{"version":3,"file":"maplibre-gl-dev.mjs","names":["v8","properties","getProperties","styleSpec","getProperties","properties","getProperties","styleSpec","getProperties","mat4.create","mat4.multiply","deserializeBucket","vec2.sqrLen","createSource","mat4.create","mat2.create","vec2.create","vec2.length","symbolSize.evaluateSizeForZoom","symbolSize.evaluateSizeForFeature","intersectionTests.polygonIntersectsPolygon","mat4.identity","projection.getPitchedLabelPlaneMatrix","symbolSize.evaluateSizeForZoom","symbolSize.evaluateSizeForFeature","preludeFrag","preludeVert","projectionMercatorFrag","projectionMercatorVert","projectionGlobeFrag","projectionGlobeVert","backgroundFrag","backgroundVert","backgroundPatternFrag","backgroundPatternVert","circleFrag","circleVert","clippingMaskFrag","clippingMaskVert","heatmapFrag","heatmapVert","heatmapTextureFrag","heatmapTextureVert","collisionBoxFrag","collisionBoxVert","collisionCircleFrag","collisionCircleVert","colorReliefFrag","colorReliefVert","debugFrag","debugVert","depthVert","fillFrag","fillVert","fillOutlineFrag","fillOutlineVert","fillOutlinePatternFrag","fillOutlinePatternVert","fillPatternFrag","fillPatternVert","fillExtrusionFrag","fillExtrusionVert","fillExtrusionPatternFrag","fillExtrusionPatternVert","hillshadePrepareFrag","hillshadePrepareVert","hillshadeFrag","hillshadeVert","lineFrag","lineVert","lineGradientFrag","lineGradientVert","linePatternFrag","linePatternVert","lineSDFFrag","lineSDFVert","lineGradientSDFFrag","lineGradientSDFVert","layerOpacityFrag","layerOpacityVert","rasterFrag","rasterVert","symbolIconFrag","symbolIconVert","symbolSDFFrag","symbolSDFVert","symbolTextAndIconFrag","symbolTextAndIconVert","terrainFrag","terrainVert","terrainDepthFrag","terrainVertDepth","terrainCoordsFrag","terrainVertCoords","atmosphereFrag","atmosphereVert","skyFrag","skyVert","interpolates","mat2.create","mat4.identity","vec3.scale","vec3.add","vec3.clone","vec3.sub","vec3.normalize","vec3.cross","vec3.dot","vec4.transformMat4","vec4.mul","vec3.length","vec3.len","vec4.scale","vec3.scale","vec3.add","interpolates","mat4.clone","mat4.scale","mat4.multiply","mat4.invert","vec4.transformMat4","vec3.clone","scale","interpolates","interpolates","styleSpec","dot","vec3.dot","vec3.len","quat.fromEuler","vec3.transformQuat","vec3.scale","vec3.dot","vec3.scale","vec3.cross","dot","vec3.dot","vec3.length","mat4.clone","vec3.dot","vec3.dot","vec3.length","interpolates","clone","diffStyles","mat3.create","mat4.create","mat4.create","ALWAYS","mat4.identity","mat4.create","mat4.identity","mat4.identity","mat4.create","mat4.exactEquals","mat4.equals","LEFT_BUTTON","RIGHT_BUTTON","defaultZoomRate","defaultOptions","defaultZoomRate","interpolates","interpolates","mat4.fromScaling","mat4.identity","version","packageJSON.version","defaultOptions","Map","defaultOptions","defaultOptions","defaultOptions","packageJSON.version"],"sources":["../package.json","../src/util/browser.ts","../src/util/time_control.ts","../src/util/dom.ts","../src/util/image_request.ts","../src/util/request_manager.ts","../src/ui/events.ts","../src/util/style.ts","../src/style/load_sprite.ts","../src/render/image_manager.ts","../src/style/load_glyph_range.ts","../node_modules/@mapbox/tiny-sdf/index.js","../src/render/glyph_manager.ts","../src/style/light_properties.g.ts","../src/style/light.ts","../src/style/sky_properties.g.ts","../src/style/sky.ts","../src/render/line_atlas.ts","../src/util/web_worker.ts","../src/util/worker_pool.ts","../src/util/global_worker_pool.ts","../src/util/dispatcher.ts","../src/source/query_features.ts","../src/source/load_tilejson.ts","../src/geo/lng_lat_bounds.ts","../src/tile/tile_bounds.ts","../src/source/vector_tile_source.ts","../src/source/raster_tile_source.ts","../src/source/raster_dem_tile_source.ts","../src/source/geojson_source_diff.ts","../src/util/geojson_bounds.ts","../src/tile/tile_id_to_lng_lat_bounds.ts","../src/source/geojson_source.ts","../src/source/image_source.ts","../src/source/video_source.ts","../src/source/canvas_source.ts","../src/source/source.ts","../src/data/bucket.ts","../src/source/rtl_text_plugin_status.ts","../src/source/rtl_text_plugin_main_thread.ts","../src/tile/tile.ts","../src/source/source_state.ts","../src/util/primitives/bounding_volume.ts","../src/geo/projection/covering_tiles.ts","../src/data/extent_bounds.ts","../src/tile/tile_manager_raster.ts","../src/tile/tile_manager_raster_dem.ts","../src/tile/tile_manager_in_view_tiles.ts","../src/tile/tile_manager.ts","../src/symbol/path_interpolator.ts","../src/symbol/grid_index.ts","../src/util/fast_maths.ts","../src/symbol/projection.ts","../src/symbol/collision_index.ts","../src/symbol/placement.ts","../src/style/pauseable_placement.ts","../node_modules/kdbush/index.js","../src/symbol/cross_tile_symbol_index.ts","../src/shaders/glsl/_prelude.fragment.glsl.g.ts","../src/shaders/glsl/_prelude.vertex.glsl.g.ts","../src/shaders/glsl/background.fragment.glsl.g.ts","../src/shaders/glsl/background.vertex.glsl.g.ts","../src/shaders/glsl/background_pattern.fragment.glsl.g.ts","../src/shaders/glsl/background_pattern.vertex.glsl.g.ts","../src/shaders/glsl/circle.fragment.glsl.g.ts","../src/shaders/glsl/circle.vertex.glsl.g.ts","../src/shaders/glsl/clipping_mask.fragment.glsl.g.ts","../src/shaders/glsl/clipping_mask.vertex.glsl.g.ts","../src/shaders/glsl/heatmap.fragment.glsl.g.ts","../src/shaders/glsl/heatmap.vertex.glsl.g.ts","../src/shaders/glsl/heatmap_texture.fragment.glsl.g.ts","../src/shaders/glsl/heatmap_texture.vertex.glsl.g.ts","../src/shaders/glsl/collision_box.fragment.glsl.g.ts","../src/shaders/glsl/collision_box.vertex.glsl.g.ts","../src/shaders/glsl/collision_circle.fragment.glsl.g.ts","../src/shaders/glsl/collision_circle.vertex.glsl.g.ts","../src/shaders/glsl/color_relief.fragment.glsl.g.ts","../src/shaders/glsl/color_relief.vertex.glsl.g.ts","../src/shaders/glsl/debug.fragment.glsl.g.ts","../src/shaders/glsl/debug.vertex.glsl.g.ts","../src/shaders/glsl/depth.vertex.glsl.g.ts","../src/shaders/glsl/fill.fragment.glsl.g.ts","../src/shaders/glsl/fill.vertex.glsl.g.ts","../src/shaders/glsl/fill_outline.fragment.glsl.g.ts","../src/shaders/glsl/fill_outline.vertex.glsl.g.ts","../src/shaders/glsl/fill_outline_pattern.fragment.glsl.g.ts","../src/shaders/glsl/fill_outline_pattern.vertex.glsl.g.ts","../src/shaders/glsl/fill_pattern.fragment.glsl.g.ts","../src/shaders/glsl/fill_pattern.vertex.glsl.g.ts","../src/shaders/glsl/fill_extrusion.fragment.glsl.g.ts","../src/shaders/glsl/fill_extrusion.vertex.glsl.g.ts","../src/shaders/glsl/fill_extrusion_pattern.fragment.glsl.g.ts","../src/shaders/glsl/fill_extrusion_pattern.vertex.glsl.g.ts","../src/shaders/glsl/hillshade_prepare.fragment.glsl.g.ts","../src/shaders/glsl/hillshade_prepare.vertex.glsl.g.ts","../src/shaders/glsl/hillshade.fragment.glsl.g.ts","../src/shaders/glsl/hillshade.vertex.glsl.g.ts","../src/shaders/glsl/line.fragment.glsl.g.ts","../src/shaders/glsl/line.vertex.glsl.g.ts","../src/shaders/glsl/line_gradient.fragment.glsl.g.ts","../src/shaders/glsl/line_gradient.vertex.glsl.g.ts","../src/shaders/glsl/line_pattern.fragment.glsl.g.ts","../src/shaders/glsl/line_pattern.vertex.glsl.g.ts","../src/shaders/glsl/line_sdf.fragment.glsl.g.ts","../src/shaders/glsl/line_sdf.vertex.glsl.g.ts","../src/shaders/glsl/line_gradient_sdf.fragment.glsl.g.ts","../src/shaders/glsl/line_gradient_sdf.vertex.glsl.g.ts","../src/shaders/glsl/layer_opacity.fragment.glsl.g.ts","../src/shaders/glsl/layer_opacity.vertex.glsl.g.ts","../src/shaders/glsl/raster.fragment.glsl.g.ts","../src/shaders/glsl/raster.vertex.glsl.g.ts","../src/shaders/glsl/symbol_icon.fragment.glsl.g.ts","../src/shaders/glsl/symbol_icon.vertex.glsl.g.ts","../src/shaders/glsl/symbol_sdf.fragment.glsl.g.ts","../src/shaders/glsl/symbol_sdf.vertex.glsl.g.ts","../src/shaders/glsl/symbol_text_and_icon.fragment.glsl.g.ts","../src/shaders/glsl/symbol_text_and_icon.vertex.glsl.g.ts","../src/shaders/glsl/terrain_depth.fragment.glsl.g.ts","../src/shaders/glsl/terrain_coords.fragment.glsl.g.ts","../src/shaders/glsl/terrain.fragment.glsl.g.ts","../src/shaders/glsl/terrain.vertex.glsl.g.ts","../src/shaders/glsl/terrain_depth.vertex.glsl.g.ts","../src/shaders/glsl/terrain_coords.vertex.glsl.g.ts","../src/shaders/glsl/_projection_mercator.vertex.glsl.g.ts","../src/shaders/glsl/_projection_mercator.fragment.glsl.g.ts","../src/shaders/glsl/_projection_globe.vertex.glsl.g.ts","../src/shaders/glsl/_projection_globe.fragment.glsl.g.ts","../src/shaders/glsl/atmosphere.fragment.glsl.g.ts","../src/shaders/glsl/atmosphere.vertex.glsl.g.ts","../src/shaders/glsl/sky.fragment.glsl.g.ts","../src/shaders/glsl/sky.vertex.glsl.g.ts","../src/shaders/shaders.ts","../src/render/mesh.ts","../src/data/pos_attributes.ts","../src/geo/projection/mercator_projection.ts","../src/geo/edge_insets.ts","../src/geo/transform_helper.ts","../src/util/primitives/aabb.ts","../src/geo/projection/mercator_covering_tiles_details_provider.ts","../src/util/primitives/frustum.ts","../src/geo/projection/mercator_transform.ts","../src/geo/projection/camera_helper.ts","../src/geo/projection/mercator_camera_helper.ts","../src/style/projection_properties.g.ts","../src/util/create_tile_mesh.ts","../src/geo/projection/vertical_perspective_projection.ts","../src/geo/projection/globe_projection.ts","../src/geo/projection/globe_utils.ts","../src/util/primitives/bounding_volume_cache.ts","../src/util/primitives/convex_volume.ts","../src/geo/projection/globe_covering_tiles_details_provider.ts","../src/geo/projection/vertical_perspective_transform.ts","../src/geo/projection/globe_transform.ts","../src/geo/projection/vertical_perspective_camera_helper.ts","../src/geo/projection/globe_camera_helper.ts","../src/geo/projection/projection_factory.ts","../src/style/style.ts","../src/data/raster_bounds_attributes.ts","../src/webgl/vertex_array_object.ts","../src/webgl/program/terrain_program.ts","../src/webgl/program/projection_program.ts","../src/webgl/program.ts","../src/webgl/program/pattern.ts","../src/webgl/program/fill_extrusion_program.ts","../src/webgl/program/fill_program.ts","../src/webgl/program/circle_program.ts","../src/webgl/program/collision_program.ts","../src/webgl/program/debug_program.ts","../src/webgl/program/heatmap_program.ts","../src/webgl/program/hillshade_program.ts","../src/webgl/program/color_relief_program.ts","../src/webgl/program/line_program.ts","../src/webgl/program/layer_opacity_program.ts","../src/webgl/program/raster_program.ts","../src/webgl/program/symbol_program.ts","../src/webgl/program/background_program.ts","../src/webgl/program/atmosphere_program.ts","../src/webgl/program/sky_program.ts","../src/webgl/program/program_uniforms.ts","../src/webgl/index_buffer.ts","../src/webgl/vertex_buffer.ts","../src/webgl/value.ts","../src/webgl/framebuffer.ts","../src/webgl/color_mode.ts","../src/webgl/context.ts","../src/webgl/depth_mode.ts","../src/webgl/stencil_mode.ts","../src/webgl/cull_face_mode.ts","../src/webgl/draw/draw_collision_debug.ts","../src/webgl/draw/draw_symbol.ts","../src/webgl/draw/draw_circle.ts","../src/webgl/draw/draw_heatmap.ts","../src/webgl/draw/draw_layer_opacity.ts","../src/webgl/draw/draw_line.ts","../src/render/update_pattern_positions_in_program.ts","../src/webgl/draw/draw_fill.ts","../src/webgl/draw/draw_fill_extrusion.ts","../src/webgl/draw/draw_hillshade.ts","../src/webgl/draw/draw_color_relief.ts","../src/webgl/draw/draw_raster.ts","../src/webgl/draw/draw_background.ts","../src/webgl/draw/draw_debug.ts","../src/webgl/draw/draw_custom.ts","../src/webgl/draw/draw_terrain.ts","../src/webgl/draw/draw_sky.ts","../src/webgl/draw/index.ts","../src/render/painter.ts","../src/util/gpu_initialization_error.ts","../src/util/throttle.ts","../src/ui/hash.ts","../src/ui/handler_inertia.ts","../src/ui/handler/map_event.ts","../src/ui/handler/box_zoom.ts","../src/ui/handler/handler_util.ts","../src/ui/handler/tap_recognizer.ts","../src/ui/handler/tap_zoom.ts","../src/ui/handler/drag_handler.ts","../src/ui/handler/drag_move_state_manager.ts","../src/ui/handler/mouse.ts","../src/ui/handler/touch_pan.ts","../src/ui/handler/two_fingers_touch.ts","../src/ui/handler/keyboard.ts","../src/ui/handler/scroll_zoom.ts","../src/ui/handler/shim/dblclick_zoom.ts","../src/ui/handler/click_zoom.ts","../src/ui/handler/tap_drag_zoom.ts","../src/ui/handler/shim/drag_pan.ts","../src/ui/handler/shim/drag_rotate.ts","../src/ui/handler/shim/two_fingers_touch.ts","../src/ui/handler/cooperative_gestures.ts","../src/ui/handler/transform-provider.ts","../src/ui/handler_manager.ts","../src/ui/camera.ts","../src/ui/control/attribution_control.ts","../src/ui/control/logo_control.ts","../src/util/task_queue.ts","../src/data/pos3d_attributes.ts","../src/tile/terrain_tile_manager.ts","../src/render/terrain.ts","../src/webgl/render_to_texture.ts","../src/ui/default_locale.ts","../src/ui/map.ts","../src/ui/control/navigation_control.ts","../src/util/geolocation_support.ts","../src/util/smart_wrap.ts","../src/ui/anchor.ts","../src/ui/marker.ts","../src/ui/control/geolocate_control.ts","../src/ui/control/scale_control.ts","../src/ui/control/fullscreen_control.ts","../src/ui/control/terrain_control.ts","../src/ui/control/globe_control.ts","../src/ui/popup.ts","../src/index.ts"],"sourcesContent":["","import {AbortError} from './abort_error.ts';\nimport {subscribe} from './util.ts';\n\nlet linkEl;\n\nlet reducedMotionQuery: MediaQueryList;\nlet reducedMotionOverride: boolean | undefined;\n\n/** */\nexport const browser = {\n    /**\n     * Schedules a callback to be invoked on the next animation frame.\n     * @param abortController - Controller to abort the scheduled frame.\n     * @param fn - Callback to invoke with the paint start timestamp.\n     * @param reject - Callback to invoke if the frame is aborted.\n     * @param targetWindow - Optional window to use for requestAnimationFrame.\n     *   When the map is rendered in a popup window or iframe, pass the owning\n     *   window to ensure animation frames continue even when the main window\n     *   is not focused.\n     */\n    frame(abortController: AbortController, fn: (paintStartTimestamp: number) => void, reject: (error: Error) => void, targetWindow?: Window): void {\n        const win = targetWindow || window;\n        const frameId = win.requestAnimationFrame((paintStartTimestamp)=>{\n            unsubscribe();\n            fn(paintStartTimestamp);\n        });\n\n        const {unsubscribe} = subscribe(abortController.signal, 'abort', () => {\n            unsubscribe();\n            win.cancelAnimationFrame(frameId);\n            reject(new AbortError(abortController.signal.reason));\n        }, false);\n    },\n\n    /**\n     * Returns a promise that resolves on the next animation frame.\n     * @param abortController - Controller to abort the scheduled frame.\n     * @param targetWindow - Optional window to use for requestAnimationFrame.\n     * @see {@link browser.frame}\n     */\n    frameAsync(abortController: AbortController, targetWindow?: Window): Promise<number> {\n        return new Promise((resolve, reject) => {\n            this.frame(abortController, resolve, reject, targetWindow);\n        });\n    },\n\n    getImageData(img:  HTMLImageElement | ImageBitmap, padding: number = 0): ImageData {\n        const context = this.getImageCanvasContext(img);\n        return context.getImageData(-padding, -padding, img.width + 2 * padding, img.height + 2 * padding);\n    },\n\n    getImageCanvasContext(img: HTMLImageElement | ImageBitmap): CanvasRenderingContext2D {\n        const canvas = window.document.createElement('canvas');\n        const context = canvas.getContext('2d', {willReadFrequently: true});\n        if (!context) {\n            throw new Error('failed to create canvas 2d context');\n        }\n        canvas.width = img.width;\n        canvas.height = img.height;\n        context.drawImage(img, 0, 0, img.width, img.height);\n        return context;\n    },\n\n    resolveURL(path: string): string {\n        linkEl ||= document.createElement('a');\n        linkEl.href = path;\n        return linkEl.href;\n    },\n\n    get hardwareConcurrency(): number {\n        return (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) || 4;\n    },\n\n    get prefersReducedMotion(): boolean {\n        if (reducedMotionOverride !== undefined) return reducedMotionOverride;\n        // In case your test crashes when checking matchMedia, call setMatchMedia from 'src/util/test/util'\n        if (!matchMedia) return false;\n        //Lazily initialize media query\n        reducedMotionQuery ??= matchMedia('(prefers-reduced-motion: reduce)');\n        return reducedMotionQuery.matches;\n    },\n\n    set prefersReducedMotion(value: boolean) {\n        reducedMotionOverride = value;\n    }\n};\n","/**\n * Manages time flow with optional freezing capability for deterministic rendering.\n */\nclass TimeManager {\n    private _frozenAt: number | null = null;\n\n    /**\n     * Gets the current time, either real or frozen.\n     * @returns Current time in milliseconds\n     */\n    getCurrentTime(): number {\n        return this._frozenAt !== null ? this._frozenAt : performance.now();\n    }\n\n    /**\n     * Sets time at a specific timestamp.\n     * @param timestamp - Time in milliseconds to set\n     */\n    setNow(timestamp: number): void {\n        this._frozenAt = timestamp;\n    }\n\n    /**\n     * Restores normal time flow.\n     */\n    restoreNow(): void {\n        this._frozenAt = null;\n    }\n\n    /**\n     * Returns whether time is currently frozen.\n     * @returns True if time is frozen, false otherwise\n     */\n    isFrozen(): boolean {\n        return this._frozenAt !== null;\n    }\n}\n\nconst timeManager = new TimeManager();\n\n/**\n * Returns the current time in milliseconds.\n * When time is frozen via setNow(), returns the frozen timestamp.\n * Otherwise returns real browser time via performance.now().\n *\n * @returns Current time in milliseconds\n * @example\n * ```ts\n * // Measure elapsed time\n * const start = maplibregl.now();\n * // ... later ...\n * const elapsed = maplibregl.now() - start;\n *\n * // During frozen time\n * maplibregl.setNow(16.67);\n * console.log(maplibregl.now()); // 16.67\n * maplibregl.restoreNow();\n * console.log(maplibregl.now()); // real time\n * ```\n */\nexport function now(): number {\n    return timeManager.getCurrentTime();\n}\n\n/**\n * Freezes time at a specific timestamp for deterministic rendering.\n * Useful for frame-by-frame video capture where each frame needs\n * a consistent time value.\n *\n * @param timestamp - Time in milliseconds to freeze at\n * @example\n * ```ts\n * // Freeze time for video export at 60fps\n * setNow(0);           // First frame\n * // ... render frame ...\n * setNow(16.67);       // Second frame\n * // ... render frame ...\n * setNow(33.34);       // Third frame\n * // ... done ...\n * restoreNow();        // Resume normal time\n * ```\n */\nexport function setNow(timestamp: number): void {\n    timeManager.setNow(timestamp);\n}\n\n/**\n * Restores normal time flow after freezing with setNow().\n * Call this after finishing deterministic rendering operations.\n *\n * @example\n * ```ts\n * // After video export, resume normal time\n * setNow(0);\n * // ... export frames ...\n * restoreNow(); // Map animations resume normally\n * ```\n */\nexport function restoreNow(): void {\n    timeManager.restoreNow();\n}\n\n/**\n * Returns whether time is currently frozen.\n * @returns True if time is frozen via setNow(), false otherwise\n * @example\n * ```ts\n * setNow(1000);\n * console.log(isTimeFrozen()); // true\n * restoreNow();\n * console.log(isTimeFrozen()); // false\n * ```\n */\nexport function isTimeFrozen(): boolean {\n    return timeManager.isFrozen();\n}","import Point from '@mapbox/point-geometry';\n\ntype ScaleReturnValue = {\n    x: number;\n    y: number;\n    boundingClientRect: DOMRect;\n};\n\nexport class DOM {\n    private static readonly docStyle = typeof window !== 'undefined' && window.document?.documentElement.style;\n\n    private static userSelect: string;\n\n    private static selectProp = !DOM.docStyle || 'userSelect' in DOM.docStyle ? 'userSelect' : 'webkitUserSelect';\n\n    public static create<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string, container?: HTMLElement): HTMLElementTagNameMap[K] {\n        const el = window.document.createElement(tagName);\n        if (className !== undefined) el.className = className;\n        if (container) container.appendChild(el);\n        return el;\n    }\n\n    public static createNS(namespaceURI: string, tagName: string): Element {\n        return window.document.createElementNS(namespaceURI, tagName);\n    }\n\n    public static disableDrag(): void {\n        if (DOM.docStyle && DOM.selectProp) {\n            DOM.userSelect = DOM.docStyle[DOM.selectProp];\n            DOM.docStyle[DOM.selectProp] = 'none';\n        }\n    }\n\n    public static enableDrag(): void {\n        if (DOM.docStyle && DOM.selectProp) {\n            DOM.docStyle[DOM.selectProp] = DOM.userSelect;\n        }\n    }\n\n    // Suppress the next click, but only if it's immediate.\n    private static suppressClickInternal(e) {\n        e.preventDefault();\n        e.stopPropagation();\n        window.removeEventListener('click', DOM.suppressClickInternal, true);\n    }\n\n    public static suppressClick(): void {\n        window.addEventListener('click', DOM.suppressClickInternal, true);\n        window.setTimeout(() => {\n            window.removeEventListener('click', DOM.suppressClickInternal, true);\n        }, 0);\n    }\n\n    private static getScale(element: HTMLElement): ScaleReturnValue {\n        const rect = element.getBoundingClientRect();\n        return {\n            x: (rect.width / element.offsetWidth) || 1,\n            y: (rect.height / element.offsetHeight) || 1,\n            boundingClientRect: rect,\n        };\n    }\n\n    private static getPoint(el: HTMLElement, scale: ScaleReturnValue, e: MouseEvent | Touch): Point {\n        const rect = scale.boundingClientRect;\n        return new Point(\n            // rect.left/top values are in page scale (like clientX/Y),\n            // whereas clientLeft/Top (border width) values are the original values (before CSS scale applies).\n            ((e.clientX - rect.left) / scale.x) - el.clientLeft,\n            ((e.clientY - rect.top) / scale.y) - el.clientTop\n        );\n    }\n\n    public static mousePos(el: HTMLElement, e: MouseEvent | Touch): Point {\n        const scale = DOM.getScale(el);\n        return DOM.getPoint(el, scale, e);\n    }\n\n    public static touchPos(el: HTMLElement, touches: TouchList): Point[] {\n        const points: Point[] = [];\n        const scale = DOM.getScale(el);\n        for (const touch of touches) {\n            points.push(DOM.getPoint(el, scale, touch));\n        }\n        return points;\n    }\n\n    /**\n     * Sanitize an HTML string - this might not be enough to prevent all XSS attacks\n     * Base on https://javascriptsource.com/sanitize-an-html-string-to-reduce-the-risk-of-xss-attacks/\n     * (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com\n     */\n    public static sanitize(str: string): string {\n        const parser = new DOMParser();\n        const doc = parser.parseFromString(str, 'text/html');\n        const html = doc.body || document.createElement('body');\n        const scripts = html.querySelectorAll('script');\n        for (const script of scripts) {\n            script.remove();\n        }\n\n        DOM.clean(html);\n\n        return html.innerHTML;\n    }\n\n    /**\n     * Check if the attribute is potentially dangerous\n     */\n    private static isPossiblyDangerous(name: string, value: string): boolean {\n        const val = value.replace(/\\s+/g, '').toLowerCase();\n        if (['src', 'href', 'xlink:href'].includes(name)) {\n            if (val.includes('javascript:') || val.includes('data:')) return true;\n        }\n        if (name.startsWith('on')) return true;\n    }\n\n    /**\n\t * Remove dangerous stuff from the HTML document's nodes\n\t * @param html - The HTML document\n\t */\n    private static clean(html: Element) {\n        const nodes = html.children;\n        for (const node of nodes) {\n            DOM.removeAttributes(node);\n            DOM.clean(node);\n        }\n    }\n\n    /**\n\t * Remove potentially dangerous attributes from an element\n\t * @param elem - The element\n\t */\n    private static removeAttributes(elem: Element) {\n        for (const {name, value} of elem.attributes) {\n            if (!DOM.isPossiblyDangerous(name, value)) continue;\n            elem.removeAttribute(name);\n        }\n    }\n}\n","import {type RequestParameters, makeRequest, sameOrigin, type GetResourceResponse} from './ajax.ts';\nimport {arrayBufferToImageBitmap, arrayBufferToImage, ensureError, extend, isWorker, isImageBitmap} from './util.ts';\nimport {config} from './config.ts';\nimport {AbortError} from './abort_error.ts';\nimport {getProtocol} from '../source/protocol_crud.ts';\n\ntype ImageQueueThrottleControlCallback = () => boolean;\n\nexport type ImageRequestQueueItem  = {\n    requestParameters: RequestParameters;\n    supportImageRefresh: boolean;\n    imageBitmapOptions?: ImageBitmapOptions;\n    state: 'queued' | 'running' | 'completed';\n    abortController: AbortController;\n    onError: (error: Error) => void;\n    onSuccess: (response: GetResourceResponse<HTMLImageElement | ImageBitmap | null>) => void;\n};\n\ntype ImageQueueThrottleCallbackDictionary = {\n    [Key: number]: ImageQueueThrottleControlCallback;\n};\n\ntype HTMLImageElementWithPriority = HTMLImageElement &\n{\n    // fetchPriority is experimental property supported on Chromium browsers from Version 102\n    // By default images are downloaded with priority low, whereas fetch request downloads with priority high\n    // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority\n    fetchPriority?: 'auto' | 'high' | 'low';\n};\n\n/**\n * By default, the image queue is self driven, meaning as soon as one requested item is processed,\n * it will move on to next one as quickly as it can while limiting\n * the number of concurrent requests to MAX_PARALLEL_IMAGE_REQUESTS. The default behavior\n * ensures that static views of the map can be rendered with minimal delay.\n *\n * However, the default behavior can prevent dynamic views of the map from rendering\n * smoothly in that many requests can finish in one render frame, putting too much pressure on GPU.\n *\n * When the view of the map is moving dynamically, smoother frame rates can be achieved\n * by throttling the number of items processed by the queue per frame. This can be\n * accomplished by using {@link addThrottleControl} to allow the caller to\n * use a lambda function to determine when the queue should be throttled (e.g. when isMoving())\n * and manually calling {@link processQueue} in the render loop.\n */\nexport namespace ImageRequest {\n    let imageRequestQueue : ImageRequestQueueItem[];\n    let currentParallelImageRequests:number;\n\n    let throttleControlCallbackHandleCounter: number;\n    let throttleControlCallbacks: ImageQueueThrottleCallbackDictionary;\n\n    /**\n     * Reset the image request queue, removing all pending requests.\n     */\n    export const resetRequestQueue = (): void => {\n        imageRequestQueue = [];\n        currentParallelImageRequests = 0;\n        throttleControlCallbackHandleCounter = 0;\n        throttleControlCallbacks = {};\n    };\n\n    /**\n     * Install a callback to control when image queue throttling is desired.\n     * (e.g. when the map view is moving)\n     * @param callback - The callback function to install\n     * @returns handle that identifies the installed callback.\n     */\n    export const addThrottleControl = (callback: ImageQueueThrottleControlCallback): number => {\n        const handle = throttleControlCallbackHandleCounter++;\n        throttleControlCallbacks[handle] = callback;\n        return handle;\n    };\n\n    /**\n     * Remove a previously installed callback by passing in the handle returned\n     * by {@link addThrottleControl}.\n     * @param callbackHandle - The handle for the callback to remove.\n     */\n    export const removeThrottleControl = (callbackHandle: number): void => {\n        delete throttleControlCallbacks[callbackHandle];\n        // Try updating the queue\n        processQueue();\n    };\n\n    /**\n     * Check to see if any of the installed callbacks are requesting the queue\n     * to be throttled.\n     * @returns `true` if any callback is causing the queue to be throttled.\n     */\n    const isThrottled = (): boolean => {\n        for (const key of Object.keys(throttleControlCallbacks)) {\n            if (throttleControlCallbacks[key]()) {\n                return true;\n            }\n        }\n        return false;\n    };\n\n    /**\n     * Request to load an image.\n     * @param requestParameters - Request parameters.\n     * @param abortController - allows to abort the request.\n     * @param supportImageRefresh - `true`, if the image request need to support refresh based on cache headers.\n     * @returns - A promise resolved when the image is loaded.\n     */\n    export const getImage = (\n        requestParameters: RequestParameters,\n        abortController: AbortController,\n        supportImageRefresh: boolean = true,\n        imageBitmapOptions?: ImageBitmapOptions\n    ): Promise<GetResourceResponse<HTMLImageElement | ImageBitmap | null>> => {\n        return new Promise<GetResourceResponse<HTMLImageElement | ImageBitmap | null>>((resolve, reject) => {\n            requestParameters.headers ||= {};\n            requestParameters.headers.accept = 'image/webp,*/*';\n            extend(requestParameters, {type: 'image'});\n            const request: ImageRequestQueueItem = {\n                abortController,\n                requestParameters,\n                supportImageRefresh,\n                imageBitmapOptions,\n                state: 'queued',\n                onError: (error: Error) => {\n                    reject(error);\n                },\n                onSuccess: (response) => {\n                    resolve(response);\n                }\n            };\n\n            imageRequestQueue.push(request);\n            processQueue();\n        });\n    };\n\n    const arrayBufferToCanvasImageSource = (data: ArrayBuffer, imageBitmapOptions?: ImageBitmapOptions): Promise<HTMLImageElement | ImageBitmap | null> => {\n        const imageBitmapSupported = typeof createImageBitmap === 'function';\n        if (imageBitmapSupported) {\n            return arrayBufferToImageBitmap(data, imageBitmapOptions);\n        } else {\n            return arrayBufferToImage(data);\n        }\n    };\n\n    const doImageRequest = async (itemInQueue: ImageRequestQueueItem) => {\n        itemInQueue.state = 'running';\n        const {requestParameters, supportImageRefresh, imageBitmapOptions, onError, onSuccess, abortController} = itemInQueue;\n        // - If refreshExpiredTiles is false, then we can use HTMLImageElement to download raster images.\n        // - Fetch/XHR (via MakeRequest API) will be used to download images for following scenarios:\n        //      1. Style image sprite will had a issue with HTMLImageElement as described\n        //          here: https://github.com/mapbox/mapbox-gl-js/issues/1470\n        //      2. If refreshExpiredTiles is true (default), then in order to read the image cache header,\n        //          fetch/XHR request will be required\n        // - For any special case handling like use of AddProtocol, worker initiated request or additional headers\n        //      let makeRequest handle it.\n        // - HtmlImageElement request automatically adds accept header for all the browser supported images\n        const canUseHTMLImageElement = supportImageRefresh === false &&\n            !imageBitmapOptions &&\n            !isWorker(self) &&\n            !getProtocol(requestParameters.url) &&\n            (!requestParameters.headers ||\n                Object.keys(requestParameters.headers).reduce((acc, item) => acc && item === 'accept', true));\n\n        currentParallelImageRequests++;\n\n        const getImagePromise = canUseHTMLImageElement ?\n            getImageUsingHtmlImage(requestParameters, abortController) :\n            makeRequest(requestParameters, abortController);\n\n        try {\n            const response = await getImagePromise;\n            delete itemInQueue.abortController;\n            itemInQueue.state = 'completed';\n            if (response.data instanceof HTMLImageElement || isImageBitmap(response.data)) {\n                // User using addProtocol can directly return HTMLImageElement/ImageBitmap type\n                // If HtmlImageElement is used to get image then response type will be HTMLImageElement\n                onSuccess(response);\n            } else if (response.data) {\n                const img = await arrayBufferToCanvasImageSource(response.data, imageBitmapOptions);\n                onSuccess({data: img, cacheControl: response.cacheControl, expires: response.expires});\n            }\n        } catch (err) {\n            delete itemInQueue.abortController;\n            onError(ensureError(err));\n        } finally {\n            currentParallelImageRequests--;\n            processQueue();\n        }\n    };\n\n    /**\n     * Process some number of items in the image request queue.\n     */\n    const processQueue = (): void => {\n\n        const maxImageRequests = isThrottled() ?\n            config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME :\n            config.MAX_PARALLEL_IMAGE_REQUESTS;\n\n        // limit concurrent image loads to help with raster sources performance on big screens\n        for (let numImageRequests = currentParallelImageRequests;\n            numImageRequests < maxImageRequests && imageRequestQueue.length > 0;\n            numImageRequests++) {\n\n            const topItemInQueue: ImageRequestQueueItem = imageRequestQueue.shift();\n            if (topItemInQueue.abortController.signal.aborted) {\n                numImageRequests--;\n                continue;\n            }\n            doImageRequest(topItemInQueue);\n        }\n    };\n\n    const getImageUsingHtmlImage = (requestParameters: RequestParameters, abortController: AbortController): Promise<GetResourceResponse<HTMLImageElement | ImageBitmap | null>>  => {\n        return new Promise<GetResourceResponse<HTMLImageElement | ImageBitmap | null>>((resolve, reject) => {\n\n            const image = new Image() as HTMLImageElementWithPriority;\n            const url = requestParameters.url;\n            const credentials = requestParameters.credentials;\n            if (credentials && credentials === 'include') {\n                image.crossOrigin = 'use-credentials';\n            } else if ((credentials && credentials === 'same-origin') || !sameOrigin(url)) {\n                image.crossOrigin = 'anonymous';\n            }\n\n            abortController.signal.addEventListener('abort', () => {\n                // Set src to '' to actually cancel the request\n                image.src = '';\n                reject(new AbortError(abortController.signal.reason));\n            });\n\n            image.fetchPriority = 'high';\n            image.onload = () => {\n                image.onerror = image.onload = null;\n                resolve({data: image});\n            };\n            image.onerror = () => {\n                image.onerror = image.onload = null;\n                if (abortController.signal.aborted) {\n                    return;\n                }\n                reject(new Error('Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.'));\n            };\n            image.src = url;\n        });\n    };\n}\n\nImageRequest.resetRequestQueue();\n","import type {RequestParameters} from './ajax.ts';\n\n/**\n * A type of MapLibre resource.\n */\nexport const enum ResourceType {\n    Glyphs = 'Glyphs',\n    Image = 'Image',\n    Source = 'Source',\n    SpriteImage = 'SpriteImage',\n    SpriteJSON = 'SpriteJSON',\n    Style = 'Style',\n    Tile = 'Tile',\n    Unknown = 'Unknown',\n}\n\n/**\n * This function is used to transform a request.\n * It is used just before executing the relevant request.\n */\nexport type RequestTransformFunction = (url: string, resourceType?: ResourceType) => RequestParameters | Promise<RequestParameters> | undefined;\n\nexport class RequestManager {\n    _transformRequestFn: RequestTransformFunction | null;\n\n    constructor(transformRequestFn?: RequestTransformFunction | null) {\n        this._transformRequestFn = transformRequestFn ?? null;\n    }\n\n    transformRequest(url: string, type: ResourceType): RequestParameters | Promise<RequestParameters> {\n        if (this._transformRequestFn) {\n            return this._transformRequestFn(url, type) || {url};\n        }\n\n        return {url};\n    }\n\n    setTransformRequest(transformRequest: RequestTransformFunction | null): void {\n        this._transformRequestFn = transformRequest;\n    }\n}\n\n","import {Event} from '../util/evented.ts';\n\nimport {DOM} from '../util/dom.ts';\nimport Point from '@mapbox/point-geometry';\nimport {extend} from '../util/util.ts';\nimport type {MapGeoJSONFeature} from '../util/vectortile_to_geojson.ts';\n\nimport type {Map} from './map.ts';\nimport type {LngLat} from '../geo/lng_lat.ts';\nimport type {ProjectionSpecification, SourceSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {GeoJSONSourceShouldReloadTileOptions} from '../source/geojson_source.ts';\nimport type {OverscaledTileID} from '../tile/tile_id.ts';\n\n/**\n * An event from the mouse relevant to a specific layer.\n *\n * @group Event Related\n */\nexport type MapLayerMouseEvent = MapMouseEvent & { features?: MapGeoJSONFeature[] };\n\n/**\n * An event from a touch device relevant to a specific layer.\n *\n * @group Event Related\n */\nexport type MapLayerTouchEvent = MapTouchEvent & { features?: MapGeoJSONFeature[] };\n\n/**\n * The source event data type\n */\nexport type MapSourceDataType = 'content' | 'metadata' | 'visibility' | 'idle';\n\n/**\n * `MapLayerEventType` - a mapping between the event name and the event.\n * !!! note\n *     These events are compatible with the optional `layerId` parameter.\n * If `layerId` is included as the second argument in {@link Map.on}, the event listener will fire only when the\n * event action contains a visible portion of the specified layer.\n * The following example can be used for all the events.\n *\n * @group Event Related\n * @example\n * ```ts\n * // Initialize the map\n * let map = new Map({ // map options });\n * // Set an event listener for a specific layer\n * map.on('the-event-name', 'poi-label', (e) => {\n *   console.log('An event has occurred on a visible portion of the poi-label layer');\n * });\n * ```\n */\nexport type MapLayerEventType = {\n    /**\n     * Fired when a pointing device (usually a mouse) is pressed and released contains a visible portion of the specified layer.\n     *\n     * @see [Measure distances](https://maplibre.org/maplibre-gl-js/docs/examples/measure-distances/)\n     * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js/docs/examples/center-the-map-on-a-clicked-symbol/)\n     */\n    click: MapLayerMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is pressed and released twice contains a visible portion of the specified layer.\n     *\n     * !!! note\n     *     Under normal conditions, this event will be preceded by two `click` events.\n     */\n    dblclick: MapLayerMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is pressed while inside a visible portion of the specified layer.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    mousedown: MapLayerMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is released while inside a visible portion of the specified layer.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    mouseup: MapLayerMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is moved while the cursor is inside a visible portion of the specified layer.\n     * As you move the cursor across the layer, the event will fire every time the cursor changes position within that layer.\n     *\n     * @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-coordinates-of-the-mouse-pointer/)\n     * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-hover-effect/)\n     * @see [Display a popup on over](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n     * @see [Animate symbol to follow the mouse](https://maplibre.org/maplibre-gl-js/docs/examples/animate-symbol-to-follow-the-mouse/)\n     */\n    mousemove: MapLayerMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) enters a visible portion of a specified layer from\n     * outside that layer or outside the map canvas.\n     *\n     * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js/docs/examples/center-the-map-on-a-clicked-symbol/)\n     * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-click/)\n     */\n    mouseenter: MapLayerMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) leaves a visible portion of a specified layer, or leaves\n     * the map canvas.\n     *\n     * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-hover-effect/)\n     * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-click/)\n     */\n    mouseleave: MapLayerMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is moved inside a visible portion of the specified layer.\n     *\n     * @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-coordinates-of-the-mouse-pointer/)\n     * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-hover-effect/)\n     * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n     */\n    mouseover: MapLayerMouseEvent;\n    /**\n     * Fired when a point device (usually a mouse) leaves the visible portion of the specified layer.\n     */\n    mouseout: MapLayerMouseEvent;\n    /**\n     * Fired when the right button of the mouse is clicked or the context menu key is pressed within visible portion of the specified layer.\n     */\n    contextmenu: MapLayerMouseEvent;\n    /**\n     * Fired when a [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart) event occurs within the visible portion of the specified layer.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    touchstart: MapLayerTouchEvent;\n    /**\n     * Fired when a [`touchend`](https://developer.mozilla.org/en-US/docs/Web/Events/touchend) event occurs within the visible portion of the specified layer.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    touchend: MapLayerTouchEvent;\n    /**\n     * Fired when a [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart) event occurs within the visible portion of the specified layer.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    touchcancel: MapLayerTouchEvent;\n};\n\n/**\n * `MapEventType` - a mapping between the event name and the event value.\n * These events are used with the {@link Map.on} method.\n * When using a `layerId` with {@link Map.on} method, please refer to {@link MapLayerEventType}.\n * The following example can be used for all the events.\n *\n * @group Event Related\n * @example\n * ```ts\n * // Initialize the map\n * let map = new Map({ // map options });\n * // Set an event listener\n * map.on('the-event-name', () => {\n *   console.log('An event has occurred!');\n * });\n * ```\n */\nexport type MapEventType = {\n    /**\n     * Fired when an error occurs. This is GL JS's primary error reporting\n     * mechanism. We use an event instead of `throw` to better accommodate\n     * asynchronous operations. If no listeners are bound to the `error` event, the\n     * error will be printed to the console.\n     */\n    error: ErrorEvent;\n    /**\n     * Fired immediately after all necessary resources have been downloaded\n     * and the first visually complete rendering of the map has occurred.\n     *\n     * @see [Draw GeoJSON points](https://maplibre.org/maplibre-gl-js/docs/examples/draw-geojson-points/)\n     * @see [Add live realtime data](https://maplibre.org/maplibre-gl-js/docs/examples/add-live-realtime-data/)\n     * @see [Animate a point](https://maplibre.org/maplibre-gl-js/docs/examples/animate-a-point/)\n     */\n    load: MapLibreEvent;\n    /**\n     * Fired after the last frame rendered before the map enters an\n     * \"idle\" state:\n     *\n     * - No camera transitions are in progress\n     * - All currently requested tiles have loaded\n     * - All fade/transition animations have completed\n     */\n    idle: MapLibreEvent;\n    /**\n     * Fired immediately after the map has been removed with {@link Map.remove}.\n     */\n    remove: MapLibreEvent;\n    /**\n     * Fired whenever the map is drawn to the screen, as the result of\n     *\n     * - a change to the map's position, zoom, pitch, or bearing\n     * - a change to the map's style\n     * - a change to a GeoJSON source\n     * - the loading of a vector tile, GeoJSON file, glyph, or sprite\n     */\n    render: MapLibreEvent;\n    /**\n     * Fired immediately after the map has been resized.\n     */\n    resize: MapLibreEvent;\n    /**\n     * Fired when the WebGL context is lost.\n     */\n    webglcontextlost: MapContextEvent;\n    /**\n     * Fired when the WebGL context is restored.\n     */\n    webglcontextrestored: MapContextEvent;\n    /**\n     * Fired when any map data (style, source, tile, etc) begins loading or\n     * changing asynchronously. All `dataloading` events are followed by a `data`,\n     * `dataabort` or `error` event.\n     */\n    dataloading: MapSourceDataEvent | MapStyleDataEvent;\n    /**\n     * Fired when any map data loads or changes. See {@link MapSourceDataEvent} and {@link MapStyleDataEvent} for more information.\n     * @see [Display HTML clusters with custom properties](https://maplibre.org/maplibre-gl-js/docs/examples/display-html-clusters-with-custom-properties/)\n     */\n    data: MapSourceDataEvent | MapStyleDataEvent;\n    /**\n     * Fired when one of the map's sources begins loading or changing asynchronously.\n     * All `sourcedataloading` events are followed by a `sourcedata`, `sourcedataabort` or `error` event.\n     */\n    sourcedataloading: MapSourceDataEvent;\n    /**\n     * Fired when the map's style begins loading or changing asynchronously.\n     * All `styledataloading` events are followed by a `styledata`\n     * or `error` event.\n     */\n    styledataloading: MapStyleDataEvent;\n    /**\n     * Fired when one of the map's sources loads or changes, including if a tile belonging\n     * to a source loads or changes.\n     */\n    sourcedata: MapSourceDataEvent;\n    /**\n     * Fired when the map's style loads or changes.\n     */\n    styledata: MapStyleDataEvent;\n    /**\n     * Fired once the map's style has fully loaded or changed, after all\n     * necessary resources referenced by the style have been requested.\n     */\n    'style.load': MapStyleLoadEvent;\n    /**\n     * Fired when an icon or pattern needed by the style is missing and no missing style image resolver\n     * supplies it. To load or generate images on demand, use {@link Map.setMissingStyleImageResolver}.\n     * Event listeners cannot resolve the missing image for the current request.\n     * @see [Generate and add a missing icon to the map](https://maplibre.org/maplibre-gl-js/docs/examples/generate-and-add-a-missing-icon-to-the-map/)\n     */\n    styleimagemissing: MapStyleImageMissingEvent;\n    /**\n     * Fired when a request for one of the map's sources' tiles or data is aborted.\n     */\n    dataabort: MapSourceDataEvent;\n    /**\n     * Fired when a request for one of the map's sources' data is aborted.\n     */\n    sourcedataabort: MapSourceDataEvent;\n    /**\n     * Fired when the user cancels a \"box zoom\" interaction, or when the bounding box does not meet the minimum size threshold.\n     * See {@link BoxZoomHandler}.\n     */\n    boxzoomcancel: MapBoxZoomEvent;\n    /**\n     * Fired when a \"box zoom\" interaction starts. See {@link BoxZoomHandler}.\n     */\n    boxzoomstart: MapBoxZoomEvent;\n    /**\n     * Fired when a \"box zoom\" interaction ends.  See {@link BoxZoomHandler}.\n     */\n    boxzoomend: MapBoxZoomEvent;\n    /**\n     * Fired when a [`touchcancel`](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel) event occurs within the map.\n     */\n    touchcancel: MapTouchEvent;\n    /**\n     * Fired when a [`touchmove`](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove) event occurs within the map.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    touchmove: MapTouchEvent;\n    /**\n     * Fired when a [`touchend`](https://developer.mozilla.org/en-US/docs/Web/Events/touchend) event occurs within the map.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    touchend: MapTouchEvent;\n    /**\n     * Fired when a [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart) event occurs within the map.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    touchstart: MapTouchEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is pressed and released at the same point on the map.\n     *\n     * @see [Measure distances](https://maplibre.org/maplibre-gl-js/docs/examples/measure-distances/)\n     * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js/docs/examples/center-the-map-on-a-clicked-symbol/)\n     */\n    click: MapMouseEvent;\n    /**\n     * Fired when the right button of the mouse is clicked or the context menu key is pressed within the map.\n     */\n    contextmenu: MapMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is pressed and released twice at the same point on the map in rapid succession.\n     *\n     * !!! note\n     *     Under normal conditions, this event will be preceded by two `click` events.\n     */\n    dblclick: MapMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is moved while the cursor is inside the map.\n     * As you move the cursor across the map, the event will fire every time the cursor changes position within the map.\n     *\n     * @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-coordinates-of-the-mouse-pointer/)\n     * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-hover-effect/)\n     * @see [Display a popup on over](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n     */\n    mousemove: MapMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is released within the map.\n     *\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    mouseup: MapMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is pressed within the map.\n     *\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    mousedown: MapMouseEvent;\n    /**\n     * Fired when a point device (usually a mouse) leaves the map's canvas.\n     */\n    mouseout: MapMouseEvent;\n    /**\n     * Fired when a pointing device (usually a mouse) is moved within the map.\n     * As you move the cursor across a web page containing a map,\n     * the event will fire each time it enters the map or any child elements.\n     *\n     * @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-coordinates-of-the-mouse-pointer/)\n     * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-hover-effect/)\n     * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n     */\n    mouseover: MapMouseEvent;\n    /**\n     * Fired just before the map begins a transition from one\n     * view to another, as the result of either user interaction or methods such as {@link Map.jumpTo}.\n     *\n     */\n    movestart: MapMovementEvent;\n    /**\n     * Fired repeatedly during an animated transition from one view to\n     * another, as the result of either user interaction or methods such as {@link Map.flyTo}.\n     *\n     * @see [Display HTML clusters with custom properties](https://maplibre.org/maplibre-gl-js/docs/examples/display-html-clusters-with-custom-properties/)\n     */\n    move: MapMovementEvent;\n    /**\n     * Fired just after the map completes a transition from one\n     * view to another, as the result of either user interaction or methods such as {@link Map.jumpTo}.\n     *\n     * @see [Display HTML clusters with custom properties](https://maplibre.org/maplibre-gl-js/docs/examples/display-html-clusters-with-custom-properties/)\n     */\n    moveend: MapMovementEvent;\n    /**\n     * Fired just before the map begins a transition from one zoom level to another,\n     * as the result of either user interaction or methods such as {@link Map.flyTo}.\n     */\n    zoomstart: MapMovementEvent;\n    /**\n     * Fired repeatedly during an animated transition from one zoom level to another,\n     * as the result of either user interaction or methods such as {@link Map.flyTo}.\n     */\n    zoom: MapMovementEvent;\n    /**\n     * Fired just after the map completes a transition from one zoom level to another,\n     * as the result of either user interaction or methods such as {@link Map.flyTo}.\n     */\n    zoomend: MapMovementEvent;\n    /**\n     * Fired when a \"drag to rotate\" interaction starts. See {@link DragRotateHandler}.\n     */\n    rotatestart: MapMovementEvent;\n    /**\n     * Fired repeatedly during a \"drag to rotate\" interaction. See {@link DragRotateHandler}.\n     */\n    rotate: MapMovementEvent;\n    /**\n     * Fired when a \"drag to rotate\" interaction ends. See {@link DragRotateHandler}.\n     */\n    rotateend: MapMovementEvent;\n    /**\n     * Fired when a \"drag to pan\" interaction starts. See {@link DragPanHandler}.\n     */\n    dragstart: MapMovementEvent;\n    /**\n     * Fired repeatedly during a \"drag to pan\" interaction. See {@link DragPanHandler}.\n     */\n    drag: MapMovementEvent;\n    /**\n     * Fired when a \"drag to pan\" interaction ends. See {@link DragPanHandler}.\n     * @see [Create a draggable marker](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-marker/)\n     */\n    dragend: MapMovementEvent;\n    /**\n     * Fired whenever the map's pitch (tilt) begins a change as\n     * the result of either user interaction or methods such as {@link Map.flyTo} .\n     */\n    pitchstart: MapMovementEvent;\n    /**\n     * Fired repeatedly during the map's pitch (tilt) animation between\n     * one state and another as the result of either user interaction\n     * or methods such as {@link Map.flyTo}.\n     */\n    pitch: MapMovementEvent;\n    /**\n     * Fired immediately after the map's pitch (tilt) finishes changing as\n     * the result of either user interaction or methods such as {@link Map.flyTo}.\n     */\n    pitchend: MapMovementEvent;\n    /**\n     * Fired whenever the map's roll begins a change as\n     * the result of either user interaction or methods such as {@link Map.flyTo}.\n     */\n    rollstart: MapMovementEvent;\n    /**\n     * Fired repeatedly during the map's roll animation between\n     * one state and another as the result of either user interaction\n     * or methods such as {@link Map.flyTo}.\n     */\n    roll: MapMovementEvent;\n    /**\n     * Fired immediately after the map's roll finishes changing as\n     * the result of either user interaction or methods such as {@link Map.flyTo}.\n     */\n    rollend: MapMovementEvent;\n    /**\n     * Fired when a [`wheel`](https://developer.mozilla.org/en-US/docs/Web/Events/wheel) event occurs within the map.\n     */\n    wheel: MapWheelEvent;\n    /**\n     * Fired when terrain is changed\n     */\n    terrain: MapTerrainEvent;\n    /**\n     * Fired whenever the cooperativeGestures option prevents a gesture from being handled by the map.\n     * This is useful for showing your own UI when this happens.\n     */\n    cooperativegestureprevented: MapLibreEvent<WheelEvent | TouchEvent> & {\n        gestureType: 'wheel_zoom' | 'touch_pan';\n    };\n    /**\n     * Fired when map's projection is modified in other ways than by map being moved.\n     */\n    projectiontransition: MapProjectionEvent;\n};\n\n/**\n * `SourceEventType` - a mapping between the source data event names and their event value.\n * These are the events fired by a {@link Source} as its data loads or changes; they also bubble\n * up to the {@link Map}. See {@link MapSourceDataEvent} for the event shape.\n *\n * @group Event Related\n */\nexport type SourceEventType = {\n    /**\n     * Fired when the source's data loads or changes.\n     */\n    data: MapSourceDataEvent;\n    /**\n     * Fired when the source begins loading or changing data.\n     */\n    dataloading: MapSourceDataEvent;\n    /**\n     * Fired when a request for the source's data is aborted.\n     */\n    dataabort: MapSourceDataEvent;\n    /**\n     * Fired when there's an error\n     */ \n    error: ErrorEvent;\n};\n\n/**\n * The base event for MapLibre\n *\n * @group Event Related\n */\nexport class MapLibreEvent<TOrig = unknown> extends Event {\n    type: keyof MapEventType | keyof MapLayerEventType;\n    target: Map;\n    originalEvent: TOrig;\n}\n\n/**\n * `MapMovementEvent` is the event type for the camera-transition map events:\n * `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `rotatestart`, `rotate`, `rotateend`,\n * `dragstart`, `drag`, `dragend`, `pitchstart`, `pitch`, `pitchend`, `rollstart`, `roll` and `rollend`.\n * These are fired as the map's view changes, as a result of either user interaction or methods such\n * as {@link Map.jumpTo} / {@link Map.flyTo}.\n *\n * @group Event Related\n */\nexport class MapMovementEvent extends MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined> {\n    type: 'movestart' | 'move' | 'moveend' | 'zoomstart' | 'zoom' | 'zoomend' |\n    'rotatestart' | 'rotate' | 'rotateend' | 'dragstart' | 'drag' | 'dragend' |\n    'pitchstart' | 'pitch' | 'pitchend' | 'rollstart' | 'roll' | 'rollend';\n}\n\n/**\n * The `style.load` event, fired once the map's style has fully loaded or changed.\n *\n * @group Event Related\n */\nexport class MapStyleLoadEvent extends MapLibreEvent {\n    type: 'style.load';\n\n    constructor(data: any = {}) {\n        super('style.load', data);\n    }\n}\n\n/**\n * The style data event\n *\n * @group Event Related\n */\nexport class MapStyleDataEvent extends MapLibreEvent {\n    type: 'data' | 'dataloading' | 'styledata' | 'styledataloading';\n    dataType: 'style';\n\n    constructor(type: MapStyleDataEvent['type'], data: Omit<Partial<MapStyleDataEvent>, 'type' | 'dataType' | 'target'> = {}) {\n        super(type, data);\n        this.dataType = 'style';\n    }\n}\n\n/**\n * A `MapSourceDataEvent` is emitted with the source-related `data`, `dataloading`, `dataabort`,\n * `sourcedata`, `sourcedataloading` and `sourcedataabort` events. Its `dataType` is always `'source'`.\n *\n * Possible values for `sourceDataType`s are:\n *\n * - `'metadata'`: indicates that any necessary source metadata has been loaded (such as TileJSON) and it is ok to start loading tiles\n * - `'content'`: indicates the source data has changed (such as when source.setData() has been called on GeoJSONSource)\n * - `'visibility'`: send when the source becomes used when at least one of its layers becomes visible in style sense (inside the layer's zoom range and with layout.visibility set to 'visible')\n * - `'idle'`: indicates that no new source data has been fetched (but the source has done loading)\n *\n * @group Event Related\n *\n * @example\n * ```ts\n * // The sourcedata event is an example of a MapSourceDataEvent.\n * // Set up an event listener on the map.\n * map.on('sourcedata', (e) => {\n *    if (e.isSourceLoaded) {\n *        // Do something when the source has finished loading\n *    }\n * });\n * ```\n */\nexport class MapSourceDataEvent extends MapLibreEvent {\n    type: 'data' | 'dataloading' | 'dataabort' | 'sourcedata' | 'sourcedataloading' | 'sourcedataabort';\n    dataType: 'source';\n    /**\n     * True if the event has a `dataType` of `source` and the source has no outstanding network requests.\n     */\n    isSourceLoaded: boolean;\n    /**\n     * The [style spec representation of the source](https://maplibre.org/maplibre-style-spec/#sources) if the event has a `dataType` of `source`.\n     */\n    source: SourceSpecification;\n    sourceId: string;\n    sourceDataType: MapSourceDataType;\n    sourceDataChanged?: boolean;\n    /**\n     * The tile being loaded or changed, if the event has a `dataType` of `source` and\n     * the event is related to loading of a tile.\n     */\n    tile: any;\n    /**\n     * The tile ID of the tile being loaded or changed, if the event is related to loading of a tile.\n     */\n    coord: OverscaledTileID;\n    /**\n     * Resource timing data, if `collectResourceTiming` is enabled for the source.\n     */\n    resourceTiming?: PerformanceResourceTiming[];\n\n    /**\n     * Options to determine whether a tile should be reloaded.\n     * @internal\n     */\n    shouldReloadTileOptions: GeoJSONSourceShouldReloadTileOptions;\n\n    constructor(type: MapSourceDataEvent['type'], data: Omit<Partial<MapSourceDataEvent>, 'type' | 'dataType' | 'target'> = {}) {\n        super(type, data);\n        this.dataType = 'source';\n    }\n};\n/**\n * `MapMouseEvent` is the event type for mouse-related map events.\n *\n * @group Event Related\n *\n * @example\n * ```ts\n * // The `click` event is an example of a `MapMouseEvent`.\n * // Set up an event listener on the map.\n * map.on('click', (e) => {\n *   // The event object (e) contains information like the\n *   // coordinates of the point on the map that was clicked.\n *   console.log('A click event has occurred at ' + e.lngLat);\n * });\n * ```\n */\nexport class MapMouseEvent extends MapLibreEvent<MouseEvent> {\n    /**\n     * The event type\n     */\n    type: 'mousedown' | 'mouseup' | 'click' | 'dblclick' | 'mousemove' | 'mouseover' | 'mouseenter' | 'mouseleave' | 'mouseout' | 'contextmenu';\n\n    /**\n     * The `Map` object that fired the event.\n     */\n    target: Map;\n\n    /**\n     * The DOM event which caused the map event.\n     */\n    originalEvent: MouseEvent;\n\n    /**\n     * The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.\n     */\n    point: Point;\n\n    /**\n     * The geographic location on the map of the mouse cursor.\n     */\n    lngLat: LngLat;\n\n    /**\n     * Prevents subsequent default processing of the event by the map.\n     *\n     * Calling this method will prevent the following default map behaviors:\n     *\n     *   * On `mousedown` events, the behavior of {@link DragPanHandler}\n     *   * On `mousedown` events, the behavior of {@link DragRotateHandler}\n     *   * On `mousedown` events, the behavior of {@link BoxZoomHandler}\n     *   * On `dblclick` events, the behavior of {@link DoubleClickZoomHandler}\n     *\n     */\n    preventDefault(): void {\n        this._defaultPrevented = true;\n    }\n\n    /**\n     * `true` if `preventDefault` has been called.\n     */\n    get defaultPrevented(): boolean {\n        return this._defaultPrevented;\n    }\n\n    _defaultPrevented: boolean;\n\n    constructor(type: string, map: Map, originalEvent: MouseEvent, data: any = {}) {\n        originalEvent = originalEvent instanceof MouseEvent ? originalEvent : new MouseEvent(type, originalEvent);\n        const point = DOM.mousePos(map.getCanvas(), originalEvent);\n        const lngLat = map.unproject(point);\n        super(type, extend({point, lngLat, originalEvent}, data));\n        this._defaultPrevented = false;\n        this.target = map;\n    }\n}\n\n/**\n * `MapTouchEvent` is the event type for touch-related map events.\n *\n * @group Event Related\n */\nexport class MapTouchEvent extends MapLibreEvent<TouchEvent> {\n    /**\n     * The event type.\n     */\n    type: 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';\n\n    /**\n     * The `Map` object that fired the event.\n     */\n    target: Map;\n\n    /**\n     * The DOM event which caused the map event.\n     */\n    originalEvent: TouchEvent;\n\n    /**\n     * The geographic location on the map of the center of the touch event points.\n     */\n    lngLat: LngLat;\n\n    /**\n     * The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left\n     * corner.\n     */\n    point: Point;\n\n    /**\n     * The array of pixel coordinates corresponding to a\n     * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n     */\n    points: Point[];\n\n    /**\n     * The geographical locations on the map corresponding to a\n     * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n     */\n    lngLats: LngLat[];\n\n    /**\n     * Prevents subsequent default processing of the event by the map.\n     *\n     * Calling this method will prevent the following default map behaviors:\n     *\n     *   * On `touchstart` events, the behavior of {@link DragPanHandler}\n     *   * On `touchstart` events, the behavior of {@link TwoFingersTouchZoomRotateHandler}\n     *\n     */\n    preventDefault(): void {\n        this._defaultPrevented = true;\n    }\n\n    /**\n     * `true` if `preventDefault` has been called.\n     */\n    get defaultPrevented(): boolean {\n        return this._defaultPrevented;\n    }\n\n    _defaultPrevented: boolean;\n\n    constructor(type: string, map: Map, originalEvent: TouchEvent) {\n        const touches = type === 'touchend' ? originalEvent.changedTouches : originalEvent.touches;\n        const points = DOM.touchPos(map.getCanvasContainer(), touches);\n        const lngLats = points.map((t) => map.unproject(t));\n        const point = points.reduce((prev, curr, i, arr) => {\n            return prev.add(curr.div(arr.length));\n        }, new Point(0, 0));\n        const lngLat = map.unproject(point);\n        super(type, {points, point, lngLats, lngLat, originalEvent});\n        this._defaultPrevented = false;\n    }\n}\n\n/**\n * `MapWheelEvent` is the event type for the `wheel` map event.\n *\n * @group Event Related\n */\nexport class MapWheelEvent extends MapLibreEvent<WheelEvent> {\n    /**\n     * The event type.\n     */\n    type: 'wheel';\n\n    /**\n     * The `Map` object that fired the event.\n     */\n    target: Map;\n\n    /**\n     * The DOM event which caused the map event.\n     */\n    originalEvent: WheelEvent;\n\n    /**\n     * Prevents subsequent default processing of the event by the map.\n     *\n     * Calling this method will prevent the behavior of {@link ScrollZoomHandler}.\n     */\n    preventDefault(): void {\n        this._defaultPrevented = true;\n    }\n\n    /**\n     * `true` if `preventDefault` has been called.\n     */\n    get defaultPrevented(): boolean {\n        return this._defaultPrevented;\n    }\n\n    _defaultPrevented: boolean;\n\n    /** */\n    constructor(map: Map, originalEvent: WheelEvent) {\n        super('wheel', {originalEvent});\n        this._defaultPrevented = false;\n    }\n}\n\n/**\n * A `MapBoxZoomEvent` is the event type for the boxzoom-related map events emitted by the {@link BoxZoomHandler}.\n *\n * @group Event Related\n */\nexport class MapBoxZoomEvent extends MapLibreEvent<MouseEvent> {\n    /**\n     * The type of boxzoom event. One of `boxzoomstart`, `boxzoomend` or `boxzoomcancel`\n     */\n    type: 'boxzoomstart' | 'boxzoomend' | 'boxzoomcancel';\n    /**\n     * The `Map` instance that triggered the event\n     */\n    target: Map;\n    /**\n     * The DOM event that triggered the boxzoom event. Can be a `MouseEvent` or `KeyboardEvent`\n     */\n    originalEvent: MouseEvent;\n};\n\n/**\n * The terrain event\n *\n * @group Event Related\n */\nexport class MapTerrainEvent extends MapLibreEvent {\n    type: 'terrain';\n\n    constructor(data: any = {}) {\n        super('terrain', data);\n    }\n};\n\n/**\n * The map projection event\n *\n * @group Event Related\n */\nexport class MapProjectionEvent extends MapLibreEvent {\n    type: 'projectiontransition';\n    /**\n     * Specifies the name of the new projection.\n     * For example:\n     *\n     *  - `globe` to describe globe that has internally switched to mercator\n     *  - `vertical-perspective` to describe a globe that doesn't change to mercator\n     *  - `mercator` to describe mercator projection\n     */\n    newProjection: ProjectionSpecification['type'];\n\n    constructor(data: any = {}) {\n        super('projectiontransition', data);\n    }\n}\n\n/**\n * An event related to the web gl context\n *\n * @group Event Related\n */\nexport class MapContextEvent extends MapLibreEvent<WebGLContextEvent> {\n    type: 'webglcontextlost' | 'webglcontextrestored';\n    originalEvent: WebGLContextEvent;\n};\n\n/**\n * The style image missing event, fired when an image is still missing after the missing style image\n * resolver has been given a chance to supply it. To load or generate images on demand,\n * use {@link Map.setMissingStyleImageResolver}.\n * Event listeners cannot resolve the missing image for the current request.\n *\n * @group Event Related\n *\n * @see [Generate and add a missing icon to the map](https://maplibre.org/maplibre-gl-js/docs/examples/generate-and-add-a-missing-icon-to-the-map/)\n */\nexport class MapStyleImageMissingEvent extends MapLibreEvent {\n    type: 'styleimagemissing';\n    id: string;\n\n    constructor(data: any = {}) {\n        super('styleimagemissing', data);\n    }\n};\n","import type {SpriteSpecification} from '@maplibre/maplibre-gl-style-spec';\n\n/**\n * Takes a SpriteSpecification value and returns it in its array form. If `undefined` is passed as an input value, an\n * empty array is returned.\n * duplicated entries with identical id/url will be removed in returned array\n * @param sprite - optional sprite to coerce\n * @returns an empty array in case `undefined` is passed; id-url pairs otherwise\n */\nexport function coerceSpriteToArray(sprite?: SpriteSpecification): Array<{id: string; url: string}> {\n    const resultArray: Array<{id: string; url: string}>  = [];\n\n    if (typeof sprite === 'string') {\n        resultArray.push({id: 'default', url: sprite});\n    } else if (sprite && sprite.length > 0) {\n        const dedupArray: string[] = [];\n        for (const {id, url} of sprite) {\n            const key = `${id}${url}`;\n            if (!dedupArray.includes(key)) {\n                dedupArray.push(key);\n                resultArray.push({id, url});\n            }\n        }\n    }\n\n    return resultArray;\n\n}\n","import {type GetResourceResponse, getJSON} from '../util/ajax.ts';\nimport {ImageRequest} from '../util/image_request.ts';\nimport {ResourceType} from '../util/request_manager.ts';\n\nimport {browser} from '../util/browser.ts';\nimport {coerceSpriteToArray} from '../util/style.ts';\n\nimport type {SpriteSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {SpriteJSON, StyleImage} from './style_image.ts';\nimport type {RequestManager} from '../util/request_manager.ts';\n\nexport type LoadSpriteResult = {\n    [spriteName: string]: {\n        [id: string]: StyleImage;\n    };\n};\n\nexport function normalizeSpriteURL(url: string, format: string, extension: string): string {\n    try {\n        const parsed = new URL(url);\n        parsed.pathname += `${format}${extension}`;\n        return parsed.toString();\n    }\n    catch {\n        throw new Error(`Invalid sprite URL \"${url}\", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`);\n    }\n}\n\nexport async function loadSprite(\n    originalSprite: SpriteSpecification,\n    requestManager: RequestManager,\n    pixelRatio: number,\n    abortController: AbortController,\n): Promise<LoadSpriteResult> {\n    const spriteArray = coerceSpriteToArray(originalSprite);\n    const format = pixelRatio > 1 ? '@2x' : '';\n\n    const jsonsMap: {[id: string]: Promise<GetResourceResponse<SpriteJSON>>} = {};\n    const imagesMap: {[id: string]: Promise<GetResourceResponse<HTMLImageElement | ImageBitmap>>} = {};\n\n    for (const {id, url} of spriteArray) {\n        const jsonRequestParameters = await requestManager.transformRequest(normalizeSpriteURL(url, format, '.json'), ResourceType.SpriteJSON);\n        jsonsMap[id] = getJSON<SpriteJSON>(jsonRequestParameters, abortController);\n\n        const imageRequestParameters = await requestManager.transformRequest(normalizeSpriteURL(url, format, '.png'), ResourceType.SpriteImage);\n        imagesMap[id] = ImageRequest.getImage(imageRequestParameters, abortController);\n    }\n\n    await Promise.all([...Object.values(jsonsMap), ...Object.values(imagesMap)]);\n    return doOnceCompleted(jsonsMap, imagesMap);\n}\n\n/**\n * @param jsonsMap - JSON data map\n * @param imagesMap - image data map\n */\nasync function doOnceCompleted(\n    jsonsMap:{[id: string]: Promise<GetResourceResponse<SpriteJSON>>},\n    imagesMap:{[id: string]: Promise<GetResourceResponse<HTMLImageElement | ImageBitmap>>}): Promise<LoadSpriteResult> {\n\n    const result = {} as {[spriteName: string]: {[id: string]: StyleImage}};\n    for (const spriteName in jsonsMap) {\n        result[spriteName] = {};\n\n        const context = browser.getImageCanvasContext((await imagesMap[spriteName]).data);\n        const json = (await jsonsMap[spriteName]).data;\n\n        for (const id in json) {\n            const {width, height, x, y, sdf, pixelRatio, stretchX, stretchY, content, textFitWidth, textFitHeight} = json[id];\n            const spriteData = {width, height, x, y, context};\n            result[spriteName][id] = {data: null, pixelRatio, sdf, stretchX, stretchY, content, textFitWidth, textFitHeight, spriteData};\n        }\n    }\n\n    return result;\n}\n","/* eslint-disable key-spacing */\nimport potpack from 'potpack';\n\nimport {ErrorEvent, Evented} from '../util/evented.ts';\nimport {MapStyleImageMissingEvent} from '../ui/events.ts';\nimport {RGBAImage} from '../util/image.ts';\nimport {ImagePosition} from './image_atlas.ts';\nimport {Texture} from '../webgl/texture.ts';\nimport {renderStyleImage} from '../style/style_image.ts';\nimport {warnOnce} from '../util/util.ts';\n\nimport type {StyleImage} from '../style/style_image.ts';\nimport type {Context} from '../webgl/context.ts';\nimport type {PotpackBox} from 'potpack';\nimport type {GetImagesResponse} from '../util/actor_messages.ts';\n\nexport type MissingImageRequestHandler = (id: string) => void | Promise<void>;\n\ntype Pattern = {\n    bin: PotpackBox;\n    position: ImagePosition;\n};\n\n/**\n * When copied into the atlas texture, image data is padded by one pixel on each side. Icon\n * images are padded with fully transparent pixels, while pattern images are padded with a\n * copy of the image data wrapped from the opposite side. In both cases, this ensures the\n * correct behavior of GL_LINEAR texture sampling mode.\n */\nconst padding = 1;\n\n/**\n * ImageManager does three things:\n *\n * 1. Tracks requests for icon images from tile workers and sends responses when the requests are fulfilled.\n * 2. Builds a texture atlas for pattern images.\n * 3. Rerenders renderable images once per frame\n *\n * These are disparate responsibilities and should eventually be handled by different classes. When we implement\n * data-driven support for `*-pattern`, we'll likely use per-bucket pattern atlases, and that would be a good time\n * to refactor this.\n*/\nexport class ImageManager extends Evented {\n    images: {[_: string]: StyleImage};\n    updatedImages: {[_: string]: boolean};\n    callbackDispatchedThisFrame: {[_: string]: boolean};\n    loaded: boolean;\n    /**\n     * This is used to track requests for images that are not yet available. When the image is loaded,\n     * the requestors will be notified.\n     */\n    requestors: Array<{\n        ids: string[];\n        promiseResolve: (value: GetImagesResponse | PromiseLike<GetImagesResponse>) => void;\n    }>;\n    missingImageResolver: MissingImageRequestHandler | null;\n\n    patterns: {[_: string]: Pattern};\n    atlasImage: RGBAImage;\n    atlasTexture: Texture;\n    dirty: boolean;\n\n    constructor() {\n        super();\n        this.images = {};\n        this.updatedImages = {};\n        this.callbackDispatchedThisFrame = {};\n        this.loaded = false;\n        this.requestors = [];\n        this.missingImageResolver = null;\n\n        this.patterns = {};\n        this.atlasImage = new RGBAImage({width: 1, height: 1});\n        this.dirty = true;\n    }\n\n    destroy(): void {\n        // Destroy atlas texture if it exists\n        if (this.atlasTexture) {\n            this.atlasTexture.destroy();\n            this.atlasTexture = null;\n        }\n        // Remove all images and patterns\n        for (const id of Object.keys(this.images)) {\n            this.removeImage(id);\n        }\n\n        this.patterns = {};\n        this.atlasImage = new RGBAImage({width: 1, height: 1});\n        this.dirty = true;\n    }\n    isLoaded(): boolean {\n        return this.loaded;\n    }\n\n    setLoaded(loaded: boolean): void {\n        if (this.loaded === loaded) {\n            return;\n        }\n\n        this.loaded = loaded;\n\n        if (loaded) {\n            for (const {ids, promiseResolve} of this.requestors) {\n                promiseResolve(this._getImagesForIds(ids));\n            }\n            this.requestors = [];\n        }\n    }\n\n    getImage(id: string): StyleImage {\n        const image = this.images[id];\n        // Extract sprite image data on demand\n        if (image && !image.data && image.spriteData) {\n            const spriteData = image.spriteData;\n            image.data = new RGBAImage({\n                width: spriteData.width,\n                height: spriteData.height\n            }, spriteData.context.getImageData(\n                spriteData.x,\n                spriteData.y,\n                spriteData.width,\n                spriteData.height).data);\n            image.spriteData = null;\n        }\n\n        return image;\n    }\n\n    addImage(id: string, image: StyleImage): void {\n        if (this.images[id]) throw new Error(`Image id ${id} already exist, use updateImage instead`);\n        if (this._validate(id, image)) {\n            this.images[id] = image;\n        }\n    }\n\n    _validate(id: string, image: StyleImage): boolean {\n        let valid = true;\n        const data = image.data || image.spriteData;\n        if (!this._validateStretch(image.stretchX, data?.width)) {\n            this.fire(new ErrorEvent(new Error(`Image \"${id}\" has invalid \"stretchX\" value`)));\n            valid = false;\n        }\n        if (!this._validateStretch(image.stretchY, data?.height)) {\n            this.fire(new ErrorEvent(new Error(`Image \"${id}\" has invalid \"stretchY\" value`)));\n            valid = false;\n        }\n        if (!this._validateContent(image.content, image)) {\n            this.fire(new ErrorEvent(new Error(`Image \"${id}\" has invalid \"content\" value`)));\n            valid = false;\n        }\n        return valid;\n    }\n\n    _validateStretch(stretch: Array<[number, number]>, size: number): boolean {\n        if (!stretch) return true;\n        let last = 0;\n        for (const part of stretch) {\n            if (part[0] < last || part[1] < part[0] || size < part[1]) return false;\n            last = part[1];\n        }\n        return true;\n    }\n\n    _validateContent(content: [number, number, number, number], image: StyleImage): boolean {\n        if (!content) return true;\n        if (content.length !== 4) return false;\n        const spriteData = image.spriteData;\n        const width = (spriteData?.width) || image.data.width;\n        const height = (spriteData?.height) || image.data.height;\n        if (content[0] < 0 || width < content[0]) return false;\n        if (content[1] < 0 || height < content[1]) return false;\n        if (content[2] < 0 || width < content[2]) return false;\n        if (content[3] < 0 || height < content[3]) return false;\n        if (content[2] < content[0]) return false;\n        return content[3] >= content[1];\n    }\n\n    updateImage(id: string, image: StyleImage, validate: boolean = true): void {\n        const oldImage = this.getImage(id);\n        if (validate && (oldImage.data.width !== image.data.width || oldImage.data.height !== image.data.height)) {\n            throw new Error(`size mismatch between old image (${oldImage.data.width}x${oldImage.data.height}) and new image (${image.data.width}x${image.data.height}).`);\n        }\n        image.version = oldImage.version + 1;\n        this.images[id] = image;\n        this.updatedImages[id] = true;\n    }\n\n    removeImage(id: string): void {\n        const image = this.images[id];\n        delete this.images[id];\n        delete this.patterns[id];\n\n        if (image.userImage?.onRemove) {\n            image.userImage.onRemove();\n        }\n    }\n\n    listImages(): string[] {\n        return Object.keys(this.images);\n    }\n\n    setMissingImageResolver(resolver: MissingImageRequestHandler | null): void {\n        this.missingImageResolver = resolver;\n    }\n\n    getImages(ids: string[]): Promise<GetImagesResponse> {\n        return new Promise<GetImagesResponse>((resolve, _reject) => {\n            // If the sprite has been loaded, or if all the icon dependencies are already present\n            // (i.e. if they've been added via runtime styling), then notify the requestor immediately.\n            // Otherwise, delay notification until the sprite is loaded. At that point, if any of the\n            // dependencies are still unavailable, we'll just assume they are permanently missing.\n            let hasAllDependencies = true;\n            if (!this.isLoaded()) {\n                for (const id of ids) {\n                    if (!this.images[id]) {\n                        hasAllDependencies = false;\n                    }\n                }\n            }\n            if (this.isLoaded() || hasAllDependencies) {\n                resolve(this._getImagesForIds(ids));\n            } else {\n                this.requestors.push({ids, promiseResolve: resolve});\n            }\n        });\n    }\n\n    async _getImagesForIds(ids: string[]): Promise<GetImagesResponse> {\n        const unresolvedIds = new Set(ids.filter((id) => !this.getImage(id)));\n        const resolver = this.missingImageResolver;\n\n        if (resolver) {\n            await Promise.all(Array.from(unresolvedIds, (id) => resolver(id)));\n        }\n\n        const response: GetImagesResponse = {};\n\n        for (const id of ids) {\n            const image = this.getImage(id);\n\n            if (image) {\n                unresolvedIds.delete(id);\n                // Clone the image so that our own copy of its ArrayBuffer doesn't get transferred.\n                response[id] = {\n                    data: image.data.clone(),\n                    pixelRatio: image.pixelRatio,\n                    sdf: image.sdf,\n                    version: image.version,\n                    stretchX: image.stretchX,\n                    stretchY: image.stretchY,\n                    content: image.content,\n                    textFitWidth: image.textFitWidth,\n                    textFitHeight: image.textFitHeight,\n                    hasRenderCallback: Boolean(image.userImage?.render)\n                };\n            }\n        }\n\n        for (const id of unresolvedIds) {\n            this.fire(new MapStyleImageMissingEvent({id}));\n            warnOnce(`Image \"${id}\" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a \"sprite\" property in your style.`);\n        }\n\n        return response;\n    }\n\n    // Pattern stuff\n\n    getPixelSize(): {width: number; height: number} {\n        const {width, height} = this.atlasImage;\n        return {width, height};\n    }\n\n    getPattern(id: string): ImagePosition {\n        const pattern = this.patterns[id];\n\n        const image = this.getImage(id);\n        if (!image) {\n            return null;\n        }\n\n        // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- pattern?.position.version would be undefined when pattern is nullish, making undefined === undefined true\n        if (pattern && pattern.position.version === image.version) {\n            return pattern.position;\n        }\n\n        if (!pattern) {\n            const w = image.data.width + padding * 2;\n            const h = image.data.height + padding * 2;\n            const bin = {w, h, x: 0, y: 0};\n            const position = new ImagePosition(bin, image);\n            this.patterns[id] = {bin, position};\n        } else {\n            pattern.position.version = image.version;\n        }\n\n        this._updatePatternAtlas();\n\n        return this.patterns[id].position;\n    }\n\n    bind(context: Context): void {\n        const gl = context.gl;\n        if (!this.atlasTexture) {\n            this.atlasTexture = new Texture(context, this.atlasImage, gl.RGBA);\n        } else if (this.dirty) {\n            this.atlasTexture.update(this.atlasImage);\n            this.dirty = false;\n        }\n\n        this.atlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n    }\n\n    _updatePatternAtlas(): void {\n        const bins = [];\n        for (const id in this.patterns) {\n            bins.push(this.patterns[id].bin);\n        }\n\n        const {w, h} = potpack(bins);\n\n        const dst = this.atlasImage;\n        dst.resize({width: w || 1, height: h || 1});\n\n        for (const id in this.patterns) {\n            const {bin} = this.patterns[id];\n            const x = bin.x + padding;\n            const y = bin.y + padding;\n            const src = this.getImage(id).data;\n            const w = src.width;\n            const h = src.height;\n\n            RGBAImage.copy(src, dst, {x: 0, y: 0}, {x, y}, {width: w, height: h});\n\n            // Add 1 pixel wrapped padding on each side of the image.\n            RGBAImage.copy(src, dst, {x: 0, y: h - 1}, {x, y: y - 1}, {width: w, height: 1}); // T\n            RGBAImage.copy(src, dst, {x: 0, y:     0}, {x, y: y + h}, {width: w, height: 1}); // B\n            RGBAImage.copy(src, dst, {x: w - 1, y: 0}, {x: x - 1, y}, {width: 1, height: h}); // L\n            RGBAImage.copy(src, dst, {x: 0,     y: 0}, {x: x + w, y}, {width: 1, height: h}); // R\n        }\n\n        this.dirty = true;\n    }\n\n    beginFrame(): void {\n        this.callbackDispatchedThisFrame = {};\n    }\n\n    dispatchRenderCallbacks(ids: string[]): void {\n        for (const id of ids) {\n\n            // the callback for the image was already dispatched for a different frame\n            if (this.callbackDispatchedThisFrame[id]) continue;\n            this.callbackDispatchedThisFrame[id] = true;\n\n            const image = this.getImage(id);\n            if (!image) warnOnce(`Image with ID: \"${id}\" was not found`);\n\n            const updated = renderStyleImage(image);\n            if (updated) {\n                this.updateImage(id, image);\n            }\n        }\n    }\n\n    cloneImages(): Record<string, StyleImage> {\n        const clonedImages: Record<string, StyleImage> = {};\n        for (const id in this.images) {\n            const image = this.images[id];\n            clonedImages[id] = {\n                ...image,\n                data: image.data ? image.data.clone() : null\n            };\n        }\n        return clonedImages;\n    }\n}\n","import {getArrayBuffer} from '../util/ajax.ts';\nimport {ResourceType} from '../util/request_manager.ts';\n\nimport {parseGlyphPbf} from './parse_glyph_pbf.ts';\n\nimport type {StyleGlyph} from './style_glyph.ts';\nimport type {RequestManager} from '../util/request_manager.ts';\n\nexport async function loadGlyphRange(fontstack: string,\n    range: number,\n    urlTemplate: string,\n    requestManager: RequestManager): Promise<{[_: number]: StyleGlyph | null}> {\n    const begin = range * 256;\n    const end = begin + 255;\n\n    const request = await requestManager.transformRequest(\n        urlTemplate.replace('{fontstack}', fontstack).replace('{range}', `${begin}-${end}`),\n        ResourceType.Glyphs\n    );\n\n    const response = await getArrayBuffer(request, new AbortController());\n    if (!response?.data) {\n        throw new Error(`Could not load glyph range. range: ${range}, ${begin}-${end}`);\n    }\n    const glyphs = {};\n\n    for (const glyph of parseGlyphPbf(response.data)) {\n        glyphs[glyph.id] = glyph;\n    }\n\n    return glyphs;\n}\n","const INF = 1e20;\n\n// lookup table for gamma-corrected, signed squared alpha distance values\nconst alphaTable = new Float64Array(256);\nfor (let i = 0; i < 256; i++) {\n    const d = 0.5 - Math.pow(i / 255, 1 / 2.2);\n    alphaTable[i] = d * Math.abs(d);\n}\nalphaTable[255] = -INF;\n\nexport default class TinySDF {\n    constructor({\n        fontSize = 24,\n        buffer = 3,\n        radius = 8,\n        cutoff = 0.25,\n        fontFamily = 'sans-serif',\n        fontWeight = 'normal',\n        fontStyle = 'normal',\n        lang = null\n    } = {}) {\n        this.buffer = buffer; // padding around a glyph's bounding box\n        this.radius = radius; // how many pixels around the glyph edge are encoded as signed distances\n        this.cutoff = cutoff; // how much of the SDF byte range represents inside vs outside the edge\n        this.lang = lang; // language of the Canvas drawing context\n\n        // make the canvas size big enough to both have the specified buffer around the glyph\n        // for \"halo\", and account for some glyphs possibly being larger than their font size\n        const size = this.size = fontSize + buffer * 4;\n\n        const canvas = this._createCanvas(size);\n        const ctx = this.ctx = canvas.getContext('2d', {willReadFrequently: true});\n        ctx.font = `${fontStyle} ${fontWeight} ${fontSize}px ${fontFamily}`;\n\n        ctx.textBaseline = 'alphabetic';\n        ctx.textAlign = 'left'; // Necessary so that RTL text doesn't have different alignment\n        ctx.fillStyle = 'black';\n\n        // two grids of squared distances: one for the outside of the glyph shape, one for the inside;\n        // the signed distance is derived as sqrt(outer) - sqrt(inner)\n        this.gridOuter = new Float64Array(size * size);\n        this.gridInner = new Float64Array(size * size);\n        this.f = new Float64Array(size);\n        this.z = new Float64Array(size + 1);\n        this.v = new Uint16Array(size);\n    }\n\n    _createCanvas(size) {\n        if (typeof OffscreenCanvas !== 'undefined') {\n            return new OffscreenCanvas(size, size);\n        }\n        const canvas = document.createElement('canvas');\n        canvas.width = canvas.height = size;\n        return canvas;\n    }\n\n    draw(char) {\n        const {\n            width: glyphAdvance,\n            actualBoundingBoxAscent,\n            actualBoundingBoxDescent,\n            actualBoundingBoxLeft,\n            actualBoundingBoxRight\n        } = this.ctx.measureText(char);\n\n        // The integer/pixel part of the alignment is encoded in metrics.glyphTop/glyphLeft\n        // The remainder is implicitly encoded in the rasterization\n        const glyphTop = Math.ceil(actualBoundingBoxAscent);\n        // actualBoundingBoxLeft is positive when ink extends LEFT of the origin (per spec),\n        // so negate to get the ink's left edge in canvas x-coords (positive = right of origin)\n        const glyphLeft = Math.floor(-actualBoundingBoxLeft);\n\n        // If the glyph overflows the canvas size, it will be clipped at the bottom/right\n        const glyphWidth = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(actualBoundingBoxRight) - glyphLeft));\n        const glyphHeight = Math.max(0, Math.min(this.size - this.buffer, glyphTop + Math.ceil(actualBoundingBoxDescent)));\n\n        const width = glyphWidth + 2 * this.buffer;\n        const height = glyphHeight + 2 * this.buffer;\n\n        const len = Math.max(width * height, 0);\n        const data = new Uint8ClampedArray(len);\n        const glyph = {data, width, height, glyphWidth, glyphHeight, glyphTop, glyphLeft, glyphAdvance};\n        if (glyphWidth === 0 || glyphHeight === 0) return glyph;\n\n        const {ctx, buffer, gridInner, gridOuter} = this;\n        if (this.lang) ctx.lang = this.lang;\n        ctx.clearRect(buffer, buffer, glyphWidth, glyphHeight);\n        ctx.fillText(char, buffer - glyphLeft, buffer + glyphTop);\n        const imgData = ctx.getImageData(buffer, buffer, glyphWidth, glyphHeight);\n\n        // default: outside the glyph (INF distance) for outer, inside (0 distance) for inner\n        gridOuter.fill(INF, 0, len);\n        gridInner.fill(0, 0, len);\n\n        // for anti-aliased pixels, treat partial coverage as a distance approximation:\n        // a fully covered pixel gets 0 outer / INF inner; a partial pixel gets a small\n        // non-zero outer or inner distance based on how far its coverage deviates from 0.5\n        let imgIdx = 3; // start at the alpha channel of the first pixel\n        for (let y = 0; y < glyphHeight; y++) {\n            let j = (y + buffer) * width + buffer;\n            for (let x = 0; x < glyphWidth; x++, imgIdx += 4, j++) {\n                const a = imgData.data[imgIdx]; // alpha value\n                if (a === 0) continue; // empty pixels\n                const t = alphaTable[a];\n                gridOuter[j] = Math.max(0, t);\n                gridInner[j] = Math.max(0, -t);\n            }\n        }\n\n        edt(gridOuter, 0, 0, width, height, width, this.f, this.v, this.z);\n        // Pad the inner EDT region by 1 px so ink pixels touching the bbox edge can see the\n        // outside-ink seeds in the buffer region; clamp to buffer so we don't underflow when buffer=0\n        const pad = Math.min(buffer, 1);\n        edt(gridInner, buffer - pad, buffer - pad, glyphWidth + 2 * pad, glyphHeight + 2 * pad, width, this.f, this.v, this.z);\n\n        // encode signed distance as a byte: inside the glyph maps to high values, outside to low,\n        // with the edge gradient spanning [-radius * cutoff, radius * (1 - cutoff)] pixels around the edge;\n        // Uint8ClampedArray clamps beyond that\n        const scale = 255 / this.radius;\n        const base = 255 * (1 - this.cutoff);\n        for (let i = 0; i < len; i++) {\n            const d = Math.sqrt(gridOuter[i]) - Math.sqrt(gridInner[i]);\n            data[i] = Math.round(base - scale * d);\n        }\n\n        return glyph;\n    }\n}\n\n// 2D Euclidean squared distance transform by Felzenszwalb & Huttenlocher https://cs.brown.edu/~pff/papers/dt-final.pdf\nfunction edt(data, x0, y0, width, height, gridSize, f, v, z) {\n    for (let x = x0; x < x0 + width; x++) edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z);\n    for (let y = y0; y < y0 + height; y++) edt1d(data, y * gridSize + x0, 1, width, f, v, z);\n}\n\n// 1D squared distance transform\nfunction edt1d(grid, offset, stride, length, f, v, z) {\n    v[0] = 0;\n    z[0] = -INF;\n    z[1] = INF;\n    f[0] = grid[offset];\n\n    for (let q = 1, k = 0, s = 0; q < length; q++) {\n        f[q] = grid[offset + q * stride];\n        const q2 = q * q;\n        do {\n            const r = v[k];\n            s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2;\n        } while (s <= z[k] && --k > -1);\n\n        k++;\n        v[k] = q;\n        z[k] = s;\n        z[k + 1] = INF;\n    }\n\n    for (let q = 0, k = 0; q < length; q++) {\n        while (z[k + 1] < q) k++;\n        const r = v[k];\n        const qr = q - r;\n        grid[offset + q * stride] = f[r] + qr * qr;\n    }\n}\n","import {loadGlyphRange} from '../style/load_glyph_range.ts';\n\nimport TinySDF from '@mapbox/tiny-sdf';\nimport {codePointUsesLocalIdeographFontFamily} from '../util/unicode_properties.g.ts';\nimport {AlphaImage} from '../util/image.ts';\nimport {ensureError, warnOnce} from '../util/util.ts';\n\nimport type {StyleGlyph} from '../style/style_glyph.ts';\nimport type {RequestManager} from '../util/request_manager.ts';\nimport type {GetGlyphsResponse} from '../util/actor_messages.ts';\n\nimport {v8} from '@maplibre/maplibre-gl-style-spec';\n\ntype Entry = {\n    // null means we've requested the range, but the glyph wasn't included in the result.\n    glyphs: {\n        [id: number]: StyleGlyph | null;\n    };\n    requests: {\n        [range: number]: Promise<{[_: number]: StyleGlyph | null}>;\n    };\n    ranges: {\n        [range: number]: boolean | null;\n    };\n    tinySDF?: Promise<TinySDF>;\n    ideographTinySDF?: Promise<TinySDF>;\n};\n\n/**\n * The style specification hard-codes some last resort fonts as a default fontstack.\n */\nconst defaultStack = v8.layout_symbol['text-font'].default.join(',');\n/**\n * The CSS generic font family closest to `defaultStack`.\n */\nconst defaultGenericFontFamily = 'sans-serif';\n\n/**\n * Scale factor for client-generated glyphs.\n *\n * Client-generated glyphs are rendered at 2× because CJK glyphs are more detailed than others.\n */\nconst textureScale = 2;\n\nexport class GlyphManager {\n    requestManager: RequestManager;\n    localIdeographFontFamily: string | false;\n    entries: {[stack: string]: Entry};\n    url: string;\n    lang?: string;\n\n    // exposed as statistics to enable stubbing in unit tests\n    static loadGlyphRange: typeof loadGlyphRange = loadGlyphRange;\n    static TinySDF: typeof TinySDF = TinySDF;\n\n    constructor(requestManager: RequestManager, localIdeographFontFamily?: string | false, lang?: string) {\n        this.requestManager = requestManager;\n        this.localIdeographFontFamily = localIdeographFontFamily;\n        this.entries = {};\n        this.lang = lang;\n    }\n\n    setURL(url?: string | null): void {\n        this.url = url;\n    }\n\n    async getGlyphs(glyphs: {[stack: string]: number[]}): Promise<GetGlyphsResponse> {\n        const glyphsPromises: Array<Promise<{stack: string; id: number; glyph: StyleGlyph}>> = [];\n\n        for (const stack in glyphs) {\n            for (const id of glyphs[stack]) {\n                glyphsPromises.push(this._getAndCacheGlyphsPromise(stack, id));\n            }\n        }\n\n        const updatedGlyphs = await Promise.all(glyphsPromises);\n\n        const result: GetGlyphsResponse = {};\n\n        for (const {stack, id, glyph} of updatedGlyphs) {\n            result[stack] ||= {};\n            // Clone the glyph so that our own copy of its ArrayBuffer doesn't get transferred.\n            result[stack][id] = glyph && {\n                id: glyph.id,\n                bitmap: glyph.bitmap.clone(),\n                metrics: glyph.metrics\n            };\n        }\n\n        return result;\n    }\n\n    async _getAndCacheGlyphsPromise(stack: string, id: number): Promise<{stack: string; id: number; glyph: StyleGlyph}> {\n        // Create an entry for this fontstack if it doesn’t already exist.\n        this.entries[stack] ??= {glyphs: {}, requests: {}, ranges: {}};\n        const entry = this.entries[stack];\n\n        // Try to get the glyph from the cache of client-side glyphs by codepoint.\n        let glyph = entry.glyphs[id];\n        if (glyph !== undefined) {\n            return {stack, id, glyph};\n        }\n\n        // If the style hasn’t opted into server-side fonts or this codepoint is CJK, draw the glyph locally and cache it.\n        if (!this.url || this._charUsesLocalIdeographFontFamily(id)) {\n            glyph = entry.glyphs[id] = await this._drawGlyph(entry, stack, id);\n            return {stack, id, glyph};\n        }\n\n        return await this._downloadAndCacheRangePromise(stack, id);\n    }\n\n    async _downloadAndCacheRangePromise(stack: string, id: number): Promise<{stack: string; id: number; glyph: StyleGlyph}> {\n        // Try to get the glyph from the cache of server-side glyphs by PBF range.\n        const entry = this.entries[stack];\n        const range = Math.floor(id / 256);\n        if (entry.ranges[range]) {\n            return {stack, id, glyph: null};\n        }\n\n        // Start downloading this range unless we’re currently downloading it.\n        entry.requests[range] ||= GlyphManager.loadGlyphRange(stack, range, this.url, this.requestManager);\n\n        try {\n            // Get the response and cache the glyphs from it.\n            const response = await entry.requests[range];\n            for (const id in response) {\n                entry.glyphs[+id] = response[+id];\n            }\n            entry.ranges[range] = true;\n            return {stack, id, glyph: response[id] || null};\n        } catch (e) {\n            // Fall back to drawing the glyph locally and caching it.\n            const glyph = entry.glyphs[id] = await this._drawGlyph(entry, stack, id);\n            this._warnOnMissingGlyphRange(glyph, range, id, ensureError(e));\n            return {stack, id, glyph};\n        }\n    }\n\n    _warnOnMissingGlyphRange(glyph: StyleGlyph, range: number, id: number, err: Error): void {\n        const begin = range * 256;\n        const end = begin + 255;\n        const codePoint = id.toString(16).padStart(4, '0').toUpperCase();\n        warnOnce(`Unable to load glyph range ${range}, ${begin}-${end}. Rendering codepoint U+${codePoint} locally instead. ${err}`);\n    }\n\n    /**\n     * Returns whether the given codepoint should be rendered locally.\n     */\n    _charUsesLocalIdeographFontFamily(id: number): boolean {\n        return !!this.localIdeographFontFamily && codePointUsesLocalIdeographFontFamily(id);\n    }\n\n    /**\n     * Draws a glyph offscreen using TinySDF, creating a TinySDF instance lazily.\n     */\n    async _drawGlyph(entry: Entry, stack: string, id: number): Promise<StyleGlyph> {\n        // The CJK fallback font specified by the developer takes precedence over the last resort fontstack in the style specification.\n        const usesLocalIdeographFontFamily = stack === defaultStack && this.localIdeographFontFamily !== '' && this._charUsesLocalIdeographFontFamily(id);\n\n        // Keep a separate TinySDF instance for when we need to apply the localIdeographFontFamily fallback to keep the font selection from bleeding into non-CJK text.\n        const tinySDFKey = usesLocalIdeographFontFamily ? 'ideographTinySDF' : 'tinySDF';\n        entry[tinySDFKey] ||= this._createTinySDF(usesLocalIdeographFontFamily ? this.localIdeographFontFamily : stack);\n        const tinySDF = await entry[tinySDFKey];\n        const char = tinySDF.draw(String.fromCodePoint(id));\n\n        /**\n         * TinySDF's \"top\" is the distance from the alphabetic baseline to the top of the glyph.\n         * Server-generated fonts specify \"top\" relative to an origin above the em box (the origin\n         * comes from FreeType, but I'm unclear on exactly how it's derived)\n         * ref: https://github.com/mapbox/sdf-glyph-foundry\n         *\n         * Server fonts don't yet include baseline information, so we can't line up exactly with them\n         * (and they don't line up with each other)\n         * ref: https://github.com/mapbox/node-fontnik/pull/160\n         *\n         * To approximately align TinySDF glyphs with server-provided glyphs, we use this baseline adjustment\n         * factor calibrated to be in between DIN Pro and Arial Unicode (but closer to Arial Unicode)\n         */\n        const topAdjustment = 27.5;\n\n        const leftAdjustment = 0.5;\n\n        // By definition, control characters are invisible and nonspacing.\n        const isControl = /^\\p{gc=Cf}+$/u.test(String.fromCodePoint(id));\n\n        return {\n            id,\n            bitmap: new AlphaImage({width: char.width || 30 * textureScale, height: char.height || 30 * textureScale}, char.data),\n            metrics: {\n                width: isControl ? 0 : (char.glyphWidth / textureScale || 24),\n                height: char.glyphHeight / textureScale || 24,\n                left: (char.glyphLeft / textureScale + leftAdjustment) || 0,\n                top: char.glyphTop / textureScale - topAdjustment || -8,\n                advance: isControl ? 0 : (char.glyphAdvance / textureScale || 24),\n                isDoubleResolution: true\n            }\n        };\n    }\n\n    async _createTinySDF(stack: String | false): Promise<TinySDF> {\n        // Escape and quote the font family list for use in CSS.\n        const fontFamilies = stack ? stack.split(',') : [];\n        fontFamilies.push(defaultGenericFontFamily);\n        const fontFamily = fontFamilies.map(fontName =>\n            /[-\\w]+/.test(fontName) ? fontName : `'${CSS.escape(fontName)}'`\n        ).join(',');\n\n        const fontSize = 24 * textureScale;\n        const fontWeight = this._fontWeight(fontFamilies[0]);\n        const fontStyle = this._fontStyle(fontFamilies[0]);\n\n        // Await web font load so TinySDF doesn't cache a fallback bitmap. See #7307.\n        if (typeof document !== 'undefined' && document.fonts?.load) {\n            try {\n                await document.fonts.load(`${fontStyle} ${fontWeight || 'normal'} ${fontSize}px ${fontFamily}`);\n            } catch (e) {\n                warnOnce(`Failed to load font \"${fontFamily}\": ${ensureError(e).message}`);\n            }\n        }\n\n        return new GlyphManager.TinySDF({\n            fontSize,\n            buffer: 3 * textureScale,\n            radius: 8 * textureScale,\n            cutoff: 0.25,\n            fontFamily,\n            fontWeight,\n            fontStyle,\n            lang: this.lang\n        });\n    }\n\n    /**\n     * Sniffs the font style out of a font family name.\n     */\n    _fontStyle(fontFamily: string): string {\n        if (/italic/i.test(fontFamily)) {\n            return 'italic';\n        } else if (/oblique/i.test(fontFamily)) {\n            return 'oblique';\n        }\n        return 'normal';\n    }\n\n    /**\n     * Sniffs the font weight out of a font family name.\n     */\n    _fontWeight(fontFamily: string): string {\n        // Based on the OpenType specification\n        // https://learn.microsoft.com/en-us/typography/opentype/spec/os2#usweightclass\n        const weightsByName = {\n            thin: 100, hairline: 100,\n            'extra light': 200, 'ultra light': 200,\n            light: 300,\n            normal: 400, regular: 400,\n            medium: 500,\n            semibold: 600, demibold: 600,\n            bold: 700,\n            'extra bold': 800, 'ultra bold': 800,\n            black: 900, heavy: 900,\n            'extra black': 950, 'ultra black': 950\n        };\n        let match;\n        for (const [name, weight] of Object.entries(weightsByName)) {\n            if (new RegExp(`\\\\b${name}\\\\b`, 'i').test(fontFamily)) {\n                match = `${weight}`;\n            }\n        }\n        return match;\n    }\n\n    destroy(): void {\n        for (const stack in this.entries) {\n            const entry = this.entries[stack];\n            entry.tinySDF = null;\n            entry.ideographTinySDF = null;\n            entry.glyphs = {};\n            entry.requests = {};\n            entry.ranges = {};\n        }\n        this.entries = {};\n    }\n}\n","// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.\n/* eslint-disable */\n\nimport {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';\n\nimport {\n    Properties,\n    DataConstantProperty,\n    DataDrivenProperty,\n    CrossFadedDataDrivenProperty,\n    CrossFadedProperty,\n    ColorRampProperty,\n    PossiblyEvaluatedPropertyValue,\n    CrossFaded\n} from './properties.ts';\n\nimport type {Color, Formatted, Padding, NumberArray, ColorArray, ResolvedImage, VariableAnchorOffsetCollection, ProjectionDefinitionSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';\n\n\nexport type LightProps = {\n    \"anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n    \"position\": DataConstantProperty<[number, number, number]>,\n    \"color\": DataConstantProperty<Color>,\n    \"intensity\": DataConstantProperty<number>,\n};\n\nexport type LightPropsPossiblyEvaluated = {\n    \"anchor\": \"map\" | \"viewport\",\n    \"position\": [number, number, number],\n    \"color\": Color,\n    \"intensity\": number,\n};\n\nlet properties: Properties<LightProps>;\nexport const getProperties = (): Properties<LightProps> => properties = properties || new Properties({\n    \"anchor\": new DataConstantProperty(styleSpec[\"light\"][\"anchor\"] as any as StylePropertySpecification, \"anchor\"),\n    \"position\": new DataConstantProperty(styleSpec[\"light\"][\"position\"] as any as StylePropertySpecification, \"position\"),\n    \"color\": new DataConstantProperty(styleSpec[\"light\"][\"color\"] as any as StylePropertySpecification, \"color\"),\n    \"intensity\": new DataConstantProperty(styleSpec[\"light\"][\"intensity\"] as any as StylePropertySpecification, \"intensity\"),\n});","import {sphericalToCartesian} from '../util/util.ts';\nimport {Evented} from '../util/evented.ts';\nimport {validateStyle, validateAndEmit, type Validator} from './validate_style.ts';\nimport {getProperties, type LightProps, type LightPropsPossiblyEvaluated} from './light_properties.g.ts';\n\nimport type {vec3} from 'gl-matrix';\nimport type {LightSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {EvaluationParameters} from './evaluation_parameters.ts';\nimport type {StyleSetterOptions} from '../style/style.ts';\nimport {Transitionable, type Transitioning, type PossiblyEvaluated, TRANSITION_SUFFIX} from './properties.ts';\n\nimport type {TransitionParameters} from './properties.ts';\n\n/*\n * Represents the light used to light extruded features.\n */\nexport class Light extends Evented {\n    _transitionable: Transitionable<LightProps>;\n    _transitioning: Transitioning<LightProps>;\n    properties: PossiblyEvaluated<LightProps, LightPropsPossiblyEvaluated>;\n\n    constructor(lightOptions: LightSpecification, globalState: Record<string, any>) {\n        super();\n        this._transitionable = new Transitionable(getProperties(), 'light', globalState);\n        this.setLight(lightOptions);\n        this._transitioning = this._transitionable.untransitioned();\n    }\n\n    getLight(): LightSpecification {\n        return this._transitionable.serialize();\n    }\n\n    /**\n     * Gets the light position in cartesian coordinates.\n     */\n    getCartesianPosition(): vec3 {\n        return sphericalToCartesian(this.properties.get('position'));\n    }\n\n    setLight(light: LightSpecification, options: StyleSetterOptions = {}): void {\n        if (this._validate(validateStyle.light, light, options)) {\n            return;\n        }\n\n        for (const name in light) {\n            const value = light[name];\n            if (name.endsWith(TRANSITION_SUFFIX)) {\n                this._transitionable.setTransition(name.slice(0, -TRANSITION_SUFFIX.length) as keyof LightProps, value);\n            } else {\n                this._transitionable.setValue(name as keyof LightProps, value);\n            }\n        }\n    }\n\n    updateTransitions(parameters: TransitionParameters): void {\n        this._transitioning = this._transitionable.transitioned(parameters, this._transitioning);\n    }\n\n    hasTransition(): boolean {\n        return this._transitioning.hasTransition();\n    }\n\n    recalculate(parameters: EvaluationParameters): void {\n        this.properties = this._transitioning.possiblyEvaluate(parameters);\n    }\n\n    _validate(validate: Validator, value: unknown, options?: StyleSetterOptions): boolean {\n        return validateAndEmit(this, validate, {value}, options);\n    }\n}\n","// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.\n/* eslint-disable */\n\nimport {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';\n\nimport {\n    Properties,\n    DataConstantProperty,\n    DataDrivenProperty,\n    CrossFadedDataDrivenProperty,\n    CrossFadedProperty,\n    ColorRampProperty,\n    PossiblyEvaluatedPropertyValue,\n    CrossFaded\n} from './properties.ts';\n\nimport type {Color, Formatted, Padding, NumberArray, ColorArray, ResolvedImage, VariableAnchorOffsetCollection, ProjectionDefinitionSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';\n\n\nexport type SkyProps = {\n    \"sky-color\": DataConstantProperty<Color>,\n    \"horizon-color\": DataConstantProperty<Color>,\n    \"fog-color\": DataConstantProperty<Color>,\n    \"fog-ground-blend\": DataConstantProperty<number>,\n    \"horizon-fog-blend\": DataConstantProperty<number>,\n    \"sky-horizon-blend\": DataConstantProperty<number>,\n    \"atmosphere-blend\": DataConstantProperty<number>,\n};\n\nexport type SkyPropsPossiblyEvaluated = {\n    \"sky-color\": Color,\n    \"horizon-color\": Color,\n    \"fog-color\": Color,\n    \"fog-ground-blend\": number,\n    \"horizon-fog-blend\": number,\n    \"sky-horizon-blend\": number,\n    \"atmosphere-blend\": number,\n};\n\nlet properties: Properties<SkyProps>;\nexport const getProperties = (): Properties<SkyProps> => properties = properties || new Properties({\n    \"sky-color\": new DataConstantProperty(styleSpec[\"sky\"][\"sky-color\"] as any as StylePropertySpecification, \"sky-color\"),\n    \"horizon-color\": new DataConstantProperty(styleSpec[\"sky\"][\"horizon-color\"] as any as StylePropertySpecification, \"horizon-color\"),\n    \"fog-color\": new DataConstantProperty(styleSpec[\"sky\"][\"fog-color\"] as any as StylePropertySpecification, \"fog-color\"),\n    \"fog-ground-blend\": new DataConstantProperty(styleSpec[\"sky\"][\"fog-ground-blend\"] as any as StylePropertySpecification, \"fog-ground-blend\"),\n    \"horizon-fog-blend\": new DataConstantProperty(styleSpec[\"sky\"][\"horizon-fog-blend\"] as any as StylePropertySpecification, \"horizon-fog-blend\"),\n    \"sky-horizon-blend\": new DataConstantProperty(styleSpec[\"sky\"][\"sky-horizon-blend\"] as any as StylePropertySpecification, \"sky-horizon-blend\"),\n    \"atmosphere-blend\": new DataConstantProperty(styleSpec[\"sky\"][\"atmosphere-blend\"] as any as StylePropertySpecification, \"atmosphere-blend\"),\n});","import {type PossiblyEvaluated, TRANSITION_SUFFIX, Transitionable, type Transitioning, type TransitionParameters} from './properties.ts';\nimport {Evented} from '../util/evented.ts';\nimport {EvaluationParameters} from './evaluation_parameters.ts';\nimport {validateStyle, validateAndEmit, type Validator} from './validate_style.ts';\nimport {getProperties, type SkyProps, type SkyPropsPossiblyEvaluated} from './sky_properties.g.ts';\nimport type {Mesh} from '../render/mesh.ts';\nimport type {SkySpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {StyleSetterOptions} from './style.ts';\n\nexport class Sky extends Evented {\n    properties: PossiblyEvaluated<SkyProps, SkyPropsPossiblyEvaluated>;\n\n    /**\n     * This is used to cache the gl mesh for the sky, it should be initialized only once.\n     */\n    mesh: Mesh | undefined;\n    atmosphereMesh: Mesh | undefined;\n    _transitionable: Transitionable<SkyProps>;\n    _transitioning: Transitioning<SkyProps>;\n\n    constructor(sky: SkySpecification | undefined, globalState: Record<string, any>) {\n        super();\n        this._transitionable = new Transitionable(getProperties(), 'sky', globalState);\n        this.setSky(sky);\n        this._transitioning = this._transitionable.untransitioned();\n        this.recalculate(new EvaluationParameters(0));\n    }\n\n    setSky(sky?: SkySpecification, options: StyleSetterOptions = {}): void {\n        if (this._validate(validateStyle.sky, sky, options)) return;\n\n        sky ||= {\n            'sky-color': 'transparent',\n            'horizon-color': 'transparent',\n            'fog-color': 'transparent',\n            'fog-ground-blend': 1,\n            'atmosphere-blend': 0,\n        };\n\n        for (const name in sky) {\n            const value = sky[name];\n            if (name.endsWith(TRANSITION_SUFFIX)) {\n                this._transitionable.setTransition(name.slice(0, -TRANSITION_SUFFIX.length) as keyof SkyProps, value);\n            } else {\n                this._transitionable.setValue(name as keyof SkyProps, value);\n            }\n        }\n    }\n\n    getSky(): SkySpecification {\n        return this._transitionable.serialize();\n    }\n\n    updateTransitions(parameters: TransitionParameters): void {\n        this._transitioning = this._transitionable.transitioned(parameters, this._transitioning);\n    }\n\n    hasTransition(): boolean {\n        return this._transitioning.hasTransition();\n    }\n\n    recalculate(parameters: EvaluationParameters): void {\n        this.properties = this._transitioning.possiblyEvaluate(parameters);\n    }\n\n    _validate(validate: Validator, value: unknown, options: StyleSetterOptions = {}): boolean {\n        return validateAndEmit(this, validate, {value}, options);\n    }\n\n    /**\n     * Currently fog is a very simple implementation, and should only used\n     * to create an atmosphere near the horizon.\n     * But because the fog is drawn from the far-clipping-plane to\n     * map-center, and because the fog does nothing know about the horizon,\n     * this method does a fadeout in respect of pitch. So, when the horizon\n     * gets out of view, which is at about pitch 70, this methods calculates\n     * the corresponding opacity values. Below pitch 60 the fog is completely\n     * invisible.\n     */\n    calculateFogBlendOpacity(pitch: number): number {\n        if (pitch < 60) return 0; // disable\n        if (pitch < 70) return (pitch - 60) / 10; // fade in\n        return 1;\n    }\n}\n","import {warnOnce} from '../util/util.ts';\n\nimport type {Context} from '../webgl/context.ts';\n\ntype DashRange = {left: number; right: number; isDash: boolean; zeroLength: boolean};\n\n/**\n * A dash entry\n */\nexport type DashEntry = {\n    y: number;\n    height: number;\n    width: number;\n};\n\n/**\n * @internal\n * A LineAtlas lets us reuse rendered dashed lines\n * by writing many of them to a texture and then fetching their positions\n * using {@link LineAtlas.getDash}.\n *\n * @param width - the width\n * @param height - the height\n */\nexport class LineAtlas {\n    width: number;\n    height: number;\n    nextRow: number;\n    bytes: number;\n    data: Uint8Array;\n    dashEntry: {[_: string]: DashEntry};\n    dirty: boolean;\n    texture: WebGLTexture;\n\n    constructor(width: number, height: number) {\n        this.width = width;\n        this.height = height;\n        this.nextRow = 0;\n\n        this.data = new Uint8Array(this.width * this.height);\n\n        this.dashEntry = {};\n    }\n\n    /**\n     * Get or create a dash line pattern.\n     *\n     * @param dasharray - the key (represented by numbers) to get the dash texture\n     * @param round - whether to add circle caps in between dash segments\n     * @returns position of dash texture in {@link DashEntry}\n     */\n    getDash(dasharray: number[], round: boolean): DashEntry {\n        const key = dasharray.join(',') + String(round);\n\n        this.dashEntry[key] ||= this.addDash(dasharray, round);\n        return this.dashEntry[key];\n    }\n\n    getDashRanges(dasharray: number[], lineAtlasWidth: number, stretch: number): DashRange[] {\n        // If dasharray has an odd length, both the first and last parts\n        // are dashes and should be joined seamlessly.\n        const oddDashArray = dasharray.length % 2 === 1;\n\n        const ranges = [];\n\n        let left = oddDashArray ? -dasharray[dasharray.length - 1] * stretch : 0;\n        let right = dasharray[0] * stretch;\n        let isDash = true;\n\n        ranges.push({left, right, isDash, zeroLength: dasharray[0] === 0});\n\n        let currentDashLength = dasharray[0];\n        for (let i = 1; i < dasharray.length; i++) {\n            isDash = !isDash;\n\n            const dashLength = dasharray[i];\n            left = currentDashLength * stretch;\n            currentDashLength += dashLength;\n            right = currentDashLength * stretch;\n\n            ranges.push({left, right, isDash, zeroLength: dashLength === 0});\n        }\n\n        return ranges;\n    }\n\n    addRoundDash(ranges: DashRange[], stretch: number, n: number): void {\n        const halfStretch = stretch / 2;\n\n        for (let y = -n; y <= n; y++) {\n            const row = this.nextRow + n + y;\n            const index = this.width * row;\n            let currIndex = 0;\n            let range = ranges[currIndex];\n\n            for (let x = 0; x < this.width; x++) {\n                if (x / range.right > 1) { range = ranges[++currIndex]; }\n\n                const distLeft = Math.abs(x - range.left);\n                const distRight = Math.abs(x - range.right);\n                const minDist = Math.min(distLeft, distRight);\n                let signedDistance;\n\n                const distMiddle =  y / n * (halfStretch + 1);\n                if (range.isDash) {\n                    const distEdge = halfStretch - Math.abs(distMiddle);\n                    signedDistance = Math.sqrt(minDist * minDist + distEdge * distEdge);\n                } else {\n                    signedDistance = halfStretch - Math.sqrt(minDist * minDist + distMiddle * distMiddle);\n                }\n\n                this.data[index + x] = Math.max(0, Math.min(255, signedDistance + 128));\n            }\n        }\n    }\n\n    addRegularDash(ranges: DashRange[]): void {\n\n        // Collapse any zero-length range\n        // Collapse neighbouring same-type parts into a single part\n        for (let i = ranges.length - 1; i >= 0; --i) {\n            const part = ranges[i];\n            const next = ranges[i + 1];\n            if (part.zeroLength) {\n                ranges.splice(i, 1);\n            } else if (next?.isDash === part.isDash) {\n                next.left = part.left;\n                ranges.splice(i, 1);\n            }\n        }\n\n        // Combine the first and last parts if possible\n        const first = ranges[0];\n        const last = ranges[ranges.length - 1];\n        if (first.isDash === last.isDash) {\n            first.left = last.left - this.width;\n            last.right = first.right + this.width;\n        }\n\n        const index = this.width * this.nextRow;\n        let currIndex = 0;\n        let range = ranges[currIndex];\n\n        for (let x = 0; x < this.width; x++) {\n            if (x / range.right > 1) {\n                range = ranges[++currIndex];\n            }\n\n            const distLeft = Math.abs(x - range.left);\n            const distRight = Math.abs(x - range.right);\n\n            const minDist = Math.min(distLeft, distRight);\n            const signedDistance = range.isDash ? minDist : -minDist;\n\n            this.data[index + x] = Math.max(0, Math.min(255, signedDistance + 128));\n        }\n    }\n\n    addDash(dasharray: number[], round: boolean): DashEntry {\n        const n = round ? 7 : 0;\n        const height = 2 * n + 1;\n\n        if (this.nextRow + height > this.height) {\n            warnOnce('LineAtlas out of space');\n            return null;\n        }\n\n        let length = 0;\n        for (const dash of dasharray) { length += dash; }\n\n        if (length !== 0) {\n            const stretch = this.width / length;\n            const ranges = this.getDashRanges(dasharray, this.width, stretch);\n\n            if (round) {\n                this.addRoundDash(ranges, stretch, n);\n            } else {\n                this.addRegularDash(ranges);\n            }\n        }\n\n        const dashEntry = {\n            y: this.nextRow + n,\n            height: 2 * n,\n            width: length\n        };\n\n        this.nextRow += height;\n        this.dirty = true;\n\n        return dashEntry;\n    }\n\n    bind(context: Context): void {\n        const gl = context.gl;\n        if (!this.texture) {\n            this.texture = gl.createTexture();\n            gl.bindTexture(gl.TEXTURE_2D, this.texture);\n            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n            gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, this.width, this.height, 0, gl.ALPHA, gl.UNSIGNED_BYTE, this.data);\n\n        } else {\n            gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n            if (this.dirty) {\n                this.dirty = false;\n                gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.ALPHA, gl.UNSIGNED_BYTE, this.data);\n            }\n        }\n    }\n}\n","import {type AddProtocolAction, config} from './config.ts';\nimport type {default as MaplibreWorker} from '../source/worker.ts';\nimport type {WorkerSourceConstructor} from '../source/worker_source.ts';\nimport type {GetResourceResponse, RequestParameters} from './ajax.ts';\n\nexport interface WorkerGlobalScopeInterface {\n    registerWorkerSource: (sourceName: string, sourceConstructor: WorkerSourceConstructor) => void;\n    registerRTLTextPlugin: (_: any) => void;\n    addProtocol: (customProtocol: string, loadFn: AddProtocolAction) => void;\n    removeProtocol: (customProtocol: string) => void;\n    makeRequest: (request: RequestParameters, abortController: AbortController) => Promise<GetResourceResponse<any>>;\n    worker: MaplibreWorker;\n}\n\nfunction isCrossOrigin(url: string): boolean {\n    if (!url) return false;\n    const loc = (globalThis as any).location;\n    if (!loc) return false;\n    try {\n        return new URL(url, loc.href).origin !== loc.origin;\n    } catch {\n        return false;\n    }\n}\n\nfunction defaultWorkerUrl(): string {\n    const moduleUrl = import.meta.url;\n    if (!/^https?:/.test(moduleUrl)) return '';\n    const workerName = moduleUrl.endsWith('-dev.mjs')\n        ? 'maplibre-gl-worker-dev.mjs'\n        : 'maplibre-gl-worker.mjs';\n    return new URL(`./${workerName}`, moduleUrl).href;\n}\n\nfunction createWorker(url: string, asModule: boolean): Worker {\n    if (asModule) {\n        try {\n            return new Worker(url, {type: 'module'});\n        } catch (e) {\n            console.warn('Module worker not supported, falling back to classic worker', e);\n        }\n    }\n    return new Worker(url);\n}\n\nasync function fetchAsBlobUrl(url: string): Promise<string> {\n    const response = await fetch(url);\n    if (!response.ok) {\n        throw new Error(`Failed to fetch worker script (${response.status}): ${url}`);\n    }\n    const code = await response.text();\n    const blob = new Blob([code], {type: 'text/javascript'});\n    return URL.createObjectURL(blob);\n}\n\nfunction importAsBlobUrl(url: string): string {\n    const blob = new Blob([`import ${JSON.stringify(new URL(url, import.meta.url).href)}`], {type: 'text/javascript'});\n    return URL.createObjectURL(blob);\n}\n\nexport async function workerFactory(): Promise<Worker> {\n    const url = config.WORKER_URL || defaultWorkerUrl();\n    const asModule = url?.endsWith('.cjs') ? false : true;\n\n    if (!isCrossOrigin(url)) {\n        return createWorker(url, asModule);\n    }\n\n    if (asModule) {\n        const blobUrl = importAsBlobUrl(url);\n        try {\n            return createWorker(blobUrl, asModule);\n        } finally {\n            URL.revokeObjectURL(blobUrl);\n        }\n    }\n\n    const blobUrl = await fetchAsBlobUrl(url);\n    try {\n        return createWorker(blobUrl, asModule);\n    } finally {\n        URL.revokeObjectURL(blobUrl);\n    }\n}\n","import {workerFactory} from './web_worker.ts';\nimport {browser} from './browser.ts';\nimport {isSafari} from './util.ts';\nimport {type ActorTarget} from './actor.ts';\n\nexport const PRELOAD_POOL_ID = 'maplibre_preloaded_worker_pool';\n\n/**\n * Constructs a worker pool.\n */\nexport class WorkerPool {\n    static workerCount: number;\n\n    active: {\n        [_ in number | string]: boolean;\n    };\n    workersPromise: Promise<ActorTarget[]> | null;\n\n    constructor() {\n        this.active = {};\n        this.workersPromise = null;\n    }\n\n    async acquire(mapId: number | string): Promise<ActorTarget[]> {\n        this.active[mapId] = true;\n        if (!this.workersPromise) {\n            const promises: Array<Promise<Worker>> = [];\n            while (promises.length < WorkerPool.workerCount) {\n                promises.push(workerFactory());\n            }\n            this.workersPromise = Promise.all(promises);\n        }\n        return (await this.workersPromise).slice();\n    }\n\n    release(mapId: number | string): void {\n        delete this.active[mapId];\n        if (this.numActive() === 0 && this.workersPromise) {\n            const promise = this.workersPromise;\n            this.workersPromise = null;\n            promise.then(workers => {\n                for (const w of workers) {\n                    w.terminate();\n                }\n            });\n        }\n    }\n\n    isPreloaded(): boolean {\n        return !!this.active[PRELOAD_POOL_ID];\n    }\n\n    numActive(): number {\n        return Object.keys(this.active).length;\n    }\n}\n\n// Based on results from A/B testing: https://github.com/maplibre/maplibre-gl-js/pull/2354\nconst availableLogicalProcessors = Math.floor(browser.hardwareConcurrency / 2);\nWorkerPool.workerCount = isSafari(globalThis) ? Math.max(Math.min(availableLogicalProcessors, 3), 1) : 1;\n","import {WorkerPool, PRELOAD_POOL_ID} from './worker_pool.ts';\n\nlet globalWorkerPool: WorkerPool;\n\n/**\n * Creates (if necessary) and returns the single, global WorkerPool instance\n * to be shared across each Map\n */\nexport function getGlobalWorkerPool(): WorkerPool {\n    globalWorkerPool ||= new WorkerPool();\n    return globalWorkerPool;\n}\n\n/**\n * Initializes resources like WebWorkers that can be shared across maps to lower load\n * times in some situations. `setWorkerUrl()` and `setWorkerCount()`, if being\n * used, must be set before `prewarm()` is called to have an effect.\n *\n * By default, the lifecycle of these resources is managed automatically, and they are\n * lazily initialized when a Map is first created. By invoking `prewarm()`, these\n * resources will be created ahead of time, and will not be cleared when the last Map\n * is removed from the page. This allows them to be re-used by new Map instances that\n * are created later. They can be manually cleared by calling\n * `clearPrewarmedResources()`. This is only necessary if your web page remains\n * active but stops using maps altogether.\n *\n * This is primarily useful when using GL-JS maps in a single page app, wherein a user\n * would navigate between various views that can cause Map instances to constantly be\n * created and destroyed.\n *\n * @example\n * ```ts\n * prewarm()\n * ```\n */\nexport function prewarm(): void {\n    const workerPool = getGlobalWorkerPool();\n    workerPool.acquire(PRELOAD_POOL_ID);\n}\n\n/**\n * Clears up resources that have previously been created by `prewarm()`.\n * Note that this is typically not necessary. You should only call this function\n * if you expect the user of your app to not return to a Map view at any point\n * in your application.\n *\n * @example\n * ```ts\n * clearPrewarmedResources()\n * ```\n */\nexport function clearPrewarmedResources(): void {\n    const pool = globalWorkerPool;\n    if (pool) {\n        // Remove the pool only if all maps that referenced the preloaded global worker pool have been removed.\n        if (pool.isPreloaded() && pool.numActive() === 1) {\n            pool.release(PRELOAD_POOL_ID);\n            globalWorkerPool = null;\n        } else {\n            console.warn('Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()');\n        }\n    }\n}\n","import {Actor, type ActorTarget, type MessageHandler} from './actor.ts';\nimport {getGlobalWorkerPool} from './global_worker_pool.ts';\nimport {GLOBAL_DISPATCHER_ID, makeRequest} from './ajax.ts';\n\nimport type {WorkerPool} from './worker_pool.ts';\nimport type {RequestResponseMessageMap} from './actor_messages.ts';\nimport {MessageType} from './actor_messages.ts';\n\n/**\n * Responsible for sending messages from a {@link Source} to an associated worker source (usually with the same name).\n */\nexport class Dispatcher {\n    workerPool: WorkerPool;\n    actors: Actor[];\n    actorsPromise: Promise<Actor[]>;\n    currentActor: number;\n    id: string | number;\n    private removed: boolean;\n\n    constructor(workerPool: WorkerPool, mapId: string | number) {\n        this.workerPool = workerPool;\n        this.actors = [];\n        this.currentActor = 0;\n        this.id = mapId;\n        this.removed = false;\n        this.actorsPromise = this.initActors(mapId);\n    }\n\n    private async initActors(mapId: string | number): Promise<Actor[]> {\n        const workers = await this.workerPool.acquire(mapId);\n        if (this.removed) return [];\n        this.actors = workers.map((worker: ActorTarget, i: number) => {\n            const actor = new Actor(worker, mapId);\n            actor.name = `Worker ${i}`;\n            return actor;\n        });\n        if (!this.actors.length) throw new Error('No actors found');\n        return this.actors;\n    }\n\n    /**\n     * Broadcast a message to all Workers.\n     */\n    async broadcast<T extends MessageType>(type: T, data: RequestResponseMessageMap[T][0]): Promise<Array<RequestResponseMessageMap[T][1]>> {\n        const actors = await this.actorsPromise;\n        return Promise.all(actors.map(actor => actor.sendAsync({type, data})));\n    }\n\n    /**\n     * Acquires an actor to dispatch messages to. The actors are distributed in round-robin fashion.\n     * @returns An actor object backed by a web worker for processing messages.\n     */\n    async getActor(): Promise<Actor> {\n        const actors = await this.actorsPromise;\n        this.currentActor = (this.currentActor + 1) % actors.length;\n        return actors[this.currentActor];\n    }\n\n    async waitForInitComplete(): Promise<void> {\n        if (this.actors.length === 0) {\n            await this.actorsPromise;\n        }\n    }\n\n    getReadyActor(): Actor {\n        this.currentActor = (this.currentActor + 1) % this.actors.length;\n        return this.actors[this.currentActor];\n    }\n\n    remove(mapRemoved: boolean = true): void {\n        this.removed = true;\n        for (const actor of this.actors) {\n            actor.remove();\n        }\n        this.actors = [];\n        if (mapRemoved) this.workerPool.release(this.id);\n    }\n\n    public async registerMessageHandler<T extends MessageType>(type: T, handler: MessageHandler<T>): Promise<void> {\n        const actors = await this.actorsPromise;\n        for (const actor of actors) {\n            actor.registerMessageHandler(type, handler);\n        }\n    }\n\n    public async unregisterMessageHandler<T extends MessageType>(type: T): Promise<void> {\n        const actors = await this.actorsPromise;\n        for (const actor of actors) {\n            actor.unregisterMessageHandler(type);\n        }\n    }\n}\n\nlet globalDispatcher: Dispatcher;\n\n/**\n * This function is used to get the global dispatcher that is shared across all maps instances.\n * It is used by the main thread to send messages to the workers, and by the workers to send messages back to the main thread.\n * If you import a script into the worker and need to send a message to the workers to pass some parameters for example,\n * you can use this function to get the global dispatcher and send a message to the workers.\n * @returns The global dispatcher instance.\n */\nexport function getGlobalDispatcher(): Dispatcher {\n    if (!globalDispatcher) {\n        globalDispatcher = new Dispatcher(getGlobalWorkerPool(), GLOBAL_DISPATCHER_ID);\n        globalDispatcher.registerMessageHandler(MessageType.getResource, (_mapId, params, abortController) => {\n            return makeRequest(params, abortController);\n        });\n    }\n    return globalDispatcher;\n}\n","import {mat4} from 'gl-matrix';\nimport type Point from '@mapbox/point-geometry';\nimport type {TileManager} from '../tile/tile_manager.ts';\nimport type {StyleLayer} from '../style/style_layer.ts';\nimport type {CollisionIndex} from '../symbol/collision_index.ts';\nimport type {IReadonlyTransform} from '../geo/transform_interface.ts';\nimport type {RetainedQueryData} from '../symbol/placement.ts';\nimport type {FilterSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {GeoJSONFeature, MapGeoJSONFeature} from '../util/vectortile_to_geojson.ts';\nimport type {QueryResults, QueryResultsItem} from '../data/feature_index.ts';\nimport type {OverscaledTileID} from '../tile/tile_id.ts';\n\ntype RenderedFeatureLayer = {\n    wrappedTileID: string;\n    queryResults: QueryResults;\n};\n\n/**\n * Options to pass to query the map for the rendered features\n */\nexport type QueryRenderedFeaturesOptions = {\n    /**\n     * An array or set of [style layer IDs](https://maplibre.org/maplibre-style-spec/#layer-id) for the query to inspect.\n     * Only features within these layers will be returned. If this parameter is undefined, all layers will be checked.\n     */\n    layers?: string[] | Set<string>;\n    /**\n     * A [filter](https://maplibre.org/maplibre-style-spec/layers/#filter) to limit query results.\n     */\n    filter?: FilterSpecification;\n    /**\n     * An array of string representing the available images\n     */\n    availableImages?: string[];\n    /**\n     * Whether to check if the `options.filter` conforms to the MapLibre Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n     */\n    validate?: boolean;\n};\n\n/**\n * @internal\n * A version of QueryRenderedFeaturesOptions used internally\n */\nexport type QueryRenderedFeaturesOptionsStrict = Omit<QueryRenderedFeaturesOptions, 'layers'> & {\n    layers: Set<string> | null;\n    globalState?: Record<string, any>;\n};\n\n/**\n * The options object related to the {@link Map.querySourceFeatures} method\n */\nexport type QuerySourceFeatureOptions = {\n    /**\n     * The name of the source layer to query. *For vector tile sources, this parameter is required.* For GeoJSON sources, it is ignored.\n     */\n    sourceLayer?: string;\n    /**\n     * A [filter](https://maplibre.org/maplibre-style-spec/layers/#filter)\n     * to limit query results.\n     */\n    filter?: FilterSpecification;\n    /**\n     * Whether to check if the `parameters.filter` conforms to the MapLibre Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n     * @defaultValue true\n     */\n    validate?: boolean;\n};\n\n/**\n * @internal\n * A version of QuerySourceFeatureOptions used internally\n */\nexport type QuerySourceFeatureOptionsStrict = QuerySourceFeatureOptions & {\n    globalState?: Record<string, any>;\n};\n\nexport type QueryRenderedFeaturesResults = {\n    [key: string]: QueryRenderedFeaturesResultsItem[];\n};\n\nexport type QueryRenderedFeaturesResultsItem = QueryResultsItem & { feature: MapGeoJSONFeature };\n\n/*\n * Returns a matrix that can be used to convert from tile coordinates to viewport pixel coordinates.\n */\nfunction getPixelPosMatrix(transform, tileID: OverscaledTileID) {\n    const t = mat4.create();\n    mat4.translate(t, t, [1, 1, 0]);\n    mat4.scale(t, t, [transform.width * 0.5, transform.height * 0.5, 1]);\n    if (transform.calculatePosMatrix) { // Globe: TODO: remove this hack once queryRendererFeatures supports globe properly\n        return mat4.multiply(t, t, transform.calculatePosMatrix(tileID.toUnwrapped()));\n    } else {\n        return t;\n    }\n}\n\nfunction queryIncludes3DLayer(layers: Set<string> | undefined, styleLayers: {[_: string]: StyleLayer}, sourceID: string) {\n    if (layers) {\n        for (const layerID of layers) {\n            const layer = styleLayers[layerID];\n            if (layer?.source === sourceID && layer.type === 'fill-extrusion') {\n                return true;\n            }\n        }\n    } else {\n        for (const key in styleLayers) {\n            const layer = styleLayers[key];\n            if (layer.source === sourceID && layer.type === 'fill-extrusion') {\n                return true;\n            }\n        }\n    }\n    return false;\n}\n\nexport function queryRenderedFeatures(\n    tileManager: TileManager,\n    styleLayers: {[_: string]: StyleLayer},\n    serializedLayers: {[_: string]: any},\n    queryGeometry: Point[],\n    params: QueryRenderedFeaturesOptionsStrict | undefined,\n    transform: IReadonlyTransform,\n    getElevation: undefined | ((id: OverscaledTileID, x: number, y: number) => number)\n): QueryRenderedFeaturesResults {\n\n    const has3DLayer = queryIncludes3DLayer(params?.layers ?? null, styleLayers, tileManager.id);\n    const maxPitchScaleFactor = transform.maxPitchScaleFactor();\n    const tilesIn = tileManager.tilesIn(queryGeometry, maxPitchScaleFactor, has3DLayer);\n\n    tilesIn.sort(sortTilesIn);\n    const renderedFeatureLayers: RenderedFeatureLayer[] = [];\n    for (const tileIn of tilesIn) {\n        renderedFeatureLayers.push({\n            wrappedTileID: tileIn.tileID.wrapped().key,\n            queryResults: tileIn.tile.queryRenderedFeatures(\n                styleLayers,\n                serializedLayers,\n                tileManager.getState(),\n                tileIn.queryGeometry,\n                tileIn.cameraQueryGeometry,\n                tileIn.scale,\n                params,\n                transform,\n                maxPitchScaleFactor,\n                getPixelPosMatrix(transform, tileIn.tileID),\n                getElevation ? (x: number, y: number) => getElevation(tileIn.tileID, x, y) : undefined,\n            )\n        });\n    }\n\n    const result = mergeRenderedFeatureLayers(renderedFeatureLayers);\n\n    return convertFeaturesToMapFeatures(result, tileManager);\n}\n\nexport function queryRenderedSymbols(styleLayers: {[_: string]: StyleLayer},\n    serializedLayers: {[_: string]: StyleLayer},\n    tileManagers: {[_: string]: TileManager},\n    queryGeometry: Point[],\n    params: QueryRenderedFeaturesOptionsStrict,\n    collisionIndex: CollisionIndex,\n    retainedQueryData: {\n        [_: number]: RetainedQueryData;\n    }): QueryRenderedFeaturesResults {\n    const result: QueryResults = {};\n    const renderedSymbols = collisionIndex.queryRenderedSymbols(queryGeometry);\n    const bucketQueryData: RetainedQueryData[] = [];\n    for (const bucketInstanceId of Object.keys(renderedSymbols).map(Number)) {\n        bucketQueryData.push(retainedQueryData[bucketInstanceId]);\n    }\n    bucketQueryData.sort(sortTilesIn);\n\n    for (const queryData of bucketQueryData) {\n        const bucketSymbols = queryData.featureIndex.lookupSymbolFeatures(\n            renderedSymbols[queryData.bucketInstanceId],\n            serializedLayers,\n            queryData.bucketIndex,\n            queryData.sourceLayerIndex,\n            {\n                filterSpec: params.filter,\n                globalState: params.globalState\n            },\n            params.layers,\n            params.availableImages,\n            styleLayers);\n\n        for (const layerID in bucketSymbols) {\n            result[layerID] ||= [];\n            const layerSymbols = bucketSymbols[layerID];\n            layerSymbols.sort((a, b) => {\n                // Match topDownFeatureComparator from FeatureIndex, but using\n                // most recent sorting of features from bucket.sortFeatures\n                const featureSortOrder = queryData.featureSortOrder;\n                if (featureSortOrder) {\n                    // queryRenderedSymbols documentation says we'll return features in\n                    // \"top-to-bottom\" rendering order (aka last-to-first).\n                    // Actually, there can be multiple symbol instances per feature, so\n                    // we sort each feature based on the first matching symbol instance.\n                    const sortedA = featureSortOrder.indexOf(a.featureIndex);\n                    const sortedB = featureSortOrder.indexOf(b.featureIndex);\n                    return sortedB - sortedA;\n                } else {\n                    // Bucket hasn't been re-sorted based on angle, so use the\n                    // reverse of the order the features appeared in the data.\n                    return b.featureIndex - a.featureIndex;\n                }\n            });\n            for (const symbolFeature of layerSymbols) {\n                result[layerID].push(symbolFeature);\n            }\n        }\n    }\n\n    return convertFeaturesToMapFeaturesMultiple(result, styleLayers, tileManagers);\n}\n\nexport function querySourceFeatures(tileManager: TileManager, params: QuerySourceFeatureOptionsStrict | undefined): GeoJSONFeature[] {\n    const tiles = tileManager.getRenderableIds().map((id) => {\n        return tileManager.getTileByID(id);\n    });\n\n    const result: GeoJSONFeature[] = [];\n\n    const dataTiles = {};\n    for (const tile of tiles) {\n        const dataID = tile.tileID.canonical.key;\n        if (!dataTiles[dataID]) {\n            dataTiles[dataID] = true;\n            tile.querySourceFeatures(result, params);\n        }\n    }\n\n    return result;\n}\n\nfunction sortTilesIn(a: {tileID: OverscaledTileID}, b: {tileID: OverscaledTileID}) {\n    const idA = a.tileID;\n    const idB = b.tileID;\n    return (idA.overscaledZ - idB.overscaledZ) || (idA.canonical.y - idB.canonical.y) || (idA.wrap - idB.wrap) || (idA.canonical.x - idB.canonical.x);\n}\n\nfunction mergeRenderedFeatureLayers(tiles: RenderedFeatureLayer[]): QueryResults {\n    // Merge results from all tiles, but if two tiles share the same\n    // wrapped ID, don't duplicate features between the two tiles\n    const result: QueryResults = {};\n    const wrappedIDLayerMap = {};\n    for (const {queryResults, wrappedTileID} of tiles) {\n        wrappedIDLayerMap[wrappedTileID] ||= {};\n        const wrappedIDLayers = wrappedIDLayerMap[wrappedTileID];\n        for (const layerID in queryResults) {\n            const tileFeatures = queryResults[layerID];\n            wrappedIDLayers[layerID] ||= {};\n            const wrappedIDFeatures = wrappedIDLayers[layerID];\n            result[layerID] ||= [];\n            for (const tileFeature of tileFeatures) {\n                if (!wrappedIDFeatures[tileFeature.featureIndex]) {\n                    wrappedIDFeatures[tileFeature.featureIndex] = true;\n                    result[layerID].push(tileFeature);\n                }\n            }\n        }\n    }\n    return result;\n}\n\nfunction convertFeaturesToMapFeatures(result: QueryResults, tileManager: TileManager): QueryRenderedFeaturesResults {\n    // Merge state from TileManager into the results\n    for (const layerID in result) {\n        for (const featureWrapper of result[layerID]) {\n            convertFeatureToMapFeature(featureWrapper, tileManager);\n        }\n    }\n    return result as QueryRenderedFeaturesResults;\n}\n\nfunction convertFeaturesToMapFeaturesMultiple(result: QueryResults, styleLayers: {[_: string]: StyleLayer}, tileManagers: {[_: string]: TileManager}): QueryRenderedFeaturesResults {\n    // Merge state from TileManager into the results\n    for (const layerName in result) {\n        for (const featureWrapper of result[layerName]) {\n            const layer = styleLayers[layerName];\n            const tileManager = tileManagers[layer.source];\n            convertFeatureToMapFeature(featureWrapper, tileManager);\n        };\n    }\n    return result as QueryRenderedFeaturesResults;\n}\n\nfunction convertFeatureToMapFeature(featureWrapper: QueryResultsItem, tileManager: TileManager) {\n    const feature = featureWrapper.feature as MapGeoJSONFeature;\n    const state = tileManager.getFeatureState(feature.layer['source-layer'], feature.id);\n    feature.source = feature.layer.source;\n    if (feature.layer['source-layer']) {\n        feature.sourceLayer = feature.layer['source-layer'];\n    }\n    feature.state = state;\n}\n","import {pick, extend, type TileJSON} from '../util/util.ts';\nimport {getJSON} from '../util/ajax.ts';\nimport {ResourceType} from '../util/request_manager.ts';\nimport {browser} from '../util/browser.ts';\n\nimport type {RequestManager} from '../util/request_manager.ts';\nimport type {RasterDEMSourceSpecification, RasterSourceSpecification, VectorSourceSpecification} from '@maplibre/maplibre-gl-style-spec';\n\nexport type LoadTileJsonResponse = {\n    tiles: string[];\n    minzoom: number;\n    maxzoom: number;\n    attribution: string;\n    bounds: RasterSourceSpecification['bounds'];\n    scheme: RasterSourceSpecification['scheme'];\n    tileSize: number;\n    encoding: RasterDEMSourceSpecification['encoding'];\n    vectorLayerIds?: string[];\n};\n\nexport async function loadTileJson(\n    options: RasterSourceSpecification | RasterDEMSourceSpecification | VectorSourceSpecification,\n    requestManager: RequestManager,\n    abortController: AbortController,\n    targetWindow?: Window,\n): Promise<LoadTileJsonResponse | null> {\n    let tileJSON: TileJSON | typeof options = options;\n    if (options.url) {\n        const response = await getJSON<TileJSON>(await requestManager.transformRequest(options.url, ResourceType.Source), abortController);\n        tileJSON = response.data;\n    } else {\n        await browser.frameAsync(abortController, targetWindow);\n    }\n    if (!tileJSON) {\n        return null;\n    }\n    const result = pick(\n        // explicit source options take precedence over TileJSON\n        extend(tileJSON, options),\n        ['tiles', 'minzoom', 'maxzoom', 'attribution', 'bounds', 'scheme', 'tileSize', 'encoding']\n    ) as LoadTileJsonResponse;\n\n    if ('vector_layers' in tileJSON && tileJSON.vector_layers) {\n        result.vectorLayerIds = tileJSON.vector_layers.map((layer) => layer.id);\n    }\n\n    return result;\n}\n","import {LngLat} from './lng_lat.ts';\nimport type {LngLatLike} from './lng_lat.ts';\nimport {wrap} from '../util/util.ts';\n\n/**\n * A {@link LngLatBounds} object, an array of {@link LngLatLike} objects in `[sw, ne]` order,\n * or an array of numbers in `[west, south, east, north]` order.\n *\n * @group Geography and Geometry\n *\n * @example\n * ```ts\n * let v1 = new LngLatBounds(\n *   new LngLat(-73.9876, 40.7661),\n *   new LngLat(-73.9397, 40.8002)\n * );\n * let v2 = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002])\n * let v3 = [[-73.9876, 40.7661], [-73.9397, 40.8002]];\n * ```\n */\nexport type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number];\n\n/**\n * A `LngLatBounds` object represents a geographical bounding box,\n * defined by its southwest and northeast points in longitude and latitude.\n *\n * If no arguments are provided to the constructor, a `null` bounding box is created.\n *\n * Note that any MapLibre GL method that accepts a `LngLatBounds` object as an argument or option\n * can also accept an `Array` of two {@link LngLatLike} constructs and will perform an implicit conversion.\n * This flexible type is documented as {@link LngLatBoundsLike}.\n *\n * @group Geography and Geometry\n *\n * @example\n * ```ts\n * let sw = new LngLat(-73.9876, 40.7661);\n * let ne = new LngLat(-73.9397, 40.8002);\n * let llb = new LngLatBounds(sw, ne);\n * ```\n * @see [Fit to the bounds of a LineString](https://maplibre.org/maplibre-gl-js/docs/examples/fit-to-the-bounds-of-a-linestring/)\n */\nexport class LngLatBounds {\n    _ne: LngLat;\n    _sw: LngLat;\n\n    /**\n     * @param sw - The southwest corner of the bounding box.\n     * OR array of 4 numbers in the order of  west, south, east, north\n     * OR array of 2 LngLatLike: `[sw, ne]`\n     * @param ne - The northeast corner of the bounding box.\n     * @example\n     * ```ts\n     * let sw = new LngLat(-73.9876, 40.7661);\n     * let ne = new LngLat(-73.9397, 40.8002);\n     * let llb = new LngLatBounds(sw, ne);\n     * ```\n     * OR\n     * ```ts\n     * let llb = new LngLatBounds([-73.9876, 40.7661, -73.9397, 40.8002]);\n     * ```\n     * OR\n     * ```ts\n     * let llb = new LngLatBounds([sw, ne]);\n     * ```\n     */\n    constructor(sw?: LngLatLike | [number, number, number, number] | [LngLatLike, LngLatLike], ne?: LngLatLike) {\n        if (!sw) {\n            // noop\n        } else if (ne) {\n            this.setSouthWest(<LngLatLike>sw).setNorthEast(ne);\n        } else if (Array.isArray(sw)) {\n            if (sw.length === 4) {\n            // 4 element array: west, south, east, north\n                this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);\n            } else {\n                this.setSouthWest(sw[0] as LngLatLike).setNorthEast(sw[1] as LngLatLike);\n            }\n        }\n    }\n\n    /**\n     * Set the northeast corner of the bounding box\n     *\n     * @param ne - a {@link LngLatLike} object describing the northeast corner of the bounding box.\n     */\n    setNorthEast(ne: LngLatLike): this {\n        this._ne = ne instanceof LngLat ? new LngLat(ne.lng, ne.lat) : LngLat.convert(ne);\n        return this;\n    }\n\n    /**\n     * Set the southwest corner of the bounding box\n     *\n     * @param sw - a {@link LngLatLike} object describing the southwest corner of the bounding box.\n     */\n    setSouthWest(sw: LngLatLike): this {\n        this._sw = sw instanceof LngLat ? new LngLat(sw.lng, sw.lat) : LngLat.convert(sw);\n        return this;\n    }\n\n    /**\n     * Extend the bounds to include a given LngLatLike or LngLatBoundsLike.\n     *\n     * @param obj - object to extend to\n     */\n    extend(obj: LngLatLike | LngLatBoundsLike): this {\n        const sw = this._sw,\n            ne = this._ne;\n        let sw2, ne2;\n\n        if (obj instanceof LngLat) {\n            sw2 = obj;\n            ne2 = obj;\n\n        } else if (obj instanceof LngLatBounds) {\n            sw2 = obj._sw;\n            ne2 = obj._ne;\n\n            if (!sw2 || !ne2) return this;\n\n        } else {\n            if (Array.isArray(obj)) {\n                if (obj.length === 4 || (obj as any[]).every(Array.isArray)) {\n                    const lngLatBoundsObj = (obj as any as LngLatBoundsLike);\n                    return this.extend(LngLatBounds.convert(lngLatBoundsObj));\n                } else {\n                    const lngLatObj = (obj as any as LngLatLike);\n                    return this.extend(LngLat.convert(lngLatObj));\n                }\n\n            } else if (obj && ('lng' in obj || 'lon' in obj) && 'lat' in obj) {\n                return this.extend(LngLat.convert(obj));\n            }\n\n            return this;\n        }\n\n        if (!sw && !ne) {\n            this._sw = new LngLat(sw2.lng, sw2.lat);\n            this._ne = new LngLat(ne2.lng, ne2.lat);\n\n        } else {\n            sw.lng = Math.min(sw2.lng, sw.lng);\n            sw.lat = Math.min(sw2.lat, sw.lat);\n            ne.lng = Math.max(ne2.lng, ne.lng);\n            ne.lat = Math.max(ne2.lat, ne.lat);\n        }\n\n        return this;\n    }\n\n    /**\n     * Returns the geographical coordinate equidistant from the bounding box's corners.\n     *\n     * @returns The bounding box's center.\n     * @example\n     * ```ts\n     * let llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n     * llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315}\n     * ```\n     */\n    getCenter(): LngLat {\n        return new LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);\n    }\n\n    /**\n     * Returns the southwest corner of the bounding box.\n     *\n     * @returns The southwest corner of the bounding box.\n     */\n    getSouthWest(): LngLat { return this._sw; }\n\n    /**\n     * Returns the northeast corner of the bounding box.\n     *\n     * @returns The northeast corner of the bounding box.\n     */\n    getNorthEast(): LngLat { return this._ne; }\n\n    /**\n     * Returns the northwest corner of the bounding box.\n     *\n     * @returns The northwest corner of the bounding box.\n     */\n    getNorthWest(): LngLat { return new LngLat(this.getWest(), this.getNorth()); }\n\n    /**\n     * Returns the southeast corner of the bounding box.\n     *\n     * @returns The southeast corner of the bounding box.\n     */\n    getSouthEast(): LngLat { return new LngLat(this.getEast(), this.getSouth()); }\n\n    /**\n     * Returns the west edge of the bounding box.\n     *\n     * @returns The west edge of the bounding box.\n     */\n    getWest(): number { return this._sw.lng; }\n\n    /**\n     * Returns the south edge of the bounding box.\n     *\n     * @returns The south edge of the bounding box.\n     */\n    getSouth(): number { return this._sw.lat; }\n\n    /**\n     * Returns the east edge of the bounding box.\n     *\n     * @returns The east edge of the bounding box.\n     */\n    getEast(): number { return this._ne.lng; }\n\n    /**\n     * Returns the north edge of the bounding box.\n     *\n     * @returns The north edge of the bounding box.\n     */\n    getNorth(): number { return this._ne.lat; }\n\n    /**\n     * Returns the bounding box represented as an array.\n     *\n     * @returns The bounding box represented as an array, consisting of the\n     * southwest and northeast coordinates of the bounding represented as arrays of numbers.\n     * @example\n     * ```ts\n     * let llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n     * llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]]\n     * ```\n     */\n    toArray(): [[number, number], [number, number]] {\n        return [this._sw.toArray(), this._ne.toArray()];\n    }\n\n    /**\n     * Return the bounding box represented as a string.\n     *\n     * @returns The bounding box represents as a string of the format\n     * `'LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))'`.\n     * @example\n     * ```ts\n     * let llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n     * llb.toString(); // = \"LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))\"\n     * ```\n     */\n    toString() {\n        return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`;\n    }\n\n    /**\n     * Check if the bounding box is an empty/`null`-type box.\n     *\n     * @returns True if bounds have been defined, otherwise false.\n     */\n    isEmpty(): boolean {\n        return !(this._sw && this._ne);\n    }\n\n    /**\n     * Check if the point is within the bounding box.\n     *\n     * @param lnglat - geographic point to check against.\n     * @returns `true` if the point is within the bounding box.\n     * @example\n     * ```ts\n     * let llb = new LngLatBounds(\n     *   new LngLat(-73.9876, 40.7661),\n     *   new LngLat(-73.9397, 40.8002)\n     * );\n     *\n     * let ll = new LngLat(-73.9567, 40.7789);\n     *\n     * console.log(llb.contains(ll)); // = true\n     * ```\n     */\n    contains(lnglat: LngLatLike): boolean {\n        const {lng, lat} = LngLat.convert(lnglat);\n\n        const containsLatitude = this._sw.lat <= lat && lat <= this._ne.lat;\n        let containsLongitude = this._sw.lng <= lng && lng <= this._ne.lng;\n        if (this._sw.lng > this._ne.lng) { // wrapped coordinates\n            containsLongitude = this._sw.lng >= lng && lng >= this._ne.lng;\n        }\n\n        return containsLatitude && containsLongitude;\n    }\n\n    /**\n     * Checks if this bounding box intersects with another bounding box.\n     *\n     * Returns true if the bounding boxes share any area, including cases where\n     * they only touch along an edge or at a corner.\n     *\n     * This method properly handles cases where either or both bounding boxes cross\n     * the antimeridian (date line).\n     */\n    intersects(other: LngLatBoundsLike): boolean {\n        other = LngLatBounds.convert(other);\n\n        const latIntersects =\n            other.getNorth() >= this.getSouth() &&\n            other.getSouth() <= this.getNorth();\n\n        if (!latIntersects) return false;\n\n        // Check if either bound covers the full world (|span| >= 360°)\n        // This must be done before wrapping to preserve the span information\n        const thisSpan = Math.abs(this.getEast() - this.getWest());\n        const otherSpan = Math.abs(other.getEast() - other.getWest());\n\n        if (thisSpan >= 360 || otherSpan >= 360) {\n            return true;\n        }\n\n        // Normalize longitudes to [-180, 180] range\n        const thisWest = wrap(this.getWest(), -180, 180);\n        const thisEast = wrap(this.getEast(), -180, 180);\n        const otherWest = wrap(other.getWest(), -180, 180);\n        const otherEast = wrap(other.getEast(), -180, 180);\n\n        // Check if either bounds wraps around the antimeridian\n        // Use strict inequality: equal values indicate zero-width bounds (e.g., a point), not wrapping\n        const thisWraps = thisWest > thisEast;\n        const otherWraps = otherWest > otherEast;\n\n        // Both wrap: they always intersect\n        if (thisWraps && otherWraps) {\n            return true;\n        }\n\n        // Only this wraps: intersects if other is outside the gap\n        if (thisWraps) {\n            return otherEast >= thisWest || otherWest <= thisEast;\n        }\n\n        if (otherWraps) {\n            // Only other wraps: intersects if this is outside the gap\n            return thisEast >= otherWest || thisWest <= otherEast;\n        }\n\n        // Neither wraps: standard intersection check\n        return otherWest <= thisEast && otherEast >= thisWest;\n    }\n\n    /**\n     * Converts an array to a `LngLatBounds` object.\n     *\n     * If a `LngLatBounds` object is passed in, the function returns it unchanged.\n     *\n     * Internally, the function calls {@link LngLat.convert} to convert arrays to `LngLat` values.\n     *\n     * @param input - An array of two coordinates to convert, or a `LngLatBounds` object to return.\n     * @returns A new `LngLatBounds` object, if a conversion occurred, or the original `LngLatBounds` object.\n     * @example\n     * ```ts\n     * let arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]];\n     * let llb = LngLatBounds.convert(arr); // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}}\n     * ```\n     */\n    static convert(input: LngLatBoundsLike | null): LngLatBounds {\n        if (input instanceof LngLatBounds) return input;\n        if (!input) return input as null;\n        return new LngLatBounds(input);\n    }\n\n    /**\n     * Returns a `LngLatBounds` from the coordinates extended by a given `radius`. The returned `LngLatBounds` completely contains the `radius`.\n     *\n     * @param center - center coordinates of the new bounds.\n     * @param radius - Distance in meters from the coordinates to extend the bounds.\n     * @returns A new `LngLatBounds` object representing the coordinates extended by the `radius`.\n     * @example\n     * ```ts\n     * let center = new LngLat(-73.9749, 40.7736);\n     * LngLatBounds.fromLngLat(100).toArray(); // = [[-73.97501862141328, 40.77351016847229], [-73.97478137858673, 40.77368983152771]]\n     * ```\n     */\n    static fromLngLat(center: LngLat, radius:number = 0): LngLatBounds {\n        const earthCircumferenceInMetersAtEquator = 40075017;\n        const latAccuracy = 360 * radius / earthCircumferenceInMetersAtEquator,\n            lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * center.lat);\n\n        return new LngLatBounds(new LngLat(center.lng - lngAccuracy, center.lat - latAccuracy),\n            new LngLat(center.lng + lngAccuracy, center.lat + latAccuracy));\n    }\n\n    /**\n     * Adjusts the given bounds to handle the case where the bounds cross the 180th meridian (antimeridian).\n     *\n     * @returns The adjusted LngLatBounds\n     * @example\n     * ```ts\n     * let bounds = new LngLatBounds([175.813127, -20.157768], [-178. 340903, -15.449124]);\n     * let adjustedBounds = bounds.adjustAntiMeridian();\n     * // adjustedBounds will be: [[175.813127, -20.157768], [181.659097, -15.449124]]\n     * ```\n     */\n    adjustAntiMeridian(): LngLatBounds {\n        const sw = new LngLat(this._sw.lng, this._sw.lat);\n        const ne = new LngLat(this._ne.lng, this._ne.lat);\n\n        if (sw.lng > ne.lng) {\n            return new LngLatBounds(\n                sw,\n                new LngLat(ne.lng + 360, ne.lat)\n            );\n        }\n\n        return new LngLatBounds(sw, ne);\n    }\n\n}\n","import {LngLatBounds, type LngLatBoundsLike} from '../geo/lng_lat_bounds.ts';\nimport {mercatorXfromLng, mercatorYfromLat} from '../geo/mercator_coordinate.ts';\n\nimport type {CanonicalTileID} from './tile_id.ts';\n\nexport class TileBounds {\n    bounds: LngLatBounds;\n    minzoom: number;\n    maxzoom: number;\n\n    constructor(bounds: [number, number, number, number], minzoom?: number | null, maxzoom?: number | null) {\n        this.bounds = LngLatBounds.convert(this.validateBounds(bounds));\n        this.minzoom = minzoom || 0;\n        this.maxzoom = maxzoom || 24;\n    }\n\n    validateBounds(bounds: [number, number, number, number]): LngLatBoundsLike {\n        // make sure the bounds property contains valid longitude and latitudes\n        if (!Array.isArray(bounds) || bounds.length !== 4) return [-180, -90, 180, 90];\n        return [Math.max(-180, bounds[0]), Math.max(-90, bounds[1]), Math.min(180, bounds[2]), Math.min(90, bounds[3])];\n    }\n\n    contains(tileID: CanonicalTileID): boolean {\n        const worldSize = Math.pow(2, tileID.z);\n        const level = {\n            minX: Math.floor(mercatorXfromLng(this.bounds.getWest()) * worldSize),\n            minY: Math.floor(mercatorYfromLat(this.bounds.getNorth()) * worldSize),\n            maxX: Math.ceil(mercatorXfromLng(this.bounds.getEast()) * worldSize),\n            maxY: Math.ceil(mercatorYfromLat(this.bounds.getSouth()) * worldSize)\n        };\n        return tileID.x >= level.minX && tileID.x < level.maxX && tileID.y >= level.minY && tileID.y < level.maxY;\n    }\n}\n","import {ErrorEvent, Evented} from '../util/evented.ts';\nimport {MapSourceDataEvent, type SourceEventType} from '../ui/events.ts';\n\nimport {ensureError, extend, pick} from '../util/util.ts';\nimport {loadTileJson} from './load_tilejson.ts';\nimport {TileBounds} from '../tile/tile_bounds.ts';\nimport {ResourceType} from '../util/request_manager.ts';\nimport {MessageType} from '../util/actor_messages.ts';\nimport {isAbortError} from '../util/abort_error.ts';\n\nimport type {Source} from './source.ts';\nimport type {OverscaledTileID} from '../tile/tile_id.ts';\nimport type {Map} from '../ui/map.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {VectorSourceSpecification, PromoteIdSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {WorkerTileParameters, OverzoomParameters, WorkerTileResult, TileEncoding} from './worker_source.ts';\n\nexport type VectorTileSourceOptions = VectorSourceSpecification & {\n    collectResourceTiming?: boolean;\n    tileSize?: number;\n};\n\nexport type LoadTileResult = {\n    /**\n     * Indicates that the tile requested was not modified.\n     */\n    unmodified?: boolean;\n};\n\n/**\n * A source containing vector tiles in [Maplibre Vector Tile format](https://maplibre.org/maplibre-tile-spec/) or [Mapbox Vector Tile format](https://docs.mapbox.com/vector-tiles/reference/).\n * (See the [Style Specification](https://maplibre.org/maplibre-style-spec/) for detailed documentation of options.)\n *\n * @group Sources\n *\n * @example\n * ```ts\n * map.addSource('some id', {\n *     type: 'vector',\n *     url: 'https://demotiles.maplibre.org/tiles/tiles.json'\n * });\n * ```\n *\n * @example\n * ```ts\n * map.addSource('some id', {\n *     type: 'vector',\n *     tiles: ['https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt'],\n *     minzoom: 6,\n *     maxzoom: 14\n * });\n * ```\n *\n * @example\n * ```ts\n * map.getSource('some id').setUrl(\"https://demotiles.maplibre.org/tiles/tiles.json\");\n * ```\n *\n * @example\n * ```ts\n * map.getSource('some id').setTiles(['https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt']);\n * ```\n * @see [Add a vector tile source](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-vector-tile-source/)\n */\nexport class VectorTileSource extends Evented<SourceEventType> implements Source {\n    type: 'vector';\n    id: string;\n    minzoom: number;\n    maxzoom: number;\n    url: string;\n    scheme: string;\n    encoding: TileEncoding;\n    tileSize: number;\n    promoteId: PromoteIdSpecification;\n\n    _options: VectorSourceSpecification;\n    _collectResourceTiming: boolean;\n    dispatcher: Dispatcher;\n    map: Map;\n    bounds: [number, number, number, number];\n    tiles: string[];\n    tileBounds: TileBounds;\n    reparseOverscaled: boolean;\n    isTileClipped: boolean;\n    _tileJSONRequest: AbortController;\n    _loaded: boolean;\n\n    constructor(id: string, options: VectorTileSourceOptions, dispatcher: Dispatcher, eventedParent: Evented) {\n        super();\n        this.id = id;\n        this.dispatcher = dispatcher;\n\n        this.type = 'vector';\n        this.minzoom = 0;\n        this.maxzoom = 22;\n        this.scheme = 'xyz';\n        this.tileSize = 512;\n        this.reparseOverscaled = true;\n        this.isTileClipped = true;\n        this._loaded = false;\n\n        extend(this, pick(options, ['url', 'scheme', 'tileSize', 'promoteId', 'encoding']));\n        this._options = extend({type: 'vector'}, options);\n\n        this._collectResourceTiming = options.collectResourceTiming;\n\n        if (this.tileSize !== 512) {\n            throw new Error('vector tile sources must have a tileSize of 512');\n        }\n\n        this.setEventedParent(eventedParent);\n    }\n\n    async load(sourceDataChanged: boolean = false): Promise<void> {\n        this._loaded = false;\n        this.fire(new MapSourceDataEvent('dataloading'));\n        this._tileJSONRequest = new AbortController();\n        try {\n            const tileJSON = await loadTileJson(this._options, this.map._requestManager, this._tileJSONRequest, this.map._ownerWindow);\n            this._tileJSONRequest = null;\n            this._loaded = true;\n            if (tileJSON) {\n                extend(this, tileJSON);\n                if (tileJSON.bounds) this.tileBounds = new TileBounds(tileJSON.bounds, this.minzoom, this.maxzoom);\n\n                // `content` is included here to prevent a race condition where `Style._updateSources` is called\n                // before the TileJSON arrives. this makes sure the tiles needed are loaded once TileJSON arrives\n                // ref: https://github.com/mapbox/mapbox-gl-js/pull/4347#discussion_r104418088\n                this.fire(new MapSourceDataEvent('data', {sourceDataType: 'metadata'}));\n                this.fire(new MapSourceDataEvent('data', {sourceDataType: 'content', sourceDataChanged}));\n            }\n        } catch (err) {\n            this._tileJSONRequest = null;\n            this._loaded = true; // let's pretend it's loaded so the source will be ignored\n\n            // only fire error event if it is not due to aborting the request\n            if (!isAbortError(err)) {\n                this.fire(new ErrorEvent(ensureError(err)));\n            }\n        }\n    }\n\n    loaded(): boolean {\n        return this._loaded;\n    }\n\n    hasTile(tileID: OverscaledTileID): boolean {\n        return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n    }\n\n    onAdd(map: Map): void {\n        this.map = map;\n        this.load();\n    }\n\n    setSourceProperty(callback: Function): void {\n        if (this._tileJSONRequest) {\n            this._tileJSONRequest.abort();\n        }\n\n        callback();\n\n        this.load(true);\n    }\n\n    /**\n     * Sets the source `tiles` property and re-renders the map.\n     *\n     * @param tiles - An array of one or more tile source URLs, as in the TileJSON spec.\n     */\n    setTiles(tiles: string[]): this {\n        this.setSourceProperty(() => {\n            this._options.tiles = tiles;\n        });\n\n        return this;\n    }\n\n    /**\n     * Sets the source `url` property and re-renders the map.\n     *\n     * @param url - A URL to a TileJSON resource. Supported protocols are `http:` and `https:`.\n     */\n    setUrl(url: string): this {\n        this.setSourceProperty(() => {\n            this.url = url;\n            this._options.url = url;\n        });\n\n        return this;\n    }\n\n    onRemove(): void {\n        if (this._tileJSONRequest) {\n            this._tileJSONRequest.abort();\n            this._tileJSONRequest = null;\n        }\n    }\n\n    serialize(): VectorSourceSpecification {\n        return extend({}, this._options);\n    }\n\n    async loadTile(tile: Tile): Promise<LoadTileResult | void> {\n        const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);\n        const params: WorkerTileParameters = {\n            request: await this.map._requestManager.transformRequest(url, ResourceType.Tile),\n            uid: tile.uid,\n            tileID: tile.tileID,\n            zoom: tile.tileID.overscaledZ,\n            tileSize: this.tileSize * tile.tileID.overscaleFactor(),\n            type: this.type,\n            source: this.id,\n            pixelRatio: this.map.getPixelRatio(),\n            showCollisionBoxes: this.map.showCollisionBoxes,\n            promoteId: this.promoteId,\n            subdivisionGranularity: this.map.style.projection.subdivisionGranularity,\n            encoding: this.encoding,\n            overzoomParameters: await this._getOverzoomParameters(tile),\n            etag: tile.etag\n        };\n        params.request.collectResourceTiming = this._collectResourceTiming;\n        await this.dispatcher.waitForInitComplete();\n        let messageType: MessageType.loadTile | MessageType.reloadTile = MessageType.reloadTile;\n        if (!tile.actor || tile.state === 'expired') {\n            tile.actor = this.dispatcher.getReadyActor();\n            messageType = MessageType.loadTile;\n        } else if (tile.state === 'loading') {\n            return new Promise<void>((resolve, reject) => {\n                tile.reloadPromise = {resolve, reject};\n            });\n        }\n        tile.abortController = new AbortController();\n        try {\n            const data = await tile.actor.sendAsync({type: messageType, data: params}, tile.abortController);\n            delete tile.abortController;\n\n            if (tile.aborted) {\n                return;\n            }\n            this._afterTileLoadWorkerResponse(tile, data);\n\n            const result: LoadTileResult = {};\n            if (data?.etagUnmodified) result.unmodified = true;\n            return result;\n        } catch (err) {\n            delete tile.abortController;\n\n            if (tile.aborted || isAbortError(err)) {\n                return;\n            }\n            if (err && err.status !== 404) {\n                throw err;\n            }\n            this._afterTileLoadWorkerResponse(tile, null);\n        }\n    }\n\n    /**\n     * When the requested tile has a higher canonical Z than source maxzoom, pass overzoom parameters so worker can load the\n     * deepest tile at source max zoom to generate sub tiles using geojsonvt for highest performance on vector overscaling\n     */\n    private async _getOverzoomParameters(tile: Tile): Promise<OverzoomParameters | undefined> {\n        if (tile.tileID.canonical.z <= this.maxzoom) {\n            return undefined;\n        }\n        if (this.map._zoomLevelsToOverscale === undefined) {\n            return undefined;\n        }\n        const maxZoomTileID = tile.tileID.scaledTo(this.maxzoom).canonical;\n        const maxZoomTileUrl = maxZoomTileID.url(this.tiles, this.map.getPixelRatio(), this.scheme);\n\n        return {\n            maxZoomTileID,\n            overzoomRequest: await this.map._requestManager.transformRequest(maxZoomTileUrl, ResourceType.Tile)\n        };\n    }\n\n    private _afterTileLoadWorkerResponse(tile: Tile, data: WorkerTileResult) {\n        if (data?.resourceTiming) {\n            tile.resourceTiming = data.resourceTiming;\n        }\n\n        if (data && this.map._refreshExpiredTiles) {\n            tile.setExpiryData(data);\n        }\n        tile.etag = data?.etag;\n\n        tile.loadVectorData(data, this.map.painter);\n\n        if (tile.reloadPromise) {\n            const reloadPromise = tile.reloadPromise;\n            tile.reloadPromise = null;\n            this.loadTile(tile).then(reloadPromise.resolve).catch(reloadPromise.reject);\n        }\n    }\n\n    async abortTile(tile: Tile): Promise<void> {\n        if (tile.abortController) {\n            tile.abortController.abort();\n            delete tile.abortController;\n        }\n        if (tile.actor) {\n            await tile.actor.sendAsync({\n                type: MessageType.abortTile,\n                data: {uid: tile.uid, type: this.type, source: this.id}\n            });\n        }\n    }\n\n    async unloadTile(tile: Tile): Promise<void> {\n        tile.unloadVectorData();\n        if (tile.actor) {\n            await tile.actor.sendAsync({\n                type: MessageType.removeTile,\n                data: {\n                    uid: tile.uid,\n                    type: this.type,\n                    source: this.id}\n            });\n        }\n    }\n\n    hasTransition() {\n        return false;\n    }\n}\n","import {ensureError, extend, pick} from '../util/util.ts';\n\nimport {ImageRequest} from '../util/image_request.ts';\n\nimport {ResourceType} from '../util/request_manager.ts';\nimport {ErrorEvent, Evented} from '../util/evented.ts';\nimport {MapSourceDataEvent, type SourceEventType} from '../ui/events.ts';\nimport {loadTileJson} from './load_tilejson.ts';\nimport {TileBounds} from '../tile/tile_bounds.ts';\nimport {Texture} from '../webgl/texture.ts';\nimport {isAbortError} from '../util/abort_error.ts';\n\nimport type {Source} from './source.ts';\nimport type {OverscaledTileID} from '../tile/tile_id.ts';\nimport type {Map} from '../ui/map.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {\n    RasterSourceSpecification,\n    RasterDEMSourceSpecification\n} from '@maplibre/maplibre-gl-style-spec';\n\n/**\n * A source containing raster tiles (See the [raster source documentation](https://maplibre.org/maplibre-style-spec/sources/#raster) for detailed documentation of options.)\n *\n * @group Sources\n *\n * \\> ℹ️ **Note:** The default `tileSize` is `512`. If your tile provider (such as OpenStreetMap or Stadia Maps) serves 256px tiles, set `tileSize: 256` manually to avoid blurry rendering due to upscaling.\n *\n * @example\n * ```ts\n * map.addSource('raster-source', {\n *     'type': 'raster',\n *     'tiles': ['https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg'],\n *     'tileSize': 256, // Set this to match tile server output to avoid blurry rendering\n * });\n * ```\n *\n * @example\n * ```ts\n * map.addSource('wms-test-source', {\n *      'type': 'raster',\n * // use the tiles option to specify a WMS tile source URL\n *      'tiles': [\n *          'https://img.nj.gov/imagerywms/Natural2015?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&transparent=true&width=256&height=256&layers=Natural2015'\n *      ],\n *      'tileSize': 256 // Important for WMS if tiles are 256px\n * });\n * ```\n * @see [Add a raster tile source](https://maplibre.org/maplibre-gl-js/docs/examples/map-tiles/)\n * @see [Add a WMS source](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-wms-source/)\n * @see [Display a satellite map](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-satellite-map/)\n */\nexport class RasterTileSource extends Evented<SourceEventType> implements Source {\n    type: 'raster' | 'raster-dem';\n    id: string;\n    minzoom: number;\n    maxzoom: number;\n    url: string;\n    scheme: string;\n    tileSize: number;\n\n    bounds: [number, number, number, number];\n    tileBounds: TileBounds;\n    roundZoom: boolean;\n    dispatcher: Dispatcher;\n    map: Map;\n    tiles: string[];\n\n    _loaded: boolean;\n    _options: RasterSourceSpecification | RasterDEMSourceSpecification;\n    _premultiplyAlpha: boolean;\n    _tileJSONRequest: AbortController;\n\n    constructor(id: string, options: RasterSourceSpecification | RasterDEMSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n        super();\n        this.id = id;\n        this.dispatcher = dispatcher;\n        this.setEventedParent(eventedParent);\n\n        this.type = 'raster';\n        this.minzoom = 0;\n        this.maxzoom = 22;\n        this.roundZoom = true;\n        this.scheme = 'xyz';\n        this.tileSize = 512;\n        this._loaded = false;\n        this._premultiplyAlpha = true;\n\n        this._options = extend({type: 'raster'}, options);\n        extend(this, pick(options, ['url', 'scheme', 'tileSize']));\n    }\n\n    async load(sourceDataChanged: boolean = false): Promise<void> {\n        this._loaded = false;\n        this.fire(new MapSourceDataEvent('dataloading'));\n        this._tileJSONRequest = new AbortController();\n        try {\n            const tileJSON = await loadTileJson(this._options, this.map._requestManager, this._tileJSONRequest, this.map._ownerWindow);\n            this._tileJSONRequest = null;\n            this._loaded = true;\n            if (tileJSON) {\n                extend(this, tileJSON);\n                if (tileJSON.bounds) this.tileBounds = new TileBounds(tileJSON.bounds, this.minzoom, this.maxzoom);\n\n                // `content` is included here to prevent a race condition where `Style._updateSources` is called\n                // before the TileJSON arrives. this makes sure the tiles needed are loaded once TileJSON arrives\n                // ref: https://github.com/mapbox/mapbox-gl-js/pull/4347#discussion_r104418088\n                this.fire(new MapSourceDataEvent('data', {sourceDataType: 'metadata'}));\n                this.fire(new MapSourceDataEvent('data', {sourceDataType: 'content', sourceDataChanged}));\n            }\n        } catch (err) {\n            this._tileJSONRequest = null;\n            this._loaded = true; // let's pretend it's loaded so the source will be ignored\n\n            // only fire error event if it is not due to aborting the request\n            if (!isAbortError(err)) {\n                this.fire(new ErrorEvent(ensureError(err)));\n            }\n        }\n    }\n\n    loaded(): boolean {\n        return this._loaded;\n    }\n\n    onAdd(map: Map): void {\n        this.map = map;\n        this.load();\n    }\n\n    onRemove(): void {\n        if (this._tileJSONRequest) {\n            this._tileJSONRequest.abort();\n            this._tileJSONRequest = null;\n        }\n    }\n\n    setSourceProperty(callback: Function): void {\n        if (this._tileJSONRequest) {\n            this._tileJSONRequest.abort();\n            this._tileJSONRequest = null;\n        }\n\n        callback();\n\n        this.load(true);\n    }\n\n    /**\n     * Sets the source `tiles` property and re-renders the map.\n     *\n     * @param tiles - An array of one or more tile source URLs, as in the raster tiles spec (See the [Style Specification](https://maplibre.org/maplibre-style-spec/)\n     */\n    setTiles(tiles: string[]): this {\n        this.setSourceProperty(() => {\n            this._options.tiles = tiles;\n        });\n\n        return this;\n    }\n\n    /**\n     * Sets the source `url` property and re-renders the map.\n     *\n     * @param url - A URL to a TileJSON resource. Supported protocols are `http:` and `https:`.\n     */\n    setUrl(url: string): this {\n        this.setSourceProperty(() => {\n            this.url = url;\n            this._options.url = url;\n        });\n\n        return this;\n    }\n\n    serialize(): RasterSourceSpecification | RasterDEMSourceSpecification {\n        return extend({}, this._options);\n    }\n\n    /**\n     * Sets whether alpha premultiplication is applied to raster tile images.\n     * Set to `false` to preserve exact RGBA byte values when alpha carries data instead of opacity.\n     *\n     * @param premultiplyAlpha - If `false`, disables alpha premultiplication for raster tile image decode and texture upload.\n     * @example\n     * ```ts\n     * map.getSource<RasterTileSource>('raster-source').setPremultiplyAlpha(false);\n     * ```\n     */\n    setPremultiplyAlpha(premultiplyAlpha: boolean): this {\n        if (this._premultiplyAlpha === premultiplyAlpha) return this;\n\n        this.setSourceProperty(() => {\n            this._premultiplyAlpha = premultiplyAlpha;\n        });\n\n        return this;\n    }\n\n    hasTile(tileID: OverscaledTileID): boolean {\n        return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n    }\n\n    async loadTile(tile: Tile): Promise<void> {\n        const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);\n        const premultiply = this._premultiplyAlpha;\n        const imageBitmapOptions = premultiply ? undefined : {premultiplyAlpha: 'none'} as const;\n        const request = await this.map._requestManager.transformRequest(url, ResourceType.Tile);\n        tile.abortController = new AbortController();\n        try {\n            const response = await ImageRequest.getImage(\n                request,\n                tile.abortController,\n                this.map._refreshExpiredTiles,\n                imageBitmapOptions\n            );\n            delete tile.abortController;\n            if (tile.aborted) {\n                tile.state = 'unloaded';\n                return;\n            }\n            if (response?.data) {\n                if (this.map._refreshExpiredTiles && (response.cacheControl || response.expires)) {\n                    tile.setExpiryData({cacheControl: response.cacheControl, expires: response.expires});\n                }\n                const context = this.map.painter.context;\n                const gl = context.gl;\n                const img = response.data;\n                tile.texture = this.map.painter.getTileTexture(img.width);\n                if (tile.texture) {\n                    tile.texture.update(img, {useMipmap: true, premultiply});\n                } else {\n                    tile.texture = new Texture(context, img, gl.RGBA, {useMipmap: true, premultiply});\n                    tile.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n                }\n                tile.state = 'loaded';\n            }\n        } catch (err) {\n            delete tile.abortController;\n            if (tile.aborted) {\n                tile.state = 'unloaded';\n            } else if (err) {\n                tile.state = 'errored';\n                throw err;\n            }\n        }\n    }\n\n    async abortTile(tile: Tile): Promise<void> {\n        if (tile.abortController) {\n            tile.abortController.abort();\n            delete tile.abortController;\n        }\n    }\n\n    async unloadTile(tile: Tile): Promise<void> {\n        if (tile.texture) {\n            this.map.painter.saveTileTexture(tile.texture);\n        }\n    }\n\n    hasTransition(): boolean {\n        return false;\n    }\n}\n","import {ImageRequest} from '../util/image_request.ts';\nimport {ResourceType} from '../util/request_manager.ts';\nimport {extend, isImageBitmap, readImageUsingVideoFrame} from '../util/util.ts';\nimport {type Evented} from '../util/evented.ts';\nimport {browser} from '../util/browser.ts';\nimport {offscreenCanvasSupported} from '../util/offscreen_canvas_supported.ts';\nimport {OverscaledTileID} from '../tile/tile_id.ts';\nimport {RasterTileSource} from './raster_tile_source.ts';\n// ensure DEMData is registered for worker transfer on main thread:\nimport '../data/dem_data.ts';\nimport type {DEMEncoding} from '../data/dem_data.ts';\n\nimport type {Source} from './source.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {RasterDEMSourceSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport {isOffscreenCanvasDistorted} from '../util/offscreen_canvas_distorted.ts';\nimport {RGBAImage} from '../util/image.ts';\nimport {MessageType} from '../util/actor_messages.ts';\n\n/**\n * A source containing raster DEM tiles (See the [Style Specification](https://maplibre.org/maplibre-style-spec/) for detailed documentation of options.)\n * This source can be used to show hillshading and 3D terrain\n *\n * @group Sources\n *\n * @example\n * ```ts\n * map.addSource('raster-dem-source', {\n *      type: 'raster-dem',\n *      url: 'https://demotiles.maplibre.org/terrain-tiles/tiles.json',\n *      tileSize: 256\n * });\n * ```\n * @see [3D Terrain](https://maplibre.org/maplibre-gl-js/docs/examples/3d-terrain/)\n */\nexport class RasterDEMTileSource extends RasterTileSource implements Source {\n    encoding: DEMEncoding;\n    redFactor?: number;\n    greenFactor?: number;\n    blueFactor?: number;\n    baseShift?: number;\n\n    constructor(id: string, options: RasterDEMSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n        super(id, options, dispatcher, eventedParent);\n        this.type = 'raster-dem';\n        this.maxzoom = 22;\n        this._options = extend({type: 'raster-dem'}, options);\n        this.encoding = options.encoding || 'mapbox';\n        this.redFactor = options.redFactor;\n        this.greenFactor = options.greenFactor;\n        this.blueFactor = options.blueFactor;\n        this.baseShift = options.baseShift;\n    }\n\n    override async loadTile(tile: Tile): Promise<void> {\n        const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);\n        const request = await this.map._requestManager.transformRequest(url, ResourceType.Tile);\n        tile.neighboringTiles = this._getNeighboringTiles(tile.tileID);\n        tile.abortController = new AbortController();\n        try {\n            const response = await ImageRequest.getImage(request, tile.abortController, this.map._refreshExpiredTiles);\n            delete tile.abortController;\n            if (tile.aborted) {\n                tile.state = 'unloaded';\n                return;\n            }\n            if (response?.data) {\n                const img = response.data;\n                if (this.map._refreshExpiredTiles && (response.cacheControl || response.expires)) {\n                    tile.setExpiryData({cacheControl: response.cacheControl, expires: response.expires});\n                }\n                const transfer = isImageBitmap(img) && offscreenCanvasSupported();\n                const rawImageData = transfer ? img : await this.readImageNow(img);\n                const params = {\n                    type: this.type,\n                    uid: tile.uid,\n                    source: this.id,\n                    rawImageData,\n                    encoding: this.encoding,\n                    redFactor: this.redFactor,\n                    greenFactor: this.greenFactor,\n                    blueFactor: this.blueFactor,\n                    baseShift: this.baseShift\n                };\n\n                if (tile.actor && tile.state !== 'expired' && tile.state !== 'reloading') {\n                    return;\n                }\n                await this.dispatcher.waitForInitComplete();\n                if (!tile.actor || tile.state === 'expired') {\n                    tile.actor = this.dispatcher.getReadyActor();\n                }\n                tile.dem = await tile.actor.sendAsync({type: MessageType.loadDEMTile, data: params});\n                tile.needsHillshadePrepare = true;\n                tile.needsTerrainPrepare = true;\n                tile.state = 'loaded';\n            }\n        } catch (err) {\n            delete tile.abortController;\n            if (tile.aborted) {\n                tile.state = 'unloaded';\n            } else if (err) {\n                tile.state = 'errored';\n                throw err;\n            }\n        }\n    }\n\n    async readImageNow(img: ImageBitmap | HTMLImageElement): Promise<RGBAImage | ImageData> {\n        if (typeof VideoFrame !== 'undefined' && isOffscreenCanvasDistorted()) {\n            const width = img.width + 2;\n            const height = img.height + 2;\n            try {\n                return new RGBAImage({width, height}, await readImageUsingVideoFrame(img, -1, -1, width, height));\n            } catch {\n                // fall-back to browser canvas decoding\n            }\n        }\n        return browser.getImageData(img, 1);\n    }\n\n    _getNeighboringTiles(tileID: OverscaledTileID): Record<string, {backfilled: boolean}> {\n        const canonical = tileID.canonical;\n        const dim = Math.pow(2, canonical.z);\n\n        const px = (canonical.x - 1 + dim) % dim;\n        const pxw = canonical.x === 0 ? tileID.wrap - 1 : tileID.wrap;\n        const nx = (canonical.x + 1 + dim) % dim;\n        const nxw = canonical.x + 1 === dim ? tileID.wrap + 1 : tileID.wrap;\n\n        const neighboringTiles: Record<string, {backfilled: boolean}> = {};\n        // add adjacent tiles\n        neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y).key] = {backfilled: false};\n        neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y).key] = {backfilled: false};\n\n        // Add upper neighboringTiles\n        if (canonical.y > 0) {\n            neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y - 1).key] = {backfilled: false};\n            neighboringTiles[new OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y - 1).key] = {backfilled: false};\n            neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y - 1).key] = {backfilled: false};\n        }\n        // Add lower neighboringTiles\n        if (canonical.y + 1 < dim) {\n            neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y + 1).key] = {backfilled: false};\n            neighboringTiles[new OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y + 1).key] = {backfilled: false};\n            neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y + 1).key] = {backfilled: false};\n        }\n\n        return neighboringTiles;\n    }\n\n    async unloadTile(tile: Tile): Promise<void> {\n        if (tile.demTexture) this.map.painter.saveTileTexture(tile.demTexture);\n        if (tile.fbo) {\n            tile.fbo.destroy();\n            delete tile.fbo;\n        }\n        if (tile.dem) delete tile.dem;\n        delete tile.neighboringTiles;\n\n        tile.state = 'unloaded';\n        if (tile.actor) {\n            await tile.actor.sendAsync({type: MessageType.removeDEMTile, data: {type: this.type, uid: tile.uid, source: this.id}});\n        }\n    }\n}\n","/**\n * A way to identify a feature, either by string or by number\n */\nexport type GeoJSONFeatureId = number | string;\n\n/**\n * The geojson source diff object - processed in the following order: remove, add, update. Provides an efficient\n * way to update GeoJSON data in a map source without having to replace the entire dataset.\n */\nexport type GeoJSONSourceDiff = {\n    /**\n     * When set to `true` it will remove all features\n     */\n    removeAll?: boolean;\n    /**\n     * An array of features IDs to remove\n     */\n    remove?: GeoJSONFeatureId[];\n    /**\n     * An array of features to add\n     */\n    add?: GeoJSON.Feature[];\n    /**\n     * An array of update objects\n     */\n    update?: GeoJSONFeatureDiff[];\n};\n\n/**\n * A geojson feature diff object - processed in the following order: new geometry, remove properties, add/update properties.\n * Provides an efficient way to update GeoJSON features in a map source without replacing the entire feature.\n */\nexport type GeoJSONFeatureDiff = {\n    /**\n     * The feature ID\n     */\n    id: GeoJSONFeatureId;\n    /**\n     * If it's a new geometry, place it here\n     */\n    newGeometry?: GeoJSON.Geometry;\n    /**\n     * Setting to `true` will remove all preperties\n     */\n    removeAllProperties?: boolean;\n    /**\n     * The properties keys to remove\n     */\n    removeProperties?: string[];\n    /**\n     * The properties to add or update along side their values\n     */\n    addOrUpdateProperties?: Array<{key: string; value: any}>;\n};\n\nexport type UpdateableGeoJSON = GeoJSON.Feature | GeoJSON.FeatureCollection | undefined;\n\nfunction getFeatureId(feature: GeoJSON.Feature, promoteId?: string): GeoJSONFeatureId | undefined {\n    return promoteId ? feature.properties[promoteId] : feature.id;\n}\n\n/**\n * Converts a GeoJSON object into a map of feature IDs to GeoJSON features.\n * @param data - The GeoJSON object to convert.\n * @param promoteId - If set, the feature id will be set to the promoteId property value.\n * @returns A map of feature IDs to GeoJSON features, or `undefined` if the GeoJSON object is not a valid updateable object.\n *\n * Features must have unique identifiers to be updateable. IDs can come from:\n * - The feature's `id` property (standard GeoJSON)\n * - A promoted property specified by `promoteId` (e.g., a \"name\" property)\n */\nexport function toUpdateable(data: GeoJSON.GeoJSON | undefined, promoteId?: string): Map<GeoJSONFeatureId, GeoJSON.Feature> | undefined {\n    const updateable = new Map<GeoJSONFeatureId, GeoJSON.Feature>();\n\n    // null can be updated - empty updateable\n    if (data == null) {\n        return updateable;\n    }\n\n    // {} can be updated - empty updateable\n    if (data.type == null) {\n        return updateable;\n    }\n\n    // a single feature with an id can be updated, need to explicitly check against null because 0 is a valid feature id that is falsy\n    if (data.type === 'Feature') {\n        const id = getFeatureId(data, promoteId);\n        if (id == null) return undefined;\n\n        updateable.set(id, data);\n        return updateable;\n    }\n\n    // a feature collection can be updated if every feature has a unique id, which prevents the silent dropping of features\n    if (data.type === 'FeatureCollection') {\n        const seenIds = new Set<GeoJSONFeatureId>();\n\n        for (const feature of data.features) {\n            const id = getFeatureId(feature, promoteId);\n            if (id == null) return undefined;\n\n            if (seenIds.has(id)) return undefined;\n            seenIds.add(id);\n\n            updateable.set(id, feature);\n        }\n\n        return updateable;\n    }\n\n    return undefined;\n}\n\n/**\n * Mutates updateable and applies a {@link GeoJSONSourceDiff}. Operations are processed in a specific order to ensure predictable behavior:\n * 1. Remove operations (removeAll, remove)\n * 2. Add operations (add)\n * 3. Update operations (update)\n * @returns an array of geometries that were affected by the diff - with the exception of removeAll which does not track any affected geometries.\n */\nexport function applySourceDiff(updateable: Map<GeoJSONFeatureId, GeoJSON.Feature>, diff: GeoJSONSourceDiff, promoteId?: string): GeoJSON.Geometry[] {\n    const affectedGeometries: GeoJSON.Geometry[] = [];\n\n    if (diff.removeAll) {\n        updateable.clear();\n    }\n    else if (diff.remove) {\n        for (const id of diff.remove) {\n            const existing = updateable.get(id);\n            if (!existing) continue;\n\n            affectedGeometries.push(existing.geometry);\n            updateable.delete(id);\n        }\n    }\n\n    if (diff.add) {\n        for (const feature of diff.add) {\n            const id = getFeatureId(feature, promoteId);\n            if (id == null) continue;\n\n            const existing = updateable.get(id);\n            if (existing) affectedGeometries.push(existing.geometry);\n\n            affectedGeometries.push(feature.geometry);\n            updateable.set(id, feature);\n        }\n    }\n\n    if (diff.update) {\n        for (const update of diff.update) {\n            const existing = updateable.get(update.id);\n            if (!existing) continue;\n\n            const changeGeometry = !!update.newGeometry;\n\n            const changeProps =\n                update.removeAllProperties ||\n                update.removeProperties?.length > 0 ||\n                update.addOrUpdateProperties?.length > 0;\n\n            // nothing to do\n            if (!changeGeometry && !changeProps) continue;\n\n            // clone once since we'll mutate\n            affectedGeometries.push(existing.geometry);\n            const feature = {...existing};\n            updateable.set(update.id, feature);\n\n            if (changeGeometry) {\n                affectedGeometries.push(update.newGeometry);\n                feature.geometry = update.newGeometry;\n            }\n\n            if (changeProps) {\n                if (update.removeAllProperties) {\n                    feature.properties = {};\n                } else {\n                    feature.properties = {...feature.properties || {}};\n                }\n\n                if (update.removeProperties) {\n                    for (const key of update.removeProperties) {\n                        delete feature.properties[key];\n                    }\n                }\n\n                if (update.addOrUpdateProperties) {\n                    for (const {key, value} of update.addOrUpdateProperties) {\n                        feature.properties[key] = value;\n                    }\n                }\n            }\n        }\n    }\n\n    return affectedGeometries;\n}\n\n/**\n * Merge two GeoJSONSourceDiffs, considering the order of operations as specified above (remove, add, update).\n *\n * For `add` features that use promoteId, the feature id will be set to the promoteId value temporarily so that\n * the merge can be completed, then reverted to the original promoteId state after the merge.\n */\nexport function mergeSourceDiffs(\n    prevDiff: GeoJSONSourceDiff | undefined,\n    nextDiff: GeoJSONSourceDiff | undefined,\n    promoteId?: string\n): GeoJSONSourceDiff {\n    if (!prevDiff) return nextDiff || {};\n    if (!nextDiff) return prevDiff || {};\n\n    if (promoteId) {\n        // Temporarily normalize diff.add for features using promoteId\n        promoteFeatureIds(prevDiff.add, promoteId);\n        promoteFeatureIds(nextDiff.add, promoteId);\n    }\n\n    // Hash for o(1) lookups while creating a mutatable copy of the collections\n    const prev = diffToHashed(prevDiff);\n    const next = diffToHashed(nextDiff);\n\n    // Resolve merge conflicts\n    resolveMergeConflicts(prev, next);\n\n    // Simply merge the two diffs now that conflicts have been resolved\n    const merged: GeoJSONSourceDiffHashed = {};\n    if (prev.removeAll || next.removeAll) merged.removeAll = true;\n    merged.remove = new Set([...prev.remove , ...next.remove]);\n    merged.add    = new Map([...prev.add    , ...next.add]);\n    merged.update = new Map([...prev.update , ...next.update]);\n\n    // Squash the merge - removing then adding the same feature\n    if (merged.remove.size && merged.add.size) {\n        for (const id of merged.add.keys()) {\n            merged.remove.delete(id);\n        }\n    }\n\n    // Convert back to array-based representation\n    const mergedDiff = hashedToDiff(merged);\n\n    if (promoteId) {\n        // Revert diff.add for features using promoteId\n        demoteFeatureIds(mergedDiff.add, promoteId);\n    }\n\n    return mergedDiff;\n}\n\n/**\n * Resolve merge conflicts between two GeoJSONSourceDiffs considering the ordering above (remove/add/update).\n *\n * - If you `removeAll` and then `add` features in the same diff, the added features will be kept.\n * - Updates only apply to features that exist after removes and adds have been processed.\n */\nfunction resolveMergeConflicts(prev: GeoJSONSourceDiffHashed, next: GeoJSONSourceDiffHashed) {\n    // Removing all features with added or updated features in previous - and clear no-op removes\n    if (next.removeAll) {\n        prev.add.clear();\n        prev.update.clear();\n        prev.remove.clear();\n        next.remove.clear();\n    }\n\n    // Removing features that were added or updated in previous\n    for (const id of next.remove) {\n        prev.add.delete(id);\n        prev.update.delete(id);\n    }\n\n    // Updating features that were updated in previous\n    for (const [id, nextUpdate] of next.update) {\n        const prevUpdate = prev.update.get(id);\n        if (!prevUpdate) continue;\n\n        next.update.set(id, mergeFeatureDiffs(prevUpdate, nextUpdate));\n        prev.update.delete(id);\n    }\n}\n\n/**\n * Merge two feature diffs for the same feature id, considering the order of operations as specified above (remove, add/update).\n */\nfunction mergeFeatureDiffs(prev: GeoJSONFeatureDiff, next: GeoJSONFeatureDiff): GeoJSONFeatureDiff {\n    const merged: GeoJSONFeatureDiff = {id: prev.id};\n\n    // Removing all properties with added or updated properties in previous - and clear no-op removes\n    if (next.removeAllProperties) {\n        delete prev.removeProperties;\n        delete prev.addOrUpdateProperties;\n        delete next.removeProperties;\n    }\n    // Removing properties that were added or updated in previous\n    if (next.removeProperties) {\n        for (const key of next.removeProperties) {\n            const index = prev.addOrUpdateProperties.findIndex(prop => prop.key === key);\n            if (index > -1) prev.addOrUpdateProperties.splice(index, 1);\n        }\n    }\n\n    // Merge the two diffs\n    if (prev.removeAllProperties || next.removeAllProperties) {\n        merged.removeAllProperties = true;\n    }\n    if (prev.removeProperties || next.removeProperties) {\n        merged.removeProperties = [...prev.removeProperties || [], ...next.removeProperties || []];\n    }\n    if (prev.addOrUpdateProperties || next.addOrUpdateProperties) {\n        merged.addOrUpdateProperties = [...prev.addOrUpdateProperties || [], ...next.addOrUpdateProperties || []];\n    }\n    if (prev.newGeometry || next.newGeometry) {\n        merged.newGeometry = next.newGeometry || prev.newGeometry;\n    }\n\n    return merged;\n}\n\n/**\n * Mutates diff.add and applies a feature id using the promoteId property\n */\nfunction promoteFeatureIds(add: GeoJSON.Feature[], promoteId: string) {\n    if (!add) return;\n\n    for (const feature of add) {\n        const id = getFeatureId(feature, promoteId);\n        if (id != null) feature.id = id;\n    }\n}\n\n/**\n * Mutates diff.add and removes the feature id if using the promoteId property\n */\nfunction demoteFeatureIds(add: GeoJSON.Feature[], promoteId: string) {\n    if (!add) return;\n\n    for (const feature of add) {\n        const id = getFeatureId(feature, promoteId);\n        if (id != null) delete feature.id;\n    }\n}\n\n/**\n * @internal\n * Internal representation of GeoJSONSourceDiff using Sets and Maps for efficient operations\n */\ntype GeoJSONSourceDiffHashed = {\n    removeAll?: boolean;\n    remove?: Set<GeoJSONFeatureId>;\n    add?: Map<GeoJSONFeatureId, GeoJSON.Feature>;\n    update?: Map<GeoJSONFeatureId, GeoJSONFeatureDiff>;\n};\n\n/**\n * @internal\n * Convert a GeoJSONSourceDiff to an idempotent hashed representation using Sets and Maps\n */\nfunction diffToHashed(diff: GeoJSONSourceDiff | undefined): GeoJSONSourceDiffHashed {\n    if (!diff) return {};\n\n    const hashed: GeoJSONSourceDiffHashed = {};\n\n    hashed.removeAll = diff.removeAll;\n    hashed.remove = new Set(diff.remove || []);\n    hashed.add    = new Map(diff.add?.map(feature => [feature.id, feature]));\n    hashed.update = new Map(diff.update?.map(update => [update.id, update]));\n\n    return hashed;\n}\n\n/**\n * @internal\n * Convert a hashed GeoJSONSourceDiff back to the array-based representation\n */\nfunction hashedToDiff(hashed: GeoJSONSourceDiffHashed): GeoJSONSourceDiff {\n    const diff: GeoJSONSourceDiff = {};\n\n    if (hashed.removeAll) {\n        diff.removeAll = hashed.removeAll;\n    }\n    if (hashed.remove) {\n        diff.remove = Array.from(hashed.remove);\n    }\n    if (hashed.add) {\n        diff.add = Array.from(hashed.add.values());\n    }\n    if (hashed.update) {\n        diff.update = Array.from(hashed.update.values());\n    }\n\n    return diff;\n}\n","import {LngLatBounds} from '../geo/lng_lat_bounds.ts';\n\ntype DeepCoordinates = GeoJSON.Position | DeepCoordinates[];\n\nfunction extractCoordinates(coords: DeepCoordinates): number[][] {\n    if (!coords || coords.length === 0) return [];\n\n    if (typeof coords[0] === 'number') {\n        return [coords as number[]];\n    }\n\n    return coords.flatMap(c => extractCoordinates(c));\n}\n\nfunction getCoordinatesFromGeometry(geometry: GeoJSON.Geometry): number[][] {\n    if (geometry.type === 'GeometryCollection') {\n        return geometry.geometries.flatMap(g => getCoordinatesFromGeometry(g));\n    }\n\n    return extractCoordinates(geometry.coordinates);\n}\n\n/**\n * Calculates the bounding box of GeoJSON data.\n * @param data - The GeoJSON data to calculate bounds for\n * @returns The bounding box of the GeoJSON data\n */\nexport function getGeoJSONBounds(data: GeoJSON.GeoJSON): LngLatBounds {\n    const bounds = new LngLatBounds();\n    let coordinates: number[][];\n\n    switch (data.type) {\n        case 'FeatureCollection':\n            coordinates = data.features.flatMap(f => getCoordinatesFromGeometry(f.geometry));\n            break;\n        case 'Feature':\n            coordinates = getCoordinatesFromGeometry(data.geometry);\n            break;\n        default:\n            coordinates = getCoordinatesFromGeometry(data);\n            break;\n    }\n\n    if (coordinates.length === 0) {\n        return bounds;\n    }\n\n    for (const coordinate of coordinates) {\n        const [lng, lat] = coordinate;\n\n        bounds.extend([lng, lat]);\n    }\n    return bounds;\n}\n","import {latFromMercatorY, lngFromMercatorX} from '../geo/mercator_coordinate.ts';\nimport {LngLatBounds} from '../geo/lng_lat_bounds.ts';\nimport type {CanonicalTileID} from './tile_id.ts';\n\nexport function tileIdToLngLatBounds(\n    {x,y,z}: CanonicalTileID,\n    buffer: number = 0,\n): LngLatBounds {\n    const lngMin = lngFromMercatorX((x - buffer) / Math.pow(2, z));\n    const latMin = latFromMercatorY((y + 1 + buffer) / Math.pow(2, z));\n\n    const lngMax = lngFromMercatorX((x + 1 + buffer) / Math.pow(2, z));\n    const latMax = latFromMercatorY((y - buffer) / Math.pow(2, z));\n\n    return new LngLatBounds([lngMin, latMin], [lngMax, latMax]);\n}\n","import {ErrorEvent, Evented} from '../util/evented.ts';\nimport {MapSourceDataEvent, type SourceEventType} from '../ui/events.ts';\nimport {ensureError, extend, warnOnce, type ExactlyOne} from '../util/util.ts';\nimport {EXTENT} from '../data/extent.ts';\nimport {ResourceType} from '../util/request_manager.ts';\nimport {browser} from '../util/browser.ts';\nimport {applySourceDiff, mergeSourceDiffs, toUpdateable} from './geojson_source_diff.ts';\nimport {getGeoJSONBounds} from '../util/geojson_bounds.ts';\nimport {isAbortError} from '../util/abort_error.ts';\nimport {MessageType} from '../util/actor_messages.ts';\nimport {tileIdToLngLatBounds} from '../tile/tile_id_to_lng_lat_bounds.ts';\n\nimport type {LngLatBounds} from '../geo/lng_lat_bounds.ts';\nimport type {Source} from './source.ts';\nimport type {Map} from '../ui/map.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {Actor} from '../util/actor.ts';\nimport type {GeoJSONWorkerSourceLoadDataResult} from '../util/actor_messages.ts';\nimport type {GeoJSONSourceSpecification, PromoteIdSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {GeoJSONFeatureId, GeoJSONSourceDiff} from './geojson_source_diff.ts';\nimport type {GeoJSONWorkerOptions, LoadGeoJSONParameters} from './geojson_worker_source.ts';\nimport type {WorkerTileParameters} from './worker_source.ts';\n\n/**\n * Options object for GeoJSONSource.\n */\nexport type GeoJSONSourceOptions = GeoJSONSourceSpecification & {\n    workerOptions?: GeoJSONWorkerOptions;\n    collectResourceTiming?: boolean;\n    data: GeoJSON.GeoJSON | string;\n};\n\nexport type GeoJSONSourceInternalOptions = {\n    data?: GeoJSON.GeoJSON | string | undefined;\n    cluster?: boolean;\n    clusterMaxZoom?: number;\n    clusterRadius?: number;\n    clusterMinPoints?: number;\n    generateId?: boolean;\n};\n\n/**\n * @internal\n */\nexport type GeoJSONSourceShouldReloadTileOptions = {\n    /**\n     * Refresh all tiles that WILL contain these bounds.\n     */\n    affectedBounds: LngLatBounds[];\n};\n\n/**\n * The cluster options to set\n */\nexport type SetClusterOptions = {\n    /**\n     * Whether or not to cluster\n     */\n    cluster?: boolean;\n    /**\n     * The cluster's max zoom.\n     * Non-integer values are rounded to the closest integer due to supercluster integer value requirements.\n     */\n    clusterMaxZoom?: number;\n    /**\n     * The cluster's radius\n     */\n    clusterRadius?: number;\n};\n\n/**\n * The cluster options currently configured on a source, as returned by `getClusterOptions`\n */\nexport type GetClusterOptions = {\n    /**\n     * Whether or not the source is clustered\n     */\n    cluster: boolean;\n    /**\n     * The cluster's max zoom\n     */\n    clusterMaxZoom: number;\n    /**\n     * The cluster's radius, in pixels\n     */\n    clusterRadius: number;\n};\n\n/**\n * A source containing GeoJSON.\n * (See the [Style Specification](https://maplibre.org/maplibre-style-spec/#sources-geojson) for detailed documentation of options.)\n *\n * @group Sources\n *\n * @example\n * ```ts\n * map.addSource('some id', {\n *     type: 'geojson',\n *     data: 'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_10m_ports.geojson'\n * });\n * ```\n *\n * @example\n * ```ts\n * map.addSource('some id', {\n *    type: 'geojson',\n *    data: {\n *        \"type\": \"FeatureCollection\",\n *        \"features\": [{\n *            \"type\": \"Feature\",\n *            \"properties\": {},\n *            \"geometry\": {\n *                \"type\": \"Point\",\n *                \"coordinates\": [\n *                    -76.53063297271729,\n *                    39.18174077994108\n *                ]\n *            }\n *        }]\n *    }\n * });\n * ```\n *\n * @example\n * ```ts\n * map.getSource('some id').setData({\n *   \"type\": \"FeatureCollection\",\n *   \"features\": [{\n *       \"type\": \"Feature\",\n *       \"properties\": { \"name\": \"Null Island\" },\n *       \"geometry\": {\n *           \"type\": \"Point\",\n *           \"coordinates\": [ 0, 0 ]\n *       }\n *   }]\n * });\n * ```\n * @see [Draw GeoJSON points](https://maplibre.org/maplibre-gl-js/docs/examples/draw-geojson-points/)\n * @see [Add a GeoJSON line](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-geojson-line/)\n * @see [Create a heatmap from points](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-heatmap-layer/)\n * @see [Create and style clusters](https://maplibre.org/maplibre-gl-js/docs/examples/create-and-style-clusters/)\n */\nexport class GeoJSONSource extends Evented<SourceEventType> implements Source {\n    type: 'geojson';\n    id: string;\n    minzoom: number;\n    maxzoom: number;\n    tileSize: number;\n    attribution: string;\n    promoteId: PromoteIdSpecification;\n\n    isTileClipped: boolean;\n    reparseOverscaled: boolean;\n    _data: ExactlyOne<{\n        url: string;\n        geojson: GeoJSON.GeoJSON;\n        updateable: globalThis.Map<GeoJSONFeatureId, GeoJSON.Feature>;\n    }>;\n    _options: GeoJSONSourceInternalOptions;\n    workerOptions: GeoJSONWorkerOptions;\n    map: Map;\n    actorPromise: Promise<Actor>;\n    _isUpdatingWorker: boolean;\n    _updatePromise: Promise<void>;\n    _pendingWorkerUpdate: {\n        data?: GeoJSON.GeoJSON | string;\n        diff?: GeoJSONSourceDiff;\n        updateCluster?: boolean;\n    };\n    _collectResourceTiming: boolean;\n    _removed: boolean;\n\n    /** @internal */\n    constructor(id: string, options: GeoJSONSourceOptions, dispatcher: Dispatcher, eventedParent: Evented) {\n        super();\n\n        this.id = id;\n\n        // `type` is a property rather than a constant to make it easy for 3rd\n        // parties to use GeoJSONSource to build their own source types.\n        this.type = 'geojson';\n\n        this.minzoom = 0;\n        this.maxzoom = 18;\n        this.tileSize = 512;\n        this.isTileClipped = true;\n        this.reparseOverscaled = true;\n        this._removed = false;\n        this._isUpdatingWorker = false;\n        this._pendingWorkerUpdate = {data: options.data};\n\n        this.actorPromise = dispatcher.getActor();\n        this.setEventedParent(eventedParent);\n\n        this._data = typeof options.data === 'string' ? {url: options.data} : {geojson: options.data};\n        this._options = extend({}, options);\n\n        this._collectResourceTiming = options.collectResourceTiming;\n\n        if (options.maxzoom !== undefined) this.maxzoom = options.maxzoom;\n        if (options.type) this.type = options.type;\n        if (options.attribution) this.attribution = options.attribution;\n        this.promoteId = options.promoteId;\n\n        if (options.clusterMaxZoom !== undefined && this.maxzoom <= options.clusterMaxZoom) {\n            warnOnce(`The maxzoom value \"${this.maxzoom}\" is expected to be greater than the clusterMaxZoom value \"${options.clusterMaxZoom}\".`);\n        }\n\n        // sent to the worker, along with `url: ...` or `data: literal geojson`,\n        // so that it can load/parse/index the geojson data\n        // extending with `options.workerOptions` helps to make it easy for\n        // third-party sources to hack/reuse GeoJSONSource.\n        this.workerOptions = extend({\n            source: this.id,\n            geojsonVtOptions: {\n                buffer: this._pixelsToTileUnits(options.buffer !== undefined ? options.buffer : 128),\n                tolerance: this._pixelsToTileUnits(options.tolerance !== undefined ? options.tolerance : 0.375),\n                extent: EXTENT,\n                maxZoom: this.maxzoom,\n                lineMetrics: options.lineMetrics || false,\n                generateId: options.generateId || false,\n                promoteId: typeof options.promoteId === 'string' ? options.promoteId : undefined,\n                cluster: options.cluster || false,\n                clusterOptions: {\n                    maxZoom: this._getClusterMaxZoom(options.clusterMaxZoom),\n                    minPoints: Math.max(2, options.clusterMinPoints || 2),\n                    extent: EXTENT,\n                    radius: this._pixelsToTileUnits(options.clusterRadius || 50),\n                    log: false,\n                    generateId: options.generateId || false\n                },\n            },\n            clusterProperties: options.clusterProperties,\n            filter: options.filter\n        }, options.workerOptions);\n    }\n\n    private _hasPendingWorkerUpdate(): boolean {\n        return this._pendingWorkerUpdate.data !== undefined || this._pendingWorkerUpdate.diff !== undefined || this._pendingWorkerUpdate.updateCluster;\n    }\n\n    private _pixelsToTileUnits(pixelValue: number): number {\n        return pixelValue * (EXTENT / this.tileSize);\n    }\n\n    private _tileUnitsToPixels(tileUnitValue: number): number {\n        return tileUnitValue / (EXTENT / this.tileSize);\n    }\n\n    private _getClusterMaxZoom(clusterMaxZoom: number): number {\n        const effectiveClusterMaxZoom = clusterMaxZoom ? Math.round(clusterMaxZoom) : this.maxzoom - 1;\n        if (!(Number.isInteger(clusterMaxZoom) || clusterMaxZoom === undefined)) {\n            warnOnce(`Integer expected for option 'clusterMaxZoom': provided value \"${clusterMaxZoom}\" rounded to \"${effectiveClusterMaxZoom}\"`);\n        }\n        return effectiveClusterMaxZoom;\n    }\n\n    async load(): Promise<void> {\n        await this._updateWorkerData();\n    }\n\n    onAdd(map: Map): void {\n        this.map = map;\n        this.load();\n    }\n\n    /**\n     * Sets the GeoJSON data and re-renders the map.\n     *\n     * @param data - A GeoJSON data object or a URL to one. The latter is preferable in the case of large GeoJSON files.\n     */\n    setData(data: GeoJSON.GeoJSON | string): Promise<void> {\n        this._data = typeof data === 'string' ? {url: data} : {geojson: data};\n        this._pendingWorkerUpdate = {data};\n        return this._updateWorkerData();\n    }\n\n    /**\n     * Updates the source's GeoJSON, and re-renders the map.\n     *\n     * For sources with lots of features, this method can be used to make updates more quickly.\n     *\n     * This approach requires unique IDs for every feature in the source. The IDs can either be specified on the feature,\n     * or by using the promoteId option to specify which property should be used as the ID.\n     *\n     * It is an error to call updateData on a source that did not have unique IDs for each of its features already.\n     *\n     * Updates are applied on a best-effort basis, updating an ID that does not exist will not result in an error.\n     *\n     * @param diff - The changes that need to be applied.\n     */\n    updateData(diff: GeoJSONSourceDiff): Promise<void> {\n        this._pendingWorkerUpdate.diff = mergeSourceDiffs(this._pendingWorkerUpdate.diff, diff);\n        return this._updateWorkerData();\n    }\n\n    /**\n     * Allows to get the source's actual GeoJSON data.\n     *\n     * @returns a promise which resolves to the source's actual GeoJSON data\n     */\n    async getData(): Promise<GeoJSON.GeoJSON> {\n        if (this._data.url) {\n            await this.once('data'); // wait for loading to complete\n        }\n        if (this._data.geojson) {\n            return this._data.geojson;\n        }\n        return {\n            type: 'FeatureCollection',\n            features: Array.from(this._data.updateable.values())\n        };\n    }\n\n    /**\n     * Allows getting the source's boundaries.\n     * If there's a problem with the source's data, it will return an empty {@link LngLatBounds}.\n     * @returns a promise which resolves to the source's boundaries\n     */\n    async getBounds(): Promise<LngLatBounds> {\n        return getGeoJSONBounds(await this.getData());\n    }\n\n    /**\n     * To disable/enable clustering on the source options\n     * @param options - The options to set\n     * @example\n     * ```ts\n     * map.getSource('some id').setClusterOptions({cluster: false});\n     * map.getSource('some id').setClusterOptions({cluster: false, clusterRadius: 50, clusterMaxZoom: 14});\n     * ```\n     */\n    setClusterOptions(options: SetClusterOptions): Promise<void> {\n        this.workerOptions.geojsonVtOptions.cluster = options.cluster;\n        if (options.clusterRadius !== undefined) {\n            this.workerOptions.geojsonVtOptions.clusterOptions.radius = this._pixelsToTileUnits(options.clusterRadius);\n        }\n        if (options.clusterMaxZoom !== undefined) {\n            this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom = this._getClusterMaxZoom(options.clusterMaxZoom);\n        }\n        this._pendingWorkerUpdate.updateCluster = true;\n        return this._updateWorkerData();\n    }\n\n    /**\n     * Gets the cluster options currently configured on the source.\n     * The returned values mirror the options accepted by `setClusterOptions`.\n     *\n     * @returns the source's current cluster options\n     * @example\n     * ```ts\n     * const {cluster, clusterMaxZoom, clusterRadius} = map.getSource('some id').getClusterOptions();\n     * ```\n     */\n    getClusterOptions(): GetClusterOptions {\n        const {cluster, clusterOptions} = this.workerOptions.geojsonVtOptions;\n        return {\n            cluster,\n            clusterMaxZoom: clusterOptions.maxZoom,\n            clusterRadius: this._tileUnitsToPixels(clusterOptions.radius)\n        };\n    }\n\n    /**\n     * For clustered sources, fetches the zoom at which the given cluster expands.\n     *\n     * @param clusterId - The value of the cluster's `cluster_id` property.\n     * @returns a promise that is resolved with the zoom number\n     */\n    async getClusterExpansionZoom(clusterId: number): Promise<number> {\n        return (await this.actorPromise).sendAsync({type: MessageType.getClusterExpansionZoom, data: {type: this.type, clusterId, source: this.id}});\n    }\n\n    /**\n     * For clustered sources, fetches the children of the given cluster on the next zoom level (as an array of GeoJSON features).\n     *\n     * @param clusterId - The value of the cluster's `cluster_id` property.\n     * @returns a promise that is resolved when the features are retrieved\n     */\n    async getClusterChildren(clusterId: number): Promise<GeoJSON.Feature[]> {\n        return (await this.actorPromise).sendAsync({type: MessageType.getClusterChildren, data: {type: this.type, clusterId, source: this.id}});\n    }\n\n    /**\n     * For clustered sources, fetches the original points that belong to the cluster (as an array of GeoJSON features).\n     *\n     * @param clusterId - The value of the cluster's `cluster_id` property.\n     * @param limit - The maximum number of features to return.\n     * @param offset - The number of features to skip (e.g. for pagination).\n     * @returns a promise that is resolved when the features are retrieved\n     * @example\n     * Retrieve cluster leaves on click\n     * ```ts\n     * map.on('click', 'clusters', (e) => {\n     *   let features = map.queryRenderedFeatures(e.point, {\n     *     layers: ['clusters']\n     *   });\n     *\n     *   let clusterId = features[0].properties.cluster_id;\n     *   let pointCount = features[0].properties.point_count;\n     *   let clusterSource = map.getSource('clusters');\n     *\n     *   const features = await clusterSource.getClusterLeaves(clusterId, pointCount);\n     *   // Print cluster leaves in the console\n     *   console.log('Cluster leaves:', features);\n     * });\n     * ```\n     */\n    async getClusterLeaves(clusterId: number, limit: number, offset: number): Promise<GeoJSON.Feature[]> {\n        return (await this.actorPromise).sendAsync({type: MessageType.getClusterLeaves, data: {\n            type: this.type,\n            source: this.id,\n            clusterId,\n            limit,\n            offset\n        }});\n    }\n\n    /**\n     * Responsible for invoking WorkerSource's geojson.loadData target, which\n     * handles loading the geojson data and preparing to serve it up as tiles,\n     * using geojson-vt or supercluster as appropriate.\n     */\n    async _updateWorkerData(): Promise<void> {\n        if (this._isUpdatingWorker) return this._updatePromise;\n\n        if (!this._hasPendingWorkerUpdate()) {\n            warnOnce(`No pending worker updates for GeoJSONSource ${this.id}.`);\n            return;\n        }\n\n        const {data, diff, updateCluster} = this._pendingWorkerUpdate;\n        // delay awaiting params until _isUpdatingWorker is set, otherwise, a race condition could happen\n        const params = this._getLoadGeoJSONParameters(data, diff, updateCluster);\n\n        if (data !== undefined) {\n            this._pendingWorkerUpdate.data = undefined;\n        } else if (diff) {\n            this._pendingWorkerUpdate.diff = undefined;\n        } else if (updateCluster) {\n            this._pendingWorkerUpdate.updateCluster = undefined;\n        }\n\n        this._updatePromise = this._dispatchWorkerUpdate(params);\n        await this._updatePromise;\n    }\n\n    /**\n     * Create the parameters object that will be sent to the worker and used to load GeoJSON.\n     */\n    private async _getLoadGeoJSONParameters(data: string | GeoJSON.GeoJSON<GeoJSON.Geometry>, diff: GeoJSONSourceDiff, updateCluster: boolean): Promise<LoadGeoJSONParameters | undefined> {\n        const params: LoadGeoJSONParameters = extend({type: this.type, source: this.id}, this.workerOptions);\n\n        // Data comes from a remote url\n        if (typeof data === 'string') {\n            params.request = await this.map._requestManager.transformRequest(browser.resolveURL(data), ResourceType.Source);\n            params.request.collectResourceTiming = this._collectResourceTiming;\n            return params;\n        }\n\n        // Data is a geojson object\n        if (data !== undefined) {\n            params.data = data;\n            return params;\n        }\n\n        // Data is a differential update\n        if (diff) {\n            params.dataDiff = diff;\n            return params;\n        }\n\n        // Update supercluster with the latest worker cluster options\n        if (updateCluster) {\n            params.updateCluster = true;\n            return params;\n        }\n    }\n\n    /**\n     * Send the worker update data from the main thread to the worker\n     */\n    private async _dispatchWorkerUpdate(optionsPromise: Promise<LoadGeoJSONParameters>) {\n        this._isUpdatingWorker = true;\n        this.fire(new MapSourceDataEvent('dataloading'));\n\n        try {\n            const options = await optionsPromise;\n            const result = await (await this.actorPromise).sendAsync({type: MessageType.loadData, data: options});\n            this._isUpdatingWorker = false;\n\n            if (this._removed || result.abandoned) {\n                this.fire(new MapSourceDataEvent('dataabort'));\n                return;\n            }\n\n            // Update the copy of the data in this source with the worker result. (only sent for url based geojson data)\n            if (result.data) {\n                this._data = {geojson: result.data};\n            }\n\n            const affectedGeometries = this._applyDiffToSource(options.dataDiff);\n            const shouldReloadTileOptions = this._getShouldReloadTileOptions(affectedGeometries);\n\n            const eventData: {resourceTiming?: PerformanceResourceTiming[]} = {};\n            this._applyResourceTiming(eventData, result);\n\n            // Fire the metadata event to let the TileManager know it's ok to start requesting tiles.\n            this.fire(new MapSourceDataEvent('data', {...eventData, sourceDataType: 'metadata'}));\n            this.fire(new MapSourceDataEvent('data', {...eventData, sourceDataType: 'content', shouldReloadTileOptions}));\n        } catch (err) {\n            this._isUpdatingWorker = false;\n\n            if (this._removed) {\n                this.fire(new MapSourceDataEvent('dataabort'));\n                return;\n            }\n\n            this.fire(new ErrorEvent(ensureError(err)));\n        } finally {\n            // If there is more pending data, update the worker again.\n            if (this._hasPendingWorkerUpdate()) {\n                await this._updateWorkerData();\n            }\n        }\n    }\n\n    /**\n     * Apply resource timing data to the event object.\n     */\n    private _applyResourceTiming(eventData: {resourceTiming?: PerformanceResourceTiming[]}, result: GeoJSONWorkerSourceLoadDataResult) {\n        if (!this._collectResourceTiming) return;\n\n        const timingData = result.resourceTiming?.[this.id];\n        if (!timingData) return;\n\n        const resourceTiming = timingData.slice(0);\n        if (!resourceTiming?.length) return;\n\n        extend(eventData, {resourceTiming});\n    }\n\n    /**\n     * Apply a diff to this source's data and return the affected feature geometries.\n     * @param diff - The {@link GeoJSONSourceDiff} to apply.\n     * @returns The affected geometries, or undefined if the diff is not applicable or all geometries are affected.\n     */\n    private _applyDiffToSource(diff: GeoJSONSourceDiff): GeoJSON.Geometry[] | undefined {\n        if (!diff) {\n            return undefined;\n        }\n\n        const promoteId = typeof this.promoteId === 'string' ? this.promoteId : undefined;\n\n        // Lazily convert `this._data` to updateable if it's not already\n        if (!this._data.url && !this._data.updateable) {\n            const updateable = toUpdateable(this._data.geojson, promoteId);\n            if (!updateable) throw new Error(`GeoJSONSource \"${this.id}\": GeoJSON data is not compatible with updateData`);\n            this._data = {updateable};\n        }\n\n        if (!this._data.updateable) {\n            return undefined;\n        }\n        const affectedGeometries = applySourceDiff(this._data.updateable, diff, promoteId);\n\n        if (diff.removeAll || this._options.cluster) {\n            return undefined;\n        }\n\n        return affectedGeometries;\n    }\n\n    /**\n     * Get options for use in determining whether to reload a tile based on the modified features.\n     * @param affectedGeometries - The feature geometries affected by the update.\n     * @returns A {@link GeoJSONSourceShouldReloadTileOptions} object which contains an array of affected bounds caused by the update.\n     */\n    private _getShouldReloadTileOptions(affectedGeometries: GeoJSON.Geometry[]): GeoJSONSourceShouldReloadTileOptions | undefined {\n        if (!affectedGeometries) return undefined;\n\n        const affectedBounds = affectedGeometries\n            .filter(Boolean)\n            .map(g => getGeoJSONBounds(g));\n\n        return {affectedBounds};\n    }\n\n    /**\n     * Determine whether a tile should be reloaded based on a set of options associated with a {@link MapSourceDataChangedEvent}.\n     * @internal\n     */\n    shouldReloadTile(tile: Tile, {affectedBounds}: GeoJSONSourceShouldReloadTileOptions): boolean {\n        if (tile.state === 'loading') {\n            return true;\n        }\n        if (tile.state === 'unloaded') {\n            return false;\n        }\n\n        // Update the tile if contained or will contain an updated feature.\n        const {buffer, extent} = this.workerOptions.geojsonVtOptions;\n        const tileBounds = tileIdToLngLatBounds(\n            tile.tileID.canonical,\n            buffer / extent\n        );\n        for (const bounds of affectedBounds) {\n            if (tileBounds.intersects(bounds)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    loaded(): boolean {\n        return !this._isUpdatingWorker && !this._hasPendingWorkerUpdate();\n    }\n\n    async loadTile(tile: Tile): Promise<void> {\n        const message = !tile.actor ?  MessageType.loadTile :  MessageType.reloadTile;\n        tile.actor = await this.actorPromise;\n        const params: WorkerTileParameters = {\n            type: this.type,\n            uid: tile.uid,\n            tileID: tile.tileID,\n            zoom: tile.tileID.overscaledZ,\n            maxZoom: this.maxzoom,\n            tileSize: this.tileSize,\n            source: this.id,\n            pixelRatio: this.map.getPixelRatio(),\n            showCollisionBoxes: this.map.showCollisionBoxes,\n            promoteId: this.promoteId,\n            subdivisionGranularity: this.map.style.projection.subdivisionGranularity\n        };\n\n        tile.abortController = new AbortController();\n        try {\n            const data = await (await this.actorPromise).sendAsync({type: message, data: params}, tile.abortController);\n            delete tile.abortController;\n            tile.unloadVectorData();\n\n            if (!tile.aborted) {\n                tile.loadVectorData(data, this.map.painter, message ===  MessageType.reloadTile);\n            }\n        } catch (err) {\n            delete tile.abortController;\n            if (tile.aborted || isAbortError(err)) {\n                return;\n            }\n            throw err;\n        }\n    }\n\n    async abortTile(tile: Tile): Promise<void> {\n        if (tile.abortController) {\n            tile.abortController.abort();\n            delete tile.abortController;\n        }\n        tile.aborted = true;\n    }\n\n    async unloadTile(tile: Tile): Promise<void> {\n        tile.unloadVectorData();\n        await (await this.actorPromise).sendAsync({type: MessageType.removeTile, data: {uid: tile.uid, type: this.type, source: this.id}});\n    }\n\n    onRemove(): void {\n        this._removed = true;\n        this.actorPromise.then(actor => actor.sendAsync({type: MessageType.removeSource, data: {type: this.type, source: this.id}}));\n    }\n\n    serialize(): GeoJSONSourceSpecification {\n        return extend({}, this._options, {\n            type: this.type,\n            data: this._data.updateable ?\n                {\n                    type: 'FeatureCollection',\n                    features: Array.from(this._data.updateable.values())\n                } :\n                this._data.url || this._data.geojson\n        });\n    }\n\n    hasTransition() {\n        return false;\n    }\n}\n","import {CanonicalTileID} from '../tile/tile_id.ts';\nimport {ErrorEvent, Evented} from '../util/evented.ts';\nimport {MapSourceDataEvent, type SourceEventType} from '../ui/events.ts';\nimport {ImageRequest} from '../util/image_request.ts';\nimport {ResourceType} from '../util/request_manager.ts';\nimport {Texture} from '../webgl/texture.ts';\nimport {MercatorCoordinate} from '../geo/mercator_coordinate.ts';\n\nimport type {Source} from './source.ts';\nimport type {CanvasSourceSpecification} from './canvas_source.ts';\nimport type {Map} from '../ui/map.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {\n    ImageSourceSpecification,\n    VideoSourceSpecification\n} from '@maplibre/maplibre-gl-style-spec';\nimport type Point from '@mapbox/point-geometry';\nimport {ensureError, MAX_TILE_ZOOM} from '../util/util.ts';\nimport {Bounds} from '../geo/bounds.ts';\nimport {isAbortError} from '../util/abort_error.ts';\n\n/**\n * Four geographical coordinates,\n * represented as arrays of longitude and latitude numbers, which define the corners of the image.\n * The coordinates start at the top left corner of the image and proceed in clockwise order.\n * They do not have to represent a rectangle.\n */\nexport type Coordinates = [[number, number], [number, number], [number, number], [number, number]];\n\n/**\n * An already-decoded image that can be handed to an {@link ImageSource} directly,\n * without a network request.\n */\nexport type ImageSourceImage = HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData;\n\n/**\n * The options object for the {@link ImageSource.updateImage} method.\n *\n * Provide exactly one of `url` (to load an image over the network) or `image`\n * (an already-decoded image to display directly, without a network request).\n */\nexport type UpdateImageOptions = {\n    /**\n     * The image coordinates\n     */\n    coordinates?: Coordinates;\n} & ({\n    /**\n     * The image URL to load.\n     */\n    url: string;\n} | {\n    /**\n     * An already-decoded image (`HTMLImageElement`, `HTMLCanvasElement`, `ImageBitmap` or `ImageData`)\n     * to display directly, without a network request.\n     */\n    image: ImageSourceImage;\n});\n\nexport type CanonicalTileRange = {\n    minTileY: number;\n    maxTileY: number;\n\n    /**\n     * Image can exceed the boundary of a single \"world\" (tile 0/0/0),\n     * so we need to know the tile range for wrapping.\n     */\n    minTileXWrapped: number;\n    maxTileXWrapped: number;\n    minWrap: number;\n    maxWrap: number;\n};\n\n/**\n * A data source containing an image.\n * (See the [Style Specification](https://maplibre.org/maplibre-style-spec/#sources-image) for detailed documentation of options.)\n *\n * @group Sources\n *\n * @example\n * ```ts\n * // add to map\n * map.addSource('some id', {\n *    type: 'image',\n *    url: 'https://www.maplibre.org/images/foo.png',\n *    coordinates: [\n *        [-76.54, 39.18],\n *        [-76.52, 39.18],\n *        [-76.52, 39.17],\n *        [-76.54, 39.17]\n *    ]\n * });\n *\n * // update coordinates\n * let mySource = map.getSource('some id');\n * mySource.setCoordinates([\n *     [-76.54335737228394, 39.18579907229748],\n *     [-76.52803659439087, 39.1838364847587],\n *     [-76.5295386314392, 39.17683392507606],\n *     [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * // update url and coordinates simultaneously\n * mySource.updateImage({\n *    url: 'https://www.maplibre.org/images/bar.png',\n *    coordinates: [\n *        [-76.54335737228394, 39.18579907229748],\n *        [-76.52803659439087, 39.1838364847587],\n *        [-76.5295386314392, 39.17683392507606],\n *        [-76.54520273208618, 39.17876344106642]\n *    ]\n * })\n *\n * // update with an already-decoded image (no network request)\n * const bitmap = await createImageBitmap(myCanvas);\n * mySource.updateImage({image: bitmap});\n *\n * map.removeSource('some id');  // remove\n * ```\n */\nexport class ImageSource extends Evented<SourceEventType> implements Source {\n    type: string;\n    id: string;\n    minzoom: number;\n    maxzoom: number;\n    tileSize: number;\n    url: string;\n    /**\n     * This object is used to store the range of terrain tiles that overlap with this tile.\n     * It is relevant for image tiles, as the image exceeds single tile boundaries.\n     */\n    terrainTileRanges: {[zoom: string]: CanonicalTileRange};\n\n    coordinates: Coordinates;\n    tiles: {[_: string]: Tile};\n    options: any;\n    dispatcher: Dispatcher;\n    map: Map;\n    texture: Texture | null;\n    image: ImageSourceImage;\n    tileID: CanonicalTileID;\n    tileCoords: Point[];\n    flippedWindingOrder: boolean = false;\n    _loaded: boolean;\n    _request: AbortController;\n\n    /** @internal */\n    constructor(id: string, options: ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n        super();\n        this.id = id;\n        this.dispatcher = dispatcher;\n        this.coordinates = options.coordinates;\n\n        this.type = 'image';\n        this.minzoom = 0;\n        this.maxzoom = 22;\n        this.tileSize = 512;\n        this.tiles = {};\n        this._loaded = false;\n\n        this.setEventedParent(eventedParent);\n\n        this.options = options;\n    }\n\n    async load(newCoordinates?: Coordinates): Promise<void> {\n        this._loaded = false;\n        this.fire(new MapSourceDataEvent('dataloading'));\n\n        this.url = this.options.url;\n\n        const request = await this.map._requestManager.transformRequest(this.url, ResourceType.Image);\n        this._request = new AbortController();\n        try {\n            const image = await ImageRequest.getImage(request, this._request);\n            this._request = null;\n            this._loaded = true;\n\n            if (image?.data) {\n                this.image = image.data;\n                if (newCoordinates) {\n                    this.coordinates = newCoordinates;\n                }\n                this._finishLoading();\n            }\n        } catch (err) {\n            this._request = null;\n            this._loaded = true;\n            if (!isAbortError(err)) {\n                this.fire(new ErrorEvent(ensureError(err)));\n            }\n        }\n    }\n\n    loaded(): boolean {\n        return this._loaded;\n    }\n\n    /**\n     * Updates the image and, optionally, the coordinates. To avoid having the image flash after changing,\n     * set the `raster-fade-duration` paint property on the raster layer to 0.\n     *\n     * Provide exactly one of `url` (to fetch a new image over the network) or `image` (an\n     * already-decoded `HTMLImageElement`, `HTMLCanvasElement`, `ImageBitmap` or `ImageData` to\n     * display directly, without a network request).\n     *\n     * @param options - The options object.\n     */\n    updateImage(options: UpdateImageOptions): this {\n        if (this._request) {\n            this._request.abort();\n            this._request = null;\n        }\n\n        if ('image' in options) {\n            // Use the already-decoded image directly, skipping the network request.\n            this._loaded = true;\n            this.image = options.image;\n            if (options.coordinates) {\n                this.coordinates = options.coordinates;\n            }\n            this.texture = null;\n            this._finishLoading();\n            return this;\n        }\n\n        if (!options.url) {\n            return this;\n        }\n\n        this.options.url = options.url;\n        this.load(options.coordinates).finally(() => this.texture = null);\n        return this;\n    }\n\n    _finishLoading(): void {\n        if (this.map) {\n            this.setCoordinates(this.coordinates);\n            this.fire(new MapSourceDataEvent('data', {sourceDataType: 'metadata'}));\n        }\n    }\n\n    onAdd(map: Map): void {\n        this.map = map;\n        this.load();\n    }\n\n    onRemove(): void {\n        if (this._request) {\n            this._request.abort();\n            this._request = null;\n        }\n    }\n\n    /**\n     * Sets the image's coordinates and re-renders the map.\n     *\n     * @param coordinates - Four geographical coordinates,\n     * represented as arrays of longitude and latitude numbers, which define the corners of the image.\n     * The coordinates start at the top left corner of the image and proceed in clockwise order.\n     * They do not have to represent a rectangle.\n     */\n    setCoordinates(coordinates: Coordinates): this {\n        this.coordinates = coordinates;\n\n        // Calculate which mercator tile is suitable for rendering the video in\n        // and create a buffer with the corner coordinates. These coordinates\n        // may be outside the tile, because raster tiles aren't clipped when rendering.\n\n        // transform the geo coordinates into (zoom 0) tile space coordinates\n        const cornerCoords = coordinates.map(MercatorCoordinate.fromLngLat);\n\n        // Compute the coordinates of the tile we'll use to hold this image's\n        // render data\n        this.tileID = getCoordinatesCenterTileID(cornerCoords);\n\n        // Compute tiles overlapping with the image. We need to know for which\n        // terrain tiles we have to render the image.\n        this.terrainTileRanges = this._getOverlappingTileRanges(cornerCoords);\n\n        // Constrain min/max zoom to our tile's zoom level in order to force\n        // TileManager to request this tile (no matter what the map's zoom\n        // level)\n        this.minzoom = this.maxzoom = this.tileID.z;\n\n        // Transform the corner coordinates into the coordinate space of our\n        // tile.\n        this.tileCoords = cornerCoords.map((coord) => this.tileID.getTilePoint(coord)._round());\n        this.flippedWindingOrder = hasWrongWindingOrder(this.tileCoords);\n\n        this.fire(new MapSourceDataEvent('data', {sourceDataType: 'content'}));\n        return this;\n    }\n\n    prepare(): void {\n        if (Object.keys(this.tiles).length === 0 || !this.image) {\n            return;\n        }\n\n        const context = this.map.painter.context;\n        const gl = context.gl;\n\n        if (!this.texture) {\n            this.texture = new Texture(context, this.image, gl.RGBA);\n            this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n        }\n\n        let newTilesLoaded = false;\n        for (const w in this.tiles) {\n            const tile = this.tiles[w];\n            if (tile.state !== 'loaded') {\n                tile.state = 'loaded';\n                tile.texture = this.texture;\n                newTilesLoaded = true;\n            }\n        }\n\n        if (newTilesLoaded) {\n            this.fire(new MapSourceDataEvent('data', {sourceDataType: 'idle', sourceId: this.id}));\n        }\n    }\n\n    async loadTile(tile: Tile): Promise<void> {\n        // We have a single tile -- whose coordinates are this.tileID -- that\n        // covers the image we want to render.  If that's the one being\n        // requested, set it up with the image; otherwise, mark the tile as\n        // `errored` to indicate that we have no data for it.\n        // If the world wraps, we may have multiple \"wrapped\" copies of the\n        // single tile.\n        if (this.tileID?.equals(tile.tileID.canonical)) {\n            this.tiles[String(tile.tileID.wrap)] = tile;\n            tile.buckets = {};\n        } else {\n            tile.state = 'errored';\n        }\n    }\n\n    serialize(): ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification {\n        return {\n            type: 'image',\n            url: this.options.url,\n            coordinates: this.coordinates\n        };\n    }\n\n    hasTransition() {\n        return false;\n    }\n\n    /**\n     * Given a list of coordinates, determine overlapping tile ranges for all zoom levels.\n     *\n     * @returns Overlapping tile ranges for all zoom levels.\n     * @internal\n     */\n    private _getOverlappingTileRanges(\n        coords: MercatorCoordinate[]\n    ): {[zoom: string]: CanonicalTileRange} {\n        const {minX, minY, maxX, maxY} = Bounds.fromPoints(coords);\n\n        const ranges: {[zoom: string]: CanonicalTileRange} = {};\n\n        for (let z = 0; z <= MAX_TILE_ZOOM; z++) {\n            const tilesAtZoom = Math.pow(2, z);\n            const minTileX = Math.floor(minX * tilesAtZoom);\n            const minTileY = Math.floor(minY * tilesAtZoom);\n            const maxTileX = Math.floor(maxX * tilesAtZoom);\n            const maxTileY = Math.floor(maxY * tilesAtZoom);\n\n            const minTileXWrapped = ((minTileX % tilesAtZoom) + tilesAtZoom) % tilesAtZoom;\n            const maxTileXWrapped = maxTileX % tilesAtZoom;\n            const minWrap = Math.floor(minTileX / tilesAtZoom);\n            const maxWrap = Math.floor(maxTileX / tilesAtZoom);\n\n            ranges[z] = {\n                minWrap,\n                maxWrap,\n                minTileXWrapped,\n                maxTileXWrapped,\n                minTileY,\n                maxTileY\n            };\n        }\n\n        return ranges;\n    }\n}\n\n/**\n * Given a list of coordinates, get their center as a coordinate.\n *\n * @returns centerpoint\n * @internal\n */\nexport function getCoordinatesCenterTileID(coords: MercatorCoordinate[]): CanonicalTileID {\n    const bounds = Bounds.fromPoints(coords);\n\n    const dx = bounds.width();\n    const dy = bounds.height();\n    const dMax = Math.max(dx, dy);\n    const zoom = Math.max(0, Math.floor(-Math.log(dMax) / Math.LN2));\n    const tilesAtZoom = Math.pow(2, zoom);\n\n    return new CanonicalTileID(\n        zoom,\n        Math.floor((bounds.minX + bounds.maxX) / 2 * tilesAtZoom),\n        Math.floor((bounds.minY + bounds.maxY) / 2 * tilesAtZoom));\n}\n\nfunction hasWrongWindingOrder(coords: Point[]) {\n    const e0x = coords[1].x - coords[0].x;\n    const e0y = coords[1].y - coords[0].y;\n    const e1x = coords[2].x - coords[0].x;\n    const e1y = coords[2].y - coords[0].y;\n\n    const crossProduct = e0x * e1y - e0y * e1x;\n\n    return crossProduct < 0;\n}\n","import {getVideo} from '../util/ajax.ts';\nimport {ResourceType} from '../util/request_manager.ts';\n\nimport {ImageSource} from './image_source.ts';\nimport {Texture} from '../webgl/texture.ts';\nimport {ErrorEvent} from '../util/evented.ts';\nimport {MapSourceDataEvent} from '../ui/events.ts';\nimport {ensureError} from '../util/util.ts';\nimport {ValidationError} from '@maplibre/maplibre-gl-style-spec';\n\nimport type {Map} from '../ui/map.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {Evented} from '../util/evented.ts';\nimport type {VideoSourceSpecification} from '@maplibre/maplibre-gl-style-spec';\n\n/**\n * A data source containing video.\n * (See the [Style Specification](https://maplibre.org/maplibre-style-spec/#sources-video) for detailed documentation of options.)\n *\n * @group Sources\n *\n * @example\n * ```ts\n * // add to map\n * map.addSource('some id', {\n *    type: 'video',\n *    url: [\n *        'https://www.mapbox.com/blog/assets/baltimore-smoke.mp4',\n *        'https://www.mapbox.com/blog/assets/baltimore-smoke.webm'\n *    ],\n *    coordinates: [\n *        [-76.54, 39.18],\n *        [-76.52, 39.18],\n *        [-76.52, 39.17],\n *        [-76.54, 39.17]\n *    ]\n * });\n *\n * // update\n * let mySource = map.getSource('some id');\n * mySource.setCoordinates([\n *     [-76.54335737228394, 39.18579907229748],\n *     [-76.52803659439087, 39.1838364847587],\n *     [-76.5295386314392, 39.17683392507606],\n *     [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * map.removeSource('some id');  // remove\n * ```\n * @see [Add a video](https://maplibre.org/maplibre-gl-js/docs/examples/video-on-a-map/)\n *\n * Note that when rendered as a raster layer, the layer's `raster-fade-duration` property will cause the video to fade in.\n * This happens when playback is started, paused and resumed, or when the video's coordinates are updated. To avoid this behavior,\n * set the layer's `raster-fade-duration` property to `0`.\n */\nexport class VideoSource extends ImageSource {\n    options: VideoSourceSpecification;\n    urls: string[];\n    video: HTMLVideoElement;\n    roundZoom: boolean;\n\n    private _onPlayingHandler = () => {\n        this.map?.triggerRepaint();\n    };\n\n    constructor(id: string, options: VideoSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n        super(id, options, dispatcher, eventedParent);\n        this.roundZoom = true;\n        this.type = 'video';\n        this.options = options;\n    }\n\n    async load(): Promise<void> {\n        this._loaded = false;\n        const options = this.options;\n\n        this.urls = [];\n        for (const url of options.urls) {\n            this.urls.push((await this.map._requestManager.transformRequest(url, ResourceType.Source)).url);\n        }\n        try {\n            const video = await getVideo(this.urls);\n            this._loaded = true;\n            if (!video) {\n                return;\n            }\n            this.video = video;\n            this.video.loop = true;\n\n            // Start repainting when video starts playing. hasTransition() will then return\n            // true to trigger additional frames as long as the videos continues playing.\n            this.video.addEventListener('playing', this._onPlayingHandler);\n\n            if (this.map) {\n                this.video.play();\n            }\n\n            this._finishLoading();\n        } catch (err) {\n            this.fire(new ErrorEvent(ensureError(err)));\n        }\n    }\n\n    /**\n     * Pauses the video.\n     */\n    pause(): void {\n        if (this.video) {\n            this.video.pause();\n        }\n    }\n\n    /**\n     * Plays the video.\n     */\n    play(): void {\n        if (this.video) {\n            this.video.play();\n        }\n    }\n\n    /**\n     * Sets playback to a timestamp, in seconds.\n     */\n    seek(seconds: number): void {\n        if (this.video) {\n            const seekableRange = this.video.seekable;\n            if (seconds < seekableRange.start(0) || seconds > seekableRange.end(0)) {\n                this.fire(new ErrorEvent(new ValidationError(`sources.${this.id}`, null, `Playback for this video can be set only between the ${seekableRange.start(0)} and ${seekableRange.end(0)}-second mark.`)));\n            } else this.video.currentTime = seconds;\n        }\n    }\n\n    /**\n     * Returns the HTML `video` element.\n     *\n     * @returns The HTML `video` element.\n     */\n    getVideo(): HTMLVideoElement {\n        return this.video;\n    }\n\n    onAdd(map: Map): void {\n        if (this.map) return;\n        this.map = map;\n        this.load();\n        if (this.video) {\n            this.video.play();\n            this.setCoordinates(this.coordinates);\n        }\n    }\n\n    onRemove(): void {\n        super.onRemove();\n        if (this.video) {\n            this.video.removeEventListener('playing', this._onPlayingHandler);\n            this.video.pause();\n        }\n    }\n\n    /**\n     * Sets the video's coordinates and re-renders the map.\n     */\n    prepare(): this {\n        if (Object.keys(this.tiles).length === 0 || this.video.readyState < 2) {\n            return; // not enough data for current position\n        }\n\n        const context = this.map.painter.context;\n        const gl = context.gl;\n\n        if (!this.texture) {\n            this.texture = new Texture(context, this.video, gl.RGBA);\n            this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n        } else if (!this.video.paused) {\n            this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n            gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.video);\n        }\n\n        let newTilesLoaded = false;\n        for (const w in this.tiles) {\n            const tile = this.tiles[w];\n            if (tile.state !== 'loaded') {\n                tile.state = 'loaded';\n                tile.texture = this.texture;\n                newTilesLoaded = true;\n            }\n        }\n\n        if (newTilesLoaded) {\n            this.fire(new MapSourceDataEvent('data', {sourceDataType: 'idle', sourceId: this.id}));\n        }\n    }\n\n    serialize(): VideoSourceSpecification {\n        return {\n            type: 'video',\n            urls: this.urls,\n            coordinates: this.coordinates\n        };\n    }\n\n    hasTransition(): boolean {\n        return this.video && !this.video.paused;\n    }\n}\n","import {ImageSource} from './image_source.ts';\n\nimport {Texture} from '../webgl/texture.ts';\nimport {ErrorEvent} from '../util/evented.ts';\nimport {MapSourceDataEvent} from '../ui/events.ts';\nimport {ValidationError} from '@maplibre/maplibre-gl-style-spec';\n\nimport type {Map} from '../ui/map.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {Evented} from '../util/evented.ts';\n\n/**\n * Options to add a canvas source type to the map.\n */\nexport type CanvasSourceSpecification = {\n    /**\n     * Source type. Must be `\"canvas\"`.\n     */\n    type: 'canvas';\n    /**\n     * Four geographical coordinates denoting where to place the corners of the canvas, specified in `[longitude, latitude]` pairs.\n     */\n    coordinates: [[number, number], [number, number], [number, number], [number, number]];\n    /**\n     * Whether the canvas source is animated. If the canvas is static (i.e. pixels do not need to be re-read on every frame), `animate` should be set to `false` to improve performance.\n     * @defaultValue true\n     */\n    animate?: boolean;\n    /**\n     * Canvas source from which to read pixels. Can be a string representing the ID of the canvas element, or the `HTMLCanvasElement` itself.\n     */\n    canvas?: string | HTMLCanvasElement;\n};\n\n/**\n * A data source containing the contents of an HTML canvas. See {@link CanvasSourceSpecification} for detailed documentation of options.\n *\n * @group Sources\n *\n * @example\n * ```ts\n * // add to map\n * map.addSource('some id', {\n *    type: 'canvas',\n *    canvas: 'idOfMyHTMLCanvas',\n *    animate: true,\n *    coordinates: [\n *        [-76.54, 39.18],\n *        [-76.52, 39.18],\n *        [-76.52, 39.17],\n *        [-76.54, 39.17]\n *    ]\n * });\n *\n * // update\n * let mySource = map.getSource('some id');\n * mySource.setCoordinates([\n *     [-76.54335737228394, 39.18579907229748],\n *     [-76.52803659439087, 39.1838364847587],\n *     [-76.5295386314392, 39.17683392507606],\n *     [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * map.removeSource('some id');  // remove\n * ```\n */\nexport class CanvasSource extends ImageSource {\n    options: CanvasSourceSpecification;\n    animate: boolean;\n    canvas: HTMLCanvasElement;\n    width: number;\n    height: number;\n    /**\n     * Enables animation. The image will be copied from the canvas to the map on each frame.\n     */\n    play: () => void;\n    /**\n     * Disables animation. The map will display a static copy of the canvas image.\n     */\n    pause: () => void;\n    _playing: boolean;\n\n    /** @internal */\n    constructor(id: string, options: CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n        super(id, options, dispatcher, eventedParent);\n\n        // We build in some validation here, since canvas sources aren't included in the style spec:\n        if (!options.coordinates) {\n            this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'missing required property \"coordinates\"')));\n        } else if (!Array.isArray(options.coordinates) || options.coordinates.length !== 4 ||\n                options.coordinates.some(c => !Array.isArray(c) || c.length !== 2 || c.some(l => typeof l !== 'number'))) {\n            this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, '\"coordinates\" property must be an array of 4 longitude/latitude array pairs')));\n        }\n\n        if (options.animate && typeof options.animate !== 'boolean') {\n            this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'optional \"animate\" property must be a boolean value')));\n        }\n\n        if (!options.canvas) {\n            this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'missing required property \"canvas\"')));\n        } else if (typeof options.canvas !== 'string' && !(options.canvas instanceof HTMLCanvasElement)) {\n            this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, '\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance')));\n        }\n\n        this.options = options;\n        this.animate = options.animate !== undefined ? options.animate : true;\n    }\n\n    async load(): Promise<void> {\n        this._loaded = true;\n        this.canvas ||= (this.options.canvas instanceof HTMLCanvasElement) ?\n            this.options.canvas :\n            document.getElementById(this.options.canvas) as HTMLCanvasElement;\n        // cast to HTMLCanvasElement in else of ternary\n        // should we do a safety check and throw if it's not actually HTMLCanvasElement?\n        this.width = this.canvas.width;\n        this.height = this.canvas.height;\n\n        if (this._hasInvalidDimensions()) {\n            this.fire(new ErrorEvent(new Error('Canvas dimensions cannot be less than or equal to zero.')));\n            return;\n        }\n\n        this.play = function() {\n            this._playing = true;\n            this.map.triggerRepaint();\n        };\n\n        this.pause = function() {\n            if (this._playing) {\n                this.prepare();\n                this._playing = false;\n            }\n        };\n\n        this._finishLoading();\n    }\n\n    /**\n     * Returns the HTML `canvas` element.\n     *\n     * @returns The HTML `canvas` element.\n     */\n    getCanvas(): HTMLCanvasElement {\n        return this.canvas;\n    }\n\n    onAdd(map: Map): void {\n        this.map = map;\n        this.load();\n        if (this.canvas) {\n            if (this.animate) this.play();\n        }\n    }\n\n    onRemove(): void {\n        this.pause();\n    }\n\n    prepare(): void {\n        let resize = false;\n        if (this.canvas.width !== this.width) {\n            this.width = this.canvas.width;\n            resize = true;\n        }\n        if (this.canvas.height !== this.height) {\n            this.height = this.canvas.height;\n            resize = true;\n        }\n\n        if (this._hasInvalidDimensions()) return;\n\n        if (Object.keys(this.tiles).length === 0) return; // not enough data for current position\n\n        const context = this.map.painter.context;\n        const gl = context.gl;\n\n        if (!this.texture) {\n            this.texture = new Texture(context, this.canvas, gl.RGBA, {premultiply: true});\n            this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n        } else if (resize || this._playing) {\n            this.texture.update(this.canvas, {premultiply: true});\n        }\n\n        let newTilesLoaded = false;\n        for (const w in this.tiles) {\n            const tile = this.tiles[w];\n            if (tile.state !== 'loaded') {\n                tile.state = 'loaded';\n                tile.texture = this.texture;\n                newTilesLoaded = true;\n            }\n        }\n\n        if (newTilesLoaded) {\n            this.fire(new MapSourceDataEvent('data', {sourceDataType: 'idle', sourceId: this.id}));\n        }\n    }\n\n    serialize(): CanvasSourceSpecification {\n        return {\n            type: 'canvas',\n            animate: this.animate,\n            canvas: this.options.canvas,\n            coordinates: this.coordinates\n        };\n    }\n\n    hasTransition(): boolean {\n        return this._playing;\n    }\n\n    _hasInvalidDimensions(): boolean {\n        for (const x of [this.canvas.width, this.canvas.height]) {\n            if (isNaN(x) || x <= 0) return true;\n        }\n        return false;\n    }\n}\n","import {VectorTileSource} from '../source/vector_tile_source.ts';\nimport {RasterTileSource} from '../source/raster_tile_source.ts';\nimport {RasterDEMTileSource} from '../source/raster_dem_tile_source.ts';\nimport {GeoJSONSource, type GeoJSONSourceShouldReloadTileOptions} from '../source/geojson_source.ts';\nimport {VideoSource} from '../source/video_source.ts';\nimport {ImageSource} from '../source/image_source.ts';\nimport {CanvasSource} from '../source/canvas_source.ts';\nimport {type Dispatcher} from '../util/dispatcher.ts';\n\nimport type {SourceSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {Event, Evented} from '../util/evented.ts';\nimport type {Map} from '../ui/map.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {OverscaledTileID, CanonicalTileID} from '../tile/tile_id.ts';\nimport type {LoadTileResult} from '../source/vector_tile_source.ts';\nimport type {CanvasSourceSpecification} from '../source/canvas_source.ts';\nimport {type CalculateTileZoomFunction} from '../geo/projection/covering_tiles.ts';\n\nconst registeredSources = {} as {[key:string]: SourceClass};\n\n/**\n * The `Source` interface must be implemented by each source type, including \"core\" types (`vector`, `raster`,\n * `video`, etc.) and all custom, third-party types.\n *\n * **Event** `data` - Fired with `{dataType: 'source', sourceDataType: 'metadata'}` to indicate that any necessary metadata\n * has been loaded so that it's okay to call `loadTile`; and with `{dataType: 'source', sourceDataType: 'content'}`\n * to indicate that the source data has changed, so that any current caches should be flushed.\n *\n * @group Sources\n */\nexport interface Source {\n    readonly type: string;\n    /**\n     * The id for the source. Must not be used by any existing source.\n     */\n    id: string;\n    /**\n     * The minimum zoom level for the source.\n     */\n    minzoom: number;\n    /**\n     * The maximum zoom level for the source.\n     */\n    maxzoom: number;\n    /**\n     * The tile size for the source.\n     */\n    tileSize: number;\n    /**\n     * The attribution for the source.\n     */\n    attribution?: string;\n    /**\n     * `true` if zoom levels are rounded to the nearest integer in the source data, `false` if they are floor-ed to the nearest integer.\n     */\n    roundZoom?: boolean;\n    /**\n     * `false` if tiles can be drawn outside their boundaries, `true` if they cannot.\n     */\n    isTileClipped?: boolean;\n    tileID?: CanonicalTileID;\n    /**\n     * `true` if tiles should be sent back to the worker for each overzoomed zoom level, `false` if not.\n     */\n    reparseOverscaled?: boolean;\n    vectorLayerIds?: string[];\n    /**\n     * True if the source has transition, false otherwise.\n     */\n    hasTransition(): boolean;\n    /**\n     * True if the source is loaded, false otherwise.\n     */\n    loaded(): boolean;\n    /**\n     * An ability to fire an event to all the listeners, see {@link Evented}\n     * @param event - The event to fire\n     */\n    fire(event: Event): unknown;\n    /**\n     * This method is called when the source is added to the map.\n     * @param map - The map instance\n     */\n    onAdd?(map: Map): void;\n    /**\n     * This method is called when the source is removed from the map.\n     * @param map - The map instance\n     */\n    onRemove?(map: Map): void;\n    /**\n     * This method does the heavy lifting of loading a tile.\n     * In most cases it will defer the work to the relevant worker source.\n     * @param tile - The tile to load\n     */\n    loadTile(tile: Tile): Promise<LoadTileResult | void>;\n    /**\n     * True is the tile is part of the source, false otherwise.\n     * @param tileID - The tile ID\n     */\n    hasTile?(tileID: OverscaledTileID): boolean;\n    /**\n     * Allows to abort a tile loading.\n     * @param tile - The tile to abort\n     */\n    abortTile?(tile: Tile): Promise<void>;\n    /**\n     * Allows to unload a tile.\n     * @param tile - The tile to unload\n     */\n    unloadTile?(tile: Tile): Promise<void>;\n    /**\n     * @returns A plain (stringifiable) JS object representing the current state of the source.\n     * Creating a source using the returned object as the `options` should result in a Source that is\n     * equivalent to this one.\n     */\n    serialize(): any;\n    /**\n     * Allows to execute a prepare step before the source is used.\n     */\n    prepare?(): void;\n    /**\n     * Optional function to redefine how tiles are loaded at high pitch angles.\n     */\n    calculateTileZoom?: CalculateTileZoomFunction;\n    /**\n     * Optional function to determine whether a tile should be reloaded, given a\n     * set of options associated with a `MapSourceDataChangedEvent`.\n     * @internal\n     */\n    shouldReloadTile?(tile: Tile, options: GeoJSONSourceShouldReloadTileOptions): boolean;\n}\n\n/**\n * A general definition of a {@link Source} class for factory usage\n */\nexport type SourceClass = {\n    new (id: string, specification: SourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented): Source;\n};\n\n/**\n * Creates a tiled data source instance given an options object.\n *\n * @param id - The id for the source. Must not be used by any existing source.\n * @param specification - Source options, specific to the source type (except for `options.type`, which is always required).\n * @param source - A source definition object compliant with\n * [`maplibre-gl-style-spec`](https://maplibre.org/maplibre-style-spec/#sources) or, for a third-party source type,\n  * with that type's requirements.\n * @param dispatcher - A {@link Dispatcher} instance, which can be used to send messages to the workers.\n * @returns a newly created source\n */\nexport const create = (id: string, specification: SourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented): Source => {\n\n    const Class = getSourceType(specification.type);\n    const source = new Class(id, specification, dispatcher, eventedParent);\n\n    if (source.id !== id) {\n        throw new Error(`Expected Source id to be ${id} instead of ${source.id}`);\n    }\n\n    return source;\n};\n\nconst getSourceType = (name: string): SourceClass => {\n    switch (name) {\n        case 'geojson':\n            return GeoJSONSource;\n        case 'image':\n            return ImageSource;\n        case 'raster':\n            return RasterTileSource;\n        case 'raster-dem':\n            return RasterDEMTileSource;\n        case 'vector':\n            return VectorTileSource;\n        case 'video':\n            return VideoSource;\n        case 'canvas':\n            return CanvasSource;\n    }\n    return registeredSources[name];\n};\n\nconst setSourceType = (name: string, type: SourceClass) => {\n    registeredSources[name] = type;\n};\n\n/**\n * Adds a custom source type, making it available for use with {@link Map.addSource}.\n * @param name - The name of the source type; source definition objects use this name in the `{type: ...}` field.\n * @param SourceType - A {@link SourceClass} - which is a constructor for the `Source` interface.\n * @returns a promise that is resolved when the source type is ready or rejected with an error.\n */\nexport const addSourceType = async (name: string, SourceType: SourceClass): Promise<void> => {\n    if (getSourceType(name)) {\n        throw new Error(`A source type called \"${name}\" already exists.`);\n    }\n    setSourceType(name, SourceType);\n};\n","import type {CollisionBoxArray} from './array_types.g.ts';\nimport type {Style} from '../style/style.ts';\nimport type {TypedStyleLayer} from '../style/style_layer/typed_style_layer.ts';\nimport type {FeatureIndex} from './feature_index.ts';\nimport type {Context} from '../webgl/context.ts';\nimport type {FeatureStates} from '../source/source_state.ts';\nimport type {ImagePosition} from '../render/image_atlas.ts';\nimport type {CanonicalTileID} from '../tile/tile_id.ts';\nimport type Point from '@mapbox/point-geometry';\nimport type {SubdivisionGranularitySetting} from '../render/subdivision_granularity_settings.ts';\nimport type {DashEntry} from '../render/line_atlas.ts';\nimport type {Feature as StyleFeature} from '@maplibre/maplibre-gl-style-spec';\nimport type {VectorTileFeatureLike, VectorTileLayerLike} from '@maplibre/vt-pbf';\n\nexport type BucketParameters<Layer extends TypedStyleLayer> = {\n    index: number;\n    layers: Layer[];\n    zoom: number;\n    pixelRatio: number;\n    overscaling: number;\n    collisionBoxArray: CollisionBoxArray;\n    sourceLayerIndex: number;\n    sourceID: string;\n};\n\nexport type PopulateParameters = {\n    featureIndex: FeatureIndex;\n    iconDependencies: {};\n    patternDependencies: {};\n    glyphDependencies: {};\n    dashDependencies: Record<string, {round: boolean; dasharray: number[]}>;\n    availableImages: string[];\n    subdivisionGranularity: SubdivisionGranularitySetting;\n};\n\nexport type IndexedFeature = {\n    feature: VectorTileFeatureLike;\n    id: number | string;\n    index: number;\n    sourceLayerIndex: number;\n};\n\nexport type BucketFeature = {\n    index: number;\n    sourceLayerIndex: number;\n    geometry: Point[][];\n    properties: any;\n    type: 0 | 1 | 2 | 3;\n    id?: any;\n    readonly patterns: {\n        [_: string]: {\n            'min': string;\n            'mid': string;\n            'max': string;\n        };\n    };\n    readonly dashes?: NonNullable<StyleFeature['dashes']>;\n    sortKey?: number;\n};\n\n/**\n * @hidden\n * The `Bucket` interface is the single point of knowledge about turning vector\n * tiles into WebGL buffers.\n *\n * `Bucket` is an abstract interface. An implementation exists for each style layer type.\n * Create a bucket via the `StyleLayer.createBucket` method.\n *\n * The concrete bucket types, using layout options from the style layer,\n * transform feature geometries into vertex and index data for use by the\n * vertex shader.  They also (via `ProgramConfiguration`) use feature\n * properties and the zoom level to populate the attributes needed for\n * data-driven styling.\n *\n * Buckets are designed to be built on a worker thread and then serialized and\n * transferred back to the main thread for rendering.  On the worker side, a\n * bucket's vertex, index, and attribute data is stored in `bucket.arrays: ArrayGroup`.\n * When a bucket's data is serialized and sent back to the main thread,\n * is gets deserialized (using `new Bucket(serializedBucketData)`, with\n * the array data now stored in `bucket.buffers: BufferGroup`. BufferGroups\n * hold the same data as ArrayGroups, but are tuned for consumption by WebGL.\n */\nexport interface Bucket {\n    layerIds: string[];\n    hasDependencies: boolean;\n    readonly layers: any[];\n    readonly stateDependentLayers: any[];\n    readonly stateDependentLayerIds: string[];\n    populate(features: IndexedFeature[], options: PopulateParameters, canonical: CanonicalTileID): void;\n    update(states: FeatureStates, vtLayer: VectorTileLayerLike, imagePositions: {[_: string]: ImagePosition}, dashPositions: Record<string, DashEntry>): void;\n    isEmpty(): boolean;\n    upload(context: Context): void;\n    uploadPending(): boolean;\n    /**\n     * Release the WebGL resources associated with the buffers. Note that because\n     * buckets are shared between layers having the same layout properties, they\n     * must be destroyed in groups (all buckets for a tile, or all symbol buckets).\n     */\n    destroy(): void;\n}\n\nexport function deserialize(input: Bucket[], style: Style): {[_: string]: Bucket} {\n    const output = {};\n\n    // Guard against the case where the map's style has been set to null while\n    // this bucket has been parsing.\n    if (!style) return output;\n\n    for (const bucket of input) {\n        const layers = bucket.layerIds\n            .map((id) => style.getLayer(id))\n            .filter(Boolean);\n\n        if (layers.length === 0) {\n            continue;\n        }\n\n        // look up StyleLayer objects from layer ids (since we don't\n        // want to waste time serializing/copying them from the worker)\n        (bucket as any).layers = layers;\n        if (bucket.stateDependentLayerIds) {\n            (bucket as any).stateDependentLayers = bucket.stateDependentLayerIds.map((lId) => layers.filter((l) => l.id === lId)[0]);\n        }\n        for (const layer of layers) {\n            output[layer.id] = bucket;\n        }\n    }\n\n    return output;\n}\n","/**\n * The possible option of the plugin's status\n *\n * `unavailable`: Not loaded.\n *\n * `deferred`: The plugin URL has been specified, but loading has been deferred.\n *\n * `requested`: at least one tile needs RTL to render, but the plugin has not been set\n *\n * `loading`: RTL is in the process of being loaded by worker.\n *\n * `loaded`: The plugin is now loaded\n *\n *  `error`: The plugin failed to load\n */\nexport type RTLPluginStatus =\n                'unavailable' |\n                'deferred' |\n                'requested' |\n                'loading' |\n                'loaded' |\n                'error';\n\n/**\n * The RTL plugin state\n */\nexport type PluginState = {\n    pluginStatus: RTLPluginStatus;\n    pluginURL: string;\n};\n\nexport const RTLPluginLoadedEventName = 'RTLPluginLoaded';\n\n","\nimport {browser} from '../util/browser.ts';\nimport {Event, Evented} from '../util/evented.ts';\nimport {type RTLPluginStatus, RTLPluginLoadedEventName, type PluginState} from './rtl_text_plugin_status.ts';\nimport {type Dispatcher, getGlobalDispatcher} from '../util/dispatcher.ts';\nimport {MessageType} from '../util/actor_messages.ts';\n\nclass RTLMainThreadPlugin extends Evented {\n    status: RTLPluginStatus = 'unavailable';\n    url: string = null;\n    dispatcher: Dispatcher = getGlobalDispatcher();\n\n    /** Sync RTL plugin state by broadcasting a message to the worker */\n    _syncState(statusToSend: RTLPluginStatus): Promise<PluginState[]> {\n        this.status = statusToSend;\n        return this.dispatcher.broadcast(MessageType.syncRTLPluginState, {pluginStatus: statusToSend, pluginURL: this.url})\n            .catch((e: any) => {\n                this.status = 'error';\n                throw e;\n            });\n    }\n\n    /** This one is exposed to outside */\n    getRTLTextPluginStatus(): RTLPluginStatus {\n        return this.status;\n    }\n\n    clearRTLTextPlugin(): void {\n        this.status = 'unavailable';\n        this.url = null;\n    }\n\n    async setRTLTextPlugin(url: string, deferred: boolean = false): Promise<void> {\n        if (this.url) {\n            // error\n            throw new Error('setRTLTextPlugin cannot be called multiple times.');\n        }\n\n        this.url = browser.resolveURL(url);\n        if (!this.url) {\n            throw new Error(`requested url ${url} is invalid`);\n        }\n        if (this.status === 'unavailable') {\n\n            // from initial state:\n            if (deferred) {\n\n                this.status = 'deferred';\n                // fire and forget: in this case it does not need wait for the broadcasting result\n                // it is important to sync the deferred status once because\n                // symbol_bucket will be checking it in worker\n                this._syncState(this.status);\n\n            } else {\n                return this._requestImport();\n            }\n\n        } else if (this.status === 'requested') {\n            return this._requestImport();\n        }\n    }\n\n    /** Send a message to worker which will import the RTL plugin script */\n    async _requestImport() : Promise<void> {\n\n        // all errors/exceptions will be handled by _syncState\n        await this._syncState('loading');\n        this.status = 'loaded';\n        this.fire(new Event(RTLPluginLoadedEventName));\n    }\n\n    /** Start a lazy loading process of RTL plugin */\n    lazyLoad(): void {\n        if (this.status === 'unavailable') {\n            this.status = 'requested';\n        } else if (this.status === 'deferred') {\n            this._requestImport();\n        }\n    }\n}\n\nlet rtlMainThreadPlugin: RTLMainThreadPlugin = null;\n\nexport function rtlMainThreadPluginFactory(): RTLMainThreadPlugin {\n    rtlMainThreadPlugin ||= new RTLMainThreadPlugin();\n    return rtlMainThreadPlugin;\n}\n","import {uniqueId, parseCacheControl} from '../util/util.ts';\nimport {deserialize as deserializeBucket} from '../data/bucket.ts';\nimport {GEOJSON_TILE_LAYER_NAME, type FeatureIndex, type QueryResults} from '../data/feature_index.ts';\nimport {GeoJSONFeature} from '../util/vectortile_to_geojson.ts';\nimport {featureFilter} from '@maplibre/maplibre-gl-style-spec';\nimport {SymbolBucket} from '../data/bucket/symbol_bucket.ts';\nimport {CollisionBoxArray} from '../data/array_types.g.ts';\nimport {Texture} from '../webgl/texture.ts';\nimport {now} from '../util/time_control.ts';\nimport {toEvaluationFeature} from '../data/evaluation_feature.ts';\nimport {EvaluationParameters} from '../style/evaluation_parameters.ts';\nimport {rtlMainThreadPluginFactory} from '../source/rtl_text_plugin_main_thread.ts';\n\nimport type {SourceFeatureState} from '../source/source_state.ts';\nimport type {Bucket} from '../data/bucket.ts';\nimport type {StyleLayer} from '../style/style_layer.ts';\nimport type {TileEncoding, WorkerTileResult} from '../source/worker_source.ts';\nimport type {Actor} from '../util/actor.ts';\nimport type {DEMData} from '../data/dem_data.ts';\nimport type {AlphaImage} from '../util/image.ts';\nimport type {ImageAtlas} from '../render/image_atlas.ts';\nimport type {ImageManager} from '../render/image_manager.ts';\nimport type {Context} from '../webgl/context.ts';\nimport type {OverscaledTileID} from './tile_id.ts';\nimport type {Framebuffer} from '../webgl/framebuffer.ts';\nimport type {IReadonlyTransform} from '../geo/transform_interface.ts';\nimport type {LayerFeatureStates} from '../source/source_state.ts';\nimport type Point from '@mapbox/point-geometry';\nimport type {mat4} from 'gl-matrix';\nimport type {ExpiryData} from '../util/ajax.ts';\nimport type {QueryRenderedFeaturesOptionsStrict, QuerySourceFeatureOptionsStrict} from '../source/query_features.ts';\nimport type {DashEntry} from '../render/line_atlas.ts';\nimport type {VectorTileLayerLike} from '@maplibre/vt-pbf';\nimport type {Painter, RTTObject} from '../render/painter.ts';\n\nconst CLOCK_SKEW_RETRY_TIMEOUT = 30000;\n\n/**\n * The tile's state, can be:\n *\n * - `loading` Tile data is in the process of loading.\n * - `loaded` Tile data has been loaded. Tile can be rendered.\n * - `reloading` Tile data has been loaded and is being updated. Tile can be rendered.\n * - `unloaded` Tile data has been deleted.\n * - `errored` Tile data was not loaded because of an error.\n * - `expired` Tile data was previously loaded, but has expired per its HTTP headers and is in the process of refreshing.\n */\nexport type TileState = 'loading' | 'loaded' | 'reloading' | 'unloaded' | 'errored' | 'expired';\n\n/** @internal */\ntype CrossFadeArgs = {\n    fadingRole: FadingRoles;\n    fadingDirection: FadingDirections;\n    fadingParentID?: OverscaledTileID;\n    fadeEndTime: number;\n};\n\nexport enum FadingRoles {\n    Base, Parent\n}\nexport enum FadingDirections {\n    Departing, Incoming\n}\n\n/**\n * A tile object is the combination of a Coordinate, which defines\n * its place, as well as a unique ID and data tracking for its content\n */\nexport class Tile {\n    tileID: OverscaledTileID;\n    uid: number;\n    uses: number;\n    tileSize: number;\n    buckets: {[_: string]: Bucket};\n    latestFeatureIndex: FeatureIndex | null;\n    latestRawTileData: ArrayBuffer;\n    latestEncoding: TileEncoding;\n    imageAtlas: ImageAtlas;\n    imageAtlasTexture: Texture;\n    dashPositions: {[_: string]: DashEntry};\n    glyphAtlasImage: AlphaImage;\n    glyphAtlasTexture: Texture;\n    etag?: string;\n    expirationTime: any;\n    expiredRequestCount: number;\n    state: TileState;\n    fadingRole: FadingRoles;\n    fadingDirection: FadingDirections;\n    fadingParentID: OverscaledTileID;\n    selfFading: boolean;\n    timeAdded: number = 0;\n    fadeEndTime: number = 0;\n    fadeOpacity: number = 1;\n    collisionBoxArray: CollisionBoxArray;\n    redoWhenDone: boolean;\n    showCollisionBoxes: boolean;\n    placementSource: any;\n    actor: Actor;\n    vtLayers: {[_: string]: VectorTileLayerLike};\n\n    neighboringTiles: Record<string, {backfilled: boolean}>;\n    dem: DEMData;\n    demMatrix: mat4;\n    aborted: boolean;\n    needsHillshadePrepare: boolean;\n    needsTerrainPrepare: boolean;\n    abortController: AbortController;\n    texture: any;\n    fbo: Framebuffer;\n    demTexture: Texture;\n    refreshedUponExpiration: boolean;\n    reloadPromise: {resolve: () => void; reject: () => void};\n    resourceTiming: PerformanceResourceTiming[];\n    queryPadding: number;\n\n    symbolFadeHoldUntil: number;\n    hasSymbolBuckets: boolean;\n    hasRTLText: boolean;\n    dependencies: any;\n    /**\n     * @internal\n     * Caches the result of rendering this 2D tile into a texture so it can be\n     * draped over 3D terrain. Indexed by stack index, where a stack is a\n     * contiguous run of RTT-eligible layers (fill, line, raster, etc.) split\n     * by non-RTT layers like symbols. So `_rttObjects[0]` holds the texture\n     * for layers below the first symbol break, `_rttObjects[1]` for layers\n     * between the first and second symbol breaks, and so on. Each entry\n     * survives across frames until the tile is unloaded or its source data\n     * changes.\n     */\n    rttObjects: Array<RTTObject | undefined>;\n    rttFingerprint: {[sourceId:string]: string};\n\n    featureStateRevision: number;\n\n    /**\n     * @param tileID - the tile ID\n     * @param size - The tile size\n     */\n    constructor(tileID: OverscaledTileID, size: number) {\n        this.tileID = tileID;\n        this.uid = uniqueId();\n        this.uses = 0;\n        this.tileSize = size;\n        this.buckets = {};\n        this.expirationTime = null;\n        this.queryPadding = 0;\n        this.hasSymbolBuckets = false;\n        this.hasRTLText = false;\n        this.dependencies = {};\n        this.rttObjects = [];\n        this.rttFingerprint = {};\n\n        // Counts the number of times a response was already expired when\n        // received. We're using this to add a delay when making a new request\n        // so we don't have to keep retrying immediately in case of a server\n        // serving expired tiles.\n        this.expiredRequestCount = 0;\n\n        this.state = 'loading';\n        this.featureStateRevision = -1;\n    }\n\n    isRenderable(symbolLayer: boolean): boolean {\n        return (\n            this.hasData() &&\n            (!this.fadeEndTime || this.fadeOpacity > 0) &&  // raster fading\n            (symbolLayer || !this.holdingForSymbolFade())   // symbol fading\n        );\n    }\n\n    /**\n     * @internal\n     * Many-to-one crossfade between a base tile and parent/ancestor tile (when zooming)\n     */\n    setCrossFadeLogic({fadingRole, fadingDirection, fadingParentID, fadeEndTime}: CrossFadeArgs): void {\n        this.resetFadeLogic();\n\n        this.fadingRole = fadingRole;\n        this.fadingDirection = fadingDirection;\n        this.fadingParentID = fadingParentID;\n        this.fadeEndTime = fadeEndTime;\n    }\n\n    /**\n     * Self fading for edge tiles (when panning map)\n     */\n    setSelfFadeLogic(fadeEndTime: number): void {\n        this.resetFadeLogic();\n        this.selfFading = true;\n        this.fadeEndTime = fadeEndTime;\n    }\n\n    resetFadeLogic(): void {\n        this.fadingRole = null;\n        this.fadingDirection = null;\n        this.fadingParentID = null;\n        this.selfFading = false;\n\n        this.timeAdded = now();\n        this.fadeEndTime = 0;\n        this.fadeOpacity = 1;\n    }\n\n    wasRequested(): boolean {\n        return this.state === 'errored' || this.state === 'loaded' || this.state === 'reloading';\n    }\n\n    clearTextures(painter: Painter): void {\n        if (this.demTexture) painter.saveTileTexture(this.demTexture);\n        this.demTexture = null;\n    }\n\n    /**\n     * @internal\n     * Returns the cached RTT object for this stack, or undefined on a cache miss.\n     */\n    getRTT(stack: number): RTTObject | undefined {\n        return this.rttObjects[stack];\n    }\n\n    /**\n     * @internal\n     * Allocates a fresh RTT object from the painter's pool and stores it at the\n     * given stack slot. Callers should check {@link getRTT} first; calling this\n     * over an existing slot leaks the previous object.\n     */\n    acquireRTT(painter: Painter, stack: number, size: number): RTTObject {\n        return this.rttObjects[stack] = painter.acquireRTT(size);\n    }\n\n    /**\n     * @internal\n     * Returns all cached RTT slots to the painter's pool.\n     */\n    releaseRTT(painter: Painter): void {\n        if (this.rttObjects.length === 0) return;\n        for (const obj of this.rttObjects) {\n            // Release RTT only if defined (undefined for holes in sparse array)\n            if (obj) painter.releaseRTT(obj);\n        }\n        this.rttObjects.length = 0;\n    }\n\n    /**\n     * Given a data object with a 'buffers' property, load it into\n     * this tile's elementGroups and buffers properties and set loaded\n     * to true. If the data is null, like in the case of an empty\n     * GeoJSON tile, no-op but still set loaded to true.\n     * @param data - The data from the worker\n     * @param painter - the painter\n     * @param justReloaded - `true` to just reload\n     */\n    loadVectorData(data: WorkerTileResult, painter: Painter, justReloaded?: boolean | null): void {\n        if (data?.etagUnmodified === true) {\n            this.state = 'loaded';\n            return;\n        }\n\n        if (this.hasData()) {\n            this.unloadVectorData();\n        }\n\n        this.state = 'loaded';\n\n        // empty GeoJSON tile\n        if (!data) {\n            this.collisionBoxArray = new CollisionBoxArray();\n            return;\n        }\n\n        if (data.featureIndex) {\n            this.latestFeatureIndex = data.featureIndex;\n            if (data.rawTileData) {\n                // Only vector tiles have rawTileData, and they won't update it for\n                // 'reloadTile'\n                this.latestRawTileData = data.rawTileData;\n                this.latestEncoding = data.encoding;\n                this.latestFeatureIndex.rawTileData = data.rawTileData;\n                this.latestFeatureIndex.encoding = data.encoding;\n            } else if (this.latestRawTileData) {\n                // If rawTileData hasn't updated, hold onto a pointer to the last\n                // one we received\n                this.latestFeatureIndex.rawTileData = this.latestRawTileData;\n                this.latestFeatureIndex.encoding = this.latestEncoding;\n            }\n        }\n        this.collisionBoxArray = data.collisionBoxArray;\n        this.buckets = deserializeBucket(data.buckets, painter?.style);\n\n        this.hasSymbolBuckets = false;\n        for (const id in this.buckets) {\n            const bucket = this.buckets[id];\n            if (bucket instanceof SymbolBucket) {\n                this.hasSymbolBuckets = true;\n                if (justReloaded) {\n                    bucket.justReloaded = true;\n                } else {\n                    break;\n                }\n            }\n        }\n\n        this.hasRTLText = false;\n        if (this.hasSymbolBuckets) {\n            for (const id in this.buckets) {\n                const bucket = this.buckets[id];\n                if (bucket instanceof SymbolBucket) {\n                    if (bucket.hasRTLText) {\n                        this.hasRTLText = true;\n                        rtlMainThreadPluginFactory().lazyLoad();\n                        break;\n                    }\n                }\n            }\n        }\n\n        this.queryPadding = 0;\n        for (const id in this.buckets) {\n            const bucket = this.buckets[id];\n            this.queryPadding = Math.max(this.queryPadding, painter.style.getLayer(id).queryRadius(bucket));\n        }\n\n        if (data.imageAtlas) {\n            this.imageAtlas = data.imageAtlas;\n        }\n        if (data.glyphAtlasImage) {\n            this.glyphAtlasImage = data.glyphAtlasImage;\n        }\n        this.dashPositions = data.dashPositions;\n    }\n\n    /**\n     * Release any data or WebGL resources referenced by this tile.\n     */\n    unloadVectorData(): void {\n        for (const id in this.buckets) {\n            this.buckets[id].destroy();\n        }\n        this.buckets = {};\n\n        if (this.imageAtlasTexture) {\n            this.imageAtlasTexture.destroy();\n        }\n\n        if (this.glyphAtlasTexture) {\n            this.glyphAtlasTexture.destroy();\n        }\n\n        this.imageAtlas = null;\n        this.dashPositions = null;\n        this.latestFeatureIndex = null;\n        this.state = 'unloaded';\n    }\n\n    getBucket(layer: StyleLayer): Bucket {\n        return this.buckets[layer.id];\n    }\n\n    upload(context: Context): void {\n        for (const id in this.buckets) {\n            const bucket = this.buckets[id];\n            if (bucket.uploadPending()) {\n                bucket.upload(context);\n            }\n        }\n\n        const gl = context.gl;\n        if (this.imageAtlas && !this.imageAtlas.uploaded) {\n            this.imageAtlasTexture = new Texture(context, this.imageAtlas.image, gl.RGBA);\n            this.imageAtlas.uploaded = true;\n        }\n\n        if (this.glyphAtlasImage) {\n            this.glyphAtlasTexture = new Texture(context, this.glyphAtlasImage, gl.ALPHA);\n            this.glyphAtlasImage = null;\n        }\n    }\n\n    prepare(imageManager: ImageManager): void {\n        if (this.imageAtlas) {\n            this.imageAtlas.patchUpdatedImages(imageManager, this.imageAtlasTexture);\n        }\n    }\n\n    // Queries non-symbol features rendered for this tile.\n    // Symbol features are queried globally\n    queryRenderedFeatures(\n        layers: {[_: string]: StyleLayer},\n        serializedLayers: {[_: string]: any},\n        sourceFeatureState: SourceFeatureState,\n        queryGeometry: Point[],\n        cameraQueryGeometry: Point[],\n        scale: number,\n        params: Pick<QueryRenderedFeaturesOptionsStrict, 'filter' | 'layers' | 'availableImages'> | undefined,\n        transform: IReadonlyTransform,\n        maxPitchScaleFactor: number,\n        pixelPosMatrix: mat4,\n        getElevation: undefined | ((x: number, y: number) => number)\n    ): QueryResults {\n        if (!this.latestFeatureIndex?.rawTileData)\n            return {};\n\n        return this.latestFeatureIndex.query({\n            queryGeometry,\n            cameraQueryGeometry,\n            scale,\n            tileSize: this.tileSize,\n            pixelPosMatrix,\n            transform,\n            params,\n            queryPadding: this.queryPadding * maxPitchScaleFactor,\n            getElevation\n        }, layers, serializedLayers, sourceFeatureState);\n    }\n\n    querySourceFeatures(result: GeoJSONFeature[], params?: QuerySourceFeatureOptionsStrict): void {\n        const featureIndex = this.latestFeatureIndex;\n        if (!featureIndex?.rawTileData) return;\n\n        const vtLayers = featureIndex.loadVTLayers();\n\n        const sourceLayer = params?.sourceLayer ? params.sourceLayer : '';\n        const layer = vtLayers[GEOJSON_TILE_LAYER_NAME] || vtLayers[sourceLayer];\n\n        if (!layer) return;\n\n        const filter = featureFilter(params?.filter, `querySourceFeatures[${sourceLayer}].filter`, params?.globalState);\n        const {z, x, y} = this.tileID.canonical;\n        const coord = {z, x, y};\n\n        for (let i = 0; i < layer.length; i++) {\n            const feature = layer.feature(i);\n            if (filter.needGeometry) {\n                const evaluationFeature = toEvaluationFeature(feature, true);\n                if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), evaluationFeature, this.tileID.canonical)) continue;\n            } else if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {\n                continue;\n            }\n            const id = featureIndex.getId(feature, sourceLayer);\n            const geojsonFeature = new GeoJSONFeature(feature, z, x, y, id);\n            (geojsonFeature as any).tile = coord;\n            result.push(geojsonFeature);\n        }\n    }\n\n    hasData(): boolean {\n        return this.state === 'loaded' || this.state === 'reloading' || this.state === 'expired';\n    }\n\n    patternsLoaded(): boolean {\n        return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;\n    }\n\n    setExpiryData(data: ExpiryData): void {\n        const prior = this.expirationTime;\n\n        if (data.cacheControl) {\n            const parsedCC = parseCacheControl(data.cacheControl);\n            if (parsedCC['max-age']) this.expirationTime = Date.now() + parsedCC['max-age'] * 1000;\n        } else if (data.expires) {\n            this.expirationTime = new Date(data.expires).getTime();\n        }\n\n        if (this.expirationTime) {\n            const now = Date.now();\n            let isExpired = false;\n\n            if (this.expirationTime > now) {\n                isExpired = false;\n            } else if (!prior) {\n                isExpired = true;\n            } else if (this.expirationTime < prior) {\n                // Expiring date is going backwards:\n                // fall back to exponential backoff\n                isExpired = true;\n\n            } else {\n                const delta = this.expirationTime - prior;\n\n                if (!delta) {\n                    // Server is serving the same expired resource over and over: fall\n                    // back to exponential backoff.\n                    isExpired = true;\n\n                } else {\n                    // Assume that either the client or the server clock is wrong and\n                    // try to interpolate a valid expiration date (from the client POV)\n                    // observing a minimum timeout.\n                    this.expirationTime = now + Math.max(delta, CLOCK_SKEW_RETRY_TIMEOUT);\n\n                }\n            }\n\n            if (isExpired) {\n                this.expiredRequestCount++;\n                this.state = 'expired';\n            } else {\n                this.expiredRequestCount = 0;\n            }\n        }\n    }\n\n    getExpiryTimeout(): number {\n        if (this.expirationTime) {\n            if (this.expiredRequestCount) {\n                return 1000 * (1 << Math.min(this.expiredRequestCount - 1, 31));\n            } else {\n                // Max value for `setTimeout` implementations is a 32 bit integer; cap this accordingly\n                return Math.min(this.expirationTime - new Date().getTime(), Math.pow(2, 31) - 1);\n            }\n        }\n    }\n\n    setFeatureState(states: LayerFeatureStates, painter: Painter, revision: number): void {\n        if (!this.latestFeatureIndex?.rawTileData ||\n            Object.keys(states).length === 0) {\n            return;\n        }\n\n        // Skip bucket updates if we already processed this revision\n        if (this.featureStateRevision === revision) {\n            return;\n        }\n        this.featureStateRevision = revision;\n\n        const vtLayers = this.latestFeatureIndex.loadVTLayers();\n\n        for (const id in this.buckets) {\n            if (!painter.style.hasLayer(id)) continue;\n\n            const bucket = this.buckets[id];\n            // Buckets are grouped by common source-layer\n            const sourceLayerId = bucket.layers[0]['sourceLayer'] || GEOJSON_TILE_LAYER_NAME;\n            const sourceLayer = vtLayers[sourceLayerId];\n            const sourceLayerStates = states[sourceLayerId];\n            if (!sourceLayer || !sourceLayerStates || sourceLayerStates.length === 0) continue;\n\n            bucket.update(sourceLayerStates, sourceLayer, this.imageAtlas?.patternPositions || {}, this.dashPositions || {});\n            const layer = painter?.style?.getLayer(id);\n            if (layer) {\n                this.queryPadding = Math.max(this.queryPadding, layer.queryRadius(bucket));\n            }\n        }\n    }\n\n    holdingForSymbolFade(): boolean {\n        return this.symbolFadeHoldUntil !== undefined;\n    }\n\n    symbolFadeFinished(): boolean {\n        return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < now();\n    }\n\n    clearSymbolFadeHold(): void {\n        this.symbolFadeHoldUntil = undefined;\n    }\n\n    setSymbolHoldDuration(duration: number): void {\n        this.symbolFadeHoldUntil = now() + duration;\n    }\n\n    setDependencies(namespace: string, dependencies: string[]): void {\n        const index = {};\n        for (const dep of dependencies) {\n            index[dep] = true;\n        }\n        this.dependencies[namespace] = index;\n    }\n\n    hasDependency(namespaces: string[], keys: string[]): boolean {\n        for (const namespace of namespaces) {\n            const dependencies = this.dependencies[namespace];\n            if (dependencies) {\n                for (const key of keys) {\n                    if (dependencies[key]) {\n                        return true;\n                    }\n                }\n            }\n        }\n        return false;\n    }\n}\n","import {extend} from '../util/util.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {FeatureState} from '@maplibre/maplibre-gl-style-spec';\nimport type {InViewTiles} from '../tile/tile_manager_in_view_tiles.ts';\nimport type {Painter} from '../render/painter.ts';\n\nexport type FeatureStateEntry = {id: string; state: FeatureState};\nexport type FeatureStates = FeatureStateEntry[];\nexport type LayerFeatureStates = Record<string, FeatureStates>;\n\ntype FeatureStatesMap = Record<string, FeatureState>;\ntype LayerFeatureStatesMap = Record<string, FeatureStatesMap>;\n\nfunction featureStatesMapToArray(map: FeatureStatesMap): FeatureStates {\n    const result: FeatureStates = [];\n    for (const id in map) {\n        result.push({id, state: map[id]});\n    }\n    return result;\n}\n\n/**\n * @internal\n * SourceFeatureState manages the state and pending changes\n * to features in a source, separated by source layer.\n * stateChanges and deletedStates batch all changes to the tile (updates and removes, respectively)\n * between coalesce() events. addFeatureState() and removeFeatureState() also update their counterpart's\n * list of changes, such that coalesce() can apply the proper state changes while agnostic to the order of operations.\n * In deletedStates, all null's denote complete removal of state at that scope\n*/\nexport class SourceFeatureState {\n    state: LayerFeatureStatesMap;\n    stateChanges: LayerFeatureStatesMap;\n    deletedStates: {};\n    revision: number;\n\n    constructor() {\n        this.state = {};\n        this.stateChanges = {};\n        this.deletedStates = {};\n        this.revision = 0;\n    }\n\n    updateState(sourceLayer: string, featureId: number | string, newState: any): void {\n        const feature = String(featureId);\n        this.stateChanges[sourceLayer] ||= {};\n        this.stateChanges[sourceLayer][feature] ||= {};\n        extend(this.stateChanges[sourceLayer][feature], newState);\n\n        if (this.deletedStates[sourceLayer] === null) {\n            this.deletedStates[sourceLayer] = {};\n            for (const ft in this.state[sourceLayer]) {\n                if (ft === feature){\n                    this.deletedStates[sourceLayer][feature] = {};\n                    for (const prop in this.state[sourceLayer][ft]){\n                        if (newState[prop] === undefined) this.deletedStates[sourceLayer][feature][prop] = null;\n                    }\n                } else {\n                    this.deletedStates[sourceLayer][ft] = null;\n                }\n            }\n        } else {\n            const featureDeletionQueued = this.deletedStates[sourceLayer]?.[feature] === null;\n            if (featureDeletionQueued) {\n                this.deletedStates[sourceLayer][feature] = {};\n                for (const prop in this.state[sourceLayer][feature]) {\n                    if (newState[prop] === undefined) this.deletedStates[sourceLayer][feature][prop] = null;\n                }\n            } else {\n                for (const key in newState) {\n                    const deletionInQueue = this.deletedStates[sourceLayer]?.[feature]?.[key] === null;\n                    if (deletionInQueue) delete this.deletedStates[sourceLayer][feature][key];\n                }\n            }\n        }\n    }\n\n    removeFeatureState(sourceLayer: string, featureId?: number | string, key?: string): void {\n        const sourceLayerDeleted = this.deletedStates[sourceLayer] === null;\n        if (sourceLayerDeleted) return;\n\n        const feature = String(featureId);\n\n        this.deletedStates[sourceLayer] ||= {};\n\n        if (key && featureId !== undefined) {\n            if (this.deletedStates[sourceLayer][feature] !== null) {\n                this.deletedStates[sourceLayer][feature] ||= {};\n                this.deletedStates[sourceLayer][feature][key] = null;\n            }\n        } else if (featureId !== undefined) {\n            const updateInQueue = this.stateChanges[sourceLayer]?.[feature];\n            if (updateInQueue) {\n                this.deletedStates[sourceLayer][feature] = {};\n                for (key in this.stateChanges[sourceLayer][feature]) this.deletedStates[sourceLayer][feature][key] = null;\n\n            } else {\n                this.deletedStates[sourceLayer][feature] = null;\n            }\n        } else {\n            this.deletedStates[sourceLayer] = null;\n        }\n\n    }\n\n    getState(sourceLayer: string, featureId: number | string): FeatureState {\n        const feature = String(featureId);\n        const base = this.state[sourceLayer] || {};\n        const changes = this.stateChanges[sourceLayer] || {};\n\n        const reconciledState = extend({}, base[feature], changes[feature]);\n\n        //return empty object if the whole source layer is awaiting deletion\n        if (this.deletedStates[sourceLayer] === null) return {};\n        else if (this.deletedStates[sourceLayer]) {\n            const featureDeletions = this.deletedStates[sourceLayer][featureId];\n            if (featureDeletions === null) return {};\n            for (const prop in featureDeletions) delete reconciledState[prop];\n        }\n        return reconciledState;\n    }\n\n    initializeTileState(tile: Tile, painter: Painter): void {\n        const layerStates: LayerFeatureStates = {};\n        for (const sourceLayer in this.state) {\n            layerStates[sourceLayer] = featureStatesMapToArray(this.state[sourceLayer]);\n        }\n        tile.setFeatureState(layerStates, painter, this.revision);\n    }\n\n    coalesceChanges(inViewTiles: InViewTiles, painter: Painter): void {\n        //track changes with full state objects, but only for features that got modified\n        //use an intermediate object keyed by feature id to naturally deduplicate entries\n        const featuresChangedMap: LayerFeatureStatesMap = {};\n\n        for (const sourceLayer in this.stateChanges) {\n            this.state[sourceLayer] ||= {};\n            featuresChangedMap[sourceLayer] ||= {};\n            for (const feature in this.stateChanges[sourceLayer]) {\n                this.state[sourceLayer][feature] ||= {};\n                extend(this.state[sourceLayer][feature], this.stateChanges[sourceLayer][feature]);\n                featuresChangedMap[sourceLayer][feature] = this.state[sourceLayer][feature];\n            }\n        }\n\n        for (const sourceLayer in this.deletedStates) {\n            this.state[sourceLayer] ||= {};\n            featuresChangedMap[sourceLayer] ||= {};\n\n            if (this.deletedStates[sourceLayer] === null) {\n                for (const ft in this.state[sourceLayer]) {\n                    this.state[sourceLayer][ft] = {};\n                    featuresChangedMap[sourceLayer][ft] = {};\n                }\n            } else {\n                for (const feature in this.deletedStates[sourceLayer]) {\n                    const deleteWholeFeatureState = this.deletedStates[sourceLayer][feature] === null;\n                    if (deleteWholeFeatureState) this.state[sourceLayer][feature] = {};\n                    else {\n                        for (const key of Object.keys(this.deletedStates[sourceLayer][feature])) {\n                            delete this.state[sourceLayer][feature][key];\n                        }\n                    }\n                    featuresChangedMap[sourceLayer][feature] = this.state[sourceLayer][feature];\n                }\n            }\n        }\n\n        this.stateChanges = {};\n        this.deletedStates = {};\n\n        if (Object.keys(featuresChangedMap).length === 0) return;\n\n        this.revision++;\n\n        const featuresChanged: LayerFeatureStates = {};\n        for (const sourceLayer in featuresChangedMap) {\n            featuresChanged[sourceLayer] = featureStatesMapToArray(featuresChangedMap[sourceLayer]);\n        }\n\n        inViewTiles.setFeatureState(featuresChanged, painter, this.revision);\n    }\n}\n","import {type vec4} from 'gl-matrix';\nimport {type Frustum} from './frustum.ts';\n\nexport const enum IntersectionResult {\n    None = 0,\n    Partial = 1,\n    Full = 2,\n}\n\nexport interface IBoundingVolume {\n    /**\n     * Performs an intersection test with a frustum.\n     */\n    intersectsFrustum(frustum: Frustum): IntersectionResult;\n\n    /**\n     * Performs an intersection test with a half-space defined by a plane equation.\n     * The half-space is assumed to lie on the positive side of the plane.\n     */\n    intersectsPlane(plane: vec4): IntersectionResult;\n}\n","import {OverscaledTileID} from '../../tile/tile_id.ts';\nimport {vec2, type vec4} from 'gl-matrix';\nimport {MercatorCoordinate} from '../mercator_coordinate.ts';\nimport {clamp, degreesToRadians, scaleZoom} from '../../util/util.ts';\n\nimport type {IReadonlyTransform} from '../transform_interface.ts';\nimport type {Terrain} from '../../render/terrain.ts';\nimport type {Frustum} from '../../util/primitives/frustum.ts';\nimport {maxMercatorHorizonAngle} from './mercator_utils.ts';\nimport {type IBoundingVolume, IntersectionResult} from '../../util/primitives/bounding_volume.ts';\n\ntype CoveringTilesResult = {\n    tileID: OverscaledTileID;\n    distanceSq: number;\n    tileDistanceToCamera: number;\n};\n\ntype CoveringTilesStackEntry = {\n    zoom: number;\n    x: number;\n    y: number;\n    wrap: number;\n    fullyVisible: boolean;\n};\n\nexport type CoveringTilesOptions = {\n    /**\n     * Smallest allowed tile zoom.\n     */\n    minzoom?: number;\n    /**\n     * Largest allowed tile zoom.\n     */\n    maxzoom?: number;\n    /**\n     * Whether to round or floor the target zoom level. If true, the value will be rounded to the closest integer. Otherwise the value will be floored.\n     */\n    roundZoom?: boolean;\n    /**\n     * Tile size, expressed in screen pixels.\n     */\n    tileSize: number;\n};\n\nexport type CoveringTilesOptionsInternal = CoveringTilesOptions & {\n    /**\n     * `true` if tiles should be sent back to the worker for each overzoomed zoom level, `false` if not.\n     * Fill this option when computing covering tiles for a source.\n     * When true, any tile at `maxzoom` level that should be overscaled to a greater zoom will have\n     * its zoom set to the overscaled greater zoom. When false, such tiles will have zoom set to `maxzoom`.\n     */\n    reparseOverscaled?: boolean;\n    /**\n     * When terrain is present, tile visibility will be computed in regards to the min and max elevations for each tile.\n     */\n    terrain?: Terrain;\n    /**\n     * Optional function to redefine how tiles are loaded at high pitch angles.\n     */\n    calculateTileZoom?: CalculateTileZoomFunction;\n};\n\n/**\n * Function to define how tiles are loaded at high pitch angles\n * @param requestedCenterZoom - the requested zoom level, valid at the center point.\n * @param distanceToTile2D - 2D distance from the camera to the candidate tile, in mercator units.\n * @param distanceToTileZ - vertical distance from the camera to the candidate tile, in mercator units.\n * @param distanceToCenter3D - distance from camera to center point, in mercator units\n * @param cameraVerticalFOV - camera vertical field of view, in degrees\n * @return the desired zoom level for this tile. May not be an integer.\n */\nexport type CalculateTileZoomFunction = (requestedCenterZoom: number,\n    distanceToTile2D: number,\n    distanceToTileZ: number,\n    distanceToCenter3D: number,\n    cameraVerticalFOV: number) => number;\n\n/**\n * A simple/heuristic function that returns whether the tile is visible under the current transform.\n * @returns an {@link IntersectionResult}.\n */\nexport function isTileVisible(frustum: Frustum, tileBoundingVolume: IBoundingVolume, plane?: vec4): IntersectionResult {\n    const frustumTest = tileBoundingVolume.intersectsFrustum(frustum);\n    if (!plane || frustumTest === IntersectionResult.None) {\n        return frustumTest;\n    }\n    const planeTest = tileBoundingVolume.intersectsPlane(plane);\n\n    if (planeTest === IntersectionResult.None) {\n        return IntersectionResult.None;\n    }\n\n    if (frustumTest === IntersectionResult.Full && planeTest === IntersectionResult.Full) {\n        return IntersectionResult.Full;\n    }\n\n    return IntersectionResult.Partial;\n}\n\n/**\n * Definite integral of cos(x)^p. The analytical solution is described in `developer-guides/covering-tiles.md`,\n * but here the integral is evaluated numerically.\n * @param p - the power to raise cos(x) to inside the integral\n * @param x1 - the starting point of the integral.\n * @param x2 - the ending point of the integral.\n * @return the integral of cos(x)^p from x=x1 to x=x2\n */\nfunction integralOfCosXByP(p: number, x1: number, x2: number): number {\n    const numPoints = 10;\n    let sum = 0;\n    const dx = (x2 - x1 ) / numPoints;\n    // Midpoint integration\n    for( let i = 0; i < numPoints; i++)\n    {\n        const x = x1 + (i + 0.5)/numPoints * (x2 - x1);\n        sum += dx * Math.pow(Math.cos(x), p);\n    }\n    return sum;\n}\n\nexport function createCalculateTileZoomFunction(maxZoomLevelsOnScreen: number, tileCountMaxMinRatio: number): CalculateTileZoomFunction {\n    return function (requestedCenterZoom: number,\n        distanceToTile2D: number,\n        distanceToTileZ: number,\n        distanceToCenter3D: number,\n        cameraVerticalFOV: number): number {\n        /**\n        * Controls how tiles are loaded at high pitch angles. Higher numbers cause fewer, lower resolution\n        * tiles to be loaded. Calculate the value that will result in the selected number of zoom levels in\n        * the worst-case condition (when the horizon is at the top of the screen). For more information, see\n        * `developer-guides/covering-tiles.md`\n        */\n        const pitchTileLoadingBehavior = 2 * ((maxZoomLevelsOnScreen - 1) /\n            scaleZoom(Math.cos(degreesToRadians(maxMercatorHorizonAngle - cameraVerticalFOV)) /\n                Math.cos(degreesToRadians(maxMercatorHorizonAngle))) - 1);\n\n        const centerPitch = Math.acos(distanceToTileZ / distanceToCenter3D);\n        const tileCountPitch0 = 2 * integralOfCosXByP(pitchTileLoadingBehavior - 1, 0, degreesToRadians(cameraVerticalFOV / 2));\n        const highestPitch = Math.min(degreesToRadians(maxMercatorHorizonAngle), centerPitch + degreesToRadians(cameraVerticalFOV / 2));\n        const lowestPitch = Math.min(highestPitch, centerPitch - degreesToRadians(cameraVerticalFOV / 2));\n        const tileCount = integralOfCosXByP(pitchTileLoadingBehavior - 1, lowestPitch, highestPitch);\n        const thisTilePitch = Math.atan(distanceToTile2D / distanceToTileZ);\n        const distanceToTile3D = Math.hypot(distanceToTile2D, distanceToTileZ);\n\n        let thisTileDesiredZ = requestedCenterZoom;\n        // if distance to candidate tile is a tiny bit farther than distance to center,\n        // use the same zoom as the center. This is achieved by the scaling distance ratio by cos(fov/2)\n        thisTileDesiredZ = thisTileDesiredZ + scaleZoom(distanceToCenter3D / distanceToTile3D / Math.max(0.5, Math.cos(degreesToRadians(cameraVerticalFOV / 2))));\n        thisTileDesiredZ += pitchTileLoadingBehavior * scaleZoom(Math.cos(thisTilePitch)) / 2;\n        thisTileDesiredZ -= scaleZoom(Math.max(1, tileCount / tileCountPitch0 / tileCountMaxMinRatio)) / 2;\n        return thisTileDesiredZ;\n    };\n}\nconst defaultMaxZoomLevelsOnScreen = 9.314;\nconst defaultTileCountMaxMinRatio = 3.0;\nconst defaultCalculateTileZoom = createCalculateTileZoomFunction(defaultMaxZoomLevelsOnScreen, defaultTileCountMaxMinRatio);\n\n/**\n * Return what zoom level of a tile source would most closely cover the tiles displayed by this transform.\n * @param options - The options, most importantly the source's tile size.\n * @returns An integer zoom level at which all tiles will be visible.\n */\nexport function coveringZoomLevel(transform: IReadonlyTransform, options: CoveringTilesOptions): number {\n    const z = (options.roundZoom ? Math.round : Math.floor)(\n        transform.zoom + scaleZoom(transform.tileSize / options.tileSize)\n    );\n    // At negative zoom levels load tiles from z0 because negative tile zoom levels don't exist.\n    return Math.max(0, z);\n}\n\n/**\n * Without terrain, `getTileBoundingVolume` has no knowledge of extruded features\n * (eg. 3D buildings): every tile's bounding box is flat at the camera's `elevation`.\n * That's a fine approximation of what's visible for most views, but it breaks down\n * as the frustum's bottom edge approaches horizontal (which depends on both `pitch`\n * and `fov`, not pitch alone) - a tall building can still be poking up into view\n * long after its tile's ground point has dropped out of the frustum.\n *\n * This is an assumed upper bound on real-world feature height (in metres), used to\n * grow the elevation used for tile culling as that bottom edge nears horizontal, so\n * such tiles are not dropped too early. It has no effect away from that edge case.\n */\nconst ASSUMED_MAX_FEATURE_HEIGHT_METERS = 500;\n\n/**\n * Angle between the frustum's bottom edge and the mercator horizon below which\n * the culling elevation starts to grow.\n */\nconst TILE_CULLING_HORIZON_ONSET_DEGREES = 15;\n\n/**\n * Returns the elevation to use when computing tile bounding volumes for culling:\n * `transform.elevation`, growing by up to `ASSUMED_MAX_FEATURE_HEIGHT_METERS` as\n * the frustum's bottom edge approaches the horizon, where a ground-level bounding\n * box would cull tiles whose extruded features are still visible.\n */\nfunction getElevationForTileCulling(transform: IReadonlyTransform): number {\n    const bottomEdgeDegreesAboveHorizontal = maxMercatorHorizonAngle - transform.pitch - transform.fov / 2;\n    const proximityToHorizon = clamp(\n        (TILE_CULLING_HORIZON_ONSET_DEGREES - bottomEdgeDegreesAboveHorizontal) / TILE_CULLING_HORIZON_ONSET_DEGREES,\n        0, 1);\n    return transform.elevation + proximityToHorizon * ASSUMED_MAX_FEATURE_HEIGHT_METERS;\n}\n\n/**\n * Returns a list of tiles that optimally covers the screen. Adapted for globe projection.\n * Correctly handles LOD when moving over the antimeridian.\n * @param transform - The transform instance.\n * @param frustum - The covering frustum.\n * @param plane - The clipping plane used by globe transform, or null.\n * @param cameraCoord - The x, y, z position of the camera in MercatorCoordinates.\n * @param centerCoord - The x, y, z position of the center point in MercatorCoordinates.\n * @param options - Additional coveringTiles options.\n * @param details - Interface to define required helper functions.\n * @returns A list of tile coordinates, ordered by ascending distance from camera.\n */\nexport function coveringTiles(transform: IReadonlyTransform, options: CoveringTilesOptionsInternal): OverscaledTileID[] {\n    const frustum = transform.getCameraFrustum();\n    const plane = transform.getClippingPlane();\n    const cameraCoord = transform.screenPointToMercatorCoordinate(transform.getCameraPoint());\n    const centerCoord = MercatorCoordinate.fromLngLat(transform.center, transform.elevation);\n    cameraCoord.z = centerCoord.z + Math.cos(transform.pitchInRadians) * transform.cameraToCenterDistance / transform.worldSize;\n    const elevationForTileCulling = getElevationForTileCulling(transform);\n    const detailsProvider = transform.getCoveringTilesDetailsProvider();\n    const allowVariableZoom = detailsProvider.allowVariableZoom(transform, options);\n    \n    const desiredZ = coveringZoomLevel(transform, options);\n    const minZoom = options.minzoom || 0;\n    const maxZoom = options.maxzoom !== undefined ? options.maxzoom : transform.maxZoom;\n    const nominalZ = Math.min(Math.max(0, desiredZ), maxZoom);\n\n    const numTiles = Math.pow(2, nominalZ);\n    const cameraPoint = [numTiles * cameraCoord.x, numTiles * cameraCoord.y, 0];\n    const centerPoint = [numTiles * centerCoord.x, numTiles * centerCoord.y, 0];\n    const distanceToCenter2d = Math.hypot(centerCoord.x - cameraCoord.x, centerCoord.y - cameraCoord.y);\n    const distanceZ = Math.abs(centerCoord.z - cameraCoord.z);\n    const distanceToCenter3d = Math.hypot(distanceToCenter2d, distanceZ);\n\n    const newRootTile = (wrap: number): CoveringTilesStackEntry => {\n        return {\n            zoom: 0,\n            x: 0,\n            y: 0,\n            wrap,\n            fullyVisible: false\n        };\n    };\n\n    // Do a depth-first traversal to find visible tiles and proper levels of detail\n    const stack: CoveringTilesStackEntry[] = [];\n    const result: CoveringTilesResult[] = [];\n\n    if (transform.renderWorldCopies && detailsProvider.allowWorldCopies()) {\n        // Render copy of the globe thrice on both sides\n        for (let i = 1; i <= 3; i++) {\n            stack.push(newRootTile(-i));\n            stack.push(newRootTile(i));\n        }\n    }\n\n    stack.push(newRootTile(0));\n\n    while (stack.length > 0) {\n        const it = stack.pop();\n        const x = it.x;\n        const y = it.y;\n        let fullyVisible = it.fullyVisible;\n        const tileID = {x, y, z: it.zoom};\n        const boundingVolume = detailsProvider.getTileBoundingVolume(tileID, it.wrap, elevationForTileCulling, options);\n\n        // Visibility of a tile is not required if any of its ancestor is fully visible\n        if (!fullyVisible) {\n            const intersectResult = isTileVisible(frustum, boundingVolume, plane);\n\n            if (intersectResult === IntersectionResult.None)\n                continue;\n\n            fullyVisible = intersectResult === IntersectionResult.Full;\n        }\n\n        const distToTile2d = detailsProvider.distanceToTile2d(cameraCoord.x, cameraCoord.y, tileID, boundingVolume);\n\n        let thisTileDesiredZ = desiredZ;\n        if (allowVariableZoom) {\n            const tileZoomFunc = options.calculateTileZoom || defaultCalculateTileZoom;\n            thisTileDesiredZ = tileZoomFunc(transform.zoom + scaleZoom(transform.tileSize / options.tileSize),\n                distToTile2d,\n                distanceZ,\n                distanceToCenter3d,\n                transform.fov);\n        }\n        thisTileDesiredZ = (options.roundZoom ? Math.round : Math.floor)(thisTileDesiredZ);\n        thisTileDesiredZ = Math.max(0, thisTileDesiredZ);\n        const z = Math.min(thisTileDesiredZ, maxZoom);\n\n        // We need to compute a valid wrap value for the tile to keep globe compatibility with mercator\n        it.wrap = detailsProvider.getWrap(centerCoord, tileID, it.wrap);\n\n        // Have we reached the target depth?\n        if (it.zoom >= z) {\n            if (it.zoom < minZoom) {\n                continue;\n            }\n            const dz = nominalZ - it.zoom;\n            const dx = cameraPoint[0] - 0.5 - (x << dz);\n            const dy = cameraPoint[1] - 0.5 - (y << dz);\n            const overscaledZ = options.reparseOverscaled ? Math.max(it.zoom, thisTileDesiredZ) : it.zoom;\n            result.push({\n                tileID: new OverscaledTileID(it.zoom === maxZoom ? overscaledZ : it.zoom, it.wrap, it.zoom, x, y),\n                distanceSq: vec2.sqrLen([centerPoint[0] - 0.5 - x, centerPoint[1] - 0.5 - y]),\n                // this variable is currently not used, but may be important to reduce the amount of loaded tiles\n                tileDistanceToCamera: Math.sqrt(dx * dx + dy * dy)\n            });\n            continue;\n        }\n\n        for (let i = 0; i < 4; i++) {\n            const childX = (x << 1) + (i % 2);\n            const childY = (y << 1) + (i >> 1);\n            const childZ = it.zoom + 1;\n            stack.push({zoom: childZ, x: childX, y: childY, wrap: it.wrap, fullyVisible});\n        }\n    }\n\n    return result.sort((a, b) => a.distanceSq - b.distanceSq).map(a => a.tileID);\n}\n","import Point from '@mapbox/point-geometry';\nimport {Bounds, type ReadOnlyBounds} from '../geo/bounds.ts';\nimport {EXTENT} from './extent.ts';\n\n/**\n * The bounding box covering the entire extent of a tile.\n */\nexport const EXTENT_BOUNDS = Bounds.fromPoints([new Point(0, 0), new Point(EXTENT, EXTENT)]) as ReadOnlyBounds;","import {now} from '../util/time_control.ts';\nimport {getEdgeTiles} from '../util/util.ts';\nimport {FadingDirections, FadingRoles, type Tile} from './tile.ts';\nimport {type OverscaledTileID} from './tile_id.ts';\nimport {type InViewTiles} from './tile_manager_in_view_tiles.ts';\n\nexport function isRasterType(type: string): boolean {\n    return type === 'raster' || type === 'image' || type === 'video';\n}\n\n/**\n * Designate fading bases and parents using a many-to-one relationship where the lower children fade in/out\n * with their parents. Raster shaders are not currently designed for a one-to-many fade relationship.\n *\n * Tiles that are candidates for fading out must be loaded and rendered tiles, as loading a tile to then\n * fade it out would not appear smoothly. The first source of truth for tile fading always starts at the\n * ideal tile, which continually changes on map adjustment. The state of the previously rendered ideal\n * tile plane indicates which direction to fade each part of the newer ideal plane (with varying z).\n *\n * For a pitched map, the back of the map can have decreasing zooms while the front can have increasing zooms.\n * Fade logic must therefore adapt dynamically based on the previously rendered ideal tile set.\n */\nexport function updateFadingTiles(\n    inViewTiles: InViewTiles,\n    idealTileIDs: OverscaledTileID[], \n    retain: Record<string, OverscaledTileID>,\n    maxFadingAncestorLevels: number,\n    sourceMinZoom: number,\n    sourceMaxZoom: number,\n    rasterFadeDuration: number): void {\n    const currentTime: number = now();\n    const edgeTileIDs: Set<OverscaledTileID> = getEdgeTiles(idealTileIDs);\n\n    for (const idealID of idealTileIDs) {\n        const idealTile = inViewTiles.getTileById(idealID.key);\n\n        // reset any previously departing(ed) tiles that are now ideal tiles\n        if (idealTile.fadingDirection === FadingDirections.Departing || idealTile.fadeOpacity === 0) {\n            idealTile.resetFadeLogic();\n        }\n\n        const parentIsFader = updateFadingAncestor(inViewTiles, idealTile, retain, currentTime, maxFadingAncestorLevels, sourceMinZoom, rasterFadeDuration);\n        if (parentIsFader) continue;\n\n        const childIsFader = updateFadingDescendents(inViewTiles, idealTile, retain, currentTime, sourceMaxZoom, rasterFadeDuration);\n        if (childIsFader) continue;\n\n        const edgeIsFader = updateFadingEdge(idealTile, edgeTileIDs, currentTime, rasterFadeDuration);\n        if (edgeIsFader) continue;\n\n        // for all remaining non-fading ideal tiles reset the fade logic\n        idealTile.resetFadeLogic();\n    }\n}\n\n/**\n * Many-to-one cross-fade. Set 4 ideal tiles as the fading base for a rendered parent tile\n * as the fading parent. Here the parent is fading out and the ideal tile is fading in.\n *\n * Parent tile - fading out                                ■                                -- Fading Parent\n *                                   ┌──────────────┬──────┴───────┬──────────────┐\n * Ideal tiles - fading in           ■              ■              ■              ■         -- Base Role = Incoming\n *                             ┌───┬─┴─┬───┐  ┌───┬─┴─┬───┐  ┌───┬─┴─┬───┐  ┌───┬─┴─┬───┐\n *                             ■   ■   ■   ■  ■   ■   ■   ■  ■   ■   ■   ■  ■   ■   ■   ■\n */\nfunction updateFadingAncestor(\n    inViewTiles: InViewTiles,\n    idealTile: Tile, \n    retain: Record<string, OverscaledTileID>, \n    now: number,\n    maxFadingAncestorLevels: number,\n    sourceMinZoom: number,\n    rasterFadeDuration: number): boolean {\n    if (!idealTile.hasData()) return false;\n\n    const {tileID: idealID, fadingRole, fadingDirection, fadingParentID} = idealTile;\n    // ideal tile already has fading parent - retain and return\n    if (fadingRole === FadingRoles.Base && fadingDirection === FadingDirections.Incoming && fadingParentID) {\n        retain[fadingParentID.key] = fadingParentID;\n        return true;\n    }\n\n    // find a loaded parent tile to fade with the ideal tile\n    const minAncestorZ = Math.max(idealID.overscaledZ - maxFadingAncestorLevels, sourceMinZoom);\n    for (let ancestorZ = idealID.overscaledZ - 1; ancestorZ >= minAncestorZ; ancestorZ--) {\n        const ancestorID = idealID.scaledTo(ancestorZ);\n        const ancestorTile = inViewTiles.getLoadedTile(ancestorID);\n        if (!ancestorTile) continue;\n\n        // ideal tile (base) is fading in\n        idealTile.setCrossFadeLogic({\n            fadingRole: FadingRoles.Base,\n            fadingDirection: FadingDirections.Incoming,\n            fadingParentID: ancestorTile.tileID,  // fading out\n            fadeEndTime: now + rasterFadeDuration\n        });\n        // ancestor tile (parent) is fading out\n        ancestorTile.setCrossFadeLogic({\n            fadingRole: FadingRoles.Parent,\n            fadingDirection: FadingDirections.Departing,\n            fadeEndTime: now + rasterFadeDuration\n        });\n\n        retain[ancestorID.key] = ancestorID;\n        return true;\n    }\n    return false;\n}\n\n/**\n * Many-to-one cross-fade. Search descendents of ideal tiles as the fading base with the ideal tile\n * as the fading parent. Here the children are fading out and the ideal tile is fading in.\n *\n *                                                         ■\n *                                   ┌──────────────┬──────┴───────┬──────────────┐\n * Ideal tiles - fading in           ■              ■              ■              ■          -- Fading Parent\n *                             ┌───┬─┴─┬───┐  ┌───┬─┴─┬───┐  ┌───┬─┴─┬───┐  ┌───┬─┴─┬───┐\n * Child tiles - fading out    ■   ■   ■   ■  ■   ■   ■   ■  ■   ■   ■   ■  ■   ■   ■   ■    -- Base Role = Departing\n *\n * Try direct children first. If none found, try grandchildren. Stops at the first generation that provides a fader.\n */\nfunction updateFadingDescendents(inViewTiles: InViewTiles, idealTile: Tile, retain: Record<string, OverscaledTileID>, now: number, sourceMaxZoom: number, rasterFadeDuration: number): boolean {\n    if (!idealTile.hasData()) return false;\n\n    // search first level of descendents (4 tiles)\n    const idealChildren = idealTile.tileID.children(sourceMaxZoom);\n    let hasFader = updateFadingChildren(inViewTiles, idealTile, idealChildren, retain, now, sourceMaxZoom, rasterFadeDuration);\n    if (hasFader) return true;\n\n    // search second level of descendents (16 tiles)\n    for (const childID of idealChildren) {\n        const grandChildIDs = childID.children(sourceMaxZoom);\n        if (updateFadingChildren(inViewTiles, idealTile, grandChildIDs, retain, now, sourceMaxZoom, rasterFadeDuration)) {\n            hasFader = true;\n        }\n    }\n\n    return hasFader;\n}\n\nfunction updateFadingChildren(\n    inViewTiles: InViewTiles,\n    idealTile: Tile, \n    childIDs: OverscaledTileID[], \n    retain: Record<string, OverscaledTileID>, \n    now: number, \n    sourceMaxZoom: number,\n    rasterFadeDuration: number): boolean {\n    if (childIDs[0].overscaledZ >= sourceMaxZoom) return false;\n    let foundFader = false;\n\n    // find loaded child tiles to fade with the ideal tile\n    for (const childID of childIDs) {\n        const childTile = inViewTiles.getLoadedTile(childID);\n        if (!childTile) continue;\n\n        const {fadingRole, fadingDirection, fadingParentID} = childTile;\n        if (fadingRole !== FadingRoles.Base || fadingDirection !== FadingDirections.Departing || !fadingParentID) {\n            // child tile (base) is fading out\n            childTile.setCrossFadeLogic({\n                fadingRole: FadingRoles.Base,\n                fadingDirection: FadingDirections.Departing,\n                fadingParentID: idealTile.tileID,\n                fadeEndTime: now + rasterFadeDuration\n            });\n            // ideal tile (parent) is fading in\n            idealTile.setCrossFadeLogic({\n                fadingRole: FadingRoles.Parent,\n                fadingDirection: FadingDirections.Incoming,\n                fadeEndTime: now + rasterFadeDuration\n            });\n        }\n\n        retain[childID.key] = childID;\n        foundFader = true;\n    }\n\n    return foundFader;\n}\n\n/**\n * One-to-one self fading for unloaded edge tiles (for panning sideways on map). for loading tiles over gaps it feels\n * more natural for them to fade in, however if they are already loaded/cached then there is no need to fade as map will\n * look cohesive with no gaps. Note that draw_raster determines fade priority, as many-to-one fade supersedes edge fading.\n */\nfunction updateFadingEdge(idealTile: Tile, edgeTileIDs: Set<OverscaledTileID>, now: number, rasterFadeDuration: number): boolean {\n    const idealID: OverscaledTileID = idealTile.tileID;\n\n    // tile is already self fading\n    if (idealTile.selfFading) {\n        return true;\n    }\n\n    // fading not needed for tiles that are already loaded\n    if (idealTile.hasData()) {\n        return false;\n    }\n\n    // enable fading for loading edges with no data\n    if (edgeTileIDs.has(idealID)) {\n        const fadeEndTime = now + rasterFadeDuration;\n        idealTile.setSelfFadeLogic(fadeEndTime);\n        return true;\n    }\n\n    return false;\n}\n\nexport function hasRasterTransition(inViewTiles: InViewTiles, rasterFadeDuration: number): boolean {\n    if (rasterFadeDuration <= 0) {\n        return false;\n    }\n    const currentTime = now();\n    for (const tile of inViewTiles.getAllTiles()) {\n        if (tile.fadeEndTime >= currentTime) {\n            return true;\n        }\n    }\n    return false;\n}","import {type Tile} from './tile.ts';\nimport {type InViewTiles} from './tile_manager_in_view_tiles.ts';\n\n/**\n * For raster terrain source, backfill DEM to eliminate visible tile boundaries\n */\nexport function backfillDEM(tile: Tile, inViewTiles: InViewTiles): void {\n    const renderables = inViewTiles.getRenderableIds();\n    for (const borderId of renderables) {\n        if (!tile.neighboringTiles?.[borderId]) {\n            continue;\n        }\n        const borderTile = inViewTiles.getTileById(borderId);\n        if (!tile.neighboringTiles[borderId].backfilled) {\n            fillBorder(tile, borderTile);\n        }\n        if (borderTile.neighboringTiles?.[tile.tileID.key]?.backfilled) {\n            continue;\n        }\n        fillBorder(borderTile, tile);\n    }\n}\n\nfunction fillBorder(tile: Tile, borderTile: Tile) {\n    tile.needsHillshadePrepare = true;\n    tile.needsTerrainPrepare = true;\n    let dx = borderTile.tileID.canonical.x - tile.tileID.canonical.x;\n    const dy = borderTile.tileID.canonical.y - tile.tileID.canonical.y;\n    const dim = Math.pow(2, tile.tileID.canonical.z);\n    const borderId = borderTile.tileID.key;\n    if (dx === 0 && dy === 0) return;\n\n    if (Math.abs(dy) > 1) {\n        return;\n    }\n    if (Math.abs(dx) > 1) {\n        // Adjust the delta coordinate for world wraparound.\n        if (Math.abs(dx + dim) === 1) {\n            dx += dim;\n        } else if (Math.abs(dx - dim) === 1) {\n            dx -= dim;\n        }\n    }\n    if (!borderTile.dem || !tile.dem) return;\n    tile.dem.backfillBorder(borderTile.dem, dx, dy);\n    if (tile.neighboringTiles?.[borderId]) {\n        tile.neighboringTiles[borderId].backfilled = true;\n    }\n}\n\n","import Point from '@mapbox/point-geometry';\nimport {type LayerFeatureStates} from '../source/source_state.ts';\nimport {type Tile} from './tile.ts';\nimport {compareTileId, type OverscaledTileID} from './tile_id.ts';\nimport type {Painter} from '../render/painter.ts';\n\nexport class InViewTiles {\n    private _tiles: Record<string, Tile> = {};\n\n    public handleWrapJump(wrapDelta: number): void {\n        const tiles: Record<string, Tile> = {};\n        for (const id in this._tiles) {\n            const tile = this._tiles[id];\n            tile.tileID = tile.tileID.unwrapTo(tile.tileID.wrap + wrapDelta);\n            tiles[tile.tileID.key] = tile;\n        }\n        this._tiles = tiles;\n    }\n\n    public setFeatureState(featuresChanged: LayerFeatureStates, painter: Painter, revision: number): void {\n        for (const id in this._tiles) {\n            const tile = this._tiles[id];\n            tile.setFeatureState(featuresChanged, painter, revision);\n        }\n    }\n\n    public getAllTiles(): Tile[] {\n        return Object.values(this._tiles);\n    }\n\n    public getAllIds(sorted = false): string[] {\n        if (sorted) {\n            return Object.values(this._tiles).map(tile => tile.tileID).sort(compareTileId).map(id => id.key);\n        }\n        return Object.keys(this._tiles);\n    }\n\n    public getTileById(key: string): Tile | undefined {\n        return this._tiles[key];\n    }\n\n    public setTile(key: string, tile: Tile): void {\n        this._tiles[key] = tile;\n    }\n\n    public deleteTileById(key: string): void {\n        delete this._tiles[key];\n    }\n\n    /**\n     * Get a currently loaded tile.\n     * - a cached tile is not a loaded tile\n     * @returns the tile if it's in view and had data, null otherwise.\n     */\n    public getLoadedTile(tileID: OverscaledTileID): Tile | null {\n        const tile = this.getTileById(tileID.key);\n        if (tile?.hasData()) {\n            return tile;\n        }\n        return null;\n    }\n\n    public isIdRenderable(id: string, symbolLayer: boolean = false): boolean {\n        return this.getTileById(id)?.isRenderable(symbolLayer);\n    }\n\n    public getRenderableIds(bearingInRadians: number = 0, symbolLayer?: boolean): string[] {\n        const renderables: Tile[] = [];\n        for (const id of this.getAllIds()) {\n            if (this.isIdRenderable(id, symbolLayer)) {\n                renderables.push(this.getTileById(id));\n            }\n        }\n        if (symbolLayer) {\n            return renderables.sort((a_: Tile, b_: Tile) => {\n                const a = a_.tileID;\n                const b = b_.tileID;\n                const rotatedA = (new Point(a.canonical.x, a.canonical.y))._rotate(-bearingInRadians);\n                const rotatedB = (new Point(b.canonical.x, b.canonical.y))._rotate(-bearingInRadians);\n                return a.overscaledZ - b.overscaledZ || rotatedB.y - rotatedA.y || rotatedB.x - rotatedA.x;\n            }).map(tile => tile.tileID.key);\n        }\n        return renderables.map(tile => tile.tileID).sort(compareTileId).map(id => id.key);\n    }\n}","import {create as createSource} from '../source/source.ts';\nimport {Tile} from './tile.ts';\nimport {ErrorEvent, Evented} from '../util/evented.ts';\nimport {ensureError} from '../util/util.ts';\nimport {TileCache} from './tile_cache.ts';\nimport {MercatorCoordinate} from '../geo/mercator_coordinate.ts';\nimport {EXTENT} from '../data/extent.ts';\nimport {now} from '../util/time_control.ts';\nimport {OverscaledTileID} from './tile_id.ts';\nimport {SourceFeatureState} from '../source/source_state.ts';\nimport {config} from '../util/config.ts';\nimport {coveringTiles, coveringZoomLevel} from '../geo/projection/covering_tiles.ts';\nimport {Bounds} from '../geo/bounds.ts';\nimport {EXTENT_BOUNDS} from '../data/extent_bounds.ts';\nimport {GEOJSON_TILE_LAYER_NAME} from '../data/feature_index.ts';\nimport {hasRasterTransition, isRasterType, updateFadingTiles} from './tile_manager_raster.ts';\nimport {backfillDEM} from './tile_manager_raster_dem.ts';\nimport {InViewTiles} from './tile_manager_in_view_tiles.ts';\nimport {MapSourceDataEvent} from '../ui/events.ts';\n\nimport type Point from '@mapbox/point-geometry';\nimport type {Context} from '../webgl/context.ts';\nimport type {Source} from '../source/source.ts';\nimport type {Map} from '../ui/map.ts';\nimport type {Style} from '../style/style.ts';\nimport type {Dispatcher} from '../util/dispatcher.ts';\nimport type {IReadonlyTransform, ITransform} from '../geo/transform_interface.ts';\nimport type {TileState} from './tile.ts';\nimport type {FeatureState, ICanonicalTileID, SourceSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {Terrain} from '../render/terrain.ts';\nimport type {CanvasSourceSpecification} from '../source/canvas_source.ts';\nimport type {LoadTileResult} from '../source/vector_tile_source.ts';\n\ntype TileResult = {\n    tile: Tile;\n    tileID: OverscaledTileID;\n    queryGeometry: Point[];\n    cameraQueryGeometry: Point[];\n    scale: number;\n};\n\n/**\n * @internal\n * `TileManager` is responsible for\n *\n *  - creating an instance of `Source`\n *  - caching tiles loaded from an instance of `Source`\n *  - handling incoming source data events events from `Map` and coordinating updates\n *  - providing the current renderable tile coordinates to the `Painter`\n *  - loading the tiles needed to render a given viewport\n *  - retaining the tiles needed as substitutes for pending loading tiles\n *  - retaining the tiles needed for fading between parents and children (for raster sources)\n *  - reloading tiles when source data or dependencies change\n *  - handling tile expiration and refresh timers\n *  - unloading cached tiles not needed to render a given viewport\n *  - managing tile state and feature state\n */\nexport class TileManager extends Evented {\n    id: string;\n    dispatcher: Dispatcher;\n    map: Map;\n    style: Style;\n\n    _source: Source;\n\n    /**\n     * @internal\n     * signifies that the TileJSON is loaded if applicable.\n     * if the source type does not come with a TileJSON, the flag signifies the\n     * source data has loaded (i.e geojson has been tiled on the worker and is ready)\n     */\n    _sourceLoaded: boolean;\n\n    _sourceErrored: boolean;\n    _inViewTiles: InViewTiles;\n    _prevLng: number;\n    _outOfViewCache: TileCache;\n    _timers: Record<string, ReturnType<typeof setTimeout>>;\n    _maxTileCacheSize: number;\n    _maxTileCacheZoomLevels: number;\n    _paused: boolean;\n    _shouldReloadOnResume: boolean;\n    transform: ITransform;\n    terrain: Terrain;\n    used: boolean;\n    usedForTerrain: boolean;\n    tileSize: number;\n    _state: SourceFeatureState;\n    _didEmitContent: boolean;\n    _updated: boolean;\n    _rasterFadeDuration: number;\n    _maxFadingAncestorLevels: number;\n\n    static maxUnderzooming: number = 10;\n    static maxOverzooming: number = 3;\n\n    constructor(id: string, options: SourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher) {\n        super();\n        this.id = id;\n        this.dispatcher = dispatcher;\n\n        this.on('data', (e: MapSourceDataEvent) => { this._dataHandler(e); });\n\n        this.on('dataloading', () => {\n            this._sourceErrored = false;\n        });\n\n        this.on('error', () => {\n            // Only set _sourceErrored if the source does not have pending loads.\n            this._sourceErrored = this._source.loaded();\n        });\n\n        this._source = createSource(id, options, dispatcher, this);\n\n        this._inViewTiles = new InViewTiles();\n        this._outOfViewCache = new TileCache(0, (tile) => this._unloadTile(tile));\n        this._timers = {};\n        this._maxTileCacheSize = null;\n        this._maxTileCacheZoomLevels = null;\n        this._rasterFadeDuration = 0;\n        this._maxFadingAncestorLevels = 5;\n\n        this._state = new SourceFeatureState();\n        this._didEmitContent = false;\n        this._updated = false;\n    }\n\n    onAdd(map: Map): void {\n        this.map = map;\n        this._maxTileCacheSize = map ? map._maxTileCacheSize : null;\n        this._maxTileCacheZoomLevels = map ? map._maxTileCacheZoomLevels : null;\n        if (this._source?.onAdd) {\n            this._source.onAdd(map);\n        }\n    }\n\n    onRemove(map: Map): void {\n        for (const tile of this._inViewTiles.getAllTiles()) {\n            tile.unloadVectorData();\n        }\n        this.clearTiles();\n        if (this._source?.onRemove) {\n            this._source.onRemove(map);\n        }\n        this._inViewTiles = new InViewTiles();\n    }\n\n    /**\n     * Return true if no tile data is pending, tiles will not change unless\n     * an additional API call is received.\n     */\n    loaded(): boolean {\n        if (this._sourceErrored) { return true; }\n        if (!this._sourceLoaded) { return false; }\n        if (!this._source.loaded()) { return false; }\n        if ((this.used !== undefined || this.usedForTerrain !== undefined) && !this.used && !this.usedForTerrain) { return true; }\n        // do not consider as loaded if the update hasn't been called yet (we do not know if we will have any tiles to fetch)\n        if (!this._updated) { return false; }\n\n        for (const tile of this._inViewTiles.getAllTiles()) {\n            if (tile.state !== 'loaded' && tile.state !== 'errored')\n                return false;\n        }\n        return true;\n    }\n\n    getSource(): Source {\n        return this._source;\n    }\n\n    getState(): SourceFeatureState {\n        return this._state;\n    }\n\n    pause(): void {\n        this._paused = true;\n    }\n\n    resume(): void {\n        if (!this._paused) return;\n        const shouldReload = this._shouldReloadOnResume;\n        this._paused = false;\n        this._shouldReloadOnResume = false;\n        if (shouldReload) this.reload();\n        if (this.transform) this.update(this.transform, this.terrain);\n    }\n\n    async _loadTile(tile: Tile, id: string, state: TileState): Promise<void> {\n        try {\n            const result = await this._source.loadTile(tile) as LoadTileResult;\n            this._tileLoaded(tile, id, state, result);\n        } catch (err) {\n            tile.state = 'errored';\n\n            if (err.status !== 404) {\n                this._source.fire(new ErrorEvent(ensureError(err), {tile}));\n            } else {\n                // continue to try loading parent/children tiles if a tile doesn't exist (404)\n                this.update(this.transform, this.terrain);\n            }\n        }\n    }\n\n    _unloadTile(tile: Tile): void {\n        if (this._source.unloadTile)\n            this._source.unloadTile(tile);\n    }\n\n    _abortTile(tile: Tile): void {\n        if (this._source.abortTile)\n            this._source.abortTile(tile);\n\n        this._source.fire(new MapSourceDataEvent('dataabort', {tile, coord: tile.tileID}));\n    }\n\n    serialize(): any {\n        return this._source.serialize();\n    }\n\n    prepare(context: Context): void {\n        if  (this._source.prepare) {\n            this._source.prepare();\n        }\n\n        this._state.coalesceChanges(this._inViewTiles, this.map ? this.map.painter : null);\n        for (const tile of this._inViewTiles.getAllTiles()) {\n            tile.upload(context);\n            tile.prepare(this.map.style.imageManager);\n        }\n    }\n\n    /**\n     * Return all tile ids ordered with z-order, and cast to numbers\n     */\n    getIds(): string[] {\n        return this._inViewTiles.getAllIds(true);\n    }\n\n    getRenderableIds(symbolLayer?: boolean): string[] {\n        return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians, symbolLayer);\n    }\n\n    hasRenderableParent(tileID: OverscaledTileID): boolean {\n        const parentZ = tileID.overscaledZ - 1;\n        if (parentZ >= this._source.minzoom) {\n            const parentTile = this.getLoadedTile(tileID.scaledTo(parentZ));\n            if (parentTile) {\n                return this._inViewTiles.isIdRenderable(parentTile.tileID.key);\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Reload tiles based on the current state of the source.\n     * @param sourceDataChanged - If `true`, reload all tiles using a state of 'expired' (errored tiles use 'loading' since they have nothing to show yet), otherwise reload only non-errored tiles using state of 'reloading'.\n     * @param shouldReloadTileOptions - Set of options associated with a `MapSourceDataChangedEvent` that can be passed back to the associated `Source` determine whether a tile should be reloaded.\n     */\n    reload(\n        sourceDataChanged?: boolean,\n        shouldReloadTileOptions: any = undefined\n    ): void {\n        if (this._paused) {\n            this._shouldReloadOnResume = true;\n            return;\n        }\n\n        this._outOfViewCache.reset();\n\n        for (const id of this._inViewTiles.getAllIds()) {\n            const tile = this._inViewTiles.getTileById(id);\n            if (shouldReloadTileOptions && !this._source.shouldReloadTile(tile, shouldReloadTileOptions)) {\n                continue;\n            } else if (sourceDataChanged) {\n                this._reloadTile(id, tile.state === 'errored' ? 'loading' : 'expired');\n            } else if (tile.state !== 'errored') {\n                this._reloadTile(id, 'reloading');\n            }\n        }\n    }\n\n    async _reloadTile(id: string, state: TileState): Promise<void> {\n        const tile = this._inViewTiles.getTileById(id);\n\n        // this potentially does not address all underlying\n        // issues https://github.com/mapbox/mapbox-gl-js/issues/4252\n        // - hard to tell without repro steps\n        if (!tile) return;\n\n        // The difference between \"loading\" tiles and \"reloading\" or \"expired\"\n        // tiles is that \"reloading\"/\"expired\" tiles are \"renderable\".\n        // Therefore, a \"loading\" tile cannot become a \"reloading\" tile without\n        // first becoming a \"loaded\" tile.\n        if (tile.state !== 'loading') {\n            tile.state = state;\n        }\n        await this._loadTile(tile, id, state);\n    }\n\n    _tileLoaded(tile: Tile, id: string, previousState: TileState, result: LoadTileResult): void {\n        tile.timeAdded = now();\n        // Since self-fading applies to unloaded tiles, fadeEndTime must be updated upon load\n        if (tile.selfFading) {\n            tile.fadeEndTime = tile.timeAdded + this._rasterFadeDuration;\n        }\n\n        if (previousState === 'expired') tile.refreshedUponExpiration = true;\n        this._setTileReloadTimer(id, tile);\n\n        if (result?.unmodified) return;\n\n        if (this.getSource().type === 'raster-dem' && tile.dem) {\n            backfillDEM(tile, this._inViewTiles);\n        }\n        // Reset feature state revision so initializeTileState re-applies\n        // feature state to the tile's new bucket data after a reload.\n        tile.featureStateRevision = -1;\n        this._state.initializeTileState(tile, this.map ? this.map.painter : null);\n\n        if (!tile.aborted) {\n            this._source.fire(new MapSourceDataEvent('data', {tile, coord: tile.tileID}));\n        }\n    }\n    /**\n     * Get a specific tile by TileID\n     */\n    getTile(tileID: OverscaledTileID): Tile {\n        return this.getTileByID(tileID.key);\n    }\n\n    /**\n     * Get a specific tile by id\n     */\n    getTileByID(id: string): Tile | undefined {\n        return this._inViewTiles.getTileById(id);\n    }\n\n    /**\n     * Retain the uppermost loaded children of each provided target tile, within a variable covering zoom range.\n     *\n     * On pitched maps, different parts of the screen show different zoom levels simultaneously.\n     * Ideal tiles are generated using coveringTiles() above, which returns the ideal tile set for\n     * the current pitched plane, which can carry tiles of varying zooms (overscaledZ).\n     * See: https://maplibre.org/maplibre-gl-js/docs/examples/level-of-detail-control/\n     *\n     * A fixed `maxCoveringZoom` on a pitched map would incorrectly intersect with some\n     * ideal tiles and cause distant high-pitch tiles to skip their uppermost children.\n     *\n     * To solve this, we calculate the max covering zoom for each ideal tile separately using its\n     * `overscaledZ`. This effectively makes the \"max covering zoom plane\" parallel to the\n     * \"ideal tile plane,\" ensuring that we correctly capture the uppermost children\n     * of each ideal tile across the pitched view.\n     *\n     * Analogy: imagine two sheets of paper in 3D space:\n     *   - one sheet = ideal tiles at varying overscaledZ\n     *   - the second sheet = maxCoveringZoom\n     *\n     * @param retainTileMap - this parameters will be updated with the child tiles to keep\n     * @param idealTilesWithoutData - which of the ideal tiles currently does not have loaded data\n     * @return a set of tiles that need to be loaded\n     */\n    _retainLoadedChildren(retainTileMap: Record<string, OverscaledTileID>, idealTilesWithoutData: Set<OverscaledTileID>): Set<OverscaledTileID> {\n        const loadedDescendents: Record<string, Tile[]> = this._getLoadedDescendents(idealTilesWithoutData);\n        const incomplete = new Set<OverscaledTileID>();\n\n        // retain the uppermost descendents of target tiles\n        for (const targetID of idealTilesWithoutData) {\n            const descendents = loadedDescendents[targetID.key];\n            if (!descendents?.length) {\n                incomplete.add(targetID);\n                continue;\n            }\n\n            // find descendents within the max covering zoom range\n            const maxCoveringZoom = targetID.overscaledZ + TileManager.maxOverzooming;\n            const candidates = descendents.filter(t => t.tileID.overscaledZ <= maxCoveringZoom);\n            if (!candidates.length) {\n                incomplete.add(targetID);\n                continue;\n            }\n\n            // retain the uppermost descendents in the topmost zoom below the target tile\n            const topZoom = Math.min(...candidates.map(t => t.tileID.overscaledZ));\n            const topIDs = candidates.filter(t => t.tileID.overscaledZ === topZoom).map(t => t.tileID);\n            for (const tileID of topIDs) {\n                retainTileMap[tileID.key] = tileID;\n            }\n\n            //determine if the retained generation is fully covered\n            if (!this._areDescendentsComplete(topIDs, topZoom, targetID.overscaledZ)) {\n                incomplete.add(targetID);\n            }\n        }\n\n        return incomplete;\n    }\n\n    /**\n     * Return dictionary of qualified loaded descendents for each provided target tile id\n     */\n    _getLoadedDescendents(targetTileIDs: Set<OverscaledTileID>): Record<string, Tile[]> {\n        const loadedDescendents: Record<string, Tile[]> = {};\n\n        // enumerate current tiles and find the loaded descendents of each target tile\n        for (const tile of this._inViewTiles.getAllTiles().filter(tile => tile.hasData())) {\n            // determine if the loaded tile (hasData) is a qualified descendent of any target tile\n            for (const targetID of targetTileIDs) {\n                if (tile.tileID.isChildOf(targetID)) {\n                    loadedDescendents[targetID.key] ||= [];\n                    loadedDescendents[targetID.key].push(tile);\n                }\n            }\n        }\n\n        return loadedDescendents;\n    }\n\n    /**\n     * Determine if tile ids fully cover the current generation.\n     * - 1st generation: need 4 children or 1 overscaled child\n     * - 2nd generation: need 16 children or 1 overscaled child\n     */\n    _areDescendentsComplete(generationIDs: OverscaledTileID[], generationZ: number, ancestorZ: number): boolean {\n        //if overscaled, seeking 1 tile at generationZ, otherwise seeking a power of 4 for each descending Z\n        if (generationIDs.length === 1 && generationIDs[0].isOverscaled()) {\n            return generationIDs[0].overscaledZ === generationZ;\n        } else {\n            const expectedTiles = Math.pow(4, generationZ - ancestorZ);  //4, 16, 64 (for first 3 gens)\n            return expectedTiles === generationIDs.length;\n        }\n    }\n\n    /**\n     * Get a currently loaded tile.\n     * - a cached tile is not a loaded tile\n     * @returns the tile if it's in view and had data, null otherwise.\n     */\n    getLoadedTile(tileID: OverscaledTileID): Tile | null {\n        return this._inViewTiles.getLoadedTile(tileID);\n    }\n\n    /**\n     * Resizes the tile cache based on the current viewport's size\n     * or the maxTileCacheSize option passed during map creation\n     *\n     * Larger viewports use more tiles and need larger caches. Larger viewports\n     * are more likely to be found on devices with more memory and on pages where\n     * the map is more important.\n     */\n    updateCacheSize(transform: IReadonlyTransform): void {\n        const widthInTiles = Math.ceil(transform.width / this._source.tileSize) + 1;\n        const heightInTiles = Math.ceil(transform.height / this._source.tileSize) + 1;\n        const approxTilesInView = widthInTiles * heightInTiles;\n        const commonZoomRange = this._maxTileCacheZoomLevels === null ?\n            config.MAX_TILE_CACHE_ZOOM_LEVELS : this._maxTileCacheZoomLevels;\n        const viewDependentMaxSize = Math.floor(approxTilesInView * commonZoomRange);\n        const maxSize = typeof this._maxTileCacheSize === 'number' ?\n            Math.min(this._maxTileCacheSize, viewDependentMaxSize) : viewDependentMaxSize;\n\n        this._outOfViewCache.setMaxSize(maxSize);\n    }\n\n    handleWrapJump(lng: number): void {\n        // On top of the regular z/x/y values, TileIDs have a `wrap` value that specify\n        // which copy of the world the tile belongs to. For example, at `lng: 10` you\n        // might render z/x/y/0 while at `lng: 370` you would render z/x/y/1.\n        //\n        // When lng values get wrapped (going from `lng: 370` to `long: 10`) you expect\n        // to see the same thing on the screen (370 degrees and 10 degrees is the same\n        // place in the world) but all the TileIDs will have different wrap values.\n        //\n        // In order to make this transition seamless, we calculate the rounded difference of\n        // \"worlds\" between the last frame and the current frame. If the map panned by\n        // a world, then we can assign all the tiles new TileIDs with updated wrap values.\n        // For example, assign z/x/y/1 a new id: z/x/y/0. It is the same tile, just rendered\n        // in a different position.\n        //\n        // This enables us to reuse the tiles at more ideal locations and prevent flickering.\n        const prevLng = this._prevLng === undefined ? lng : this._prevLng;\n        const lngDifference = lng - prevLng;\n        const worldDifference = lngDifference / 360;\n        const wrapDelta = Math.round(worldDifference);\n        this._prevLng = lng;\n\n        if (wrapDelta) {\n            this._inViewTiles.handleWrapJump(wrapDelta);\n            this._resetTileReloadTimers();\n        }\n    }\n\n    /**\n     * Removes tiles that are outside the viewport and adds new tiles that\n     * are inside the viewport.\n     */\n    update(transform: ITransform, terrain?: Terrain): void {\n        if (!this._sourceLoaded || this._paused) {\n            return;\n        }\n        this.transform = transform;\n        this.terrain = terrain;\n\n        this.updateCacheSize(transform);\n        this.handleWrapJump(this.transform.center.lng);\n\n        let idealTileIDs: OverscaledTileID[];\n\n        if (!this.used && !this.usedForTerrain) {\n            idealTileIDs = [];\n        } else if (this._source.tileID) { // image source\n            idealTileIDs = transform.getVisibleUnwrappedCoordinates(this._source.tileID)\n                .map((unwrapped) => new OverscaledTileID(unwrapped.canonical.z, unwrapped.wrap, unwrapped.canonical.z, unwrapped.canonical.x, unwrapped.canonical.y));\n        } else {\n            idealTileIDs = coveringTiles(transform, {\n                tileSize: this.usedForTerrain ? this.tileSize : this._source.tileSize,\n                minzoom: this._source.minzoom,\n                maxzoom: this._source.type === 'vector' && this.map._zoomLevelsToOverscale !== undefined\n                    ? Math.max(this._source.maxzoom, transform.maxZoom - this.map._zoomLevelsToOverscale)\n                    : this._source.maxzoom,\n                roundZoom: this.usedForTerrain ? false : this._source.roundZoom,\n                reparseOverscaled: this._source.reparseOverscaled,\n                terrain,\n                calculateTileZoom: this._source.calculateTileZoom,\n            });\n\n            if (this._source.hasTile) { // tile should be in bounds\n                idealTileIDs = idealTileIDs.filter((coord) => this._source.hasTile(coord));\n            }\n        }\n\n        // When tilemanager is used for terrain also load parent tiles for complete rendering of 3d terrain levels\n        if (this.usedForTerrain) {\n            idealTileIDs = this._addTerrainIdealTiles(idealTileIDs);\n        }\n\n        const noPendingDataEmissions = idealTileIDs.length === 0 && !this._updated && this._didEmitContent;\n        this._updated = true;\n        // if we won't have any tiles to fetch and content is already emitted\n        // there will be no more data emissions, so we need to emit the event with isSourceLoaded = true\n        if (noPendingDataEmissions) {\n            this.fire(new MapSourceDataEvent('data', {sourceDataType: 'idle', sourceId: this.id}));\n        }\n\n        // Retain is a list of tiles that we shouldn't delete, even if they are not\n        // the most ideal tile for the current viewport. This may include tiles like\n        // parent or child tiles that are *already* loaded.\n        const zoom: number = coveringZoomLevel(transform, this._source);\n        const retain: Record<string, OverscaledTileID> = this._updateRetainedTiles(idealTileIDs, zoom);\n\n        // enable fading for raster source except when using terrain which doesn't currently support fading\n        const isRaster = isRasterType(this._source.type);\n        if (isRaster && this._rasterFadeDuration > 0 && !terrain) {\n            updateFadingTiles(this._inViewTiles, idealTileIDs, retain, this._maxFadingAncestorLevels, this._source.minzoom, this._source.maxzoom, this._rasterFadeDuration);\n        }\n\n        // clean up non-retained tiles that are no longer needed\n        if (isRaster) {\n            this._cleanUpRasterTiles(retain);\n        } else {\n            this._cleanUpVectorTiles(retain);\n        }\n    }\n\n    /**\n     * Remove raster tiles that are no longer retained\n     */\n    _cleanUpRasterTiles(retain: Record<string, OverscaledTileID>): void {\n        for (const id of this._inViewTiles.getAllIds()) {\n            if (!retain[id]) {\n                this._removeTile(id);\n            }\n        }\n    }\n\n    /**\n     * Remove vector tiles that are no longer retained and also not needed for symbol fading\n     */\n    _cleanUpVectorTiles(retain: Record<string, OverscaledTileID>): void {\n        for (const id of this._inViewTiles.getAllIds()) {\n            const tile = this._inViewTiles.getTileById(id);\n\n            // retained - clear fade hold so if it's removed again fade timer starts fresh.\n            if (retain[id]) {\n                tile.clearSymbolFadeHold();\n                continue;\n            }\n\n            // remove non-retained tiles without symbols\n            if (!tile.hasSymbolBuckets) {\n                this._removeTile(id);\n                continue;\n            }\n\n            // for tile with symbols - hold for fade - then remove\n            if (!tile.holdingForSymbolFade()) {\n                tile.setSymbolHoldDuration(this.map._fadeDuration);\n            } else if (tile.symbolFadeFinished()) {\n                this._removeTile(id);\n            }\n        }\n    }\n\n    /**\n     * Add ideal tiles needed for 3D terrain rendering\n     */\n    _addTerrainIdealTiles(idealTileIDs: OverscaledTileID[]): OverscaledTileID[] {\n        const ancestors = [];\n\n        for (const tileID of idealTileIDs) {\n            if (tileID.canonical.z > this._source.minzoom) {\n                const parent = tileID.scaledTo(tileID.canonical.z - 1);\n                ancestors.push(parent);\n                // load very low zoom to calculate tile visibility in transform.coveringTiles and high zoom levels correct\n                const parent2 = tileID.scaledTo(Math.max(this._source.minzoom, Math.min(tileID.canonical.z, 5)));\n                ancestors.push(parent2);\n            }\n        }\n\n        return idealTileIDs.concat(ancestors);\n    }\n\n    releaseSymbolFadeTiles(): void {\n        for (const id of this._inViewTiles.getAllIds()) {\n            if (this._inViewTiles.getTileById(id).holdingForSymbolFade()) {\n                this._removeTile(id);\n            }\n        }\n    }\n\n    /**\n     * Set tiles to be retained on update of the source. For ideal tiles that do not have data, retain their loaded\n     * children so they can be displayed as substitutes pending load of each ideal tile (to reduce flickering).\n     * If no loaded children are available, fallback to seeking loaded parents as an alternative substitute.\n     */\n    _updateRetainedTiles(idealTileIDs: OverscaledTileID[], zoom: number): Record<string, OverscaledTileID> {\n        const idealTilesWithoutData = new Set<OverscaledTileID>();\n        for (const idealID of idealTileIDs) {\n            const idealTile = this._addTile(idealID);\n\n            if (!idealTile.hasData()) {\n                idealTilesWithoutData.add(idealID);\n            }\n        }\n\n        // retain the tile even if it's not loaded because it's an ideal tile.\n        const retainTileMap: Record<string, OverscaledTileID> = idealTileIDs.reduce((acc, t) => { acc[t.key] = t; return acc;}, {});\n        const tileIdsWithoutData = this._retainLoadedChildren(retainTileMap, idealTilesWithoutData);\n\n        // for remaining missing tiles with incomplete child coverage, seek a loaded parent tile\n        const checked: Record<string, boolean> = {};\n        const minCoveringZoom = Math.max(zoom - TileManager.maxUnderzooming, this._source.minzoom);\n        for (const tileID of tileIdsWithoutData) {\n            let tile = this._inViewTiles.getTileById(tileID.key);\n\n            // As we ascend up the tile pyramid of the ideal tile, we check whether the parent\n            // tile has been previously requested (and errored because we only loop over tiles with no data)\n            // in order to determine if we need to request its parent.\n            let parentWasRequested = tile?.wasRequested();\n\n            for (let overscaledZ = tileID.overscaledZ - 1; overscaledZ >= minCoveringZoom; --overscaledZ) {\n                const parentId = tileID.scaledTo(overscaledZ);\n\n                // Break parent tile ascent if this route has been previously checked by another child.\n                if (checked[parentId.key]) break;\n                checked[parentId.key] = true;\n\n                tile = this.getTile(parentId);\n                if (!tile && parentWasRequested) {\n                    tile = this._addTile(parentId);\n                }\n                if (tile) {\n                    const hasData = tile.hasData();\n                    if (hasData || !this.map?.cancelPendingTileRequestsWhileZooming || parentWasRequested) {\n                        retainTileMap[parentId.key] = parentId;\n                    }\n                    // Save the current values, since they're the parent of the next iteration\n                    // of the parent tile ascent loop.\n                    parentWasRequested = tile.wasRequested();\n                    if (hasData) break;\n                }\n            }\n        }\n\n        return retainTileMap;\n    }\n\n    /**\n     * Add a tile, given its coordinate, to the pyramid.\n     */\n    _addTile(tileID: OverscaledTileID): Tile {\n        let tile = this._inViewTiles.getTileById(tileID.key);\n        if (tile)\n            return tile;\n\n        tile = this._outOfViewCache.getAndRemove(tileID);\n        if (tile) {\n            //reset fading logic to remove stale fading data from cache\n            tile.resetFadeLogic();\n\n            // set timer for the reloading of the tile upon expiration\n            this._setTileReloadTimer(tileID.key, tile);\n\n            // set the tileID because the cached tile could have had a different wrap value\n            tile.tileID = tileID;\n            this._state.initializeTileState(tile, this.map ? this.map.painter : null);\n        }\n\n        const cached = tile;\n\n        if (!tile) {\n            tile = new Tile(tileID, this._source.tileSize * tileID.overscaleFactor());\n            this._loadTile(tile, tileID.key, tile.state);\n        }\n\n        tile.uses++;\n        this._inViewTiles.setTile(tileID.key, tile);\n        if (!cached) {\n            this._source.fire(new MapSourceDataEvent('dataloading', {tile, coord: tile.tileID}));\n        }\n\n        return tile;\n    }\n\n    /**\n     * Set a timeout to reload the tile after it expires\n     */\n    _setTileReloadTimer(id: string, tile: Tile): void {\n        this._clearTileReloadTimer(id);\n\n        const expiryTimeout = tile.getExpiryTimeout();\n        if (expiryTimeout) {\n            const reload = () => {\n                this._reloadTile(id, 'expired');\n                delete this._timers[id];\n            };\n            this._timers[id] = setTimeout(reload, expiryTimeout);\n        }\n    }\n\n    _clearTileReloadTimer(id: string): void {\n        const timeout = this._timers[id];\n        if (timeout) {\n            clearTimeout(timeout);\n            delete this._timers[id];\n        }\n    }\n\n    _resetTileReloadTimers(): void {\n        for (const id in this._timers) {\n            clearTimeout(this._timers[id]);\n            delete this._timers[id];\n        }\n        for (const id of this._inViewTiles.getAllIds()) {\n            const tile = this._inViewTiles.getTileById(id);\n            this._setTileReloadTimer(id, tile);\n        }\n    }\n\n    /**\n     * Reload any currently renderable tiles that are match one of the incoming `tileId` x/y/z\n     */\n    refreshTiles(tileIds: ICanonicalTileID[]): void {\n        for (const id of this._inViewTiles.getAllIds()) {\n            const tile = this._inViewTiles.getTileById(id);\n            if (!this._inViewTiles.isIdRenderable(id) && tile.state != 'errored') {\n                continue;\n            }\n            if (tileIds.some(tid => tid.equals(tile.tileID.canonical))) {\n                this._reloadTile(id, 'expired');\n            }\n        }\n    }\n\n    /**\n     * Remove a tile, given its id, from the pyramid\n     */\n    _removeTile(id: string): void {\n        const tile = this._inViewTiles.getTileById(id);\n        if (!tile)\n            return;\n\n        tile.uses--;\n        this._inViewTiles.deleteTileById(id);\n        this._clearTileReloadTimer(id);\n\n        if (tile.uses > 0)\n            return;\n\n        if (tile.hasData() && tile.state !== 'reloading') {\n            this._outOfViewCache.add(tile.tileID, tile, tile.getExpiryTimeout());\n        } else {\n            tile.aborted = true;\n            this._abortTile(tile);\n            this._unloadTile(tile);\n        }\n    }\n\n    /** @internal\n     * Handles incoming source data messages (i.e. after the source has been updated via a worker that has fired\n     * to map.ts data event). For sources with mutable data, the 'content' event fires when the underlying data\n     * to a source has changed. (i.e. GeoJSONSource.setData and ImageSource.setCoordinates)\n     */\n    private _dataHandler(e: MapSourceDataEvent): void {\n        if (e.dataType !== 'source') return;\n\n        if (e.sourceDataType === 'metadata') {\n            this._sourceLoaded = true;\n            return;\n        }\n\n        if (e.sourceDataType !== 'content' || !this._sourceLoaded || this._paused) {\n            return;\n        }\n\n        this.reload(e.sourceDataChanged, e.shouldReloadTileOptions);\n        if (this.transform) {\n            this.update(this.transform, this.terrain);\n        }\n        this._didEmitContent = true;\n    }\n\n    /**\n     * Remove all tiles from this pyramid\n     */\n    clearTiles(): void {\n        this._shouldReloadOnResume = false;\n        this._paused = false;\n\n        for (const id of this._inViewTiles.getAllIds()) {\n            this._removeTile(id);\n        }\n\n        this._outOfViewCache.reset();\n    }\n\n    /**\n     * Search through our current tiles and attempt to find the tiles that\n     * cover the given bounds.\n     * @param pointQueryGeometry - coordinates of the corners of bounding rectangle\n     * @returns result items have `{tile, minX, maxX, minY, maxY}`, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile.\n     */\n    tilesIn(pointQueryGeometry: Point[], maxPitchScaleFactor: number, has3DLayer: boolean): TileResult[] {\n        const tileResults: TileResult[] = [];\n\n        const transform = this.transform;\n        if (!transform) return tileResults;\n        const allowWorldCopies = transform.getCoveringTilesDetailsProvider().allowWorldCopies();\n\n        const cameraPointQueryGeometry = has3DLayer ?\n            transform.getCameraQueryGeometry(pointQueryGeometry) :\n            pointQueryGeometry;\n\n        const project = (point: Point) => transform.screenPointToMercatorCoordinate(point, this.terrain);\n        const queryGeometry = this.transformBbox(pointQueryGeometry, project, !allowWorldCopies);\n        const cameraQueryGeometry = this.transformBbox(cameraPointQueryGeometry, project, !allowWorldCopies);\n\n        const ids = this.getIds();\n\n        const cameraBounds = Bounds.fromPoints(cameraQueryGeometry);\n\n        for (const id of ids) {\n            const tile = this._inViewTiles.getTileById(id);\n            if (tile.holdingForSymbolFade()) {\n                // Tiles held for fading are covered by tiles that are closer to ideal\n                continue;\n            }\n            // if the projection does not render world copies then we need to explicitly check for the bounding box crossing the antimeridian\n            const tileIDs = allowWorldCopies ? [tile.tileID] : [tile.tileID.unwrapTo(-1), tile.tileID.unwrapTo(0)];\n            const scale = Math.pow(2, transform.zoom - tile.tileID.overscaledZ);\n            const queryPadding = maxPitchScaleFactor * tile.queryPadding * EXTENT / tile.tileSize / scale;\n\n            for (const tileID of tileIDs) {\n\n                const tileSpaceBounds = cameraBounds.map(point => tileID.getTilePoint(new MercatorCoordinate(point.x, point.y)));\n                tileSpaceBounds.expandBy(queryPadding);\n\n                if (tileSpaceBounds.intersects(EXTENT_BOUNDS)) {\n\n                    const tileSpaceQueryGeometry: Point[] = queryGeometry.map((c) => tileID.getTilePoint(c));\n                    const tileSpaceCameraQueryGeometry = cameraQueryGeometry.map((c) => tileID.getTilePoint(c));\n\n                    tileResults.push({\n                        tile,\n                        tileID: allowWorldCopies ? tileID : tileID.unwrapTo(0),\n                        queryGeometry: tileSpaceQueryGeometry,\n                        cameraQueryGeometry: tileSpaceCameraQueryGeometry,\n                        scale\n                    });\n                }\n            }\n        }\n\n        return tileResults;\n    }\n\n    private transformBbox(geom: Point[], project: (point: Point) => MercatorCoordinate, checkWrap: boolean): MercatorCoordinate[] {\n        let transformed = geom.map(project);\n        if (checkWrap) {\n            // If the projection does not allow world copies, then a bounding box may span the antimeridian and\n            // instead of a bounding box going from 179°E to 179°W, it goes from 179°W to 179°E and covers the entire\n            // planet except for what should be inside it.\n            const bounds = Bounds.fromPoints(geom);\n            bounds.shrinkBy(Math.min(bounds.width(), bounds.height()) * 0.001);\n            const projected = bounds.map(project);\n\n            const newBounds = Bounds.fromPoints(transformed);\n\n            if (!newBounds.covers(projected)) {\n                transformed = transformed.map((coord) => coord.x > 0.5 ?\n                    new MercatorCoordinate(coord.x - 1, coord.y, coord.z) :\n                    coord\n                );\n            }\n        }\n        return transformed;\n    }\n\n    getVisibleCoordinates(symbolLayer?: boolean): OverscaledTileID[] {\n        const coords = this.getRenderableIds(symbolLayer).map((id) => this._inViewTiles.getTileById(id).tileID);\n        if (this.transform) {\n            this.transform.populateCache(coords);\n        }\n        return coords;\n    }\n\n    hasTransition(): boolean {\n        if (this._source.hasTransition()) {\n            return true;\n        }\n\n        return isRasterType(this._source.type) && hasRasterTransition(this._inViewTiles, this._rasterFadeDuration);\n    }\n\n    setRasterFadeDuration(fadeDuration: number): void {\n        this._rasterFadeDuration = fadeDuration;\n    }\n\n    /**\n     * Set the value of a particular state for a feature\n     */\n    setFeatureState(sourceLayer: string, featureId: number | string, state: any): void {\n        sourceLayer ||= GEOJSON_TILE_LAYER_NAME;\n        this._state.updateState(sourceLayer, featureId, state);\n    }\n\n    /**\n     * Resets the value of a particular state key for a feature\n     */\n    removeFeatureState(sourceLayer?: string, featureId?: number | string, key?: string): void {\n        sourceLayer ||= GEOJSON_TILE_LAYER_NAME;\n        this._state.removeFeatureState(sourceLayer, featureId, key);\n    }\n\n    /**\n     * Get the entire state object for a feature\n     */\n    getFeatureState(sourceLayer: string, featureId: number | string): FeatureState {\n        sourceLayer ||= GEOJSON_TILE_LAYER_NAME;\n        return this._state.getState(sourceLayer, featureId);\n    }\n\n    /**\n     * Sets the set of keys that the tile depends on. This allows tiles to\n     * be reloaded when their dependencies change.\n     */\n    setDependencies(tileKey: string, namespace: string, dependencies: string[]): void {\n        const tile = this._inViewTiles.getTileById(tileKey);\n        if (tile) {\n            tile.setDependencies(namespace, dependencies);\n        }\n    }\n\n    /**\n     * Reloads all tiles that depend on the given keys.\n     */\n    reloadTilesForDependencies(namespaces: string[], keys: string[]): void {\n        for (const id of this._inViewTiles.getAllIds()) {\n            const tile = this._inViewTiles.getTileById(id);\n            if (tile.hasDependency(namespaces, keys)) {\n                this._reloadTile(id, 'reloading');\n            }\n        }\n        this._outOfViewCache.filter(tile => !tile.hasDependency(namespaces, keys));\n    }\n\n    areTilesLoaded(): boolean {\n        for (const tile of this._inViewTiles.getAllTiles()) {\n            if (!(tile.state === 'loaded' || tile.state === 'errored')) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n","import {clamp} from '../util/util.ts';\nimport type Point from '@mapbox/point-geometry';\n\nexport class PathInterpolator {\n    points: Point[];\n    length: number;\n    paddedLength: number;\n    padding: number;\n    _distances: number[];\n\n    constructor(points_?: Point[] | null, padding_?: number | null) {\n        this.reset(points_, padding_);\n    }\n\n    reset(points_?: Point[] | null, padding_?: number | null): void {\n        this.points = points_ || [];\n\n        // Compute cumulative distance from first point to every other point in the segment.\n        // Last entry in the array is total length of the path\n        this._distances = [0.0];\n\n        for (let i = 1; i < this.points.length; i++) {\n            this._distances[i] = this._distances[i - 1] + this.points[i].dist(this.points[i - 1]);\n        }\n\n        this.length = this._distances[this._distances.length - 1];\n        this.padding = Math.min(padding_ || 0, this.length * 0.5);\n        this.paddedLength = this.length - this.padding * 2.0;\n    }\n\n    lerp(t: number): Point {\n        if (this.points.length === 1) {\n            return this.points[0];\n        }\n\n        t = clamp(t, 0, 1);\n\n        // Find the correct segment [p0, p1] where p0 <= x < p1\n        let currentIndex = 1;\n        let distOfCurrentIdx = this._distances[currentIndex];\n        const distToTarget = t * this.paddedLength + this.padding;\n\n        while (distOfCurrentIdx < distToTarget && currentIndex < this._distances.length) {\n            distOfCurrentIdx = this._distances[++currentIndex];\n        }\n\n        // Interpolate between the two points of the segment\n        const idxOfPrevPoint = currentIndex - 1;\n        const distOfPrevIdx = this._distances[idxOfPrevPoint];\n        const segmentLength = distOfCurrentIdx - distOfPrevIdx;\n        const segmentT = segmentLength > 0 ? (distToTarget - distOfPrevIdx) / segmentLength : 0;\n\n        return this.points[idxOfPrevPoint].mult(1.0 - segmentT).add(this.points[currentIndex].mult(segmentT));\n    }\n}\n","import type {OverlapMode} from '../style/style_layer/overlap_mode.ts';\n\ntype QueryArgs = {\n    hitTest: boolean;\n    overlapMode?: OverlapMode;\n    circle?: {\n        x: number;\n        y: number;\n        radius: number;\n    };\n    seenUids: {\n        box: {\n            [_: number]: boolean;\n        };\n        circle: {\n            [_: number]: boolean;\n        };\n    };\n};\n\ntype QueryResult<T> = {\n    key: T;\n    x1: number;\n    y1: number;\n    x2: number;\n    y2: number;\n};\n\n/**\n * A key for the grid\n */\nexport type GridKey = {\n    overlapMode?: OverlapMode;\n};\n\nfunction overlapAllowed(overlapA: OverlapMode, overlapB: OverlapMode): boolean {\n    let allowed = true;\n\n    if (overlapA === 'always') {\n        // symbol A using 'always' overlap - allowed to overlap anything.\n    } else if (overlapA === 'never' || overlapB === 'never') {\n        // symbol A using 'never' overlap - can't overlap anything\n        // symbol A using 'cooperative' overlap - can overlap 'always' or 'cooperative' symbol; can't overlap 'never'\n        allowed = false;\n    }\n\n    return allowed;\n}\n\n/**\n * @internal\n * GridIndex is a data structure for testing the intersection of\n * circles and rectangles in a 2d plane.\n * It is optimized for rapid insertion and querying.\n * GridIndex splits the plane into a set of \"cells\" and keeps track\n * of which geometries intersect with each cell. At query time,\n * full geometry comparisons are only done for items that share\n * at least one cell. As long as the geometries are relatively\n * uniformly distributed across the plane, this greatly reduces\n * the number of comparisons necessary.\n */\nexport class GridIndex<T extends GridKey> {\n    circleKeys: T[];\n    boxKeys: T[];\n    boxCells: number[][];\n    circleCells: number[][];\n    bboxes: number[];\n    circles: number[];\n    xCellCount: number;\n    yCellCount: number;\n    width: number;\n    height: number;\n    xScale: number;\n    yScale: number;\n    boxUid: number;\n    circleUid: number;\n\n    constructor (width: number, height: number, cellSize: number) {\n        const boxCells = this.boxCells = [];\n        const circleCells = this.circleCells = [];\n\n        // More cells -> fewer geometries to check per cell, but items tend\n        // to be split across more cells.\n        // Sweet spot allows most small items to fit in one cell\n        this.xCellCount = Math.ceil(width / cellSize);\n        this.yCellCount = Math.ceil(height / cellSize);\n\n        for (let i = 0; i < this.xCellCount * this.yCellCount; i++) {\n            boxCells.push([]);\n            circleCells.push([]);\n        }\n        this.circleKeys = [];\n        this.boxKeys = [];\n        this.bboxes = [];\n        this.circles = [];\n\n        this.width = width;\n        this.height = height;\n        this.xScale = this.xCellCount / width;\n        this.yScale = this.yCellCount / height;\n        this.boxUid = 0;\n        this.circleUid = 0;\n    }\n\n    keysLength(): number {\n        return this.boxKeys.length + this.circleKeys.length;\n    }\n\n    insert(key: T, x1: number, y1: number, x2: number, y2: number): void {\n        this._forEachCell(x1, y1, x2, y2, this._insertBoxCell, this.boxUid++);\n        this.boxKeys.push(key);\n        this.bboxes.push(x1);\n        this.bboxes.push(y1);\n        this.bboxes.push(x2);\n        this.bboxes.push(y2);\n    }\n\n    insertCircle(key: T, x: number, y: number, radius: number): void {\n        // Insert circle into grid for all cells in the circumscribing square\n        // It's more than necessary (by a factor of 4/PI), but fast to insert\n        this._forEachCell(x - radius, y - radius, x + radius, y + radius, this._insertCircleCell, this.circleUid++);\n        this.circleKeys.push(key);\n        this.circles.push(x);\n        this.circles.push(y);\n        this.circles.push(radius);\n    }\n\n    private _insertBoxCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, uid: number) {\n        this.boxCells[cellIndex].push(uid);\n    }\n\n    private _insertCircleCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, uid: number)  {\n        this.circleCells[cellIndex].push(uid);\n    }\n\n    private _query(x1: number, y1: number, x2: number, y2: number, hitTest: boolean, overlapMode: OverlapMode, predicate?: (key: T) => boolean): Array<QueryResult<T>> {\n        if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n            return [];\n        }\n        const result: Array<QueryResult<T>> = [];\n        if (x1 <= 0 && y1 <= 0 && this.width <= x2 && this.height <= y2) {\n            if (hitTest) {\n                // Covers the entire grid, so collides with everything\n                return [{\n                    key: null,\n                    x1,\n                    y1,\n                    x2,\n                    y2\n                }];\n            }\n            for (let boxUid = 0; boxUid < this.boxKeys.length; boxUid++) {\n                result.push({\n                    key: this.boxKeys[boxUid],\n                    x1: this.bboxes[boxUid * 4],\n                    y1: this.bboxes[boxUid * 4 + 1],\n                    x2: this.bboxes[boxUid * 4 + 2],\n                    y2: this.bboxes[boxUid * 4 + 3]\n                });\n            }\n            for (let circleUid = 0; circleUid < this.circleKeys.length; circleUid++) {\n                const x = this.circles[circleUid * 3];\n                const y = this.circles[circleUid * 3 + 1];\n                const radius = this.circles[circleUid * 3 + 2];\n                result.push({\n                    key: this.circleKeys[circleUid],\n                    x1: x - radius,\n                    y1: y - radius,\n                    x2: x + radius,\n                    y2: y + radius\n                });\n            }\n        } else {\n            const queryArgs: QueryArgs = {\n                hitTest,\n                overlapMode,\n                seenUids: {box: {}, circle: {}}\n            };\n            this._forEachCell(x1, y1, x2, y2, this._queryCell, result, queryArgs, predicate);\n        }\n\n        return result;\n    }\n\n    query(x1: number, y1: number, x2: number, y2: number): Array<QueryResult<T>> {\n        return this._query(x1, y1, x2, y2, false, null);\n    }\n\n    hitTest(x1: number, y1: number, x2: number, y2: number, overlapMode: OverlapMode, predicate?: (key: T) => boolean): boolean {\n        return this._query(x1, y1, x2, y2, true, overlapMode, predicate).length > 0;\n    }\n\n    hitTestCircle(x: number, y: number, radius: number, overlapMode: OverlapMode, predicate?: (key: T) => boolean): boolean {\n        // Insert circle into grid for all cells in the circumscribing square\n        // It's more than necessary (by a factor of 4/PI), but fast to insert\n        const x1 = x - radius;\n        const x2 = x + radius;\n        const y1 = y - radius;\n        const y2 = y + radius;\n        if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n            return false;\n        }\n\n        // Box query early exits if the bounding box is larger than the grid, but we don't do\n        // the equivalent calculation for circle queries because early exit is less likely\n        // and the calculation is more expensive\n        const result: boolean[] = [];\n        const queryArgs: QueryArgs = {\n            hitTest: true,\n            overlapMode,\n            circle: {x, y, radius},\n            seenUids: {box: {}, circle: {}}\n        };\n        this._forEachCell(x1, y1, x2, y2, this._queryCellCircle, result, queryArgs, predicate);\n        return result.length > 0;\n    }\n\n    private _queryCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, result: Array<QueryResult<T>>, queryArgs: QueryArgs, predicate?: (key: T) => boolean): boolean {\n        const {seenUids, hitTest, overlapMode} = queryArgs;\n        const boxCell = this.boxCells[cellIndex];\n\n        // Use a small epsilon to account for floating-point imprecision\n        // when collision box boundaries are computed via different\n        // projection paths (different tiles/sources) but should\n        // mathematically produce the same boundary value.\n        const epsilon = 1e-6;\n\n        if (boxCell !== null) {\n            const bboxes = this.bboxes;\n            for (const boxUid of boxCell) {\n                if (!seenUids.box[boxUid]) {\n                    seenUids.box[boxUid] = true;\n                    const offset = boxUid * 4;\n                    const key = this.boxKeys[boxUid];\n\n                    if ((x1 <= bboxes[offset + 2] + epsilon) &&\n                        (y1 <= bboxes[offset + 3] + epsilon) &&\n                        (x2 >= bboxes[offset + 0] - epsilon) &&\n                        (y2 >= bboxes[offset + 1] - epsilon) &&\n                        (!predicate || predicate(key))) {\n                        if (!hitTest || !overlapAllowed(overlapMode, key.overlapMode)) {\n                            result.push({\n                                key,\n                                x1: bboxes[offset],\n                                y1: bboxes[offset + 1],\n                                x2: bboxes[offset + 2],\n                                y2: bboxes[offset + 3]\n                            });\n                            if (hitTest) {\n                                // true return value stops the query after first match\n                                return true;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        const circleCell = this.circleCells[cellIndex];\n        if (circleCell !== null) {\n            const circles = this.circles;\n            for (const circleUid of circleCell) {\n                if (!seenUids.circle[circleUid]) {\n                    seenUids.circle[circleUid] = true;\n                    const offset = circleUid * 3;\n                    const key = this.circleKeys[circleUid];\n\n                    if (this._circleAndRectCollide(\n                        circles[offset],\n                        circles[offset + 1],\n                        circles[offset + 2],\n                        x1,\n                        y1,\n                        x2,\n                        y2) &&\n                        (!predicate || predicate(key))) {\n                        if (!hitTest || !overlapAllowed(overlapMode, key.overlapMode)) {\n                            const x = circles[offset];\n                            const y = circles[offset + 1];\n                            const radius = circles[offset + 2];\n                            result.push({\n                                key,\n                                x1: x - radius,\n                                y1: y - radius,\n                                x2: x + radius,\n                                y2: y + radius\n                            });\n                            if (hitTest) {\n                                // true return value stops the query after first match\n                                return true;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        // false return to continue query\n        return false;\n    }\n\n    private _queryCellCircle(x1: number, y1: number, x2: number, y2: number, cellIndex: number, result: boolean[], queryArgs: QueryArgs, predicate?: (key: T) => boolean): boolean {\n        const {circle, seenUids, overlapMode} = queryArgs;\n        const boxCell = this.boxCells[cellIndex];\n\n        if (boxCell !== null) {\n            const bboxes = this.bboxes;\n            for (const boxUid of boxCell) {\n                if (!seenUids.box[boxUid]) {\n                    seenUids.box[boxUid] = true;\n                    const offset = boxUid * 4;\n                    const key = this.boxKeys[boxUid];\n                    if (this._circleAndRectCollide(\n                        circle.x,\n                        circle.y,\n                        circle.radius,\n                        bboxes[offset + 0],\n                        bboxes[offset + 1],\n                        bboxes[offset + 2],\n                        bboxes[offset + 3]) &&\n                        (!predicate || predicate(key)) &&\n                        !overlapAllowed(overlapMode, key.overlapMode)) {\n                        result.push(true);\n                        return true;\n                    }\n                }\n            }\n        }\n\n        const circleCell = this.circleCells[cellIndex];\n        if (circleCell !== null) {\n            const circles = this.circles;\n            for (const circleUid of circleCell) {\n                if (!seenUids.circle[circleUid]) {\n                    seenUids.circle[circleUid] = true;\n                    const offset = circleUid * 3;\n                    const key = this.circleKeys[circleUid];\n                    if (this._circlesCollide(\n                        circles[offset],\n                        circles[offset + 1],\n                        circles[offset + 2],\n                        circle.x,\n                        circle.y,\n                        circle.radius) &&\n                        (!predicate || predicate(key)) &&\n                        !overlapAllowed(overlapMode, key.overlapMode)) {\n                        result.push(true);\n                        return true;\n                    }\n                }\n            }\n        }\n    }\n\n    private _forEachCell<TArg>(\n        x1: number,\n        y1: number,\n        x2: number,\n        y2: number,\n        fn: (x1: number, y1: number, x2: number, y2: number, cellIndex: number, arg1: TArg, arg2?: QueryArgs, predicate?: (key: T) => boolean) => boolean | void,\n        arg1: TArg,\n        arg2?: QueryArgs,\n        predicate?: (key: T) => boolean) {\n        const cx1 = this._convertToXCellCoord(x1);\n        const cy1 = this._convertToYCellCoord(y1);\n        const cx2 = this._convertToXCellCoord(x2);\n        const cy2 = this._convertToYCellCoord(y2);\n\n        for (let x = cx1; x <= cx2; x++) {\n            for (let y = cy1; y <= cy2; y++) {\n                const cellIndex = this.xCellCount * y + x;\n                if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, predicate)) return;\n            }\n        }\n    }\n\n    private _convertToXCellCoord(x: number) {\n        return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(x * this.xScale)));\n    }\n\n    private _convertToYCellCoord(y: number) {\n        return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(y * this.yScale)));\n    }\n\n    private _circlesCollide(x1: number, y1: number, r1: number, x2: number, y2: number, r2: number): boolean {\n        const dx = x2 - x1;\n        const dy = y2 - y1;\n        const bothRadii = r1 + r2;\n        return (bothRadii * bothRadii) > (dx * dx + dy * dy);\n    }\n\n    private _circleAndRectCollide(\n        circleX: number,\n        circleY: number,\n        radius: number,\n        x1: number,\n        y1: number,\n        x2: number,\n        y2: number\n    ): boolean {\n        const halfRectWidth = (x2 - x1) / 2;\n        const distX = Math.abs(circleX - (x1 + halfRectWidth));\n        if (distX > (halfRectWidth + radius)) {\n            return false;\n        }\n\n        const halfRectHeight = (y2 - y1) / 2;\n        const distY = Math.abs(circleY - (y1 + halfRectHeight));\n        if (distY > (halfRectHeight + radius)) {\n            return false;\n        }\n\n        if (distX <= halfRectWidth || distY <= halfRectHeight) {\n            return true;\n        }\n\n        const dx = distX - halfRectWidth;\n        const dy = distY - halfRectHeight;\n        return (dx * dx + dy * dy <= (radius * radius));\n    }\n}\n","/*\nThis class implements fast mathematical operations to optimize or complement gl-matrix\n*/\nimport type {mat4} from 'gl-matrix';\n\n/*\nInvert a transform matrix\ndst and src are in column-major flat format\n*/\nexport function fastInvertTransformMat4(dst: mat4, src: mat4): mat4{\n    // extract scale. hyp: scale X = scale Y:\n    const sXYSqInv = 1.0 / (src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);\n    const sZSqInv = 1.0 / (src[8] * src[8] + src[9] * src[9] + src[10] * src[10]);\n\n    // inv rotation and scaling part:\n    const s0 = src[0] * sXYSqInv;\n    const s4 = src[4] * sXYSqInv;\n    const s8 = src[8] * sZSqInv;\n    const s1 = src[1] * sXYSqInv;\n    const s5 = src[5] * sXYSqInv;\n    const s9 = src[9] * sZSqInv;\n    const s2 = src[2] * sXYSqInv;\n    const s6 = src[6] * sXYSqInv;\n    const s10 = src[10] * sZSqInv;\n\n    // rotation part:\n    dst[0] = s0;\n    dst[1] = s4;\n    dst[2] = s8;\n    dst[4] = s1;\n    dst[5] = s5;\n    dst[6] = s9;\n    dst[8] = s2;\n    dst[9] = s6;\n    dst[10] = s10;\n\n    // translation part:\n    const t0 = src[12];\n    const t1 = src[13];\n    const t2 = src[14];\n    dst[12] = -s0 * t0 - s1 * t1 - s2 * t2;\n    dst[13] = -s4 * t0 - s5 * t1 - s6 * t2;\n    dst[14] = -s8 * t0 - s9 * t1 - s10 * t2;\n\n    // constant part:\n    dst[3] = 0;\n    dst[7] = 0;\n    dst[11] = 0;\n    dst[15] = 1;\n\n    return dst;\n}\n\n/*\nInvert a perspective projection matrix\ndst and src are in column-major flat format\n*/\nexport function fastInvertProjMat4(dst: mat4, src: mat4): mat4{\n    dst[0] = 1 / src[0];\n    dst[1] = 0;\n    dst[2] = 0;\n    dst[3] = 0;\n\n    dst[4] = 0;\n    dst[5] = 1 / src[5];\n    dst[6] = 0;\n    dst[7] = 0;\n\n    dst[8] = 0;\n    dst[9] = 0;\n    dst[10] = 0;\n    dst[11] = 1 / src[14];\n\n    dst[12] = 0;\n    dst[13] = 0;\n    dst[14] = -1;\n    dst[15] = src[10] / src[14];\n\n    return dst;\n}\n\n/*\nInvert a skew matrix\nwith diag coefficients > 0 and XY counterdiag\ndst and src are in column-major flat format\n*/\n\nexport function fastInvertSkewMat4(dst: mat4, src: mat4): mat4{\n    const invDetXY = 1.0 / (src[0]*src[5] - src[1]*src[4]);\n    dst[0] = src[5] * invDetXY;\n    dst[1] = -src[1] * invDetXY;\n    dst[2] = 0;\n    dst[3] = 0;\n\n    dst[4] = -src[4] * invDetXY;\n    dst[5] = src[0] * invDetXY;\n    dst[6] = 0;\n    dst[7] = 0;\n\n    dst[8] = 0;\n    dst[9] = 0;\n    dst[10] = 1 / src[10];\n    dst[11] = 0;\n\n    dst[12] = 0;\n    dst[13] = 0;\n    dst[14] = 0;\n    dst[15] = 1 / src[15];\n\n    return dst;\n}\n","import Point from '@mapbox/point-geometry';\n\nimport {mat2, mat4, vec2, vec4} from 'gl-matrix';\nimport * as symbolSize from './symbol_size.ts';\nimport {addDynamicAttributes} from '../data/bucket/symbol_bucket.ts';\n\nimport type {Painter} from '../render/painter.ts';\nimport type {IReadonlyTransform} from '../geo/transform_interface.ts';\nimport type {SymbolBucket} from '../data/bucket/symbol_bucket.ts';\nimport type {\n    GlyphOffsetArray,\n    SymbolLineVertexArray,\n    SymbolDynamicLayoutArray,\n    PlacedSymbol,\n} from '../data/array_types.g.ts';\nimport {WritingMode} from '../symbol/shaping.ts';\nimport {findLineIntersection} from '../util/util.ts';\nimport {type UnwrappedTileID} from '../tile/tile_id.ts';\nimport {type StructArray} from '../util/struct_array.ts';\nimport {fastInvertSkewMat4} from '../util/fast_maths.ts';\n\n/**\n * Pre-allocate objects to avoid online allocation\n */\nconst tmpMat4 = mat4.create();\n\n/**\n * The result of projecting a point to the screen, with some additional information about the projection.\n */\nexport type PointProjection = {\n    /**\n     * The projected point.\n     */\n    point: Point;\n    /**\n     * The original W component of the projection.\n     */\n    signedDistanceFromCamera: number;\n    /**\n     * For complex projections (such as globe), true if the point is occluded by the projection, such as by being on the backfacing side of the globe.\n     * If the point is simply beyond the edge of the screen, this should NOT be set to false.\n     */\n    isOccluded: boolean;\n};\n\n/*\n * # Overview of coordinate spaces\n *\n * ## Tile coordinate spaces\n * Each label has an anchor. Some labels have corresponding line geometries.\n * The points for both anchors and lines are stored in tile units. Each tile has it's own\n * coordinate space going from (0, 0) at the top left to (EXTENT, EXTENT) at the bottom right.\n *\n * ## Clip space (GL coordinate space)\n * At the end of everything, the vertex shader needs to produce a position in clip space,\n * which is (-1, 1) at the top left and (1, -1) in the bottom right.\n * In the depth buffer, values are between 0 (near plane) to 1 (far plane).\n *\n * ## Map pixel coordinate spaces\n * Each tile has a pixel coordinate space. It's just the tile units scaled so that one unit is\n * whatever counts as 1 pixel at the current zoom.\n * This space is used for pitch-alignment=map, rotation-alignment=map\n *\n * ## Rotated map pixel coordinate spaces\n * Like the above, but rotated so axis of the space are aligned with the viewport instead of the tile.\n * This space is used for pitch-alignment=map, rotation-alignment=viewport\n *\n * ## Viewport pixel coordinate space\n * (0, 0) is at the top left of the canvas and (pixelWidth, pixelHeight) is at the bottom right corner\n * of the canvas. This space is used for pitch-alignment=viewport\n *\n *\n * # Vertex projection\n * It goes roughly like this:\n * 1. project the anchor and line from tile units into the correct label coordinate space\n *      - map pixel space           pitch-alignment=map         rotation-alignment=map\n *      - rotated map pixel space   pitch-alignment=map         rotation-alignment=viewport\n *      - viewport pixel space      pitch-alignment=viewport    rotation-alignment=*\n * 2. if the label follows a line, find the point along the line that is the correct distance from the anchor.\n * 3. add the glyph's corner offset to the point from step 3\n * 4. convert from the label coordinate space to clip space\n *\n * For horizontal labels we want to do step 1 in the shader for performance reasons (no cpu work).\n *      This is what `u_label_plane_matrix` is used for.\n * For labels aligned with lines we have to steps 1 and 2 on the cpu since we need access to the line geometry.\n *      This is what `updateLineLabels(...)` does.\n *      Since the conversion is handled on the cpu we just set `u_label_plane_matrix` to an identity matrix.\n *\n * Steps 3 and 4 are done in the shaders for all labels.\n *\n *\n * # Custom projection handling\n * Note that since MapLibre now supports more than one projection, the transformation\n * to viewport pixel space and GL clip space now *must* go through the projection's (`transform`'s)\n * `projectTileCoordinates` function, since it might do nontrivial transformations.\n *\n * Hence projecting anything to a symbol's label plane can no longer be handled by a simple matrix,\n * since, if the symbol's label plane is viewport pixel space, `projectTileCoordinates` must be used.\n * This is applies both here and in the symbol vertex shaders.\n */\n\nexport function getPitchedLabelPlaneMatrix(\n    rotateWithMap: boolean,\n    transform: IReadonlyTransform,\n    pixelsToTileUnits: number): mat4 {\n    const m = mat4.create();\n    if (!rotateWithMap) {\n        const {vecSouth, vecEast} = getTileSkewVectors(transform);\n        const skew = mat2.create();\n        skew[0] = vecEast[0];\n        skew[1] = vecEast[1];\n        skew[2] = vecSouth[0];\n        skew[3] = vecSouth[1];\n        mat2.invert(skew, skew);\n        m[0] = skew[0];\n        m[1] = skew[1];\n        m[4] = skew[2];\n        m[5] = skew[3];\n    }\n    mat4.scale(m, m, [1 / pixelsToTileUnits, 1 / pixelsToTileUnits, 1]);\n    return m;\n}\n\n/*\n * Returns a matrix for either converting from pitched label space to tile space,\n * or for converting from screenspace pixels to clip space.\n */\nexport function getGlCoordMatrix(\n    pitchWithMap: boolean,\n    rotateWithMap: boolean,\n    transform: IReadonlyTransform,\n    pixelsToTileUnits: number): mat4 {\n    if (pitchWithMap) {\n        const m = mat4.create();\n        if (!rotateWithMap) {\n            const {vecSouth, vecEast} = getTileSkewVectors(transform);\n            m[0] = vecEast[0];\n            m[1] = vecEast[1];\n            m[4] = vecSouth[0];\n            m[5] = vecSouth[1];\n        }\n        mat4.scale(m, m, [pixelsToTileUnits, pixelsToTileUnits, 1]);\n        return m;\n    } else {\n        return transform.pixelsToClipSpaceMatrix;\n    }\n}\n\nexport function getTileSkewVectors(transform: IReadonlyTransform): {vecEast: vec2; vecSouth: vec2} {\n    const cosRoll = Math.cos(transform.rollInRadians);\n    const sinRoll = Math.sin(transform.rollInRadians);\n    const cosPitch = Math.cos(transform.pitchInRadians);\n    const cosBearing = Math.cos(transform.bearingInRadians);\n    const sinBearing = Math.sin(transform.bearingInRadians);\n    const vecSouth = vec2.create();\n    vecSouth[0] = -cosBearing * cosPitch * sinRoll - sinBearing * cosRoll;\n    vecSouth[1] = -sinBearing * cosPitch * sinRoll + cosBearing * cosRoll;\n    const vecSouthLen = vec2.length(vecSouth);\n    if (vecSouthLen < 1.0e-9) {\n        vec2.zero(vecSouth);\n    } else {\n        vec2.scale(vecSouth, vecSouth, 1 / vecSouthLen);\n    }\n    const vecEast = vec2.create();\n    vecEast[0] = cosBearing * cosPitch * cosRoll - sinBearing * sinRoll;\n    vecEast[1] = sinBearing * cosPitch * cosRoll + cosBearing * sinRoll;\n    const vecEastLen = vec2.length(vecEast);\n    if (vecEastLen < 1.0e-9) {\n        vec2.zero(vecEast);\n    } else {\n        vec2.scale(vecEast, vecEast, 1 / vecEastLen);\n    }\n\n    return {vecEast, vecSouth};\n}\n\n/**\n * Projects a point using a specified matrix, including the perspective divide.\n * Uses a fast path if `getElevation` is undefined.\n */\nexport function projectWithMatrix(x: number, y: number, matrix: mat4, getElevation?: (x: number, y: number) => number): PointProjection {\n    let pos;\n    if (getElevation) { // slow because of handle z-index\n        pos = [x, y, getElevation(x, y), 1] as vec4;\n        vec4.transformMat4(pos, pos, matrix);\n    } else { // fast because of ignore z-index\n        pos = [x, y, 0, 1] as vec4;\n        xyTransformMat4(pos, pos, matrix);\n    }\n    const w = pos[3];\n    return {\n        point: new Point(pos[0] / w, pos[1] / w),\n        signedDistanceFromCamera: w,\n        isOccluded: false\n    };\n}\n\nexport function getPerspectiveRatio(cameraToCenterDistance: number, signedDistanceFromCamera: number): number {\n    return 0.5 + 0.5 * (cameraToCenterDistance / signedDistanceFromCamera);\n}\n\nfunction isVisible(p: Point,\n    clippingBuffer: [number, number]) {\n    const inPaddedViewport = (\n        p.x >= -clippingBuffer[0] &&\n        p.x <= clippingBuffer[0] &&\n        p.y >= -clippingBuffer[1] &&\n        p.y <= clippingBuffer[1]);\n    return inPaddedViewport;\n}\n\n/*\n *  Update the `dynamicLayoutVertexBuffer` for the buffer with the correct glyph positions for the current map view.\n *  This is only run on labels that are aligned with lines. Horizontal labels are handled entirely in the shader.\n */\nexport function updateLineLabels(bucket: SymbolBucket,\n    painter: Painter,\n    isText: boolean,\n    pitchedLabelPlaneMatrix: mat4,\n    pitchedLabelPlaneMatrixInverse: mat4,\n    pitchWithMap: boolean,\n    keepUpright: boolean,\n    rotateToLine: boolean,\n    unwrappedTileID: UnwrappedTileID,\n    viewportWidth: number,\n    viewportHeight: number,\n    translation: [number, number],\n    getElevation: (x: number, y: number) => number): void {\n\n    const sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n    const partiallyEvaluatedSize = symbolSize.evaluateSizeForZoom(sizeData, painter.transform.zoom);\n\n    const clippingBuffer: [number, number] = [256 / painter.width * 2 + 1, 256 / painter.height * 2 + 1];\n\n    const dynamicLayoutVertexArray = isText ?\n        bucket.text.dynamicLayoutVertexArray :\n        bucket.icon.dynamicLayoutVertexArray;\n    dynamicLayoutVertexArray.clear();\n\n    const lineVertexArray = bucket.lineVertexArray;\n    const placedSymbols = isText ? bucket.text.placedSymbolArray : bucket.icon.placedSymbolArray;\n\n    const aspectRatio = painter.transform.width / painter.transform.height;\n\n    let useVertical = false;\n\n    for (let s = 0; s < placedSymbols.length; s++) {\n        const symbol = placedSymbols.get(s);\n\n        // Don't do calculations for vertical glyphs unless the previous symbol was horizontal\n        // and we determined that vertical glyphs were necessary.\n        // Also don't do calculations for symbols that are collided and fully faded out\n        if (symbol.hidden || symbol.writingMode === WritingMode.vertical && !useVertical) {\n            hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n            continue;\n        }\n        // Awkward... but we're counting on the paired \"vertical\" symbol coming immediately after its horizontal counterpart\n        useVertical = false;\n\n        const tileAnchorPoint = new Point(symbol.anchorX, symbol.anchorY);\n        const projectionCache: ProjectionCache = {projections: {}, offsets: {}, cachedAnchorPoint: undefined, anyProjectionOccluded: false};\n\n        const projectionContext: SymbolProjectionContext = {\n            getElevation,\n            pitchedLabelPlaneMatrix,\n            lineVertexArray,\n            pitchWithMap,\n            projectionCache,\n            transform: painter.transform,\n            tileAnchorPoint,\n            unwrappedTileID,\n            width: viewportWidth,\n            height: viewportHeight,\n            translation\n        };\n\n        const anchorPos = projectTileCoordinatesToClipSpace(symbol.anchorX, symbol.anchorY, projectionContext);\n\n        // Don't bother calculating the correct point for invisible labels.\n        if (!isVisible(anchorPos.point, clippingBuffer)) {\n            hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n            continue;\n        }\n\n        const cameraToAnchorDistance = anchorPos.signedDistanceFromCamera;\n        const perspectiveRatio = getPerspectiveRatio(painter.transform.cameraToCenterDistance, cameraToAnchorDistance);\n\n        const fontSize = symbolSize.evaluateSizeForFeature(sizeData, partiallyEvaluatedSize, symbol);\n        const pitchScaledFontSize = pitchWithMap ? (fontSize * painter.transform.getPitchedTextCorrection(symbol.anchorX, symbol.anchorY, unwrappedTileID) / perspectiveRatio) : fontSize * perspectiveRatio;\n\n        const placeUnflipped = placeGlyphsAlongLine({\n            projectionContext,\n            pitchedLabelPlaneMatrixInverse,\n            symbol,\n            fontSize: pitchScaledFontSize,\n            flip: false,\n            keepUpright,\n            glyphOffsetArray: bucket.glyphOffsetArray,\n            dynamicLayoutVertexArray,\n            aspectRatio,\n            rotateToLine,\n        });\n\n        useVertical = placeUnflipped.useVertical;\n\n        if (placeUnflipped.notEnoughRoom || useVertical ||\n            (placeUnflipped.needsFlipping &&\n                placeGlyphsAlongLine({\n                    projectionContext,\n                    pitchedLabelPlaneMatrixInverse,\n                    symbol,\n                    fontSize: pitchScaledFontSize,\n                    flip: true, // flipped\n                    keepUpright,\n                    glyphOffsetArray: bucket.glyphOffsetArray,\n                    dynamicLayoutVertexArray,\n                    aspectRatio,\n                    rotateToLine,\n                }).notEnoughRoom)) {\n            hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n        }\n    }\n\n    if (isText) {\n        bucket.text.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n    } else {\n        bucket.icon.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n    }\n}\n\ntype FirstAndLastGlyphPlacement = {\n    first: PlacedGlyph;\n    last: PlacedGlyph;\n} | null;\n\n/*\n * Place the first and last glyph of a line label, projected to the label plane.\n * This function is called both during collision detection (to determine the label's size)\n * and during line label rendering (to make sure the label fits on the line geometry with\n * the current camera position, which may differ from the position used during collision detection).\n *\n * Calling this function has the effect of populating the \"projectionCache\" with all projected\n * vertex locations the label will need, making future calls to placeGlyphAlongLine (for all the\n * intermediate glyphs) much cheaper.\n *\n * Returns null if the label can't fit on the geometry\n */\nexport function placeFirstAndLastGlyph(\n    fontScale: number,\n    glyphOffsetArray: GlyphOffsetArray,\n    lineOffsetX: number,\n    lineOffsetY: number,\n    flip: boolean,\n    symbol: PlacedSymbol,\n    rotateToLine: boolean,\n    projectionContext: SymbolProjectionContext): FirstAndLastGlyphPlacement {\n    const glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n    const lineStartIndex = symbol.lineStartIndex;\n    const lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n\n    const firstGlyphOffset = glyphOffsetArray.getoffsetX(symbol.glyphStartIndex);\n    const lastGlyphOffset = glyphOffsetArray.getoffsetX(glyphEndIndex - 1);\n\n    const firstPlacedGlyph = placeGlyphAlongLine(fontScale * firstGlyphOffset, lineOffsetX, lineOffsetY, flip, symbol.segment,\n        lineStartIndex, lineEndIndex, projectionContext, rotateToLine);\n    if (!firstPlacedGlyph)\n        return null;\n\n    const lastPlacedGlyph = placeGlyphAlongLine(fontScale * lastGlyphOffset, lineOffsetX, lineOffsetY, flip, symbol.segment,\n        lineStartIndex, lineEndIndex, projectionContext, rotateToLine);\n    if (!lastPlacedGlyph)\n        return null;\n\n    if (projectionContext.projectionCache.anyProjectionOccluded) {\n        return null;\n    }\n\n    return {first: firstPlacedGlyph, last: lastPlacedGlyph};\n}\n\ntype OrientationChangeType = {\n    useVertical?: boolean;\n    needsFlipping?: boolean;\n};\n\nfunction requiresOrientationChange(writingMode, firstPoint, lastPoint, aspectRatio): OrientationChangeType {\n    if (writingMode === WritingMode.horizontal) {\n        // On top of choosing whether to flip, choose whether to render this version of the glyphs or the alternate\n        // vertical glyphs. We can't just filter out vertical glyphs in the horizontal range because the horizontal\n        // and vertical versions can have slightly different projections which could lead to angles where both or\n        // neither showed.\n        const rise = Math.abs(lastPoint.y - firstPoint.y);\n        const run = Math.abs(lastPoint.x - firstPoint.x) * aspectRatio;\n        if (rise > run) {\n            return {useVertical: true};\n        }\n    }\n\n    if (writingMode === WritingMode.vertical ? firstPoint.y < lastPoint.y : firstPoint.x > lastPoint.x) {\n        // Includes \"horizontalOnly\" case for labels without vertical glyphs\n        return {needsFlipping: true};\n    }\n\n    return null;\n}\n\ntype GlyphLinePlacementResult = OrientationChangeType & {\n    notEnoughRoom?: boolean;\n};\n\ntype GlyphLinePlacementArgs = {\n    projectionContext: SymbolProjectionContext;\n    pitchedLabelPlaneMatrixInverse: mat4;\n    symbol: PlacedSymbol;\n    fontSize: number;\n    flip: boolean;\n    keepUpright: boolean;\n    glyphOffsetArray: GlyphOffsetArray;\n    dynamicLayoutVertexArray: StructArray;\n    aspectRatio: number;\n    rotateToLine: boolean;\n};\n\n/*\n* Place first and last glyph along the line projected to label plane, and if they fit\n* iterate through all the intermediate glyphs, calculating their label plane positions\n* from the projected line.\n*\n* Finally, add resulting glyph position calculations to dynamicLayoutVertexArray for\n* upload to the GPU\n*/\nfunction placeGlyphsAlongLine(args: GlyphLinePlacementArgs): GlyphLinePlacementResult {\n    const {\n        projectionContext,\n        pitchedLabelPlaneMatrixInverse,\n        symbol,\n        fontSize,\n        flip,\n        keepUpright,\n        glyphOffsetArray,\n        dynamicLayoutVertexArray,\n        aspectRatio,\n        rotateToLine\n    } = args;\n\n    const fontScale = fontSize / 24;\n    const lineOffsetX = symbol.lineOffsetX * fontScale;\n    const lineOffsetY = symbol.lineOffsetY * fontScale;\n\n    let placedGlyphs;\n    if (symbol.numGlyphs > 1) {\n        const glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n        const lineStartIndex = symbol.lineStartIndex;\n        const lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n\n        // Place the first and the last glyph in the label first, so we can figure out\n        // the overall orientation of the label and determine whether it needs to be flipped in keepUpright mode\n        // Note: these glyphs are placed onto the label plane\n        const firstAndLastGlyph = placeFirstAndLastGlyph(fontScale, glyphOffsetArray, lineOffsetX, lineOffsetY, flip, symbol, rotateToLine, projectionContext);\n        if (!firstAndLastGlyph) {\n            return {notEnoughRoom: true};\n        }\n        const firstPoint = projectFromLabelPlaneToClipSpace(firstAndLastGlyph.first.point.x, firstAndLastGlyph.first.point.y, projectionContext, pitchedLabelPlaneMatrixInverse);\n        const lastPoint = projectFromLabelPlaneToClipSpace(firstAndLastGlyph.last.point.x, firstAndLastGlyph.last.point.y, projectionContext, pitchedLabelPlaneMatrixInverse);\n\n        if (keepUpright && !flip) {\n            const orientationChange = requiresOrientationChange(symbol.writingMode, firstPoint, lastPoint, aspectRatio);\n            if (orientationChange) {\n                return orientationChange;\n            }\n        }\n\n        placedGlyphs = [firstAndLastGlyph.first];\n        for (let glyphIndex = symbol.glyphStartIndex + 1; glyphIndex < glyphEndIndex - 1; glyphIndex++) {\n            // Since first and last glyph fit on the line, try placing the rest of the glyphs.\n            const placedGlyph = placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(glyphIndex), lineOffsetX, lineOffsetY, flip, symbol.segment,\n                lineStartIndex, lineEndIndex, projectionContext, rotateToLine);\n            if (!placedGlyph) {\n                return {notEnoughRoom: true};\n            }\n            placedGlyphs.push(placedGlyph);\n        }\n        placedGlyphs.push(firstAndLastGlyph.last);\n    } else {\n        // Only a single glyph to place\n        // So, determine whether to flip based on projected angle of the line segment it's on\n        if (keepUpright && !flip) {\n            const a = projectTileCoordinatesToLabelPlane(projectionContext.tileAnchorPoint.x, projectionContext.tileAnchorPoint.y, projectionContext).point;\n            const tileVertexIndex = (symbol.lineStartIndex + symbol.segment + 1);\n            const tileSegmentEnd = new Point(projectionContext.lineVertexArray.getx(tileVertexIndex), projectionContext.lineVertexArray.gety(tileVertexIndex));\n            const projectedVertex = projectTileCoordinatesToLabelPlane(tileSegmentEnd.x, tileSegmentEnd.y, projectionContext);\n            // We know the anchor will be in the viewport, but the end of the line segment may be\n            // behind the plane of the camera, in which case we can use a point at any arbitrary (closer)\n            // point on the segment.\n            const b = (projectedVertex.signedDistanceFromCamera > 0) ?\n                projectedVertex.point :\n                projectTruncatedLineSegmentToLabelPlane(projectionContext.tileAnchorPoint, tileSegmentEnd, a, 1, projectionContext);\n\n            const clipSpaceA = projectFromLabelPlaneToClipSpace(a.x, a.y, projectionContext, pitchedLabelPlaneMatrixInverse);\n            const clipSpaceB = projectFromLabelPlaneToClipSpace(b.x, b.y, projectionContext, pitchedLabelPlaneMatrixInverse);\n\n            const orientationChange = requiresOrientationChange(symbol.writingMode, clipSpaceA, clipSpaceB, aspectRatio);\n            if (orientationChange) {\n                return orientationChange;\n            }\n        }\n        const singleGlyph = placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(symbol.glyphStartIndex), lineOffsetX, lineOffsetY, flip, symbol.segment,\n            symbol.lineStartIndex, symbol.lineStartIndex + symbol.lineLength, projectionContext, rotateToLine);\n        if (!singleGlyph || projectionContext.projectionCache.anyProjectionOccluded)\n            return {notEnoughRoom: true};\n\n        placedGlyphs = [singleGlyph];\n    }\n\n    for (const glyph of placedGlyphs) {\n        addDynamicAttributes(dynamicLayoutVertexArray, glyph.point, glyph.angle);\n    }\n    return {};\n}\n\n/**\n * Takes a line and direction from `previousTilePoint` to `currentTilePoint`, projects it to the correct label plane,\n * and returns a projected point along this projected line that is `minimumLength` distance away from `previousProjectedPoint`.\n * Projects a \"virtual\" vertex along a line segment.\n * @param previousTilePoint - Line start point, in tile coordinates.\n * @param currentTilePoint - Line end point, in tile coordinates.\n * @param previousProjectedPoint - Projection of `previousTilePoint` into label plane\n * @param minimumLength - Distance in the projected space along the line for the returned point.\n * @param projectionContext - Projection context, used to get terrain's `getElevation`, and to project the points to screen pixels.\n */\nfunction projectTruncatedLineSegmentToLabelPlane(previousTilePoint: Point, currentTilePoint: Point, previousProjectedPoint: Point, minimumLength: number, projectionContext: SymbolProjectionContext) {\n    // We are assuming \"previousTilePoint\" won't project to a point within one unit of the camera plane\n    // If it did, that would mean our label extended all the way out from within the viewport to a (very distant)\n    // point near the plane of the camera. We wouldn't be able to render the label anyway once it crossed the\n    // plane of the camera.\n    const unitVertexToBeProjected = previousTilePoint.add(previousTilePoint.sub(currentTilePoint)._unit());\n    const projectedUnitVertex = projectTileCoordinatesToLabelPlane(unitVertexToBeProjected.x, unitVertexToBeProjected.y, projectionContext).point;\n    const projectedUnitSegment = previousProjectedPoint.sub(projectedUnitVertex);\n    return previousProjectedPoint.add(projectedUnitSegment._mult(minimumLength / projectedUnitSegment.mag()));\n}\n\ntype IndexToPointCache = { [lineIndex: number]: Point };\n\n/**\n * @internal\n * We calculate label-plane projected points for line vertices as we place glyphs along the line\n * Since we will use the same vertices for potentially many glyphs, cache the results for this bucket\n * over the course of the render. Each vertex location also potentially has one offset equivalent\n * for us to hold onto. The vertex indices are per-symbol-bucket.\n */\ntype ProjectionCache = {\n    /**\n     * tile-unit vertices projected into label-plane units\n     */\n    projections: IndexToPointCache;\n    /**\n     * label-plane vertices which have been shifted to follow an offset line\n     */\n    offsets: IndexToPointCache;\n    /**\n     * Cached projected anchor point.\n     */\n    cachedAnchorPoint: Point | undefined;\n    /**\n     * Was any projected point occluded by the map itself (eg. occluded by the planet when using globe projection).\n     *\n     * Viewport-pitched line-following texts where *any* of the line points is hidden behind the planet curve becomes entirely hidden.\n     * This is perhaps not the most ideal behavior, but it works, it is simple and planetary-scale texts such as this seem to be a rare edge case.\n     */\n    anyProjectionOccluded: boolean;\n};\n\n/**\n * @internal\n * Arguments necessary to project a vertex to the label plane\n */\nexport type SymbolProjectionContext = {\n    /**\n     * Used to cache results, save cost if projecting the same vertex multiple times\n     */\n    projectionCache: ProjectionCache;\n    /**\n     * The array of tile-unit vertices transferred from worker\n     */\n    lineVertexArray: SymbolLineVertexArray;\n    /**\n     * Matrix for transforming from pixels (symbol shaping) to potentially rotated tile units (pitched map label plane).\n     */\n    pitchedLabelPlaneMatrix: mat4;\n    /**\n     * Function to get elevation at a point\n     * @param x - the x coordinate\n     * @param y - the y coordinate\n    */\n    getElevation: (x: number, y: number) => number;\n    /**\n     * Only for creating synthetic vertices if vertex would otherwise project behind plane of camera,\n     * but still convenient to pass it inside this type.\n     */\n    tileAnchorPoint: Point;\n    /**\n     * True when line glyphs are projected onto the map, instead of onto the viewport.\n     */\n    pitchWithMap: boolean;\n    transform: IReadonlyTransform;\n    unwrappedTileID: UnwrappedTileID;\n    /**\n     * Viewport width.\n     */\n    width: number;\n    /**\n     * Viewport height.\n     */\n    height: number;\n    /**\n     * Translation in tile units, computed using text-translate and text-translate-anchor paint style properties.\n     */\n    translation: [number, number];\n};\n\n/**\n * Only for creating synthetic vertices if vertex would otherwise project behind plane of camera\n */\nexport type ProjectionSyntheticVertexArgs = {\n    distanceFromAnchor: number;\n    previousVertex: Point;\n    direction: number;\n    absOffsetX: number;\n};\n\n/**\n * Transform a vertex from tile coordinates to label plane coordinates\n * @param index - index of vertex to project\n * @param projectionContext - necessary data to project a vertex\n * @returns the vertex projected to the label plane\n */\nexport function projectLineVertexToLabelPlane(index: number, projectionContext: SymbolProjectionContext, syntheticVertexArgs: ProjectionSyntheticVertexArgs): Point {\n    const cache = projectionContext.projectionCache;\n\n    if (cache.projections[index]) {\n        return cache.projections[index];\n    }\n    const currentVertex = new Point(\n        projectionContext.lineVertexArray.getx(index),\n        projectionContext.lineVertexArray.gety(index));\n\n    const projection = projectTileCoordinatesToLabelPlane(currentVertex.x, currentVertex.y, projectionContext);\n\n    if (projection.signedDistanceFromCamera > 0) {\n        cache.projections[index] = projection.point;\n        cache.anyProjectionOccluded ||= projection.isOccluded;\n        return projection.point;\n    }\n\n    // The vertex is behind the plane of the camera, so we can't project it\n    // Instead, we'll create a vertex along the line that's far enough to include the glyph\n    const previousLineVertexIndex = index - syntheticVertexArgs.direction;\n    const previousTilePoint = syntheticVertexArgs.distanceFromAnchor === 0 ?\n        projectionContext.tileAnchorPoint :\n        new Point(projectionContext.lineVertexArray.getx(previousLineVertexIndex), projectionContext.lineVertexArray.gety(previousLineVertexIndex));\n\n    // Don't cache because the new vertex might not be far enough out for future glyphs on the same segment\n    const minimumLength = syntheticVertexArgs.absOffsetX - syntheticVertexArgs.distanceFromAnchor + 1;\n    return projectTruncatedLineSegmentToLabelPlane(previousTilePoint, currentVertex, syntheticVertexArgs.previousVertex, minimumLength, projectionContext);\n}\n\n/**\n * Projects the given point in tile coordinates to the correct label plane.\n * If pitchWithMap is true, the (rotated) map plane in pixels is used,\n * otherwise screen pixels are used.\n */\nexport function projectTileCoordinatesToLabelPlane(x: number, y: number, projectionContext: SymbolProjectionContext): PointProjection {\n    const translatedX = x + projectionContext.translation[0];\n    const translatedY = y + projectionContext.translation[1];\n    let projection;\n    if (projectionContext.pitchWithMap) {\n        projection = projectWithMatrix(translatedX, translatedY, projectionContext.pitchedLabelPlaneMatrix, projectionContext.getElevation);\n        projection.isOccluded = false;\n    } else {\n        projection = projectionContext.transform.projectTileCoordinates(translatedX, translatedY, projectionContext.unwrappedTileID, projectionContext.getElevation);\n        projection.point.x = (projection.point.x * 0.5 + 0.5) * projectionContext.width;\n        projection.point.y = (-projection.point.y * 0.5 + 0.5) * projectionContext.height;\n    }\n    return projection;\n}\n\nfunction projectFromLabelPlaneToClipSpace(x: number, y: number, projectionContext: SymbolProjectionContext, pitchedLabelPlaneMatrixInverse: mat4): {x: number; y: number} {\n    if (projectionContext.pitchWithMap) {\n        const pos = [x, y, 0, 1] as vec4;\n        vec4.transformMat4(pos, pos, pitchedLabelPlaneMatrixInverse);\n        return projectionContext.transform.projectTileCoordinates(pos[0] / pos[3], pos[1] / pos[3], projectionContext.unwrappedTileID, projectionContext.getElevation).point;\n    } else {\n        return {\n            x: (x / projectionContext.width) * 2.0 - 1.0,\n            y: 1.0 - (y / projectionContext.height) * 2.0\n        };\n    }\n}\n\n/**\n * Projects the given point in tile coordinates to the GL clip space (-1..1).\n */\nexport function projectTileCoordinatesToClipSpace(x: number, y: number, projectionContext: SymbolProjectionContext): PointProjection {\n    const projection = projectionContext.transform.projectTileCoordinates(x, y, projectionContext.unwrappedTileID, projectionContext.getElevation);\n    return projection;\n}\n\n/**\n * Calculate the normal vector for a line segment\n * @param segmentVector - will be mutated as a tiny optimization\n * @param offset - magnitude of resulting vector\n * @param direction - direction of line traversal\n * @returns a normal vector from the segment, with magnitude equal to offset amount\n */\nexport function transformToOffsetNormal(segmentVector: Point, offset: number, direction: number): Point {\n    return segmentVector._unit()._perp()._mult(offset * direction);\n}\n\n/**\n * Construct offset line segments for the current segment and the next segment, then extend/shrink\n * the segments until they intersect. If the segments are parallel, then they will touch with no modification.\n *\n * @param index - Index of the current vertex\n * @param prevToCurrentOffsetNormal - Normal vector of the line segment from the previous vertex to the current vertex\n * @param currentVertex - Current (non-offset) vertex projected to the label plane\n * @param lineStartIndex - Beginning index for the line this label is on\n * @param lineEndIndex - End index for the line this label is on\n * @param offsetPreviousVertex - The previous vertex projected to the label plane, and then offset along the previous segments normal\n * @param lineOffsetY - Magnitude of the offset\n * @param projectionContext - Necessary data for tile-to-label-plane projection\n * @returns The point at which the current and next line segments intersect, once offset and extended/shrunk to their meeting point\n */\nexport function findOffsetIntersectionPoint(\n    index: number,\n    prevToCurrentOffsetNormal: Point,\n    currentVertex: Point,\n    lineStartIndex: number,\n    lineEndIndex: number,\n    offsetPreviousVertex: Point,\n    lineOffsetY: number,\n    projectionContext: SymbolProjectionContext,\n    syntheticVertexArgs: ProjectionSyntheticVertexArgs): Point {\n    if (projectionContext.projectionCache.offsets[index]) {\n        return projectionContext.projectionCache.offsets[index];\n    }\n\n    const offsetCurrentVertex = currentVertex.add(prevToCurrentOffsetNormal);\n\n    if (index + syntheticVertexArgs.direction < lineStartIndex || index + syntheticVertexArgs.direction >= lineEndIndex) {\n        // This is the end of the line, no intersection to calculate\n        projectionContext.projectionCache.offsets[index] = offsetCurrentVertex;\n        return offsetCurrentVertex;\n    }\n    // Offset the vertices for the next segment\n    const nextVertex = projectLineVertexToLabelPlane(index + syntheticVertexArgs.direction, projectionContext, syntheticVertexArgs);\n    const currentToNextOffsetNormal = transformToOffsetNormal(nextVertex.sub(currentVertex), lineOffsetY, syntheticVertexArgs.direction);\n    const offsetNextSegmentBegin = currentVertex.add(currentToNextOffsetNormal);\n    const offsetNextSegmentEnd = nextVertex.add(currentToNextOffsetNormal);\n\n    // find the intersection of these two lines\n    // if the lines are parallel, offsetCurrent/offsetNextBegin will touch\n    projectionContext.projectionCache.offsets[index] = findLineIntersection(offsetPreviousVertex, offsetCurrentVertex, offsetNextSegmentBegin, offsetNextSegmentEnd) || offsetCurrentVertex;\n\n    return projectionContext.projectionCache.offsets[index];\n}\n\n/**\n * Placed Glyph type\n */\ntype PlacedGlyph = {\n    /**\n     * The point at which the glyph should be placed, in label plane coordinates\n     */\n    point: Point;\n    /**\n     * The angle at which the glyph should be placed\n     */\n    angle: number;\n    /**\n     * The label-plane path used to reach this glyph: used only for collision detection\n     */\n    path: Point[];\n};\n\n/*\n * Place a single glyph along its line, projected into the label plane, by iterating outward\n * from the anchor point until the distance traversed in the label plane equals the glyph's\n * offsetX. Returns null if the glyph can't fit on the line geometry.\n */\nexport function placeGlyphAlongLine(\n    offsetX: number,\n    lineOffsetX: number,\n    lineOffsetY: number,\n    flip: boolean,\n    anchorSegment: number,\n    lineStartIndex: number,\n    lineEndIndex: number,\n    projectionContext: SymbolProjectionContext,\n    rotateToLine: boolean): PlacedGlyph | null {\n\n    const combinedOffsetX = flip ?\n        offsetX - lineOffsetX :\n        offsetX + lineOffsetX;\n\n    let direction = combinedOffsetX > 0 ? 1 : -1;\n\n    let angle = 0;\n    if (flip) {\n        // The label needs to be flipped to keep text upright.\n        // Iterate in the reverse direction.\n        direction *= -1;\n        angle = Math.PI;\n    }\n\n    if (direction < 0) angle += Math.PI;\n\n    let currentIndex = direction > 0 ?\n        lineStartIndex + anchorSegment :\n        lineStartIndex + anchorSegment + 1;\n\n    // Project anchor point to viewport and cache it\n    let anchorPoint: Point;\n\n    if (projectionContext.projectionCache.cachedAnchorPoint) {\n        anchorPoint = projectionContext.projectionCache.cachedAnchorPoint;\n    } else {\n        anchorPoint = projectTileCoordinatesToLabelPlane(projectionContext.tileAnchorPoint.x, projectionContext.tileAnchorPoint.y, projectionContext).point;\n        projectionContext.projectionCache.cachedAnchorPoint = anchorPoint;\n    }\n\n    let currentVertex = anchorPoint;\n    let previousVertex = anchorPoint;\n\n    // offsetPrev and intersectionPoint are analogous to previousVertex and currentVertex\n    // but if there's a line offset they are calculated in parallel as projection happens\n    let offsetIntersectionPoint: Point;\n    let offsetPreviousVertex: Point;\n\n    let distanceFromAnchor = 0;\n    let currentSegmentDistance = 0;\n    const absOffsetX = Math.abs(combinedOffsetX);\n    const pathVertices: Point[] = [];\n\n    let currentLineSegment: Point;\n    while (distanceFromAnchor + currentSegmentDistance <= absOffsetX) {\n        currentIndex += direction;\n\n        // offset does not fit on the projected line\n        if (currentIndex < lineStartIndex || currentIndex >= lineEndIndex)\n            return null;\n\n        // accumulate values from last iteration\n        distanceFromAnchor += currentSegmentDistance;\n        previousVertex = currentVertex;\n        offsetPreviousVertex = offsetIntersectionPoint;\n\n        const syntheticVertexArgs: ProjectionSyntheticVertexArgs = {\n            absOffsetX,\n            direction,\n            distanceFromAnchor,\n            previousVertex\n        };\n\n        // find next vertex in viewport space\n        currentVertex = projectLineVertexToLabelPlane(currentIndex, projectionContext, syntheticVertexArgs);\n        if (lineOffsetY === 0) {\n            // Store vertices for collision detection and update current segment geometry\n            pathVertices.push(previousVertex);\n            currentLineSegment = currentVertex.sub(previousVertex);\n        } else {\n            // Calculate the offset for this section\n            let prevToCurrentOffsetNormal;\n            const prevToCurrent = currentVertex.sub(previousVertex);\n            if (prevToCurrent.mag() === 0) {\n                // We are starting with our anchor point directly on the vertex, so look one vertex ahead\n                // to calculate a normal\n                const nextVertex = projectLineVertexToLabelPlane(currentIndex + direction, projectionContext, syntheticVertexArgs);\n                prevToCurrentOffsetNormal = transformToOffsetNormal(nextVertex.sub(currentVertex), lineOffsetY, direction);\n            } else {\n                prevToCurrentOffsetNormal = transformToOffsetNormal(prevToCurrent, lineOffsetY, direction);\n            }\n            // Initialize offsetPrev on our first iteration, after that it will be pre-calculated\n            offsetPreviousVertex ||= previousVertex.add(prevToCurrentOffsetNormal);\n\n            offsetIntersectionPoint = findOffsetIntersectionPoint(currentIndex, prevToCurrentOffsetNormal, currentVertex, lineStartIndex, lineEndIndex, offsetPreviousVertex, lineOffsetY, projectionContext, syntheticVertexArgs);\n\n            pathVertices.push(offsetPreviousVertex);\n            currentLineSegment = offsetIntersectionPoint.sub(offsetPreviousVertex);\n        }\n        currentSegmentDistance = currentLineSegment.mag();\n    }\n\n    // The point is on the current segment. Interpolate to find it.\n    const segmentInterpolationT = (absOffsetX - distanceFromAnchor) / currentSegmentDistance;\n    const p = currentLineSegment._mult(segmentInterpolationT)._add(offsetPreviousVertex || previousVertex);\n\n    const segmentAngle = angle + Math.atan2(currentVertex.y - previousVertex.y, currentVertex.x - previousVertex.x);\n\n    pathVertices.push(p);\n\n    return {\n        point: p,\n        angle: rotateToLine ? segmentAngle : 0.0,\n        path: pathVertices\n    };\n}\n\nconst hiddenGlyphAttributes = new Float32Array([-Infinity, -Infinity, 0, -Infinity, -Infinity, 0, -Infinity, -Infinity, 0, -Infinity, -Infinity, 0]);\n\n// Hide them by moving them offscreen. We still need to add them to the buffer\n// because the dynamic buffer is paired with a static buffer that doesn't get updated.\nexport function hideGlyphs(num: number, dynamicLayoutVertexArray: SymbolDynamicLayoutArray): void {\n    for (let i = 0; i < num; i++) {\n        const offset = dynamicLayoutVertexArray.length;\n        dynamicLayoutVertexArray.resize(offset + 4);\n        // Since all hidden glyphs have the same attributes, we can build up the array faster with a single call to Float32Array.set\n        // for each set of four vertices, instead of calling addDynamicAttributes for each vertex.\n        dynamicLayoutVertexArray.float32.set(hiddenGlyphAttributes, offset * 3);\n    }\n}\n\n// For line label layout, we're not using z output and our w input is always 1\n// This custom matrix transformation ignores those components to make projection faster\nexport function xyTransformMat4(out: vec4, a: vec4, m: mat4): vec4 {\n    const x = a[0], y = a[1];\n    out[0] = m[0] * x + m[4] * y + m[12];\n    out[1] = m[1] * x + m[5] * y + m[13];\n    out[3] = m[3] * x + m[7] * y + m[15];\n    return out;\n}\n\n/**\n * Takes a path of points that was previously projected using the `pitchedLabelPlaneMatrix`\n * and projects it using the map projection's (mercator/globe...) `projectTileCoordinates` function.\n * Returns a new array of the projected points.\n * Does not modify the input array.\n */\nexport function projectPathSpecialProjection(projectedPath: Point[], projectionContext: SymbolProjectionContext): PointProjection[] {\n    const inverseLabelPlaneMatrix = tmpMat4;\n    fastInvertSkewMat4(inverseLabelPlaneMatrix, projectionContext.pitchedLabelPlaneMatrix);\n    return projectedPath.map(p => {\n        const backProjected = projectWithMatrix(p.x, p.y, inverseLabelPlaneMatrix, projectionContext.getElevation);\n        const projected = projectionContext.transform.projectTileCoordinates(\n            backProjected.point.x,\n            backProjected.point.y,\n            projectionContext.unwrappedTileID,\n            projectionContext.getElevation\n        );\n        projected.point.x = (projected.point.x * 0.5 + 0.5) * projectionContext.width;\n        projected.point.y = (-projected.point.y * 0.5 + 0.5) * projectionContext.height;\n        return projected;\n    });\n}\n\n/**\n * Takes a path of points projected to screenspace, finds the longest continuous unoccluded segment of that path\n * and returns it.\n * Does not modify the input array.\n */\nexport function pathSlicedToLongestUnoccluded(path: PointProjection[]): PointProjection[] {\n    let longestUnoccludedStart = 0;\n    let longestUnoccludedLength = 0;\n    let currentUnoccludedStart = 0;\n    let currentUnoccludedLength = 0;\n    for (let i = 0; i < path.length; i++) {\n        if (path[i].isOccluded) {\n            currentUnoccludedStart = i + 1;\n            currentUnoccludedLength = 0;\n        } else {\n            currentUnoccludedLength++;\n            if (currentUnoccludedLength > longestUnoccludedLength) {\n                longestUnoccludedLength = currentUnoccludedLength;\n                longestUnoccludedStart = currentUnoccludedStart;\n            }\n        }\n    }\n    return path.slice(longestUnoccludedStart, longestUnoccludedStart + longestUnoccludedLength);\n}\n","import Point from '@mapbox/point-geometry';\nimport {clipLine} from './clip_line.ts';\nimport {PathInterpolator} from './path_interpolator.ts';\n\nimport * as intersectionTests from '../util/intersection_tests.ts';\nimport {GridIndex} from './grid_index.ts';\nimport {mat4, vec4} from 'gl-matrix';\nimport ONE_EM from '../symbol/one_em.ts';\n\nimport type {IReadonlyTransform} from '../geo/transform_interface.ts';\nimport type {SingleCollisionBox} from '../data/bucket/symbol_bucket.ts';\nimport type {\n    GlyphOffsetArray,\n    PlacedSymbol,\n    SymbolLineVertexArray\n} from '../data/array_types.g.ts';\nimport type {OverlapMode} from '../style/style_layer/overlap_mode.ts';\nimport {type OverscaledTileID, type UnwrappedTileID} from '../tile/tile_id.ts';\nimport {type PointProjection, type SymbolProjectionContext, getTileSkewVectors, pathSlicedToLongestUnoccluded, placeFirstAndLastGlyph, projectPathSpecialProjection, xyTransformMat4} from '../symbol/projection.ts';\nimport {clamp, getAABB} from '../util/util.ts';\nimport {Bounds} from '../geo/bounds.ts';\n\n// When a symbol crosses the edge that causes it to be included in\n// collision detection, it will cause changes in the symbols around\n// it. This constant specifies how many pixels to pad the edge of\n// the viewport for collision detection so that the bulk of the changes\n// occur offscreen. Making this constant greater increases label\n// stability, but it's expensive.\nexport const viewportPadding = 100;\n\nexport type PlacedCircles = {\n    circles: number[];\n    offscreen: boolean;\n    collisionDetected: boolean;\n};\n\nexport type PlacedBox = {\n    box: number[];\n    placeable: boolean;\n    offscreen: boolean;\n    occluded: boolean;\n};\n\nexport type FeatureKey = {\n    bucketInstanceId: number;\n    featureIndex: number;\n    collisionGroupID: number;\n    overlapMode: OverlapMode;\n};\n\ntype ProjectedBox = {\n    /**\n     * The AABB in the format [minX, minY, maxX, maxY].\n     */\n    box: [number, number, number, number];\n    allPointsOccluded: boolean;\n};\n\n/**\n * @internal\n * A collision index used to prevent symbols from overlapping. It keep tracks of\n * where previous symbols have been placed and is used to check if a new\n * symbol overlaps with any previously added symbols.\n *\n * There are two steps to insertion: first placeCollisionBox/Circles checks if\n * there's room for a symbol, then insertCollisionBox/Circles actually puts the\n * symbol in the index. The two step process allows paired symbols to be inserted\n * together even if they overlap.\n */\nexport class CollisionIndex {\n    grid: GridIndex<FeatureKey>;\n    ignoredGrid: GridIndex<FeatureKey>;\n    transform: IReadonlyTransform;\n    pitchFactor: number;\n    screenRightBoundary: number;\n    screenBottomBoundary: number;\n    gridRightBoundary: number;\n    gridBottomBoundary: number;\n\n    // With perspectiveRatio the fontsize is calculated for tilted maps (near = bigger, far = smaller).\n    // The cutoff defines a threshold to no longer render labels near the horizon.\n    perspectiveRatioCutoff: number;\n\n    constructor(\n        transform: IReadonlyTransform,\n        grid: GridIndex<FeatureKey> = new GridIndex<FeatureKey>(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25),\n        ignoredGrid: GridIndex<FeatureKey> = new GridIndex<FeatureKey>(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25)\n    ) {\n        this.transform = transform;\n\n        this.grid = grid;\n        this.ignoredGrid = ignoredGrid;\n        this.pitchFactor = Math.cos(transform.pitch * Math.PI / 180.0) * transform.cameraToCenterDistance;\n\n        this.screenRightBoundary = transform.width + viewportPadding;\n        this.screenBottomBoundary = transform.height + viewportPadding;\n        this.gridRightBoundary = transform.width + 2 * viewportPadding;\n        this.gridBottomBoundary = transform.height + 2 * viewportPadding;\n\n        this.perspectiveRatioCutoff = 0.6;\n    }\n\n    placeCollisionBox(\n        collisionBox: SingleCollisionBox,\n        overlapMode: OverlapMode,\n        textPixelRatio: number,\n        tileID: OverscaledTileID,\n        unwrappedTileID: UnwrappedTileID,\n        pitchWithMap: boolean,\n        rotateWithMap: boolean,\n        translation: [number, number],\n        collisionGroupPredicate?: (key: FeatureKey) => boolean,\n        getElevation?: (x: number, y: number) => number,\n        shift?: Point,\n        simpleProjectionMatrix?: mat4,\n    ): PlacedBox {\n        const x = collisionBox.anchorPointX + translation[0];\n        const y = collisionBox.anchorPointY + translation[1];\n        const projectedPoint = this.projectAndGetPerspectiveRatio(\n            x,\n            y,\n            unwrappedTileID,\n            getElevation,\n            simpleProjectionMatrix\n        );\n\n        const tileToViewport = textPixelRatio * projectedPoint.perspectiveRatio;\n        let projectedBox: ProjectedBox;\n\n        if (!pitchWithMap && !rotateWithMap) {\n            // Fast path for common symbols\n            const pointX = projectedPoint.x + (shift ? shift.x * tileToViewport : 0);\n            const pointY = projectedPoint.y + (shift ? shift.y * tileToViewport : 0);\n            projectedBox = {\n                allPointsOccluded: false,\n                box: [\n                    pointX + collisionBox.x1 * tileToViewport,\n                    pointY + collisionBox.y1 * tileToViewport,\n                    pointX + collisionBox.x2 * tileToViewport,\n                    pointY + collisionBox.y2 * tileToViewport,\n                ]\n            };\n        } else {\n            projectedBox = this._projectCollisionBox(\n                collisionBox,\n                tileToViewport,\n                tileID,\n                unwrappedTileID,\n                pitchWithMap,\n                rotateWithMap,\n                translation,\n                projectedPoint,\n                getElevation,\n                shift,\n                simpleProjectionMatrix,\n            );\n        }\n\n        const [tlX, tlY, brX, brY] = projectedBox.box;\n\n        // Conditions are ordered from the fastest to evaluate to the slowest.\n        const occluded = pitchWithMap ? projectedBox.allPointsOccluded : projectedPoint.isOccluded;\n\n        let unplaceable = occluded;\n        unplaceable ||= projectedPoint.perspectiveRatio < this.perspectiveRatioCutoff;\n        unplaceable ||= !this.isInsideGrid(tlX, tlY, brX, brY);\n\n        if (unplaceable ||\n            (overlapMode !== 'always' && this.grid.hitTest(tlX, tlY, brX, brY, overlapMode, collisionGroupPredicate))) {\n            return {\n                box: [tlX, tlY, brX, brY],\n                placeable: false,\n                offscreen: false,\n                occluded\n            };\n        }\n\n        return {\n            box: [tlX, tlY, brX, brY],\n            placeable: true,\n            offscreen: this.isOffscreen(tlX, tlY, brX, brY),\n            occluded\n        };\n    }\n\n    placeCollisionCircles(\n        overlapMode: OverlapMode,\n        symbol: PlacedSymbol,\n        lineVertexArray: SymbolLineVertexArray,\n        glyphOffsetArray: GlyphOffsetArray,\n        fontSize: number,\n        unwrappedTileID: UnwrappedTileID,\n        pitchedLabelPlaneMatrix: mat4,\n        showCollisionCircles: boolean,\n        pitchWithMap: boolean,\n        collisionGroupPredicate: (key: FeatureKey) => boolean,\n        circlePixelDiameter: number,\n        textPixelPadding: number,\n        translation: [number, number],\n        getElevation: (x: number, y: number) => number\n    ): PlacedCircles {\n        const placedCollisionCircles = [];\n\n        const tileUnitAnchorPoint = new Point(symbol.anchorX, symbol.anchorY);\n        const perspectiveRatio = this.getPerspectiveRatio(tileUnitAnchorPoint.x, tileUnitAnchorPoint.y, unwrappedTileID, getElevation);\n\n        const labelPlaneFontSize = pitchWithMap ? (fontSize * this.transform.getPitchedTextCorrection(symbol.anchorX, symbol.anchorY, unwrappedTileID) / perspectiveRatio) : fontSize * perspectiveRatio;\n        const labelPlaneFontScale = labelPlaneFontSize / ONE_EM;\n\n        const projectionCache = {projections: {}, offsets: {}, cachedAnchorPoint: undefined, anyProjectionOccluded: false};\n        const lineOffsetX = symbol.lineOffsetX * labelPlaneFontScale;\n        const lineOffsetY = symbol.lineOffsetY * labelPlaneFontScale;\n\n        const projectionContext: SymbolProjectionContext = {\n            getElevation,\n            pitchedLabelPlaneMatrix,\n            lineVertexArray,\n            pitchWithMap,\n            projectionCache,\n            transform: this.transform,\n            tileAnchorPoint: tileUnitAnchorPoint,\n            unwrappedTileID,\n            width: this.transform.width,\n            height: this.transform.height,\n            translation\n        };\n\n        const firstAndLastGlyph = placeFirstAndLastGlyph(\n            labelPlaneFontScale,\n            glyphOffsetArray,\n            lineOffsetX,\n            lineOffsetY,\n            /*flip*/ false,\n            symbol,\n            false,\n            projectionContext);\n\n        let collisionDetected = false;\n        let inGrid = false;\n        let entirelyOffscreen = true;\n\n        if (firstAndLastGlyph) {\n            const radius = circlePixelDiameter * 0.5 * perspectiveRatio + textPixelPadding;\n            const screenPlaneMin = new Point(-viewportPadding, -viewportPadding);\n            const screenPlaneMax = new Point(this.screenRightBoundary, this.screenBottomBoundary);\n            const interpolator = new PathInterpolator();\n\n            // Construct a projected path from projected line vertices. Anchor points are ignored and removed\n            const first = firstAndLastGlyph.first;\n            const last = firstAndLastGlyph.last;\n\n            let projectedPath: Point[] = [];\n            for (let i = first.path.length - 1; i >= 1; i--) {\n                projectedPath.push(first.path[i]);\n            }\n            for (let i = 1; i < last.path.length; i++) {\n                projectedPath.push(last.path[i]);\n            }\n\n            // Tolerate a slightly longer distance than one diameter between two adjacent circles\n            const circleDist = radius * 2.5;\n\n            // The path might need to be converted into screen space if a pitched map is used as the label space\n            if (pitchWithMap) {\n                const screenSpacePath = this.projectPathToScreenSpace(projectedPath, projectionContext);\n                // Do not try to place collision circles if even one of the points is behind the camera.\n                // This is a plausible scenario with big camera pitch angles\n                if (screenSpacePath.some(point => point.signedDistanceFromCamera <= 0)) {\n                    projectedPath = [];\n                } else {\n                    projectedPath = screenSpacePath.map(p => p.point);\n                }\n            }\n\n            let segments = [];\n\n            if (projectedPath.length > 0) {\n                // Quickly check if the path is fully inside or outside of the padded collision region.\n                // For overlapping paths we'll only create collision circles for the visible segments\n                const minPoint = projectedPath[0].clone();\n                const maxPoint = projectedPath[0].clone();\n\n                for (let i = 1; i < projectedPath.length; i++) {\n                    minPoint.x = Math.min(minPoint.x, projectedPath[i].x);\n                    minPoint.y = Math.min(minPoint.y, projectedPath[i].y);\n                    maxPoint.x = Math.max(maxPoint.x, projectedPath[i].x);\n                    maxPoint.y = Math.max(maxPoint.y, projectedPath[i].y);\n                }\n\n                if (minPoint.x >= screenPlaneMin.x && maxPoint.x <= screenPlaneMax.x &&\n                    minPoint.y >= screenPlaneMin.y && maxPoint.y <= screenPlaneMax.y) {\n                    // Quad fully visible\n                    segments = [projectedPath];\n                } else if (maxPoint.x < screenPlaneMin.x || minPoint.x > screenPlaneMax.x ||\n                    maxPoint.y < screenPlaneMin.y || minPoint.y > screenPlaneMax.y) {\n                    // Not visible\n                    segments = [];\n                } else {\n                    segments = clipLine([projectedPath], screenPlaneMin.x, screenPlaneMin.y, screenPlaneMax.x, screenPlaneMax.y);\n                }\n            }\n\n            for (const seg of segments) {\n                // interpolate positions for collision circles. Add a small padding to both ends of the segment\n                interpolator.reset(seg, radius * 0.25);\n\n                let numCircles = 0;\n\n                if (interpolator.length <= 0.5 * radius) {\n                    numCircles = 1;\n                } else {\n                    numCircles = Math.ceil(interpolator.paddedLength / circleDist) + 1;\n                }\n\n                for (let i = 0; i < numCircles; i++) {\n                    const t = i / Math.max(numCircles - 1, 1);\n                    const circlePosition = interpolator.lerp(t);\n\n                    // add viewport padding to the position and perform initial collision check\n                    const centerX = circlePosition.x + viewportPadding;\n                    const centerY = circlePosition.y + viewportPadding;\n\n                    placedCollisionCircles.push(centerX, centerY, radius, 0);\n\n                    const x1 = centerX - radius;\n                    const y1 = centerY - radius;\n                    const x2 = centerX + radius;\n                    const y2 = centerY + radius;\n\n                    entirelyOffscreen &&= this.isOffscreen(x1, y1, x2, y2);\n                    inGrid ||= this.isInsideGrid(x1, y1, x2, y2);\n\n                    if (overlapMode !== 'always' && this.grid.hitTestCircle(centerX, centerY, radius, overlapMode, collisionGroupPredicate)) {\n                        // Don't early exit if we're showing the debug circles because we still want to calculate\n                        // which circles are in use\n                        collisionDetected = true;\n                        if (!showCollisionCircles) {\n                            return {\n                                circles: [],\n                                offscreen: false,\n                                collisionDetected\n                            };\n                        }\n                    }\n                }\n            }\n        }\n\n        return {\n            circles: ((!showCollisionCircles && collisionDetected) || !inGrid || perspectiveRatio < this.perspectiveRatioCutoff) ? [] : placedCollisionCircles,\n            offscreen: entirelyOffscreen,\n            collisionDetected\n        };\n    }\n\n    projectPathToScreenSpace(projectedPath: Point[], projectionContext: SymbolProjectionContext): PointProjection[] {\n        const screenSpacePath = projectPathSpecialProjection(projectedPath, projectionContext);\n        // We don't want to generate screenspace collision circles for parts of the line that\n        // are occluded by the planet itself. Find the longest segment of the path that is\n        // not occluded, and remove everything else.\n        return pathSlicedToLongestUnoccluded(screenSpacePath);\n    }\n\n    /**\n     * Because the geometries in the CollisionIndex are an approximation of the shape of\n     * symbols on the map, we use the CollisionIndex to look up the symbol part of\n     * `queryRenderedFeatures`.\n     */\n    queryRenderedSymbols(viewportQueryGeometry: Point[]): Record<number, number[]> {\n        if (viewportQueryGeometry.length === 0 || (this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0)) {\n            return {};\n        }\n\n        const query = [];\n        const bounds = new Bounds();\n        for (const point of viewportQueryGeometry) {\n            const gridPoint = new Point(point.x + viewportPadding, point.y + viewportPadding);\n            bounds.extend(gridPoint);\n            query.push(gridPoint);\n        }\n\n        const {minX, minY, maxX, maxY} = bounds;\n        const features = this.grid.query(minX, minY, maxX, maxY)\n            .concat(this.ignoredGrid.query(minX, minY, maxX, maxY));\n\n        const seenFeatures = {};\n        const result = {};\n\n        for (const feature of features) {\n            const featureKey = feature.key;\n            // Skip already seen features.\n            if (seenFeatures[featureKey.bucketInstanceId] === undefined) {\n                seenFeatures[featureKey.bucketInstanceId] = {};\n            }\n            if (seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex]) {\n                continue;\n            }\n\n            // Check if query intersects with the feature box\n            // \"Collision Circles\" for line labels are treated as boxes here\n            // Since there's no actual collision taking place, the circle vs. square\n            // distinction doesn't matter as much, and box geometry is easier\n            // to work with.\n            const bbox = [\n                new Point(feature.x1, feature.y1),\n                new Point(feature.x2, feature.y1),\n                new Point(feature.x2, feature.y2),\n                new Point(feature.x1, feature.y2)\n            ];\n            if (!intersectionTests.polygonIntersectsPolygon(query, bbox)) {\n                continue;\n            }\n\n            seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex] = true;\n            if (result[featureKey.bucketInstanceId] === undefined) {\n                result[featureKey.bucketInstanceId] = [];\n            }\n            result[featureKey.bucketInstanceId].push(featureKey.featureIndex);\n        }\n\n        return result;\n    }\n\n    insertCollisionBox(collisionBox: number[], overlapMode: OverlapMode, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number): void {\n        const grid = ignorePlacement ? this.ignoredGrid : this.grid;\n\n        const key = {bucketInstanceId, featureIndex, collisionGroupID, overlapMode};\n        grid.insert(key, collisionBox[0], collisionBox[1], collisionBox[2], collisionBox[3]);\n    }\n\n    insertCollisionCircles(collisionCircles: number[], overlapMode: OverlapMode, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number): void {\n        const grid = ignorePlacement ? this.ignoredGrid : this.grid;\n\n        const key = {bucketInstanceId, featureIndex, collisionGroupID, overlapMode};\n        for (let k = 0; k < collisionCircles.length; k += 4) {\n            grid.insertCircle(key, collisionCircles[k], collisionCircles[k + 1], collisionCircles[k + 2]);\n        }\n    }\n\n    projectAndGetPerspectiveRatio(x: number, y: number, unwrappedTileID: UnwrappedTileID, getElevation?: (x: number, y: number) => number, simpleProjectionMatrix?: mat4): {\n        x: number;\n        y: number;\n        perspectiveRatio: number;\n        isOccluded: boolean;\n        signedDistanceFromCamera: number;\n    } {\n        if (simpleProjectionMatrix) {\n            // This branch is a fast-path for mercator transform.\n            // The code here is a copy of MercatorTransform.projectTileCoordinates, slightly modified for extra performance.\n            // This has a huge impact for some reason.\n            let pos;\n            if (getElevation) { // slow because of handle z-index\n                pos = [x, y, getElevation(x, y), 1] as vec4;\n                vec4.transformMat4(pos, pos, simpleProjectionMatrix);\n            } else { // fast because of ignore z-index\n                pos = [x, y, 0, 1] as vec4;\n                xyTransformMat4(pos, pos, simpleProjectionMatrix);\n            }\n            const w = pos[3];\n            return {\n                x: (((pos[0] / w + 1) / 2) * this.transform.width) + viewportPadding,\n                y: (((-pos[1] / w + 1) / 2) * this.transform.height) + viewportPadding,\n                perspectiveRatio: 0.5 + 0.5 * (this.transform.cameraToCenterDistance / w),\n                isOccluded: false,\n                signedDistanceFromCamera: w\n            };\n        } else {\n            const projected = this.transform.projectTileCoordinates(x, y, unwrappedTileID, getElevation);\n            return {\n                x: (((projected.point.x + 1) / 2) * this.transform.width) + viewportPadding,\n                y: (((-projected.point.y + 1) / 2) * this.transform.height) + viewportPadding,\n                // See perspective ratio comment in symbol_sdf.vertex\n                // We're doing collision detection in viewport space so we need\n                // to scale down boxes in the distance\n                perspectiveRatio: 0.5 + 0.5 * (this.transform.cameraToCenterDistance / projected.signedDistanceFromCamera),\n                isOccluded: projected.isOccluded,\n                signedDistanceFromCamera: projected.signedDistanceFromCamera\n            };\n        }\n    }\n\n    getPerspectiveRatio(x: number, y: number, unwrappedTileID: UnwrappedTileID, getElevation?: (x: number, y: number) => number): number {\n        // We don't care about the actual projected point, just its W component.\n        const projected = this.transform.projectTileCoordinates(x, y, unwrappedTileID, getElevation);\n        return 0.5 + 0.5 * (this.transform.cameraToCenterDistance / projected.signedDistanceFromCamera);\n    }\n\n    isOffscreen(x1: number, y1: number, x2: number, y2: number): boolean {\n        return x2 < viewportPadding || x1 >= this.screenRightBoundary || y2 < viewportPadding || y1 > this.screenBottomBoundary;\n    }\n\n    isInsideGrid(x1: number, y1: number, x2: number, y2: number): boolean {\n        return x2 >= 0 && x1 < this.gridRightBoundary && y2 >= 0 && y1 < this.gridBottomBoundary;\n    }\n\n    /*\n    * Returns a matrix for transforming collision shapes to viewport coordinate space.\n    * Use this function to render e.g. collision circles on the screen.\n    *   example transformation: clipPos = glCoordMatrix * viewportMatrix * circle_pos\n    */\n    getViewportMatrix(): mat4 {\n        const m = mat4.identity([]);\n        mat4.translate(m, m, [-viewportPadding, -viewportPadding, 0.0]);\n        return m;\n    }\n\n    /**\n     * Applies all layout+paint properties of the given box in order to find as good approximation of its screen-space bounding box as possible.\n     */\n    private _projectCollisionBox(\n        collisionBox: SingleCollisionBox,\n        tileToViewport: number,\n        tileID: OverscaledTileID,\n        unwrappedTileID: UnwrappedTileID,\n        pitchWithMap: boolean,\n        rotateWithMap: boolean,\n        translation: [number, number],\n        projectedPoint: {x: number; y: number; perspectiveRatio: number; signedDistanceFromCamera: number},\n        getElevation?: (x: number, y: number) => number,\n        shift?: Point,\n        simpleProjectionMatrix?: mat4,\n    ): ProjectedBox {\n        // These vectors are valid both for screen space viewport-rotation-aligned texts and for pitch-align: map texts that are map-rotation-aligned.\n        let vecEastX = 1;\n        let vecEastY = 0;\n        let vecSouthX = 0;\n        let vecSouthY = 1;\n\n        const translatedAnchorX = collisionBox.anchorPointX + translation[0];\n        const translatedAnchorY = collisionBox.anchorPointY + translation[1];\n\n        if (rotateWithMap && !pitchWithMap) {\n            // Handles screen space texts that are always aligned east-west.\n            const projectedEast = this.projectAndGetPerspectiveRatio(\n                translatedAnchorX + 1,\n                translatedAnchorY,\n                unwrappedTileID,\n                getElevation,\n                simpleProjectionMatrix,\n            );\n            const toEastX = projectedEast.x - projectedPoint.x;\n            const toEastY = projectedEast.y - projectedPoint.y;\n            const angle = Math.atan(toEastY / toEastX) + (toEastX < 0 ? Math.PI : 0);\n            const sin = Math.sin(angle);\n            const cos = Math.cos(angle);\n            vecEastX = cos;\n            vecEastY = sin;\n            vecSouthX = -sin;\n            vecSouthY = cos;\n        } else if (!rotateWithMap && pitchWithMap) {\n            // Handles pitch-align: map texts that are always aligned with the viewport's X axis.\n            const skew = getTileSkewVectors(this.transform);\n            vecEastX = skew.vecEast[0];\n            vecEastY = skew.vecEast[1];\n            vecSouthX = skew.vecSouth[0];\n            vecSouthY = skew.vecSouth[1];\n        }\n\n        // Configuration for screen space offsets\n        let basePointX = projectedPoint.x;\n        let basePointY = projectedPoint.y;\n        let distanceMultiplier = tileToViewport;\n\n        if (pitchWithMap) {\n            // Configuration for tile space (map-pitch-aligned) offsets\n            basePointX = translatedAnchorX;\n            basePointY = translatedAnchorY;\n\n            const zoomFraction = this.transform.zoom - tileID.overscaledZ;\n            distanceMultiplier = Math.pow(2, -zoomFraction);\n            distanceMultiplier *= this.transform.getPitchedTextCorrection(translatedAnchorX, translatedAnchorY, unwrappedTileID);\n\n            // This next correction can't be applied when variable anchors are in use.\n            if (!shift) {\n                // Shader applies a perspective size correction, we need to apply the same correction.\n                // For non-pitchWithMap texts, this is handled above by multiplying `textPixelRatio` with `projectedPoint.perspectiveRatio`,\n                // which is equivalent to the non-pitchWithMap branch of the GLSL code.\n                // Here, we compute and apply the pitchWithMap branch.\n                // See the computation of `perspective_ratio` in the symbol vertex shaders for the GLSL code.\n                const distanceRatio = projectedPoint.signedDistanceFromCamera / this.transform.cameraToCenterDistance;\n                const perspectiveRatio = clamp(0.5 + 0.5 * distanceRatio, 0.0, 4.0); // Same clamp as what is used in the shader.\n                distanceMultiplier *= perspectiveRatio;\n            }\n        }\n\n        if (shift) {\n            // Variable anchors are in use\n            basePointX += vecEastX * shift.x * distanceMultiplier + vecSouthX * shift.y * distanceMultiplier;\n            basePointY += vecEastY * shift.x * distanceMultiplier + vecSouthY * shift.y * distanceMultiplier;\n        }\n\n        const offsetXmin = collisionBox.x1 * distanceMultiplier;\n        const offsetXmax = collisionBox.x2 * distanceMultiplier;\n        const offsetXhalf = (offsetXmin + offsetXmax) / 2;\n        const offsetYmin = collisionBox.y1 * distanceMultiplier;\n        const offsetYmax = collisionBox.y2 * distanceMultiplier;\n        const offsetYhalf = (offsetYmin + offsetYmax) / 2;\n\n        // 0--1--2\n        // |     |\n        // 7     3\n        // |     |\n        // 6--5--4\n        const offsetsArray: Array<{offsetX: number; offsetY: number}> = [\n            {offsetX: offsetXmin,  offsetY: offsetYmin},\n            {offsetX: offsetXhalf, offsetY: offsetYmin},\n            {offsetX: offsetXmax,  offsetY: offsetYmin},\n            {offsetX: offsetXmax,  offsetY: offsetYhalf},\n            {offsetX: offsetXmax,  offsetY: offsetYmax},\n            {offsetX: offsetXhalf, offsetY: offsetYmax},\n            {offsetX: offsetXmin,  offsetY: offsetYmax},\n            {offsetX: offsetXmin,  offsetY: offsetYhalf}\n        ];\n\n        let points: Point[] = [];\n\n        for (const {offsetX, offsetY} of offsetsArray) {\n            points.push(new Point(\n                basePointX + vecEastX * offsetX + vecSouthX * offsetY,\n                basePointY + vecEastY * offsetX + vecSouthY * offsetY\n            ));\n        }\n\n        // Is any point of the collision shape visible on the globe (on beyond horizon)?\n        let anyPointVisible = false;\n\n        if (pitchWithMap) {\n            const projected = points.map(p => this.projectAndGetPerspectiveRatio(p.x, p.y, unwrappedTileID, getElevation, simpleProjectionMatrix));\n\n            // Is at least one of the projected points NOT behind the horizon?\n            anyPointVisible = projected.some(p => !p.isOccluded);\n\n            points = projected.map(p => new Point(p.x, p.y));\n        } else {\n            // Labels that are not pitchWithMap cannot ever hide behind the horizon.\n            anyPointVisible = true;\n        }\n\n        return {\n            box: getAABB(points),\n            allPointsOccluded: !anyPointVisible\n        };\n    }\n}\n","import {CollisionIndex, viewportPadding} from './collision_index.ts';\nimport type {FeatureKey, PlacedBox, PlacedCircles} from './collision_index.ts';\nimport {EXTENT} from '../data/extent.ts';\nimport * as symbolSize from './symbol_size.ts';\nimport * as projection from './projection.ts';\nimport {getAnchorJustification} from './symbol_layout.ts';\nimport {getAnchorAlignment, WritingMode} from './shaping.ts';\nimport {type mat4} from 'gl-matrix';\nimport {pixelsToTileUnits} from '../source/pixels_to_tile_units.ts';\nimport Point from '@mapbox/point-geometry';\nimport type {IReadonlyTransform, ITransform} from '../geo/transform_interface.ts';\nimport type {StyleLayer} from '../style/style_layer.ts';\nimport {type PossiblyEvaluated} from '../style/properties.ts';\nimport type {SymbolLayoutProps, SymbolLayoutPropsPossiblyEvaluated} from '../style/style_layer/symbol_style_layer_properties.g.ts';\nimport {getOverlapMode, type OverlapMode} from '../style/style_layer/overlap_mode.ts';\n\nimport type {Tile} from '../tile/tile.ts';\nimport type {SymbolBucket, CollisionArrays, SingleCollisionBox, SymbolBuffers} from '../data/bucket/symbol_bucket.ts';\nimport type {CollisionBoxArray, CollisionVertexArray, SymbolInstance, TextAnchorOffset} from '../data/array_types.g.ts';\nimport type {FeatureIndex} from '../data/feature_index.ts';\nimport type {OverscaledTileID, UnwrappedTileID} from '../tile/tile_id.ts';\nimport {type Terrain} from '../render/terrain.ts';\nimport {translatePosition, warnOnce} from '../util/util.ts';\nimport {type TextAnchor, TextAnchorEnum} from '../style/style_layer/variable_text_anchor.ts';\n\nclass OpacityState {\n    opacity: number;\n    placed: boolean;\n    constructor(prevState: OpacityState, increment: number, placed: boolean, skipFade?: boolean | null) {\n        if (prevState) {\n            this.opacity = Math.max(0, Math.min(1, prevState.opacity + (prevState.placed ? increment : -increment)));\n        } else {\n            this.opacity = (skipFade && placed) ? 1 : 0;\n        }\n        this.placed = placed;\n    }\n    isHidden(): boolean {\n        return this.opacity === 0 && !this.placed;\n    }\n}\n\nclass JointOpacityState {\n    text: OpacityState;\n    icon: OpacityState;\n    constructor(prevState: JointOpacityState, increment: number, placedText: boolean, placedIcon: boolean, skipFade?: boolean | null) {\n        this.text = new OpacityState(prevState ? prevState.text : null, increment, placedText, skipFade);\n        this.icon = new OpacityState(prevState ? prevState.icon : null, increment, placedIcon, skipFade);\n    }\n    isHidden(): boolean {\n        return this.text.isHidden() && this.icon.isHidden();\n    }\n}\n\nclass JointPlacement {\n    text: boolean;\n    icon: boolean;\n    // skipFade = outside viewport, but within CollisionIndex::viewportPadding px of the edge\n    // Because these symbols aren't onscreen yet, we can skip the \"fade in\" animation,\n    // and if a subsequent viewport change brings them into view, they'll be fully\n    // visible right away.\n    skipFade: boolean;\n    constructor(text: boolean, icon: boolean, skipFade: boolean) {\n        this.text = text;\n        this.icon = icon;\n        this.skipFade = skipFade;\n    }\n}\n\nexport class RetainedQueryData {\n    bucketInstanceId: number;\n    featureIndex: FeatureIndex;\n    sourceLayerIndex: number;\n    bucketIndex: number;\n    tileID: OverscaledTileID;\n    featureSortOrder: number[];\n    constructor(bucketInstanceId: number,\n        featureIndex: FeatureIndex,\n        sourceLayerIndex: number,\n        bucketIndex: number,\n        tileID: OverscaledTileID) {\n        this.bucketInstanceId = bucketInstanceId;\n        this.featureIndex = featureIndex;\n        this.sourceLayerIndex = sourceLayerIndex;\n        this.bucketIndex = bucketIndex;\n        this.tileID = tileID;\n    }\n}\n\ntype CollisionGroup = {\n    ID: number;\n    predicate?: (key: FeatureKey) => boolean;\n};\n\nclass CollisionGroups {\n    collisionGroups: {[groupName: string]: CollisionGroup};\n    maxGroupID: number;\n    crossSourceCollisions: boolean;\n\n    constructor(crossSourceCollisions: boolean) {\n        this.crossSourceCollisions = crossSourceCollisions;\n        this.maxGroupID = 0;\n        this.collisionGroups = {};\n    }\n\n    get(sourceID: string): CollisionGroup {\n        // The predicate/groupID mechanism allows for arbitrary grouping,\n        // but the current interface defines one source == one group when\n        // crossSourceCollisions == true.\n        if (!this.crossSourceCollisions) {\n            if (!this.collisionGroups[sourceID]) {\n                const nextGroupID = ++this.maxGroupID;\n                this.collisionGroups[sourceID] = {\n                    ID: nextGroupID,\n                    predicate: (key) => {\n                        return key.collisionGroupID === nextGroupID;\n                    }\n                };\n            }\n            return this.collisionGroups[sourceID];\n        } else {\n            return {ID: 0, predicate: null};\n        }\n    }\n}\n\nfunction calculateVariableLayoutShift(\n    anchor: TextAnchor,\n    width: number,\n    height: number,\n    textOffset: [number, number],\n    textBoxScale: number\n): Point {\n    const {horizontalAlign, verticalAlign} = getAnchorAlignment(anchor);\n    const shiftX = -(horizontalAlign - 0.5) * width;\n    const shiftY = -(verticalAlign - 0.5) * height;\n    return new Point(\n        shiftX + textOffset[0] * textBoxScale,\n        shiftY + textOffset[1] * textBoxScale\n    );\n}\n\nexport type VariableOffset = {\n    textOffset: [number, number];\n    width: number;\n    height: number;\n    anchor: TextAnchor;\n    textBoxScale: number;\n    prevAnchor?: TextAnchor;\n};\n\ntype TileLayerParameters = {\n    bucket: SymbolBucket;\n    layout: PossiblyEvaluated<SymbolLayoutProps, SymbolLayoutPropsPossiblyEvaluated>;\n    translationText: [number, number];\n    translationIcon: [number, number];\n    unwrappedTileID: UnwrappedTileID;\n    pitchedLabelPlaneMatrix: mat4;\n    scale: number;\n    textPixelRatio: number;\n    holdingForFade: boolean;\n    collisionBoxArray: CollisionBoxArray;\n    partiallyEvaluatedTextSize: {\n        uSize: number;\n        uSizeT: number;\n    };\n    collisionGroup: CollisionGroup;\n};\n\nexport type BucketPart = {\n    sortKey?: number | void;\n    symbolInstanceStart: number;\n    symbolInstanceEnd: number;\n    parameters: TileLayerParameters;\n};\n\nexport type CrossTileID = string | number;\n\nexport class Placement {\n    transform: IReadonlyTransform;\n    terrain: Terrain;\n    collisionIndex: CollisionIndex;\n    placements: {\n        [_ in CrossTileID]: JointPlacement;\n    };\n    opacities: {\n        [_ in CrossTileID]: JointOpacityState;\n    };\n    variableOffsets: {\n        [_ in CrossTileID]: VariableOffset;\n    };\n    placedOrientations: {\n        [_ in CrossTileID]: number;\n    };\n    commitTime: number;\n    prevZoomAdjustment: number;\n    lastPlacementChangeTime: number;\n    stale: boolean;\n    fadeDuration: number;\n    retainedQueryData: {\n        [_: number]: RetainedQueryData;\n    };\n    collisionGroups: CollisionGroups;\n    prevPlacement: Placement;\n    zoomAtLastRecencyCheck: number;\n    collisionCircleArrays: {\n        [k in any]: number[];\n    };\n    collisionBoxArrays: Map<number, Map<number, {\n        text: number[];\n        icon: number[];\n    }>>;\n\n    constructor(transform: ITransform, terrain: Terrain, fadeDuration: number, crossSourceCollisions: boolean, prevPlacement?: Placement) {\n        this.transform = transform.clone();\n        this.terrain = terrain;\n        this.collisionIndex = new CollisionIndex(this.transform);\n        this.placements = {};\n        this.opacities = {};\n        this.variableOffsets = {};\n        this.stale = false;\n        this.commitTime = 0;\n        this.fadeDuration = fadeDuration;\n        this.retainedQueryData = {};\n        this.collisionGroups = new CollisionGroups(crossSourceCollisions);\n        this.collisionCircleArrays = {};\n        this.collisionBoxArrays = new Map<number, Map<number, {\n            text: number[];\n            icon: number[];\n        }>>();\n\n        this.prevPlacement = prevPlacement;\n        if (prevPlacement) {\n            prevPlacement.prevPlacement = undefined; // Only hold on to one placement back\n        }\n\n        this.placedOrientations = {};\n    }\n\n    private _getTerrainElevationFunc(tileID: OverscaledTileID) {\n        const terrain = this.terrain;\n        if (!terrain) return null;\n        return (x: number, y: number) => terrain.getElevation(tileID, x, y);\n    }\n\n    getBucketParts(results: BucketPart[], styleLayer: StyleLayer, tile: Tile, sortAcrossTiles: boolean): void {\n        const symbolBucket = (tile.getBucket(styleLayer) as SymbolBucket);\n        const bucketFeatureIndex = tile.latestFeatureIndex;\n        if (!symbolBucket || !bucketFeatureIndex || styleLayer.id !== symbolBucket.layerIds[0])\n            return;\n\n        const collisionBoxArray = tile.collisionBoxArray;\n\n        const layout = symbolBucket.layers[0].layout;\n        const paint = symbolBucket.layers[0].paint;\n\n        const scale = Math.pow(2, this.transform.zoom - tile.tileID.overscaledZ);\n        const textPixelRatio = tile.tileSize / EXTENT;\n\n        const unwrappedTileID = tile.tileID.toUnwrapped();\n\n        const rotateWithMap = layout.get('text-rotation-alignment') === 'map';\n        const pixelsToTiles = pixelsToTileUnits(tile, 1, this.transform.zoom);\n\n        const translationText = translatePosition(\n            this.collisionIndex.transform,\n            tile,\n            paint.get('text-translate'),\n            paint.get('text-translate-anchor'),);\n\n        const translationIcon = translatePosition(\n            this.collisionIndex.transform,\n            tile,\n            paint.get('icon-translate'),\n            paint.get('icon-translate-anchor'),);\n\n        const pitchedLabelPlaneMatrix = projection.getPitchedLabelPlaneMatrix(rotateWithMap, this.transform, pixelsToTiles);\n\n        // As long as this placement lives, we have to hold onto this bucket's\n        // matching FeatureIndex/data for querying purposes\n        this.retainedQueryData[symbolBucket.bucketInstanceId] = new RetainedQueryData(\n            symbolBucket.bucketInstanceId,\n            bucketFeatureIndex,\n            symbolBucket.sourceLayerIndex,\n            symbolBucket.index,\n            tile.tileID\n        );\n\n        const parameters: TileLayerParameters = {\n            bucket: symbolBucket,\n            layout,\n            translationText,\n            translationIcon,\n            unwrappedTileID,\n            pitchedLabelPlaneMatrix,\n            scale,\n            textPixelRatio,\n            holdingForFade: tile.holdingForSymbolFade(),\n            collisionBoxArray,\n            partiallyEvaluatedTextSize: symbolSize.evaluateSizeForZoom(symbolBucket.textSizeData, this.transform.zoom),\n            collisionGroup: this.collisionGroups.get(symbolBucket.sourceID)\n        };\n\n        if (sortAcrossTiles) {\n            for (const range of symbolBucket.sortKeyRanges) {\n                const {sortKey, symbolInstanceStart, symbolInstanceEnd} = range;\n                results.push({sortKey, symbolInstanceStart, symbolInstanceEnd, parameters});\n            }\n        } else {\n            results.push({\n                symbolInstanceStart: 0,\n                symbolInstanceEnd: symbolBucket.symbolInstances.length,\n                parameters\n            });\n        }\n    }\n\n    attemptAnchorPlacement(\n        textAnchorOffset: TextAnchorOffset,\n        textBox: SingleCollisionBox,\n        width: number,\n        height: number,\n        textBoxScale: number,\n        rotateWithMap: boolean,\n        pitchWithMap: boolean,\n        textPixelRatio: number,\n        tileID: OverscaledTileID,\n        unwrappedTileID: UnwrappedTileID,\n        collisionGroup: CollisionGroup,\n        textOverlapMode: OverlapMode,\n        symbolInstance: SymbolInstance,\n        bucket: SymbolBucket,\n        orientation: number,\n        translationText: [number, number],\n        translationIcon: [number, number],\n        iconBox?: SingleCollisionBox | null,\n        getElevation?: (x: number, y: number) => number,\n        simpleProjectionMatrix?: mat4,\n    ): {\n        shift: Point;\n        placedGlyphBoxes: PlacedBox;\n    } {\n\n        const anchor = TextAnchorEnum[textAnchorOffset.textAnchor] as TextAnchor;\n        const textOffset = [textAnchorOffset.textOffset0, textAnchorOffset.textOffset1] as [number, number];\n        const shift = calculateVariableLayoutShift(anchor, width, height, textOffset, textBoxScale);\n\n        const placedGlyphBoxes = this.collisionIndex.placeCollisionBox(\n            textBox,\n            textOverlapMode,\n            textPixelRatio,\n            tileID,\n            unwrappedTileID,\n            pitchWithMap,\n            rotateWithMap,\n            translationText,\n            collisionGroup.predicate,\n            getElevation,\n            shift,\n            simpleProjectionMatrix,\n        );\n\n        if (iconBox) {\n            const placedIconBoxes = this.collisionIndex.placeCollisionBox(\n                iconBox,\n                textOverlapMode,\n                textPixelRatio,\n                tileID,\n                unwrappedTileID,\n                pitchWithMap,\n                rotateWithMap,\n                translationIcon,\n                collisionGroup.predicate,\n                getElevation,\n                shift,\n                simpleProjectionMatrix,\n            );\n            if (!placedIconBoxes.placeable) return;\n        }\n\n        if (placedGlyphBoxes.placeable) {\n            let prevAnchor;\n            // If this label was placed in the previous placement, record the anchor position\n            // to allow us to animate the transition\n            if (this.prevPlacement?.variableOffsets[symbolInstance.crossTileID] &&\n                this.prevPlacement?.placements[symbolInstance.crossTileID]?.text) {\n                prevAnchor = this.prevPlacement.variableOffsets[symbolInstance.crossTileID].anchor;\n            }\n            if (symbolInstance.crossTileID === 0) throw new Error('symbolInstance.crossTileID can\\'t be 0');\n            this.variableOffsets[symbolInstance.crossTileID] = {\n                textOffset,\n                width,\n                height,\n                anchor,\n                textBoxScale,\n                prevAnchor\n            };\n            this.markUsedJustification(bucket, anchor, symbolInstance, orientation);\n\n            if (bucket.allowVerticalPlacement) {\n                this.markUsedOrientation(bucket, orientation, symbolInstance);\n                this.placedOrientations[symbolInstance.crossTileID] = orientation;\n            }\n\n            return {shift, placedGlyphBoxes};\n        }\n    }\n\n    placeLayerBucketPart(bucketPart: BucketPart, seenCrossTileIDs: {\n        [k in string | number]: boolean;\n    }, showCollisionBoxes: boolean): void {\n\n        const {\n            bucket,\n            layout,\n            translationText,\n            translationIcon,\n            unwrappedTileID,\n            pitchedLabelPlaneMatrix,\n            textPixelRatio,\n            holdingForFade,\n            collisionBoxArray,\n            partiallyEvaluatedTextSize,\n            collisionGroup\n        } = bucketPart.parameters;\n\n        const textOptional = layout.get('text-optional');\n        const iconOptional = layout.get('icon-optional');\n        const textOverlapMode = getOverlapMode(layout, 'text-overlap', 'text-allow-overlap');\n        const textAlwaysOverlap = textOverlapMode === 'always';\n        const iconOverlapMode = getOverlapMode(layout, 'icon-overlap', 'icon-allow-overlap');\n        const iconAlwaysOverlap = iconOverlapMode === 'always';\n        const rotateWithMap = layout.get('text-rotation-alignment') === 'map';\n        const pitchWithMap = layout.get('text-pitch-alignment') === 'map';\n        const hasIconTextFit = layout.get('icon-text-fit') !== 'none';\n        const zOrderByViewportY = layout.get('symbol-z-order') === 'viewport-y';\n\n        // This logic is similar to the \"defaultOpacityState\" logic below in updateBucketOpacities\n        // If we know a symbol is always supposed to show, force it to be marked visible even if\n        // it wasn't placed into the collision index (because some or all of it was outside the range\n        // of the collision grid).\n        // There is a subtle edge case here we're accepting:\n        //  Symbol A has text-allow-overlap: true, icon-allow-overlap: true, icon-optional: false\n        //  A's icon is outside the grid, so doesn't get placed\n        //  A's text would be inside grid, but doesn't get placed because of icon-optional: false\n        //  We still show A because of the allow-overlap settings.\n        //  Symbol B has allow-overlap: false, and gets placed where A's text would be\n        //  On panning in, there is a short period when Symbol B and Symbol A will overlap\n        //  This is the reverse of our normal policy of \"fade in on pan\", but should look like any other\n        //  collision and hopefully not be too noticeable.\n        // See https://github.com/mapbox/mapbox-gl-js/issues/7172\n        const alwaysShowText = textAlwaysOverlap && (iconAlwaysOverlap || !bucket.hasIconData() || iconOptional);\n        const alwaysShowIcon = iconAlwaysOverlap && (textAlwaysOverlap || !bucket.hasTextData() || textOptional);\n\n        if (!bucket.collisionArrays && collisionBoxArray) {\n            bucket.deserializeCollisionBoxes(collisionBoxArray);\n        }\n\n        const tileID = this.retainedQueryData[bucket.bucketInstanceId].tileID;\n        const getElevation = this._getTerrainElevationFunc(tileID);\n        const simpleProjectionMatrix = this.transform.getFastPathSimpleProjectionMatrix(tileID);\n\n        const placeSymbol = (symbolInstance: SymbolInstance, collisionArrays: CollisionArrays, symbolIndex: number) => {\n            if (seenCrossTileIDs[symbolInstance.crossTileID]) return;\n            if (holdingForFade) {\n                // Mark all symbols from this tile as \"not placed\", but don't add to seenCrossTileIDs, because we don't\n                // know yet if we have a duplicate in a parent tile that _should_ be placed.\n                this.placements[symbolInstance.crossTileID] = new JointPlacement(false, false, false);\n                return;\n            }\n\n            let placeText = false;\n            let placeIcon = false;\n            let offscreen = true;\n            let shift = null;\n\n            let placed: PlacedBox = {box: null, placeable: false, offscreen: null, occluded: false};\n            let placedVerticalText = {box: null, placeable: false, offscreen: null};\n\n            let placedGlyphBoxes: PlacedBox = null;\n            let placedGlyphCircles: PlacedCircles = null;\n            let placedIconBoxes: PlacedBox = null;\n            let textFeatureIndex = 0;\n            let verticalTextFeatureIndex = 0;\n            let iconFeatureIndex = 0;\n\n            if (collisionArrays.textFeatureIndex) {\n                textFeatureIndex = collisionArrays.textFeatureIndex;\n            } else if (symbolInstance.useRuntimeCollisionCircles) {\n                textFeatureIndex = symbolInstance.featureIndex;\n            }\n            if (collisionArrays.verticalTextFeatureIndex) {\n                verticalTextFeatureIndex = collisionArrays.verticalTextFeatureIndex;\n            }\n\n            const textBox = collisionArrays.textBox;\n            if (textBox) {\n\n                const updatePreviousOrientationIfNotPlaced = (isPlaced) => {\n                    let previousOrientation = WritingMode.horizontal;\n                    if (bucket.allowVerticalPlacement && !isPlaced && this.prevPlacement) {\n                        const prevPlacedOrientation = this.prevPlacement.placedOrientations[symbolInstance.crossTileID];\n                        if (prevPlacedOrientation) {\n                            this.placedOrientations[symbolInstance.crossTileID] = prevPlacedOrientation;\n                            previousOrientation = prevPlacedOrientation;\n                            this.markUsedOrientation(bucket, previousOrientation, symbolInstance);\n                        }\n                    }\n                    return previousOrientation;\n                };\n\n                const placeTextForPlacementModes = (placeHorizontalFn, placeVerticalFn) => {\n                    if (bucket.allowVerticalPlacement && symbolInstance.numVerticalGlyphVertices > 0 && collisionArrays.verticalTextBox) {\n                        for (const placementMode of bucket.writingModes) {\n                            if (placementMode === WritingMode.vertical) {\n                                placed = placeVerticalFn();\n                                placedVerticalText = placed;\n                            } else {\n                                placed = placeHorizontalFn();\n                            }\n                            if (placed?.placeable) break;\n                        }\n                    } else {\n                        placed = placeHorizontalFn();\n                    }\n                };\n\n                const textAnchorOffsetStart = symbolInstance.textAnchorOffsetStartIndex;\n                const textAnchorOffsetEnd = symbolInstance.textAnchorOffsetEndIndex;\n\n                // If start+end indices match, text-variable-anchor is not in play.\n                if (textAnchorOffsetEnd === textAnchorOffsetStart) {\n                    const placeBox = (collisionTextBox, orientation) => {\n                        const placedFeature = this.collisionIndex.placeCollisionBox(\n                            collisionTextBox,\n                            textOverlapMode,\n                            textPixelRatio,\n                            tileID,\n                            unwrappedTileID,\n                            pitchWithMap,\n                            rotateWithMap,\n                            translationText,\n                            collisionGroup.predicate,\n                            getElevation,\n                            undefined,\n                            simpleProjectionMatrix,\n                        );\n                        if (placedFeature?.placeable) {\n                            this.markUsedOrientation(bucket, orientation, symbolInstance);\n                            this.placedOrientations[symbolInstance.crossTileID] = orientation;\n                        }\n                        return placedFeature;\n                    };\n\n                    const placeHorizontal = () => {\n                        return placeBox(textBox, WritingMode.horizontal);\n                    };\n\n                    const placeVertical = () => {\n                        const verticalTextBox = collisionArrays.verticalTextBox;\n                        if (bucket.allowVerticalPlacement && symbolInstance.numVerticalGlyphVertices > 0 && verticalTextBox) {\n                            return placeBox(verticalTextBox, WritingMode.vertical);\n                        }\n                        return {box: null, offscreen: null};\n                    };\n\n                    placeTextForPlacementModes(placeHorizontal, placeVertical);\n                    updatePreviousOrientationIfNotPlaced(placed?.placeable);\n\n                } else {\n                    // If this symbol was in the last placement, prefer placement using same anchor, if it's still available\n                    let prevAnchor = TextAnchorEnum[this.prevPlacement?.variableOffsets[symbolInstance.crossTileID]?.anchor];\n\n                    const placeBoxForVariableAnchors = (collisionTextBox, collisionIconBox, orientation) => {\n                        const width = collisionTextBox.x2 - collisionTextBox.x1;\n                        const height = collisionTextBox.y2 - collisionTextBox.y1;\n                        const textBoxScale = symbolInstance.textBoxScale;\n                        const variableIconBox = hasIconTextFit && (iconOverlapMode === 'never') ? collisionIconBox : null;\n\n                        let placedBox: PlacedBox = null;\n                        let placementPasses = (textOverlapMode === 'never') ? 1 : 2;\n                        let overlapMode: OverlapMode = 'never';\n\n                        if (prevAnchor) {\n                            placementPasses++;\n                        }\n\n                        for (let pass = 0; pass < placementPasses; pass++) {\n                            for (let i = textAnchorOffsetStart; i < textAnchorOffsetEnd; i++) {\n                                const textAnchorOffset = bucket.textAnchorOffsets.get(i);\n\n                                if (prevAnchor && textAnchorOffset.textAnchor !== prevAnchor) {\n                                    continue;\n                                }\n\n                                const result = this.attemptAnchorPlacement(\n                                    textAnchorOffset, collisionTextBox, width, height,\n                                    textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, tileID, unwrappedTileID,\n                                    collisionGroup, overlapMode, symbolInstance, bucket, orientation, translationText, translationIcon, variableIconBox, getElevation);\n\n                                if (result) {\n                                    placedBox = result.placedGlyphBoxes;\n                                    if (placedBox?.placeable) {\n                                        placeText = true;\n                                        shift = result.shift;\n                                        return placedBox;\n                                    }\n                                }\n                            }\n\n                            if (prevAnchor) {\n                                prevAnchor = null;\n                            } else {\n                                overlapMode = textOverlapMode;\n                            }\n                        }\n\n                        if (showCollisionBoxes && !placedBox) {\n                            // No box was successfully placed\n                            // Generate bounds for a fake centered box, so that we can at least display something for collision debug.\n                            const placedFakeGlyphBox = this.collisionIndex.placeCollisionBox(\n                                textBox,\n                                'always', // Skips expensive collision check with already placed boxes\n                                textPixelRatio,\n                                tileID,\n                                unwrappedTileID,\n                                pitchWithMap,\n                                rotateWithMap,\n                                translationText,\n                                collisionGroup.predicate,\n                                getElevation,\n                                undefined,\n                                simpleProjectionMatrix,\n                            );\n                            placedBox = {\n                                box: placedFakeGlyphBox.box,\n                                offscreen: false,\n                                placeable: false,\n                                occluded: false,\n                            };\n                        }\n\n                        return placedBox;\n                    };\n\n                    const placeHorizontal = () => {\n                        return placeBoxForVariableAnchors(textBox, collisionArrays.iconBox, WritingMode.horizontal);\n                    };\n\n                    const placeVertical = () => {\n                        const verticalTextBox = collisionArrays.verticalTextBox;\n                        const wasPlaced = placed?.placeable;\n                        if (bucket.allowVerticalPlacement && !wasPlaced && symbolInstance.numVerticalGlyphVertices > 0 && verticalTextBox) {\n                            return placeBoxForVariableAnchors(verticalTextBox, collisionArrays.verticalIconBox, WritingMode.vertical);\n                        }\n                        return {box: null, occluded: true, offscreen: null};\n                    };\n\n                    placeTextForPlacementModes(placeHorizontal, placeVertical);\n\n                    if (placed) {\n                        placeText = placed.placeable;\n                        offscreen = placed.offscreen;\n                    }\n\n                    const prevOrientation = updatePreviousOrientationIfNotPlaced(placed?.placeable);\n\n                    // If we didn't get placed, we still need to copy our position from the last placement for\n                    // fade animations\n                    if (!placeText && this.prevPlacement) {\n                        const prevOffset = this.prevPlacement.variableOffsets[symbolInstance.crossTileID];\n                        if (prevOffset) {\n                            this.variableOffsets[symbolInstance.crossTileID] = prevOffset;\n                            this.markUsedJustification(bucket, prevOffset.anchor, symbolInstance, prevOrientation);\n                        }\n                    }\n\n                }\n            }\n\n            placedGlyphBoxes = placed;\n            placeText = placedGlyphBoxes?.placeable;\n            offscreen = placedGlyphBoxes?.offscreen;\n\n            if (symbolInstance.useRuntimeCollisionCircles && symbolInstance.centerJustifiedTextSymbolIndex >= 0) {\n                const placedSymbol = bucket.text.placedSymbolArray.get(symbolInstance.centerJustifiedTextSymbolIndex);\n                const fontSize = symbolSize.evaluateSizeForFeature(bucket.textSizeData, partiallyEvaluatedTextSize, placedSymbol);\n\n                const textPixelPadding = layout.get('text-padding');\n                const circlePixelDiameter = symbolInstance.collisionCircleDiameter;\n\n                placedGlyphCircles = this.collisionIndex.placeCollisionCircles(\n                    textOverlapMode,\n                    placedSymbol,\n                    bucket.lineVertexArray,\n                    bucket.glyphOffsetArray,\n                    fontSize,\n                    unwrappedTileID,\n                    pitchedLabelPlaneMatrix,\n                    showCollisionBoxes,\n                    pitchWithMap,\n                    collisionGroup.predicate,\n                    circlePixelDiameter,\n                    textPixelPadding,\n                    translationText,\n                    getElevation\n                );\n\n                if (placedGlyphCircles.circles.length && placedGlyphCircles.collisionDetected && !showCollisionBoxes) {\n                    warnOnce('Collisions detected, but collision boxes are not shown');\n                }\n\n                // If text-overlap is set to 'always', force \"placedCircles\" to true\n                // In theory there should always be at least one circle placed\n                // in this case, but for now quirks in text-anchor\n                // and text-offset may prevent that from being true.\n                placeText = textAlwaysOverlap || (placedGlyphCircles.circles.length > 0 && !placedGlyphCircles.collisionDetected);\n                offscreen &&= placedGlyphCircles.offscreen;\n            }\n\n            if (collisionArrays.iconFeatureIndex) {\n                iconFeatureIndex = collisionArrays.iconFeatureIndex;\n            }\n\n            if (collisionArrays.iconBox) {\n                const placeIconFeature = iconBox => {\n                    return this.collisionIndex.placeCollisionBox(\n                        iconBox,\n                        iconOverlapMode,\n                        textPixelRatio,\n                        tileID,\n                        unwrappedTileID,\n                        pitchWithMap,\n                        rotateWithMap,\n                        translationIcon,\n                        collisionGroup.predicate,\n                        getElevation,\n                        (hasIconTextFit && shift) ? shift : undefined,\n                        simpleProjectionMatrix,\n                    );\n                };\n\n                if (placedVerticalText && placedVerticalText.placeable && collisionArrays.verticalIconBox) {\n                    placedIconBoxes = placeIconFeature(collisionArrays.verticalIconBox);\n                    placeIcon = placedIconBoxes.placeable;\n                } else {\n                    placedIconBoxes = placeIconFeature(collisionArrays.iconBox);\n                    placeIcon = placedIconBoxes.placeable;\n                }\n                offscreen &&= placedIconBoxes.offscreen;\n            }\n\n            const iconWithoutText = textOptional ||\n                (symbolInstance.numHorizontalGlyphVertices === 0 && symbolInstance.numVerticalGlyphVertices === 0);\n            const textWithoutIcon = iconOptional || symbolInstance.numIconVertices === 0;\n\n            // Combine the scales for icons and text.\n            if (!iconWithoutText && !textWithoutIcon) {\n                placeIcon = placeText = placeIcon && placeText;\n            } else if (!textWithoutIcon) {\n                placeText = placeIcon && placeText;\n            } else if (!iconWithoutText) {\n                placeIcon &&= placeText;\n            }\n\n            const hasTextBox = placeText && placedGlyphBoxes.placeable;\n            const hasIconBox = placeIcon && placedIconBoxes.placeable;\n\n            if (hasTextBox) {\n                if (placedVerticalText && placedVerticalText.placeable && verticalTextFeatureIndex) {\n                    this.collisionIndex.insertCollisionBox(\n                        placedGlyphBoxes.box,\n                        textOverlapMode,\n                        layout.get('text-ignore-placement'),\n                        bucket.bucketInstanceId,\n                        verticalTextFeatureIndex,\n                        collisionGroup.ID);\n                } else {\n                    this.collisionIndex.insertCollisionBox(\n                        placedGlyphBoxes.box,\n                        textOverlapMode,\n                        layout.get('text-ignore-placement'),\n                        bucket.bucketInstanceId,\n                        textFeatureIndex,\n                        collisionGroup.ID);\n                }\n\n            }\n            if (hasIconBox) {\n                this.collisionIndex.insertCollisionBox(\n                    placedIconBoxes.box,\n                    iconOverlapMode,\n                    layout.get('icon-ignore-placement'),\n                    bucket.bucketInstanceId,\n                    iconFeatureIndex,\n                    collisionGroup.ID);\n            }\n            if (placedGlyphCircles) {\n                if (placeText) {\n                    this.collisionIndex.insertCollisionCircles(\n                        placedGlyphCircles.circles,\n                        textOverlapMode,\n                        layout.get('text-ignore-placement'),\n                        bucket.bucketInstanceId,\n                        textFeatureIndex,\n                        collisionGroup.ID);\n                }\n            }\n\n            if (showCollisionBoxes) {\n                this.storeCollisionData(bucket.bucketInstanceId, symbolIndex, collisionArrays, placedGlyphBoxes, placedIconBoxes, placedGlyphCircles);\n            }\n\n            if (symbolInstance.crossTileID === 0) throw new Error('symbolInstance.crossTileID can\\'t be 0');\n            if (bucket.bucketInstanceId === 0) throw new Error('bucket.bucketInstanceId can\\'t be 0');\n\n            // Do not show text or icons that are occluded by the globe, even if overlap mode is 'always'!\n            const textVisible: boolean = (placeText || alwaysShowText) && !(placedGlyphBoxes?.occluded);\n            const iconVisible = (placeIcon || alwaysShowIcon) && !(placedIconBoxes?.occluded);\n            this.placements[symbolInstance.crossTileID] = new JointPlacement(textVisible, iconVisible, offscreen || bucket.justReloaded);\n            seenCrossTileIDs[symbolInstance.crossTileID] = true;\n        };\n\n        if (zOrderByViewportY) {\n            if (bucketPart.symbolInstanceStart !== 0) throw new Error('bucket.bucketInstanceId should be 0');\n            const symbolIndexes = bucket.getSortedSymbolIndexes(-this.transform.bearingInRadians);\n            for (let i = symbolIndexes.length - 1; i >= 0; --i) {\n                const symbolIndex = symbolIndexes[i];\n                placeSymbol(bucket.symbolInstances.get(symbolIndex), bucket.collisionArrays[symbolIndex], symbolIndex);\n            }\n        } else {\n            for (let i = bucketPart.symbolInstanceStart; i < bucketPart.symbolInstanceEnd; i++) {\n                placeSymbol(bucket.symbolInstances.get(i), bucket.collisionArrays[i], i);\n            }\n        }\n\n        bucket.justReloaded = false;\n    }\n\n    storeCollisionData(bucketInstanceId: number, symbolIndex: number, collisionArrays: CollisionArrays, placedGlyphBoxes: PlacedBox, placedIconBoxes: PlacedBox, placedGlyphCircles: PlacedCircles): void {\n        if (collisionArrays.textBox || collisionArrays.iconBox) {\n            // Store the actually used collision box for debug draw\n            let boxArray: Map<number, {\n                text: number[];\n                icon: number[];\n            }>;\n\n            if (this.collisionBoxArrays.has(bucketInstanceId)) {\n                boxArray = this.collisionBoxArrays.get(bucketInstanceId);\n            } else {\n                boxArray = new Map<number, {\n                    text: number[];\n                    icon: number[];\n                }>();\n                this.collisionBoxArrays.set(bucketInstanceId, boxArray);\n            }\n            let realCollisionBox: {\n                text: number[];\n                icon: number[];\n            };\n\n            if (boxArray.has(symbolIndex)) {\n                realCollisionBox = boxArray.get(symbolIndex);\n            } else {\n                realCollisionBox = {\n                    text: null,\n                    icon: null\n                };\n                boxArray.set(symbolIndex, realCollisionBox);\n            }\n\n            if (collisionArrays.textBox) {\n                realCollisionBox.text = placedGlyphBoxes.box;\n            }\n            if (collisionArrays.iconBox) {\n                realCollisionBox.icon = placedIconBoxes.box;\n            }\n        }\n\n        if (placedGlyphCircles) {\n            let circleArray = this.collisionCircleArrays[bucketInstanceId];\n\n            // Group collision circles together by bucket. Circles can't be pushed forward for rendering yet as the symbol placement\n            // for a bucket is not guaranteed to be complete before the commit-function has been called\n            if (circleArray === undefined)\n                circleArray = this.collisionCircleArrays[bucketInstanceId] = [];\n\n            for (let i = 0; i < placedGlyphCircles.circles.length; i += 4) {\n                circleArray.push(placedGlyphCircles.circles[i + 0] - viewportPadding); // x\n                circleArray.push(placedGlyphCircles.circles[i + 1] - viewportPadding); // y\n                circleArray.push(placedGlyphCircles.circles[i + 2]);                   // radius\n                circleArray.push(placedGlyphCircles.collisionDetected ? 1 : 0);        // collisionDetected-flag\n            }\n        }\n    }\n\n    markUsedJustification(bucket: SymbolBucket, placedAnchor: TextAnchor, symbolInstance: SymbolInstance, orientation: number): void {\n        const justifications = {\n            'left': symbolInstance.leftJustifiedTextSymbolIndex,\n            'center': symbolInstance.centerJustifiedTextSymbolIndex,\n            'right': symbolInstance.rightJustifiedTextSymbolIndex\n        };\n\n        let autoIndex;\n        if (orientation === WritingMode.vertical) {\n            autoIndex = symbolInstance.verticalPlacedTextSymbolIndex;\n        } else {\n            autoIndex = justifications[getAnchorJustification(placedAnchor)];\n        }\n\n        const indexes = [\n            symbolInstance.leftJustifiedTextSymbolIndex,\n            symbolInstance.centerJustifiedTextSymbolIndex,\n            symbolInstance.rightJustifiedTextSymbolIndex,\n            symbolInstance.verticalPlacedTextSymbolIndex\n        ];\n\n        for (const index of indexes) {\n            if (index >= 0) {\n                if (autoIndex >= 0 && index !== autoIndex) {\n                    // There are multiple justifications and this one isn't it: shift offscreen\n                    bucket.text.placedSymbolArray.get(index).crossTileID = 0;\n                } else {\n                    // Either this is the chosen justification or the justification is hardwired: use this one\n                    bucket.text.placedSymbolArray.get(index).crossTileID = symbolInstance.crossTileID;\n                }\n            }\n        }\n    }\n\n    markUsedOrientation(bucket: SymbolBucket, orientation: number, symbolInstance: SymbolInstance): void {\n        const horizontal = (orientation === WritingMode.horizontal || orientation === WritingMode.horizontalOnly) ? orientation : 0;\n        const vertical = orientation === WritingMode.vertical ? orientation : 0;\n\n        const horizontalIndexes = [\n            symbolInstance.leftJustifiedTextSymbolIndex,\n            symbolInstance.centerJustifiedTextSymbolIndex,\n            symbolInstance.rightJustifiedTextSymbolIndex\n        ];\n\n        for (const index of horizontalIndexes) {\n            bucket.text.placedSymbolArray.get(index).placedOrientation = horizontal;\n        }\n\n        if (symbolInstance.verticalPlacedTextSymbolIndex) {\n            bucket.text.placedSymbolArray.get(symbolInstance.verticalPlacedTextSymbolIndex).placedOrientation = vertical;\n        }\n    }\n\n    commit(now: number): void {\n        this.commitTime = now;\n        this.zoomAtLastRecencyCheck = this.transform.zoom;\n\n        const prevPlacement = this.prevPlacement;\n        let placementChanged = false;\n\n        this.prevZoomAdjustment = prevPlacement ? prevPlacement.zoomAdjustment(this.transform.zoom) : 0;\n        const increment = prevPlacement ? prevPlacement.symbolFadeChange(now) : 1;\n\n        const prevOpacities = prevPlacement ? prevPlacement.opacities : {};\n        const prevOffsets = prevPlacement ? prevPlacement.variableOffsets : {};\n        const prevOrientations = prevPlacement ? prevPlacement.placedOrientations : {};\n\n        // add the opacities from the current placement, and copy their current values from the previous placement\n        for (const crossTileID in this.placements) {\n            const jointPlacement = this.placements[crossTileID];\n            const prevOpacity = prevOpacities[crossTileID];\n            if (prevOpacity) {\n                this.opacities[crossTileID] = new JointOpacityState(prevOpacity, increment, jointPlacement.text, jointPlacement.icon);\n                placementChanged ||= jointPlacement.text !== prevOpacity.text.placed;\n                placementChanged ||= jointPlacement.icon !== prevOpacity.icon.placed;\n            } else {\n                this.opacities[crossTileID] = new JointOpacityState(null, increment, jointPlacement.text, jointPlacement.icon, jointPlacement.skipFade);\n                placementChanged ||= jointPlacement.text || jointPlacement.icon;\n            }\n        }\n\n        // copy and update values from the previous placement that aren't in the current placement but haven't finished fading\n        for (const crossTileID in prevOpacities) {\n            const prevOpacity = prevOpacities[crossTileID];\n            if (!this.opacities[crossTileID]) {\n                const jointOpacity = new JointOpacityState(prevOpacity, increment, false, false);\n                if (!jointOpacity.isHidden()) {\n                    this.opacities[crossTileID] = jointOpacity;\n                    placementChanged ||= prevOpacity.text.placed;\n                    placementChanged ||= prevOpacity.icon.placed;\n                }\n            }\n        }\n        for (const crossTileID in prevOffsets) {\n            if (!this.variableOffsets[crossTileID] && this.opacities[crossTileID] && !this.opacities[crossTileID].isHidden()) {\n                this.variableOffsets[crossTileID] = prevOffsets[crossTileID];\n            }\n        }\n\n        for (const crossTileID in prevOrientations) {\n            if (!this.placedOrientations[crossTileID] && this.opacities[crossTileID] && !this.opacities[crossTileID].isHidden()) {\n                this.placedOrientations[crossTileID] = prevOrientations[crossTileID];\n            }\n        }\n\n        // this.lastPlacementChangeTime is the time of the last commit() that\n        // resulted in a placement change -- in other words, the start time of\n        // the last symbol fade animation\n        if (prevPlacement && prevPlacement.lastPlacementChangeTime === undefined) {\n            throw new Error('Last placement time for previous placement is not defined');\n        }\n        if (placementChanged) {\n            this.lastPlacementChangeTime = now;\n        } else if (typeof this.lastPlacementChangeTime !== 'number') {\n            this.lastPlacementChangeTime = prevPlacement ? prevPlacement.lastPlacementChangeTime : now;\n        }\n    }\n\n    updateLayerOpacities(styleLayer: StyleLayer, tiles: Tile[]): void {\n        const seenCrossTileIDs = {};\n        for (const tile of tiles) {\n            const symbolBucket = tile.getBucket(styleLayer) as SymbolBucket;\n            if (symbolBucket && tile.latestFeatureIndex && styleLayer.id === symbolBucket.layerIds[0]) {\n                this.updateBucketOpacities(symbolBucket, tile.tileID, seenCrossTileIDs, tile.collisionBoxArray);\n            }\n        }\n    }\n\n    updateBucketOpacities(bucket: SymbolBucket, tileID: OverscaledTileID, seenCrossTileIDs: {\n        [k in string | number]: boolean;\n    }, collisionBoxArray?: CollisionBoxArray | null): void {\n        if (bucket.hasTextData()) {\n            bucket.text.opacityVertexArray.clear();\n            bucket.text.hasVisibleVertices = false;\n        }\n        if (bucket.hasIconData()) {\n            bucket.icon.opacityVertexArray.clear();\n            bucket.icon.hasVisibleVertices = false;\n        }\n        if (bucket.hasIconCollisionBoxData()) bucket.iconCollisionBox.collisionVertexArray.clear();\n        if (bucket.hasTextCollisionBoxData()) bucket.textCollisionBox.collisionVertexArray.clear();\n\n        const layer = bucket.layers[0];\n        const layout = layer.layout;\n        const duplicateOpacityState = new JointOpacityState(null, 0, false, false, true);\n        const textAllowOverlap = layout.get('text-allow-overlap');\n        const iconAllowOverlap = layout.get('icon-allow-overlap');\n        const hasVariablePlacement = layer._unevaluatedLayout.hasValue('text-variable-anchor') || layer._unevaluatedLayout.hasValue('text-variable-anchor-offset');\n        const rotateWithMap = layout.get('text-rotation-alignment') === 'map';\n        const pitchWithMap = layout.get('text-pitch-alignment') === 'map';\n        const hasIconTextFit = layout.get('icon-text-fit') !== 'none';\n        // If allow-overlap is true, we can show symbols before placement runs on them\n        // But we have to wait for placement if we potentially depend on a paired icon/text\n        // with allow-overlap: false.\n        // See https://github.com/mapbox/mapbox-gl-js/issues/7032\n        const defaultOpacityState = new JointOpacityState(null, 0,\n            textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || layout.get('icon-optional')),\n            iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || layout.get('text-optional')),\n            true);\n\n        if (!bucket.collisionArrays && collisionBoxArray && ((bucket.hasIconCollisionBoxData() || bucket.hasTextCollisionBoxData()))) {\n            bucket.deserializeCollisionBoxes(collisionBoxArray);\n        }\n\n        const addOpacities = (iconOrText: SymbolBuffers, numVertices: number, opacity: number) => {\n            for (let i = 0; i < numVertices / 4; i++) {\n                iconOrText.opacityVertexArray.emplaceBack(opacity);\n            }\n            iconOrText.hasVisibleVertices ||= (opacity !== PACKED_HIDDEN_OPACITY);\n        };\n\n        const boxArrays = this.collisionBoxArrays.get(bucket.bucketInstanceId);\n\n        for (let s = 0; s < bucket.symbolInstances.length; s++) {\n            const symbolInstance = bucket.symbolInstances.get(s);\n            const {\n                numHorizontalGlyphVertices,\n                numVerticalGlyphVertices,\n                crossTileID\n            } = symbolInstance;\n\n            const isDuplicate = seenCrossTileIDs[crossTileID];\n\n            let opacityState = this.opacities[crossTileID];\n            if (isDuplicate) {\n                opacityState = duplicateOpacityState;\n            } else if (!opacityState) {\n                opacityState = defaultOpacityState;\n                // store the state so that future placements use it as a starting point\n                this.opacities[crossTileID] = opacityState;\n            }\n\n            seenCrossTileIDs[crossTileID] = true;\n\n            const hasText = numHorizontalGlyphVertices > 0 || numVerticalGlyphVertices > 0;\n            const hasIcon = symbolInstance.numIconVertices > 0;\n\n            const placedOrientation = this.placedOrientations[symbolInstance.crossTileID];\n            const horizontalHidden = placedOrientation === WritingMode.vertical;\n            const verticalHidden = placedOrientation === WritingMode.horizontal || placedOrientation === WritingMode.horizontalOnly;\n\n            if (hasText) {\n                const packedOpacity = packOpacity(opacityState.text);\n                // Vertical text fades in/out on collision the same way as corresponding\n                // horizontal text. Switch between vertical/horizontal should be instantaneous\n                const horizontalOpacity = horizontalHidden ? PACKED_HIDDEN_OPACITY : packedOpacity;\n                addOpacities(bucket.text, numHorizontalGlyphVertices, horizontalOpacity);\n                const verticalOpacity = verticalHidden ? PACKED_HIDDEN_OPACITY : packedOpacity;\n                addOpacities(bucket.text, numVerticalGlyphVertices, verticalOpacity);\n\n                // If this label is completely faded, mark it so that we don't have to calculate\n                // its position at render time. If this layer has variable placement, shift the various\n                // symbol instances appropriately so that symbols from buckets that have yet to be placed\n                // offset appropriately.\n                const symbolHidden = opacityState.text.isHidden();\n                const textSymbolIndexes = [\n                    symbolInstance.rightJustifiedTextSymbolIndex,\n                    symbolInstance.centerJustifiedTextSymbolIndex,\n                    symbolInstance.leftJustifiedTextSymbolIndex\n                ];\n                for (const index of textSymbolIndexes) {\n                    if (index >= 0) {\n                        bucket.text.placedSymbolArray.get(index).hidden = symbolHidden || horizontalHidden ? 1 : 0;\n                    }\n                }\n\n                if (symbolInstance.verticalPlacedTextSymbolIndex >= 0) {\n                    bucket.text.placedSymbolArray.get(symbolInstance.verticalPlacedTextSymbolIndex).hidden = symbolHidden || verticalHidden ? 1 : 0;\n                }\n\n                const prevOffset = this.variableOffsets[symbolInstance.crossTileID];\n                if (prevOffset) {\n                    this.markUsedJustification(bucket, prevOffset.anchor, symbolInstance, placedOrientation);\n                }\n\n                const prevOrientation = this.placedOrientations[symbolInstance.crossTileID];\n                if (prevOrientation) {\n                    this.markUsedJustification(bucket, 'left', symbolInstance, prevOrientation);\n                    this.markUsedOrientation(bucket, prevOrientation, symbolInstance);\n                }\n            }\n\n            if (hasIcon) {\n                const packedOpacity = packOpacity(opacityState.icon);\n\n                const useHorizontal = !(hasIconTextFit && symbolInstance.verticalPlacedIconSymbolIndex && horizontalHidden);\n\n                if (symbolInstance.placedIconSymbolIndex >= 0) {\n                    const horizontalOpacity = useHorizontal ? packedOpacity : PACKED_HIDDEN_OPACITY;\n                    addOpacities(bucket.icon, symbolInstance.numIconVertices, horizontalOpacity);\n                    bucket.icon.placedSymbolArray.get(symbolInstance.placedIconSymbolIndex).hidden =\n                        (opacityState.icon.isHidden() as any);\n                }\n\n                if (symbolInstance.verticalPlacedIconSymbolIndex >= 0) {\n                    const verticalOpacity = !useHorizontal ? packedOpacity : PACKED_HIDDEN_OPACITY;\n                    addOpacities(bucket.icon, symbolInstance.numVerticalIconVertices, verticalOpacity);\n                    bucket.icon.placedSymbolArray.get(symbolInstance.verticalPlacedIconSymbolIndex).hidden =\n                        (opacityState.icon.isHidden() as any);\n                }\n            }\n\n            const realBoxes = (boxArrays?.has(s)) ? boxArrays.get(s) : {\n                text: null,\n                icon: null\n            };\n\n            if (bucket.hasIconCollisionBoxData() || bucket.hasTextCollisionBoxData()) {\n                const collisionArrays = bucket.collisionArrays[s];\n                if (collisionArrays) {\n                    let shift = new Point(0, 0);\n                    if (collisionArrays.textBox || collisionArrays.verticalTextBox) {\n                        let used = true;\n                        if (hasVariablePlacement) {\n                            const variableOffset = this.variableOffsets[crossTileID];\n                            if (variableOffset) {\n                                // This will show either the currently placed position or the last\n                                // successfully placed position (so you can visualize what collision\n                                // just made the symbol disappear, and the most likely place for the\n                                // symbol to come back)\n                                shift = calculateVariableLayoutShift(variableOffset.anchor,\n                                    variableOffset.width,\n                                    variableOffset.height,\n                                    variableOffset.textOffset,\n                                    variableOffset.textBoxScale);\n                                if (rotateWithMap) {\n                                    shift._rotate(pitchWithMap ? -this.transform.bearingInRadians : this.transform.bearingInRadians);\n                                }\n                            } else {\n                                // No offset -> this symbol hasn't been placed since coming on-screen\n                                // No single box is particularly meaningful and all of them would be too noisy\n                                // Use the center box just to show something's there, but mark it \"not used\"\n                                used = false;\n                            }\n                        }\n\n                        if (collisionArrays.textBox || collisionArrays.verticalTextBox) {\n                            let hidden: boolean;\n                            if (collisionArrays.textBox) {\n                                hidden = horizontalHidden;\n                            }\n                            if (collisionArrays.verticalTextBox) {\n                                hidden = verticalHidden;\n                            }\n                            updateCollisionVertices(bucket.textCollisionBox.collisionVertexArray, opacityState.text.placed, !used || hidden, realBoxes.text, shift.x, shift.y);\n                        }\n                    }\n\n                    if (collisionArrays.iconBox || collisionArrays.verticalIconBox) {\n                        const verticalIconUsed = Boolean(!verticalHidden && collisionArrays.verticalIconBox);\n                        let hidden: boolean;\n                        if (collisionArrays.iconBox) {\n                            hidden = verticalIconUsed;\n                        }\n                        if (collisionArrays.verticalIconBox) {\n                            hidden = !verticalIconUsed;\n                        }\n                        updateCollisionVertices(bucket.iconCollisionBox.collisionVertexArray, opacityState.icon.placed, hidden, realBoxes.icon,\n                            hasIconTextFit ? shift.x : 0,\n                            hasIconTextFit ? shift.y : 0);\n                    }\n                }\n            }\n        }\n\n        bucket.sortFeatures(-this.transform.bearingInRadians);\n        if (this.retainedQueryData[bucket.bucketInstanceId]) {\n            this.retainedQueryData[bucket.bucketInstanceId].featureSortOrder = bucket.featureSortOrder;\n        }\n\n        if (bucket.hasTextData() && bucket.text.opacityVertexBuffer) {\n            bucket.text.opacityVertexBuffer.updateData(bucket.text.opacityVertexArray);\n        }\n        if (bucket.hasIconData() && bucket.icon.opacityVertexBuffer) {\n            bucket.icon.opacityVertexBuffer.updateData(bucket.icon.opacityVertexArray);\n        }\n        if (bucket.hasIconCollisionBoxData() && bucket.iconCollisionBox.collisionVertexBuffer) {\n            bucket.iconCollisionBox.collisionVertexBuffer.updateData(bucket.iconCollisionBox.collisionVertexArray);\n        }\n        if (bucket.hasTextCollisionBoxData() && bucket.textCollisionBox.collisionVertexBuffer) {\n            bucket.textCollisionBox.collisionVertexBuffer.updateData(bucket.textCollisionBox.collisionVertexArray);\n        }\n\n        if (bucket.text.opacityVertexArray.length !== bucket.text.layoutVertexArray.length / 4) throw new Error(`bucket.text.opacityVertexArray.length (= ${bucket.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${bucket.text.layoutVertexArray.length}) / 4`);\n        if (bucket.icon.opacityVertexArray.length !== bucket.icon.layoutVertexArray.length / 4) throw new Error(`bucket.icon.opacityVertexArray.length (= ${bucket.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${bucket.icon.layoutVertexArray.length}) / 4`);\n\n        // Push generated collision circles to the bucket for debug rendering\n        if (bucket.bucketInstanceId in this.collisionCircleArrays) {\n            bucket.collisionCircleArray = this.collisionCircleArrays[bucket.bucketInstanceId];\n            delete this.collisionCircleArrays[bucket.bucketInstanceId];\n        }\n    }\n\n    symbolFadeChange(now: number): number {\n        return this.fadeDuration === 0 ?\n            1 :\n            ((now - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment);\n    }\n\n    zoomAdjustment(zoom: number): number {\n        // When zooming out quickly, labels can overlap each other. This\n        // adjustment is used to reduce the interval between placement calculations\n        // and to reduce the fade duration when zooming out quickly. Discovering the\n        // collisions more quickly and fading them more quickly reduces the unwanted effect.\n        return Math.max(0, (this.transform.zoom - zoom) / 1.5);\n    }\n\n    hasTransitions(now: number): boolean {\n        return this.stale ||\n            now - this.lastPlacementChangeTime < this.fadeDuration;\n    }\n\n    stillRecent(now: number, zoom: number): boolean {\n        // The adjustment makes placement more frequent when zooming.\n        // This condition applies the adjustment only after the map has\n        // stopped zooming. This avoids adding extra jank while zooming.\n        const durationAdjustment = this.zoomAtLastRecencyCheck === zoom ?\n            (1 - this.zoomAdjustment(zoom)) :\n            1;\n        this.zoomAtLastRecencyCheck = zoom;\n\n        return this.commitTime + this.fadeDuration * durationAdjustment > now;\n    }\n\n    setStale(): void {\n        this.stale = true;\n    }\n}\n\nfunction updateCollisionVertices(collisionVertexArray: CollisionVertexArray, placed: boolean, notUsed: boolean | number, realBox: number[], shiftX?: number, shiftY?: number) {\n    if (!realBox || realBox.length === 0) {\n        realBox = [0, 0, 0, 0];\n    }\n\n    const tlX = realBox[0] - viewportPadding;\n    const tlY = realBox[1] - viewportPadding;\n    const brX = realBox[2] - viewportPadding;\n    const brY = realBox[3] - viewportPadding;\n\n    collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0, tlX, tlY);\n    collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0, brX, tlY);\n    collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0, brX, brY);\n    collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0, tlX, brY);\n}\n\n// All four vertices for a glyph will have the same opacity state\n// So we pack the opacity into a uint8, and then repeat it four times\n// to make a single uint32 that we can upload for each glyph in the\n// label.\nconst shift25 = Math.pow(2, 25);\nconst shift24 = Math.pow(2, 24);\nconst shift17 = Math.pow(2, 17);\nconst shift16 = Math.pow(2, 16);\nconst shift9 = Math.pow(2, 9);\nconst shift8 = Math.pow(2, 8);\nconst shift1 = Math.pow(2, 1);\nfunction packOpacity(opacityState: OpacityState): number {\n    if (opacityState.opacity === 0 && !opacityState.placed) {\n        return 0;\n    } else if (opacityState.opacity === 1 && opacityState.placed) {\n        return 4294967295;\n    }\n    const targetBit = opacityState.placed ? 1 : 0;\n    const opacityBits = Math.floor(opacityState.opacity * 127);\n    return opacityBits * shift25 + targetBit * shift24 +\n        opacityBits * shift17 + targetBit * shift16 +\n        opacityBits * shift9 + targetBit * shift8 +\n        opacityBits * shift1 + targetBit;\n}\n\nconst PACKED_HIDDEN_OPACITY = 0;\n","import {now} from '../util/time_control.ts';\nimport {Placement} from '../symbol/placement.ts';\nimport {isSymbolStyleLayer, type SymbolStyleLayer} from './style_layer/symbol_style_layer.ts';\nimport type {ITransform} from '../geo/transform_interface.ts';\nimport type {StyleLayer} from './style_layer.ts';\nimport type {Tile} from '../tile/tile.ts';\nimport type {BucketPart} from '../symbol/placement.ts';\nimport type {Terrain} from '../render/terrain.ts';\n\nclass LayerPlacement {\n    _sortAcrossTiles: boolean;\n    _currentTileIndex: number;\n    _currentPartIndex: number;\n    _seenCrossTileIDs: {\n        [k in string | number]: boolean;\n    };\n    _bucketParts: BucketPart[];\n\n    constructor(styleLayer: SymbolStyleLayer) {\n        this._sortAcrossTiles = styleLayer.layout.get('symbol-z-order') !== 'viewport-y' &&\n            !styleLayer.layout.get('symbol-sort-key').isConstant();\n\n        this._currentTileIndex = 0;\n        this._currentPartIndex = 0;\n        this._seenCrossTileIDs = {};\n        this._bucketParts = [];\n    }\n\n    continuePlacement(tiles: Tile[], placement: Placement, showCollisionBoxes: boolean, styleLayer: StyleLayer, shouldPausePlacement: () => boolean): boolean {\n\n        const bucketParts = this._bucketParts;\n\n        while (this._currentTileIndex < tiles.length) {\n            const tile = tiles[this._currentTileIndex];\n            placement.getBucketParts(bucketParts, styleLayer, tile, this._sortAcrossTiles);\n\n            this._currentTileIndex++;\n            if (shouldPausePlacement()) {\n                return true;\n            }\n        }\n\n        if (this._sortAcrossTiles) {\n            this._sortAcrossTiles = false;\n            bucketParts.sort((a, b) => (a.sortKey as any as number) - (b.sortKey as any as number));\n        }\n\n        while (this._currentPartIndex < bucketParts.length) {\n            const bucketPart = bucketParts[this._currentPartIndex];\n            placement.placeLayerBucketPart(bucketPart, this._seenCrossTileIDs, showCollisionBoxes);\n\n            this._currentPartIndex++;\n            if (shouldPausePlacement()) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n\nexport class PauseablePlacement {\n    placement: Placement;\n    _done: boolean;\n    _currentPlacementIndex: number;\n    _forceFullPlacement: boolean;\n    _showCollisionBoxes: boolean;\n    _inProgressLayer: LayerPlacement;\n\n    constructor(\n        transform: ITransform,\n        terrain: Terrain,\n        order: string[],\n        forceFullPlacement: boolean,\n        showCollisionBoxes: boolean,\n        fadeDuration: number,\n        crossSourceCollisions: boolean,\n        prevPlacement?: Placement\n    ) {\n        this.placement = new Placement(transform, terrain, fadeDuration, crossSourceCollisions, prevPlacement);\n        this._currentPlacementIndex = order.length - 1;\n        this._forceFullPlacement = forceFullPlacement;\n        this._showCollisionBoxes = showCollisionBoxes;\n        this._done = false;\n    }\n\n    isDone(): boolean {\n        return this._done;\n    }\n\n    continuePlacement(\n        order: string[],\n        layers: {[_: string]: StyleLayer},\n        layerTiles: {[_: string]: Tile[]}\n    ): void {\n        const startTime = now();\n\n        const shouldPausePlacement = () => {\n            return this._forceFullPlacement ? false : (now() - startTime) > 2;\n        };\n\n        while (this._currentPlacementIndex >= 0) {\n            const layerId = order[this._currentPlacementIndex];\n            const layer = layers[layerId];\n            const placementZoom = this.placement.collisionIndex.transform.zoom;\n            if (isSymbolStyleLayer(layer) &&\n                layer.layout &&\n                (!layer.minzoom || layer.minzoom <= placementZoom) &&\n                (!layer.maxzoom || layer.maxzoom > placementZoom)) {\n\n                this._inProgressLayer ||= new LayerPlacement(layer);\n\n                const pausePlacement = this._inProgressLayer.continuePlacement(layerTiles[layer.source], this.placement, this._showCollisionBoxes, layer, shouldPausePlacement);\n\n                if (pausePlacement) {\n                    // We didn't finish placing all layers within 2ms,\n                    // but we can keep rendering with a partial placement\n                    // We'll resume here on the next frame\n                    return;\n                }\n\n                delete this._inProgressLayer;\n            }\n\n            this._currentPlacementIndex--;\n        }\n\n        this._done = true;\n    }\n\n    commit(now: number): Placement {\n        this.placement.commit(now);\n        return this.placement;\n    }\n}\n","\nconst ARRAY_TYPES = [\n    Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,\n    Int32Array, Uint32Array, Float32Array, Float64Array\n];\n\n/** @typedef {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor} TypedArrayConstructor */\n/** @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array} TypedArray */\n\nconst VERSION = 1; // serialized format version\nconst HEADER_SIZE = 8;\n\n// Shared scratch stack for iterative DFS in range/within. Sized for the worst case:\n// 3 ints per frame * (treeHeight + 1), with treeHeight ≤ ceil(log2(2^32 / 3)) ≈ 31.\nconst STACK = new Uint32Array(96);\n\nexport default class KDBush {\n\n    /**\n     * Creates an index from raw `ArrayBuffer` data.\n     * @param {ArrayBufferLike} data\n     */\n    static from(data) {\n        // @ts-expect-error duck typing array buffers\n        if (!data || data.byteLength === undefined || data.buffer) {\n            throw new Error('Data must be an instance of ArrayBuffer or SharedArrayBuffer.');\n        }\n        const [magic, versionAndType] = new Uint8Array(data, 0, 2);\n        if (magic !== 0xdb) {\n            throw new Error('Data does not appear to be in a KDBush format.');\n        }\n        const version = versionAndType >> 4;\n        if (version !== VERSION) {\n            throw new Error(`Got v${version} data when expected v${VERSION}.`);\n        }\n        const ArrayType = ARRAY_TYPES[versionAndType & 0x0f];\n        if (!ArrayType) {\n            throw new Error('Unrecognized array type.');\n        }\n        const [nodeSize] = new Uint16Array(data, 2, 1);\n        const [numItems] = new Uint32Array(data, 4, 1);\n\n        return new KDBush(numItems, nodeSize, ArrayType, undefined, data);\n    }\n\n    /**\n     * Creates an index that will hold a given number of items.\n     * @param {number} numItems\n     * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).\n     * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).\n     * @param {ArrayBufferConstructor | SharedArrayBufferConstructor} [ArrayBufferType=ArrayBuffer] The array buffer type used for storage (`ArrayBuffer` by default).\n     * @param {ArrayBufferLike} [data] (For internal use only)\n     */\n    constructor(numItems, nodeSize = 64, ArrayType = Float64Array, ArrayBufferType = ArrayBuffer, data) {\n        if (isNaN(numItems) || numItems < 0) throw new Error(`Unexpected numItems value: ${numItems}.`);\n\n        this.numItems = +numItems;\n        this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);\n        this.ArrayType = ArrayType;\n        this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array;\n\n        const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);\n        const coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT;\n        const idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT;\n        const padCoords = (8 - idsByteSize % 8) % 8;\n\n        if (arrayTypeIndex < 0) {\n            throw new Error(`Unexpected typed array class: ${ArrayType}.`);\n        }\n\n        if (data) { // reconstruct an index from a buffer\n            this.data = data;\n            // @ts-expect-error TS can't handle SharedArrayBuffer overloads\n            this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);\n            // @ts-expect-error TS can't handle SharedArrayBuffer overloads\n            this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);\n            this._pos = numItems * 2;\n            this._finished = true;\n\n        } else { // initialize a new index\n            const data = this.data = new ArrayBufferType(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords);\n            // @ts-expect-error TS can't handle SharedArrayBuffer overloads\n            this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);\n            // @ts-expect-error TS can't handle SharedArrayBuffer overloads\n            this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);\n            this._pos = 0;\n            this._finished = false;\n\n            // set header\n            new Uint8Array(data, 0, 2).set([0xdb, (VERSION << 4) + arrayTypeIndex]);\n            new Uint16Array(data, 2, 1)[0] = nodeSize;\n            new Uint32Array(data, 4, 1)[0] = numItems;\n        }\n    }\n\n    /**\n     * Add a point to the index.\n     * @param {number} x\n     * @param {number} y\n     * @returns {number} An incremental index associated with the added item (starting from `0`).\n     */\n    add(x, y) {\n        const index = this._pos >> 1;\n        this.ids[index] = index;\n        this.coords[this._pos++] = x;\n        this.coords[this._pos++] = y;\n        return index;\n    }\n\n    /**\n     * Perform indexing of the added points.\n     */\n    finish() {\n        const numAdded = this._pos >> 1;\n        if (numAdded !== this.numItems) {\n            throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);\n        }\n        // kd-sort both arrays for efficient search\n        sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0);\n\n        this._finished = true;\n        return this;\n    }\n\n    /**\n     * Search the index for items within a given bounding box.\n     * @param {number} minX\n     * @param {number} minY\n     * @param {number} maxX\n     * @param {number} maxY\n     * @returns {number[]} An array of indices correponding to the found items.\n     */\n    range(minX, minY, maxX, maxY) {\n        if (!this._finished) throw new Error('Data not yet indexed - call index.finish().');\n\n        const {ids, coords, nodeSize} = this;\n        STACK[0] = 0;\n        STACK[1] = ids.length - 1;\n        STACK[2] = 0;\n        let sp = 3;\n        const result = [];\n\n        // recursively search for items in range in the kd-sorted arrays\n        while (sp > 0) {\n            const axis = STACK[--sp];\n            const right = STACK[--sp];\n            const left = STACK[--sp];\n\n            // if we reached \"tree node\", search linearly\n            if (right - left <= nodeSize) {\n                for (let i = left; i <= right; i++) {\n                    const x = coords[2 * i];\n                    const y = coords[2 * i + 1];\n                    if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]);\n                }\n                continue;\n            }\n\n            // otherwise find the middle index\n            const m = (left + right) >> 1;\n\n            // include the middle item if it's in range\n            const x = coords[2 * m];\n            const y = coords[2 * m + 1];\n            if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]);\n\n            // queue search in halves that intersect the query\n            if (axis === 0 ? minX <= x : minY <= y) {\n                STACK[sp++] = left;\n                STACK[sp++] = m - 1;\n                STACK[sp++] = 1 - axis;\n            }\n            if (axis === 0 ? maxX >= x : maxY >= y) {\n                STACK[sp++] = m + 1;\n                STACK[sp++] = right;\n                STACK[sp++] = 1 - axis;\n            }\n        }\n\n        return result;\n    }\n\n    /**\n     * Search the index for items within a given radius.\n     * @param {number} qx\n     * @param {number} qy\n     * @param {number} r Query radius.\n     * @returns {number[]} An array of indices correponding to the found items.\n     */\n    within(qx, qy, r) {\n        const result = /** @type {number[]} */ ([]);\n        this.withinInto(qx, qy, r, result);\n        return result;\n    }\n\n    /**\n     * Search the index for items within a given radius, writing matching ids into `out`\n     * via indexed assignment (`out[i] = id`). Accepts any indexed-writable container —\n     * a typed array sized to the expected upper bound (allocation-free, fast) or a plain\n     * `Array` (which will grow as needed). Returns the number of matches written.\n     * @param {number} qx\n     * @param {number} qy\n     * @param {number} r Query radius.\n     * @param {number[] | TypedArray} out Container to write matching ids into.\n     * @returns {number} The number of matches written to `out`.\n     */\n    withinInto(qx, qy, r, out) {\n        if (!this._finished) throw new Error('Data not yet indexed - call index.finish().');\n\n        const {ids, coords, nodeSize} = this;\n        STACK[0] = 0;\n        STACK[1] = ids.length - 1;\n        STACK[2] = 0;\n        let sp = 3;\n        let count = 0;\n        const r2 = r * r;\n\n        // recursively search for items within radius in the kd-sorted arrays\n        while (sp > 0) {\n            const axis = STACK[--sp];\n            const right = STACK[--sp];\n            const left = STACK[--sp];\n\n            // if we reached \"tree node\", search linearly\n            if (right - left <= nodeSize) {\n                for (let i = left; i <= right; i++) {\n                    if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) out[count++] = ids[i];\n                }\n                continue;\n            }\n\n            // otherwise find the middle index\n            const m = (left + right) >> 1;\n\n            // include the middle item if it's in range\n            const x = coords[2 * m];\n            const y = coords[2 * m + 1];\n            if (sqDist(x, y, qx, qy) <= r2) out[count++] = ids[m];\n\n            // queue search in halves that intersect the query\n            if (axis === 0 ? qx - r <= x : qy - r <= y) {\n                STACK[sp++] = left;\n                STACK[sp++] = m - 1;\n                STACK[sp++] = 1 - axis;\n            }\n            if (axis === 0 ? qx + r >= x : qy + r >= y) {\n                STACK[sp++] = m + 1;\n                STACK[sp++] = right;\n                STACK[sp++] = 1 - axis;\n            }\n        }\n\n        return count;\n    }\n}\n\n/**\n * @param {Uint16Array | Uint32Array} ids\n * @param {TypedArray} coords\n * @param {number} nodeSize\n * @param {number} left\n * @param {number} right\n * @param {number} axis\n */\nfunction sort(ids, coords, nodeSize, left, right, axis) {\n    if (right - left <= nodeSize) return;\n\n    const m = (left + right) >> 1; // middle index\n\n    // sort ids and coords around the middle index so that the halves lie\n    // either left/right or top/bottom correspondingly (taking turns)\n    select(ids, coords, m, left, right, axis);\n\n    // recursively kd-sort first half and second half on the opposite axis\n    sort(ids, coords, nodeSize, left, m - 1, 1 - axis);\n    sort(ids, coords, nodeSize, m + 1, right, 1 - axis);\n}\n\n/**\n * Custom Floyd-Rivest selection algorithm: sort ids and coords so that\n * [left..k-1] items are smaller than k-th item (on either x or y axis)\n * @param {Uint16Array | Uint32Array} ids\n * @param {TypedArray} coords\n * @param {number} k\n * @param {number} left\n * @param {number} right\n * @param {number} axis\n */\nfunction select(ids, coords, k, left, right, axis) {\n\n    while (right > left) {\n        if (right - left > 600) {\n            const n = right - left + 1;\n            const m = k - left + 1;\n            const z = Math.log(n);\n            const s = 0.5 * Math.exp(2 * z / 3);\n            const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n            const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n            const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n            select(ids, coords, k, newLeft, newRight, axis);\n        }\n\n        const t = coords[2 * k + axis];\n        let i = left;\n        let j = right;\n\n        swapItem(ids, coords, left, k);\n        if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right);\n\n        while (i < j) {\n            swapItem(ids, coords, i, j);\n            i++;\n            j--;\n            while (coords[2 * i + axis] < t) i++;\n            while (coords[2 * j + axis] > t) j--;\n        }\n\n        if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j);\n        else {\n            j++;\n            swapItem(ids, coords, j, right);\n        }\n\n        if (j <= k) left = j + 1;\n        if (k <= j) right = j - 1;\n    }\n}\n\n/**\n * @param {Uint16Array | Uint32Array} ids\n * @param {TypedArray} coords\n * @param {number} i\n * @param {number} j\n */\nfunction swapItem(ids, coords, i, j) {\n    swap(ids, i, j);\n    swap(coords, 2 * i, 2 * j);\n    swap(coords, 2 * i + 1, 2 * j + 1);\n}\n\n/**\n * @param {TypedArray} arr\n * @param {number} i\n * @param {number} j\n */\nfunction swap(arr, i, j) {\n    const tmp = arr[i];\n    arr[i] = arr[j];\n    arr[j] = tmp;\n}\n\n/**\n * @param {number} ax\n * @param {number} ay\n * @param {number} bx\n * @param {number} by\n */\nfunction sqDist(ax, ay, bx, by) {\n    const dx = ax - bx;\n    const dy = ay - by;\n    return dx * dx + dy * dy;\n}\n","import KDBush from 'kdbush';\nimport {EXTENT} from '../data/extent.ts';\n\nimport type {SymbolInstance} from '../data/array_types.g.ts';\nimport {type SymbolInstanceArray} from '../data/array_types.g.ts';\nimport type {OverscaledTileID} from '../tile/tile_id.ts';\nimport type {SymbolBucket} from '../data/bucket/symbol_bucket.ts';\nimport type {StyleLayer} from '../style/style_layer.ts';\nimport type {Tile} from '../tile/tile.ts';\n\n/*\n    The CrossTileSymbolIndex generally works on the assumption that\n    a conceptual \"unique symbol\" can be identified by the text of\n    the label combined with the anchor point. The goal is to assign\n    these conceptual \"unique symbols\" a shared crossTileID that can be\n    used by Placement to keep fading opacity states consistent and to\n    deduplicate labels.\n\n    The CrossTileSymbolIndex indexes all the current symbol instances and\n    their crossTileIDs. When a symbol bucket gets added or updated, the\n    index assigns a crossTileID to each of it's symbol instances by either\n    matching it with an existing id or assigning a new one.\n*/\n\n// Round anchor positions to roughly 4 pixel grid\nconst roundingFactor = 512 / EXTENT / 2;\n\nexport const KDBUSH_THRESHHOLD = 128;\n\ntype SymbolsByKeyEntry = {\n    index?: KDBush;\n    positions?: Array<{x: number; y: number}>;\n    crossTileIDs: number[];\n};\n\nclass TileLayerIndex {\n    _symbolsByKey: Record<number, SymbolsByKeyEntry> = {};\n\n    constructor(public tileID: OverscaledTileID, symbolInstances: SymbolInstanceArray, public bucketInstanceId: number) {\n        // group the symbolInstances by key\n        const symbolInstancesByKey = new Map<number, SymbolInstance[]>();\n        for (let i = 0; i < symbolInstances.length; i++) {\n            const symbolInstance = symbolInstances.get(i);\n            const key = symbolInstance.key;\n            const instances = symbolInstancesByKey.get(key);\n            if (instances) {\n                // This tile may have multiple symbol instances with the same key\n                // Store each one along with its coordinates\n                instances.push(symbolInstance);\n            } else {\n                symbolInstancesByKey.set(key, [symbolInstance]);\n            }\n        }\n\n        // index the SymbolInstances in this each bucket\n        for (const [key, symbols] of symbolInstancesByKey) {\n            const positions = symbols.map(symbolInstance => ({x: Math.floor(symbolInstance.anchorX * roundingFactor), y: Math.floor(symbolInstance.anchorY * roundingFactor)}));\n            const crossTileIDs = symbols.map(v => v.crossTileID);\n            const entry: SymbolsByKeyEntry = {positions, crossTileIDs};\n\n            // once we get too many symbols for a given key, it becomes much faster to index it before queries\n            if (entry.positions.length > KDBUSH_THRESHHOLD) {\n\n                const index = new KDBush(entry.positions.length, 16, Uint16Array);\n                for (const {x, y} of entry.positions) index.add(x, y);\n                index.finish();\n\n                // clear all references to the original positions data\n                delete entry.positions;\n                entry.index = index;\n            }\n\n            this._symbolsByKey[key] = entry;\n        }\n    }\n\n    // Converts the coordinates of the input symbol instance into coordinates that be can compared\n    // against other symbols in this index. Coordinates are:\n    // (1) local-tile-based (so after correction we get x,y values relative to our local anchorX/Y)\n    // (2) converted to the z-scale of this TileLayerIndex\n    // (3) down-sampled by \"roundingFactor\" from tile coordinate precision in order to be\n    //     more tolerant of small differences between tiles.\n    getScaledCoordinates(symbolInstance: SymbolInstance, childTileID: OverscaledTileID): {x: number; y: number} {\n        const {x: localX, y: localY, z: localZ} = this.tileID.canonical;\n        const {x, y, z} = childTileID.canonical;\n\n        const zDifference = z - localZ;\n        const scale = roundingFactor / Math.pow(2, zDifference);\n        const xWorld = (x * EXTENT + symbolInstance.anchorX) * scale;\n        const yWorld = (y * EXTENT + symbolInstance.anchorY) * scale;\n        const xOffset = localX * EXTENT * roundingFactor;\n        const yOffset = localY * EXTENT * roundingFactor;\n        return {\n            x: Math.floor(xWorld - xOffset),\n            y: Math.floor(yWorld - yOffset)\n        };\n    }\n\n    findMatches(symbolInstances: SymbolInstanceArray, newTileID: OverscaledTileID, zoomCrossTileIDs: {\n        [crossTileID: number]: boolean;\n    }): void {\n        const tolerance = this.tileID.canonical.z < newTileID.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - newTileID.canonical.z);\n\n        for (let i = 0; i < symbolInstances.length; i++) {\n            const symbolInstance = symbolInstances.get(i);\n            if (symbolInstance.crossTileID) {\n                // already has a match, skip\n                continue;\n            }\n\n            const entry = this._symbolsByKey[symbolInstance.key];\n            if (!entry) {\n                // No symbol with this key in this bucket\n                continue;\n            }\n\n            const scaledSymbolCoord = this.getScaledCoordinates(symbolInstance, newTileID);\n\n            if (entry.index) {\n                // Return any symbol with the same keys whose coordinates are within 1\n                // grid unit. (with a 4px grid, this covers a 12px by 12px area)\n                const indexes = entry.index.range(\n                    scaledSymbolCoord.x - tolerance,\n                    scaledSymbolCoord.y - tolerance,\n                    scaledSymbolCoord.x + tolerance,\n                    scaledSymbolCoord.y + tolerance).sort();\n\n                for (const i of indexes) {\n                    const crossTileID = entry.crossTileIDs[i];\n\n                    if (!zoomCrossTileIDs[crossTileID]) {\n                        // Once we've marked ourselves duplicate against this parent symbol,\n                        // don't let any other symbols at the same zoom level duplicate against\n                        // the same parent (see issue #5993)\n                        zoomCrossTileIDs[crossTileID] = true;\n                        symbolInstance.crossTileID = crossTileID;\n                        break;\n                    }\n                }\n            } else if (entry.positions) {\n                for (let i = 0; i < entry.positions.length; i++) {\n                    const thisTileSymbol = entry.positions[i];\n                    const crossTileID = entry.crossTileIDs[i];\n\n                    // Return any symbol with the same keys whose coordinates are within 1\n                    // grid unit. (with a 4px grid, this covers a 12px by 12px area)\n                    if (Math.abs(thisTileSymbol.x - scaledSymbolCoord.x) <= tolerance &&\n                        Math.abs(thisTileSymbol.y - scaledSymbolCoord.y) <= tolerance &&\n                        !zoomCrossTileIDs[crossTileID]) {\n                        // Once we've marked ourselves duplicate against this parent symbol,\n                        // don't let any other symbols at the same zoom level duplicate against\n                        // the same parent (see issue #5993)\n                        zoomCrossTileIDs[crossTileID] = true;\n                        symbolInstance.crossTileID = crossTileID;\n                        break;\n                    }\n                }\n            }\n        }\n    }\n\n    getCrossTileIDsLists(): number[][] {\n        return Object.values(this._symbolsByKey).map(({crossTileIDs}) => crossTileIDs);\n    }\n}\n\nclass CrossTileIDs {\n    maxCrossTileID: number;\n    constructor() {\n        this.maxCrossTileID = 0;\n    }\n    generate(): number {\n        return ++this.maxCrossTileID;\n    }\n}\n\nclass CrossTileSymbolLayerIndex {\n    indexes: {\n        [zoom in string | number]: {\n            [tileId in string | number]: TileLayerIndex;\n        };\n    };\n    usedCrossTileIDs: {\n        [zoom in string | number]: {\n            [crossTileID: number]: boolean;\n        };\n    };\n    lng: number;\n\n    constructor() {\n        this.indexes = {};\n        this.usedCrossTileIDs = {};\n        this.lng = 0;\n    }\n\n    /*\n     * Sometimes when a user pans across the antimeridian the longitude value gets wrapped.\n     * To prevent labels from flashing out and in we adjust the tileID values in the indexes\n     * so that they match the new wrapped version of the map.\n     */\n    handleWrapJump(lng: number): void {\n        const wrapDelta = Math.round((lng - this.lng) / 360);\n        if (wrapDelta !== 0) {\n            for (const zoom in this.indexes) {\n                const zoomIndexes = this.indexes[zoom];\n                const newZoomIndex = {};\n                for (const key in zoomIndexes) {\n                    // change the tileID's wrap and add it to a new index\n                    const index = zoomIndexes[key];\n                    index.tileID = index.tileID.unwrapTo(index.tileID.wrap + wrapDelta);\n                    newZoomIndex[index.tileID.key] = index;\n                }\n                this.indexes[zoom] = newZoomIndex;\n            }\n        }\n        this.lng = lng;\n    }\n\n    addBucket(tileID: OverscaledTileID, bucket: SymbolBucket, crossTileIDs: CrossTileIDs): boolean {\n        if (this.indexes[tileID.overscaledZ]?.[tileID.key]) {\n            if (this.indexes[tileID.overscaledZ][tileID.key].bucketInstanceId ===\n                bucket.bucketInstanceId) {\n                return false;\n            } else {\n                // We're replacing this bucket with an updated version\n                // Remove the old bucket's \"used crossTileIDs\" now so that\n                // the new bucket can claim them.\n                // The old index entries themselves stick around until\n                // 'removeStaleBuckets' is called.\n                this.removeBucketCrossTileIDs(tileID.overscaledZ,\n                    this.indexes[tileID.overscaledZ][tileID.key]);\n            }\n        }\n\n        for (let i = 0; i < bucket.symbolInstances.length; i++) {\n            const symbolInstance = bucket.symbolInstances.get(i);\n            symbolInstance.crossTileID = 0;\n        }\n\n        this.usedCrossTileIDs[tileID.overscaledZ] ||= {};\n        const zoomCrossTileIDs = this.usedCrossTileIDs[tileID.overscaledZ];\n\n        for (const zoom in this.indexes) {\n            const zoomIndexes = this.indexes[zoom];\n            if (Number(zoom) > tileID.overscaledZ) {\n                for (const id in zoomIndexes) {\n                    const childIndex = zoomIndexes[id];\n                    if (childIndex.tileID.isChildOf(tileID)) {\n                        childIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n                    }\n                }\n            } else {\n                const parentCoord = tileID.scaledTo(Number(zoom));\n                const parentIndex = zoomIndexes[parentCoord.key];\n                if (parentIndex) {\n                    parentIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n                }\n            }\n        }\n\n        for (let i = 0; i < bucket.symbolInstances.length; i++) {\n            const symbolInstance = bucket.symbolInstances.get(i);\n            if (!symbolInstance.crossTileID) {\n                // symbol did not match any known symbol, assign a new id\n                symbolInstance.crossTileID = crossTileIDs.generate();\n                zoomCrossTileIDs[symbolInstance.crossTileID] = true;\n            }\n        }\n\n        if (this.indexes[tileID.overscaledZ] === undefined) {\n            this.indexes[tileID.overscaledZ] = {};\n        }\n        this.indexes[tileID.overscaledZ][tileID.key] = new TileLayerIndex(tileID, bucket.symbolInstances, bucket.bucketInstanceId);\n\n        return true;\n    }\n\n    removeBucketCrossTileIDs(zoom: string | number, removedBucket: TileLayerIndex): void {\n        for (const crossTileIDs of removedBucket.getCrossTileIDsLists()) {\n            for (const crossTileID of crossTileIDs) {\n                delete this.usedCrossTileIDs[zoom][crossTileID];\n            }\n        }\n    }\n\n    removeStaleBuckets(currentIDs: {\n        [k in string | number]: boolean;\n    }): boolean {\n        let tilesChanged = false;\n        for (const z in this.indexes) {\n            const zoomIndexes = this.indexes[z];\n            for (const tileKey in zoomIndexes) {\n                if (!currentIDs[zoomIndexes[tileKey].bucketInstanceId]) {\n                    this.removeBucketCrossTileIDs(z, zoomIndexes[tileKey]);\n                    delete zoomIndexes[tileKey];\n                    tilesChanged = true;\n                }\n            }\n        }\n        return tilesChanged;\n    }\n}\n\nexport class CrossTileSymbolIndex {\n    layerIndexes: {[layerId: string]: CrossTileSymbolLayerIndex};\n    crossTileIDs: CrossTileIDs;\n    maxBucketInstanceId: number;\n    bucketsInCurrentPlacement: {[_: number]: boolean};\n\n    constructor() {\n        this.layerIndexes = {};\n        this.crossTileIDs = new CrossTileIDs();\n        this.maxBucketInstanceId = 0;\n        this.bucketsInCurrentPlacement = {};\n    }\n\n    addLayer(styleLayer: StyleLayer, tiles: Tile[], lng: number): boolean {\n        let layerIndex = this.layerIndexes[styleLayer.id];\n        if (layerIndex === undefined) {\n            layerIndex = this.layerIndexes[styleLayer.id] = new CrossTileSymbolLayerIndex();\n        }\n\n        let symbolBucketsChanged = false;\n        const currentBucketIDs = {};\n\n        layerIndex.handleWrapJump(lng);\n\n        for (const tile of tiles) {\n            const symbolBucket = (tile.getBucket(styleLayer) as any as SymbolBucket);\n            if (styleLayer.id !== symbolBucket?.layerIds[0])\n                continue;\n\n            if (!symbolBucket.bucketInstanceId) {\n                this.maxBucketInstanceId += 1;\n                symbolBucket.bucketInstanceId = this.maxBucketInstanceId;\n            }\n\n            if (layerIndex.addBucket(tile.tileID, symbolBucket, this.crossTileIDs)) {\n                symbolBucketsChanged = true;\n            }\n            currentBucketIDs[symbolBucket.bucketInstanceId] = true;\n        }\n\n        if (layerIndex.removeStaleBuckets(currentBucketIDs)) {\n            symbolBucketsChanged = true;\n        }\n\n        return symbolBucketsChanged;\n    }\n\n    pruneUnusedLayers(usedLayers: string[]): void {\n        const usedLayerMap = {};\n        for (const usedLayer of usedLayers) {\n            usedLayerMap[usedLayer] = true;\n        }\n        for (const layerId in this.layerIndexes) {\n            if (!usedLayerMap[layerId]) {\n                delete this.layerIndexes[layerId];\n            }\n        }\n    }\n}\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#ifdef GL_ES\\nprecision mediump float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\\nout highp vec4 fragColor;';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#ifdef GL_ES\\nprecision highp float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c\\n);}\\n#ifdef TERRAIN3D\\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\\n#endif\\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\\n#ifdef TERRAIN3D\\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\\n#else\\nreturn 1.0;\\n#endif\\n}float calculate_visibility(vec4 pos) {\\n#ifdef TERRAIN3D\\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\\n#else\\nreturn 1.0;\\n#endif\\n}float ele(vec2 pos) {\\n#ifdef TERRAIN3D\\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\\n#else\\nreturn 0.0;\\n#endif\\n}float get_elevation(vec2 pos) {\\n#ifdef TERRAIN3D\\n#ifdef GLOBE\\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\\n#endif\\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\\n#else\\nreturn 0.0;\\n#endif\\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'in vec3 v_data;flat in float v_visibility;\\n#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define mediump float radius\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define highp vec4 stroke_color\\n#pragma maplibre: define mediump float stroke_width\\n#pragma maplibre: define lowp float stroke_opacity\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize mediump float radius\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize highp vec4 stroke_color\\n#pragma maplibre: initialize mediump float stroke_width\\n#pragma maplibre: initialize lowp float stroke_opacity\\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;layout(location=0) in vec2 a_pos;out vec3 v_data;flat out float v_visibility;\\n#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define mediump float radius\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define highp vec4 stroke_color\\n#pragma maplibre: define mediump float stroke_width\\n#pragma maplibre: define lowp float stroke_opacity\\nvoid main(void) {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize mediump float radius\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize highp vec4 stroke_color\\n#pragma maplibre: initialize mediump float stroke_width\\n#pragma maplibre: initialize lowp float stroke_opacity\\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\\n#ifdef GLOBE\\nvec3 center_vector=projectToSphere(circle_center);\\n#endif\\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\\n#ifdef GLOBE\\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\\n#else\\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\\n#endif\\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\\n#ifdef GLOBE\\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\\n#else\\ngl_Position=projectTileWithElevation(corner_position,ele);\\n#endif\\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'void main() {fragColor=vec4(1.0);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform highp float u_intensity;in vec2 v_extrude;\\n#pragma maplibre: define highp float weight\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n#pragma maplibre: initialize highp float weight\\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in vec2 a_pos;out vec2 v_extrude;\\n#pragma maplibre: define highp float weight\\n#pragma maplibre: define mediump float radius\\nconst highp float ZERO=1.0/255.0/16.0;\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main(void) {\\n#pragma maplibre: initialize highp float weight\\n#pragma maplibre: initialize mediump float radius\\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\\n#ifdef GLOBE\\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\\n#else\\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(0.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform mat4 u_matrix;uniform vec2 u_world;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;uniform vec2 u_viewport_size;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;void main() {\\n#ifdef GLOBE\\ngl_Position=projectTileFor3D(a_pos,0.0);\\n#else\\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize lowp float opacity\\nfragColor=color*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;\\n#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize lowp float opacity\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'in vec2 v_pos;\\n#ifdef GLOBE\\nin float v_depth;\\n#endif\\n#pragma maplibre: define highp vec4 outline_color\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 outline_color\\n#pragma maplibre: initialize lowp float opacity\\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\\n#ifdef GLOBE\\nif (v_depth > 1.0) {discard;}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_world;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;\\n#ifdef GLOBE\\nout float v_depth;\\n#endif\\n#pragma maplibre: define highp vec4 outline_color\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 outline_color\\n#pragma maplibre: initialize lowp float opacity\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\\n#ifdef GLOBE\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\\n#ifdef GLOBE\\nin float v_depth;\\n#endif\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\\n#ifdef GLOBE\\nif (v_depth > 1.0) {discard;}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\\n#ifdef GLOBE\\nout float v_depth;\\n#endif\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\n#pragma maplibre: define lowp float pixel_ratio_from\\n#pragma maplibre: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\n#pragma maplibre: initialize lowp float pixel_ratio_from\\n#pragma maplibre: initialize lowp float pixel_ratio_to\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\\n#ifdef GLOBE\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\n#pragma maplibre: define lowp float pixel_ratio_from\\n#pragma maplibre: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\n#pragma maplibre: initialize lowp float pixel_ratio_from\\n#pragma maplibre: initialize lowp float pixel_ratio_to\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'in vec4 v_color;void main() {fragColor=v_color;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in vec4 a_normal_ed;\\n#ifdef TERRAIN3D\\nlayout(location=2) in vec2 a_centroid;\\n#endif\\nout vec4 v_color;\\n#pragma maplibre: define highp float base\\n#pragma maplibre: define highp float height\\n#pragma maplibre: define highp vec4 color\\nvoid main() {\\n#pragma maplibre: initialize highp float base\\n#pragma maplibre: initialize highp float height\\n#pragma maplibre: initialize highp vec4 color\\nvec3 normal=a_normal_ed.xyz;\\n#ifdef TERRAIN3D\\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\\n#ifdef GLOBE\\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\\n#else\\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\\n#endif\\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\\n#ifdef GLOBE\\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\\n#endif\\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\\n#pragma maplibre: define lowp float base\\n#pragma maplibre: define lowp float height\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\n#pragma maplibre: define lowp float pixel_ratio_from\\n#pragma maplibre: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float base\\n#pragma maplibre: initialize lowp float height\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\n#pragma maplibre: initialize lowp float pixel_ratio_from\\n#pragma maplibre: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in vec4 a_normal_ed;\\n#ifdef TERRAIN3D\\nlayout(location=2) in vec2 a_centroid;\\n#endif\\n#ifdef GLOBE\\nout vec3 v_sphere_pos;\\n#endif\\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\\n#pragma maplibre: define lowp float base\\n#pragma maplibre: define lowp float height\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\n#pragma maplibre: define lowp float pixel_ratio_from\\n#pragma maplibre: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float base\\n#pragma maplibre: initialize lowp float height\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\n#pragma maplibre: initialize lowp float pixel_ratio_from\\n#pragma maplibre: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\\n#ifdef TERRAIN3D\\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\\n#ifdef GLOBE\\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\\n#else\\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\\n#endif\\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\\n? a_pos\\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\\n#define PI 3.141592653589793\\n#define STANDARD 0\\n#define COMBINED 1\\n#define IGOR 2\\n#define MULTIDIRECTIONAL 3\\n#define BASIC 4\\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform lowp float u_device_pixel_ratio;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\\n#ifdef GLOBE\\nin float v_depth;\\n#endif\\n#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\\n#ifdef GLOBE\\nif (v_depth > 1.0) {discard;}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '\\n#define scale 0.015873016\\nlayout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\\n#ifdef GLOBE\\nout float v_depth;\\n#endif\\n#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define mediump float gapwidth\\n#pragma maplibre: define lowp float offset\\n#pragma maplibre: define mediump float width\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump float gapwidth\\n#pragma maplibre: initialize lowp float offset\\n#pragma maplibre: initialize mediump float width\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\\n#ifdef GLOBE\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_width2=vec2(outset,inset);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\\n#ifdef GLOBE\\nin float v_depth;\\n#endif\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\\n#ifdef GLOBE\\nif (v_depth > 1.0) {discard;}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '\\n#define scale 0.015873016\\nlayout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\\n#ifdef GLOBE\\nout float v_depth;\\n#endif\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define mediump float gapwidth\\n#pragma maplibre: define lowp float offset\\n#pragma maplibre: define mediump float width\\nvoid main() {\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump float gapwidth\\n#pragma maplibre: initialize lowp float offset\\n#pragma maplibre: initialize mediump float width\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\\n#ifdef GLOBE\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_width2=vec2(outset,inset);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;\\n#ifdef GLOBE\\nin float v_depth;\\n#endif\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\n#pragma maplibre: define lowp float pixel_ratio_from\\n#pragma maplibre: define lowp float pixel_ratio_to\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\n#pragma maplibre: initialize lowp float pixel_ratio_from\\n#pragma maplibre: initialize lowp float pixel_ratio_to\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\nclipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\\n#ifdef GLOBE\\nif (v_depth > 1.0) {discard;}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nlayout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;\\n#ifdef GLOBE\\nout float v_depth;\\n#endif\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define lowp float offset\\n#pragma maplibre: define mediump float gapwidth\\n#pragma maplibre: define mediump float width\\n#pragma maplibre: define lowp float floorwidth\\n#pragma maplibre: define lowp vec4 pattern_from\\n#pragma maplibre: define lowp vec4 pattern_to\\n#pragma maplibre: define lowp float pixel_ratio_from\\n#pragma maplibre: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize lowp float offset\\n#pragma maplibre: initialize mediump float gapwidth\\n#pragma maplibre: initialize mediump float width\\n#pragma maplibre: initialize lowp float floorwidth\\n#pragma maplibre: initialize mediump vec4 pattern_from\\n#pragma maplibre: initialize mediump vec4 pattern_to\\n#pragma maplibre: initialize lowp float pixel_ratio_from\\n#pragma maplibre: initialize lowp float pixel_ratio_to\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\\n#ifdef GLOBE\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\\n#ifdef GLOBE\\nin float v_depth;\\n#endif\\n#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define mediump float width\\n#pragma maplibre: define lowp float floorwidth\\n#pragma maplibre: define mediump vec4 dasharray_from\\n#pragma maplibre: define mediump vec4 dasharray_to\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump float width\\n#pragma maplibre: initialize lowp float floorwidth\\n#pragma maplibre: initialize mediump vec4 dasharray_from\\n#pragma maplibre: initialize mediump vec4 dasharray_to\\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\\n#ifdef GLOBE\\nif (v_depth > 1.0) {discard;}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nlayout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\\n#ifdef GLOBE\\nout float v_depth;\\n#endif\\n#pragma maplibre: define highp vec4 color\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define mediump float gapwidth\\n#pragma maplibre: define lowp float offset\\n#pragma maplibre: define mediump float width\\n#pragma maplibre: define lowp float floorwidth\\n#pragma maplibre: define mediump vec4 dasharray_from\\n#pragma maplibre: define mediump vec4 dasharray_to\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 color\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump float gapwidth\\n#pragma maplibre: initialize lowp float offset\\n#pragma maplibre: initialize mediump float width\\n#pragma maplibre: initialize lowp float floorwidth\\n#pragma maplibre: initialize mediump vec4 dasharray_from\\n#pragma maplibre: initialize mediump vec4 dasharray_to\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\\n#ifdef GLOBE\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\\n#ifdef GLOBE\\nin float v_depth;\\n#endif\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define mediump float width\\n#pragma maplibre: define lowp float floorwidth\\n#pragma maplibre: define mediump vec4 dasharray_from\\n#pragma maplibre: define mediump vec4 dasharray_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump float width\\n#pragma maplibre: initialize lowp float floorwidth\\n#pragma maplibre: initialize mediump vec4 dasharray_from\\n#pragma maplibre: initialize mediump vec4 dasharray_to\\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\\n#ifdef GLOBE\\nif (v_depth > 1.0) {discard;}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nlayout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\\n#ifdef GLOBE\\nout float v_depth;\\n#endif\\n#pragma maplibre: define lowp float blur\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define mediump float gapwidth\\n#pragma maplibre: define lowp float offset\\n#pragma maplibre: define mediump float width\\n#pragma maplibre: define lowp float floorwidth\\n#pragma maplibre: define mediump vec4 dasharray_from\\n#pragma maplibre: define mediump vec4 dasharray_to\\nvoid main() {\\n#pragma maplibre: initialize lowp float blur\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize mediump float gapwidth\\n#pragma maplibre: initialize lowp float offset\\n#pragma maplibre: initialize mediump float width\\n#pragma maplibre: initialize lowp float floorwidth\\n#pragma maplibre: initialize mediump vec4 dasharray_from\\n#pragma maplibre: initialize mediump vec4 dasharray_to\\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\\n#ifdef GLOBE\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(0.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\\n#ifdef GLOBE\\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\\n#endif\\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec4 a_pos_offset;layout(location=1) in vec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;out vec2 v_tex;flat out float v_total_opacity;\\n#pragma maplibre: define lowp float opacity\\nvoid main() {\\n#pragma maplibre: initialize lowp float opacity\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\\n#ifdef GLOBE\\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\\n#endif\\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#define SDF_PX 8.0\\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\\n#pragma maplibre: define highp vec4 fill_color\\n#pragma maplibre: define highp vec4 halo_color\\n#pragma maplibre: define lowp float halo_width\\n#pragma maplibre: define lowp float halo_blur\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 fill_color\\n#pragma maplibre: initialize highp vec4 halo_color\\n#pragma maplibre: initialize lowp float halo_width\\n#pragma maplibre: initialize lowp float halo_blur\\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec4 a_pos_offset;layout(location=1) in vec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;out vec2 v_data0;out vec3 v_data1;\\n#pragma maplibre: define highp vec4 fill_color\\n#pragma maplibre: define highp vec4 halo_color\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define lowp float halo_width\\n#pragma maplibre: define lowp float halo_blur\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 fill_color\\n#pragma maplibre: initialize highp vec4 halo_color\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize lowp float halo_width\\n#pragma maplibre: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\\n#ifdef GLOBE\\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\\n#endif\\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#define SDF_PX 8.0\\n#define SDF 1.0\\n#define ICON 0.0\\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;\\n#pragma maplibre: define highp vec4 fill_color\\n#pragma maplibre: define highp vec4 halo_color\\n#pragma maplibre: define lowp float halo_width\\n#pragma maplibre: define lowp float halo_blur\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 fill_color\\n#pragma maplibre: initialize highp vec4 halo_color\\n#pragma maplibre: initialize lowp float halo_width\\n#pragma maplibre: initialize lowp float halo_blur\\nfloat total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\\n#ifdef OVERDRAW_INSPECTOR\\nfragColor=vec4(1.0);\\n#endif\\n}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec4 a_pos_offset;layout(location=1) in vec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;\\n#pragma maplibre: define highp vec4 fill_color\\n#pragma maplibre: define highp vec4 halo_color\\n#pragma maplibre: define lowp float opacity\\n#pragma maplibre: define lowp float halo_width\\n#pragma maplibre: define lowp float halo_blur\\nvoid main() {\\n#pragma maplibre: initialize highp vec4 fill_color\\n#pragma maplibre: initialize highp vec4 halo_color\\n#pragma maplibre: initialize lowp float opacity\\n#pragma maplibre: initialize lowp float halo_width\\n#pragma maplibre: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\\n#ifdef GLOBE\\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\\n#endif\\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '\\nvoid clipAntimeridian() {}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#define GLOBE_RADIUS 6371008.8\\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy\\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform bool u_projection_clip_antimeridian;in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default '#ifdef GL_ES\\nprecision highp float;\\n#endif\\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}';\n","// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.\nexport default 'layout(location=0) in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}';\n","// Disable Flow annotations here because Flow doesn't support importing GLSL files\n\nimport preludeFrag from './glsl/_prelude.fragment.glsl.g.ts';\nimport preludeVert from './glsl/_prelude.vertex.glsl.g.ts';\nimport backgroundFrag from './glsl/background.fragment.glsl.g.ts';\nimport backgroundVert from './glsl/background.vertex.glsl.g.ts';\nimport backgroundPatternFrag from './glsl/background_pattern.fragment.glsl.g.ts';\nimport backgroundPatternVert from './glsl/background_pattern.vertex.glsl.g.ts';\nimport circleFrag from './glsl/circle.fragment.glsl.g.ts';\nimport circleVert from './glsl/circle.vertex.glsl.g.ts';\nimport clippingMaskFrag from './glsl/clipping_mask.fragment.glsl.g.ts';\nimport clippingMaskVert from './glsl/clipping_mask.vertex.glsl.g.ts';\nimport heatmapFrag from './glsl/heatmap.fragment.glsl.g.ts';\nimport heatmapVert from './glsl/heatmap.vertex.glsl.g.ts';\nimport heatmapTextureFrag from './glsl/heatmap_texture.fragment.glsl.g.ts';\nimport heatmapTextureVert from './glsl/heatmap_texture.vertex.glsl.g.ts';\nimport collisionBoxFrag from './glsl/collision_box.fragment.glsl.g.ts';\nimport collisionBoxVert from './glsl/collision_box.vertex.glsl.g.ts';\nimport collisionCircleFrag from './glsl/collision_circle.fragment.glsl.g.ts';\nimport collisionCircleVert from './glsl/collision_circle.vertex.glsl.g.ts';\nimport colorReliefFrag from './glsl/color_relief.fragment.glsl.g.ts';\nimport colorReliefVert from './glsl/color_relief.vertex.glsl.g.ts';\nimport debugFrag from './glsl/debug.fragment.glsl.g.ts';\nimport debugVert from './glsl/debug.vertex.glsl.g.ts';\nimport depthVert from './glsl/depth.vertex.glsl.g.ts';\nimport fillFrag from './glsl/fill.fragment.glsl.g.ts';\nimport fillVert from './glsl/fill.vertex.glsl.g.ts';\nimport fillOutlineFrag from './glsl/fill_outline.fragment.glsl.g.ts';\nimport fillOutlineVert from './glsl/fill_outline.vertex.glsl.g.ts';\nimport fillOutlinePatternFrag from './glsl/fill_outline_pattern.fragment.glsl.g.ts';\nimport fillOutlinePatternVert from './glsl/fill_outline_pattern.vertex.glsl.g.ts';\nimport fillPatternFrag from './glsl/fill_pattern.fragment.glsl.g.ts';\nimport fillPatternVert from './glsl/fill_pattern.vertex.glsl.g.ts';\nimport fillExtrusionFrag from './glsl/fill_extrusion.fragment.glsl.g.ts';\nimport fillExtrusionVert from './glsl/fill_extrusion.vertex.glsl.g.ts';\nimport fillExtrusionPatternFrag from './glsl/fill_extrusion_pattern.fragment.glsl.g.ts';\nimport fillExtrusionPatternVert from './glsl/fill_extrusion_pattern.vertex.glsl.g.ts';\nimport hillshadePrepareFrag from './glsl/hillshade_prepare.fragment.glsl.g.ts';\nimport hillshadePrepareVert from './glsl/hillshade_prepare.vertex.glsl.g.ts';\nimport hillshadeFrag from './glsl/hillshade.fragment.glsl.g.ts';\nimport hillshadeVert from './glsl/hillshade.vertex.glsl.g.ts';\nimport lineFrag from './glsl/line.fragment.glsl.g.ts';\nimport lineVert from './glsl/line.vertex.glsl.g.ts';\nimport lineGradientFrag from './glsl/line_gradient.fragment.glsl.g.ts';\nimport lineGradientVert from './glsl/line_gradient.vertex.glsl.g.ts';\nimport linePatternFrag from './glsl/line_pattern.fragment.glsl.g.ts';\nimport linePatternVert from './glsl/line_pattern.vertex.glsl.g.ts';\nimport lineSDFFrag from './glsl/line_sdf.fragment.glsl.g.ts';\nimport lineSDFVert from './glsl/line_sdf.vertex.glsl.g.ts';\nimport lineGradientSDFFrag from './glsl/line_gradient_sdf.fragment.glsl.g.ts';\nimport lineGradientSDFVert from './glsl/line_gradient_sdf.vertex.glsl.g.ts';\nimport layerOpacityFrag from './glsl/layer_opacity.fragment.glsl.g.ts';\nimport layerOpacityVert from './glsl/layer_opacity.vertex.glsl.g.ts';\nimport rasterFrag from './glsl/raster.fragment.glsl.g.ts';\nimport rasterVert from './glsl/raster.vertex.glsl.g.ts';\nimport symbolIconFrag from './glsl/symbol_icon.fragment.glsl.g.ts';\nimport symbolIconVert from './glsl/symbol_icon.vertex.glsl.g.ts';\nimport symbolSDFFrag from './glsl/symbol_sdf.fragment.glsl.g.ts';\nimport symbolSDFVert from './glsl/symbol_sdf.vertex.glsl.g.ts';\nimport symbolTextAndIconFrag from './glsl/symbol_text_and_icon.fragment.glsl.g.ts';\nimport symbolTextAndIconVert from './glsl/symbol_text_and_icon.vertex.glsl.g.ts';\nimport terrainDepthFrag from './glsl/terrain_depth.fragment.glsl.g.ts';\nimport terrainCoordsFrag from './glsl/terrain_coords.fragment.glsl.g.ts';\nimport terrainFrag from './glsl/terrain.fragment.glsl.g.ts';\nimport terrainVert from './glsl/terrain.vertex.glsl.g.ts';\nimport terrainVertDepth from './glsl/terrain_depth.vertex.glsl.g.ts';\nimport terrainVertCoords from './glsl/terrain_coords.vertex.glsl.g.ts';\nimport projectionMercatorVert from './glsl/_projection_mercator.vertex.glsl.g.ts';\nimport projectionMercatorFrag from './glsl/_projection_mercator.fragment.glsl.g.ts';\nimport projectionGlobeVert from './glsl/_projection_globe.vertex.glsl.g.ts';\nimport projectionGlobeFrag from './glsl/_projection_globe.fragment.glsl.g.ts';\nimport atmosphereFrag from './glsl/atmosphere.fragment.glsl.g.ts';\nimport atmosphereVert from './glsl/atmosphere.vertex.glsl.g.ts';\nimport skyFrag from './glsl/sky.fragment.glsl.g.ts';\nimport skyVert from './glsl/sky.vertex.glsl.g.ts';\n\nexport type PreparedShader = {\n    fragmentSource: string;\n    vertexSource: string;\n    staticAttributes: string[];\n    staticUniforms: string[];\n};\n\nexport const shaders: {\n    prelude: PreparedShader;\n    projectionMercator: PreparedShader;\n    projectionGlobe: PreparedShader;\n    background: PreparedShader;\n    backgroundPattern: PreparedShader;\n    circle: PreparedShader;\n    clippingMask: PreparedShader;\n    heatmap: PreparedShader;\n    heatmapTexture: PreparedShader;\n    collisionBox: PreparedShader;\n    collisionCircle: PreparedShader;\n    colorRelief: PreparedShader;\n    debug: PreparedShader;\n    depth: PreparedShader;\n    fill: PreparedShader;\n    fillOutline: PreparedShader;\n    fillOutlinePattern: PreparedShader;\n    fillPattern: PreparedShader;\n    fillExtrusion: PreparedShader;\n    fillExtrusionPattern: PreparedShader;\n    hillshadePrepare: PreparedShader;\n    hillshade: PreparedShader;\n    line: PreparedShader;\n    lineGradient: PreparedShader;\n    linePattern: PreparedShader;\n    lineSDF: PreparedShader;\n    lineGradientSDF: PreparedShader;\n    layerOpacity: PreparedShader;\n    raster: PreparedShader;\n    symbolIcon: PreparedShader;\n    symbolSDF: PreparedShader;\n    symbolTextAndIcon: PreparedShader;\n    terrain: PreparedShader;\n    terrainDepth: PreparedShader;\n    terrainCoords: PreparedShader;\n    atmosphere: PreparedShader;\n    sky: PreparedShader;\n} = {\n    prelude: prepare(preludeFrag, preludeVert),\n    projectionMercator: prepare(projectionMercatorFrag, projectionMercatorVert),\n    projectionGlobe: prepare(projectionGlobeFrag, projectionGlobeVert),\n    background: prepare(backgroundFrag, backgroundVert),\n    backgroundPattern: prepare(backgroundPatternFrag, backgroundPatternVert),\n    circle: prepare(circleFrag, circleVert),\n    clippingMask: prepare(clippingMaskFrag, clippingMaskVert),\n    heatmap: prepare(heatmapFrag, heatmapVert),\n    heatmapTexture: prepare(heatmapTextureFrag, heatmapTextureVert),\n    collisionBox: prepare(collisionBoxFrag, collisionBoxVert),\n    collisionCircle: prepare(collisionCircleFrag, collisionCircleVert),\n    colorRelief: prepare(colorReliefFrag, colorReliefVert),\n    debug: prepare(debugFrag, debugVert),\n    depth: prepare(clippingMaskFrag, depthVert),\n    fill: prepare(fillFrag, fillVert),\n    fillOutline: prepare(fillOutlineFrag, fillOutlineVert),\n    fillOutlinePattern: prepare(fillOutlinePatternFrag, fillOutlinePatternVert),\n    fillPattern: prepare(fillPatternFrag, fillPatternVert),\n    fillExtrusion: prepare(fillExtrusionFrag, fillExtrusionVert),\n    fillExtrusionPattern: prepare(fillExtrusionPatternFrag, fillExtrusionPatternVert),\n    hillshadePrepare: prepare(hillshadePrepareFrag, hillshadePrepareVert),\n    hillshade: prepare(hillshadeFrag, hillshadeVert),\n    line: prepare(lineFrag, lineVert),\n    lineGradient: prepare(lineGradientFrag, lineGradientVert),\n    linePattern: prepare(linePatternFrag, linePatternVert),\n    lineSDF: prepare(lineSDFFrag, lineSDFVert),\n    lineGradientSDF: prepare(lineGradientSDFFrag, lineGradientSDFVert),\n    layerOpacity: prepare(layerOpacityFrag, layerOpacityVert),\n    raster: prepare(rasterFrag, rasterVert),\n    symbolIcon: prepare(symbolIconFrag, symbolIconVert),\n    symbolSDF: prepare(symbolSDFFrag, symbolSDFVert),\n    symbolTextAndIcon: prepare(symbolTextAndIconFrag, symbolTextAndIconVert),\n    terrain: prepare(terrainFrag, terrainVert),\n    terrainDepth: prepare(terrainDepthFrag, terrainVertDepth),\n    terrainCoords: prepare(terrainCoordsFrag, terrainVertCoords),\n    atmosphere: prepare(atmosphereFrag, atmosphereVert),\n    sky: prepare(skyFrag, skyVert),\n};\n\n/** Expand #pragmas to #ifdefs, extract attributes and uniforms */\nfunction prepare(fragmentSource: string, vertexSource: string): PreparedShader {\n    const re = /#pragma maplibre: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g;\n\n    const vertexAttributes = vertexSource.match(/in ([\\w]+) ([\\w]+)/g);\n    const fragmentUniforms = fragmentSource.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g);\n    const vertexUniforms = vertexSource.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g);\n    const shaderUniforms = vertexUniforms ? vertexUniforms.concat(fragmentUniforms) : fragmentUniforms;\n\n    const staticLayoutCount = vertexAttributes ? vertexAttributes.length : 0;\n    let locationCounter = staticLayoutCount;\n\n    const fragmentPragmas = {};\n\n    fragmentSource = fragmentSource.replace(re, (match, operation, precision, type, name) => {\n        fragmentPragmas[name] = true;\n        if (operation === 'define') {\n            return `\n#ifndef HAS_UNIFORM_u_${name}\nin ${precision} ${type} ${name};\n#else\nuniform ${precision} ${type} u_${name};\n#endif\n`;\n        } else /* if (operation === 'initialize') */ {\n            return `\n#ifdef HAS_UNIFORM_u_${name}\n    ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n        }\n    });\n\n    vertexSource = vertexSource.replace(re, (match, operation, precision, type, name) => {\n        const attrType = type === 'float' ? 'vec2' : 'vec4';\n        const unpackType = name.match(/color/) ? 'color' : attrType;\n\n        if (fragmentPragmas[name]) {\n            if (operation === 'define') {\n                const loc = locationCounter++;\n                return `\n#ifndef HAS_UNIFORM_u_${name}\nuniform lowp float u_${name}_t;\nlayout(location = ${loc}) in ${precision} ${attrType} a_${name};\nout ${precision} ${type} ${name};\n#else\nuniform ${precision} ${type} u_${name};\n#endif\n`;\n            } else /* if (operation === 'initialize') */ {\n                if (unpackType === 'vec4') {\n                    // vec4 attributes are only used for cross-faded properties, and are not packed\n                    return `\n#ifndef HAS_UNIFORM_u_${name}\n    ${name} = a_${name};\n#else\n    ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n                } else {\n                    return `\n#ifndef HAS_UNIFORM_u_${name}\n    ${name} = unpack_mix_${unpackType}(a_${name}, u_${name}_t);\n#else\n    ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n                }\n            }\n        } else {\n            if (operation === 'define') {\n                const loc = locationCounter++;\n                return `\n#ifndef HAS_UNIFORM_u_${name}\nuniform lowp float u_${name}_t;\nlayout(location = ${loc}) in ${precision} ${attrType} a_${name};\n#else\nuniform ${precision} ${type} u_${name};\n#endif\n`;\n            } else /* if (operation === 'initialize') */ {\n                if (unpackType === 'vec4') {\n                    // vec4 attributes are only used for cross-faded properties, and are not packed\n                    return `\n#ifndef HAS_UNIFORM_u_${name}\n    ${precision} ${type} ${name} = a_${name};\n#else\n    ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n                } else /* */ {\n                    return `\n#ifndef HAS_UNIFORM_u_${name}\n    ${precision} ${type} ${name} = unpack_mix_${unpackType}(a_${name}, u_${name}_t);\n#else\n    ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n                }\n            }\n        }\n    });\n\n    return {fragmentSource, vertexSource, staticAttributes: vertexAttributes, staticUniforms: shaderUniforms};\n}\n\n","import {type SegmentVector} from '../data/segment.ts';\nimport {type VertexBuffer} from '../webgl/vertex_buffer.ts';\nimport {type IndexBuffer} from '../webgl/index_buffer.ts';\n\nexport class Mesh {\n    vertexBuffer: VertexBuffer;\n    indexBuffer: IndexBuffer;\n    segments: SegmentVector;\n\n    constructor(vertexBuffer: VertexBuffer, indexBuffer: IndexBuffer, segments: SegmentVector) {\n        this.vertexBuffer = vertexBuffer;\n        this.indexBuffer = indexBuffer;\n        this.segments = segments;\n    }\n\n    destroy(): void {\n        this.vertexBuffer.destroy();\n        this.indexBuffer.destroy();\n        this.segments.destroy();\n\n        this.vertexBuffer = null;\n        this.indexBuffer = null;\n        this.segments = null;\n    }\n}\n","import {createLayout, type StructArrayLayout} from '../util/struct_array.ts';\n\nconst posAttributes: StructArrayLayout = createLayout([\n    {name: 'a_pos', type: 'Int16', components: 2}\n]);\n\nexport default posAttributes;\n","import type {Projection, TileMeshUsage} from './projection.ts';\nimport type {CanonicalTileID} from '../../tile/tile_id.ts';\nimport {EXTENT} from '../../data/extent.ts';\nimport {type PreparedShader, shaders} from '../../shaders/shaders.ts';\nimport type {Context} from '../../webgl/context.ts';\nimport {Mesh} from '../../render/mesh.ts';\nimport {PosArray, TriangleIndexArray} from '../../data/array_types.g.ts';\nimport {SegmentVector} from '../../data/segment.ts';\nimport posAttributes from '../../data/pos_attributes.ts';\nimport {SubdivisionGranularitySetting} from '../../render/subdivision_granularity_settings.ts';\n\nexport const MercatorShaderDefine = '#define PROJECTION_MERCATOR';\nexport const MercatorShaderVariantKey = 'mercator';\n\nexport class MercatorProjection implements Projection {\n    private _cachedMesh: Mesh = null;\n\n    get name(): 'mercator' {\n        return 'mercator';\n    }\n\n    get useSubdivision(): boolean {\n        // Mercator never uses subdivision.\n        return false;\n    }\n\n    get shaderVariantName(): string {\n        return MercatorShaderVariantKey;\n    }\n\n    get shaderDefine(): string {\n        return MercatorShaderDefine;\n    }\n\n    get shaderPreludeCode(): PreparedShader {\n        return shaders.projectionMercator;\n    }\n\n    get vertexShaderPreludeCode(): string {\n        return shaders.projectionMercator.vertexSource;\n    }\n\n    get subdivisionGranularity(): SubdivisionGranularitySetting {\n        return SubdivisionGranularitySetting.noSubdivision;\n    }\n\n    get useGlobeControls(): boolean {\n        return false;\n    }\n\n    get transitionState(): number {\n        return 0;\n    }\n\n    public destroy(): void {\n        // Do nothing.\n    }\n\n    public getMeshFromTileID(context: Context, _tileID: CanonicalTileID, _hasBorder: boolean, _allowPoles: boolean, _usage: TileMeshUsage): Mesh {\n        if (this._cachedMesh) {\n            return this._cachedMesh;\n        }\n\n        // The parameters tileID, hasBorder and allowPoles are all ignored on purpose for mercator meshes.\n\n        const tileExtentArray = new PosArray();\n        tileExtentArray.emplaceBack(0, 0);\n        tileExtentArray.emplaceBack(EXTENT, 0);\n        tileExtentArray.emplaceBack(0, EXTENT);\n        tileExtentArray.emplaceBack(EXTENT, EXTENT);\n        const tileExtentBuffer = context.createVertexBuffer(tileExtentArray, posAttributes.members);\n        const tileExtentSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n\n        const quadTriangleIndices = new TriangleIndexArray();\n        quadTriangleIndices.emplaceBack(1, 0, 2);\n        quadTriangleIndices.emplaceBack(1, 2, 3);\n        const quadTriangleIndexBuffer = context.createIndexBuffer(quadTriangleIndices);\n\n        this._cachedMesh = new Mesh(tileExtentBuffer, quadTriangleIndexBuffer, tileExtentSegments);\n        return this._cachedMesh;\n    }\n\n    public recalculate(): void {\n        // Do nothing.\n    }\n\n    public hasTransition(): boolean {\n        return false;\n    }\n}\n","import {interpolates} from '@maplibre/maplibre-gl-style-spec';\nimport Point from '@mapbox/point-geometry';\nimport {clamp, type Complete, type RequireAtLeastOne} from '../util/util.ts';\n\n/**\n * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.\n * This shifts the apparent center or the vanishing point of the map. This is useful for adding floating UI elements\n * on top of the map and having the vanishing point shift as UI elements resize.\n *\n * @group Geography and Geometry\n */\nexport class EdgeInsets {\n    /**\n     * @defaultValue 0\n     */\n    top: number;\n    /**\n     * @defaultValue 0\n     */\n    bottom: number;\n    /**\n     * @defaultValue 0\n     */\n    left: number;\n    /**\n     * @defaultValue 0\n     */\n    right: number;\n\n    constructor(top: number = 0, bottom: number = 0, left: number = 0, right: number = 0) {\n        if (isNaN(top) || top < 0 ||\n            isNaN(bottom) || bottom < 0 ||\n            isNaN(left) || left < 0 ||\n            isNaN(right) || right < 0\n        ) {\n            throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');\n        }\n\n        this.top = top;\n        this.bottom = bottom;\n        this.left = left;\n        this.right = right;\n    }\n\n    /**\n     * Interpolates the inset in-place.\n     * This maintains the current inset value for any inset not present in `target`.\n     * @param start - interpolation start\n     * @param target - interpolation target\n     * @param t - interpolation step/weight\n     * @returns the insets\n     */\n    interpolate(start: PaddingOptions | EdgeInsets, target: PaddingOptions, t: number): this {\n        if (target.top != null && start.top != null) this.top = interpolates.number(start.top, target.top, t);\n        if (target.bottom != null && start.bottom != null) this.bottom = interpolates.number(start.bottom, target.bottom, t);\n        if (target.left != null && start.left != null) this.left = interpolates.number(start.left, target.left, t);\n        if (target.right != null && start.right != null) this.right = interpolates.number(start.right, target.right, t);\n\n        return this;\n    }\n\n    /**\n     * Utility method that computes the new apparent center or vanishing point after applying insets.\n     * This is in pixels and with the top left being (0.0) and +y being downwards.\n     *\n     * @param width - the width\n     * @param height - the height\n     * @returns the point\n     */\n    getCenter(width: number, height: number): Point {\n        // Clamp insets so they never overflow width/height and always calculate a valid center\n        const x = clamp((this.left + width - this.right) / 2, 0, width);\n        const y = clamp((this.top + height - this.bottom) / 2, 0, height);\n\n        return new Point(x, y);\n    }\n\n    equals(other: PaddingOptions): boolean {\n        return this.top === other.top &&\n            this.bottom === other.bottom &&\n            this.left === other.left &&\n            this.right === other.right;\n    }\n\n    clone(): EdgeInsets {\n        return new EdgeInsets(this.top, this.bottom, this.left, this.right);\n    }\n\n    /**\n     * Returns the current state as json, useful when you want to have a\n     * read-only representation of the inset.\n     *\n     * @returns state as json\n     */\n    toJSON(): Complete<PaddingOptions> {\n        return {\n            top: this.top,\n            bottom: this.bottom,\n            left: this.left,\n            right: this.right\n        };\n    }\n}\n\n/**\n * Options for setting padding on calls to methods such as {@link Map.fitBounds}, {@link Map.fitScreenCoordinates}, and {@link Map.setPadding}. Adjust these options to set the amount of padding in pixels added to the edges of the canvas. Set a uniform padding on all edges or individual values for each edge. All properties of this object must be\n * non-negative integers.\n *\n * @group Geography and Geometry\n *\n * @example\n * ```ts\n * let bbox = [[-79, 43], [-73, 45]];\n * map.fitBounds(bbox, {\n *   padding: {top: 10, bottom:25, left: 15, right: 5}\n * });\n * ```\n *\n * @example\n * ```ts\n * let bbox = [[-79, 43], [-73, 45]];\n * map.fitBounds(bbox, {\n *   padding: 20\n * });\n * ```\n * @see [Fit to the bounds of a LineString](https://maplibre.org/maplibre-gl-js/docs/examples/zoomto-linestring/)\n * @see [Fit a map to a bounding box](https://maplibre.org/maplibre-gl-js/docs/examples/fitbounds/)\n */\nexport type PaddingOptions = RequireAtLeastOne<{\n    /**\n     * Padding in pixels from the top of the map canvas.\n     */\n    top: number;\n    /**\n     * Padding in pixels from the bottom of the map canvas.\n     */\n    bottom: number;\n    /**\n     * Padding in pixels from the left of the map canvas.\n     */\n    right: number;\n    /**\n     * Padding in pixels from the right of the map canvas.\n     */\n    left: number;\n}>;\n","import {LngLat, type LngLatLike} from './lng_lat.ts';\nimport {LngLatBounds} from './lng_lat_bounds.ts';\nimport Point from '@mapbox/point-geometry';\nimport {wrap, clamp, degreesToRadians, radiansToDegrees, zoomScale, MAX_VALID_LATITUDE, scaleZoom} from '../util/util.ts';\nimport {mat4, mat2} from 'gl-matrix';\nimport {EdgeInsets} from './edge_insets.ts';\nimport {altitudeFromMercatorZ, MercatorCoordinate, mercatorZfromAltitude} from './mercator_coordinate.ts';\nimport {cameraMercatorCoordinateFromCenterAndRotation, cameraDirectionFromPitchBearing} from './projection/mercator_utils.ts';\nimport {EXTENT} from '../data/extent.ts';\n\nimport type {PaddingOptions} from './edge_insets.ts';\nimport type {IReadonlyTransform, ITransformGetters, TransformConstrainFunction} from './transform_interface.ts';\nimport {Bounds} from './bounds.ts';\n/**\n * If a path crossing the antimeridian would be shorter, extend the final coordinate so that\n * interpolating between the two endpoints will cross it.\n * @param center - The LngLat object of the desired center. This object will be mutated.\n */\nexport function normalizeCenter(tr: IReadonlyTransform, center: LngLat): void {\n    if (!tr.renderWorldCopies || tr.lngRange) return;\n    const delta = center.lng - tr.center.lng;\n    center.lng +=\n        delta > 180 ? -360 :\n            delta < -180 ? 360 : 0;\n}\n\nexport type UnwrappedTileIDType = {\n    /**\n     * Tile wrap: 0 for the \"main\" world,\n     * negative values for worlds left of the main,\n     * positive values for worlds right of the main.\n     */\n    wrap?: number;\n    canonical: {\n        /**\n         * Tile X coordinate, in range 0..(z^2)-1\n         */\n        x: number;\n        /**\n         * Tile Y coordinate, in range 0..(z^2)-1\n         */\n        y: number;\n        /**\n         * Tile zoom level.\n         */\n        z: number;\n    };\n};\n\nexport type TransformHelperCallbacks = {\n    /**\n     * The transform's default getter of center lngLat and zoom to ensure that\n     * 1) everything beyond the bounds is excluded\n     * 2) a given lngLat is as near the center as possible\n     * Bounds are those set by maxBounds or North & South \"Poles\" and, if only 1 globe is displayed, antimeridian.\n     */\n    defaultConstrain: TransformConstrainFunction;\n\n    /**\n     * Updates the underlying transform's internal matrices.\n     */\n    calcMatrices: () => void;\n};\n\nexport type TransformOptions = {\n    /**\n     * The minimum zoom level of the map. Users cannot zoom out beyond this level. (0–24)\n     * @defaultValue 0\n     */\n    minZoom?: number;\n    /**\n     * The maximum zoom level of the map. Users cannot zoom in beyond this level. (0–24)\n     * @defaultValue 22\n     */\n    maxZoom?: number;\n    /**\n     * The minimum pitch of the map.\n     */\n    minPitch?: number;\n    /**\n     * The maximum pitch of the map.\n     */\n    maxPitch?: number;\n    /**\n     * Whether to render multiple copies of the world side by side in the map.\n     */\n    renderWorldCopies?: boolean;\n    /**\n     * An override of the transform's default constraining function for respecting its longitude and latitude bounds.\n     */\n    constrainOverride?: TransformConstrainFunction | null;\n};\n\nfunction getTileZoom(zoom: number): number {\n    return Math.max(0, Math.floor(zoom));\n}\n\n/**\n * @internal\n * This class stores all values that define a transform's state,\n * such as center, zoom, minZoom, etc.\n * This can be used as a helper for implementing the ITransform interface.\n */\nexport class TransformHelper implements ITransformGetters {\n    private _callbacks: TransformHelperCallbacks;\n\n    _tileSize: number; // constant\n    _tileZoom: number; // integer zoom level for tiles\n    _lngRange: [number, number];\n    _latRange: [number, number];\n    _scale: number; // computed based on zoom\n    _width: number;\n    _height: number;\n    /**\n     * Vertical field of view in radians.\n     */\n    _fovInRadians: number;\n    /**\n     * This transform's bearing in radians.\n     */\n    _bearingInRadians: number;\n    /**\n     * Pitch in radians.\n     */\n    _pitchInRadians: number;\n    /**\n     * Roll in radians.\n     */\n    _rollInRadians: number;\n    _zoom: number;\n    _renderWorldCopies: boolean;\n    _minZoom: number;\n    _maxZoom: number;\n    _minPitch: number;\n    _maxPitch: number;\n    _center: LngLat;\n    _elevation: number;\n    _minElevationForCurrentTile: number;\n    _pixelPerMeter: number;\n    _edgeInsets: EdgeInsets;\n    _unmodified: boolean;\n\n    _constraining: boolean;\n    _rotationMatrix: mat2;\n    _pixelsToGLUnits: [number, number];\n    _pixelsToClipSpaceMatrix: mat4;\n    _clipSpaceToPixelsMatrix: mat4;\n    _cameraToCenterDistance: number;\n\n    _nearZ: number;\n    _farZ: number;\n    _autoCalculateNearFarZ: boolean;\n\n    _constrainOverride: TransformConstrainFunction;\n\n    constructor(callbacks: TransformHelperCallbacks, options?: TransformOptions) {\n        this._callbacks = callbacks;\n        this._tileSize = 512; // constant\n\n        this._renderWorldCopies = options?.renderWorldCopies === undefined ? true : !!options?.renderWorldCopies;\n        this._minZoom = options?.minZoom || 0;\n        this._maxZoom = options?.maxZoom || 22;\n\n        this._minPitch = (options?.minPitch === undefined || options?.minPitch === null) ? 0 : options?.minPitch;\n        this._maxPitch = (options?.maxPitch === undefined || options?.maxPitch === null) ? 60 : options?.maxPitch;\n\n        this._constrainOverride = options?.constrainOverride ?? null;\n\n        this.setMaxBounds();\n\n        this._width = 0;\n        this._height = 0;\n        this._center = new LngLat(0, 0);\n        this._elevation = 0;\n        this._zoom = 0;\n        this._tileZoom = getTileZoom(this._zoom);\n        this._scale = zoomScale(this._zoom);\n        this._bearingInRadians = 0;\n        this._fovInRadians = 0.6435011087932844;\n        this._pitchInRadians = 0;\n        this._rollInRadians = 0;\n        this._unmodified = true;\n        this._edgeInsets = new EdgeInsets();\n        this._minElevationForCurrentTile = 0;\n        this._autoCalculateNearFarZ = true;\n    }\n\n    public apply(thatI: ITransformGetters, constrain: boolean, forceOverrideZ?: boolean): void {\n        this._constrainOverride = thatI.constrainOverride;\n        this._latRange = thatI.latRange;\n        this._lngRange = thatI.lngRange;\n        this._width = thatI.width;\n        this._height = thatI.height;\n        this._center = thatI.center;\n        this._elevation = thatI.elevation;\n        this._minElevationForCurrentTile = thatI.minElevationForCurrentTile;\n        this._zoom = thatI.zoom;\n        this._tileZoom = getTileZoom(this._zoom);\n        this._scale = zoomScale(this._zoom);\n        this._bearingInRadians = thatI.bearingInRadians;\n        this._fovInRadians = thatI.fovInRadians;\n        this._pitchInRadians = thatI.pitchInRadians;\n        this._rollInRadians = thatI.rollInRadians;\n        this._unmodified = thatI.unmodified;\n        this._edgeInsets = new EdgeInsets(thatI.padding.top, thatI.padding.bottom, thatI.padding.left, thatI.padding.right);\n        this._minZoom = thatI.minZoom;\n        this._maxZoom = thatI.maxZoom;\n        this._minPitch = thatI.minPitch;\n        this._maxPitch = thatI.maxPitch;\n        this._renderWorldCopies = thatI.renderWorldCopies;\n        this._cameraToCenterDistance = thatI.cameraToCenterDistance;\n        this._nearZ = thatI.nearZ;\n        this._farZ = thatI.farZ;\n        this._autoCalculateNearFarZ = !forceOverrideZ && thatI.autoCalculateNearFarZ;\n        if (constrain) {\n            this.constrainInternal();\n        }\n        this._calcMatrices();\n    }\n\n    get pixelsToClipSpaceMatrix(): mat4 { return this._pixelsToClipSpaceMatrix; }\n    get clipSpaceToPixelsMatrix(): mat4 { return this._clipSpaceToPixelsMatrix; }\n\n    get minElevationForCurrentTile(): number { return this._minElevationForCurrentTile; }\n    setMinElevationForCurrentTile(ele: number): void {\n        this._minElevationForCurrentTile = ele;\n    }\n\n    get tileSize(): number { return this._tileSize; }\n    get tileZoom(): number { return this._tileZoom; }\n    get scale(): number { return this._scale; }\n\n    /**\n     * Gets the transform's width in pixels. Use {@link resize} to set the transform's size.\n     */\n    get width(): number { return this._width; }\n\n    /**\n     * Gets the transform's height in pixels. Use {@link resize} to set the transform's size.\n     */\n    get height(): number { return this._height; }\n\n    /**\n     * Gets the transform's bearing in radians.\n     */\n    get bearingInRadians(): number { return this._bearingInRadians; }\n\n    get lngRange(): [number, number] { return this._lngRange; }\n    get latRange(): [number, number] { return this._latRange; }\n\n    get pixelsToGLUnits(): [number, number] { return this._pixelsToGLUnits; }\n\n    get minZoom(): number { return this._minZoom; }\n    setMinZoom(zoom: number): void {\n        if (this._minZoom === zoom) return;\n        this._minZoom = zoom;\n        this.setZoom(this.applyConstrain(this._center, this.zoom).zoom);\n    }\n\n    get maxZoom(): number { return this._maxZoom; }\n    setMaxZoom(zoom: number): void {\n        if (this._maxZoom === zoom) return;\n        this._maxZoom = zoom;\n        this.setZoom(this.applyConstrain(this._center, this.zoom).zoom);\n    }\n\n    get minPitch(): number { return this._minPitch; }\n    setMinPitch(pitch: number): void {\n        if (this._minPitch === pitch) return;\n        this._minPitch = pitch;\n        this.setPitch(Math.max(this.pitch, pitch));\n    }\n\n    get maxPitch(): number { return this._maxPitch; }\n    setMaxPitch(pitch: number): void {\n        if (this._maxPitch === pitch) return;\n        this._maxPitch = pitch;\n        this.setPitch(Math.min(this.pitch, pitch));\n    }\n\n    get renderWorldCopies(): boolean { return this._renderWorldCopies; }\n    setRenderWorldCopies(renderWorldCopies: boolean): void {\n        if (renderWorldCopies === undefined) {\n            renderWorldCopies = true;\n        } else if (renderWorldCopies === null) {\n            renderWorldCopies = false;\n        }\n\n        this._renderWorldCopies = renderWorldCopies;\n    }\n\n    get constrainOverride(): TransformConstrainFunction { return this._constrainOverride; }\n    setConstrainOverride(constrain?: TransformConstrainFunction | null): void {\n        if (constrain === undefined) constrain = null;\n        if (this._constrainOverride === constrain) return;\n        this._constrainOverride = constrain;\n        this.constrainInternal();\n        this._calcMatrices();\n    }\n\n    get worldSize(): number {\n        return this._tileSize * this._scale;\n    }\n\n    get centerOffset(): Point {\n        return this.centerPoint._sub(this.size._div(2));\n    }\n\n    /**\n     * Gets the transform's dimensions packed into a Point object.\n     */\n    get size(): Point {\n        return new Point(this._width, this._height);\n    }\n\n    get bearing(): number {\n        return this._bearingInRadians / Math.PI * 180;\n    }\n    setBearing(bearing: number): void {\n        const b = wrap(bearing, -180, 180) * Math.PI / 180;\n        if (this._bearingInRadians === b) return;\n        this._unmodified = false;\n        this._bearingInRadians = b;\n        this._calcMatrices();\n\n        // 2x2 matrix for rotating points\n        this._rotationMatrix = mat2.create();\n        mat2.rotate(this._rotationMatrix, this._rotationMatrix, -this._bearingInRadians);\n    }\n\n    get rotationMatrix(): mat2 { return this._rotationMatrix; }\n\n    get pitchInRadians(): number {\n        return this._pitchInRadians;\n    }\n    get pitch(): number {\n        return this._pitchInRadians / Math.PI * 180;\n    }\n    setPitch(pitch: number): void {\n        const p = clamp(pitch, this.minPitch, this.maxPitch) / 180 * Math.PI;\n        if (this._pitchInRadians === p) return;\n        this._unmodified = false;\n        this._pitchInRadians = p;\n        this._calcMatrices();\n    }\n\n    get rollInRadians(): number {\n        return this._rollInRadians;\n    }\n    get roll(): number {\n        return this._rollInRadians / Math.PI * 180;\n    }\n    setRoll(roll: number): void {\n        const r = roll / 180 * Math.PI;\n        if (this._rollInRadians === r) return;\n        this._unmodified = false;\n        this._rollInRadians = r;\n        this._calcMatrices();\n    }\n\n    get fovInRadians(): number {\n        return this._fovInRadians;\n    }\n    get fov(): number {\n        return radiansToDegrees(this._fovInRadians);\n    }\n    setFov(fov: number): void {\n        fov = clamp(fov, 0.1, 150);\n        if (this.fov === fov) return;\n        this._unmodified = false;\n        this._fovInRadians = degreesToRadians(fov);\n        this._calcMatrices();\n    }\n\n    get zoom(): number { return this._zoom; }\n    setZoom(zoom: number): void {\n        const constrainedZoom = this.applyConstrain(this._center, zoom).zoom;\n        if (this._zoom === constrainedZoom) return;\n        this._unmodified = false;\n        this._zoom = constrainedZoom;\n        this._tileZoom = Math.max(0, Math.floor(constrainedZoom));\n        this._scale = zoomScale(constrainedZoom);\n        this.constrainInternal();\n        this._calcMatrices();\n    }\n\n    get center(): LngLat { return this._center; }\n    setCenter(center: LngLat): void {\n        if (center.lat === this._center.lat && center.lng === this._center.lng) return;\n        this._unmodified = false;\n        this._center = center;\n        this.constrainInternal();\n        this._calcMatrices();\n    }\n\n    /**\n     * Elevation at current center point, meters above sea level\n     */\n    get elevation(): number { return this._elevation; }\n    setElevation(elevation: number): void {\n        if (elevation === this._elevation) return;\n        this._elevation = elevation;\n        this.constrainInternal();\n        this._calcMatrices();\n    }\n\n    get padding(): PaddingOptions { return this._edgeInsets.toJSON(); }\n    setPadding(padding: PaddingOptions): void {\n        if (this._edgeInsets.equals(padding)) return;\n        this._unmodified = false;\n        // Update edge-insets in-place\n        this._edgeInsets.interpolate(this._edgeInsets, padding, 1);\n        this._calcMatrices();\n    }\n\n    /**\n     * The center of the screen in pixels with the top-left corner being (0,0)\n     * and +y axis pointing downwards. This accounts for padding.\n     */\n    get centerPoint(): Point {\n        return this._edgeInsets.getCenter(this._width, this._height);\n    }\n\n    /**\n     * @internal\n     */\n    get pixelsPerMeter(): number { return this._pixelPerMeter; }\n\n    get unmodified(): boolean { return this._unmodified; }\n\n    get cameraToCenterDistance(): number { return this._cameraToCenterDistance; }\n\n    get nearZ(): number { return this._nearZ; }\n    get farZ(): number { return this._farZ; }\n    get autoCalculateNearFarZ(): boolean { return this._autoCalculateNearFarZ; }\n    overrideNearFarZ(nearZ: number, farZ: number): void {\n        this._autoCalculateNearFarZ = false;\n        this._nearZ = nearZ;\n        this._farZ = farZ;\n        this._calcMatrices();\n    }\n    clearNearFarZOverride(): void {\n        this._autoCalculateNearFarZ = true;\n        this._calcMatrices();\n    }\n\n    /**\n     * Returns if the padding params match\n     *\n     * @param padding - the padding to check against\n     * @returns true if they are equal, false otherwise\n     */\n    isPaddingEqual(padding: PaddingOptions): boolean {\n        return this._edgeInsets.equals(padding);\n    }\n\n    /**\n     * Helper method to update edge-insets in place\n     *\n     * @param start - the starting padding\n     * @param target - the target padding\n     * @param t - the step/weight\n     */\n    interpolatePadding(start: PaddingOptions, target: PaddingOptions, t: number): void {\n        this._unmodified = false;\n        this._edgeInsets.interpolate(start, target, t);\n        this.constrainInternal();\n        this._calcMatrices();\n    }\n\n    resize(width: number, height: number, constrain: boolean = true): void {\n        this._width = width;\n        this._height = height;\n        if (constrain) this.constrainInternal();\n        this._calcMatrices();\n    }\n\n    /**\n     * Returns the maximum geographical bounds the map is constrained to, or `null` if none set.\n     * @returns max bounds\n     */\n    getMaxBounds(): LngLatBounds | null {\n        if (this._latRange?.length !== 2 ||\n            this._lngRange?.length !== 2) return null;\n\n        return new LngLatBounds([this._lngRange[0], this._latRange[0]], [this._lngRange[1], this._latRange[1]]);\n    }\n\n    /**\n     * Sets or clears the map's geographical constraints.\n     * @param bounds - A {@link LngLatBounds} object describing the new geographic boundaries of the map.\n     */\n    setMaxBounds(bounds?: LngLatBounds | null): void {\n        if (bounds) {\n            this._lngRange = [bounds.getWest(), bounds.getEast()];\n            this._latRange = [bounds.getSouth(), bounds.getNorth()];\n            this.constrainInternal();\n        } else {\n            this._lngRange = null;\n            this._latRange = [-MAX_VALID_LATITUDE, MAX_VALID_LATITUDE];\n        }\n    }\n\n    /**\n     * When the map is pitched, some of the 3D features that intersect a query will not intersect\n     * the query at the surface of the earth. Instead the feature may be closer and only intersect\n     * the query because it extrudes into the air.\n     * @param queryGeometry - For point queries, the line from the query point to the \"camera point\",\n     * for other geometries, the envelope of the query geometry and the \"camera point\"\n     * @returns a geometry that includes all of the original query as well as all possible ares of the\n     * screen where the *base* of a visible extrusion could be.\n     *\n     */\n    getCameraQueryGeometry(cameraPoint: Point, queryGeometry: Point[]): Point[] {\n        if (queryGeometry.length === 1) {\n            return [queryGeometry[0], cameraPoint];\n        } else {\n            const {minX, minY, maxX, maxY} = Bounds.fromPoints(queryGeometry).extend(cameraPoint);\n            return [\n                new Point(minX, minY),\n                new Point(maxX, minY),\n                new Point(maxX, maxY),\n                new Point(minX, maxY),\n                new Point(minX, minY)\n            ];\n        }\n    }\n\n    applyConstrain: TransformConstrainFunction = (lngLat, zoom) => {\n        if (this._constrainOverride !== null) {\n            return this._constrainOverride(lngLat, zoom);\n        } else {\n            return this._callbacks.defaultConstrain(lngLat, zoom);\n        }\n    };\n\n    /**\n     * @internal\n     * Snaps the transform's center, zoom, etc. into the valid range.\n     */\n    private constrainInternal(): void {\n        if (!this.center || !this._width || !this._height || this._constraining) return;\n        this._constraining = true;\n        const unmodified = this._unmodified;\n        const {center, zoom} = this.applyConstrain(this.center, this.zoom);\n        this.setCenter(center);\n        this.setZoom(zoom);\n        this._unmodified = unmodified;\n        this._constraining = false;\n    }\n\n    /**\n     * This function is called every time one of the transform's defining properties (center, pitch, etc.) changes.\n     * This function should update the transform's internal data, such as matrices.\n     * Any derived `_calcMatrices` function should also call the base function first. The base function only depends on the `_width` and `_height` fields.\n     */\n    private _calcMatrices(): void {\n        if (this._width && this._height) {\n            this._pixelsToGLUnits = [2 / this._width, -2 / this._height];\n\n            let m = mat4.identity(new Float64Array(16));\n            mat4.scale(m, m, [this._width / 2, -this._height / 2, 1]);\n            mat4.translate(m, m, [1, -1, 0]);\n            this._clipSpaceToPixelsMatrix = m;\n\n            m = mat4.identity(new Float64Array(16));\n            mat4.scale(m, m, [1, -1, 1]);\n            mat4.translate(m, m, [-1, -1, 0]);\n            mat4.scale(m, m, [2 / this._width, 2 / this._height, 1]);\n            this._pixelsToClipSpaceMatrix = m;\n            const halfFov = this.fovInRadians / 2;\n            this._cameraToCenterDistance = 0.5 / Math.tan(halfFov) * this._height;\n        }\n        this._callbacks.calcMatrices();\n    }\n\n    calculateCenterFromCameraLngLatAlt(lnglat: LngLatLike, alt: number, bearing?: number, pitch?: number): {center: LngLat; elevation: number; zoom: number} {\n        const cameraBearing = bearing !== undefined ? bearing : this.bearing;\n        const cameraPitch = pitch = pitch !== undefined ? pitch : this.pitch;\n\n        const {distanceToCenter, clampedElevation} = this._distanceToCenterFromAltElevationPitch(alt, this.elevation, cameraPitch);\n        const {x, y} = cameraDirectionFromPitchBearing(cameraPitch, cameraBearing);\n        \n        // The mercator transform scale changes with latitude. At high latitudes, there are more \"Merc units\" per meter\n        // than at the equator. We treat the center point as our fundamental quantity. This means we want to convert\n        // elevation to Mercator Z using the scale factor at the center point (not the camera point). Since the center point is\n        // initially unknown, we compute it using the scale factor at the camera point. This gives us a better estimate of the\n        // center point scale factor, which we use to recompute the center point. We repeat until the error is very small.\n        // This typically takes about 5 iterations.\n        const camMercator = MercatorCoordinate.fromLngLat(lnglat, alt);\n        let metersPerMercUnit = altitudeFromMercatorZ(1, camMercator.y);\n        let centerMercator: MercatorCoordinate;\n        let dMercator: number;\n        let iter = 0;\n        const maxIter = 10;\n        do {\n            iter += 1;\n            if (iter > maxIter) {\n                break;\n            }\n            dMercator = distanceToCenter / metersPerMercUnit;\n            const dx = x * dMercator;\n            const dy = y * dMercator;\n            centerMercator = new MercatorCoordinate(camMercator.x + dx, camMercator.y + dy);\n            metersPerMercUnit = 1 / centerMercator.meterInMercatorCoordinateUnits();\n        } while (Math.abs(distanceToCenter - dMercator * metersPerMercUnit) > 1.0e-12);\n\n        const center = centerMercator.toLngLat();\n        const zoom = scaleZoom(this.height / 2 / Math.tan(this.fovInRadians / 2) / dMercator / this.tileSize);\n        return {center, elevation: clampedElevation, zoom};\n    }\n\n    recalculateZoomAndCenter(elevation: number): void {\n        if (this.elevation - elevation === 0) return;\n\n        // Critical: Stay in pixels and use original center to avoid instability at extreme latitudes when using Mercator-LngLat\n        const mercUnitsPerPixel = 1 / this.worldSize;\n        const originalMercUnitsPerMeter = mercatorZfromAltitude(1, this.center.lat);\n        const originalPixelsPerMeter = originalMercUnitsPerMeter * this.worldSize;\n\n        // Determine camera\n        const originalCenterMercator = MercatorCoordinate.fromLngLat(this.center, this.elevation);\n        const originalCenterPixelX = originalCenterMercator.x / mercUnitsPerPixel;\n        const originalCenterPixelY = originalCenterMercator.y / mercUnitsPerPixel;\n        const originalCenterPixelZ = originalCenterMercator.z / mercUnitsPerPixel;\n        \n        const cameraPitch = this.pitch;\n        const cameraBearing = this.bearing;\n        const {x, y, z} = cameraDirectionFromPitchBearing(cameraPitch, cameraBearing);\n        const dCamPixel = this.cameraToCenterDistance;\n        const camPixelX = originalCenterPixelX + dCamPixel * -x;\n        const camPixelY = originalCenterPixelY + dCamPixel * -y;\n        const camPixelZ = originalCenterPixelZ + dCamPixel * z;\n\n        // Determine corresponding center\n        const {distanceToCenter, clampedElevation} = this._distanceToCenterFromAltElevationPitch(camPixelZ / originalPixelsPerMeter, elevation, cameraPitch);\n        const distanceToCenterPixels = distanceToCenter * originalPixelsPerMeter;\n        const centerPixelX = camPixelX + x * distanceToCenterPixels;\n        const centerPixelY = camPixelY + y * distanceToCenterPixels;\n        const center = new MercatorCoordinate(centerPixelX * mercUnitsPerPixel, centerPixelY * mercUnitsPerPixel, 0).toLngLat();\n\n        const mercUnitsPerMeter = mercatorZfromAltitude(1, center.lat);\n        const zoom = scaleZoom(this.height / 2 / Math.tan(this.fovInRadians / 2) / distanceToCenter / mercUnitsPerMeter / this.tileSize);\n\n        // Update matrices\n        this._elevation = clampedElevation;\n        this._center = center;\n        this.setZoom(zoom);\n    }\n\n    _distanceToCenterFromAltElevationPitch(alt: number, elevation: number, pitch: number): {distanceToCenter: number; clampedElevation: number} {\n        const dzNormalized = -Math.cos(degreesToRadians(pitch));\n        const altitudeAGL = alt - elevation;\n        let distanceToCenter: number;\n        let clampedElevation = elevation;\n        if (dzNormalized * altitudeAGL >= 0.0 || Math.abs(dzNormalized) < 0.1) {\n            distanceToCenter = 10000;\n            clampedElevation = alt + distanceToCenter * dzNormalized;\n        } else {\n            distanceToCenter = -altitudeAGL / dzNormalized;\n        }\n        return {distanceToCenter, clampedElevation};\n    }\n\n    getCameraPoint(): Point {\n        const pitch = this.pitchInRadians;\n        const offset = Math.tan(pitch) * (this.cameraToCenterDistance || 1);\n        return this.centerPoint.add(new Point(offset * Math.sin(this.rollInRadians), offset * Math.cos(this.rollInRadians)));\n    }\n\n    getCameraAltitude(): number {\n        const altitude = Math.cos(this.pitchInRadians) * this._cameraToCenterDistance / this._pixelPerMeter;\n        return altitude + this.elevation;\n    }\n\n    getCameraLngLat(): LngLat {\n        const pixelPerMeter = mercatorZfromAltitude(1, this.center.lat) * this.worldSize;\n        const cameraToCenterDistanceMeters = this.cameraToCenterDistance / pixelPerMeter;\n        const camMercator = cameraMercatorCoordinateFromCenterAndRotation(this.center, this.elevation, this.pitch, this.bearing, cameraToCenterDistanceMeters);\n        return camMercator.toLngLat();\n    }\n\n    getMercatorTileCoordinates(overscaledTileID?: { canonical: {x: number; y: number; z: number}} | null): [number, number, number, number] {\n        if (!overscaledTileID) {\n            return [0, 0, 1, 1];\n        }\n        const scale = (overscaledTileID.canonical.z >= 0) ? (1 << overscaledTileID.canonical.z) : Math.pow(2.0, overscaledTileID.canonical.z);\n        return [\n            overscaledTileID.canonical.x / scale,\n            overscaledTileID.canonical.y / scale,\n            1.0 / scale / EXTENT,\n            1.0 / scale / EXTENT\n        ];\n    }\n}\n","import {vec3, type vec4} from 'gl-matrix';\nimport {type Frustum} from './frustum.ts';\nimport {IntersectionResult, type IBoundingVolume} from './bounding_volume.ts';\n\nexport class Aabb implements IBoundingVolume {\n    min: vec3;\n    max: vec3;\n    center: vec3;\n\n    constructor(min_: vec3, max_: vec3) {\n        this.min = min_;\n        this.max = max_;\n        this.center = vec3.scale([], vec3.add([], this.min, this.max), 0.5);\n    }\n\n    quadrant(index: number): Aabb {\n        const split = [(index % 2) === 0, index < 2];\n        const qMin = vec3.clone(this.min);\n        const qMax = vec3.clone(this.max);\n        for (let axis = 0; axis < split.length; axis++) {\n            qMin[axis] = split[axis] ? this.min[axis] : this.center[axis];\n            qMax[axis] = split[axis] ? this.center[axis] : this.max[axis];\n        }\n        // Elevation is always constant, hence quadrant.max.z = this.max.z\n        qMax[2] = this.max[2];\n        return new Aabb(qMin, qMax);\n    }\n\n    distanceX(point: number[]): number {\n        const pointOnAabb = Math.max(Math.min(this.max[0], point[0]), this.min[0]);\n        return pointOnAabb - point[0];\n    }\n\n    distanceY(point: number[]): number {\n        const pointOnAabb = Math.max(Math.min(this.max[1], point[1]), this.min[1]);\n        return pointOnAabb - point[1];\n    }\n\n    /**\n     * Performs a frustum-aabb intersection test.\n     */\n    intersectsFrustum(frustum: Frustum): IntersectionResult {\n        // Execute separating axis test between two convex objects to find intersections\n        // Each frustum plane together with 3 major axes define the separating axes\n        let fullyInside = true;\n\n        for (const plane of frustum.planes) {\n            const planeIntersection = this.intersectsPlane(plane);\n\n            if (planeIntersection === IntersectionResult.None) {\n                return IntersectionResult.None;\n            }\n            if (planeIntersection === IntersectionResult.Partial) {\n                fullyInside = false;\n            }\n        }\n\n        if (fullyInside) {\n            return IntersectionResult.Full;\n        }\n\n        if (frustum.aabb.min[0] > this.max[0] || frustum.aabb.min[1] > this.max[1] || frustum.aabb.min[2] > this.max[2] ||\n            frustum.aabb.max[0] < this.min[0] || frustum.aabb.max[1] < this.min[1] || frustum.aabb.max[2] < this.min[2]) {\n            return IntersectionResult.None;\n        }\n\n        return IntersectionResult.Partial;\n    }\n\n    /**\n     * Performs a halfspace-aabb intersection test.\n     */\n    intersectsPlane(plane: vec4): IntersectionResult {\n        let distMin = plane[3];\n        let distMax = plane[3];\n        for (let i = 0; i < 3; i++) {\n            if (plane[i] > 0) {\n                distMin += plane[i] * this.min[i];\n                distMax += plane[i] * this.max[i];\n            } else {\n                distMax += plane[i] * this.min[i];\n                distMin += plane[i] * this.max[i];\n            }\n        }\n\n        if (distMin >= 0) {\n            return IntersectionResult.Full;\n        }\n        if (distMax < 0) {\n            return IntersectionResult.None;\n        }\n        return IntersectionResult.Partial;\n    }\n}\n","import {OverscaledTileID} from '../../tile/tile_id.ts';\nimport {Aabb} from '../../util/primitives/aabb.ts';\nimport type {IBoundingVolume} from '../../util/primitives/bounding_volume.ts';\nimport {clamp} from '../../util/util.ts';\nimport {type MercatorCoordinate} from '../mercator_coordinate.ts';\nimport {type IReadonlyTransform} from '../transform_interface.ts';\nimport {type CoveringTilesOptionsInternal} from './covering_tiles.ts';\nimport {type CoveringTilesDetailsProvider} from './covering_tiles_details_provider.ts';\n\nexport class MercatorCoveringTilesDetailsProvider implements CoveringTilesDetailsProvider {\n\n    distanceToTile2d(pointX: number, pointY: number, _tileID: {x: number; y: number; z: number}, boundingVolume: IBoundingVolume): number {\n        const aabb = boundingVolume as Aabb;\n        const distanceX = aabb.distanceX([pointX, pointY]);\n        const distanceY = aabb.distanceY([pointX, pointY]);\n        return Math.hypot(distanceX, distanceY);\n    }\n\n    /**\n     * Returns the wrap value for a given tile, computed so that tiles will remain loaded when crossing the antimeridian.\n     */\n    getWrap(centerCoord: MercatorCoordinate, tileID: {x:number; y: number; z: number}, parentWrap: number): number {\n        return parentWrap;\n    }\n\n    /**\n     * Returns the AABB of the specified tile.\n     * @param tileID - Tile x, y and z for zoom.\n     */\n    getTileBoundingVolume(tileID: {x: number; y: number; z: number}, wrap: number, elevation: number, options: CoveringTilesOptionsInternal): Aabb {\n        let minElevation = Math.min(0, elevation);\n        let maxElevation = Math.max(0, elevation);\n        if (options?.terrain) {\n            const overscaledTileID = new OverscaledTileID(tileID.z, wrap, tileID.z, tileID.x, tileID.y);\n            const minMax = options.terrain.getMinMaxElevation(overscaledTileID);\n            minElevation = minMax.minElevation ?? minElevation;\n            maxElevation = minMax.maxElevation ?? maxElevation;\n        }\n        const numTiles = 1 << tileID.z;\n        return new Aabb([wrap + tileID.x / numTiles, tileID.y / numTiles, minElevation],\n            [wrap + (tileID.x + 1) / numTiles, (tileID.y + 1) / numTiles, maxElevation]);\n    }\n    \n    allowVariableZoom(transform: IReadonlyTransform, options: CoveringTilesOptionsInternal): boolean {\n        const zfov = transform.fov * (Math.abs(Math.cos(transform.rollInRadians)) * transform.height + Math.abs(Math.sin(transform.rollInRadians)) * transform.width) / transform.height;\n        const maxConstantZoomPitch = clamp(78.5 - zfov / 2, 0.0, 60.0);\n        return (!!options.terrain || transform.pitch > maxConstantZoomPitch);\n    }\n\n    allowWorldCopies(): boolean {\n        return true;\n    }\n\n    prepareNextFrame(): void { \n        // Do nothing\n    }\n}","import {type mat4, vec3, vec4} from 'gl-matrix';\nimport {Aabb} from './aabb.ts';\nimport {pointPlaneSignedDistance, rayPlaneIntersection} from '../util.ts';\n\nexport class Frustum {\n\n    constructor(public points: vec4[], public planes: vec4[], public aabb: Aabb) { }\n\n    public static fromInvProjectionMatrix(invProj: mat4, worldSize: number = 1, zoom: number = 0, horizonPlane?: vec4, flippedNearFar?: boolean): Frustum {\n        const clipSpaceCorners = [\n            [-1, 1, -1, 1],\n            [1, 1, -1, 1],\n            [1, -1, -1, 1],\n            [-1, -1, -1, 1],\n            [-1, 1, 1, 1],\n            [1, 1, 1, 1],\n            [1, -1, 1, 1],\n            [-1, -1, 1, 1]\n        ];\n\n        // Globe and mercator projection matrices have different Y directions, hence we need different sets of indices.\n        // This should be fixed in the future.\n        const frustumPlanePointIndices = flippedNearFar ? [\n            [6, 5, 4],  // near\n            [0, 1, 2],  // far\n            [0, 3, 7],  // left\n            [2, 1, 5],  // right\n            [3, 2, 6],  // bottom\n            [0, 4, 5]   // top\n        ] : [\n            [0, 1, 2],  // near\n            [6, 5, 4],  // far\n            [0, 3, 7],  // left\n            [2, 1, 5],  // right\n            [3, 2, 6],  // bottom\n            [0, 4, 5]   // top\n        ];\n\n        const scale = Math.pow(2, zoom);\n\n        // Transform frustum corner points from clip space to tile space, Z to meters\n        const frustumCoords = clipSpaceCorners.map(v => unprojectClipSpacePoint(v, invProj, worldSize, scale));\n\n        if (horizonPlane) {\n            // A horizon clipping plane was supplied.\n            adjustFarPlaneByHorizonPlane(frustumCoords, frustumPlanePointIndices[0], horizonPlane, flippedNearFar);\n        }\n\n        const frustumPlanes = frustumPlanePointIndices.map((p: number[]) => {\n            const a = vec3.sub([], frustumCoords[p[0]], frustumCoords[p[1]]);\n            const b = vec3.sub([], frustumCoords[p[2]], frustumCoords[p[1]]);\n            const n = vec3.normalize([], vec3.cross([], a, b)) as any;\n            const d = -vec3.dot(n, frustumCoords[p[1]]);\n            return n.concat(d);\n        });\n\n        const min: vec3 = [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY];\n        const max: vec3 = [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY];\n\n        for (const p of frustumCoords) {\n            for (let i = 0; i < 3; i++) {\n                min[i] = Math.min(min[i], p[i]);\n                max[i] = Math.max(max[i], p[i]);\n            }\n        }\n\n        return new Frustum(frustumCoords, frustumPlanes, new Aabb(min, max));\n    }\n}\n\nfunction unprojectClipSpacePoint(point: vec4 | number[], invProj: mat4, worldSize: number, scale: number): vec4 {\n    const v = vec4.transformMat4([], point, invProj) as any;\n    const s = 1.0 / v[3] / worldSize * scale;\n    return vec4.mul(v, v, [s, s, 1.0 / v[3], s] as vec4);\n}\n\n/**\n * Modifies points in the supplied `frustumCoords` array so that the frustum's far plane only lies as far as the horizon,\n * which improves frustum culling effectiveness.\n * @param frustumCoords - Points of the frustum.\n * @param nearPlanePointsIndices - Which indices in the `frustumCoords` form the near plane.\n * @param horizonPlane - The horizon plane.\n */\nfunction adjustFarPlaneByHorizonPlane(frustumCoords: vec4[], nearPlanePointsIndices: number[], horizonPlane: vec4, flippedNearFar: boolean): void {\n    // For each of the 4 edges from near to far plane,\n    // we find at which distance these edges intersect the given clipping plane,\n    // select the maximal value from these distances and then we move\n    // the frustum's far plane so that it is at most as far away from the near plane\n    // as this maximal distance.\n\n    const nearPlanePointsOffset = flippedNearFar ? 4 : 0;\n    const farPlanePointsOffset = flippedNearFar ? 0 : 4;\n\n    let maxDist = 0;\n    const cornerRayLengths: number[] = [];\n    const cornerRayNormalizedDirections: vec3[] = [];\n    for (let i = 0; i < 4; i++) {\n        const dir = vec3.sub([], frustumCoords[i + farPlanePointsOffset], frustumCoords[i + nearPlanePointsOffset]);\n        const len = vec3.length(dir);\n        vec3.scale(dir, dir, 1.0 / len); // normalize\n        cornerRayLengths.push(len);\n        cornerRayNormalizedDirections.push(dir);\n    }\n\n    for (let i = 0; i < 4; i++) {\n        const dist = rayPlaneIntersection(frustumCoords[i + nearPlanePointsOffset], cornerRayNormalizedDirections[i], horizonPlane);\n        if (dist !== null && dist >= 0) {\n            maxDist = Math.max(maxDist, dist);\n        } else {\n            // Use the original ray length for rays parallel to the horizon plane, or for rays pointing away from it.\n            maxDist = Math.max(maxDist, cornerRayLengths[i]);\n        }\n    }\n\n    // Compute the near plane.\n    // We use its normal as the \"view vector\" - direction in which the camera is looking.\n    const nearPlaneNormalized = getNormalizedNearPlane(frustumCoords, nearPlanePointsIndices);\n\n    // We also try to adjust the far plane position so that it exactly intersects the point on the horizon\n    // that is most distant from the near plane.\n    const idealFarPlaneDistanceFromNearPlane = getIdealNearFarPlaneDistance(horizonPlane, nearPlaneNormalized);\n    if (idealFarPlaneDistanceFromNearPlane !== null) {\n        const idealCornerRayLength = idealFarPlaneDistanceFromNearPlane / vec3.dot(cornerRayNormalizedDirections[0], nearPlaneNormalized); // dot(near plane, ray dir) is the same for all 4 corners\n        maxDist = Math.min(maxDist, idealCornerRayLength);\n    }\n\n    for (let i = 0; i < 4; i++) {\n        const targetLength = Math.min(maxDist, cornerRayLengths[i]);\n        frustumCoords[i + farPlanePointsOffset] = [\n            frustumCoords[i + nearPlanePointsOffset][0] + cornerRayNormalizedDirections[i][0] * targetLength,\n            frustumCoords[i + nearPlanePointsOffset][1] + cornerRayNormalizedDirections[i][1] * targetLength,\n            frustumCoords[i + nearPlanePointsOffset][2] + cornerRayNormalizedDirections[i][2] * targetLength,\n            1,\n        ] as vec4;\n    }\n}\n\n/**\n * Returns the near plane equation with unit length direction.\n * @param frustumCoords - Points of the frustum.\n * @param nearPlanePointsIndices - Which indices in the `frustumCoords` form the near plane.\n */\nfunction getNormalizedNearPlane(frustumCoords: vec4[], nearPlanePointsIndices: number[]): vec4 {\n    const nearPlaneA = vec3.sub([], frustumCoords[nearPlanePointsIndices[0]], frustumCoords[nearPlanePointsIndices[1]]);\n    const nearPlaneB = vec3.sub([], frustumCoords[nearPlanePointsIndices[2]], frustumCoords[nearPlanePointsIndices[1]]);\n    const nearPlaneNormalized = [0, 0, 0, 0] as vec4;\n    vec3.normalize(nearPlaneNormalized, vec3.cross([], nearPlaneA, nearPlaneB)) as any;\n    nearPlaneNormalized[3] = -vec3.dot(nearPlaneNormalized, frustumCoords[nearPlanePointsIndices[0]]);\n    return nearPlaneNormalized;\n}\n\n/**\n * Returns the ideal distance between the frustum's near and far plane so that the far plane only lies as far as the horizon.\n */\nfunction getIdealNearFarPlaneDistance(horizonPlane: vec4, nearPlaneNormalized: vec4): number | null {\n    // Normalize the horizon plane to unit direction\n    const horizonPlaneLen = vec3.len(horizonPlane);\n    const normalizedHorizonPlane = vec4.scale([], horizonPlane, 1 / horizonPlaneLen);\n\n    // Project the view vector onto the horizon plane\n    const projectedViewDirection = vec3.sub([], nearPlaneNormalized, vec3.scale([], normalizedHorizonPlane, vec3.dot(nearPlaneNormalized, normalizedHorizonPlane)));\n    const projectedViewLength = vec3.len(projectedViewDirection);\n\n    // projectedViewLength will be 0 if the camera is looking straight down\n    if (projectedViewLength > 0) {\n        // Find the radius and center of the horizon circle (the horizon circle is the intersection of the planet's sphere and the horizon plane).\n        const horizonCircleRadius = Math.sqrt(1 - normalizedHorizonPlane[3] * normalizedHorizonPlane[3]);\n        const horizonCircleCenter = vec3.scale([], normalizedHorizonPlane, -normalizedHorizonPlane[3]); // The horizon plane normal always points towards the camera.\n        // Find the furthest point on the horizon circle from the near plane.\n        const pointFurthestOnHorizonCircle = vec3.add([], horizonCircleCenter, vec3.scale([], projectedViewDirection, horizonCircleRadius / projectedViewLength));\n        // Compute this point's distance from the near plane.\n        return pointPlaneSignedDistance(nearPlaneNormalized, pointFurthestOnHorizonCircle);\n    } else {\n        return null;\n    }\n}\n","import {LngLat, type LngLatLike} from '../lng_lat.ts';\nimport {MercatorCoordinate, mercatorXfromLng, mercatorYfromLat, mercatorZfromAltitude} from '../mercator_coordinate.ts';\nimport Point from '@mapbox/point-geometry';\nimport {wrap, clamp, createMat4f64, degreesToRadians, createIdentityMat4f32, zoomScale, scaleZoom, type Mat4f32, type Mat4f64} from '../../util/util.ts';\nimport {type mat2, mat4, vec3, vec4} from 'gl-matrix';\nimport {UnwrappedTileID, OverscaledTileID, type CanonicalTileID, calculateTileKey} from '../../tile/tile_id.ts';\nimport {interpolates} from '@maplibre/maplibre-gl-style-spec';\nimport {type PointProjection, xyTransformMat4} from '../../symbol/projection.ts';\nimport {LngLatBounds} from '../lng_lat_bounds.ts';\nimport {getMercatorHorizon, projectToWorldCoordinates, unprojectFromWorldCoordinates, calculateTileMatrix, maxMercatorHorizonAngle, cameraMercatorCoordinateFromCenterAndRotation} from './mercator_utils.ts';\nimport {EXTENT} from '../../data/extent.ts';\nimport {TransformHelper} from '../transform_helper.ts';\nimport {MercatorCoveringTilesDetailsProvider} from './mercator_covering_tiles_details_provider.ts';\nimport {Frustum} from '../../util/primitives/frustum.ts';\nimport {fastInvertProjMat4} from '../../util/fast_maths.ts';\n\nimport type {Terrain} from '../../render/terrain.ts';\nimport type {IReadonlyTransform, ITransform, TransformConstrainFunction} from '../transform_interface.ts';\nimport type {TransformOptions} from '../transform_helper.ts';\nimport type {PaddingOptions} from '../edge_insets.ts';\nimport type {CustomLayerProjectionData, ProjectionDataParams, RendererProjectionData} from './projection_data.ts';\nimport type {CoveringTilesDetailsProvider} from './covering_tiles_details_provider.ts';\n\nexport class MercatorTransform implements ITransform {\n    private _helper: TransformHelper;\n\n    //\n    // Implementation of transform getters and setters\n    //\n\n    get pixelsToClipSpaceMatrix(): mat4 {\n        return this._helper.pixelsToClipSpaceMatrix;\n    }\n    get clipSpaceToPixelsMatrix(): mat4 {\n        return this._helper.clipSpaceToPixelsMatrix;\n    }\n    get pixelsToGLUnits(): [number, number] {\n        return this._helper.pixelsToGLUnits;\n    }\n    get centerOffset(): Point {\n        return this._helper.centerOffset;\n    }\n    get size(): Point {\n        return this._helper.size;\n    }\n    get rotationMatrix(): mat2 {\n        return this._helper.rotationMatrix;\n    }\n    get centerPoint(): Point {\n        return this._helper.centerPoint;\n    }\n    get pixelsPerMeter(): number {\n        return this._helper.pixelsPerMeter;\n    }\n    setMinZoom(zoom: number): void {\n        this._helper.setMinZoom(zoom);\n    }\n    setMaxZoom(zoom: number): void {\n        this._helper.setMaxZoom(zoom);\n    }\n    setMinPitch(pitch: number): void {\n        this._helper.setMinPitch(pitch);\n    }\n    setMaxPitch(pitch: number): void {\n        this._helper.setMaxPitch(pitch);\n    }\n    setRenderWorldCopies(renderWorldCopies: boolean): void {\n        this._helper.setRenderWorldCopies(renderWorldCopies);\n    }\n    setBearing(bearing: number): void {\n        this._helper.setBearing(bearing);\n    }\n    setPitch(pitch: number): void {\n        this._helper.setPitch(pitch);\n    }\n    setRoll(roll: number): void {\n        this._helper.setRoll(roll);\n    }\n    setFov(fov: number): void {\n        this._helper.setFov(fov);\n    }\n    setZoom(zoom: number): void {\n        this._helper.setZoom(zoom);\n    }\n    setCenter(center: LngLat): void {\n        this._helper.setCenter(center);\n    }\n    setElevation(elevation: number): void {\n        this._helper.setElevation(elevation);\n    }\n    setMinElevationForCurrentTile(elevation: number): void {\n        this._helper.setMinElevationForCurrentTile(elevation);\n    }\n    setPadding(padding: PaddingOptions): void {\n        this._helper.setPadding(padding);\n    }\n    interpolatePadding(start: PaddingOptions, target: PaddingOptions, t: number): void {\n        this._helper.interpolatePadding(start, target, t);\n    }\n    isPaddingEqual(padding: PaddingOptions): boolean {\n        return this._helper.isPaddingEqual(padding);\n    }\n    resize(width: number, height: number, constrain: boolean = true): void {\n        this._helper.resize(width, height, constrain);\n    }\n    getMaxBounds(): LngLatBounds {\n        return this._helper.getMaxBounds();\n    }\n    setMaxBounds(bounds?: LngLatBounds): void {\n        this._helper.setMaxBounds(bounds);\n    }\n    setConstrainOverride(constrain?: TransformConstrainFunction | null): void {\n        this._helper.setConstrainOverride(constrain);\n    }\n    overrideNearFarZ(nearZ: number, farZ: number): void {\n        this._helper.overrideNearFarZ(nearZ, farZ);\n    }\n    clearNearFarZOverride(): void {\n        this._helper.clearNearFarZOverride();\n    }\n    getCameraQueryGeometry(queryGeometry: Point[]): Point[] {\n        return this._helper.getCameraQueryGeometry(this.getCameraPoint(), queryGeometry);\n    }\n\n    get tileSize(): number {\n        return this._helper.tileSize;\n    }\n    get tileZoom(): number {\n        return this._helper.tileZoom;\n    }\n    get scale(): number {\n        return this._helper.scale;\n    }\n    get worldSize(): number {\n        return this._helper.worldSize;\n    }\n    get width(): number {\n        return this._helper.width;\n    }\n    get height(): number {\n        return this._helper.height;\n    }\n    get lngRange(): [number, number] {\n        return this._helper.lngRange;\n    }\n    get latRange(): [number, number] {\n        return this._helper.latRange;\n    }\n    get minZoom(): number {\n        return this._helper.minZoom;\n    }\n    get maxZoom(): number {\n        return this._helper.maxZoom;\n    }\n    get zoom(): number {\n        return this._helper.zoom;\n    }\n    get center(): LngLat {\n        return this._helper.center;\n    }\n    get minPitch(): number {\n        return this._helper.minPitch;\n    }\n    get maxPitch(): number {\n        return this._helper.maxPitch;\n    }\n    get pitch(): number {\n        return this._helper.pitch;\n    }\n    get pitchInRadians(): number {\n        return this._helper.pitchInRadians;\n    }\n    get roll(): number {\n        return this._helper.roll;\n    }\n    get rollInRadians(): number {\n        return this._helper.rollInRadians;\n    }\n    get bearing(): number {\n        return this._helper.bearing;\n    }\n    get bearingInRadians(): number {\n        return this._helper.bearingInRadians;\n    }\n    get fov(): number {\n        return this._helper.fov;\n    }\n    get fovInRadians(): number {\n        return this._helper.fovInRadians;\n    }\n    get elevation(): number {\n        return this._helper.elevation;\n    }\n    get minElevationForCurrentTile(): number {\n        return this._helper.minElevationForCurrentTile;\n    }\n    get padding(): PaddingOptions {\n        return this._helper.padding;\n    }\n    get unmodified(): boolean {\n        return this._helper.unmodified;\n    }\n    get renderWorldCopies(): boolean {\n        return this._helper.renderWorldCopies;\n    }\n    get cameraToCenterDistance(): number {\n        return this._helper.cameraToCenterDistance;\n    }\n    get constrainOverride(): TransformConstrainFunction {\n        return this._helper.constrainOverride;\n    }\n    public get nearZ(): number {\n        return this._helper.nearZ;\n    }\n    public get farZ(): number {\n        return this._helper.farZ;\n    }\n    public get autoCalculateNearFarZ(): boolean {\n        return this._helper.autoCalculateNearFarZ;\n    }\n    setTransitionState(_value: number): void {\n        // Do nothing\n    }\n    //\n    // Implementation of mercator transform\n    //\n\n    private _cameraPosition: vec3;\n\n    private _mercatorMatrix: mat4;\n    private _projectionMatrix: mat4;\n    private _viewProjMatrix: mat4;\n    private _invViewProjMatrix: mat4;\n    private _invProjMatrix: mat4;\n    private _alignedProjMatrix: mat4;\n    private _pixelMatrix: mat4;\n    private _pixelMatrix3D: mat4;\n    private _pixelMatrixInverse: mat4;\n    private _fogMatrix: mat4;\n\n    private _posMatrixCache: Map<string, {f64: Mat4f64; f32: Mat4f32}> = new Map();\n    private _alignedPosMatrixCache: Map<string, {f64: Mat4f64; f32: Mat4f32}> = new Map();\n    private _fogMatrixCacheF32: Map<string, mat4> = new Map();\n\n    private _coveringTilesDetailsProvider;\n\n    constructor(options?: TransformOptions) {\n        this._helper = new TransformHelper({\n            calcMatrices: () => this._calcMatrices(),\n            defaultConstrain: (center, zoom) => { return this.defaultConstrain(center, zoom); }\n        }, options);\n        this._coveringTilesDetailsProvider = new MercatorCoveringTilesDetailsProvider();\n    }\n\n    public clone(): ITransform {\n        const clone = new MercatorTransform();\n        clone.apply(this, false);\n        return clone;\n    }\n\n    public apply(that: IReadonlyTransform, constrain: boolean, forceOverrideZ?: boolean): void {\n        this._helper.apply(that, constrain, forceOverrideZ);\n    }\n\n    public get cameraPosition(): vec3 { return this._cameraPosition; }\n    public get projectionMatrix(): mat4 { return this._projectionMatrix; }\n    public get modelViewProjectionMatrix(): mat4 { return this._viewProjMatrix; }\n    public get inverseProjectionMatrix(): mat4 { return this._invProjMatrix; }\n    public get mercatorMatrix(): mat4 { return this._mercatorMatrix; } // Not part of ITransform interface\n\n    getVisibleUnwrappedCoordinates(tileID: CanonicalTileID): UnwrappedTileID[] {\n        const result = [new UnwrappedTileID(0, tileID)];\n        if (this._helper._renderWorldCopies) {\n            const utl = this.screenPointToMercatorCoordinate(new Point(0, 0));\n            const utr = this.screenPointToMercatorCoordinate(new Point(this._helper._width, 0));\n            const ubl = this.screenPointToMercatorCoordinate(new Point(this._helper._width, this._helper._height));\n            const ubr = this.screenPointToMercatorCoordinate(new Point(0, this._helper._height));\n            const w0 = Math.floor(Math.min(utl.x, utr.x, ubl.x, ubr.x));\n            const w1 = Math.floor(Math.max(utl.x, utr.x, ubl.x, ubr.x));\n\n            // Add an extra copy of the world on each side to properly render ImageSources and CanvasSources.\n            // Both sources draw outside the tile boundaries of the tile that \"contains them\" so we need\n            // to add extra copies on both sides in case offscreen tiles need to draw into on-screen ones.\n            const extraWorldCopy = 1;\n\n            for (let w = w0 - extraWorldCopy; w <= w1 + extraWorldCopy; w++) {\n                if (w === 0) continue;\n                result.push(new UnwrappedTileID(w, tileID));\n            }\n        }\n        return result;\n    }\n\n    getCameraFrustum(): Frustum {\n        return Frustum.fromInvProjectionMatrix(this._invViewProjMatrix, this.worldSize);\n    }\n    getClippingPlane(): vec4 | null {\n        return null;\n    }\n    getCoveringTilesDetailsProvider(): CoveringTilesDetailsProvider {\n        return this._coveringTilesDetailsProvider;\n    }\n\n    recalculateZoomAndCenter(terrain?: Terrain): void {\n        // find position the camera is looking on\n        const center = this.screenPointToLocation(this.centerPoint, terrain);\n        const elevation = terrain ? terrain.getElevationForLngLatZoom(center, this._helper._tileZoom) : 0;\n        this._helper.recalculateZoomAndCenter(elevation);\n    }\n\n    setLocationAtPoint(lnglat: LngLat, point: Point): void {\n        const z = mercatorZfromAltitude(this.elevation, this.center.lat);\n        const a = this.screenPointToMercatorCoordinateAtZ(point, z);\n        const b = this.screenPointToMercatorCoordinateAtZ(this.centerPoint, z);\n        const loc = MercatorCoordinate.fromLngLat(lnglat);\n        const newCenter = new MercatorCoordinate(\n            loc.x - (a.x - b.x),\n            loc.y - (a.y - b.y));\n        this.setCenter(newCenter?.toLngLat());\n        if (this._helper._renderWorldCopies) {\n            this.setCenter(this.center.wrap());\n        }\n    }\n\n    locationToScreenPoint(lnglat: LngLat, terrain?: Terrain): Point {\n        return terrain ?\n            this.coordinatePoint(MercatorCoordinate.fromLngLat(lnglat), terrain.getElevationForLngLat(lnglat, this), this._pixelMatrix3D) :\n            this.coordinatePoint(MercatorCoordinate.fromLngLat(lnglat));\n    }\n\n    screenPointToLocation(p: Point, terrain?: Terrain): LngLat {\n        return this.screenPointToMercatorCoordinate(p, terrain)?.toLngLat();\n    }\n\n    screenPointToMercatorCoordinate(p: Point, terrain?: Terrain): MercatorCoordinate {\n        // get point-coordinate from terrain coordinates framebuffer\n        if (terrain) {\n            const coordinate = terrain.pointCoordinate(p);\n            if (coordinate != null) {\n                return coordinate;\n            }\n        }\n        return this.screenPointToMercatorCoordinateAtZ(p);\n    }\n\n    screenPointToMercatorCoordinateAtZ(p: Point, mercatorZ?: number): MercatorCoordinate {\n\n        // calculate point-coordinate on flat earth\n        const targetZ = mercatorZ ? mercatorZ : 0;\n        // since we don't know the correct projected z value for the point,\n        // unproject two points to get a line and then find the point on that\n        // line with z=0\n\n        const coord0 = [p.x, p.y, 0, 1] as vec4;\n        const coord1 = [p.x, p.y, 1, 1] as vec4;\n\n        vec4.transformMat4(coord0, coord0, this._pixelMatrixInverse);\n        vec4.transformMat4(coord1, coord1, this._pixelMatrixInverse);\n\n        const w0 = coord0[3];\n        const w1 = coord1[3];\n        const x0 = coord0[0] / w0;\n        const x1 = coord1[0] / w1;\n        const y0 = coord0[1] / w0;\n        const y1 = coord1[1] / w1;\n        const z0 = coord0[2] / w0;\n        const z1 = coord1[2] / w1;\n\n        const t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0);\n\n        return new MercatorCoordinate(\n            interpolates.number(x0, x1, t) / this.worldSize,\n            interpolates.number(y0, y1, t) / this.worldSize,\n            targetZ);\n    }\n\n    /**\n     * Given a coordinate, return the screen point that corresponds to it\n     * @param coord - the coordinates\n     * @param elevation - the elevation\n     * @param pixelMatrix - the pixel matrix\n     * @returns screen point\n     */\n    coordinatePoint(coord: MercatorCoordinate, elevation: number = 0, pixelMatrix: mat4 = this._pixelMatrix): Point {\n        const p = [coord.x * this.worldSize, coord.y * this.worldSize, elevation, 1] as vec4;\n        vec4.transformMat4(p, p, pixelMatrix);\n        return new Point(p[0] / p[3], p[1] / p[3]);\n    }\n\n    getBounds(): LngLatBounds {\n        const top = Math.max(0, this._helper._height / 2 - getMercatorHorizon(this));\n        return new LngLatBounds()\n            .extend(this.screenPointToLocation(new Point(0, top)))\n            .extend(this.screenPointToLocation(new Point(this._helper._width, top)))\n            .extend(this.screenPointToLocation(new Point(this._helper._width, this._helper._height)))\n            .extend(this.screenPointToLocation(new Point(0, this._helper._height)));\n    }\n\n    isPointOnMapSurface(p: Point, terrain?: Terrain): boolean {\n        if (terrain) {\n            const coordinate = terrain.pointCoordinate(p);\n            return coordinate != null;\n        }\n        return (p.y > this.height / 2 - getMercatorHorizon(this));\n    }\n\n    /**\n     * Calculate the posMatrix that, given a tile coordinate, would be used to display the tile on a map.\n     * This function is specific to the mercator projection.\n     * @param tileID - the tile ID\n     * @param aligned - whether to use a pixel-aligned matrix variant, intended for rendering raster tiles\n     * @param useFloat32 - when true, returns a float32 matrix instead of float64. Use float32 for matrices that are passed to shaders, use float64 for everything else.\n     */\n    calculatePosMatrix(tileID: UnwrappedTileID | OverscaledTileID, aligned: boolean | undefined, useFloat32: true): Mat4f32;\n    calculatePosMatrix(tileID: UnwrappedTileID | OverscaledTileID, aligned?: boolean, useFloat32?: false): Mat4f64;\n    calculatePosMatrix(tileID: UnwrappedTileID | OverscaledTileID, aligned: boolean = false, useFloat32: boolean = false): Mat4f32 | Mat4f64 {\n        const posMatrixKey = tileID.key ?? calculateTileKey(tileID.wrap, tileID.canonical.z, tileID.canonical.z, tileID.canonical.x, tileID.canonical.y);\n        const cache = aligned ? this._alignedPosMatrixCache : this._posMatrixCache;\n        if (cache.has(posMatrixKey)) {\n            const matrices = cache.get(posMatrixKey);\n            return useFloat32 ? matrices.f32 : matrices.f64;\n        }\n\n        const tileMatrix = calculateTileMatrix(tileID, this.worldSize);\n        mat4.multiply(tileMatrix, aligned ? this._alignedProjMatrix : this._viewProjMatrix, tileMatrix);\n        const matrices: {f64: Mat4f64; f32: Mat4f32} = {\n            f64: tileMatrix,\n            f32: new Float32Array(tileMatrix), // Must have a 32 bit float version for WebGL, otherwise WebGL calls in Chrome get very slow.\n        };\n        cache.set(posMatrixKey, matrices);\n        // Make sure to return the correct precision\n        return useFloat32 ? matrices.f32 : matrices.f64;\n    }\n\n    calculateFogMatrix(unwrappedTileID: UnwrappedTileID): mat4 {\n        const posMatrixKey = unwrappedTileID.key;\n        const cache = this._fogMatrixCacheF32;\n        if (cache.has(posMatrixKey)) {\n            return cache.get(posMatrixKey);\n        }\n\n        const fogMatrix = calculateTileMatrix(unwrappedTileID, this.worldSize);\n        mat4.multiply(fogMatrix, this._fogMatrix, fogMatrix);\n\n        cache.set(posMatrixKey, new Float32Array(fogMatrix)); // Must be 32 bit floats, otherwise WebGL calls in Chrome get very slow.\n        return cache.get(posMatrixKey);\n    }\n\n    /**\n     * This mercator implementation returns center lngLat and zoom to ensure that:\n     *\n     * 1) everything beyond the bounds is excluded\n     * 2) a given lngLat is as near the center as possible\n     *\n     * Bounds are those set by maxBounds or North & South \"Poles\" and, if only 1 globe is displayed, antimeridian.\n     */\n    defaultConstrain: TransformConstrainFunction = (lngLat, zoom) => {\n        zoom = clamp(+zoom, this.minZoom, this.maxZoom);\n        const result = {\n            center: new LngLat(lngLat.lng, lngLat.lat),\n            zoom\n        };\n\n        let lngRange = this._helper._lngRange;\n\n        if (!this._helper._renderWorldCopies && lngRange === null) {\n            const almost180 = 180 - 1e-10;\n            lngRange = [-almost180, almost180];\n        }\n\n        const worldSize = this.tileSize * zoomScale(result.zoom); // A world size for the requested zoom level, not the current world size\n        let minY = 0;\n        let maxY = worldSize;\n        let minX = 0;\n        let maxX = worldSize;\n        let scaleY = 0;\n        let scaleX = 0;\n        const {x: screenWidth, y: screenHeight} = this.size;\n\n        if (this._helper._latRange) {\n            const latRange = this._helper._latRange;\n            minY = mercatorYfromLat(latRange[1]) * worldSize;\n            maxY = mercatorYfromLat(latRange[0]) * worldSize;\n            const shouldZoomIn = maxY - minY < screenHeight;\n            if (shouldZoomIn) scaleY = screenHeight / (maxY - minY);\n        }\n\n        if (lngRange) {\n            minX = wrap(\n                mercatorXfromLng(lngRange[0]) * worldSize,\n                0,\n                worldSize\n            );\n            maxX = wrap(\n                mercatorXfromLng(lngRange[1]) * worldSize,\n                0,\n                worldSize\n            );\n\n            if (maxX < minX) maxX += worldSize;\n\n            const shouldZoomIn = maxX - minX < screenWidth;\n            if (shouldZoomIn) scaleX = screenWidth / (maxX - minX);\n        }\n\n        const {x: originalX, y: originalY} = projectToWorldCoordinates(worldSize, lngLat);\n        let modifiedX, modifiedY;\n\n        const scale = Math.max(scaleX || 0, scaleY || 0);\n\n        if (scale) {\n            // zoom in to exclude all beyond the given lng/lat ranges\n            const newPoint = new Point(\n                scaleX ? (maxX + minX) / 2 : originalX,\n                scaleY ? (maxY + minY) / 2 : originalY);\n            result.center = unprojectFromWorldCoordinates(worldSize, newPoint).wrap();\n            result.zoom += scaleZoom(scale);\n            return result;\n        }\n\n        if (this._helper._latRange) {\n            const h2 = screenHeight / 2;\n            if (originalY - h2 < minY) modifiedY = minY + h2;\n            if (originalY + h2 > maxY) modifiedY = maxY - h2;\n        }\n\n        if (lngRange) {\n            const centerX = (minX + maxX) / 2;\n            let wrappedX = originalX;\n            if (this._helper._renderWorldCopies) {\n                wrappedX = wrap(originalX, centerX - worldSize / 2, centerX + worldSize / 2);\n            }\n            const w2 = screenWidth / 2;\n\n            if (wrappedX - w2 < minX) modifiedX = minX + w2;\n            if (wrappedX + w2 > maxX) modifiedX = maxX - w2;\n        }\n\n        // pan the map if the screen goes off the range\n        if (modifiedX !== undefined || modifiedY !== undefined) {\n            const newPoint = new Point(modifiedX ?? originalX, modifiedY ?? originalY);\n            result.center = unprojectFromWorldCoordinates(worldSize, newPoint).wrap();\n        }\n\n        return result;\n    };\n\n    applyConstrain: TransformConstrainFunction = (lngLat, zoom) => {\n        return this._helper.applyConstrain(lngLat, zoom);\n    };\n\n    calculateCenterFromCameraLngLatAlt(lnglat: LngLatLike, alt: number, bearing?: number, pitch?: number): {center: LngLat; elevation: number; zoom: number} {\n        return this._helper.calculateCenterFromCameraLngLatAlt(lnglat, alt, bearing, pitch);\n    }\n\n    _calculateNearFarZIfNeeded(cameraToSeaLevelDistance: number, limitedPitchRadians: number, offset: Point): void {\n        if (!this._helper.autoCalculateNearFarZ) {\n            return;\n        }\n        // In case of negative minimum elevation (e.g. the dead see, under the sea maps) use a lower plane for calculation\n        const minRenderDistanceBelowCameraInMeters = 100;\n        const minElevation = Math.min(this.elevation, this.minElevationForCurrentTile, this.getCameraAltitude() - minRenderDistanceBelowCameraInMeters);\n        const cameraToLowestPointDistance = cameraToSeaLevelDistance - minElevation * this._helper._pixelPerMeter / Math.cos(limitedPitchRadians);\n        const lowestPlane = minElevation < 0 ? cameraToLowestPointDistance : cameraToSeaLevelDistance;\n\n        // Find the distance from the center point [width/2 + offset.x, height/2 + offset.y] to the\n        // center top point [width/2 + offset.x, 0] in Z units, using the law of sines.\n        // 1 Z unit is equivalent to 1 horizontal px at the center of the map\n        // (the distance between[width/2, height/2] and [width/2 + 1, height/2])\n        const groundAngle = Math.PI / 2 + this.pitchInRadians;\n        const zfov = degreesToRadians(this.fov) * (Math.abs(Math.cos(degreesToRadians(this.roll))) * this.height + Math.abs(Math.sin(degreesToRadians(this.roll))) * this.width) / this.height;\n        const fovAboveCenter = zfov * (0.5 + offset.y / this.height);\n        const topHalfSurfaceDistance = Math.sin(fovAboveCenter) * lowestPlane / Math.sin(clamp(Math.PI - groundAngle - fovAboveCenter, 0.01, Math.PI - 0.01));\n\n        // Find the distance from the center point to the horizon\n        const horizon = getMercatorHorizon(this);\n        const horizonAngle = Math.atan(horizon / this._helper.cameraToCenterDistance);\n        const minFovCenterToHorizonRadians = degreesToRadians(90 - maxMercatorHorizonAngle);\n        const fovCenterToHorizon = horizonAngle > minFovCenterToHorizonRadians ? 2 * horizonAngle * (0.5 + offset.y / (horizon * 2)) : minFovCenterToHorizonRadians;\n        const topHalfSurfaceDistanceHorizon = Math.sin(fovCenterToHorizon) * lowestPlane / Math.sin(clamp(Math.PI - groundAngle - fovCenterToHorizon, 0.01, Math.PI - 0.01));\n\n        // Calculate z distance of the farthest fragment that should be rendered.\n        // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`\n        const topHalfMinDistance = Math.min(topHalfSurfaceDistance, topHalfSurfaceDistanceHorizon);\n\n        this._helper._farZ = (Math.cos(Math.PI / 2 - limitedPitchRadians) * topHalfMinDistance + lowestPlane) * 1.01;\n\n        // The larger the value of nearZ is\n        // - the more depth precision is available for features (good)\n        // - clipping starts appearing sooner when the camera is close to 3d features (bad)\n        //\n        // Other values work for mapbox-gl-js but deck.gl was encountering precision issues\n        // when rendering custom layers. This value was experimentally chosen and\n        // seems to solve z-fighting issues in deck.gl while not clipping buildings too close to the camera.\n        this._helper._nearZ = this._helper._height / 50;\n    }\n\n    _calcMatrices(): void {\n        if (!this._helper._height) return;\n\n        const offset = this.centerOffset;\n        const point = projectToWorldCoordinates(this.worldSize, this.center);\n        const x = point.x, y = point.y;\n        this._helper._pixelPerMeter = mercatorZfromAltitude(1, this.center.lat) * this.worldSize;\n\n        // Calculate the camera to sea-level distance in pixel in respect of terrain\n        const limitedPitchRadians = degreesToRadians(Math.min(this.pitch, maxMercatorHorizonAngle));\n        const cameraToSeaLevelDistance = Math.max(this._helper.cameraToCenterDistance / 2, this._helper.cameraToCenterDistance + this._helper._elevation * this._helper._pixelPerMeter / Math.cos(limitedPitchRadians));\n\n        this._calculateNearFarZIfNeeded(cameraToSeaLevelDistance, limitedPitchRadians, offset);\n\n        // matrix for conversion from location to clip space(-1 .. 1)\n        let m: mat4;\n        m = new Float64Array(16);\n        mat4.perspective(m, this.fovInRadians, this._helper._width / this._helper._height, this._helper._nearZ, this._helper._farZ);\n        this._invProjMatrix = new Float64Array(16);\n        fastInvertProjMat4(this._invProjMatrix, m);\n\n        // Apply center of perspective offset\n        m[8] = -offset.x * 2 / this._helper._width;\n        m[9] = offset.y * 2 / this._helper._height;\n        this._projectionMatrix = mat4.clone(m);\n\n        mat4.scale(m, m, [1, -1, 1]);\n        mat4.translate(m, m, [0, 0, -this._helper.cameraToCenterDistance]);\n        mat4.rotateZ(m, m, -this.rollInRadians);\n        mat4.rotateX(m, m, this.pitchInRadians);\n        mat4.rotateZ(m, m, -this.bearingInRadians);\n        mat4.translate(m, m, [-x, -y, 0]);\n\n        // The mercatorMatrix can be used to transform points from mercator coordinates\n        // ([0, 0] nw, [1, 1] se) to clip space.\n        this._mercatorMatrix = mat4.scale([], m, [this.worldSize, this.worldSize, this.worldSize]);\n\n        // scale vertically to meters per pixel (inverse of ground resolution):\n        mat4.scale(m, m, [1, 1, this._helper._pixelPerMeter]);\n\n        // matrix for conversion from world space to screen coordinates in 2D\n        this._pixelMatrix = mat4.multiply(new Float64Array(16), this.clipSpaceToPixelsMatrix, m);\n\n        // matrix for conversion from world space to clip space (-1 .. 1)\n        mat4.translate(m, m, [0, 0, -this.elevation]); // elevate camera over terrain\n        this._viewProjMatrix = m;\n        this._invViewProjMatrix = mat4.invert([], m);\n\n        const cameraPos: vec4 = [0, 0, -1, 1];\n        vec4.transformMat4(cameraPos, cameraPos, this._invViewProjMatrix);\n        this._cameraPosition = [\n            cameraPos[0] / cameraPos[3],\n            cameraPos[1] / cameraPos[3],\n            cameraPos[2] / cameraPos[3]\n        ];\n\n        // create a fog matrix, same es proj-matrix but with near clipping-plane in mapcenter\n        // needed to calculate a correct z-value for fog calculation, because projMatrix z value is not\n        this._fogMatrix = new Float64Array(16);\n        mat4.perspective(this._fogMatrix, this.fovInRadians, this.width / this.height, cameraToSeaLevelDistance, this._helper._farZ);\n        this._fogMatrix[8] = -offset.x * 2 / this.width;\n        this._fogMatrix[9] = offset.y * 2 / this.height;\n        mat4.scale(this._fogMatrix, this._fogMatrix, [1, -1, 1]);\n        mat4.translate(this._fogMatrix, this._fogMatrix, [0, 0, -this.cameraToCenterDistance]);\n        mat4.rotateZ(this._fogMatrix, this._fogMatrix, -this.rollInRadians);\n        mat4.rotateX(this._fogMatrix, this._fogMatrix, this.pitchInRadians);\n        mat4.rotateZ(this._fogMatrix, this._fogMatrix, -this.bearingInRadians);\n        mat4.translate(this._fogMatrix, this._fogMatrix, [-x, -y, 0]);\n        mat4.scale(this._fogMatrix, this._fogMatrix, [1, 1, this._helper._pixelPerMeter]);\n        mat4.translate(this._fogMatrix, this._fogMatrix, [0, 0, -this.elevation]); // elevate camera over terrain\n\n        // matrix for conversion from world space to screen coordinates in 3D\n        this._pixelMatrix3D = mat4.multiply(new Float64Array(16), this.clipSpaceToPixelsMatrix, m);\n\n        // Make a second projection matrix that is aligned to a pixel grid for rendering raster tiles.\n        // We're rounding the (floating point) x/y values to achieve to avoid rendering raster images to fractional\n        // coordinates. Additionally, we adjust by half a pixel in either direction in case that viewport dimension\n        // is an odd integer to preserve rendering to the pixel grid. We're rotating this shift based on the angle\n        // of the transformation so that 0°, 90°, 180°, and 270° rasters are crisp, and adjust the shift so that\n        // it is always <= 0.5 pixels.\n        const xShift = (this._helper._width % 2) / 2, yShift = (this._helper._height % 2) / 2,\n            angleCos = Math.cos(this.bearingInRadians), angleSin = Math.sin(-this.bearingInRadians),\n            dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift,\n            dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;\n        const alignedM = new Float64Array(m) as any as mat4;\n        mat4.translate(alignedM, alignedM, [dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0]);\n        this._alignedProjMatrix = alignedM;\n\n        // inverse matrix for conversion from screen coordinates to location\n        m = mat4.invert(new Float64Array(16), this._pixelMatrix);\n        if (!m) throw new Error('failed to invert matrix');\n        this._pixelMatrixInverse = m;\n\n        this._clearMatrixCaches();\n    }\n\n    private _clearMatrixCaches(): void {\n        this._posMatrixCache.clear();\n        this._alignedPosMatrixCache.clear();\n        this._fogMatrixCacheF32.clear();\n    }\n\n    maxPitchScaleFactor(): number {\n        // calcMatrices hasn't run yet\n        if (!this._pixelMatrixInverse) return 1;\n\n        const coord = this.screenPointToMercatorCoordinate(new Point(0, 0));\n        const p = [coord.x * this.worldSize, coord.y * this.worldSize, 0, 1] as vec4;\n        const topPoint = vec4.transformMat4(p, p, this._pixelMatrix);\n        return topPoint[3] / this._helper.cameraToCenterDistance;\n    }\n\n    getCameraPoint(): Point {\n        return this._helper.getCameraPoint();\n    }\n\n    getCameraAltitude(): number {\n        return this._helper.getCameraAltitude();\n    }\n\n    getCameraLngLat(): LngLat {\n        const pixelPerMeter = mercatorZfromAltitude(1, this.center.lat) * this.worldSize;\n        const cameraToCenterDistanceMeters = this._helper.cameraToCenterDistance / pixelPerMeter;\n        const camMercator = cameraMercatorCoordinateFromCenterAndRotation(this.center, this.elevation, this.pitch, this.bearing, cameraToCenterDistanceMeters);\n        return camMercator.toLngLat();\n    }\n\n    lngLatToCameraDepth(lngLat: LngLat, elevation: number): number {\n        const coord = MercatorCoordinate.fromLngLat(lngLat);\n        const p = [coord.x * this.worldSize, coord.y * this.worldSize, elevation, 1] as vec4;\n        vec4.transformMat4(p, p, this._viewProjMatrix);\n        return (p[2] / p[3]);\n    }\n\n    getProjectionData(params: ProjectionDataParams): RendererProjectionData {\n        const {overscaledTileID, aligned, applyTerrainMatrix} = params;\n        const mercatorTileCoordinates = this._helper.getMercatorTileCoordinates(overscaledTileID);\n        const tilePosMatrix = overscaledTileID ? this.calculatePosMatrix(overscaledTileID, aligned, true) : null;\n\n        let mainMatrix: Mat4f32;\n        if (overscaledTileID?.terrainRttPosMatrix32f && applyTerrainMatrix) {\n            mainMatrix = overscaledTileID.terrainRttPosMatrix32f;\n        } else if (tilePosMatrix) {\n            mainMatrix = tilePosMatrix; // This matrix should be float32\n        } else {\n            mainMatrix = createIdentityMat4f32();\n        }\n        return {\n            mainMatrix, // Might be set to a custom matrix by different projections.\n            tileMercatorCoords: mercatorTileCoordinates,\n            clippingPlane: [0, 0, 0, 0],\n            projectionTransition: 0.0, // Range 0..1, where 0 is mercator, 1 is another projection, mostly globe.\n            fallbackMatrix: mainMatrix,\n            clipAntimeridian: false,\n        };\n    }\n\n    isLocationOccluded(_: LngLat): boolean {\n        return false;\n    }\n\n    getPixelScale(): number {\n        return 1.0;\n    }\n\n    getCircleRadiusCorrection(): number {\n        return 1.0;\n    }\n\n    getPitchedTextCorrection(_textAnchorX: number, _textAnchorY: number, _tileID: UnwrappedTileID): number {\n        return 1.0;\n    }\n\n    transformLightDirection(dir: vec3): vec3 {\n        return vec3.clone(dir);\n    }\n\n    getRayDirectionFromPixel(_p: Point): vec3 {\n        throw new Error('Not implemented.'); // No need for this in mercator transform\n    }\n\n    projectTileCoordinates(x: number, y: number, unwrappedTileID: UnwrappedTileID, getElevation: (x: number, y: number) => number): PointProjection {\n        const matrix = this.calculatePosMatrix(unwrappedTileID);\n        let pos;\n        if (getElevation) { // slow because of handle z-index\n            pos = [x, y, getElevation(x, y), 1] as vec4;\n            vec4.transformMat4(pos, pos, matrix);\n        } else { // fast because of ignore z-index\n            pos = [x, y, 0, 1] as vec4;\n            xyTransformMat4(pos, pos, matrix);\n        }\n        const w = pos[3];\n        return {\n            point: new Point(pos[0] / w, pos[1] / w),\n            signedDistanceFromCamera: w,\n            isOccluded: false\n        };\n    }\n\n    populateCache(coords: OverscaledTileID[]): void {\n        for (const coord of coords) {\n            // Return value is thrown away, but this function will still\n            // place the pos matrix into the transform's internal cache.\n            this.calculatePosMatrix(coord);\n        }\n    }\n\n    getProjectionDataForCustomLayer(applyGlobeMatrix: boolean = true): CustomLayerProjectionData {\n        const tileID = new OverscaledTileID(0, 0, 0, 0, 0);\n        const rendererProjectionData = this.getProjectionData({overscaledTileID: tileID, applyGlobeMatrix});\n        const tileMatrix = calculateTileMatrix(tileID, this.worldSize);\n        mat4.multiply(tileMatrix, this._viewProjMatrix, tileMatrix);\n\n        // Even though we requested projection data for the mercator base tile which covers the entire mercator range,\n        // the shader projection machinery still expects inputs to be in tile units range [0..EXTENT].\n        // Since custom layers are expected to supply mercator coordinates [0..1], we need to rescale\n        // both matrices by EXTENT. We also need to rescale Z.\n\n        const scale: vec3 = [EXTENT, EXTENT, this.worldSize / this._helper.pixelsPerMeter];\n\n        // We pass full-precision 64bit float matrices to custom layers to prevent precision loss in case the user wants to do further transformations.\n        // Otherwise we get very visible precision-artifacts and twitching for objects that are bulding-scale.\n        const projectionMatrixScaled = createMat4f64();\n        mat4.scale(projectionMatrixScaled, tileMatrix, scale);\n\n        return {\n            ...rendererProjectionData,\n            tileMercatorCoords: [0, 0, 1, 1],\n            fallbackMatrix: projectionMatrixScaled,\n            mainMatrix: projectionMatrixScaled,\n        };\n    }\n\n    getFastPathSimpleProjectionMatrix(tileID: OverscaledTileID): mat4 {\n        return this.calculatePosMatrix(tileID);\n    }\n}\n","import Point from '@mapbox/point-geometry';\nimport {type IReadonlyTransform, type ITransform} from '../transform_interface.ts';\nimport {type LngLat, type LngLatLike} from '../lng_lat.ts';\nimport {type CameraForBoundsOptions, type PointLike} from '../../ui/camera.ts';\nimport {type PaddingOptions} from '../edge_insets.ts';\nimport {type LngLatBounds} from '../lng_lat_bounds.ts';\nimport {degreesToRadians, getRollPitchBearing, type RollPitchBearing, rollPitchBearingToQuat, scaleZoom, warnOnce, zoomScale} from '../../util/util.ts';\nimport {quat} from 'gl-matrix';\nimport {interpolates} from '@maplibre/maplibre-gl-style-spec';\nimport {projectToWorldCoordinates, unprojectFromWorldCoordinates} from './mercator_utils.ts';\n\nexport type MapControlsDeltas = {\n    panDelta: Point;\n    zoomDelta: number;\n    bearingDelta: number;\n    pitchDelta: number;\n    rollDelta: number;\n    around: Point;\n};\n\nexport type CameraForBoxAndBearingHandlerResult = {\n    center: LngLat;\n    zoom: number;\n    bearing: number;\n};\n\nexport type EaseToHandlerOptions = {\n    bearing: number;\n    pitch: number;\n    roll: number;\n    padding: PaddingOptions;\n    offsetAsPoint: Point;\n    around?: LngLat;\n    aroundPoint?: Point;\n    center?: LngLatLike;\n    zoom?: number;\n    offset?: PointLike;\n};\n\nexport type EaseToHandlerResult = {\n    easeFunc: (k: number) => void;\n    elevationCenter: LngLat;\n    isZooming: boolean;\n};\n\nexport type FlyToHandlerOptions = {\n    bearing: number;\n    pitch: number;\n    roll: number;\n    padding: PaddingOptions;\n    offsetAsPoint: Point;\n    center?: LngLatLike;\n    locationAtOffset: LngLat;\n    zoom?: number;\n    minZoom?: number;\n};\n\nexport type FlyToHandlerResult = {\n    easeFunc: (k: number, scale: number, centerFactor: number, pointAtOffset: Point) => void;\n    scaleOfZoom: number;\n    scaleOfMinZoom: number;\n    targetCenter: LngLat;\n    pixelPathLength: number;\n};\n\nexport type UpdateRotationArgs = {\n    /**\n     * The starting Euler angles.\n     */\n    startEulerAngles: RollPitchBearing;\n\n    /**\n     * The end Euler angles.\n     */\n    endEulerAngles: RollPitchBearing;\n\n    /**\n     * The transform to be updated\n     */\n    tr: ITransform;\n\n    /**\n     * The interpolation fraction, between 0 and 1.\n     */\n    k: number;\n\n    /**\n     * If true, use spherical linear interpolation. If false, use linear interpolation of Euler angles.\n     */\n    useSlerp: boolean;\n};\n\n/**\n * @internal\n */\nexport function cameraBoundsWarning(): void {\n    warnOnce(\n        'Map cannot fit within canvas with the given bounds, padding, and/or offset.'\n    );\n}\n\n/**\n * @internal\n * Contains projection-specific functions related to camera controls, easeTo, flyTo, inertia, etc.\n */\nexport interface ICameraHelper {\n    get useGlobeControls(): boolean;\n\n    handlePanInertia(pan: Point, transform: IReadonlyTransform): {\n        easingCenter: LngLat;\n        easingOffset: Point;\n    };\n\n    handleMapControlsRollPitchBearingZoom(deltas: MapControlsDeltas, tr: ITransform): void;\n\n    handleMapControlsPan(deltas: MapControlsDeltas, tr: ITransform, preZoomAroundLoc: LngLat): void;\n\n    cameraForBoxAndBearing(options: CameraForBoundsOptions, padding: PaddingOptions, bounds: LngLatBounds, bearing: number, tr: IReadonlyTransform): CameraForBoxAndBearingHandlerResult;\n\n    handleJumpToCenterZoom(tr: ITransform, options: { zoom?: number; center?: LngLatLike }): void;\n\n    handleEaseTo(tr: ITransform, options: EaseToHandlerOptions): EaseToHandlerResult;\n\n    handleFlyTo(tr: ITransform, options: FlyToHandlerOptions): FlyToHandlerResult;\n}\n\n/**\n * @internal\n * Set a transform's rotation to a value interpolated between startEulerAngles and endEulerAngles\n */\nexport function updateRotation(args: UpdateRotationArgs): void {\n    if (args.useSlerp) {\n        // At pitch ==0, the Euler angle representation is ambiguous. In this case, set the Euler angles\n        // to the representation requested by the caller\n        if (args.k < 1) {\n            const startRotation = rollPitchBearingToQuat(args.startEulerAngles.roll, args.startEulerAngles.pitch, args.startEulerAngles.bearing);\n            const endRotation = rollPitchBearingToQuat(args.endEulerAngles.roll, args.endEulerAngles.pitch, args.endEulerAngles.bearing);\n            const rotation: quat = new Float64Array(4);\n            quat.slerp(rotation, startRotation, endRotation, args.k);\n            const eulerAngles = getRollPitchBearing(rotation);\n            args.tr.setRoll(eulerAngles.roll);\n            args.tr.setPitch(eulerAngles.pitch);\n            args.tr.setBearing(eulerAngles.bearing);\n        } else {\n            args.tr.setRoll(args.endEulerAngles.roll);\n            args.tr.setPitch(args.endEulerAngles.pitch);\n            args.tr.setBearing(args.endEulerAngles.bearing);\n        }\n    } else {\n        args.tr.setRoll(interpolates.number(args.startEulerAngles.roll, args.endEulerAngles.roll, args.k));\n        args.tr.setPitch(interpolates.number(args.startEulerAngles.pitch, args.endEulerAngles.pitch, args.k));\n        args.tr.setBearing(interpolates.number(args.startEulerAngles.bearing, args.endEulerAngles.bearing, args.k));\n    }\n}\n\nexport function cameraForBoxAndBearing(options: CameraForBoundsOptions, padding: PaddingOptions, bounds: LngLatBounds, bearing: number, tr: IReadonlyTransform): CameraForBoxAndBearingHandlerResult {\n    const edgePadding = tr.padding;\n\n    // Consider all corners of the rotated bounding box derived from the given points\n    // when find the camera position that fits the given points.\n\n    const nwWorld = projectToWorldCoordinates(tr.worldSize, bounds.getNorthWest());\n    const neWorld = projectToWorldCoordinates(tr.worldSize, bounds.getNorthEast());\n    const seWorld = projectToWorldCoordinates(tr.worldSize, bounds.getSouthEast());\n    const swWorld = projectToWorldCoordinates(tr.worldSize, bounds.getSouthWest());\n\n    const bearingRadians = degreesToRadians(-bearing);\n\n    const nwRotatedWorld = nwWorld.rotate(bearingRadians);\n    const neRotatedWorld = neWorld.rotate(bearingRadians);\n    const seRotatedWorld = seWorld.rotate(bearingRadians);\n    const swRotatedWorld = swWorld.rotate(bearingRadians);\n\n    const upperRight = new Point(\n        Math.max(nwRotatedWorld.x, neRotatedWorld.x, swRotatedWorld.x, seRotatedWorld.x),\n        Math.max(nwRotatedWorld.y, neRotatedWorld.y, swRotatedWorld.y, seRotatedWorld.y)\n    );\n\n    const lowerLeft = new Point(\n        Math.min(nwRotatedWorld.x, neRotatedWorld.x, swRotatedWorld.x, seRotatedWorld.x),\n        Math.min(nwRotatedWorld.y, neRotatedWorld.y, swRotatedWorld.y, seRotatedWorld.y)\n    );\n\n    // Calculate zoom: consider the original bbox and padding.\n    const size = upperRight.sub(lowerLeft);\n\n    const availableWidth = (tr.width - (edgePadding.left + edgePadding.right + padding.left + padding.right));\n    const availableHeight = (tr.height - (edgePadding.top + edgePadding.bottom + padding.top + padding.bottom));\n    const scaleX = availableWidth / size.x;\n    const scaleY = availableHeight / size.y;\n\n    if (scaleY < 0 || scaleX < 0) {\n        cameraBoundsWarning();\n        return undefined;\n    }\n\n    const zoom = Math.min(scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom);\n\n    // Calculate center: apply the zoom, the configured offset, as well as offset that exists as a result of padding.\n    const offset = Point.convert(options.offset);\n    const paddingOffsetX = (padding.left - padding.right) / 2;\n    const paddingOffsetY = (padding.top - padding.bottom) / 2;\n    const paddingOffset = new Point(paddingOffsetX, paddingOffsetY);\n    const rotatedPaddingOffset = paddingOffset.rotate(degreesToRadians(bearing));\n    const offsetAtInitialZoom = offset.add(rotatedPaddingOffset);\n    const offsetAtFinalZoom = offsetAtInitialZoom.mult(tr.scale / zoomScale(zoom));\n\n    const center = unprojectFromWorldCoordinates(\n        tr.worldSize,\n        // either world diagonal can be used (NW-SE or NE-SW)\n        nwWorld.add(seWorld).div(2).sub(offsetAtFinalZoom)\n    );\n\n    return {\n        center,\n        zoom,\n        bearing\n    };\n}\n","import type Point from '@mapbox/point-geometry';\nimport {LngLat, type LngLatLike} from '../lng_lat.ts';\nimport {cameraForBoxAndBearing, type CameraForBoxAndBearingHandlerResult, type EaseToHandlerResult, type EaseToHandlerOptions, type FlyToHandlerResult, type FlyToHandlerOptions, type ICameraHelper, type MapControlsDeltas, updateRotation} from './camera_helper.ts';\nimport {normalizeCenter} from '../transform_helper.ts';\nimport {rollPitchBearingEqual, scaleZoom, zoomScale} from '../../util/util.ts';\nimport {getMercatorHorizon, projectToWorldCoordinates, unprojectFromWorldCoordinates} from './mercator_utils.ts';\nimport {interpolates} from '@maplibre/maplibre-gl-style-spec';\n\nimport type {IReadonlyTransform, ITransform} from '../transform_interface.ts';\nimport type {CameraForBoundsOptions} from '../../ui/camera.ts';\nimport type {PaddingOptions} from '../edge_insets.ts';\nimport type {LngLatBounds} from '../lng_lat_bounds.ts';\n\n/**\n * @internal\n */\nexport class MercatorCameraHelper implements ICameraHelper {\n    get useGlobeControls(): boolean { return false; }\n\n    handlePanInertia(pan: Point, transform: IReadonlyTransform): {\n        easingCenter: LngLat;\n        easingOffset: Point;\n    } {\n        // Reduce the offset so that it never goes past the horizon. If it goes past\n        // the horizon, the pan direction is opposite of the intended direction.\n        const offsetLength = pan.mag();\n        const pixelsToHorizon = Math.abs(getMercatorHorizon(transform));\n        const horizonFactor = 0.75; // Must be < 1 to prevent the offset from crossing the horizon\n        const offsetAsPoint = pan.mult(Math.min(pixelsToHorizon * horizonFactor / offsetLength, 1.0));\n        return {\n            easingOffset: offsetAsPoint,\n            easingCenter: transform.center,\n        };\n    }\n\n    handleMapControlsRollPitchBearingZoom(deltas: MapControlsDeltas, tr: ITransform): void {\n        if (deltas.bearingDelta) tr.setBearing(tr.bearing + deltas.bearingDelta);\n        if (deltas.pitchDelta) tr.setPitch(tr.pitch + deltas.pitchDelta);\n        if (deltas.rollDelta) tr.setRoll(tr.roll + deltas.rollDelta);\n        if (deltas.zoomDelta) tr.setZoom(tr.zoom + deltas.zoomDelta);\n    }\n\n    handleMapControlsPan(deltas: MapControlsDeltas, tr: ITransform, preZoomAroundLoc: LngLat): void {\n        // If we are rotating about the center point, there is no need to update the transform center. Doing so causes\n        // a small amount of drift of the center point, especially when pitch is close to 90 degrees.\n        // In this case, return early.\n        if (deltas.around.distSqr(tr.centerPoint) < 1.0e-2) {\n            return;\n        }\n        tr.setLocationAtPoint(preZoomAroundLoc, deltas.around);\n    }\n\n    cameraForBoxAndBearing(options: CameraForBoundsOptions, padding: PaddingOptions, bounds: LngLatBounds, bearing: number, tr: IReadonlyTransform): CameraForBoxAndBearingHandlerResult {\n        return cameraForBoxAndBearing(options, padding, bounds, bearing, tr);\n    }\n\n    handleJumpToCenterZoom(tr: ITransform, options: { zoom?: number; center?: LngLatLike }): void {\n        // Mercator zoom & center handling.\n        const optionsZoom = typeof options.zoom !== 'undefined';\n\n        const zoom = optionsZoom ? +options.zoom : tr.zoom;\n        if (tr.zoom !== zoom) {\n            tr.setZoom(+options.zoom);\n        }\n\n        if (options.center !== undefined) {\n            tr.setCenter(LngLat.convert(options.center));\n        }\n    }\n\n    handleEaseTo(tr: ITransform, options: EaseToHandlerOptions): EaseToHandlerResult {\n        const startZoom = tr.zoom;\n        const startPadding = tr.padding;\n        const startEulerAngles = {roll: tr.roll, pitch: tr.pitch, bearing: tr.bearing};\n        const endRoll = options.roll === undefined ? tr.roll : options.roll;\n        const endPitch = options.pitch === undefined ? tr.pitch : options.pitch;\n        const endBearing = options.bearing === undefined ? tr.bearing : options.bearing;\n        const endEulerAngles = {roll: endRoll, pitch: endPitch, bearing: endBearing};\n\n        const optionsZoom = typeof options.zoom !== 'undefined';\n\n        const doPadding = !tr.isPaddingEqual(options.padding);\n\n        let isZooming = false;\n\n        const zoom = optionsZoom ? +options.zoom : tr.zoom;\n\n        let pointAtOffset = tr.centerPoint.add(options.offsetAsPoint);\n        const locationAtOffset = tr.screenPointToLocation(pointAtOffset);\n        const {center, zoom: endZoom} = tr.applyConstrain(\n            LngLat.convert(options.center || locationAtOffset),\n            zoom ?? startZoom\n        );\n        normalizeCenter(tr, center);\n\n        const from = projectToWorldCoordinates(tr.worldSize, locationAtOffset);\n        const delta = projectToWorldCoordinates(tr.worldSize, center).sub(from);\n\n        const finalScale = zoomScale(endZoom - startZoom);\n        isZooming = (endZoom !== startZoom);\n\n        const easeFunc = (k: number) => {\n            if (isZooming) {\n                tr.setZoom(interpolates.number(startZoom, endZoom, k));\n            }\n            if (!rollPitchBearingEqual(startEulerAngles, endEulerAngles)) {\n                updateRotation({\n                    startEulerAngles,\n                    endEulerAngles,\n                    tr,\n                    k,\n                    useSlerp: startEulerAngles.roll != endEulerAngles.roll});\n            }\n            if (doPadding) {\n                tr.interpolatePadding(startPadding, options.padding, k);\n                // When padding is being applied, Transform.centerPoint is changing continuously,\n                // thus we need to recalculate offsetPoint every frame\n                pointAtOffset = tr.centerPoint.add(options.offsetAsPoint);\n            }\n\n            if (options.around) {\n                tr.setLocationAtPoint(options.around, options.aroundPoint);\n            } else {\n                const scale = zoomScale(tr.zoom - startZoom);\n                const base = endZoom > startZoom ?\n                    Math.min(2, finalScale) :\n                    Math.max(0.5, finalScale);\n                const speedup = Math.pow(base, 1 - k);\n                const newCenter = unprojectFromWorldCoordinates(tr.worldSize, from.add(delta.mult(k * speedup)).mult(scale));\n                tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n            }\n        };\n\n        return {\n            easeFunc,\n            isZooming,\n            elevationCenter: center,\n        };\n    }\n\n    handleFlyTo(tr: ITransform, options: FlyToHandlerOptions): FlyToHandlerResult {\n        const optionsZoom = typeof options.zoom !== 'undefined';\n\n        const startZoom = tr.zoom;\n\n        // Obtain target center and zoom\n        const constrained = tr.applyConstrain(\n            LngLat.convert(options.center || options.locationAtOffset),\n            optionsZoom ? +options.zoom : startZoom\n        );\n        const targetCenter = constrained.center;\n        const targetZoom = constrained.zoom;\n\n        normalizeCenter(tr, targetCenter);\n\n        const startWorldSize = tr.worldSize;\n        const from = projectToWorldCoordinates(startWorldSize, options.locationAtOffset);\n        const delta = projectToWorldCoordinates(startWorldSize, targetCenter).sub(from);\n\n        const pixelPathLength = delta.mag();\n\n        const scaleOfZoom = zoomScale(targetZoom - startZoom);\n\n        const requestedMinZoom = typeof options.minZoom !== 'undefined' ? +options.minZoom : tr.minZoom;\n        const effectiveMinZoom = Math.max(requestedMinZoom, tr.minZoom);\n        const minZoomPreConstrain = Math.min(effectiveMinZoom, startZoom, targetZoom);\n        const minZoom = tr.applyConstrain(targetCenter, minZoomPreConstrain).zoom;\n        const scaleOfMinZoom = zoomScale(minZoom - startZoom);\n\n        const easeFunc = (k: number, scale: number, centerFactor: number, pointAtOffset: Point) => {\n            tr.setZoom(k === 1 ? targetZoom : startZoom + scaleZoom(scale));\n            const newCenter = k === 1\n                ? targetCenter\n                : unprojectFromWorldCoordinates(startWorldSize, from.add(delta.mult(centerFactor)));\n            tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n        };\n\n        return {\n            easeFunc,\n            scaleOfZoom,\n            targetCenter,\n            scaleOfMinZoom,\n            pixelPathLength,\n        };\n    }\n}\n","// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.\n/* eslint-disable */\n\nimport {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';\n\nimport {\n    Properties,\n    DataConstantProperty,\n    DataDrivenProperty,\n    CrossFadedDataDrivenProperty,\n    CrossFadedProperty,\n    ColorRampProperty,\n    PossiblyEvaluatedPropertyValue,\n    CrossFaded\n} from './properties.ts';\n\nimport type {Color, Formatted, Padding, NumberArray, ColorArray, ResolvedImage, VariableAnchorOffsetCollection, ProjectionDefinitionSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';\n\n\nexport type ProjectionProps = {\n    \"type\": DataConstantProperty<ProjectionDefinitionSpecification>,\n};\n\nexport type ProjectionPropsPossiblyEvaluated = {\n    \"type\": ProjectionDefinitionSpecification,\n};\n\nlet properties: Properties<ProjectionProps>;\nexport const getProperties = (): Properties<ProjectionProps> => properties = properties || new Properties({\n    \"type\": new DataConstantProperty(styleSpec[\"projection\"][\"type\"] as any as StylePropertySpecification, \"type\"),\n});","import {type Context} from '../webgl/context.ts';\nimport {Mesh} from '../render/mesh.ts';\nimport {PosArray, TriangleIndexArray} from '../data/array_types.g.ts';\nimport {SegmentVector} from '../data/segment.ts';\nimport {NORTH_POLE_Y, SOUTH_POLE_Y} from '../render/subdivision.ts';\nimport {EXTENT} from '../data/extent.ts';\nimport posAttributes from '../data/pos_attributes.ts';\n\n/**\n * The size of border region for stencil masks, in internal tile coordinates.\n * Used for globe rendering.\n */\nconst EXTENT_STENCIL_BORDER = EXTENT / 128;\n\n/**\n * Options for generating a tile mesh.\n * Can optionally configure any of the following:\n * - mesh subdivision granularity\n * - border presence\n * - special geometry for the north and/or south pole\n */\nexport type CreateTileMeshOptions = {\n    /**\n     * Specifies how much should the tile mesh be subdivided.\n     * A value of 1 leads to a simple quad, a value of 4 will result in a grid of 4x4 quads.\n     */\n    granularity?: number;\n    /**\n     * When true, an additional ring of quads is generated along the border, always extending `EXTENT_STENCIL_BORDER` units away from the main mesh.\n     */\n    generateBorders?: boolean;\n    /**\n     * When true, additional geometry is generated along the north edge of the mesh, connecting it to the pole special vertex position.\n     * This geometry replaces the mesh border along this edge, if one is present.\n     */\n    extendToNorthPole?: boolean;\n    /**\n     * When true, additional geometry is generated along the south edge of the mesh, connecting it to the pole special vertex position.\n     * This geometry replaces the mesh border along this edge, if one is present.\n     */\n    extendToSouthPole?: boolean;\n};\n\n/**\n * Stores the prepared vertex and index buffer bytes for a mesh.\n */\nexport type TileMesh = {\n    /**\n     * The vertex data. Each vertex is two 16 bit signed integers, one for X, one for Y.\n     */\n    vertices: ArrayBuffer;\n    /**\n     * The index data. Each triangle is defined by three indices. The indices may either be 16 bit or 32 bit unsigned integers,\n     * depending on the mesh creation arguments and on whether the mesh can fit into 16 bit indices.\n     */\n    indices: ArrayBuffer;\n    /**\n     * A helper boolean indicating whether the indices are 32 bit.\n     */\n    uses32bitIndices: boolean;\n};\n\n/**\n * Describes desired type of vertex indices, either 16 bit uint, 32 bit uint, or, if undefined, any of the two options.\n */\nexport type IndicesType = '32bit' | '16bit' | undefined;\n\n/**\n * @internal\n * Creates a mesh of a quad that covers the entire tile (covering positions in range 0..EXTENT),\n * is optionally subdivided into finer quads, optionally includes a border\n * and optionally extends to the north and/or special pole vertices.\n * Also allocates and populates WebGL buffers for the mesh.\n * Forces 16 bit indices that are used throughout MapLibre.\n * @param context - The WebGL context wrapper.\n * @param options - Specify options for tile mesh creation such as granularity or border.\n * @returns The mesh vertices and indices, already allocated and uploaded into WebGL buffers.\n */\nexport function createTileMeshWithBuffers(context: Context, options: CreateTileMeshOptions): Mesh {\n    const tileMesh = createTileMesh(options, '16bit');\n    const vertices = PosArray.deserialize({\n        arrayBuffer: tileMesh.vertices,\n        length: tileMesh.vertices.byteLength / 2 / 2, // Two values per vertex, 16 bit\n    });\n    const indices = TriangleIndexArray.deserialize({\n        arrayBuffer: tileMesh.indices,\n        length: tileMesh.indices.byteLength / 2 / 3, // Three values per triangle, 16 bit\n    });\n    return new Mesh(\n        context.createVertexBuffer(vertices, posAttributes.members),\n        context.createIndexBuffer(indices),\n        SegmentVector.simpleSegment(0, 0, vertices.length, indices.length)\n    );\n}\n\n/**\n * Creates a mesh of a quad that covers the entire tile (covering positions in range 0..EXTENT),\n * is optionally subdivided into finer quads, optionally includes a border\n * and optionally extends to the north and/or special pole vertices.\n * Additionally the resulting mesh indices type can be specified using `forceIndicesSize`.\n * @example\n * ```\n * // Creating a mesh for a tile that can be used for raster layers, hillshade, etc.\n * const meshBuffers = createTileMesh({\n *     granularity: map.style.projection.subdivisionGranularity.tile.getGranularityForZoomLevel(tileID.z),\n *     generateBorders: true,\n *     extendToNorthPole: tileID.y === 0,\n *     extendToSouthPole: tileID.y === (1 << tileID.z) - 1,\n * }, '16bit');\n * ```\n * @see [Add a custom layer with tiles to a globe](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-custom-layer-with-tiles-to-a-globe/)\n * @param options - Specify options for tile mesh creation such as granularity or border.\n * @param forceIndicesSize - Specifies what indices type to use. The values '32bit' and '16bit' force their respective indices size. If undefined, the mesh may use either size, and will pick 16 bit indices if possible. If '16bit' is specified and the mesh exceeds 65536 vertices, an exception is thrown.\n * @returns Typed arrays of the mesh vertices and indices.\n */\nexport function createTileMesh(options: CreateTileMeshOptions, forceIndicesSize?: IndicesType): TileMesh {\n    // We only want to generate the north/south border if the tile\n    // does NOT border the north/south edge of the mercator range.\n    const granularity = options.granularity !== undefined ? Math.max(options.granularity, 1) : 1;\n\n    const quadsPerAxisX = granularity + (options.generateBorders ? 2 : 0); // two extra quads for border\n    const quadsPerAxisY = granularity + ((options.extendToNorthPole || options.generateBorders) ? 1 : 0) + (options.extendToSouthPole || options.generateBorders ? 1 : 0);\n    const verticesPerAxisX = quadsPerAxisX + 1; // one more vertex than quads\n    const verticesPerAxisY = quadsPerAxisY + 1; // one more vertex than quads\n    const offsetX = options.generateBorders ? -1 : 0;\n    const offsetY = (options.generateBorders || options.extendToNorthPole) ? -1 : 0;\n    const endX = granularity + (options.generateBorders ? 1 : 0);\n    const endY = granularity + ((options.generateBorders || options.extendToSouthPole) ? 1 : 0);\n\n    const vertexCount = verticesPerAxisX * verticesPerAxisY;\n    const indexCount = quadsPerAxisX * quadsPerAxisY * 6;\n\n    const overflows16bitIndices = verticesPerAxisX * verticesPerAxisY > (1 << 16);\n\n    if (overflows16bitIndices && forceIndicesSize === '16bit') {\n        throw new Error('Granularity is too large and meshes would not fit inside 16 bit vertex indices.');\n    }\n\n    const use32bitIndices = overflows16bitIndices || forceIndicesSize === '32bit';\n\n    const vertices = new Int16Array(vertexCount * 2);\n\n    let vertexId = 0;\n\n    for (let y = offsetY; y <= endY; y++) {\n        for (let x = offsetX; x <= endX; x++) {\n            let vx = x / granularity * EXTENT;\n            if (x === -1) {\n                vx = -EXTENT_STENCIL_BORDER;\n            }\n            if (x === granularity + 1) {\n                vx = EXTENT + EXTENT_STENCIL_BORDER;\n            }\n            let vy = y / granularity * EXTENT;\n            if (y === -1) {\n                vy = options.extendToNorthPole ? NORTH_POLE_Y : (-EXTENT_STENCIL_BORDER);\n            }\n            if (y === granularity + 1) {\n                vy = options.extendToSouthPole ? SOUTH_POLE_Y : EXTENT + EXTENT_STENCIL_BORDER;\n            }\n\n            vertices[vertexId++] = vx;\n            vertices[vertexId++] = vy;\n        }\n    }\n\n    const indices = use32bitIndices ? new Uint32Array(indexCount) : new Uint16Array(indexCount);\n\n    let indexId = 0;\n\n    for (let y = 0; y < quadsPerAxisY; y++) {\n        for (let x = 0; x < quadsPerAxisX; x++) {\n            const v0 = x + y * verticesPerAxisX;\n            const v1 = (x + 1) + y * verticesPerAxisX;\n            const v2 = x + (y + 1) * verticesPerAxisX;\n            const v3 = (x + 1) + (y + 1) * verticesPerAxisX;\n\n            // v0----v1\n            //  |  / |\n            //  | /  |\n            // v2----v3\n            indices[indexId++] = v0;\n            indices[indexId++] = v2;\n            indices[indexId++] = v1;\n\n            indices[indexId++] = v1;\n            indices[indexId++] = v2;\n            indices[indexId++] = v3;\n        }\n    }\n\n    return {\n        vertices: vertices.buffer.slice(0),\n        indices: indices.buffer.slice(0),\n        uses32bitIndices: use32bitIndices,\n    };\n}\n","import type {Context} from '../../webgl/context.ts';\nimport type {CanonicalTileID} from '../../tile/tile_id.ts';\nimport {type Mesh} from '../../render/mesh.ts';\nimport {SubdivisionGranularityExpression, SubdivisionGranularitySetting} from '../../render/subdivision_granularity_settings.ts';\nimport type {Projection, TileMeshUsage} from './projection.ts';\nimport {type PreparedShader, shaders} from '../../shaders/shaders.ts';\nimport {createTileMeshWithBuffers, type CreateTileMeshOptions} from '../../util/create_tile_mesh.ts';\nimport {type EvaluationParameters} from '../../style/evaluation_parameters.ts';\n\nexport const VerticalPerspectiveShaderDefine = '#define GLOBE';\nexport const VerticalPerspectiveShaderVariantKey = 'globe';\n\nconst granularitySettingsGlobe: SubdivisionGranularitySetting = new SubdivisionGranularitySetting({\n    fill: new SubdivisionGranularityExpression(128, 2),\n    line: new SubdivisionGranularityExpression(512, 0),\n    // Always keep at least some subdivision on raster tiles, etc,\n    // otherwise they will be visibly warped at high zooms (before mercator transition).\n    // This si not needed on fill, because fill geometry tends to already be\n    // highly tessellated and granular at high zooms.\n    tile: new SubdivisionGranularityExpression(128, 32),\n    // Stencil granularity must never be higher than fill granularity,\n    // otherwise we would get seams in the oceans at zoom levels where\n    // stencil has higher granularity than fill.\n    stencil: new SubdivisionGranularityExpression(128, 1),\n    circle: 3\n});\n\nexport class VerticalPerspectiveProjection implements Projection {\n    private _tileMeshCache: {[_: string]: Mesh} = {};\n\n    get name(): 'vertical-perspective' {\n        return 'vertical-perspective';\n    }\n\n    get transitionState(): number {\n        return 1;\n    }\n\n    get useSubdivision(): boolean {\n        return true;\n    }\n\n    get shaderVariantName(): string {\n        return VerticalPerspectiveShaderVariantKey;\n    }\n\n    get shaderDefine(): string {\n        return VerticalPerspectiveShaderDefine;\n    }\n\n    get shaderPreludeCode(): PreparedShader {\n        return shaders.projectionGlobe;\n    }\n\n    get vertexShaderPreludeCode(): string {\n        return shaders.projectionMercator.vertexSource;\n    }\n\n    get subdivisionGranularity(): SubdivisionGranularitySetting {\n        return granularitySettingsGlobe;\n    }\n\n    get useGlobeControls(): boolean {\n        return true;\n    }\n\n    public destroy(): void {\n        // Do nothing.\n    }\n\n    private _getMeshKey(options: CreateTileMeshOptions): string {\n        return `${options.granularity.toString(36)}_${options.generateBorders ? 'b' : ''}${options.extendToNorthPole ? 'n' : ''}${options.extendToSouthPole ? 's' : ''}`;\n    }\n\n    public getMeshFromTileID(context: Context, canonical: CanonicalTileID, hasBorder: boolean, allowPoles: boolean, usage: TileMeshUsage): Mesh {\n        // Stencil granularity must match fill granularity\n        const granularityConfig = usage === 'stencil' ? granularitySettingsGlobe.stencil : granularitySettingsGlobe.tile;\n        const granularity = granularityConfig.getGranularityForZoomLevel(canonical.z);\n        const north = (canonical.y === 0) && allowPoles;\n        const south = (canonical.y === (1 << canonical.z) - 1) && allowPoles;\n        return this._getMesh(context, {\n            granularity,\n            generateBorders: hasBorder,\n            extendToNorthPole: north,\n            extendToSouthPole: south,\n        });\n    }\n\n    private _getMesh(context: Context, options: CreateTileMeshOptions): Mesh {\n        const key = this._getMeshKey(options);\n\n        if (key in this._tileMeshCache) {\n            return this._tileMeshCache[key];\n        }\n\n        const mesh = createTileMeshWithBuffers(context, options);\n        this._tileMeshCache[key] = mesh;\n        return mesh;\n    }\n\n    recalculate(_params: EvaluationParameters): void {\n        // Do nothing.\n    }\n\n    hasTransition(): boolean {\n        return false;\n    }\n}","import {ProjectionDefinition, type ProjectionSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport {type PossiblyEvaluated, Transitionable, type Transitioning, type TransitionParameters} from '../../style/properties.ts';\nimport {getProperties, type ProjectionProps, type ProjectionPropsPossiblyEvaluated} from '../../style/projection_properties.g.ts';\nimport {Evented} from '../../util/evented.ts';\nimport {EvaluationParameters} from '../../style/evaluation_parameters.ts';\nimport {MercatorProjection} from './mercator_projection.ts';\nimport {VerticalPerspectiveProjection} from './vertical_perspective_projection.ts';\nimport {type Projection, type TileMeshUsage} from './projection.ts';\nimport {type PreparedShader} from '../../shaders/shaders.ts';\nimport {type SubdivisionGranularitySetting} from '../../render/subdivision_granularity_settings.ts';\nimport {type Context} from '../../webgl/context.ts';\nimport {type CanonicalTileID} from '../../tile/tile_id.ts';\nimport {type Mesh} from '../../render/mesh.ts';\n\nexport class GlobeProjection extends Evented implements Projection {\n    properties: PossiblyEvaluated<ProjectionProps, ProjectionPropsPossiblyEvaluated>;\n\n    _transitionable: Transitionable<ProjectionProps>;\n    _transitioning: Transitioning<ProjectionProps>;\n    _mercatorProjection: MercatorProjection;\n    _verticalPerspectiveProjection: VerticalPerspectiveProjection;\n\n    constructor(projection: ProjectionSpecification | undefined, globalState: Record<string, any>) {\n        super();\n        this._transitionable = new Transitionable(getProperties(), 'projection', globalState);\n        this.setProjection(projection);\n        this._transitioning = this._transitionable.untransitioned();\n        this.recalculate(new EvaluationParameters(0));\n        this._mercatorProjection = new MercatorProjection();\n        this._verticalPerspectiveProjection = new VerticalPerspectiveProjection();\n    }\n\n    public get transitionState(): number {\n        const currentProjectionSpecValue = this.properties.get('type');\n        if (typeof currentProjectionSpecValue === 'string' && currentProjectionSpecValue === 'mercator') {\n            return 0;\n        }\n        if (typeof currentProjectionSpecValue === 'string' && currentProjectionSpecValue === 'vertical-perspective') {\n            return 1;\n        }\n        if (currentProjectionSpecValue instanceof ProjectionDefinition) {\n            if (currentProjectionSpecValue.from === currentProjectionSpecValue.to) {\n                return currentProjectionSpecValue.from === 'mercator' ? 0 : 1;\n            }\n            if (currentProjectionSpecValue.from === 'vertical-perspective' && currentProjectionSpecValue.to === 'mercator') {\n                return 1 - currentProjectionSpecValue.transition;\n            }\n            if (currentProjectionSpecValue.from === 'mercator' && currentProjectionSpecValue.to === 'vertical-perspective') {\n                return currentProjectionSpecValue.transition;\n            }\n        };\n        return 1;\n    }\n\n    get useGlobeRendering(): boolean {\n        return this.transitionState > 0;\n    }\n\n    private get currentProjection(): Projection {\n        return this.useGlobeRendering ? this._verticalPerspectiveProjection : this._mercatorProjection;\n    }\n\n    get name(): ProjectionSpecification['type'] {\n        return 'globe';\n    }\n\n    get useSubdivision(): boolean {\n        return this.currentProjection.useSubdivision;\n    }\n\n    get shaderVariantName(): string {\n        return this.currentProjection.shaderVariantName;\n    }\n\n    get shaderDefine(): string {\n        return this.currentProjection.shaderDefine;\n    }\n\n    get shaderPreludeCode(): PreparedShader {\n        return this.currentProjection.shaderPreludeCode;\n    }\n\n    get vertexShaderPreludeCode(): string {\n        return this.currentProjection.vertexShaderPreludeCode;\n    }\n\n    get subdivisionGranularity(): SubdivisionGranularitySetting {\n        return this.currentProjection.subdivisionGranularity;\n    }\n\n    get useGlobeControls(): boolean {\n        return this.transitionState > 0;\n    }\n\n    public destroy(): void {\n        this._mercatorProjection.destroy();\n        this._verticalPerspectiveProjection.destroy();\n    }\n\n    public getMeshFromTileID(context: Context, _tileID: CanonicalTileID, _hasBorder: boolean, _allowPoles: boolean, _usage: TileMeshUsage): Mesh {\n        return this.currentProjection.getMeshFromTileID(context, _tileID, _hasBorder, _allowPoles, _usage);\n    }\n\n    setProjection(projection?: ProjectionSpecification): void {\n        this._transitionable.setValue('type', projection?.type || 'mercator');\n    }\n\n    updateTransitions(parameters: TransitionParameters): void {\n        this._transitioning = this._transitionable.transitioned(parameters, this._transitioning);\n    }\n\n    hasTransition(): boolean {\n        return this._transitioning.hasTransition() || this.currentProjection.hasTransition();\n    }\n\n    recalculate(parameters: EvaluationParameters): void {\n        this.properties = this._transitioning.possiblyEvaluate(parameters);\n    }\n}\n","import {type ReadonlyVec4, vec3} from 'gl-matrix';\nimport {clamp, createVec3f64, lerp, MAX_VALID_LATITUDE, mod, remapSaturate, scaleZoom, wrap} from '../../util/util.ts';\nimport {LngLat} from '../lng_lat.ts';\nimport {EXTENT} from '../../data/extent.ts';\nimport type Point from '@mapbox/point-geometry';\n\nexport function getGlobeCircumferencePixels(transform: {worldSize: number; center: {lat: number}}): number {\n    const radius = getGlobeRadiusPixels(transform.worldSize, transform.center.lat);\n    return 2.0 * Math.PI * radius;\n}\n\nexport function globeDistanceOfLocationsPixels(transform: {worldSize: number; center: {lat: number}}, a: LngLat, b: LngLat): number {\n    const vecA = angularCoordinatesToSurfaceVector(a);\n    const vecB = angularCoordinatesToSurfaceVector(b);\n    const dot = vec3.dot(vecA, vecB);\n    const radians = Math.acos(dot);\n    const circumference = getGlobeCircumferencePixels(transform);\n    return radians / (2.0 * Math.PI) * circumference;\n}\n\n/**\n * For given mercator coordinates in range 0..1, returns the angular coordinates on the sphere's surface, in radians.\n */\nexport function mercatorCoordinatesToAngularCoordinatesRadians(mercatorX: number, mercatorY: number): [number, number] {\n    const sphericalX = mod(mercatorX * Math.PI * 2.0 + Math.PI, Math.PI * 2);\n    const sphericalY = 2.0 * Math.atan(Math.exp(Math.PI - (mercatorY * Math.PI * 2.0))) - Math.PI * 0.5;\n    return [sphericalX, sphericalY];\n}\n\n/**\n * For a given longitude and latitude (note: in radians) returns the normalized vector from the planet center to the specified place on the surface.\n * @param lngRadians - Longitude in radians.\n * @param latRadians - Latitude in radians.\n */\nexport function angularCoordinatesRadiansToVector(lngRadians: number, latRadians: number): vec3 {\n    const len = Math.cos(latRadians);\n    const vec = new Float64Array(3) as any;\n    vec[0] = Math.sin(lngRadians) * len;\n    vec[1] = Math.sin(latRadians);\n    vec[2] = Math.cos(lngRadians) * len;\n    return vec;\n}\n\n/**\n * Projects a point within a tile to the surface of the unit sphere globe.\n * @param inTileX - X coordinate inside the tile in range [0 .. 8192].\n * @param inTileY - Y coordinate inside the tile in range [0 .. 8192].\n * @param tileIdX - Tile's X coordinate in range [0 .. 2^zoom - 1].\n * @param tileIdY - Tile's Y coordinate in range [0 .. 2^zoom - 1].\n * @param tileIdZ - Tile's zoom.\n * @returns A 3D vector - coordinates of the projected point on a unit sphere.\n */\nexport function projectTileCoordinatesToSphere(inTileX: number, inTileY: number, tileIdX: number, tileIdY: number, tileIdZ: number): vec3 {\n    // This code could be assembled from 3 functions, but this is a hot path for symbol placement,\n    // so for optimization purposes everything is inlined by hand.\n    //\n    // Non-inlined variant of this function would be this:\n    //     const mercator = tileCoordinatesToMercatorCoordinates(inTileX, inTileY, tileID);\n    //     const angular = mercatorCoordinatesToAngularCoordinatesRadians(mercator.x, mercator.y);\n    //     const sphere = angularCoordinatesRadiansToVector(angular[0], angular[1]);\n    //     return sphere;\n    const scale = 1.0 / (1 << tileIdZ);\n    const mercatorX = inTileX / EXTENT * scale + tileIdX * scale;\n    const mercatorY = inTileY / EXTENT * scale + tileIdY * scale;\n    const sphericalX = mod(mercatorX * Math.PI * 2.0 + Math.PI, Math.PI * 2);\n    const sphericalY = 2.0 * Math.atan(Math.exp(Math.PI - (mercatorY * Math.PI * 2.0))) - Math.PI * 0.5;\n    const len = Math.cos(sphericalY);\n    const vec = new Float64Array(3) as any;\n    vec[0] = Math.sin(sphericalX) * len;\n    vec[1] = Math.sin(sphericalY);\n    vec[2] = Math.cos(sphericalX) * len;\n    return vec;\n}\n\n/**\n * For a given longitude and latitude (note: in degrees) returns the normalized vector from the planet center to the specified place on the surface.\n */\nexport function angularCoordinatesToSurfaceVector(lngLat: LngLat): vec3 {\n    return angularCoordinatesRadiansToVector(lngLat.lng * Math.PI / 180, lngLat.lat * Math.PI / 180);\n}\n\nexport function getGlobeRadiusPixels(worldSize: number, latitudeDegrees: number): number {\n    // We want zoom levels to be consistent between globe and flat views.\n    // This means that the pixel size of features at the map center point\n    // should be the same for both globe and flat view.\n    // For this reason we scale the globe up when map center is nearer to the poles.\n    return worldSize / (2.0 * Math.PI) / Math.cos(latitudeDegrees * Math.PI / 180);\n}\n\n/**\n * Given a 3D point on the surface of a unit sphere, returns its angular coordinates in degrees.\n * The input vector must be normalized.\n */\nexport function sphereSurfacePointToCoordinates(surface: vec3): LngLat {\n    const latRadians = Math.asin(surface[1]);\n    const latDegrees = latRadians / Math.PI * 180.0;\n    const lengthXZ = Math.sqrt(surface[0] * surface[0] + surface[2] * surface[2]);\n    if (lengthXZ > 1e-6) {\n        const projX = surface[0] / lengthXZ;\n        const projZ = surface[2] / lengthXZ;\n        const acosZ = Math.acos(projZ);\n        const lngRadians = (projX > 0) ? acosZ : -acosZ;\n        const lngDegrees = lngRadians / Math.PI * 180.0;\n        return new LngLat(wrap(lngDegrees, -180, 180), latDegrees);\n    } else {\n        return new LngLat(0.0, latDegrees);\n    }\n}\n\n/**\n * Given a normalized horizon plane in Ax+By+Cz+D=0 format, compute the center and radius of\n * the circle in that plain that contains the entire visible portion of the unit sphere from horizon\n * to horizon.\n * @param horizonPlane - The plane that passes through visible horizon in Ax + By + Cz + D = 0 format where mag(A,B,C)=1\n * @returns the center point and radius of the disc that passes through the entire visible horizon\n */\nexport function horizonPlaneToCenterAndRadius(horizonPlane: ReadonlyVec4): { center: vec3; radius: number } {\n    const center = createVec3f64();\n    center[0] = horizonPlane[0] * -horizonPlane[3];\n    center[1] = horizonPlane[1] * -horizonPlane[3];\n    center[2] = horizonPlane[2] * -horizonPlane[3];\n    /*\n                     .*******\n                 ****|\\\n               **    | \\\n             **      |  1\n            * radius |   \\\n           *         |    \\\n           *  center +--D--+(0,0,0)\n     */\n    const radius = Math.sqrt(1 - horizonPlane[3] * horizonPlane[3]);\n    return {center, radius};\n}\n\n/**\n * Computes the closest point on a sphere to `point`.\n * @param center - Center of the sphere\n * @param radius - Radius of the sphere\n * @param point - Point inside or outside the sphere\n * @returns A 3d vector of the point on the sphere closest to `point`\n */\nexport function clampToSphere(center: vec3, radius: number, point: vec3): vec3 {\n    const relativeToCenter = createVec3f64();\n    vec3.sub(relativeToCenter, point, center);\n    const clamped = createVec3f64();\n    vec3.scaleAndAdd(clamped, center, relativeToCenter, radius / vec3.len(relativeToCenter));\n    return clamped;\n}\n\nfunction planetScaleAtLatitude(latitudeDegrees: number): number {\n    return Math.cos(latitudeDegrees * Math.PI / 180);\n}\n\n/**\n * Computes how much to modify zoom to keep the globe size constant when changing latitude.\n * @param transform - An instance of any transform. Does not have any relation on the computed values.\n * @param oldLat - Latitude before change, in degrees.\n * @param newLat - Latitude after change, in degrees.\n * @returns A value to add to zoom level used for old latitude to keep same planet radius at new latitude.\n */\nexport function getZoomAdjustment(oldLat: number, newLat: number): number {\n    const oldCircumference = planetScaleAtLatitude(oldLat);\n    const newCircumference = planetScaleAtLatitude(newLat);\n    return scaleZoom(newCircumference / oldCircumference);\n}\n\nexport function getDegreesPerPixel(worldSize: number, lat: number): number {\n    return 360.0 / getGlobeCircumferencePixels({worldSize, center: {lat}});\n}\n\n/**\n * Returns transform's new center rotation after applying panning.\n * @param panDelta - Panning delta, in same units as what is supplied to {@link HandlerManager}.\n * @param tr - Current transform. This object is not modified by the function.\n * @returns New center location to set to the map's transform to apply the specified panning.\n */\nexport function computeGlobePanCenter(panDelta: Point, tr: {\n    readonly bearingInRadians: number;\n    readonly worldSize: number;\n    readonly center: LngLat;\n    readonly zoom: number;\n}): LngLat {\n    // Apply map bearing to the panning vector\n    const rotatedPanDelta = panDelta.rotate(tr.bearingInRadians);\n    // Compute what the current zoom would be if the transform center would be moved to latitude 0.\n    const normalizedGlobeZoom = tr.zoom + getZoomAdjustment(tr.center.lat, 0);\n    // Note: we divide longitude speed by planet width at the given latitude. But we diminish this effect when the globe is zoomed out a lot.\n    const lngSpeed = lerp(\n        1.0 / planetScaleAtLatitude(tr.center.lat), // speed adjusted by latitude\n        1.0 / planetScaleAtLatitude(Math.min(Math.abs(tr.center.lat), 60)), // also adjusted, but latitude is clamped to 60° to avoid too large speeds near poles\n        remapSaturate(normalizedGlobeZoom, 7, 3, 0, 1.0) // Values chosen so that globe interactions feel good. Not scientific by any means.\n    );\n    const panningDegreesPerPixel = getDegreesPerPixel(tr.worldSize, tr.center.lat);\n    return new LngLat(\n        tr.center.lng - rotatedPanDelta.x * panningDegreesPerPixel * lngSpeed,\n        clamp(tr.center.lat + rotatedPanDelta.y * panningDegreesPerPixel, -MAX_VALID_LATITUDE, MAX_VALID_LATITUDE)\n    );\n}\n\n/**\n * Integration of `1 / cos(x)`.\n */\nfunction integrateSecX(x: number): number {\n    const xHalf = 0.5 * x;\n    const sin = Math.sin(xHalf);\n    const cos = Math.cos(xHalf);\n    return Math.log(sin + cos) - Math.log(cos - sin);\n}\n\n/**\n * Interpolates globe center between two locations while preserving apparent rotation speed during interpolation.\n * @param start - The starting location of the interpolation.\n * @param deltaLng - Longitude delta to the end of the interpolation.\n * @param deltaLat - Latitude delta to the end of the interpolation.\n * @param t - The interpolation point in [0..1], where 0 is starting location, 1 is end location and other values are in between.\n * @returns The interpolated location.\n */\nexport function interpolateLngLatForGlobe(start: LngLat, deltaLng: number, deltaLat: number, t: number): LngLat {\n    // Rate of change of longitude when moving the globe should be roughly 1/cos(latitude)\n    // We want to use this rate of change, even for interpolation during easing.\n    // Thus we know the derivative of our interpolation function: 1/cos(x)\n    // To get our interpolation function, we need to integrate that.\n\n    const interpolatedLat = start.lat + deltaLat * t;\n\n    if (Math.abs(deltaLat) > 1) {\n        const endLat = start.lat + deltaLat;\n        const onDifferentHemispheres = Math.sign(endLat) !== Math.sign(start.lat);\n        // Where do we sample the integrated speed curve?\n        const samplePointStart = (onDifferentHemispheres ? -Math.abs(start.lat) : Math.abs(start.lat)) * Math.PI / 180;\n        const samplePointEnd = Math.abs(start.lat + deltaLat) * Math.PI / 180;\n        // Read the integrated speed curve at those points, and at the interpolation value \"t\".\n        const valueT = integrateSecX(samplePointStart + t * (samplePointEnd - samplePointStart));\n        const valueStart = integrateSecX(samplePointStart);\n        const valueEnd = integrateSecX(samplePointEnd);\n        // Compute new interpolation factor based on the speed curve\n        const newT = (valueT - valueStart) / (valueEnd - valueStart);\n        // Interpolate using that factor\n        const interpolatedLng = start.lng + deltaLng * newT;\n        return new LngLat(\n            interpolatedLng,\n            interpolatedLat\n        );\n    } else {\n        // Fall back to simple interpolation when latitude doesn't change much.\n        const interpolatedLng = start.lng + deltaLng * t;\n        return new LngLat(\n            interpolatedLng,\n            interpolatedLat\n        );\n    }\n}\n","import {type CoveringTilesOptionsInternal} from '../../geo/projection/covering_tiles.ts';\nimport {type IBoundingVolume} from './bounding_volume.ts';\n\ntype BoundingVolumeFactory<T extends IBoundingVolume> = (tileID: {x: number; y: number; z: number}, wrap: number, elevation: number, options: CoveringTilesOptionsInternal) => T;\n\nexport class BoundingVolumeCache<T extends IBoundingVolume> {\n    private _cachePrevious: Map<string, T> = new Map();\n    private _cache: Map<string, T> = new Map();\n    private _hadAnyChanges = false;\n    private _boundingVolumeFactory: BoundingVolumeFactory<T>;\n\n    constructor(boundingVolumeFactory: BoundingVolumeFactory<T>) {\n        this._boundingVolumeFactory = boundingVolumeFactory;\n    }\n\n    /**\n     * Prepares bounding volume cache for next frame. Call at the beginning of a frame.\n     * Bounding volume of any tile accesses in the last frame is kept in the cache, other (unaccessed) bounding volumes are deleted.\n     */\n    swapBuffers(): void {\n        if (!this._hadAnyChanges) {\n            // If no new bounding volumes were added this frame, no need to conserve memory, do not clear caches.\n            return;\n        }\n        const oldCache = this._cachePrevious;\n        this._cachePrevious = this._cache;\n        this._cache = oldCache;\n        this._cache.clear();\n        this._hadAnyChanges = false;\n    }\n\n    /**\n     * Returns the bounding volume of the specified tile, fetching it from cache or creating it using the factory function if needed.\n     * @param tileID - Tile x, y and z for zoom.\n     */\n    getTileBoundingVolume(tileID: {x: number; y: number; z: number}, wrap: number, elevation: number, options: CoveringTilesOptionsInternal): T {\n        // Elevation affects the computed volume (see getElevationForTileCulling);\n        // rounding keeps sub-meter changes from defeating the cache.\n        const key = `${tileID.z}_${tileID.x}_${tileID.y}_${options?.terrain ? 't' : ''}_${Math.round(elevation)}`;\n        const cached = this._cache.get(key);\n        if (cached) {\n            return cached;\n        }\n        const cachedPrevious = this._cachePrevious.get(key);\n        if (cachedPrevious) {\n            this._cache.set(key, cachedPrevious);\n            return cachedPrevious;\n        }\n        const boundingVolume = this._boundingVolumeFactory(tileID, wrap, elevation, options);\n        this._cache.set(key, boundingVolume);\n        this._hadAnyChanges = true;\n        return boundingVolume;\n    }\n}\n","import {quat, vec3, type vec4} from 'gl-matrix';\nimport {type Frustum} from './frustum.ts';\nimport {IntersectionResult, type IBoundingVolume} from './bounding_volume.ts';\n\n/**\n * A general convex bounding volume, defined by a set of points.\n */\nexport class ConvexVolume implements IBoundingVolume {\n    // Precomputed AABB for rejecting frustum intersection.\n    min: vec3;\n    max: vec3;\n\n    points: vec3[];\n    planes: vec4[];\n\n    /**\n     * Creates an instance of a general convex bounding volume.\n     * Note that the provided points array is used *as is*, its contents are not copied!\n     *\n     * Additionally, an AABB must be provided for rejecting frustum intersections.\n     * This AABB does not need to bound this convex volume (it may be smaller),\n     * but it *must* accurately bound the actual shape this volume is approximating.\n     * @param points - Points forming the convex shape. Note that this array reference is used *as is*, its contents are not copied!\n     * @param min - The bounding AABB's min point.\n     * @param max - The bounding AABB's min point.\n     */\n    constructor(points: vec3[], planes: vec4[], min: vec3, max: vec3) {\n        this.min = min;\n        this.max = max;\n        this.points = points;\n        this.planes = planes;\n    }\n\n    /**\n     * Creates a convex BV equivalent to the specified AABB.\n     * @param min - The AABB's min point.\n     * @param max - The AABB's max point.\n     */\n    public static fromAabb(min: vec3, max: vec3): ConvexVolume {\n        const points = [];\n        for (let i = 0; i < 8; i++) {\n            points.push([\n                ((i >> 0) & 1) === 1 ? max[0] : min[0],\n                ((i >> 1) & 1) === 1 ? max[1] : min[1],\n                ((i >> 2) & 1) === 1 ? max[2] : min[2]\n            ]);\n        }\n        return new ConvexVolume(points, [\n            [-1, 0, 0, max[0]],\n            [1, 0, 0, -min[0]],\n            [0, -1, 0, max[1]],\n            [0, 1, 0, -min[1]],\n            [0, 0, -1, max[2]],\n            [0, 0, 1, -min[2]]\n        ], min, max);\n    }\n\n    /**\n     * Creates a convex bounding volume that is actually an oriented bounding box created from the specified center, half-size and rotation angles.\n     * @param center - Center of the OBB.\n     * @param halfSize - The half-size of the OBB in each axis. The box will extend by this value in each direction for the given axis.\n     * @param angles - The rotation of the box. Euler angles, in degrees.\n     */\n    public static fromCenterSizeAngles(center: vec3, halfSize: vec3, angles: vec3): ConvexVolume {\n        const q = quat.fromEuler([], angles[0], angles[1], angles[2]);\n        const axisX = vec3.transformQuat([], [halfSize[0], 0, 0], q);\n        const axisY = vec3.transformQuat([], [0, halfSize[1], 0], q);\n        const axisZ = vec3.transformQuat([], [0, 0, halfSize[2]], q);\n        // Find the AABB min/max\n        const min = [...center] as vec3;\n        const max = [...center] as vec3;\n        for (let i = 0; i < 8; i++) {\n            for (let axis = 0; axis < 3; axis++) {\n                const point = center[axis]\n                    + axisX[axis] * ((((i >> 0) & 1) === 1) ? 1 : -1)\n                    + axisY[axis] * ((((i >> 1) & 1) === 1) ? 1 : -1)\n                    + axisZ[axis] * ((((i >> 2) & 1) === 1) ? 1 : -1);\n                min[axis] = Math.min(min[axis], point);\n                max[axis] = Math.max(max[axis], point);\n            }\n        }\n        const points = [];\n        for (let i = 0; i < 8; i++) {\n            const p = [...center] as vec3;\n            vec3.add(p, p, vec3.scale([], axisX, ((i >> 0) & 1) === 1 ? 1 : -1));\n            vec3.add(p, p, vec3.scale([], axisY, ((i >> 1) & 1) === 1 ? 1 : -1));\n            vec3.add(p, p, vec3.scale([], axisZ, ((i >> 2) & 1) === 1 ? 1 : -1));\n            points.push(p);\n        }\n        return new ConvexVolume(points, [\n            [...axisX, -vec3.dot(axisX, points[0])] as vec4,\n            [...axisY, -vec3.dot(axisY, points[0])] as vec4,\n            [...axisZ, -vec3.dot(axisZ, points[0])] as vec4,\n            [-axisX[0], -axisX[1], -axisX[2], -vec3.dot(axisX, points[7])] as vec4,\n            [-axisY[0], -axisY[1], -axisY[2], -vec3.dot(axisY, points[7])] as vec4,\n            [-axisZ[0], -axisZ[1], -axisZ[2], -vec3.dot(axisZ, points[7])] as vec4,\n        ], min, max);\n    }\n\n    /**\n     * Performs an approximate frustum-obb intersection test.\n     */\n    intersectsFrustum(frustum: Frustum): IntersectionResult {\n        // Performance-critical\n        let fullyInside = true;\n\n        const boxPointCount = this.points.length;\n        const boxPlaneCount = this.planes.length;\n        const frustumPlaneCount = frustum.planes.length;\n        const frustumPointCount = frustum.points.length;\n\n        // Test whether this volume's points are inside the frustum\n        for (let i = 0; i < frustumPlaneCount; i++) {\n            const plane = frustum.planes[i];\n            let boxPointsPassed = 0;\n            for(let j = 0; j < boxPointCount; j++) {\n                const point = this.points[j];\n                // Get point-plane distance sign\n                if (plane[0] * point[0] + plane[1] * point[1] + plane[2] * point[2] + plane[3] >= 0) {\n                    boxPointsPassed++;\n                }\n            }\n\n            if (boxPointsPassed === 0) {\n                return IntersectionResult.None;\n            }\n            if (boxPointsPassed < boxPointCount) {\n                fullyInside = false;\n            }\n        }\n\n        if (fullyInside) {\n            return IntersectionResult.Full;\n        }\n\n        // Test whether the frustum's points are inside this volume.\n        for (let i = 0; i < boxPlaneCount; i++) {\n            const plane = this.planes[i];\n            let frustumPointsPassed = 0;\n            for (let j = 0; j < frustumPointCount; j++) {\n                const point = frustum.points[j];\n                if (plane[0] * point[0] + plane[1] * point[1] + plane[2] * point[2] + plane[3] >= 0) {\n                    frustumPointsPassed++;\n                }\n            }\n            if (frustumPointsPassed === 0) {\n                return IntersectionResult.None;\n            }\n        }\n\n        return IntersectionResult.Partial;\n    }\n\n    /**\n     * Performs an intersection test with a halfspace.\n     */\n    intersectsPlane(plane: vec4): IntersectionResult {\n        const pointCount = this.points.length;\n        let positivePoints = 0;\n        for (let i = 0; i < pointCount; i++) {\n            const point = this.points[i];\n            if (plane[0] * point[0] + plane[1] * point[1] + plane[2] * point[2] + plane[3] >= 0) {\n                positivePoints++;\n            }\n        }\n\n        if (positivePoints === pointCount) {\n            return IntersectionResult.Full;\n        }\n        if (positivePoints === 0) {\n            return IntersectionResult.None;\n        }\n        return IntersectionResult.Partial;\n    }\n}\n","import {EXTENT} from '../../data/extent.ts';\nimport {projectTileCoordinatesToSphere} from './globe_utils.ts';\nimport {BoundingVolumeCache} from '../../util/primitives/bounding_volume_cache.ts';\nimport {coveringZoomLevel, type CoveringTilesOptionsInternal} from './covering_tiles.ts';\nimport {vec3, type vec4} from 'gl-matrix';\nimport type {IReadonlyTransform} from '../transform_interface.ts';\nimport type {MercatorCoordinate} from '../mercator_coordinate.ts';\nimport type {CoveringTilesDetailsProvider} from './covering_tiles_details_provider.ts';\nimport {OverscaledTileID} from '../../tile/tile_id.ts';\nimport {earthRadius} from '../lng_lat.ts';\nimport {ConvexVolume} from '../../util/primitives/convex_volume.ts';\nimport type {IBoundingVolume} from '../../util/primitives/bounding_volume.ts';\nimport {threePlaneIntersection} from '../../util/util.ts';\n\n/**\n * Computes distance of a point to a tile in an arbitrary axis.\n * World is assumed to have size 1, distance returned is to the nearer tile edge.\n * @param point - Point position.\n * @param tile - Tile position.\n * @param tileSize - Tile size.\n */\nfunction distanceToTileSimple(point: number, tile: number, tileSize: number): number {\n    const delta = point - tile;\n    return (delta < 0) ? -delta : Math.max(0, delta - tileSize);\n}\n\nfunction distanceToTileWrapX(pointX: number, pointY: number, tileCornerX: number, tileCornerY: number, tileSize: number): number {\n    const tileCornerToPointX = pointX - tileCornerX;\n\n    let distanceX: number;\n    if (tileCornerToPointX < 0) {\n        // Point is left of tile\n        distanceX = Math.min(-tileCornerToPointX, 1.0 + tileCornerToPointX - tileSize);\n    } else if (tileCornerToPointX > tileSize) {\n        // Point is right of tile\n        distanceX = Math.min(Math.max(tileCornerToPointX - tileSize, 0), 1.0 - tileCornerToPointX);\n    } else {\n        // Point is inside tile in the X axis.\n        distanceX = 0;\n    }\n\n    return Math.max(distanceX, distanceToTileSimple(pointY, tileCornerY, tileSize));\n}\n\nexport class GlobeCoveringTilesDetailsProvider implements CoveringTilesDetailsProvider {\n    private _boundingVolumeCache: BoundingVolumeCache<ConvexVolume> = new BoundingVolumeCache(this._computeTileBoundingVolume);\n\n    /**\n     * Prepares the internal bounding volume cache for the next frame.\n     */\n    prepareNextFrame(): void {\n        this._boundingVolumeCache.swapBuffers();\n    }\n\n    /**\n     * Returns the distance of a point to a square tile. If the point is inside the tile, returns 0.\n     * Assumes the world to be of size 1.\n     * Handles distances on a sphere correctly: X is wrapped when crossing the antimeridian,\n     * when crossing the poles Y is mirrored and X is shifted by half world size.\n     */\n    distanceToTile2d(pointX: number, pointY: number, tileID: {x: number; y: number; z: number}, _bv: IBoundingVolume): number {\n        const scale = 1 << tileID.z;\n        const tileMercatorSize = 1.0 / scale;\n        const tileCornerX = tileID.x / scale; // In range 0..1\n        const tileCornerY = tileID.y / scale; // In range 0..1\n\n        const worldSize = 1.0;\n        const halfWorld = 0.5 * worldSize;\n        let smallestDistance = 2.0 * worldSize;\n        // Original tile\n        smallestDistance = Math.min(smallestDistance, distanceToTileWrapX(pointX, pointY, tileCornerX, tileCornerY, tileMercatorSize));\n        // Up\n        smallestDistance = Math.min(smallestDistance, distanceToTileWrapX(pointX, pointY, tileCornerX + halfWorld, -tileCornerY - tileMercatorSize, tileMercatorSize));\n        // Down\n        smallestDistance = Math.min(smallestDistance, distanceToTileWrapX(pointX, pointY, tileCornerX + halfWorld, worldSize + worldSize - tileCornerY - tileMercatorSize, tileMercatorSize));\n\n        return smallestDistance;\n    }\n\n    /**\n     * Returns the wrap value for a given tile, computed so that tiles will remain loaded when crossing the antimeridian.\n     */\n    getWrap(centerCoord: MercatorCoordinate, tileID: {x: number; y: number; z: number}, _parentWrap: number): number {\n        const scale = 1 << tileID.z;\n        const tileMercatorSize = 1.0 / scale;\n        const tileX = tileID.x / scale; // In range 0..1\n        const distanceCurrent = distanceToTileSimple(centerCoord.x, tileX, tileMercatorSize);\n        const distanceLeft = distanceToTileSimple(centerCoord.x, tileX - 1.0, tileMercatorSize);\n        const distanceRight = distanceToTileSimple(centerCoord.x, tileX + 1.0, tileMercatorSize);\n        const distanceSmallest = Math.min(distanceCurrent, distanceLeft, distanceRight);\n        if (distanceSmallest === distanceRight) {\n            return 1;\n        }\n        if (distanceSmallest === distanceLeft) {\n            return -1;\n        }\n        return 0;\n    }\n    \n    allowVariableZoom(transform: IReadonlyTransform, options: CoveringTilesOptionsInternal): boolean {\n        return coveringZoomLevel(transform, options) > 4;\n    }\n\n    allowWorldCopies(): boolean {\n        return false;\n    }\n\n    getTileBoundingVolume(tileID: { x: number; y: number; z: number }, wrap: number, elevation: number, options: CoveringTilesOptionsInternal): ConvexVolume {\n        return this._boundingVolumeCache.getTileBoundingVolume(tileID, wrap, elevation, options);\n    }\n\n    private _computeTileBoundingVolume(tileID: {x: number; y: number; z: number}, wrap: number, elevation: number, options: CoveringTilesOptionsInternal): ConvexVolume {\n        let minElevation = Math.min(0, elevation);\n        let maxElevation = Math.max(0, elevation);\n        if (options?.terrain) {\n            const overscaledTileID = new OverscaledTileID(tileID.z, wrap, tileID.z, tileID.x, tileID.y);\n            const minMax = options.terrain.getMinMaxElevation(overscaledTileID);\n            minElevation = minMax.minElevation ?? minElevation;\n            maxElevation = minMax.maxElevation ?? maxElevation;\n        }\n        // Convert elevation to distances from center of a unit sphere planet (so that 1 is surface)\n        minElevation /= earthRadius;\n        maxElevation /= earthRadius;\n        minElevation += 1;\n        maxElevation += 1;\n\n        if (tileID.z <= 0) {\n            // Tile covers the entire sphere.\n            return ConvexVolume.fromAabb( // We return an AABB in this case.\n                [-maxElevation, -maxElevation, -maxElevation],\n                [maxElevation, maxElevation, maxElevation]\n            );\n        } else if (tileID.z === 1) {\n            // Tile covers a quarter of the sphere.\n            // X is 1 at lng=E90°\n            // Y is 1 at **north** pole\n            // Z is 1 at null island\n            return ConvexVolume.fromAabb( // We also just use AABBs for this zoom level.\n                [tileID.x === 0 ? -maxElevation : 0, tileID.y === 0 ? 0 : -maxElevation, -maxElevation],\n                [tileID.x === 0 ? 0 : maxElevation, tileID.y === 0 ? maxElevation : 0, maxElevation]\n            );\n        } else {\n            const corners = [\n                projectTileCoordinatesToSphere(0, 0, tileID.x, tileID.y, tileID.z),\n                projectTileCoordinatesToSphere(EXTENT, 0, tileID.x, tileID.y, tileID.z),\n                projectTileCoordinatesToSphere(EXTENT, EXTENT, tileID.x, tileID.y, tileID.z),\n                projectTileCoordinatesToSphere(0, EXTENT, tileID.x, tileID.y, tileID.z),\n            ];\n\n            const extremesPoints = [];\n\n            for (const c of corners) {\n                extremesPoints.push(vec3.scale([], c, maxElevation));\n            }\n\n            if (maxElevation !== minElevation) {\n                // Only add additional points if terrain is enabled and is not flat.\n                for (const c of corners) {\n                    extremesPoints.push(vec3.scale([], c, minElevation));\n                }\n            }\n\n            // Special handling of poles - we need to extend the tile AABB\n            // to include the pole for tiles that border mercator north/south edge.\n            if (tileID.y === 0) {\n                extremesPoints.push([0, 1, 0]); // North pole\n            }\n            if (tileID.y === (1 << tileID.z) - 1) {\n                extremesPoints.push([0, -1, 0]); // South pole\n            }\n\n            // Compute a best-fit AABB for the frustum rejection test\n            const aabbMin: vec3 = [1, 1, 1];\n            const aabbMax: vec3 = [-1, -1, -1];\n\n            for (const c of extremesPoints) {\n                for (let i = 0; i < 3; i++) {\n                    aabbMin[i] = Math.min(aabbMin[i], c[i]);\n                    aabbMax[i] = Math.max(aabbMax[i], c[i]);\n                }\n            }\n\n            // Now we compute the actual bounding volume.\n            // The up/down plane will be normal to the tile's center.\n            // The north/south plane will be used for the tile's north and south edge and will be orthogonal to the up/down plane.\n            // The left and right planes will be determined by the tile's east/west edges and will differ slightly - we are not creating a box!\n            // We will find the min and max extents for the up/down and north/south planes using the set of points\n            // where the extremes are likely to lie.\n\n            // Vector \"center\" (from planet center to tile center) will be our up/down axis.\n            const center = projectTileCoordinatesToSphere(EXTENT / 2, EXTENT / 2, tileID.x, tileID.y, tileID.z);\n            // Vector to the east of \"center\".\n            const centerEast = vec3.cross([], [0, 1, 0], center);\n            vec3.normalize(centerEast, centerEast);\n            // Vector to the north of \"center\" will be our north/south axis.\n            const north = vec3.cross([], center, centerEast);\n            vec3.normalize(north, north);\n\n            // Axes for the east and west edge of our bounding volume.\n            // These axes are NOT opposites of each other, they differ!\n            // They are also not orthogonal to the up/down and north/south axes.\n            const axisEast = vec3.cross([], corners[2], corners[1]);\n            vec3.normalize(axisEast, axisEast);\n            const axisWest = vec3.cross([], corners[0], corners[3]);\n            vec3.normalize(axisWest, axisWest);\n\n            // Now we will expand the extremes point set for bounding volume creation.\n            // We will also include the tile center point, since it will always be an extreme for the \"center\" axis.\n            extremesPoints.push(vec3.scale([], center, maxElevation));\n            // No need to include a minElevation-scaled center, since we already have minElevation corners in the set and these will always lie lower than the center.\n\n            // The extremes might also lie on the midpoint of the north or south edge.\n            // For tiles in the north hemisphere, only the south edge can contain an extreme,\n            // since when we imagine the tile's actual shape projected onto the plane normal to \"center\" vector,\n            // the tile's north edge will curve towards the tile center, thus its extremes are accounted for by the\n            // corners, however the south edge will curve away from the center point, extending beyond the tile's edges,\n            // thus it must be included.\n            // The poles are an exception - they must always be included in the extremes, if the tile touches the north/south mercator range edge.\n            //\n            // A tile's exaggerated shape on the northern hemisphere, projected onto the normal plane of \"center\".\n            // The \"c\" is the tile's center point. The \"m\" is the edge mid point we are looking for.\n            //\n            //      /--       --\\\n            //     /   -------   \\\n            //    /               \\\n            //   /        c        \\\n            //  /                   \\\n            // /--                 --\\\n            //    -----       -----\n            //         ---m---\n            \n            if (tileID.y >= (1 << tileID.z) / 2) {\n                // South hemisphere - include the tile's north edge midpoint\n                extremesPoints.push(vec3.scale([], projectTileCoordinatesToSphere(EXTENT / 2, 0, tileID.x, tileID.y, tileID.z), maxElevation));\n                // No need to include minElevation variant of this point, for the same reason why we don't include minElevation center.\n            }\n            if (tileID.y < (1 << tileID.z) / 2) {\n                // North hemisphere - include the tile's south edge midpoint\n                extremesPoints.push(vec3.scale([], projectTileCoordinatesToSphere(EXTENT / 2, EXTENT, tileID.x, tileID.y, tileID.z), maxElevation));\n                // No need to include minElevation variant of this point, for the same reason why we don't include minElevation center.\n            }\n\n            // Find the min and max extends and the midpoints along each axis,\n            // using the set of extreme points.\n            const upDownMinMax = findAxisMinMax(center, extremesPoints);\n            const northSouthMinMax = findAxisMinMax(north, extremesPoints);\n\n            const planeUp = [-center[0], -center[1], -center[2], upDownMinMax.max] as vec4;\n            const planeDown = [center[0], center[1], center[2], -upDownMinMax.min] as vec4;\n            const planeNorth = [-north[0], -north[1], -north[2], northSouthMinMax.max] as vec4;\n            const planeSouth = [north[0], north[1], north[2], -northSouthMinMax.min] as vec4;\n            const planeEast = [...axisEast, 0] as vec4;\n            const planeWest = [...axisWest, 0] as vec4;\n\n            const points: vec3[] = [];\n\n            // North points\n            if (tileID.y === 0) {\n                // If the tile borders a pole, then \n                points.push(\n                    threePlaneIntersection(planeWest, planeEast, planeUp),\n                    threePlaneIntersection(planeWest, planeEast, planeDown),\n                );\n            } else {\n                points.push(\n                    threePlaneIntersection(planeNorth, planeEast, planeUp),\n                    threePlaneIntersection(planeNorth, planeEast, planeDown),\n                    threePlaneIntersection(planeNorth, planeWest, planeUp),\n                    threePlaneIntersection(planeNorth, planeWest, planeDown)\n                );\n            }\n\n            // South points\n            if (tileID.y === (1 << tileID.z) - 1) {\n                points.push(\n                    threePlaneIntersection(planeWest, planeEast, planeUp),\n                    threePlaneIntersection(planeWest, planeEast, planeDown),\n                );\n            } else {\n                points.push(\n                    threePlaneIntersection(planeSouth, planeEast, planeUp),\n                    threePlaneIntersection(planeSouth, planeEast, planeDown),\n                    threePlaneIntersection(planeSouth, planeWest, planeUp),\n                    threePlaneIntersection(planeSouth, planeWest, planeDown)\n                );\n            }\n\n            return new ConvexVolume(points, [\n                planeUp,\n                planeDown,\n                planeNorth,\n                planeSouth,\n                planeEast,\n                planeWest\n            ], aabbMin, aabbMax);\n        }\n    }\n}\n\nfunction findAxisMinMax(axis: vec3, points: vec3[]) {\n    let min = +Infinity;\n    let max = -Infinity;\n    for (const c of points) {\n        const dot = vec3.dot(axis, c);\n        min = Math.min(min, dot);\n        max = Math.max(max, dot);\n    }\n    return {\n        min,\n        max\n    };\n}","import {type mat2, mat4, vec3, vec4} from 'gl-matrix';\nimport {TransformHelper} from '../transform_helper.ts';\nimport {LngLat, type LngLatLike, earthRadius} from '../lng_lat.ts';\nimport {angleToRotateBetweenVectors2D, clamp, createIdentityMat4f32, createIdentityMat4f64, createMat4f64, createVec3f64, createVec4f64, differenceOfAnglesDegrees, distanceOfAnglesRadians, MAX_VALID_LATITUDE, pointPlaneSignedDistance, warnOnce, type Mat4f32} from '../../util/util.ts';\nimport {OverscaledTileID, UnwrappedTileID, type CanonicalTileID} from '../../tile/tile_id.ts';\nimport Point from '@mapbox/point-geometry';\nimport {MercatorCoordinate} from '../mercator_coordinate.ts';\nimport {LngLatBounds} from '../lng_lat_bounds.ts';\nimport {tileCoordinatesToMercatorCoordinates} from './mercator_utils.ts';\nimport {angularCoordinatesToSurfaceVector, clampToSphere, getGlobeRadiusPixels, getZoomAdjustment, horizonPlaneToCenterAndRadius, mercatorCoordinatesToAngularCoordinatesRadians, projectTileCoordinatesToSphere, sphereSurfacePointToCoordinates} from './globe_utils.ts';\nimport {GlobeCoveringTilesDetailsProvider} from './globe_covering_tiles_details_provider.ts';\nimport {Frustum} from '../../util/primitives/frustum.ts';\n\nimport type {Terrain} from '../../render/terrain.ts';\nimport type {PointProjection} from '../../symbol/projection.ts';\nimport type {IReadonlyTransform, ITransform, TransformConstrainFunction} from '../transform_interface.ts';\nimport type {TransformOptions} from '../transform_helper.ts';\nimport type {PaddingOptions} from '../edge_insets.ts';\nimport type {CustomLayerProjectionData, ProjectionDataParams, RendererProjectionData} from './projection_data.ts';\nimport type {CoveringTilesDetailsProvider} from './covering_tiles_details_provider.ts';\n\n/**\n * Describes the intersection of ray and sphere.\n * When null, no intersection occurred.\n * When both \"t\" values are the same, the ray just touched the sphere's surface.\n * When both value are different, a full intersection occurred.\n */\ntype RaySphereIntersection = {\n    /**\n     * The ray parameter for intersection that is \"less\" along the ray direction.\n     * Note that this value can be negative, meaning that this intersection occurred before the ray's origin.\n     * The intersection point can be computed as `origin + direction * tMin`.\n     */\n    tMin: number;\n    /**\n     * The ray parameter for intersection that is \"more\" along the ray direction.\n     * Note that this value can be negative, meaning that this intersection occurred before the ray's origin.\n     * The intersection point can be computed as `origin + direction * tMax`.\n     */\n    tMax: number;\n} | null;\n\nexport class VerticalPerspectiveTransform implements ITransform {\n    private _helper: TransformHelper;\n\n    //\n    // Implementation of transform getters and setters\n    //\n\n    get pixelsToClipSpaceMatrix(): mat4 {\n        return this._helper.pixelsToClipSpaceMatrix;\n    }\n    get clipSpaceToPixelsMatrix(): mat4 {\n        return this._helper.clipSpaceToPixelsMatrix;\n    }\n    get pixelsToGLUnits(): [number, number] {\n        return this._helper.pixelsToGLUnits;\n    }\n    get centerOffset(): Point {\n        return this._helper.centerOffset;\n    }\n    get size(): Point {\n        return this._helper.size;\n    }\n    get rotationMatrix(): mat2 {\n        return this._helper.rotationMatrix;\n    }\n    get centerPoint(): Point {\n        return this._helper.centerPoint;\n    }\n    get pixelsPerMeter(): number {\n        return this._helper.pixelsPerMeter;\n    }\n    setMinZoom(zoom: number): void {\n        this._helper.setMinZoom(zoom);\n    }\n    setMaxZoom(zoom: number): void {\n        this._helper.setMaxZoom(zoom);\n    }\n    setMinPitch(pitch: number): void {\n        this._helper.setMinPitch(pitch);\n    }\n    setMaxPitch(pitch: number): void {\n        this._helper.setMaxPitch(pitch);\n    }\n    setRenderWorldCopies(renderWorldCopies: boolean): void {\n        this._helper.setRenderWorldCopies(renderWorldCopies);\n    }\n    setBearing(bearing: number): void {\n        this._helper.setBearing(bearing);\n    }\n    setPitch(pitch: number): void {\n        this._helper.setPitch(pitch);\n    }\n    setRoll(roll: number): void {\n        this._helper.setRoll(roll);\n    }\n    setFov(fov: number): void {\n        this._helper.setFov(fov);\n    }\n    setZoom(zoom: number): void {\n        this._helper.setZoom(zoom);\n    }\n    setCenter(center: LngLat): void {\n        this._helper.setCenter(center);\n    }\n    setElevation(elevation: number): void {\n        this._helper.setElevation(elevation);\n    }\n    setMinElevationForCurrentTile(elevation: number): void {\n        this._helper.setMinElevationForCurrentTile(elevation);\n    }\n    setPadding(padding: PaddingOptions): void {\n        this._helper.setPadding(padding);\n    }\n    interpolatePadding(start: PaddingOptions, target: PaddingOptions, t: number): void {\n        this._helper.interpolatePadding(start, target, t);\n    }\n    isPaddingEqual(padding: PaddingOptions): boolean {\n        return this._helper.isPaddingEqual(padding);\n    }\n    resize(width: number, height: number): void {\n        this._helper.resize(width, height);\n    }\n    getMaxBounds(): LngLatBounds {\n        return this._helper.getMaxBounds();\n    }\n    setMaxBounds(bounds?: LngLatBounds): void {\n        this._helper.setMaxBounds(bounds);\n    }\n    setConstrainOverride(constrain?: TransformConstrainFunction | null): void {\n        this._helper.setConstrainOverride(constrain);\n    }\n    overrideNearFarZ(nearZ: number, farZ: number): void {\n        this._helper.overrideNearFarZ(nearZ, farZ);\n    }\n    clearNearFarZOverride(): void {\n        this._helper.clearNearFarZOverride();\n    }\n    getCameraQueryGeometry(queryGeometry: Point[]): Point[] {\n        return this._helper.getCameraQueryGeometry(this.getCameraPoint(), queryGeometry);\n    }\n\n    get tileSize(): number {\n        return this._helper.tileSize;\n    }\n    get tileZoom(): number {\n        return this._helper.tileZoom;\n    }\n    get scale(): number {\n        return this._helper.scale;\n    }\n    get worldSize(): number {\n        return this._helper.worldSize;\n    }\n    get width(): number {\n        return this._helper.width;\n    }\n    get height(): number {\n        return this._helper.height;\n    }\n    get lngRange(): [number, number] {\n        return this._helper.lngRange;\n    }\n    get latRange(): [number, number] {\n        return this._helper.latRange;\n    }\n    get minZoom(): number {\n        return this._helper.minZoom;\n    }\n    get maxZoom(): number {\n        return this._helper.maxZoom;\n    }\n    get zoom(): number {\n        return this._helper.zoom;\n    }\n    get center(): LngLat {\n        return this._helper.center;\n    }\n    get minPitch(): number {\n        return this._helper.minPitch;\n    }\n    get maxPitch(): number {\n        return this._helper.maxPitch;\n    }\n    get pitch(): number {\n        return this._helper.pitch;\n    }\n    get pitchInRadians(): number {\n        return this._helper.pitchInRadians;\n    }\n    get roll(): number {\n        return this._helper.roll;\n    }\n    get rollInRadians(): number {\n        return this._helper.rollInRadians;\n    }\n    get bearing(): number {\n        return this._helper.bearing;\n    }\n    get bearingInRadians(): number {\n        return this._helper.bearingInRadians;\n    }\n    get fov(): number {\n        return this._helper.fov;\n    }\n    get fovInRadians(): number {\n        return this._helper.fovInRadians;\n    }\n    get elevation(): number {\n        return this._helper.elevation;\n    }\n    get minElevationForCurrentTile(): number {\n        return this._helper.minElevationForCurrentTile;\n    }\n    get padding(): PaddingOptions {\n        return this._helper.padding;\n    }\n    get unmodified(): boolean {\n        return this._helper.unmodified;\n    }\n    get renderWorldCopies(): boolean {\n        return this._helper.renderWorldCopies;\n    }\n    get constrainOverride(): TransformConstrainFunction {\n        return this._helper.constrainOverride;\n    }\n    public get nearZ(): number {\n        return this._helper.nearZ;\n    }\n    public get farZ(): number {\n        return this._helper.farZ;\n    }\n    public get autoCalculateNearFarZ(): boolean {\n        return this._helper.autoCalculateNearFarZ;\n    }\n    setTransitionState(_value: number): void {\n        // Do nothing\n    }\n    //\n    // Implementation of globe transform\n    //\n\n    private _cachedClippingPlane: vec4 = createVec4f64();\n    private _cachedFrustum: Frustum;\n    private _projectionMatrix: mat4 = createIdentityMat4f64();\n    private _globeViewProjMatrix32f: Mat4f32 = createIdentityMat4f32(); // Must be 32 bit floats, otherwise WebGL calls in Chrome get very slow.\n    private _globeViewProjMatrixF64: mat4 = createIdentityMat4f64();\n    private _globeViewProjMatrixF64Inverted: mat4 = createIdentityMat4f64();\n    private _globeProjMatrixInverted: mat4 = createIdentityMat4f64();\n\n    private _cameraPosition: vec3 = createVec3f64();\n    /**\n     * Globe projection can smoothly interpolate between globe view and mercator. This variable controls this interpolation.\n     * Value 0 is mercator, value 1 is globe, anything between is an interpolation between the two projections.\n     */\n\n    private _coveringTilesDetailsProvider: GlobeCoveringTilesDetailsProvider;\n\n    public constructor(options?: TransformOptions) {\n        this._helper = new TransformHelper({\n            calcMatrices: () => this._calcMatrices(),\n            defaultConstrain: (center, zoom) => { return this.defaultConstrain(center, zoom); }\n        }, options);\n        this._coveringTilesDetailsProvider = new GlobeCoveringTilesDetailsProvider();\n    }\n\n    clone(): ITransform {\n        const clone = new VerticalPerspectiveTransform();\n        clone.apply(this, false);\n        return clone;\n    }\n\n    public apply(that: IReadonlyTransform, constrain: boolean): void {\n        this._helper.apply(that, constrain);\n    }\n\n    public get projectionMatrix(): mat4 { return this._projectionMatrix; }\n\n    public get modelViewProjectionMatrix(): mat4 { return this._globeViewProjMatrixF64; }\n\n    public get inverseProjectionMatrix(): mat4 { return this._globeProjMatrixInverted; }\n\n    public get cameraPosition(): vec3 {\n        // Return a copy - don't let outside code mutate our precomputed camera position.\n        const copy = createVec3f64(); // Ensure the resulting vector is float64s\n        copy[0] = this._cameraPosition[0];\n        copy[1] = this._cameraPosition[1];\n        copy[2] = this._cameraPosition[2];\n        return copy;\n    }\n\n    get cameraToCenterDistance(): number {\n        // Globe uses the same cameraToCenterDistance as mercator.\n        return this._helper.cameraToCenterDistance;\n    }\n\n    getProjectionData(params: ProjectionDataParams): RendererProjectionData {\n        const {overscaledTileID, applyGlobeMatrix} = params;\n        const mercatorTileCoordinates = this._helper.getMercatorTileCoordinates(overscaledTileID);\n        return {\n            mainMatrix: this._globeViewProjMatrix32f,\n            tileMercatorCoords: mercatorTileCoordinates,\n            clippingPlane: this._cachedClippingPlane as [number, number, number, number],\n            projectionTransition: applyGlobeMatrix ? 1 : 0,\n            fallbackMatrix: this._globeViewProjMatrix32f,\n            clipAntimeridian: overscaledTileID?.canonical.z === 0,\n        };\n    }\n\n    private _computeClippingPlane(globeRadiusPixels: number): vec4 {\n        // We want to compute a plane equation that, when applied to the unit sphere generated\n        // in the vertex shader, places all visible parts of the sphere into the positive half-space\n        // and all the non-visible parts in the negative half-space.\n        // We can then use that to accurately clip all non-visible geometry.\n\n        // cam....------------A\n        //        ....        |\n        //            ....    |\n        //                ....B\n        //                ggggggggg\n        //          gggggg    |   .gggggg\n        //       ggg          |       ...ggg    ^\n        //     gg             |                 |\n        //    g               |                 y\n        //    g               |                 |\n        //   g                C                 #---x--->\n        //\n        // Notes:\n        // - note the coordinate axes\n        // - \"g\" marks the globe edge\n        // - the dotted line is the camera center \"ray\" - we are looking in this direction\n        // - \"cam\" is camera origin\n        // - \"C\" is globe center\n        // - \"B\" is the point on \"top\" of the globe - camera is looking at B - \"B\" is the intersection between the camera center ray and the globe\n        // - this._pitchInRadians is the angle at B between points cam,B,A\n        // - this.cameraToCenterDistance is the distance from camera to \"B\"\n        // - globe radius is (0.5 * this.worldSize)\n        // - \"T\" is any point where a tangent line from \"cam\" touches the globe surface\n        // - elevation is assumed to be zero - globe rendering must be separate from terrain rendering anyway\n\n        const pitch = this.pitchInRadians;\n        // scale things so that the globe radius is 1\n        const distanceCameraToB = this.cameraToCenterDistance / globeRadiusPixels;\n        const radius = 1;\n\n        // Distance from camera to \"A\" - the point at the same elevation as camera, right above center point on globe\n        const distanceCameraToA = Math.sin(pitch) * distanceCameraToB;\n        // Distance from \"A\" to \"C\"\n        const distanceAtoC = (Math.cos(pitch) * distanceCameraToB + radius);\n        // Distance from camera to \"C\" - the globe center\n        const distanceCameraToC = Math.sqrt(distanceCameraToA * distanceCameraToA + distanceAtoC * distanceAtoC);\n        // cam - C - T angle cosine (at C)\n        const camCTcosine = radius / distanceCameraToC;\n        // Distance from globe center to the plane defined by all possible \"T\" points\n        const tangentPlaneDistanceToC = camCTcosine * radius;\n\n        let vectorCtoCamX = -distanceCameraToA;\n        let vectorCtoCamY = distanceAtoC;\n        // Normalize the vector\n        const vectorCtoCamLength = Math.sqrt(vectorCtoCamX * vectorCtoCamX + vectorCtoCamY * vectorCtoCamY);\n        vectorCtoCamX /= vectorCtoCamLength;\n        vectorCtoCamY /= vectorCtoCamLength;\n\n        // Note the swizzled components\n        const planeVector: vec3 = [0, vectorCtoCamX, vectorCtoCamY];\n        // Apply transforms - lat, lng and angle (NOT pitch - already accounted for, as it affects the tangent plane)\n        vec3.rotateZ(planeVector, planeVector, [0, 0, 0], -this.bearingInRadians);\n        vec3.rotateX(planeVector, planeVector, [0, 0, 0], -1 * this.center.lat * Math.PI / 180.0);\n        vec3.rotateY(planeVector, planeVector, [0, 0, 0], this.center.lng * Math.PI / 180.0);\n        // Normalize the plane vector\n        const scale = 1 / vec3.length(planeVector);\n        vec3.scale(planeVector, planeVector, scale);\n        return [...planeVector, -tangentPlaneDistanceToC * scale];\n    }\n\n    public isLocationOccluded(location: LngLat): boolean {\n        return !this.isSurfacePointVisible(angularCoordinatesToSurfaceVector(location));\n    }\n\n    public transformLightDirection(dir: vec3): vec3 {\n        const sphereX = this._helper._center.lng * Math.PI / 180.0;\n        const sphereY = this._helper._center.lat * Math.PI / 180.0;\n\n        const len = Math.cos(sphereY);\n        const spherePos: vec3 = [\n            Math.sin(sphereX) * len,\n            Math.sin(sphereY),\n            Math.cos(sphereX) * len\n        ];\n\n        const axisRight: vec3 = [spherePos[2], 0.0, -spherePos[0]]; // Equivalent to cross(vec3(0.0, 1.0, 0.0), vec)\n        const axisDown: vec3 = [0, 0, 0];\n        vec3.cross(axisDown, axisRight, spherePos);\n        vec3.normalize(axisRight, axisRight);\n        vec3.normalize(axisDown, axisDown);\n\n        const transformed: vec3 = [\n            axisRight[0] * dir[0] + axisDown[0] * dir[1] + spherePos[0] * dir[2],\n            axisRight[1] * dir[0] + axisDown[1] * dir[1] + spherePos[1] * dir[2],\n            axisRight[2] * dir[0] + axisDown[2] * dir[1] + spherePos[2] * dir[2]\n        ];\n\n        const normalized: vec3 = [0, 0, 0];\n        vec3.normalize(normalized, transformed);\n        return normalized;\n    }\n\n    public getPixelScale(): number {\n        return 1.0 / Math.cos(this._helper._center.lat * Math.PI / 180);\n    }\n\n    public getCircleRadiusCorrection(): number {\n        return Math.cos(this._helper._center.lat * Math.PI / 180);\n    }\n\n    public getPitchedTextCorrection(textAnchorX: number, textAnchorY: number, tileID: UnwrappedTileID): number {\n        const mercator = tileCoordinatesToMercatorCoordinates(textAnchorX, textAnchorY, tileID.canonical);\n        const angular = mercatorCoordinatesToAngularCoordinatesRadians(mercator.x, mercator.y);\n        return this.getCircleRadiusCorrection() / Math.cos(angular[1]);\n    }\n\n    public projectTileCoordinates(x: number, y: number, unwrappedTileID: UnwrappedTileID, getElevation: (x: number, y: number) => number): PointProjection {\n        const canonical = unwrappedTileID.canonical;\n        const spherePos = projectTileCoordinatesToSphere(x, y, canonical.x, canonical.y, canonical.z);\n        const elevation = getElevation ? getElevation(x, y) : 0.0;\n        const vectorMultiplier = 1.0 + elevation / earthRadius;\n        const pos: vec4 = [spherePos[0] * vectorMultiplier, spherePos[1] * vectorMultiplier, spherePos[2] * vectorMultiplier, 1];\n        vec4.transformMat4(pos, pos, this._globeViewProjMatrixF64);\n\n        // Also check whether the point projects to the backfacing side of the sphere.\n        const plane = this._cachedClippingPlane;\n        // dot(position on sphere, occlusion plane equation)\n        const dotResult = plane[0] * spherePos[0] + plane[1] * spherePos[1] + plane[2] * spherePos[2] + plane[3];\n        const isOccluded = dotResult < 0.0;\n\n        return {\n            point: new Point(pos[0] / pos[3], pos[1] / pos[3]),\n            signedDistanceFromCamera: pos[3],\n            isOccluded\n        };\n    }\n\n    private _calcMatrices(): void {\n        if (!this._helper._width || !this._helper._height) {\n            return;\n        }\n\n        const globeRadiusPixels = getGlobeRadiusPixels(this.worldSize, this.center.lat);\n\n        // Construct a completely separate matrix for globe view\n        const globeMatrix = createMat4f64();\n        if (this._helper.autoCalculateNearFarZ) {\n            this._helper._nearZ = 0.5;\n            this._helper._farZ = this.cameraToCenterDistance + globeRadiusPixels * 2.0; // just set the far plane far enough - we will calculate our own z in the vertex shader anyway\n        }\n        mat4.perspective(globeMatrix, this.fovInRadians, this.width / this.height, this._helper._nearZ, this._helper._farZ);\n\n        // Apply center of perspective offset\n        const offset = this.centerOffset;\n        globeMatrix[8] = -offset.x * 2 / this._helper._width;\n        globeMatrix[9] = offset.y * 2 / this._helper._height;\n        this._projectionMatrix = mat4.clone(globeMatrix);\n\n        this._globeProjMatrixInverted = createMat4f64();\n        mat4.invert(this._globeProjMatrixInverted, globeMatrix);\n        mat4.translate(globeMatrix, globeMatrix, [0, 0, -this.cameraToCenterDistance]);\n        mat4.rotateZ(globeMatrix, globeMatrix, this.rollInRadians);\n        mat4.rotateX(globeMatrix, globeMatrix, -this.pitchInRadians);\n        mat4.rotateZ(globeMatrix, globeMatrix, this.bearingInRadians);\n        mat4.translate(globeMatrix, globeMatrix, [0.0, 0, -globeRadiusPixels]);\n        // Rotate the sphere to center it on viewed coordinates\n\n        const scaleVec = createVec3f64();\n        scaleVec[0] = globeRadiusPixels;\n        scaleVec[1] = globeRadiusPixels;\n        scaleVec[2] = globeRadiusPixels;\n\n        mat4.rotateX(globeMatrix, globeMatrix, this.center.lat * Math.PI / 180.0);\n        mat4.rotateY(globeMatrix, globeMatrix, -this.center.lng * Math.PI / 180.0);\n        mat4.scale(globeMatrix, globeMatrix, scaleVec); // Scale the unit sphere to a sphere with diameter of 1\n        this._globeViewProjMatrixF64 = globeMatrix;\n        this._globeViewProjMatrix32f = new Float32Array(globeMatrix);\n\n        this._globeViewProjMatrixF64Inverted = createMat4f64();\n        mat4.invert(this._globeViewProjMatrixF64Inverted, globeMatrix);\n\n        const zero = createVec3f64();\n        this._cameraPosition = createVec3f64();\n        this._cameraPosition[2] = this.cameraToCenterDistance / globeRadiusPixels;\n        vec3.rotateZ(this._cameraPosition, this._cameraPosition, zero, -this.rollInRadians);\n        vec3.rotateX(this._cameraPosition, this._cameraPosition, zero, this.pitchInRadians);\n        vec3.rotateZ(this._cameraPosition, this._cameraPosition, zero, -this.bearingInRadians);\n        vec3.add(this._cameraPosition, this._cameraPosition, [0, 0, 1]);\n        vec3.rotateX(this._cameraPosition, this._cameraPosition, zero, -this.center.lat * Math.PI / 180.0);\n        vec3.rotateY(this._cameraPosition, this._cameraPosition, zero, this.center.lng * Math.PI / 180.0);\n\n        this._cachedClippingPlane = this._computeClippingPlane(globeRadiusPixels);\n\n        const matrix = mat4.clone(this._globeViewProjMatrixF64Inverted);\n        mat4.scale(matrix, matrix, [1, 1, -1]);\n        this._cachedFrustum = Frustum.fromInvProjectionMatrix(matrix, 1, 0, this._cachedClippingPlane, true);\n    }\n\n    calculateFogMatrix(_unwrappedTileID: UnwrappedTileID): mat4 {\n        warnOnce('calculateFogMatrix is not supported on globe projection.');\n        const m = createMat4f64();\n        mat4.identity(m);\n        return m;\n    }\n\n    getVisibleUnwrappedCoordinates(tileID: CanonicalTileID): UnwrappedTileID[] {\n        // Globe has no wrap.\n        return [new UnwrappedTileID(0, tileID)];\n    }\n\n    getCameraFrustum(): Frustum {\n        return this._cachedFrustum;\n    }\n    getClippingPlane(): vec4 | null {\n        return this._cachedClippingPlane;\n    }\n    getCoveringTilesDetailsProvider(): CoveringTilesDetailsProvider {\n        return this._coveringTilesDetailsProvider;\n    }\n\n    recalculateZoomAndCenter(terrain?: Terrain): void {\n        if (terrain) {\n            warnOnce('terrain is not fully supported on vertical perspective projection.');\n            return;\n        }\n        this._helper.recalculateZoomAndCenter(0);\n    }\n\n    maxPitchScaleFactor(): number {\n        // In mercaltor it uses the pixelMatrix, but this is not available here...\n        return 1;\n    }\n\n    getCameraPoint(): Point {\n        return this._helper.getCameraPoint();\n    }\n\n    getCameraAltitude(): number {\n        return this._helper.getCameraAltitude();\n    }\n\n    getCameraLngLat(): LngLat {\n        return this._helper.getCameraLngLat();\n    }\n\n    lngLatToCameraDepth(lngLat: LngLat, elevation: number): number {\n        if (!this._globeViewProjMatrixF64) {\n            return 1.0; // _calcMatrices hasn't run yet\n        }\n        const vec = angularCoordinatesToSurfaceVector(lngLat);\n        vec3.scale(vec, vec, (1.0 + elevation / earthRadius));\n        const result = createVec4f64();\n        vec4.transformMat4(result, [vec[0], vec[1], vec[2], 1], this._globeViewProjMatrixF64);\n        return result[2] / result[3];\n    }\n\n    populateCache(_coords: OverscaledTileID[]): void {\n        // Do nothing\n    }\n\n    getBounds(): LngLatBounds {\n        const xMid = this.width * 0.5;\n        const yMid = this.height * 0.5;\n\n        // LngLat extremes will probably tend to be in screen corners or in middle of screen edges.\n        // These test points should result in a pretty good approximation.\n        const testPoints = [\n            new Point(0, 0),\n            new Point(xMid, 0),\n            new Point(this.width, 0),\n            new Point(this.width, yMid),\n            new Point(this.width, this.height),\n            new Point(xMid, this.height),\n            new Point(0, this.height),\n            new Point(0, yMid),\n        ];\n\n        const projectedPoints = [];\n        for (const p of testPoints) {\n            projectedPoints.push(this.unprojectScreenPoint(p));\n        }\n\n        // We can't construct a simple min/max aabb, since points might lie on either side of the antimeridian.\n        // We will instead compute the furthest points relative to map center.\n        // We also take advantage of the fact that `unprojectScreenPoint` will snap pixels\n        // outside the planet to the closest point on the planet's horizon.\n        let mostEast = 0, mostWest = 0, mostNorth = 0, mostSouth = 0; // We will store these values signed.\n        const center = this.center;\n        for (const p of projectedPoints) {\n            const dLng = differenceOfAnglesDegrees(center.lng, p.lng);\n            const dLat = differenceOfAnglesDegrees(center.lat, p.lat);\n            if (dLng < mostWest) {\n                mostWest = dLng;\n            }\n            if (dLng > mostEast) {\n                mostEast = dLng;\n            }\n            if (dLat < mostSouth) {\n                mostSouth = dLat;\n            }\n            if (dLat > mostNorth) {\n                mostNorth = dLat;\n            }\n        }\n\n        const boundsArray: [number, number, number, number] = [\n            center.lng + mostWest,  // west\n            center.lat + mostSouth, // south\n            center.lng + mostEast,  // east\n            center.lat + mostNorth  // north\n        ];\n\n        // Sometimes the poles might end up not being on the horizon,\n        // thus not being detected as the northernmost/southernmost points.\n        // We fix that here.\n        if (this.isSurfacePointOnScreen([0, 1, 0])) {\n            // North pole is visible\n            // This also means that the entire longitude range must be visible\n            boundsArray[3] = 90;\n            boundsArray[0] = -180;\n            boundsArray[2] = 180;\n        }\n        if (this.isSurfacePointOnScreen([0, -1, 0])) {\n            // South pole is visible\n            boundsArray[1] = -90;\n            boundsArray[0] = -180;\n            boundsArray[2] = 180;\n        }\n\n        return new LngLatBounds(boundsArray);\n    }\n\n    defaultConstrain: TransformConstrainFunction = (lngLat, zoom) => {\n        // Globe: TODO: respect _lngRange, _latRange\n        // It is possible to implement exact constrain for globe, but I don't think it is worth the effort.\n        const constrainedLat = clamp(lngLat.lat, -MAX_VALID_LATITUDE, MAX_VALID_LATITUDE);\n        const constrainedZoom = clamp(+zoom, this.minZoom + getZoomAdjustment(0, constrainedLat), this.maxZoom);\n        return {\n            center: new LngLat(\n                lngLat.lng,\n                constrainedLat\n            ),\n            zoom: constrainedZoom\n        };\n    };\n\n    applyConstrain: TransformConstrainFunction = (lngLat, zoom) => {\n        return this._helper.applyConstrain(lngLat, zoom);\n    };\n\n    calculateCenterFromCameraLngLatAlt(lngLat: LngLatLike, alt: number, bearing?: number, pitch?: number): {center: LngLat; elevation: number; zoom: number} {\n        return this._helper.calculateCenterFromCameraLngLatAlt(lngLat, alt, bearing, pitch);\n    }\n\n    /**\n     * Note: automatically adjusts zoom to keep planet size consistent\n     * (same size before and after a {@link setLocationAtPoint} call).\n     */\n    setLocationAtPoint(lnglat: LngLat, point: Point): void {\n        // This returns some fake coordinates for pixels that do not lie on the planet.\n        // Whatever uses this `setLocationAtPoint` function will need to account for that.\n        const pointLngLat = this.unprojectScreenPoint(point);\n        const vecToPixelCurrent = angularCoordinatesToSurfaceVector(pointLngLat);\n        const vecToTarget = angularCoordinatesToSurfaceVector(lnglat);\n\n        const zero = createVec3f64();\n        vec3.zero(zero);\n\n        const rotatedPixelVector = createVec3f64();\n        vec3.rotateY(rotatedPixelVector, vecToPixelCurrent, zero, -this.center.lng * Math.PI / 180.0);\n        vec3.rotateX(rotatedPixelVector, rotatedPixelVector, zero, this.center.lat * Math.PI / 180.0);\n\n        // We are looking for the lng,lat that will rotate `vecToTarget`\n        // so that it is equal to `rotatedPixelVector`.\n\n        // The second rotation around X axis cannot change the X component,\n        // so we first must find the longitude such that rotating `vecToTarget` with it\n        // will place it so its X component is equal to X component of `rotatedPixelVector`.\n        // There will exist zero, one or two longitudes that satisfy this.\n\n        //      x  |\n        //     /   |\n        //    /    | the line is the target X - rotatedPixelVector.x\n        //   /     | the x is vecToTarget projected to x,z plane\n        //  .      | the dot is origin\n        //\n        // We need to rotate vecToTarget so that it intersects the line.\n        // If vecToTarget is shorter than the distance to the line from origin, it is impossible.\n\n        // Otherwise, we compute the intersection of the line with a ring with radius equal to\n        // length of vecToTarget projected to XZ plane.\n\n        const vecToTargetXZLengthSquared = vecToTarget[0] * vecToTarget[0] + vecToTarget[2] * vecToTarget[2];\n        const targetXSquared = rotatedPixelVector[0] * rotatedPixelVector[0];\n        if (vecToTargetXZLengthSquared < targetXSquared) {\n            // Zero solutions - setLocationAtPoint is impossible.\n            return;\n        }\n\n        // The intersection's Z coordinates\n        const intersectionA = Math.sqrt(vecToTargetXZLengthSquared - targetXSquared);\n        const intersectionB = -intersectionA; // the second solution\n\n        const lngA = angleToRotateBetweenVectors2D(vecToTarget[0], vecToTarget[2], rotatedPixelVector[0], intersectionA);\n        const lngB = angleToRotateBetweenVectors2D(vecToTarget[0], vecToTarget[2], rotatedPixelVector[0], intersectionB);\n\n        const vecToTargetLngA = createVec3f64();\n        vec3.rotateY(vecToTargetLngA, vecToTarget, zero, -lngA);\n        const latA = angleToRotateBetweenVectors2D(vecToTargetLngA[1], vecToTargetLngA[2], rotatedPixelVector[1], rotatedPixelVector[2]);\n        const vecToTargetLngB = createVec3f64();\n        vec3.rotateY(vecToTargetLngB, vecToTarget, zero, -lngB);\n        const latB = angleToRotateBetweenVectors2D(vecToTargetLngB[1], vecToTargetLngB[2], rotatedPixelVector[1], rotatedPixelVector[2]);\n        // Is at least one of the needed latitudes valid?\n\n        const limit = Math.PI * 0.5;\n\n        const isValidA = latA >= -limit && latA <= limit;\n        const isValidB = latB >= -limit && latB <= limit;\n\n        let validLng: number;\n        let validLat: number;\n        if (isValidA && isValidB) {\n            // Pick the solution that is closer to current map center.\n            const centerLngRadians = this.center.lng * Math.PI / 180.0;\n            const centerLatRadians = this.center.lat * Math.PI / 180.0;\n            const lngDistA = distanceOfAnglesRadians(lngA, centerLngRadians);\n            const latDistA = distanceOfAnglesRadians(latA, centerLatRadians);\n            const lngDistB = distanceOfAnglesRadians(lngB, centerLngRadians);\n            const latDistB = distanceOfAnglesRadians(latB, centerLatRadians);\n\n            if ((lngDistA + latDistA) < (lngDistB + latDistB)) {\n                validLng = lngA;\n                validLat = latA;\n            } else {\n                validLng = lngB;\n                validLat = latB;\n            }\n        } else if (isValidA) {\n            validLng = lngA;\n            validLat = latA;\n        } else if (isValidB) {\n            validLng = lngB;\n            validLat = latB;\n        } else {\n            // No solution.\n            return;\n        }\n\n        const newLng = validLng / Math.PI * 180;\n        const newLat = validLat / Math.PI * 180;\n        const oldLat = this.center.lat;\n        this.setCenter(new LngLat(newLng, clamp(newLat, -90, 90)));\n        this.setZoom(this.zoom + getZoomAdjustment(oldLat, this.center.lat));\n    }\n\n    locationToScreenPoint(lnglat: LngLat, terrain?: Terrain): Point {\n        const pos = angularCoordinatesToSurfaceVector(lnglat);\n\n        if (terrain) {\n            const elevation = terrain.getElevationForLngLatZoom(lnglat, this._helper._tileZoom);\n            vec3.scale(pos, pos, 1.0 + elevation / earthRadius);\n        }\n\n        return this._projectSurfacePointToScreen(pos);\n    }\n\n    /**\n     * Projects a given vector on the surface of a unit sphere (or possible above the surface)\n     * and returns its coordinates on screen in pixels.\n     */\n    private _projectSurfacePointToScreen(pos: vec3): Point {\n        const projected = createVec4f64();\n        vec4.transformMat4(projected, [...pos, 1] as vec4, this._globeViewProjMatrixF64);\n        projected[0] /= projected[3];\n        projected[1] /= projected[3];\n        return new Point(\n            (projected[0] * 0.5 + 0.5) * this.width,\n            (-projected[1] * 0.5 + 0.5) * this.height\n        );\n    }\n\n    screenPointToMercatorCoordinate(p: Point, terrain?: Terrain): MercatorCoordinate {\n        if (terrain) {\n            // Mercator has terrain handling implemented properly and since terrain\n            // simply draws tile coordinates into a special framebuffer, this works well even for globe.\n            const coordinate = terrain.pointCoordinate(p);\n            if (coordinate) {\n                return coordinate;\n            }\n        }\n        return MercatorCoordinate.fromLngLat(this.unprojectScreenPoint(p));\n    }\n\n    screenPointToLocation(p: Point, terrain?: Terrain): LngLat {\n        return this.screenPointToMercatorCoordinate(p, terrain)?.toLngLat();\n    }\n\n    isPointOnMapSurface(p: Point, _terrain?: Terrain): boolean {\n        const rayOrigin = this._cameraPosition;\n        const rayDirection = this.getRayDirectionFromPixel(p);\n\n        const intersection = this.rayPlanetIntersection(rayOrigin, rayDirection);\n\n        return !!intersection;\n    }\n\n    /**\n     * Computes normalized direction of a ray from the camera to the given screen pixel.\n     */\n    getRayDirectionFromPixel(p: Point): vec3 {\n        const pos = createVec4f64();\n        pos[0] = (p.x / this.width) * 2.0 - 1.0;\n        pos[1] = ((p.y / this.height) * 2.0 - 1.0) * -1.0;\n        pos[2] = 1;\n        pos[3] = 1;\n        vec4.transformMat4(pos, pos, this._globeViewProjMatrixF64Inverted);\n        pos[0] /= pos[3];\n        pos[1] /= pos[3];\n        pos[2] /= pos[3];\n        const ray = createVec3f64();\n        ray[0] = pos[0] - this._cameraPosition[0];\n        ray[1] = pos[1] - this._cameraPosition[1];\n        ray[2] = pos[2] - this._cameraPosition[2];\n        const rayNormalized: vec3 = createVec3f64();\n        vec3.normalize(rayNormalized, ray);\n        return rayNormalized;\n    }\n\n    /**\n     * For a given point on the unit sphere of the planet, returns whether it is visible from\n     * camera's position (not taking into account camera rotation at all).\n     */\n    private isSurfacePointVisible(p: vec3): boolean {\n        const plane = this._cachedClippingPlane;\n        // dot(position on sphere, occlusion plane equation)\n        const dotResult = plane[0] * p[0] + plane[1] * p[1] + plane[2] * p[2] + plane[3];\n        return dotResult >= 0.0;\n    }\n\n    /**\n     * Returns whether surface point is visible on screen.\n     * It must both project to a pixel in screen bounds and not be occluded by the planet.\n     */\n    private isSurfacePointOnScreen(vec: vec3): boolean {\n        if (!this.isSurfacePointVisible(vec)) {\n            return false;\n        }\n\n        const projected = createVec4f64();\n        vec4.transformMat4(projected, [...vec, 1] as vec4, this._globeViewProjMatrixF64);\n        projected[0] /= projected[3];\n        projected[1] /= projected[3];\n        projected[2] /= projected[3];\n        return projected[0] > -1 && projected[0] < 1 &&\n            projected[1] > -1 && projected[1] < 1 &&\n            projected[2] > -1 && projected[2] < 1;\n    }\n\n    /**\n     * Returns the two intersection points of the ray and the planet's sphere,\n     * or null if no intersection occurs.\n     * The intersections are encoded as the parameter for parametric ray equation,\n     * with `tMin` being the first intersection and `tMax` being the second.\n     * Eg. the nearer intersection point can then be computed as `origin + direction * tMin`.\n     * @param origin - The ray origin.\n     * @param direction - The normalized ray direction.\n     */\n    private rayPlanetIntersection(origin: vec3, direction: vec3): RaySphereIntersection {\n        const originDotDirection = vec3.dot(origin, direction);\n        const planetRadiusSquared = 1.0; // planet is a unit sphere, so its radius squared is 1\n\n        // Ray-sphere intersection involves a quadratic equation.\n        // However solving it in the traditional schoolbook way leads to floating point precision issues.\n        // Here we instead use the approach suggested in the book Ray Tracing Gems, chapter 7.\n        // https://www.realtimerendering.com/raytracinggems/rtg/index.html\n        const inner = createVec3f64();\n        const scaledDir = createVec3f64();\n        vec3.scale(scaledDir, direction, originDotDirection);\n        vec3.sub(inner, origin, scaledDir);\n        const discriminant = planetRadiusSquared - vec3.dot(inner, inner);\n\n        if (discriminant < 0) {\n            return null;\n        }\n\n        const c = vec3.dot(origin, origin) - planetRadiusSquared;\n        const q = -originDotDirection + (originDotDirection < 0 ? 1 : -1) * Math.sqrt(discriminant);\n        const t0 = c / q;\n        const t1 = q;\n        // Assume the ray origin is never inside the sphere\n        const tMin = Math.min(t0, t1);\n        const tMax = Math.max(t0, t1);\n        return {\n            tMin,\n            tMax\n        };\n    }\n\n    /**\n     * @internal\n     * Returns a {@link LngLat} representing geographical coordinates that correspond to the specified pixel coordinates.\n     * Note: if the point does not lie on the globe, returns a location on the visible globe horizon (edge) that is\n     * as close to the point as possible.\n     * @param p - Screen point in pixels to unproject.\n     * @param terrain - Optional terrain.\n     */\n    private unprojectScreenPoint(p: Point): LngLat {\n        // Here we compute the intersection of the ray towards the pixel at `p` and the planet sphere.\n        // As always, we assume that the planet is centered at 0,0,0 and has radius 1.\n        // Ray origin is `_cameraPosition` and direction is `rayNormalized`.\n        const rayOrigin = this._cameraPosition;\n        const rayDirection = this.getRayDirectionFromPixel(p);\n        const intersection = this.rayPlanetIntersection(rayOrigin, rayDirection);\n\n        if (intersection) {\n            // Ray intersects the sphere -> compute intersection LngLat.\n            // Assume the ray origin is never inside the sphere - just use tMin\n            const intersectionPoint = createVec3f64();\n            vec3.add(intersectionPoint, rayOrigin, [\n                rayDirection[0] * intersection.tMin,\n                rayDirection[1] * intersection.tMin,\n                rayDirection[2] * intersection.tMin\n            ]);\n            const sphereSurface = createVec3f64();\n            vec3.normalize(sphereSurface, intersectionPoint);\n            return sphereSurfacePointToCoordinates(sphereSurface);\n        }\n\n        // Ray does not intersect the sphere -> find the closest point on the horizon to the ray.\n        // Intersect the ray with the clipping plane, since we know that the intersection of the clipping plane and the sphere is the horizon.\n        const horizonPlane = this._cachedClippingPlane;\n        const directionDotPlaneXyz = horizonPlane[0] * rayDirection[0] + horizonPlane[1] * rayDirection[1] + horizonPlane[2] * rayDirection[2];\n        const originToPlaneDistance = pointPlaneSignedDistance(horizonPlane, rayOrigin);\n        const distanceToIntersection = -originToPlaneDistance / directionDotPlaneXyz;\n\n        const maxRayLength = 2.0; // One globe diameter\n        const planeIntersection = createVec3f64();\n\n        if (distanceToIntersection > 0) {\n            vec3.add(planeIntersection, rayOrigin, [\n                rayDirection[0] * distanceToIntersection,\n                rayDirection[1] * distanceToIntersection,\n                rayDirection[2] * distanceToIntersection\n            ]);\n        } else {\n            // When the ray takes too long to hit the plane (>maxRayLength), or if the plane intersection is behind the camera, handle things differently.\n            // Take a point along the ray at distance maxRayLength, project it to clipping plane, then continue as normal to find the horizon point.\n            const distantPoint = createVec3f64();\n            vec3.add(distantPoint, rayOrigin, [\n                rayDirection[0] * maxRayLength,\n                rayDirection[1] * maxRayLength,\n                rayDirection[2] * maxRayLength\n            ]);\n            const distanceFromPlane = pointPlaneSignedDistance(this._cachedClippingPlane, distantPoint);\n            vec3.sub(planeIntersection, distantPoint, [\n                this._cachedClippingPlane[0] * distanceFromPlane,\n                this._cachedClippingPlane[1] * distanceFromPlane,\n                this._cachedClippingPlane[2] * distanceFromPlane\n            ]);\n        }\n\n        const horizonDisk = horizonPlaneToCenterAndRadius(horizonPlane);\n        const closestOnHorizon = clampToSphere(horizonDisk.center, horizonDisk.radius, planeIntersection);\n\n        return sphereSurfacePointToCoordinates(closestOnHorizon);\n    }\n\n    getProjectionDataForCustomLayer(applyGlobeMatrix: boolean = true): CustomLayerProjectionData {\n        const globeData = this.getProjectionData({overscaledTileID: new OverscaledTileID(0, 0, 0, 0, 0), applyGlobeMatrix});\n        globeData.tileMercatorCoords = [0, 0, 1, 1];\n        return globeData;\n    }\n\n    getFastPathSimpleProjectionMatrix(_tileID: OverscaledTileID): mat4 {\n        return undefined;\n    }\n}\n","import type {mat2, mat4, vec3, vec4} from 'gl-matrix';\nimport {TransformHelper} from '../transform_helper.ts';\nimport {MercatorTransform} from './mercator_transform.ts';\nimport {VerticalPerspectiveTransform} from './vertical_perspective_transform.ts';\nimport {type LngLat, type LngLatLike,} from '../lng_lat.ts';\nimport {lerp} from '../../util/util.ts';\nimport type {OverscaledTileID, UnwrappedTileID, CanonicalTileID} from '../../tile/tile_id.ts';\n\nimport type Point from '@mapbox/point-geometry';\nimport type {MercatorCoordinate} from '../mercator_coordinate.ts';\nimport type {LngLatBounds} from '../lng_lat_bounds.ts';\nimport type {Frustum} from '../../util/primitives/frustum.ts';\nimport type {Terrain} from '../../render/terrain.ts';\nimport type {PointProjection} from '../../symbol/projection.ts';\nimport type {IReadonlyTransform, ITransform, TransformConstrainFunction} from '../transform_interface.ts';\nimport type {TransformOptions} from '../transform_helper.ts';\nimport type {PaddingOptions} from '../edge_insets.ts';\nimport type {CustomLayerProjectionData, ProjectionDataParams, RendererProjectionData} from './projection_data.ts';\nimport type {CoveringTilesDetailsProvider} from './covering_tiles_details_provider.ts';\n\n/**\n * Globe transform is a transform that moves between vertical perspective and mercator projections.\n */\nexport class GlobeTransform implements ITransform {\n    private _helper: TransformHelper;\n\n    //\n    // Implementation of transform getters and setters\n    //\n\n    get pixelsToClipSpaceMatrix(): mat4 {\n        return this._helper.pixelsToClipSpaceMatrix;\n    }\n    get clipSpaceToPixelsMatrix(): mat4 {\n        return this._helper.clipSpaceToPixelsMatrix;\n    }\n    get pixelsToGLUnits(): [number, number] {\n        return this._helper.pixelsToGLUnits;\n    }\n    get centerOffset(): Point {\n        return this._helper.centerOffset;\n    }\n    get size(): Point {\n        return this._helper.size;\n    }\n    get rotationMatrix(): mat2 {\n        return this._helper.rotationMatrix;\n    }\n    get centerPoint(): Point {\n        return this._helper.centerPoint;\n    }\n    get pixelsPerMeter(): number {\n        return this._helper.pixelsPerMeter;\n    }\n    setMinZoom(zoom: number): void {\n        this._helper.setMinZoom(zoom);\n    }\n    setMaxZoom(zoom: number): void {\n        this._helper.setMaxZoom(zoom);\n    }\n    setMinPitch(pitch: number): void {\n        this._helper.setMinPitch(pitch);\n    }\n    setMaxPitch(pitch: number): void {\n        this._helper.setMaxPitch(pitch);\n    }\n    setRenderWorldCopies(renderWorldCopies: boolean): void {\n        this._helper.setRenderWorldCopies(renderWorldCopies);\n    }\n    setBearing(bearing: number): void {\n        this._helper.setBearing(bearing);\n    }\n    setPitch(pitch: number): void {\n        this._helper.setPitch(pitch);\n    }\n    setRoll(roll: number): void {\n        this._helper.setRoll(roll);\n    }\n    setFov(fov: number): void {\n        this._helper.setFov(fov);\n    }\n    setZoom(zoom: number): void {\n        this._helper.setZoom(zoom);\n    }\n    setCenter(center: LngLat): void {\n        this._helper.setCenter(center);\n    }\n    setElevation(elevation: number): void {\n        this._helper.setElevation(elevation);\n    }\n    setMinElevationForCurrentTile(elevation: number): void {\n        this._helper.setMinElevationForCurrentTile(elevation);\n    }\n    setPadding(padding: PaddingOptions): void {\n        this._helper.setPadding(padding);\n    }\n    interpolatePadding(start: PaddingOptions, target: PaddingOptions, t: number): void {\n        this._helper.interpolatePadding(start, target, t);\n    }\n    isPaddingEqual(padding: PaddingOptions): boolean {\n        return this._helper.isPaddingEqual(padding);\n    }\n    resize(width: number, height: number, constrainTransform: boolean = true): void {\n        this._helper.resize(width, height, constrainTransform);\n    }\n    getMaxBounds(): LngLatBounds {\n        return this._helper.getMaxBounds();\n    }\n    setMaxBounds(bounds?: LngLatBounds): void {\n        this._helper.setMaxBounds(bounds);\n    }\n    setConstrainOverride(constrain?: TransformConstrainFunction | null): void {\n        this._helper.setConstrainOverride(constrain);\n    }\n    overrideNearFarZ(nearZ: number, farZ: number): void {\n        this._helper.overrideNearFarZ(nearZ, farZ);\n    }\n    clearNearFarZOverride(): void {\n        this._helper.clearNearFarZOverride();\n    }\n    getCameraQueryGeometry(queryGeometry: Point[]): Point[] {\n        return this._helper.getCameraQueryGeometry(this.getCameraPoint(), queryGeometry);\n    }\n\n    get tileSize(): number {\n        return this._helper.tileSize;\n    }\n    get tileZoom(): number {\n        return this._helper.tileZoom;\n    }\n    get scale(): number {\n        return this._helper.scale;\n    }\n    get worldSize(): number {\n        return this._helper.worldSize;\n    }\n    get width(): number {\n        return this._helper.width;\n    }\n    get height(): number {\n        return this._helper.height;\n    }\n    get lngRange(): [number, number] {\n        return this._helper.lngRange;\n    }\n    get latRange(): [number, number] {\n        return this._helper.latRange;\n    }\n    get minZoom(): number {\n        return this._helper.minZoom;\n    }\n    get maxZoom(): number {\n        return this._helper.maxZoom;\n    }\n    get zoom(): number {\n        return this._helper.zoom;\n    }\n    get center(): LngLat {\n        return this._helper.center;\n    }\n    get minPitch(): number {\n        return this._helper.minPitch;\n    }\n    get maxPitch(): number {\n        return this._helper.maxPitch;\n    }\n    get pitch(): number {\n        return this._helper.pitch;\n    }\n    get pitchInRadians(): number {\n        return this._helper.pitchInRadians;\n    }\n    get roll(): number {\n        return this._helper.roll;\n    }\n    get rollInRadians(): number {\n        return this._helper.rollInRadians;\n    }\n    get bearing(): number {\n        return this._helper.bearing;\n    }\n    get bearingInRadians(): number {\n        return this._helper.bearingInRadians;\n    }\n    get fov(): number {\n        return this._helper.fov;\n    }\n    get fovInRadians(): number {\n        return this._helper.fovInRadians;\n    }\n    get elevation(): number {\n        return this._helper.elevation;\n    }\n    get minElevationForCurrentTile(): number {\n        return this._helper.minElevationForCurrentTile;\n    }\n    get padding(): PaddingOptions {\n        return this._helper.padding;\n    }\n    get unmodified(): boolean {\n        return this._helper.unmodified;\n    }\n    get renderWorldCopies(): boolean {\n        return this._helper.renderWorldCopies;\n    }\n    get cameraToCenterDistance(): number {\n        return this._helper.cameraToCenterDistance;\n    }\n    get constrainOverride(): TransformConstrainFunction {\n        return this._helper.constrainOverride;\n    }\n    public get nearZ(): number {\n        return this._helper.nearZ;\n    }\n    public get farZ(): number {\n        return this._helper.farZ;\n    }\n    public get autoCalculateNearFarZ(): boolean {\n        return this._helper.autoCalculateNearFarZ;\n    }\n    //\n    // Implementation of globe transform\n    //\n\n    /**\n     * True when globe render path should be used instead of the old but simpler mercator rendering.\n     * Globe automatically transitions to mercator at high zoom levels, which causes a switch from\n     * globe to mercator render path.\n     */\n    get isGlobeRendering(): boolean {\n        return this._globeness > 0;\n    }\n\n    setTransitionState(globeness: number): void {\n        this._globeness = globeness;\n        this._calcMatrices();\n        this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame();\n        this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame();\n    }\n\n    private get currentTransform(): ITransform {\n        return this.isGlobeRendering ? this._verticalPerspectiveTransform : this._mercatorTransform;\n    }\n\n    /**\n     * Globe projection can smoothly interpolate between globe view and mercator. This variable controls this interpolation.\n     * Value 0 is mercator, value 1 is globe, anything between is an interpolation between the two projections.\n     */\n    private _globeness: number = 1.0;\n    private _mercatorTransform: MercatorTransform;\n    private _verticalPerspectiveTransform: VerticalPerspectiveTransform;\n\n    public constructor(options?: TransformOptions) {\n        this._helper = new TransformHelper({\n            calcMatrices: () => this._calcMatrices(),\n            defaultConstrain: (center, zoom) => { return this.defaultConstrain(center, zoom); }\n        }, options);\n        this._globeness = 1; // When transform is cloned for use in symbols, `_updateAnimation` function which usually sets this value never gets called.\n        this._mercatorTransform = new MercatorTransform();\n        this._verticalPerspectiveTransform = new VerticalPerspectiveTransform();\n    }\n\n    clone(): ITransform {\n        const clone = new GlobeTransform();\n        clone._globeness = this._globeness;\n        clone.apply(this, false);\n        return clone;\n    }\n\n    public apply(that: IReadonlyTransform, constrain: boolean): void {\n        this._helper.apply(that, constrain);\n        this._mercatorTransform.apply(this, false);\n        this._verticalPerspectiveTransform.apply(this, false);\n    }\n\n    public get projectionMatrix(): mat4 { return this.currentTransform.projectionMatrix; }\n\n    public get modelViewProjectionMatrix(): mat4 { return this.currentTransform.modelViewProjectionMatrix; }\n\n    public get inverseProjectionMatrix(): mat4 { return this.currentTransform.inverseProjectionMatrix; }\n\n    public get cameraPosition(): vec3 { return this.currentTransform.cameraPosition; }\n\n    getProjectionData(params: ProjectionDataParams): RendererProjectionData {\n        const mercatorProjectionData = this._mercatorTransform.getProjectionData(params);\n        const verticalPerspectiveProjectionData = this._verticalPerspectiveTransform.getProjectionData(params);\n\n        return {\n            mainMatrix: this.isGlobeRendering ? verticalPerspectiveProjectionData.mainMatrix : mercatorProjectionData.mainMatrix,\n            clippingPlane: verticalPerspectiveProjectionData.clippingPlane,\n            tileMercatorCoords: verticalPerspectiveProjectionData.tileMercatorCoords,\n            projectionTransition: params.applyGlobeMatrix ? this._globeness : 0,\n            fallbackMatrix: mercatorProjectionData.fallbackMatrix,\n            clipAntimeridian: verticalPerspectiveProjectionData.clipAntimeridian,\n        };\n    }\n\n    public isLocationOccluded(location: LngLat): boolean {\n        return this.currentTransform.isLocationOccluded(location);\n    }\n\n    public transformLightDirection(dir: vec3): vec3 {\n        return this.currentTransform.transformLightDirection(dir);\n    }\n\n    public getPixelScale(): number {\n        return lerp(this._mercatorTransform.getPixelScale(), this._verticalPerspectiveTransform.getPixelScale(), this._globeness);\n    }\n\n    public getCircleRadiusCorrection(): number {\n        return lerp(this._mercatorTransform.getCircleRadiusCorrection(), this._verticalPerspectiveTransform.getCircleRadiusCorrection(), this._globeness);\n    }\n\n    public getPitchedTextCorrection(textAnchorX: number, textAnchorY: number, tileID: UnwrappedTileID): number {\n        const mercatorCorrection = this._mercatorTransform.getPitchedTextCorrection(textAnchorX, textAnchorY, tileID);\n        const verticalCorrection = this._verticalPerspectiveTransform.getPitchedTextCorrection(textAnchorX, textAnchorY, tileID);\n        return lerp(mercatorCorrection, verticalCorrection, this._globeness);\n    }\n\n    public projectTileCoordinates(x: number, y: number, unwrappedTileID: UnwrappedTileID, getElevation: (x: number, y: number) => number): PointProjection {\n        return this.currentTransform.projectTileCoordinates(x, y, unwrappedTileID, getElevation);\n    }\n\n    private _calcMatrices(): void {\n        if (!this._helper._width || !this._helper._height) {\n            return;\n        }\n        // VerticalPerspective reads our near/farZ values and autoCalculateNearFarZ:\n        // - if autoCalculateNearFarZ is true then it computes globe Z values\n        // - if autoCalculateNearFarZ is false then it inherits our Z values\n        // In either case, its Z values are consistent with out settings and we want to copy its Z values to our helper.\n        this._verticalPerspectiveTransform.apply(this, false);\n        this._helper._nearZ = this._verticalPerspectiveTransform.nearZ;\n        this._helper._farZ = this._verticalPerspectiveTransform.farZ;\n\n        // When transitioning between globe and mercator, we need to synchronize the depth values in both transforms.\n        // For this reason we first update vertical perspective and then sync our Z values to its result.\n        // Now if globe rendering, we always want to force mercator transform to adapt our Z values.\n        // If not, it will either compute its own (autoCalculateNearFarZ=false) or adapt our (autoCalculateNearFarZ=true).\n        // In either case we want to (again) sync our Z values, this time with\n        this._mercatorTransform.apply(this, true, this.isGlobeRendering);\n        this._helper._nearZ = this._mercatorTransform.nearZ;\n        this._helper._farZ = this._mercatorTransform.farZ;\n    }\n\n    calculateFogMatrix(unwrappedTileID: UnwrappedTileID): mat4 {\n        return this.currentTransform.calculateFogMatrix(unwrappedTileID);\n    }\n\n    getVisibleUnwrappedCoordinates(tileID: CanonicalTileID): UnwrappedTileID[] {\n        return this.currentTransform.getVisibleUnwrappedCoordinates(tileID);\n    }\n\n    getCameraFrustum(): Frustum {\n        return this.currentTransform.getCameraFrustum();\n    }\n    getClippingPlane(): vec4 | null {\n        return this.currentTransform.getClippingPlane();\n    }\n    getCoveringTilesDetailsProvider(): CoveringTilesDetailsProvider {\n        return this.currentTransform.getCoveringTilesDetailsProvider();\n    }\n\n    recalculateZoomAndCenter(terrain?: Terrain): void {\n        this.currentTransform.recalculateZoomAndCenter(terrain);\n    }\n\n    maxPitchScaleFactor(): number {\n        // Using mercator version of this should be good enough approximation for globe.\n        return this._mercatorTransform.maxPitchScaleFactor();\n    }\n\n    getCameraPoint(): Point {\n        return this._helper.getCameraPoint();\n    }\n\n    getCameraAltitude(): number {\n        return this._helper.getCameraAltitude();\n    }\n\n    getCameraLngLat(): LngLat {\n        return this._helper.getCameraLngLat();\n    }\n\n    lngLatToCameraDepth(lngLat: LngLat, elevation: number): number {\n        return this.currentTransform.lngLatToCameraDepth(lngLat, elevation);\n    }\n\n    populateCache(coords: OverscaledTileID[]): void {\n        this._mercatorTransform.populateCache(coords);\n        this._verticalPerspectiveTransform.populateCache(coords);\n    }\n\n    getBounds(): LngLatBounds {\n        return this.currentTransform.getBounds();\n    }\n\n    defaultConstrain: TransformConstrainFunction = (lngLat, zoom) => {\n        return this.currentTransform.defaultConstrain(lngLat, zoom);\n    };\n\n    applyConstrain: TransformConstrainFunction = (lngLat, zoom) => {\n        return this._helper.applyConstrain(lngLat, zoom);\n    };\n\n    calculateCenterFromCameraLngLatAlt(lngLat: LngLatLike, alt: number, bearing?: number, pitch?: number): {center: LngLat; elevation: number; zoom: number} {\n        return this._helper.calculateCenterFromCameraLngLatAlt(lngLat, alt, bearing, pitch);\n    }\n\n    /**\n     * Note: automatically adjusts zoom to keep planet size consistent\n     * (same size before and after a {@link setLocationAtPoint} call).\n     */\n    setLocationAtPoint(lnglat: LngLat, point: Point): void {\n        if (!this.isGlobeRendering) {\n            this._mercatorTransform.setLocationAtPoint(lnglat, point);\n            this.apply(this._mercatorTransform, false);\n            return;\n        }\n        this._verticalPerspectiveTransform.setLocationAtPoint(lnglat, point);\n        this.apply(this._verticalPerspectiveTransform, false);\n        return;\n    }\n\n    locationToScreenPoint(lnglat: LngLat, terrain?: Terrain): Point {\n        return this.currentTransform.locationToScreenPoint(lnglat, terrain);\n    }\n\n    screenPointToMercatorCoordinate(p: Point, terrain?: Terrain): MercatorCoordinate {\n        return this.currentTransform.screenPointToMercatorCoordinate(p, terrain);\n    }\n\n    screenPointToLocation(p: Point, terrain?: Terrain): LngLat {\n        return this.currentTransform.screenPointToLocation(p, terrain);\n    }\n\n    isPointOnMapSurface(p: Point, terrain?: Terrain): boolean {\n        return this.currentTransform.isPointOnMapSurface(p, terrain);\n    }\n\n    /**\n     * Computes normalized direction of a ray from the camera to the given screen pixel.\n     */\n    getRayDirectionFromPixel(p: Point): vec3 {\n        return this._verticalPerspectiveTransform.getRayDirectionFromPixel(p);\n    }\n\n    getProjectionDataForCustomLayer(applyGlobeMatrix: boolean = true): CustomLayerProjectionData {\n        const mercatorData = this._mercatorTransform.getProjectionDataForCustomLayer(applyGlobeMatrix);\n\n        if (!this.isGlobeRendering) {\n            return mercatorData;\n        }\n\n        const globeData = this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(applyGlobeMatrix);\n        globeData.fallbackMatrix = mercatorData.mainMatrix;\n        return globeData;\n    }\n\n    getFastPathSimpleProjectionMatrix(tileID: OverscaledTileID): mat4 {\n        return this.currentTransform.getFastPathSimpleProjectionMatrix(tileID);\n    }\n}\n","import Point from '@mapbox/point-geometry';\nimport {cameraBoundsWarning, type CameraForBoxAndBearingHandlerResult, type EaseToHandlerResult, type EaseToHandlerOptions, type FlyToHandlerResult, type FlyToHandlerOptions, type ICameraHelper, type MapControlsDeltas, updateRotation, cameraForBoxAndBearing} from './camera_helper.ts';\nimport {LngLat, type LngLatLike} from '../lng_lat.ts';\nimport {angularCoordinatesToSurfaceVector, computeGlobePanCenter, getGlobeRadiusPixels, getZoomAdjustment, globeDistanceOfLocationsPixels, interpolateLngLatForGlobe} from './globe_utils.ts';\nimport {clamp, createVec3f64, differenceOfAnglesDegrees, MAX_VALID_LATITUDE, remapSaturate, rollPitchBearingEqual, scaleZoom, warnOnce, zoomScale} from '../../util/util.ts';\nimport {type mat4, vec3} from 'gl-matrix';\nimport {normalizeCenter} from '../transform_helper.ts';\nimport {interpolates} from '@maplibre/maplibre-gl-style-spec';\n\nimport type {IReadonlyTransform, ITransform} from '../transform_interface.ts';\nimport type {CameraForBoundsOptions} from '../../ui/camera.ts';\nimport type {LngLatBounds} from '../lng_lat_bounds.ts';\nimport type {PaddingOptions} from '../edge_insets.ts';\n\n/**\n * @internal\n */\nexport class VerticalPerspectiveCameraHelper implements ICameraHelper {\n\n    get useGlobeControls(): boolean { return true; }\n\n    handlePanInertia(pan: Point, transform: IReadonlyTransform): {\n        easingCenter: LngLat;\n        easingOffset: Point;\n    } {\n        const panCenter = computeGlobePanCenter(pan, transform);\n        if (Math.abs(panCenter.lng - transform.center.lng) > 180) {\n            // If easeTo target would be over 180° distant, the animation would move\n            // in the opposite direction that what the user intended.\n            // Thus we clamp the movement to 179.5°.\n            panCenter.lng = transform.center.lng + 179.5 * Math.sign(panCenter.lng - transform.center.lng);\n        }\n        return {\n            easingCenter: panCenter,\n            easingOffset: new Point(0, 0),\n        };\n    }\n\n    handleMapControlsRollPitchBearingZoom(deltas: MapControlsDeltas, tr: ITransform): void {\n        const zoomPixel = deltas.around;\n        const zoomLoc = tr.screenPointToLocation(zoomPixel);\n\n        if (deltas.bearingDelta) tr.setBearing(tr.bearing + deltas.bearingDelta);\n        if (deltas.pitchDelta) tr.setPitch(tr.pitch + deltas.pitchDelta);\n        if (deltas.rollDelta) tr.setRoll(tr.roll + deltas.rollDelta);\n        const oldZoomPreZoomDelta = tr.zoom;\n        if (deltas.zoomDelta) tr.setZoom(tr.zoom + deltas.zoomDelta);\n        const actualZoomDelta = tr.zoom - oldZoomPreZoomDelta;\n\n        if (actualZoomDelta === 0) {\n            return;\n        }\n\n        // Problem: `setLocationAtPoint` for globe works when it is called a single time, but is a little glitchy in practice when used repeatedly for zooming.\n        // - `setLocationAtPoint` repeatedly called at a location behind a pole will eventually glitch out\n        // - `setLocationAtPoint` at location the longitude of which is more than 90° different from current center will eventually glitch out\n        // But otherwise works fine at higher zooms, or when the target is somewhat near the current map center.\n        // Solution: use a heuristic zooming in the problematic cases and interpolate to `setLocationAtPoint` when possible.\n\n        // Magic numbers that control:\n        // - when zoom movement slowing starts for cursor not on globe (avoid unnatural map movements)\n        // - when we interpolate from exact zooming to heuristic zooming based on longitude difference of target location to current center\n        // - when we interpolate from exact zooming to heuristic zooming based on globe being too small on screen\n        // - when zoom movement slowing starts for globe being too small on viewport (avoids unnatural/unwanted map movements when map is zoomed out a lot)\n        const raySurfaceDistanceForSlowingStart = 0.3; // Zoom movement slowing will start when the planet surface to ray distance is greater than this number (globe radius is 1, so 0.3 is ~2000km form the surface).\n        const slowingMultiplier = 0.5; // The lower this value, the slower will the \"zoom movement slowing\" occur.\n        const interpolateToHeuristicStartLng = 45; // When zoom location longitude is this many degrees away from map center, we start interpolating from exact zooming to heuristic zooming.\n        const interpolateToHeuristicEndLng = 85; // Longitude difference at which interpolation to heuristic zooming ends.\n        const interpolateToHeuristicExponent = 0.25; // Makes interpolation smoother.\n        const interpolateToHeuristicStartRadius = 0.75; // When globe is this many times larger than the smaller viewport dimension, we start interpolating from exact zooming to heuristic zooming.\n        const interpolateToHeuristicEndRadius = 0.35; // Globe size at which interpolation to heuristic zooming ends.\n        const slowingRadiusStart = 0.9; // If globe is this many times larger than the smaller viewport dimension, start inhibiting map movement while zooming\n        const slowingRadiusStop = 0.5;\n        const slowingRadiusSlowFactor = 0.25; // How much is movement slowed when globe is too small\n\n        const dLngRaw = differenceOfAnglesDegrees(tr.center.lng, zoomLoc.lng);\n        const dLng = dLngRaw / (Math.abs(dLngRaw / 180) + 1.0); // This gradually reduces the amount of longitude change if the zoom location is very far, eg. on the other side of the pole (possible when looking at a pole).\n        const dLat = differenceOfAnglesDegrees(tr.center.lat, zoomLoc.lat);\n\n        // Slow zoom movement down if the mouse ray is far from the planet.\n        const rayDirection = tr.getRayDirectionFromPixel(zoomPixel);\n        const rayOrigin = tr.cameraPosition;\n        const distanceToClosestPoint = vec3.dot(rayOrigin, rayDirection) * -1; // Globe center relative to ray origin is equal to -rayOrigin and rayDirection is normalized, thus we want to compute dot(-rayOrigin, rayDirection).\n        const closestPoint = createVec3f64();\n        vec3.add(closestPoint, rayOrigin, [\n            rayDirection[0] * distanceToClosestPoint,\n            rayDirection[1] * distanceToClosestPoint,\n            rayDirection[2] * distanceToClosestPoint\n        ]);\n        const distanceFromSurface = vec3.length(closestPoint) - 1;\n        const distanceFactor = Math.exp(-Math.max(distanceFromSurface - raySurfaceDistanceForSlowingStart, 0) * slowingMultiplier);\n\n        // Slow zoom movement down if the globe is too small on viewport\n        const radius = getGlobeRadiusPixels(tr.worldSize, tr.center.lat) / Math.min(tr.width, tr.height); // Radius relative to larger viewport dimension\n        const radiusFactor = remapSaturate(radius, slowingRadiusStart, slowingRadiusStop, 1.0, slowingRadiusSlowFactor);\n\n        // Compute how much to move towards the zoom location\n        const factor = (1.0 - zoomScale(-actualZoomDelta)) * Math.min(distanceFactor, radiusFactor);\n\n        const oldCenterLat = tr.center.lat;\n        const oldZoom = tr.zoom;\n        const heuristicCenter = new LngLat(\n            tr.center.lng + dLng * factor,\n            clamp(tr.center.lat + dLat * factor, -MAX_VALID_LATITUDE, MAX_VALID_LATITUDE)\n        );\n\n        // Now compute the map center exact zoom\n        tr.setLocationAtPoint(zoomLoc, zoomPixel);\n        const exactCenter = tr.center;\n\n        // Interpolate between exact zooming and heuristic zooming depending on the longitude difference between current center and zoom location.\n        const interpolationFactorLongitude = remapSaturate(Math.abs(dLngRaw), interpolateToHeuristicStartLng, interpolateToHeuristicEndLng, 0, 1);\n        const interpolationFactorRadius = remapSaturate(radius, interpolateToHeuristicStartRadius, interpolateToHeuristicEndRadius, 0, 1);\n        const heuristicFactor = Math.pow(Math.max(interpolationFactorLongitude, interpolationFactorRadius), interpolateToHeuristicExponent);\n\n        const lngExactToHeuristic = differenceOfAnglesDegrees(exactCenter.lng, heuristicCenter.lng);\n        const latExactToHeuristic = differenceOfAnglesDegrees(exactCenter.lat, heuristicCenter.lat);\n\n        tr.setCenter(new LngLat(\n            exactCenter.lng + lngExactToHeuristic * heuristicFactor,\n            exactCenter.lat + latExactToHeuristic * heuristicFactor\n        ).wrap());\n        tr.setZoom(oldZoom + getZoomAdjustment(oldCenterLat, tr.center.lat));\n    }\n\n    handleMapControlsPan(deltas: MapControlsDeltas, tr: ITransform, _preZoomAroundLoc: LngLat): void {\n        if (!deltas.panDelta) {\n            return;\n        }\n\n        // These are actually very similar to mercator controls, and should converge to them at high zooms.\n        // We avoid using the \"grab a place and move it around\" approach from mercator here,\n        // since it is not a very pleasant way to pan a globe.\n        const oldLat = tr.center.lat;\n        const oldZoom = tr.zoom;\n        tr.setCenter(computeGlobePanCenter(deltas.panDelta, tr).wrap());\n        // Setting the center might adjust zoom to keep globe size constant, we need to avoid adding this adjustment a second time\n        tr.setZoom(oldZoom + getZoomAdjustment(oldLat, tr.center.lat));\n    }\n\n    cameraForBoxAndBearing(options: CameraForBoundsOptions, padding: PaddingOptions, bounds: LngLatBounds, bearing: number, tr: ITransform): CameraForBoxAndBearingHandlerResult {\n        const result = cameraForBoxAndBearing(options, padding, bounds, bearing, tr);\n        // If globe is enabled, we use the parameters computed for mercator, and just update the zoom to fit the bounds.\n\n        // Get clip space bounds including padding\n        const xLeft = (padding.left) / tr.width * 2.0 - 1.0;\n        const xRight = (tr.width - padding.right) / tr.width * 2.0 - 1.0;\n        const yTop = (padding.top) / tr.height * -2.0 + 1.0;\n        const yBottom = (tr.height - padding.bottom) / tr.height * -2.0 + 1.0;\n\n        // Get camera bounds\n        const flipEastWest = differenceOfAnglesDegrees(bounds.getWest(), bounds.getEast()) < 0;\n        const lngWest = flipEastWest ? bounds.getEast() : bounds.getWest();\n        const lngEast = flipEastWest ? bounds.getWest() : bounds.getEast();\n\n        const latNorth = Math.max(bounds.getNorth(), bounds.getSouth()); // \"getNorth\" doesn't always return north...\n        const latSouth = Math.min(bounds.getNorth(), bounds.getSouth());\n\n        // Additional vectors will be tested for the rectangle midpoints\n        const lngMid = lngWest + differenceOfAnglesDegrees(lngWest, lngEast) * 0.5;\n        const latMid = latNorth + differenceOfAnglesDegrees(latNorth, latSouth) * 0.5;\n\n        // Obtain a globe projection matrix that does not include pitch (unsupported)\n        const clonedTr = tr.clone();\n        clonedTr.setCenter(result.center);\n        clonedTr.setBearing(result.bearing);\n        clonedTr.setPitch(0);\n        clonedTr.setRoll(0);\n        clonedTr.setZoom(result.zoom);\n        const matrix = clonedTr.modelViewProjectionMatrix;\n\n        // Vectors to test - the bounds' corners and edge midpoints\n        const testVectors = [\n            angularCoordinatesToSurfaceVector(bounds.getNorthWest()),\n            angularCoordinatesToSurfaceVector(bounds.getNorthEast()),\n            angularCoordinatesToSurfaceVector(bounds.getSouthWest()),\n            angularCoordinatesToSurfaceVector(bounds.getSouthEast()),\n            // Also test edge midpoints\n            angularCoordinatesToSurfaceVector(new LngLat(lngEast, latMid)),\n            angularCoordinatesToSurfaceVector(new LngLat(lngWest, latMid)),\n            angularCoordinatesToSurfaceVector(new LngLat(lngMid, latNorth)),\n            angularCoordinatesToSurfaceVector(new LngLat(lngMid, latSouth))\n        ];\n        const vecToCenter = angularCoordinatesToSurfaceVector(result.center);\n\n        // Test each vector, measure how much to scale down the globe to satisfy all tested points that they are inside clip space.\n        let smallestNeededScale = Number.POSITIVE_INFINITY;\n        for (const vec of testVectors) {\n            if (xLeft < 0)\n                smallestNeededScale = VerticalPerspectiveCameraHelper.getLesserNonNegativeNonNull(smallestNeededScale, VerticalPerspectiveCameraHelper.solveVectorScale(vec, vecToCenter, matrix, 'x', xLeft));\n            if (xRight > 0)\n                smallestNeededScale = VerticalPerspectiveCameraHelper.getLesserNonNegativeNonNull(smallestNeededScale, VerticalPerspectiveCameraHelper.solveVectorScale(vec, vecToCenter, matrix, 'x', xRight));\n            if (yTop > 0)\n                smallestNeededScale = VerticalPerspectiveCameraHelper.getLesserNonNegativeNonNull(smallestNeededScale, VerticalPerspectiveCameraHelper.solveVectorScale(vec, vecToCenter, matrix, 'y', yTop));\n            if (yBottom < 0)\n                smallestNeededScale = VerticalPerspectiveCameraHelper.getLesserNonNegativeNonNull(smallestNeededScale, VerticalPerspectiveCameraHelper.solveVectorScale(vec, vecToCenter, matrix, 'y', yBottom));\n        }\n\n        if (!Number.isFinite(smallestNeededScale) || smallestNeededScale === 0) {\n            cameraBoundsWarning();\n            return undefined;\n        }\n\n        // Compute target zoom from the obtained scale.\n        result.zoom = Math.min(clonedTr.zoom + scaleZoom(smallestNeededScale), options.maxZoom);\n        return result;\n    }\n\n    /**\n     * Handles the zoom and center change during camera jumpTo.\n     */\n    handleJumpToCenterZoom(tr: ITransform, options: { zoom?: number; center?: LngLatLike }): void {\n        // Special zoom & center handling for globe:\n        // Globe constrained center isn't dependent on zoom level\n        const startingLat = tr.center.lat;\n        const constrainedCenter = tr.applyConstrain(options.center ? LngLat.convert(options.center) : tr.center, tr.zoom).center;\n        tr.setCenter(constrainedCenter.wrap());\n\n        // Make sure to compute correct target zoom level if no zoom is specified\n        const targetZoom = (typeof options.zoom !== 'undefined') ? +options.zoom : (tr.zoom + getZoomAdjustment(startingLat, constrainedCenter.lat));\n        if (tr.zoom !== targetZoom) {\n            tr.setZoom(targetZoom);\n        }\n    }\n\n    handleEaseTo(tr: ITransform, options: EaseToHandlerOptions): EaseToHandlerResult {\n        const startZoom = tr.zoom;\n        const startCenter = tr.center;\n        const startPadding = tr.padding;\n        const startEulerAngles = {roll: tr.roll, pitch: tr.pitch, bearing: tr.bearing};\n        const endRoll = options.roll === undefined ? tr.roll : options.roll;\n        const endPitch = options.pitch === undefined ? tr.pitch : options.pitch;\n        const endBearing = options.bearing === undefined ? tr.bearing : options.bearing;\n        const endEulerAngles = {roll: endRoll, pitch: endPitch, bearing: endBearing};\n\n        const optionsZoom = typeof options.zoom !== 'undefined';\n\n        const doPadding = !tr.isPaddingEqual(options.padding);\n\n        let isZooming = false;\n\n        // Globe needs special handling for how zoom should be animated.\n        // 1) if zoom is set, ease to the given mercator zoom\n        // 2) if neither is set, assume constant apparent zoom (constant planet size) is to be kept\n        const preConstrainCenter = options.center ?\n            LngLat.convert(options.center) :\n            startCenter;\n        const constrainedCenter = tr.applyConstrain(\n            preConstrainCenter,\n            startZoom // zoom can be whatever at this stage, it should not affect anything if globe is enabled\n        ).center;\n        normalizeCenter(tr, constrainedCenter);\n\n        const clonedTr = tr.clone();\n        clonedTr.setCenter(constrainedCenter);\n\n        clonedTr.setZoom(optionsZoom ?\n            +options.zoom :\n            startZoom + getZoomAdjustment(startCenter.lat, preConstrainCenter.lat));\n        clonedTr.setBearing(options.bearing);\n        const clampedPoint = new Point(\n            clamp(tr.centerPoint.x + options.offsetAsPoint.x, 0, tr.width),\n            clamp(tr.centerPoint.y + options.offsetAsPoint.y, 0, tr.height)\n        );\n        clonedTr.setLocationAtPoint(constrainedCenter, clampedPoint);\n        // Find final animation targets\n        const endCenterWithShift = (options.offset && options.offsetAsPoint.mag()) > 0 ? clonedTr.center : constrainedCenter;\n        const endZoomWithShift = optionsZoom ?\n            +options.zoom :\n            startZoom + getZoomAdjustment(startCenter.lat, endCenterWithShift.lat);\n\n        // Planet radius for a given zoom level differs according to latitude\n        // Convert zooms to what they would be at equator for the given planet radius\n        const normalizedStartZoom = startZoom + getZoomAdjustment(startCenter.lat, 0);\n        const normalizedEndZoom = endZoomWithShift + getZoomAdjustment(endCenterWithShift.lat, 0);\n        const deltaLng = differenceOfAnglesDegrees(startCenter.lng, endCenterWithShift.lng);\n        const deltaLat = differenceOfAnglesDegrees(startCenter.lat, endCenterWithShift.lat);\n\n        const finalScale = zoomScale(normalizedEndZoom - normalizedStartZoom);\n        isZooming = (endZoomWithShift !== startZoom);\n\n        const easeFunc = (k: number) => {\n            if (!rollPitchBearingEqual(startEulerAngles, endEulerAngles)) {\n                updateRotation({\n                    startEulerAngles,\n                    endEulerAngles,\n                    tr,\n                    k,\n                    useSlerp: startEulerAngles.roll != endEulerAngles.roll});\n            }\n\n            if (doPadding) {\n                tr.interpolatePadding(startPadding, options.padding,k);\n            }\n\n            if (options.around) {\n                warnOnce('Easing around a point is not supported under globe projection.');\n                tr.setLocationAtPoint(options.around, options.aroundPoint);\n            } else {\n                const base = normalizedEndZoom > normalizedStartZoom ?\n                    Math.min(2, finalScale) :\n                    Math.max(0.5, finalScale);\n                const speedup = Math.pow(base, 1 - k);\n                const factor = k * speedup;\n\n                // Spherical lerp might be used here instead, but that was tested and it leads to very weird paths when the interpolated arc gets near the poles.\n                // Instead we interpolate LngLat almost directly, but taking into account that\n                // one degree of longitude gets progressively smaller relative to latitude towards the poles.\n                const newCenter = interpolateLngLatForGlobe(startCenter, deltaLng, deltaLat, factor);\n                tr.setCenter(newCenter.wrap());\n            }\n\n            if (isZooming) {\n                const normalizedInterpolatedZoom = interpolates.number(normalizedStartZoom, normalizedEndZoom, k);\n                const interpolatedZoom = normalizedInterpolatedZoom + getZoomAdjustment(0, tr.center.lat);\n                tr.setZoom(interpolatedZoom);\n            }\n        };\n\n        return {\n            easeFunc,\n            isZooming,\n            elevationCenter: endCenterWithShift,\n        };\n    }\n\n    handleFlyTo(tr: ITransform, options: FlyToHandlerOptions): FlyToHandlerResult {\n        const optionsZoom = typeof options.zoom !== 'undefined';\n\n        const startCenter = tr.center;\n        const startZoom = tr.zoom;\n        const startPadding = tr.padding;\n\n        const doPadding = !tr.isPaddingEqual(options.padding);\n\n        // Obtain target center and zoom\n        const constrainedCenter = tr.applyConstrain(\n            LngLat.convert(options.center || options.locationAtOffset),\n            startZoom\n        ).center;\n        const targetZoom = optionsZoom ? +options.zoom : tr.zoom + getZoomAdjustment(tr.center.lat, constrainedCenter.lat);\n\n        // Compute target center that respects offset by creating a temporary transform and calling its `setLocationAtPoint`.\n        const clonedTr = tr.clone();\n        clonedTr.setCenter(constrainedCenter);\n\n        clonedTr.setZoom(targetZoom);\n        clonedTr.setBearing(options.bearing);\n        const clampedPoint = new Point(\n            clamp(tr.centerPoint.x + options.offsetAsPoint.x, 0, tr.width),\n            clamp(tr.centerPoint.y + options.offsetAsPoint.y, 0, tr.height)\n        );\n        clonedTr.setLocationAtPoint(constrainedCenter, clampedPoint);\n        const targetCenter = clonedTr.center;\n\n        normalizeCenter(tr, targetCenter);\n\n        const pixelPathLength = globeDistanceOfLocationsPixels(tr, startCenter, targetCenter);\n\n        const normalizedStartZoom = startZoom + getZoomAdjustment(startCenter.lat, 0);\n        const normalizedTargetZoom = targetZoom + getZoomAdjustment(targetCenter.lat, 0);\n        const scaleOfZoom = zoomScale(normalizedTargetZoom - normalizedStartZoom);\n\n        const requestedMinZoom = typeof options.minZoom === 'number' ? +options.minZoom : tr.minZoom;\n        const effectiveMinZoom = Math.max(requestedMinZoom, tr.minZoom);\n        const normalizedEffectiveMinZoom = effectiveMinZoom + getZoomAdjustment(targetCenter.lat, 0);\n        const normalizedMinZoomPreConstrain = Math.min(normalizedEffectiveMinZoom, normalizedStartZoom, normalizedTargetZoom);\n        const minZoomPreConstrain = normalizedMinZoomPreConstrain + getZoomAdjustment(0, targetCenter.lat);\n        const minZoom = tr.applyConstrain(targetCenter, minZoomPreConstrain).zoom;\n        const normalizedMinZoom = minZoom + getZoomAdjustment(targetCenter.lat, 0);\n        const scaleOfMinZoom = zoomScale(normalizedMinZoom - normalizedStartZoom);\n\n        const deltaLng = differenceOfAnglesDegrees(startCenter.lng, targetCenter.lng);\n        const deltaLat = differenceOfAnglesDegrees(startCenter.lat, targetCenter.lat);\n\n        const easeFunc = (k: number, scale: number, centerFactor: number, _pointAtOffset: Point) => {\n            const interpolatedCenter = interpolateLngLatForGlobe(startCenter, deltaLng, deltaLat, centerFactor);\n\n            if (doPadding) {\n                tr.interpolatePadding(startPadding, options.padding,k);\n            }\n\n            const newCenter = k === 1 ? targetCenter : interpolatedCenter;\n            tr.setCenter(newCenter.wrap());\n\n            const interpolatedZoom = normalizedStartZoom + scaleZoom(scale);\n            tr.setZoom(k === 1 ? targetZoom : (interpolatedZoom + getZoomAdjustment(0, newCenter.lat)));\n        };\n\n        return {\n            easeFunc,\n            scaleOfZoom,\n            targetCenter,\n            scaleOfMinZoom,\n            pixelPathLength,\n        };\n    }\n\n    /**\n     * Computes how much to scale the globe in order for a given point on its surface (a location) to project to a given clip space coordinate in either the X or the Y axis.\n     * @param vector - Position of the queried location on the surface of the unit sphere globe.\n     * @param toCenter - Position of current transform center on the surface of the unit sphere globe.\n     * This is needed because zooming the globe not only changes its scale,\n     * but also moves the camera closer or further away along this vector (pitch is disregarded).\n     * @param projection - The globe projection matrix.\n     * @param targetDimension - The dimension in which the scaled vector must match the target value in clip space.\n     * @param targetValue - The target clip space value in the specified dimension to which the queried vector must project.\n     * @returns How much to scale the globe.\n     */\n    private static solveVectorScale(vector: vec3, toCenter: vec3, projection: mat4, targetDimension: 'x' | 'y', targetValue: number): number | null {\n        // We want to compute how much to scale the sphere in order for the input `vector` to project to `targetValue` in the given `targetDimension` (X or Y).\n        const k = targetValue;\n        const columnXorY = targetDimension === 'x' ?\n            [projection[0], projection[4], projection[8], projection[12]] : // X\n            [projection[1], projection[5], projection[9], projection[13]];  // Y\n        const columnZ = [projection[3], projection[7], projection[11], projection[15]];\n\n        const vecDotXY = vector[0] * columnXorY[0] + vector[1] * columnXorY[1] + vector[2] * columnXorY[2];\n        const vecDotZ = vector[0] * columnZ[0] + vector[1] * columnZ[1] + vector[2] * columnZ[2];\n        const toCenterDotXY = toCenter[0] * columnXorY[0] + toCenter[1] * columnXorY[1] + toCenter[2] * columnXorY[2];\n        const toCenterDotZ = toCenter[0] * columnZ[0] + toCenter[1] * columnZ[1] + toCenter[2] * columnZ[2];\n\n        // The following can be derived from writing down what happens to a vector scaled by a parameter (\"V * t\") when it is multiplied by a projection matrix, then solving for \"t\".\n        // Or rather, we derive it for a vector \"V * t + (1-t) * C\". Where V is `vector` and C is `toCenter`. The extra addition is needed because zooming out also moves the camera along \"C\".\n\n        const t = (toCenterDotXY + columnXorY[3] - k * toCenterDotZ - k * columnZ[3]) / (toCenterDotXY - vecDotXY - k * toCenterDotZ + k * vecDotZ);\n\n        if (\n            toCenterDotXY + k * vecDotZ === vecDotXY + k * toCenterDotZ ||\n            columnZ[3] * (vecDotXY - toCenterDotXY) + columnXorY[3] * (toCenterDotZ - vecDotZ) + vecDotXY * toCenterDotZ === toCenterDotXY * vecDotZ\n        ) {\n            // The computed result is invalid.\n            return null;\n        }\n        return t;\n    }\n\n    /**\n     * Returns `newValue` if it is:\n     *\n     * - not null AND\n     * - not negative AND\n     * - smaller than `newValue`,\n     *\n     * ...otherwise returns `oldValue`.\n     */\n    private static getLesserNonNegativeNonNull(oldValue: number, newValue: number): number {\n        if (newValue !== null && newValue >= 0 && newValue < oldValue) {\n            return newValue;\n        } else {\n            return oldValue;\n        }\n    }\n}\n","import {MercatorCameraHelper} from './mercator_camera_helper.ts';\nimport {VerticalPerspectiveCameraHelper} from './vertical_perspective_camera_helper.ts';\n\nimport type Point from '@mapbox/point-geometry';\nimport type {CameraForBoxAndBearingHandlerResult, EaseToHandlerResult, EaseToHandlerOptions, FlyToHandlerResult, FlyToHandlerOptions, ICameraHelper, MapControlsDeltas} from './camera_helper.ts';\nimport type {LngLat, LngLatLike} from '../lng_lat.ts';\nimport type {IReadonlyTransform, ITransform} from '../transform_interface.ts';\nimport type {GlobeProjection} from './globe_projection.ts';\nimport type {CameraForBoundsOptions} from '../../ui/camera.ts';\nimport type {LngLatBounds} from '../lng_lat_bounds.ts';\nimport type {PaddingOptions} from '../edge_insets.ts';\n\n/**\n * @internal\n */\nexport class GlobeCameraHelper implements ICameraHelper {\n    private _globe: GlobeProjection;\n    private _mercatorCameraHelper: MercatorCameraHelper;\n    private _verticalPerspectiveCameraHelper: VerticalPerspectiveCameraHelper;\n\n    constructor(globe: GlobeProjection) {\n        this._globe = globe;\n        this._mercatorCameraHelper = new MercatorCameraHelper();\n        this._verticalPerspectiveCameraHelper = new VerticalPerspectiveCameraHelper();\n    }\n\n    get useGlobeControls(): boolean { return this._globe.useGlobeRendering; }\n\n    get currentHelper(): ICameraHelper {\n        return this.useGlobeControls ? this._verticalPerspectiveCameraHelper : this._mercatorCameraHelper;\n    }\n\n    handlePanInertia(pan: Point, transform: IReadonlyTransform): {\n        easingCenter: LngLat;\n        easingOffset: Point;\n    } {\n        return this.currentHelper.handlePanInertia(pan, transform);\n    }\n\n    handleMapControlsRollPitchBearingZoom(deltas: MapControlsDeltas, tr: ITransform): void {\n        this.currentHelper.handleMapControlsRollPitchBearingZoom(deltas, tr);\n    }\n\n    handleMapControlsPan(deltas: MapControlsDeltas, tr: ITransform, preZoomAroundLoc: LngLat): void {\n        this.currentHelper.handleMapControlsPan(deltas, tr, preZoomAroundLoc);\n    }\n\n    cameraForBoxAndBearing(options: CameraForBoundsOptions, padding: PaddingOptions, bounds: LngLatBounds, bearing: number, tr: ITransform): CameraForBoxAndBearingHandlerResult {\n        return this.currentHelper.cameraForBoxAndBearing(options, padding, bounds, bearing, tr);\n    }\n\n    /**\n     * Handles the zoom and center change during camera jumpTo.\n     */\n    handleJumpToCenterZoom(tr: ITransform, options: { zoom?: number; center?: LngLatLike }): void {\n        this.currentHelper.handleJumpToCenterZoom(tr, options);\n    }\n\n    handleEaseTo(tr: ITransform, options: EaseToHandlerOptions): EaseToHandlerResult {\n        return this.currentHelper.handleEaseTo(tr, options);\n    }\n\n    handleFlyTo(tr: ITransform, options: FlyToHandlerOptions): FlyToHandlerResult {\n        return this.currentHelper.handleFlyTo(tr, options);\n    }\n}","import {warnOnce} from '../../util/util.ts';\nimport {MercatorProjection} from './mercator_projection.ts';\nimport {MercatorTransform} from './mercator_transform.ts';\nimport {MercatorCameraHelper} from './mercator_camera_helper.ts';\nimport {GlobeProjection} from './globe_projection.ts';\nimport {GlobeTransform} from './globe_transform.ts';\nimport {GlobeCameraHelper} from './globe_camera_helper.ts';\nimport {VerticalPerspectiveCameraHelper} from './vertical_perspective_camera_helper.ts';\nimport {VerticalPerspectiveTransform} from './vertical_perspective_transform.ts';\nimport {VerticalPerspectiveProjection} from './vertical_perspective_projection.ts';\n\nimport type {ProjectionSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {Projection} from './projection.ts';\nimport type {ITransform, TransformConstrainFunction} from '../transform_interface.ts';\nimport type {ICameraHelper} from './camera_helper.ts';\n\nexport function createProjectionFromName(name: ProjectionSpecification['type'], transformConstrain: TransformConstrainFunction | undefined, globalState: Record<string, any>): {\n    projection: Projection;\n    transform: ITransform;\n    cameraHelper: ICameraHelper;\n} {\n    const transformOptions = {constrainOverride: transformConstrain};\n    if (Array.isArray(name)) {\n        const globeProjection = new GlobeProjection({type: name}, globalState);\n        return {\n            projection: globeProjection,\n            transform: new GlobeTransform(transformOptions),\n            cameraHelper: new GlobeCameraHelper(globeProjection),\n        };\n    }\n    switch (name) {\n        case 'mercator':\n        {\n            return {\n                projection: new MercatorProjection(),\n                transform: new MercatorTransform(transformOptions),\n                cameraHelper: new MercatorCameraHelper(),\n            };\n        }\n        case 'globe':\n        {\n            const globeProjection = new GlobeProjection({type: [\n                'interpolate',\n                ['linear'],\n                ['zoom'],\n                11,\n                'vertical-perspective',\n                12,\n                'mercator'\n            ]}, {});\n            return {\n                projection: globeProjection,\n                transform: new GlobeTransform(transformOptions),\n                cameraHelper: new GlobeCameraHelper(globeProjection),\n            };\n        }\n        case 'vertical-perspective':\n        {\n            return {\n                projection: new VerticalPerspectiveProjection(),\n                transform: new VerticalPerspectiveTransform(transformOptions),\n                cameraHelper: new VerticalPerspectiveCameraHelper(),\n            };\n        }\n        default:\n        {\n            warnOnce(`Unknown projection name: ${name}. Falling back to mercator projection.`);\n            return {\n                projection: new MercatorProjection(),\n                transform: new MercatorTransform(transformOptions),\n                cameraHelper: new MercatorCameraHelper(),\n            };\n        }\n    }\n}\n","import {throwIfAborted} from '../util/abort_error.ts';\nimport {ErrorEvent, Evented} from '../util/evented.ts';\nimport {MapSourceDataEvent, MapStyleDataEvent, MapStyleLoadEvent, type MapEventType} from '../ui/events.ts';\nimport {isRasterStyleLayer} from './style_layer/raster_style_layer.ts';\nimport {createStyleLayer} from './create_style_layer.ts';\nimport {loadSprite} from './load_sprite.ts';\nimport {ImageManager, type MissingImageRequestHandler} from '../render/image_manager.ts';\nimport {GlyphManager} from '../render/glyph_manager.ts';\nimport {Light} from './light.ts';\nimport {Sky} from './sky.ts';\nimport {LineAtlas} from '../render/line_atlas.ts';\nimport {clone, ensureError, extend, deepEqual, filterObject, mapObject} from '../util/util.ts';\nimport {coerceSpriteToArray} from '../util/style.ts';\nimport {getJSON, getReferrer} from '../util/ajax.ts';\nimport {ResourceType} from '../util/request_manager.ts';\nimport {browser} from '../util/browser.ts';\nimport {now} from '../util/time_control.ts';\nimport {Dispatcher} from '../util/dispatcher.ts';\nimport {validateStyle, validateStyleAndEmit, validateAndEmit, emitValidationErrors, SPEC_SOURCE_TYPES} from './validate_style.ts';\nimport {type QueryRenderedFeaturesOptions, type QueryRenderedFeaturesOptionsStrict, type QueryRenderedFeaturesResults, type QueryRenderedFeaturesResultsItem, type QuerySourceFeatureOptions, queryRenderedFeatures, queryRenderedSymbols, querySourceFeatures} from '../source/query_features.ts';\nimport {TileManager} from '../tile/tile_manager.ts';\nimport {derefLayers, emptyStyle, diff as diffStyles, type DiffCommand} from '@maplibre/maplibre-gl-style-spec';\nimport {getGlobalWorkerPool} from '../util/global_worker_pool.ts';\nimport {rtlMainThreadPluginFactory} from '../source/rtl_text_plugin_main_thread.ts';\nimport {RTLPluginLoadedEventName} from '../source/rtl_text_plugin_status.ts';\nimport {PauseablePlacement} from './pauseable_placement.ts';\nimport {ZoomHistory} from './zoom_history.ts';\nimport {CrossTileSymbolIndex} from '../symbol/cross_tile_symbol_index.ts';\nimport {validateCustomStyleLayer} from './style_layer/custom_style_layer.ts';\n\nimport type {Source} from '../source/source.ts';\nimport type {GeoJSONSource} from '../source/geojson_source.ts';\nimport type {StyleLayer} from './style_layer.ts';\nimport type {MapGeoJSONFeature, GeoJSONFeature} from '../util/vectortile_to_geojson.ts';\nimport type Point from '@mapbox/point-geometry';\n\nimport type {Map} from '../ui/map.ts';\nimport type {IReadonlyTransform, ITransform} from '../geo/transform_interface.ts';\nimport type {StyleImage} from './style_image.ts';\nimport type {EvaluationParameters} from './evaluation_parameters.ts';\nimport type {Placement} from '../symbol/placement.ts';\nimport type {\n    LayerSpecification,\n    FilterSpecification,\n    StyleSpecification,\n    LightSpecification,\n    SourceSpecification,\n    SpriteSpecification,\n    DiffOperations,\n    ProjectionSpecification,\n    SkySpecification,\n    StateSpecification,\n    AllPaintProperties,\n    AllLayoutProperties,\n    FeatureState,\n    TransitionSpecification,\n} from '@maplibre/maplibre-gl-style-spec';\nimport type {CanvasSourceSpecification} from '../source/canvas_source.ts';\nimport type {CustomLayerInterface} from './style_layer/custom_style_layer.ts';\nimport type {Validator} from './validate_style.ts';\nimport {\n    type GetDashesParameters,\n    type GetDashesResponse,\n    MessageType,\n    type GetGlyphsParameters,\n    type GetGlyphsResponse,\n    type GetImagesParameters,\n    type GetImagesResponse\n} from '../util/actor_messages.ts';\nimport {type Projection} from '../geo/projection/projection.ts';\nimport {createProjectionFromName} from '../geo/projection/projection_factory.ts';\nimport type {OverscaledTileID} from '../tile/tile_id.ts';\n\nconst empty = emptyStyle();\n/**\n * A feature identifier that is bound to a source\n */\nexport type FeatureIdentifier = {\n    /**\n     * Unique id of the feature.\n     */\n    id?: string | number | undefined;\n    /**\n     * The id of the vector or GeoJSON source for the feature.\n     */\n    source: string;\n    /**\n     * *For vector tile sources, `sourceLayer` is required.*\n     */\n    sourceLayer?: string | undefined;\n};\n\n/**\n * The options object related to the {@link Map}'s style related methods\n */\nexport type StyleOptions = {\n    /**\n     * If false, style validation will be skipped. Useful in production environment.\n     */\n    validate?: boolean;\n    /**\n     * Defines a CSS\n     * font-family for locally overriding generation of Chinese, Japanese, and Korean characters.\n     * For these characters, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).\n     * Set to `false`, to enable font settings from the map's style for these glyph ranges.\n     * Forces a full update.\n     */\n    localIdeographFontFamily?: string | false;\n};\n\n/**\n * Supporting type to add validation to another style related type\n */\nexport type StyleSetterOptions = {\n    /**\n     * Whether to check if the filter conforms to the MapLibre Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n     */\n    validate?: boolean;\n};\n\n/**\n * Part of {@link Map.setStyle} options, transformStyle is a convenience function that allows to modify a style after it is fetched but before it is committed to the map state.\n *\n * This function exposes previous and next styles, it can be commonly used to support a range of functionalities like:\n *\n * - when previous style carries certain 'state' that needs to be carried over to a new style gracefully;\n * - when a desired style is a certain combination of previous and incoming style;\n * - when an incoming style requires modification based on external state.\n * - when an incoming style uses relative paths, which need to be converted to absolute.\n *\n * @param previous - The current style.\n * @param next - The next style.\n * @returns resulting style that will to be applied to the map\n *\n * @example\n * ```ts\n * map.setStyle('https://demotiles.maplibre.org/style.json', {\n *   transformStyle: (previousStyle, nextStyle) => ({\n *       ...nextStyle,\n *       // make relative sprite path like \"../sprite\" absolute\n *       sprite: new URL(nextStyle.sprite, \"https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprites/\").href,\n *       // make relative glyphs path like \"../fonts/{fontstack}/{range}.pbf\" absolute\n *       glyphs: new URL(nextStyle.glyphs, \"https://demotiles.maplibre.org/font/\").href,\n *       sources: {\n *           // make relative vector url like \"../../\" absolute\n *           ...nextStyle.sources.map(source => {\n *              if (source.url) {\n *                  source.url = new URL(source.url, \"https://tiles.openfreemap.org/planet\");\n *              }\n *              return source;\n *           }),\n *           // copy a source from previous style\n *           'osm': previousStyle.sources.osm\n *       },\n *       layers: [\n *           // background layer\n *           nextStyle.layers[0],\n *           // copy a layer from previous style\n *           previousStyle.layers[0],\n *           // other layers from the next style\n *           ...nextStyle.layers.slice(1).map(layer => {\n *               // hide the layers we don't need from demotiles style\n *               if (layer.id.startsWith('geolines')) {\n *                   layer.layout = {...layer.layout || {}, visibility: 'none'};\n *               // filter out US polygons\n *               } else if (layer.id.startsWith('coastline') || layer.id.startsWith('countries')) {\n *                   layer.filter = ['!=', ['get', 'ADM0_A3'], 'USA'];\n *               }\n *               return layer;\n *           })\n *       ]\n *   })\n * });\n * ```\n */\nexport type TransformStyleFunction = (previous: StyleSpecification | undefined, next: StyleSpecification) => StyleSpecification;\n\n/**\n * The options object related to the {@link Map}'s style related methods\n */\nexport type StyleSwapOptions = {\n    /**\n     * If false, force a 'full' update, removing the current style\n     * and building the given one instead of attempting a diff-based update.\n     */\n    diff?: boolean;\n    /**\n     * TransformStyleFunction is a convenience function\n     * that allows to modify a style after it is fetched but before it is committed to the map state. Refer to {@link TransformStyleFunction}.\n     */\n    transformStyle?: TransformStyleFunction;\n};\n\n/**\n * Specifies a layer to be added to a {@link Style}. In addition to a standard {@link LayerSpecification}\n * or a {@link CustomLayerInterface}, a {@link LayerSpecification} with an embedded {@link SourceSpecification} can also be provided.\n */\nexport type AddLayerObject = LayerSpecification | (Omit<LayerSpecification, 'source'> & {source: SourceSpecification}) | CustomLayerInterface;\n\n/**\n * The Style base class\n */\nexport class Style extends Evented<MapEventType> {\n    map: Map;\n    stylesheet: StyleSpecification;\n    dispatcher: Dispatcher;\n    imageManager: ImageManager;\n    glyphManager: GlyphManager;\n    lineAtlas: LineAtlas;\n    light: Light;\n    projection: Projection | undefined;\n    sky: Sky;\n\n    _frameRequest: AbortController;\n    _loadStyleRequest: AbortController;\n    _spriteRequest: AbortController;\n    _layers: {[_: string]: StyleLayer};\n    _serializedLayers: {[_: string]: LayerSpecification};\n    _order: string[];\n    tileManagers: {[_: string]: TileManager};\n    zoomHistory: ZoomHistory;\n    _loaded: boolean;\n    _changed: boolean;\n    _updatedSources: {[_: string]: 'clear' | 'reload'};\n    _updatedLayers: {[_: string]: true};\n    _removedLayers: {[_: string]: StyleLayer};\n    _changedImages: {[_: string]: true};\n    _imagesListDirty: boolean;\n    _glyphsDidChange: boolean;\n    _updatedPaintProps: {[layer: string]: true};\n    _layerOrderChanged: boolean;\n    // image ids of images loaded from style's sprite\n    _spritesImagesIds: {[spriteId: string]: string[]};\n    // image ids of all images loaded (sprite + user)\n    _availableImages: string[];\n    _globalState: Record<string, any>;\n    crossTileSymbolIndex: CrossTileSymbolIndex;\n    pauseablePlacement: PauseablePlacement;\n    placement: Placement;\n    z: number;\n\n    constructor(map: Map, options: StyleOptions = {}) {\n        super();\n\n        this.map = map;\n        this.dispatcher = new Dispatcher(getGlobalWorkerPool(), map._getMapId());\n        this.dispatcher.registerMessageHandler(MessageType.getGlyphs, (mapId, params) => {\n            return this.getGlyphs(mapId, params);\n        });\n        this.dispatcher.registerMessageHandler(MessageType.getImages, (mapId, params) => {\n            return this.getImages(mapId, params);\n        });\n        this.dispatcher.registerMessageHandler(MessageType.getDashes, (mapId, params) => {\n            return this.getDashes(mapId, params);\n        });\n        this.imageManager = new ImageManager();\n        this.imageManager.setEventedParent(this);\n        this.imageManager.setMissingImageResolver(map._missingStyleImageResolver);\n        const glyphLang = map._container?.lang || (typeof document !== 'undefined' && document.documentElement?.lang) || undefined;\n        this.glyphManager = new GlyphManager(map._requestManager, options.localIdeographFontFamily, glyphLang);\n        this.lineAtlas = new LineAtlas(256, 512);\n        this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n\n        this._setInitialValues();\n\n        this._resetUpdates();\n\n        this.dispatcher.broadcast(MessageType.setReferrer, getReferrer());\n        rtlMainThreadPluginFactory().on(RTLPluginLoadedEventName, this._rtlPluginLoaded);\n\n        this.on('data', (event) => {\n            if (event.dataType !== 'source' || event.sourceDataType !== 'metadata') {\n                return;\n            }\n\n            const tileManager = this.tileManagers[event.sourceId];\n            if (!tileManager) {\n                return;\n            }\n\n            const source = tileManager.getSource();\n            if (!source?.vectorLayerIds) {\n                return;\n            }\n\n            for (const layerId in this._layers) {\n                const layer = this._layers[layerId];\n                if (layer.source === source.id) {\n                    this._validateLayer(layer);\n                }\n            }\n        });\n    }\n\n    private _setInitialValues() {\n        this._spritesImagesIds = {};\n        this._layers = {};\n        this._order = [];\n        this.tileManagers = {};\n        this.zoomHistory = new ZoomHistory();\n        this._availableImages = [];\n        this._imagesListDirty = false;\n        this._globalState = {};\n        this._serializedLayers = {};\n        this.stylesheet = null;\n        this.light = null;\n        this.sky = null;\n        if (this.projection) {\n            this.projection.destroy();\n            delete this.projection;\n        }\n        this._loaded = false;\n        this._changed = false;\n        this._updatedLayers = {};\n        this._updatedSources = {};\n        this._changedImages = {};\n        this._glyphsDidChange = false;\n        this._updatedPaintProps = {};\n        this._layerOrderChanged = false;\n        this.crossTileSymbolIndex = new (this.crossTileSymbolIndex?.constructor || Object)();\n        this.pauseablePlacement = undefined;\n        this.placement = undefined;\n        this.z = 0;\n    }\n\n    _rtlPluginLoaded: () => void = () => {\n        for (const id in this.tileManagers) {\n            const sourceType = this.tileManagers[id].getSource().type;\n            if (sourceType === 'vector' || sourceType === 'geojson') {\n                // Non-vector sources don't have any symbols buckets to reload when the RTL text plugin loads\n                // They also load more quickly, so they're more likely to have already displaying tiles\n                // that would be unnecessarily booted by the plugin load event\n                this.tileManagers[id].reload(); // Should be a no-op if the plugin loads before any tiles load\n            }\n        }\n    };\n\n    setGlobalStateProperty(name: string, value: any): this {\n        this._checkLoaded();\n\n        const newValue = value === null ?\n            this.stylesheet.state?.[name]?.default ?? null :\n            value;\n\n        if (deepEqual(newValue, this._globalState[name])) {\n            return this;\n        }\n\n        this._globalState[name] = newValue;\n\n        this._applyGlobalStateChanges([name]);\n    }\n\n    getGlobalState(): Record<string, any> {\n        return this._globalState;\n    }\n\n    setGlobalState(newStylesheetState: StateSpecification): void {\n        this._checkLoaded();\n\n        const changedGlobalStateRefs = [];\n\n        for (const propertyName in newStylesheetState) {\n            const didChange = !deepEqual(this._globalState[propertyName], newStylesheetState[propertyName].default);\n\n            if (didChange) {\n                changedGlobalStateRefs.push(propertyName);\n                this._globalState[propertyName] = newStylesheetState[propertyName].default;\n            }\n        }\n\n        this._applyGlobalStateChanges(changedGlobalStateRefs);\n    }\n\n    /**\n     * @internal\n     * Find all sources that are affected by the global state changes and reload them.\n     * Find all paint properties that are affected by the global state changes and update them.\n     * For example, if a layer filter uses global-state expression, this function will find the source id of that layer.\n     */\n    _applyGlobalStateChanges(globalStateRefs: string[]): void {\n        if (globalStateRefs.length === 0) {\n            return;\n        }\n\n        const sourceIdsToReload = new Set<string>();\n        const globalStateChange = {};\n\n        for (const ref of globalStateRefs) {\n            globalStateChange[ref] = this._globalState[ref];\n\n            for (const layerId in this._layers) {\n                const layer = this._layers[layerId];\n                const layoutAffectingGlobalStateRefs = layer.getLayoutAffectingGlobalStateRefs();\n                const paintAffectingGlobalStateRefs = layer.getPaintAffectingGlobalStateRefs();\n                const visibilityAffectingGlobalStateRefs = layer.getVisibilityAffectingGlobalStateRefs();\n\n                if (layoutAffectingGlobalStateRefs.has(ref)) {\n                    sourceIdsToReload.add(layer.source);\n                }\n                if (paintAffectingGlobalStateRefs.has(ref)) {\n                    for (const {name, value} of paintAffectingGlobalStateRefs.get(ref)) {\n                        this._updatePaintProperty(layer, name, value);\n                    }\n                }\n                if (visibilityAffectingGlobalStateRefs?.has(ref)) {\n                    layer.recalculateVisibility();\n                    this._updateLayer(layer);\n                }\n            }\n        }\n\n        // Propagate global state changes to workers\n        this.dispatcher.broadcast(MessageType.updateGlobalState, globalStateChange);\n\n        for (const id in this.tileManagers) {\n            if (sourceIdsToReload.has(id)) {\n                this._reloadSource(id);\n                this._changed = true;\n            }\n        }\n    }\n\n    async loadURL(url: string, options: StyleSwapOptions & StyleSetterOptions = {}, previousStyle?: StyleSpecification): Promise<void> {\n        this.fire(new MapStyleDataEvent('dataloading'));\n\n        options.validate = typeof options.validate === 'boolean' ?\n            options.validate : true;\n\n        this._loadStyleRequest = new AbortController();\n        const abortController = this._loadStyleRequest;\n        try {\n            const request = await this.map._requestManager.transformRequest(url, ResourceType.Style);\n            throwIfAborted(abortController.signal);\n\n            const response = await getJSON<StyleSpecification>(request, abortController);\n            if (this._loadStyleRequest === abortController) {\n                // Clear this request only if it is still the active style load. A stale\n                // request can finish after a newer loadURL() call has already installed\n                // another controller, and must not clear that newer abort handle.\n                this._loadStyleRequest = null;\n            }\n            this._load(response.data, options, previousStyle);\n        } catch (error) {\n            if (this._loadStyleRequest === abortController) {\n                this._loadStyleRequest = null;\n            }\n            if (error && !abortController.signal.aborted) { // ignore abort\n                this.fire(new ErrorEvent(ensureError(error)));\n            }\n        }\n    }\n\n    loadJSON(json: StyleSpecification, options: StyleSetterOptions & StyleSwapOptions = {}, previousStyle?: StyleSpecification): void {\n        this.fire(new MapStyleDataEvent('dataloading'));\n\n        this._frameRequest = new AbortController();\n        browser.frameAsync(this._frameRequest, this.map._ownerWindow).then(() => {\n            this._frameRequest = null;\n            options.validate = options.validate !== false;\n            this._load(json, options, previousStyle);\n        }).catch(() => {}); // ignore abort\n    }\n\n    loadEmpty(): void {\n        this.fire(new MapStyleDataEvent('dataloading'));\n        this._load(empty, {validate: false});\n    }\n\n    _load(json: StyleSpecification, options: StyleSwapOptions & StyleSetterOptions, previousStyle?: StyleSpecification): void {\n        let nextState = options.transformStyle ? options.transformStyle(previousStyle, json) : json;\n        if (options.validate && validateStyleAndEmit(this, nextState)) {\n            return;\n        }\n\n        nextState = {...nextState};\n\n        this._loaded = true;\n        this.stylesheet = nextState;\n\n        for (const id in nextState.sources) {\n            this.addSource(id, nextState.sources[id], {validate: false});\n        }\n\n        if (nextState.sprite) {\n            this._loadSprite(nextState.sprite);\n        } else {\n            this.imageManager.setLoaded(true);\n        }\n\n        this.glyphManager.setURL(nextState.glyphs);\n        this._createLayers();\n\n        this.light = new Light(this.stylesheet.light ?? {}, this._globalState);\n        this._setProjectionInternal(this.stylesheet.projection?.type || 'mercator');\n\n        this.sky = new Sky(this.stylesheet.sky, this._globalState);\n\n        // The stylesheet's terrain was already validated as part of the style itself.\n        this.map.setTerrain(this.stylesheet.terrain ?? null, {validate: false});\n\n        this.fire(new MapStyleDataEvent('data'));\n        this.fire(new MapStyleLoadEvent());\n    }\n\n    private _createLayers() {\n        const dereferencedLayers = derefLayers(this.stylesheet.layers);\n\n        this.setGlobalState(this.stylesheet.state ?? null);\n\n        // Broadcast layers to workers first, so that expensive style processing (createStyleLayer)\n        // can happen in parallel on both main and worker threads.\n        this.dispatcher.broadcast(MessageType.setLayers, dereferencedLayers);\n\n        this._order = dereferencedLayers.map((layer) => layer.id);\n        this._layers = {};\n\n        // reset serialization field, to be populated only when needed\n        this._serializedLayers = null;\n        for (const layer of dereferencedLayers) {\n            const styledLayer = createStyleLayer(layer, this._globalState);\n            styledLayer.setEventedParent(this, {layer: {id: layer.id}});\n            this._layers[layer.id] = styledLayer;\n\n            if (isRasterStyleLayer(styledLayer) && this.tileManagers[styledLayer.source]) {\n                const rasterFadeDuration = layer.paint?.['raster-fade-duration'] ?? styledLayer.paint.get('raster-fade-duration');\n                this.tileManagers[styledLayer.source].setRasterFadeDuration(rasterFadeDuration);\n            }\n        }\n    }\n\n    _loadSprite(sprite: SpriteSpecification, isUpdate: boolean = false, completion: (err: Error) => void = undefined): void {\n        this.imageManager.setLoaded(false);\n\n        const abortController = new AbortController();\n        this._spriteRequest = abortController;\n        let err: Error;\n        loadSprite(sprite, this.map._requestManager, this.map.getPixelRatio(), this._spriteRequest).then((images) => {\n            this._spriteRequest = null;\n            if (images) {\n                for (const spriteId in images) {\n                    this._spritesImagesIds[spriteId] = [];\n\n                    // remove old sprite's loaded images (for the same sprite id) that are not in new sprite\n                    const imagesToRemove = this._spritesImagesIds[spriteId] ? this._spritesImagesIds[spriteId].filter(id => !(id in images)) : [];\n                    for (const id of imagesToRemove) {\n                        this.imageManager.removeImage(id);\n                        this._changedImages[id] = true;\n                    }\n\n                    for (const id in images[spriteId]) {\n                        // don't prefix images of the \"default\" sprite\n                        const imageId = spriteId === 'default' ? id : `${spriteId}:${id}`;\n                        // save all the sprite's images' ids to be able to delete them in `removeSprite`\n                        this._spritesImagesIds[spriteId].push(imageId);\n                        if (imageId in this.imageManager.images) {\n                            this.imageManager.updateImage(imageId, images[spriteId][id], false);\n                        } else {\n                            this.imageManager.addImage(imageId, images[spriteId][id]);\n                        }\n\n                        if (isUpdate) {\n                            this._changedImages[imageId] = true;\n                        }\n                    }\n                }\n            }\n        }).catch((error) => {\n            this._spriteRequest = null;\n            err = error;\n            if (!abortController.signal.aborted) { // ignore abort\n                this.fire(new ErrorEvent(err));\n            }\n        }).finally(() => {\n            this.imageManager.setLoaded(true);\n            this._availableImages = this.imageManager.listImages();\n\n            if (isUpdate) {\n                this._changed = true;\n            }\n\n            this.dispatcher.broadcast(MessageType.setImages, this._availableImages);\n            this.fire(new MapStyleDataEvent('data'));\n\n            if (completion) {\n                completion(err);\n            }\n        });\n    }\n\n    _unloadSprite(): void {\n        for (const id of Object.values(this._spritesImagesIds).flat()) {\n            this.imageManager.removeImage(id);\n            this._changedImages[id] = true;\n        }\n\n        this._spritesImagesIds = {};\n        this._availableImages = this.imageManager.listImages();\n        this._imagesListDirty = true;\n        this._changed = true;\n        this.fire(new MapStyleDataEvent('data'));\n    }\n\n    _validateLayer(layer: StyleLayer): void {\n        const tileManager = this.tileManagers[layer.source];\n        if (!tileManager) {\n            return;\n        }\n\n        const sourceLayer = layer.sourceLayer;\n        if (!sourceLayer) {\n            return;\n        }\n\n        const source = tileManager.getSource();\n        if (source.type === 'geojson' || (source.vectorLayerIds && !source.vectorLayerIds.includes(sourceLayer))) {\n            this.fire(new ErrorEvent(new Error(\n                `Source layer \"${sourceLayer}\" ` +\n                `does not exist on source \"${source.id}\" ` +\n                `as specified by style layer \"${layer.id}\".`\n            )));\n        }\n    }\n\n    loaded(): boolean {\n        if (!this._loaded)\n            return false;\n\n        if (Object.keys(this._updatedSources).length)\n            return false;\n\n        for (const id in this.tileManagers)\n            if (!this.tileManagers[id].loaded())\n                return false;\n\n        return this.imageManager.isLoaded();\n    }\n\n    /**\n     * @hidden\n     * take an array of string IDs, and based on this._layers, generate an array of LayerSpecification\n     * @param ids - an array of string IDs, for which serialized layers will be generated. If omitted, all serialized layers will be returned\n     * @param returnClone - if true, return a clone of the layer object\n     * @returns generated result\n     */\n    private _serializeByIds(ids: string[], returnClone: boolean = false): LayerSpecification[] {\n\n        const serializedLayersDictionary = this._serializedAllLayers();\n        if (!ids || ids.length === 0) {\n            return returnClone ? Object.values(clone(serializedLayersDictionary)) : Object.values(serializedLayersDictionary);\n        }\n\n        const serializedLayers = [];\n        for (const id of ids) {\n            // this check will skip all custom layers\n            if (serializedLayersDictionary[id]) {\n                const toPush = returnClone ? clone(serializedLayersDictionary[id]) : serializedLayersDictionary[id];\n                serializedLayers.push(toPush);\n            }\n        }\n\n        return serializedLayers;\n    }\n\n    /**\n     * @hidden\n     * Lazy initialization of this._serializedLayers dictionary and return it\n     * @returns this._serializedLayers dictionary\n     */\n    private _serializedAllLayers(): {[_: string]: LayerSpecification} {\n        let serializedLayers = this._serializedLayers;\n        if (serializedLayers) {\n            return serializedLayers;\n        }\n\n        serializedLayers = this._serializedLayers = {};\n        const allLayerIds: string [] = Object.keys(this._layers);\n        for (const layerId of allLayerIds) {\n            const layer = this._layers[layerId];\n            if (layer.type !== 'custom') {\n                serializedLayers[layerId] = layer.serialize();\n            }\n        }\n\n        return serializedLayers;\n    }\n\n    hasTransitions(): boolean {\n        if (this.light?.hasTransition()) {\n            return true;\n        }\n\n        if (this.sky?.hasTransition()) {\n            return true;\n        }\n\n        if (this.projection?.hasTransition()) {\n            return true;\n        }\n\n        for (const id in this.tileManagers) {\n            if (this.tileManagers[id].hasTransition()) {\n                return true;\n            }\n        }\n\n        for (const id in this._layers) {\n            if (this._layers[id].hasTransition()) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    _checkLoaded(): void {\n        if (!this._loaded) {\n            throw new Error('Style is not done loading.');\n        }\n    }\n\n    /**\n     * @internal\n     * Apply queued style updates in a batch and recalculate zoom-dependent paint properties.\n     */\n    update(parameters: EvaluationParameters): void {\n        if (!this._loaded) {\n            return;\n        }\n\n        const changed = this._changed;\n        if (changed) {\n            if (this._imagesListDirty) {\n                this.dispatcher.broadcast(MessageType.setImages, this._availableImages);\n                this._imagesListDirty = false;\n            }\n\n            const updatedIds = Object.keys(this._updatedLayers);\n            const removedIds = Object.keys(this._removedLayers);\n\n            if (updatedIds.length || removedIds.length) {\n                this._updateWorkerLayers(updatedIds, removedIds);\n            }\n            for (const id in this._updatedSources) {\n                const action = this._updatedSources[id];\n\n                if (action === 'reload') {\n                    this._reloadSource(id);\n                } else if (action === 'clear') {\n                    this._clearSource(id);\n                } else {\n                    throw new Error(`Invalid action ${action}`);\n                }\n            }\n\n            this._updateTilesForChangedImages();\n            this._updateTilesForChangedGlyphs();\n\n            for (const id in this._updatedPaintProps) {\n                this._layers[id].updateTransitions(parameters);\n            }\n\n            this.light.updateTransitions(parameters);\n            this.sky.updateTransitions(parameters);\n\n            this._resetUpdates();\n        }\n\n        const managersUsedBefore = {};\n\n        // save 'used' status to managersUsedBefore object and reset all tileManagers 'used' field to false\n        for (const id in this.tileManagers) {\n            const tileManager = this.tileManagers[id];\n\n            // tileManager.used could be undefined, and managersUsedBefore[id] is also 'undefined'\n            managersUsedBefore[id] = tileManager.used;\n            tileManager.used = false;\n        }\n\n        // loop all layers and find layers that are not hidden at parameters.zoom\n        // and set used to true in tileManagers dictionary for the sources of these layers\n        for (const layerId of this._order) {\n            const layer = this._layers[layerId];\n\n            layer.recalculate(parameters, this._availableImages);\n            if (!layer.isHidden(parameters.zoom) && layer.source) {\n                this.tileManagers[layer.source].used = true;\n            }\n        }\n\n        // cross check managersUsedBefore against updated this.tileManagers dictionary\n        // if \"used\" field is different fire visibility event\n        for (const id in managersUsedBefore) {\n            const tileManager = this.tileManagers[id];\n\n            // (undefine !== false) will evaluate to true and fire an useless visibility event\n            // need force \"falsy\" values to boolean to avoid the case above\n            if (!!managersUsedBefore[id] !== !!tileManager.used) {\n                tileManager.fire(new MapSourceDataEvent('data',\n                    {\n                        sourceDataType: 'visibility',\n                        sourceId: id\n                    }));\n            }\n        }\n\n        this.light.recalculate(parameters);\n        this.sky.recalculate(parameters);\n        this.projection.recalculate(parameters);\n        this.z = parameters.zoom;\n\n        if (changed) {\n            this.fire(new MapStyleDataEvent('data'));\n        }\n    }\n\n    /*\n     * Apply any queued image changes.\n     */\n    _updateTilesForChangedImages(): void {\n        const changedImages = Object.keys(this._changedImages);\n        if (changedImages.length) {\n            for (const name in this.tileManagers) {\n                this.tileManagers[name].reloadTilesForDependencies(['icons', 'patterns'], changedImages);\n            }\n            this._changedImages = {};\n        }\n    }\n\n    _updateTilesForChangedGlyphs(): void {\n        if (this._glyphsDidChange) {\n            for (const name in this.tileManagers) {\n                this.tileManagers[name].reloadTilesForDependencies(['glyphs'], ['']);\n            }\n            this._glyphsDidChange = false;\n        }\n    }\n\n    _updateWorkerLayers(updatedIds: string[], removedIds: string[]): void {\n        this.dispatcher.broadcast(MessageType.updateLayers, {\n            layers: this._serializeByIds(updatedIds, false),\n            removedIds\n        });\n    }\n\n    _resetUpdates(): void {\n        this._changed = false;\n\n        this._updatedLayers = {};\n        this._removedLayers = {};\n\n        this._updatedSources = {};\n        this._updatedPaintProps = {};\n\n        this._changedImages = {};\n        this._glyphsDidChange = false;\n    }\n\n    /**\n     * Update this style's state to match the given style JSON, performing only\n     * the necessary mutations.\n     *\n     * May throw an Error ('Unimplemented: METHOD') if the maplibre-gl-style-spec\n     * diff algorithm produces an operation that is not supported.\n     *\n     * @returns true if any changes were made; false otherwise\n     */\n    setState(nextState: StyleSpecification, options: StyleSwapOptions & StyleSetterOptions = {}): boolean {\n        this._checkLoaded();\n\n        const serializedStyle =  this.serialize();\n        nextState = options.transformStyle ? options.transformStyle(serializedStyle, nextState) : nextState;\n        const validate = options.validate ?? true;\n        if (validate && validateStyleAndEmit(this, nextState)) return false;\n\n        nextState = clone(nextState);\n        nextState.layers = derefLayers(nextState.layers);\n\n        const changes = diffStyles(serializedStyle, nextState);\n        const operations = this._getOperationsToPerform(changes);\n\n        if (operations.unimplemented.length > 0) {\n            throw new Error(`Unimplemented: ${operations.unimplemented.join(', ')}.`);\n        }\n\n        if (operations.operations.length === 0) {\n            return false;\n        }\n\n        for (const styleChangeOperation of operations.operations) {\n            styleChangeOperation();\n        }\n\n        this.stylesheet = nextState;\n\n        // reset serialization field, to be populated only when needed\n        this._serializedLayers = null;\n\n        this.fire(new MapStyleLoadEvent({style: this}));\n\n        return true;\n    }\n\n    _getOperationsToPerform(diff: Array<DiffCommand<DiffOperations>>): {operations: Function[]; unimplemented: string[]} {\n        const operations: Function[] = [];\n        const unimplemented: string[] = [];\n        for (const op of diff) {\n            switch (op.command) {\n                case 'setCenter':\n                case 'setZoom':\n                case 'setBearing':\n                case 'setPitch':\n                case 'setRoll':\n                    continue;\n                case 'addLayer':\n                    operations.push(() => this.addLayer.apply(this, op.args));\n                    break;\n                case 'removeLayer':\n                    operations.push(() => this.removeLayer.apply(this, op.args));\n                    break;\n                case 'setPaintProperty':\n                    operations.push(() => this.setPaintProperty.apply(this, op.args));\n                    break;\n                case 'setLayoutProperty':\n                    operations.push(() => this.setLayoutProperty.apply(this, op.args));\n                    break;\n                case 'setFilter':\n                    operations.push(() => this.setFilter.apply(this, op.args));\n                    break;\n                case 'addSource':\n                    operations.push(() => this.addSource.apply(this, op.args));\n                    break;\n                case 'removeSource':\n                    operations.push(() => this.removeSource.apply(this, op.args));\n                    break;\n                case 'setLayerZoomRange':\n                    operations.push(() => this.setLayerZoomRange.apply(this, op.args));\n                    break;\n                case 'setLight':\n                    operations.push(() => this.setLight.apply(this, op.args));\n                    break;\n                case 'setGeoJSONSourceData':\n                    operations.push(() => this.setGeoJSONSourceData.apply(this, op.args));\n                    break;\n                case 'setGlyphs':\n                    operations.push(() => this.setGlyphs.apply(this, op.args));\n                    break;\n                case 'setSprite':\n                    operations.push(() => this.setSprite.apply(this, op.args));\n                    break;\n                case 'setTerrain':\n                    operations.push(() => this.map.setTerrain.apply(this, op.args));\n                    break;\n                case 'setSky':\n                    operations.push(() => this.setSky.apply(this, op.args));\n                    break;\n                case 'setProjection':\n                    this.setProjection.apply(this, op.args);\n                    break;\n                case 'setGlobalState':\n                    operations.push(() => this.setGlobalState.apply(this, op.args));\n                    break;\n                case 'setTransition':\n                    operations.push(() => {});\n                    break;\n                default:\n                    unimplemented.push(op.command);\n                    break;\n            }\n        }\n        const result: {operations: Function[]; unimplemented: string[]} = {\n            operations,\n            unimplemented\n        };\n        return result;\n    }\n\n    addImage(id: string, image: StyleImage): void {\n        if (this.getImage(id)) {\n            this.fire(new ErrorEvent(new Error(`An image named \"${id}\" already exists.`)));\n            return;\n        }\n        this.imageManager.addImage(id, image);\n        this._afterImageUpdated(id);\n    }\n\n    updateImage(id: string, image: StyleImage): void {\n        this.imageManager.updateImage(id, image);\n    }\n\n    getImage(id: string): StyleImage {\n        return this.imageManager.getImage(id);\n    }\n\n    setMissingImageResolver(resolver: MissingImageRequestHandler | null): void {\n        this.imageManager.setMissingImageResolver(resolver);\n    }\n\n    removeImage(id: string): void {\n        if (!this.getImage(id)) {\n            this.fire(new ErrorEvent(new Error(`An image named \"${id}\" does not exist.`)));\n            return;\n        }\n        this.imageManager.removeImage(id);\n        this._afterImageUpdated(id);\n    }\n\n    _afterImageUpdated(id: string): void {\n        this._availableImages = this.imageManager.listImages();\n        this._changedImages[id] = true;\n        this._imagesListDirty = true;\n        this._changed = true;\n        this.fire(new MapStyleDataEvent('data'));\n    }\n\n    listImages(): string[] {\n        this._checkLoaded();\n\n        return this.imageManager.listImages();\n    }\n\n    addSource(id: string, source: SourceSpecification | CanvasSourceSpecification, options: StyleSetterOptions = {}): void {\n        this._checkLoaded();\n\n        if (this.tileManagers[id] !== undefined) {\n            throw new Error(`Source \"${id}\" already exists.`);\n        }\n\n        if (!source.type) {\n            throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(source).join(', ')}.`);\n        }\n\n        const shouldValidate = SPEC_SOURCE_TYPES.has(source.type);\n        if (shouldValidate && this._validate(validateStyle.source, `sources.${id}`, source, null, options)) return;\n        if (this.map?._collectResourceTiming) (source as any).collectResourceTiming = true;\n        const tileManager = this.tileManagers[id] = new TileManager(id, source, this.dispatcher);\n        tileManager.style = this;\n        tileManager.setEventedParent(this, () => ({\n            isSourceLoaded: tileManager.loaded(),\n            source: tileManager.serialize(),\n            sourceId: id\n        }));\n\n        tileManager.onAdd(this.map);\n        this._changed = true;\n    }\n\n    /**\n     * Remove a source from this stylesheet, given its id.\n     * @param id - id of the source to remove\n     * @throws if no source is found with the given ID\n     */\n    removeSource(id: string): this {\n        this._checkLoaded();\n\n        if (this.tileManagers[id] === undefined) {\n            throw new Error(`There is no source with this ID=${id}`);\n        }\n        for (const layerId in this._layers) {\n            if (this._layers[layerId].source === id) {\n                return this.fire(new ErrorEvent(new Error(`Source \"${id}\" cannot be removed while layer \"${layerId}\" is using it.`)));\n            }\n        }\n\n        const tileManager = this.tileManagers[id];\n        delete this.tileManagers[id];\n        delete this._updatedSources[id];\n        tileManager.fire(new MapSourceDataEvent('data', {sourceDataType: 'metadata', sourceId: id}));\n        tileManager.setEventedParent(null);\n        tileManager.onRemove(this.map);\n        this._changed = true;\n    }\n\n    /**\n     * Set the data of a GeoJSON source, given its id.\n     * @param id - id of the source\n     * @param data - GeoJSON source\n     */\n    setGeoJSONSourceData(id: string, data: GeoJSON.GeoJSON | string): void {\n        this._checkLoaded();\n\n        if (this.tileManagers[id] === undefined) throw new Error(`There is no source with this ID=${id}`);\n        const geojsonSource: GeoJSONSource = (this.tileManagers[id].getSource() as any);\n        if (geojsonSource.type !== 'geojson') throw new Error(`geojsonSource.type is ${geojsonSource.type}, which is !== 'geojson`);\n\n        geojsonSource.setData(data);\n        this._changed = true;\n    }\n\n    /**\n     * Get a source by ID.\n     * @param id - ID of the desired source\n     * @returns source\n     */\n    getSource(id: string): Source | undefined {\n        return this.tileManagers[id]?.getSource();\n    }\n\n    /**\n     * Add a layer to the map style. The layer will be inserted before the layer with\n     * ID `before`, or appended if `before` is omitted.\n     * @param layerObject - The style layer to add.\n     * @param before - ID of an existing layer to insert before\n     * @param options - Style setter options.\n     */\n    addLayer(layerObject: AddLayerObject, before?: string, options: StyleSetterOptions = {}): this {\n        this._checkLoaded();\n\n        const id = layerObject.id;\n\n        if (this.getLayer(id)) {\n            this.fire(new ErrorEvent(new Error(`Layer \"${id}\" already exists on this map.`)));\n            return;\n        }\n\n        let layer: ReturnType<typeof createStyleLayer>;\n        if (layerObject.type === 'custom') {\n\n            if (emitValidationErrors(this, validateCustomStyleLayer(layerObject))) return;\n\n            layer = createStyleLayer(layerObject, this._globalState);\n\n        } else {\n            if ('source' in layerObject && typeof layerObject.source === 'object') {\n                this.addSource(id, layerObject.source);\n                layerObject = clone(layerObject);\n                layerObject = extend(layerObject, {source: id});\n            }\n\n            // this layer is not in the style.layers array, so we pass an impossible array index\n            if (this._validate(validateStyle.layer,\n                `layers.${id}`, layerObject, {arrayIndex: -1}, options)) return;\n\n            layer = createStyleLayer(layerObject as LayerSpecification | CustomLayerInterface, this._globalState);\n            this._validateLayer(layer);\n\n            layer.setEventedParent(this, {layer: {id}});\n        }\n\n        const index = before ? this._order.indexOf(before) : this._order.length;\n        if (before && index === -1) {\n            this.fire(new ErrorEvent(new Error(`Cannot add layer \"${id}\" before non-existing layer \"${before}\".`)));\n            return;\n        }\n\n        this._order.splice(index, 0, id);\n        this._layerOrderChanged = true;\n\n        this._layers[id] = layer;\n\n        if (this._removedLayers[id] && layer.source && layer.type !== 'custom') {\n            // If, in the current batch, we have already removed this layer\n            // and we are now re-adding it with a different `type`, then we\n            // need to clear (rather than just reload) the underlying source's\n            // tiles.  Otherwise, tiles marked 'reloading' will have buckets /\n            // buffers that are set up for the _previous_ version of this\n            // layer, causing, e.g.:\n            // https://github.com/mapbox/mapbox-gl-js/issues/3633\n            const removed = this._removedLayers[id];\n            delete this._removedLayers[id];\n            if (removed.type !== layer.type) {\n                this._updatedSources[layer.source] = 'clear';\n            } else {\n                this._updatedSources[layer.source] = 'reload';\n                this.tileManagers[layer.source].pause();\n            }\n        }\n        this._updateLayer(layer);\n\n        if (layer.onAdd) {\n            layer.onAdd(this.map);\n        }\n    }\n\n    /**\n     * Moves a layer to a different z-position. The layer will be inserted before the layer with\n     * ID `before`, or appended if `before` is omitted.\n     * @param id - ID of the layer to move\n     * @param before - ID of an existing layer to insert before\n     */\n    moveLayer(id: string, before?: string): void {\n        this._checkLoaded();\n        this._changed = true;\n\n        const layer = this._layers[id];\n        if (!layer) {\n            this.fire(new ErrorEvent(new Error(`The layer '${id}' does not exist in the map's style and cannot be moved.`)));\n            return;\n        }\n\n        if (id === before) {\n            return;\n        }\n\n        const index = this._order.indexOf(id);\n        this._order.splice(index, 1);\n\n        const newIndex = before ? this._order.indexOf(before) : this._order.length;\n        if (before && newIndex === -1) {\n            this.fire(new ErrorEvent(new Error(`Cannot move layer \"${id}\" before non-existing layer \"${before}\".`)));\n            return;\n        }\n        this._order.splice(newIndex, 0, id);\n\n        this._layerOrderChanged = true;\n    }\n\n    /**\n     * Remove the layer with the given id from the style.\n     * A {@link ErrorEvent} event will be fired if no such layer exists.\n     *\n     * @param id - id of the layer to remove\n     */\n    removeLayer(id: string): void {\n        this._checkLoaded();\n\n        const layer = this._layers[id];\n        if (!layer) {\n            this.fire(new ErrorEvent(new Error(`Cannot remove non-existing layer \"${id}\".`)));\n            return;\n        }\n\n        layer.setEventedParent(null);\n\n        const index = this._order.indexOf(id);\n        this._order.splice(index, 1);\n\n        this._layerOrderChanged = true;\n        this._changed = true;\n        this._removedLayers[id] = layer;\n        delete this._layers[id];\n\n        if (this._serializedLayers) {\n            delete this._serializedLayers[id];\n        }\n        delete this._updatedLayers[id];\n        delete this._updatedPaintProps[id];\n\n        if (layer.onRemove) {\n            layer.onRemove(this.map);\n        }\n    }\n\n    /**\n     * Return the style layer object with the given `id`.\n     *\n     * @param id - id of the desired layer\n     * @returns a layer, if one with the given `id` exists\n     */\n    getLayer(id: string): StyleLayer | undefined {\n        return this._layers[id];\n    }\n\n    /**\n     * Return the ids of all layers currently in the style, including custom layers, in order.\n     *\n     * @returns ids of layers, in order\n     */\n    getLayersOrder(): string[] {\n        return [...this._order];\n    }\n\n    /**\n     * Checks if a specific layer is present within the style.\n     *\n     * @param id - the id of the desired layer\n     * @returns a boolean specifying if the given layer is present\n     */\n    hasLayer(id: string): boolean {\n        return id in this._layers;\n    }\n\n    setLayerZoomRange(layerId: string, minzoom?: number | null, maxzoom?: number | null): void {\n        this._checkLoaded();\n\n        const layer = this.getLayer(layerId);\n        if (!layer) {\n            this.fire(new ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer \"${layerId}\".`)));\n            return;\n        }\n\n        if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) return;\n\n        if (minzoom != null) {\n            layer.minzoom = minzoom;\n        }\n        if (maxzoom != null) {\n            layer.maxzoom = maxzoom;\n        }\n        this._updateLayer(layer);\n    }\n\n    setFilter(layerId: string, filter?: FilterSpecification | null,  options: StyleSetterOptions = {}): void {\n        this._checkLoaded();\n\n        const layer = this.getLayer(layerId);\n        if (!layer) {\n            this.fire(new ErrorEvent(new Error(`Cannot filter non-existing layer \"${layerId}\".`)));\n            return;\n        }\n\n        if (deepEqual(layer.filter, filter)) {\n            return;\n        }\n\n        if (filter === null || filter === undefined) {\n            layer.setFilter(undefined);\n            this._updateLayer(layer);\n            return;\n        }\n\n        if (this._validate(validateStyle.filter, `layers.${layer.id}.filter`, filter, null, options)) {\n            return;\n        }\n\n        layer.setFilter(clone(filter));\n        this._updateLayer(layer);\n    }\n\n    /**\n     * Get a layer's filter object\n     * @param layer - the layer to inspect\n     * @returns the layer's filter, if any\n     */\n    getFilter(layer: string): FilterSpecification | void {\n        return clone(this.getLayer(layer).filter);\n    }\n\n    setLayoutProperty<K extends keyof AllLayoutProperties>(layerId: string, name: K, value: AllLayoutProperties[K],  options: StyleSetterOptions = {}): void {\n        this._checkLoaded();\n\n        const layer = this.getLayer(layerId);\n        if (!layer) {\n            this.fire(new ErrorEvent(new Error(`Cannot style non-existing layer \"${layerId}\".`)));\n            return;\n        }\n\n        if (deepEqual(layer.getLayoutProperty(name), value)) return;\n\n        layer.setLayoutProperty(name, value, options);\n        this._updateLayer(layer);\n    }\n\n    /**\n     * Get a layout property's value from a given layer\n     * @param layerId - the layer to inspect\n     * @param name - the name of the layout property\n     * @returns the property value\n     */\n    getLayoutProperty<K extends keyof AllLayoutProperties>(layerId: string, name: K): AllLayoutProperties[K] | undefined {\n        const layer = this.getLayer(layerId);\n        if (!layer) {\n            this.fire(new ErrorEvent(new Error(`Cannot get style of non-existing layer \"${layerId}\".`)));\n            return;\n        }\n\n        return layer.getLayoutProperty(name);\n    }\n\n    setPaintProperty<K extends keyof AllPaintProperties>(layerId: string, name: K, value: AllPaintProperties[K], options: StyleSetterOptions = {}): void {\n        this._checkLoaded();\n\n        const layer = this.getLayer(layerId);\n        if (!layer) {\n            this.fire(new ErrorEvent(new Error(`Cannot style non-existing layer \"${layerId}\".`)));\n            return;\n        }\n\n        if (deepEqual(layer.getPaintProperty(name), value)) return;\n\n        this._updatePaintProperty(layer, name, value, options);\n    }\n\n    _updatePaintProperty<K extends keyof AllPaintProperties>(layer: StyleLayer, name: K, value: AllPaintProperties[K], options: StyleSetterOptions = {}): void {\n        const requiresRelayout = layer.setPaintProperty(name, value, options);\n        if (requiresRelayout) {\n            this._updateLayer(layer);\n        }\n\n        if (isRasterStyleLayer(layer) && name === 'raster-fade-duration') {\n            this.tileManagers[layer.source].setRasterFadeDuration(value as number);\n        }\n\n        this._changed = true;\n        this._updatedPaintProps[layer.id] = true;\n        // reset serialization field, to be populated only when needed\n        this._serializedLayers = null;\n    }\n\n    getPaintProperty<K extends keyof AllPaintProperties>(layer: string, name: K): AllPaintProperties[K] {\n        return this.getLayer(layer).getPaintProperty(name);\n    }\n\n    setFeatureState(target: FeatureIdentifier, state: any): void {\n        this._checkLoaded();\n        const sourceId = target.source;\n        const sourceLayer = target.sourceLayer;\n        const tileManager = this.tileManagers[sourceId];\n\n        if (tileManager === undefined) {\n            this.fire(new ErrorEvent(new Error(`The source '${sourceId}' does not exist in the map's style.`)));\n            return;\n        }\n        const sourceType = tileManager.getSource().type;\n        if (sourceType === 'geojson' && sourceLayer) {\n            this.fire(new ErrorEvent(new Error('GeoJSON sources cannot have a sourceLayer parameter.')));\n            return;\n        }\n        if (sourceType === 'vector' && !sourceLayer) {\n            this.fire(new ErrorEvent(new Error('The sourceLayer parameter must be provided for vector source types.')));\n            return;\n        }\n        if (target.id === undefined) {\n            this.fire(new ErrorEvent(new Error('The feature id parameter must be provided.')));\n            return;\n        }\n        const forbiddenStateKeys = ['__proto__', 'constructor', 'prototype'];\n        if (state && Object.keys(state).some((stateKey: string) => forbiddenStateKeys.includes(stateKey))){\n            this.fire(new ErrorEvent(new Error(`The feature state should not include one of the following keys: ${forbiddenStateKeys}`)));\n            return;\n        }\n\n        tileManager.setFeatureState(sourceLayer, target.id, state);\n    }\n\n    removeFeatureState(target: FeatureIdentifier, key?: string): void {\n        this._checkLoaded();\n        const sourceId = target.source;\n        const tileManager = this.tileManagers[sourceId];\n\n        if (tileManager === undefined) {\n            this.fire(new ErrorEvent(new Error(`The source '${sourceId}' does not exist in the map's style.`)));\n            return;\n        }\n\n        const sourceType = tileManager.getSource().type;\n        const sourceLayer = sourceType === 'vector' ? target.sourceLayer : undefined;\n\n        if (sourceType === 'vector' && !sourceLayer) {\n            this.fire(new ErrorEvent(new Error('The sourceLayer parameter must be provided for vector source types.')));\n            return;\n        }\n\n        if (key && (typeof target.id !== 'string' && typeof target.id !== 'number')) {\n            this.fire(new ErrorEvent(new Error('A feature id is required to remove its specific state property.')));\n            return;\n        }\n\n        tileManager.removeFeatureState(sourceLayer, target.id, key);\n    }\n\n    getFeatureState(target: FeatureIdentifier): FeatureState {\n        this._checkLoaded();\n        const sourceId = target.source;\n        const sourceLayer = target.sourceLayer;\n        const tileManager = this.tileManagers[sourceId];\n\n        if (tileManager === undefined) {\n            this.fire(new ErrorEvent(new Error(`The source '${sourceId}' does not exist in the map's style.`)));\n            return;\n        }\n        const sourceType = tileManager.getSource().type;\n        if (sourceType === 'vector' && !sourceLayer) {\n            this.fire(new ErrorEvent(new Error('The sourceLayer parameter must be provided for vector source types.')));\n            return;\n        }\n        if (target.id === undefined) {\n            this.fire(new ErrorEvent(new Error('The feature id parameter must be provided.')));\n        }\n\n        return tileManager.getFeatureState(sourceLayer, target.id);\n    }\n\n    getTransition(): {duration: number; delay: number} & TransitionSpecification {\n        return extend({duration: 300, delay: 0}, this.stylesheet?.transition);\n    }\n\n    serialize(): StyleSpecification | undefined {\n        // We return undefined before we're loaded, following the pattern of Map.getStyle() before\n        // the Style object is initialized.\n        // Internally, Style._validate() calls Style.serialize() but callers are responsible for\n        // calling Style._checkLoaded() first if their validation requires the style to be loaded.\n        if (!this._loaded) return;\n\n        const sources = mapObject(this.tileManagers, (source) => source.serialize());\n        const layers = this._serializeByIds(this._order, true);\n        const terrain = this.map.getTerrain() || undefined;\n        const myStyleSheet = this.stylesheet;\n\n        return filterObject({\n            version: myStyleSheet.version,\n            name: myStyleSheet.name,\n            metadata: myStyleSheet.metadata,\n            light: myStyleSheet.light,\n            sky: myStyleSheet.sky,\n            center: myStyleSheet.center,\n            zoom: myStyleSheet.zoom,\n            bearing: myStyleSheet.bearing,\n            pitch: myStyleSheet.pitch,\n            sprite: myStyleSheet.sprite,\n            glyphs: myStyleSheet.glyphs,\n            transition: myStyleSheet.transition,\n            projection: myStyleSheet.projection,\n            sources,\n            layers,\n            terrain\n        },\n        (value) => value !== undefined);\n    }\n\n    _updateLayer(layer: StyleLayer): void {\n        this._updatedLayers[layer.id] = true;\n        if (layer.source && !this._updatedSources[layer.source] &&\n            //Skip for raster layers (https://github.com/mapbox/mapbox-gl-js/issues/7865)\n            this.tileManagers[layer.source].getSource().type !== 'raster') {\n            this._updatedSources[layer.source] = 'reload';\n            this.tileManagers[layer.source].pause();\n        }\n\n        // upon updating, serialized layer dictionary should be reset.\n        // When needed, it will be populated with the correct copy again.\n        this._serializedLayers = null;\n        this._changed = true;\n    }\n\n    _flattenAndSortRenderedFeatures(sourceResults: QueryRenderedFeaturesResults[]): MapGeoJSONFeature[] {\n        // Feature order is complicated.\n        // The order between features in two 2D layers is always determined by layer order.\n        // The order between features in two 3D layers is always determined by depth.\n        // The order between a feature in a 2D layer and a 3D layer is tricky:\n        //      Most often layer order determines the feature order in this case. If\n        //      a line layer is above a extrusion layer the line feature will be rendered\n        //      above the extrusion. If the line layer is below the extrusion layer,\n        //      it will be rendered below it.\n        //\n        //      There is a weird case though.\n        //      You have layers in this order: extrusion_layer_a, line_layer, extrusion_layer_b\n        //      Each layer has a feature that overlaps the other features.\n        //      The feature in extrusion_layer_a is closer than the feature in extrusion_layer_b so it is rendered above.\n        //      The feature in line_layer is rendered above extrusion_layer_a.\n        //      This means that that the line_layer feature is above the extrusion_layer_b feature despite\n        //      it being in an earlier layer.\n\n        const isLayer3D = layerId => this._layers[layerId].type === 'fill-extrusion';\n\n        const layerIndex = {};\n        const features3D: QueryRenderedFeaturesResultsItem[] = [];\n        for (let l = this._order.length - 1; l >= 0; l--) {\n            const layerId = this._order[l];\n            if (isLayer3D(layerId)) {\n                layerIndex[layerId] = l;\n                for (const sourceResult of sourceResults) {\n                    const layerFeatures = sourceResult[layerId];\n                    if (layerFeatures) {\n                        for (const featureWrapper of layerFeatures) {\n                            features3D.push(featureWrapper);\n                        }\n                    }\n                }\n            }\n        }\n\n        features3D.sort((a, b) => {\n            return (b.intersectionZ as number) - (a.intersectionZ as number);\n        });\n\n        const features: MapGeoJSONFeature[] = [];\n        for (let l = this._order.length - 1; l >= 0; l--) {\n            const layerId = this._order[l];\n\n            if (isLayer3D(layerId)) {\n                // add all 3D features that are in or above the current layer\n                for (let i = features3D.length - 1; i >= 0; i--) {\n                    const topmost3D = features3D[i].feature;\n                    if (layerIndex[topmost3D.layer.id] < l) break;\n                    features.push(topmost3D);\n                    features3D.pop();\n                }\n            } else {\n                for (const sourceResult of sourceResults) {\n                    const layerFeatures = sourceResult[layerId];\n                    if (layerFeatures) {\n                        for (const featureWrapper of layerFeatures) {\n                            features.push(featureWrapper.feature);\n                        }\n                    }\n                }\n            }\n        }\n\n        return features;\n    }\n\n    queryRenderedFeatures(queryGeometry: Point[], params: QueryRenderedFeaturesOptions, transform: IReadonlyTransform): MapGeoJSONFeature[] {\n        if (params?.filter) {\n            this._validate(validateStyle.filter, 'queryRenderedFeatures.filter', params.filter, null, params);\n        }\n\n        const includedSources = {};\n        if (params?.layers) {\n            const isArrayOrSet = Array.isArray(params.layers) || params.layers instanceof Set;\n            if (!isArrayOrSet) {\n                this.fire(new ErrorEvent(new Error('parameters.layers must be an Array or a Set of strings')));\n                return [];\n            }\n            for (const layerId of params.layers) {\n                const layer = this._layers[layerId];\n                if (!layer) {\n                    // this layer is not in the style.layers array\n                    this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be queried for features.`)));\n                    return [];\n                }\n                includedSources[layer.source] = true;\n            }\n        }\n\n        const sourceResults: QueryRenderedFeaturesResults[] = [];\n\n        params.availableImages = this._availableImages;\n\n        // LayerSpecification is serialized StyleLayer, and this casting is safe.\n        const serializedLayers = this._serializedAllLayers() as {[_: string]: StyleLayer};\n\n        const layersAsSet = params.layers instanceof Set ? params.layers : Array.isArray(params.layers) ? new Set(params.layers) : null;\n        const paramsStrict: QueryRenderedFeaturesOptionsStrict = {\n            ...params,\n            layers: layersAsSet,\n            globalState: this._globalState\n        };\n\n        for (const id in this.tileManagers) {\n            if (params.layers && !includedSources[id]) continue;\n            sourceResults.push(\n                queryRenderedFeatures(\n                    this.tileManagers[id],\n                    this._layers,\n                    serializedLayers,\n                    queryGeometry,\n                    paramsStrict,\n                    transform,\n                    this.map.terrain ?\n                        (id: OverscaledTileID, x: number, y: number) =>\n                            this.map.terrain.getElevation(id, x, y) :\n                        undefined)\n            );\n        }\n\n        if (this.placement) {\n            // If a placement has run, query against its CollisionIndex\n            // for symbol results, and treat it as an extra source to merge\n            sourceResults.push(\n                queryRenderedSymbols(\n                    this._layers,\n                    serializedLayers,\n                    this.tileManagers,\n                    queryGeometry,\n                    paramsStrict,\n                    this.placement.collisionIndex,\n                    this.placement.retainedQueryData)\n            );\n        }\n\n        return this._flattenAndSortRenderedFeatures(sourceResults);\n    }\n\n    querySourceFeatures(\n        sourceID: string,\n        params?: QuerySourceFeatureOptions\n    ): GeoJSONFeature[] {\n        if (params?.filter) {\n            this._validate(validateStyle.filter, 'querySourceFeatures.filter', params.filter, null, params);\n        }\n        const tileManager = this.tileManagers[sourceID];\n        return tileManager ? querySourceFeatures(tileManager, params ? {...params, globalState: this._globalState} : {globalState: this._globalState}) : [];\n    }\n\n    getLight(): LightSpecification {\n        return this.light.getLight();\n    }\n\n    setLight(lightOptions: LightSpecification, options: StyleSetterOptions = {}): void {\n        this._checkLoaded();\n\n        const light = this.light.getLight();\n        let _update = false;\n        for (const key in lightOptions) {\n            if (!deepEqual(lightOptions[key], light[key])) {\n                _update = true;\n                break;\n            }\n        }\n        if (!_update) return;\n\n        const parameters = {\n            now: now(),\n            transition: extend({\n                duration: 300,\n                delay: 0\n            }, this.stylesheet.transition)\n        };\n\n        this.light.setLight(lightOptions, options);\n        this.light.updateTransitions(parameters);\n    }\n\n    getProjection(): ProjectionSpecification {\n        return this.stylesheet?.projection;\n    }\n\n    setProjection(projection?: ProjectionSpecification): void {\n        this._checkLoaded();\n        const resolvedProjection = projection ?? {type: 'mercator'};\n        this.stylesheet.projection = projection;\n        if (this.projection) {\n            if (this.projection.name === resolvedProjection.type) {\n                return;\n            }\n            this.projection.destroy();\n            delete this.projection;\n        }\n        this._setProjectionInternal(resolvedProjection.type);\n    }\n\n    getSky(): SkySpecification {\n        return this.stylesheet?.sky;\n    }\n\n    setSky(skyOptions?: SkySpecification, options: StyleSetterOptions = {}): void {\n        this._checkLoaded();\n        const sky = this.getSky();\n\n        let update = false;\n        if (!skyOptions && !sky) return;\n\n        if (skyOptions && !sky) {\n            update = true;\n        } else if (!skyOptions && sky) {\n            update = true;\n        } else {\n            for (const key in skyOptions) {\n                if (!deepEqual(skyOptions[key], sky[key])) {\n                    update = true;\n                    break;\n                }\n            }\n        }\n        if (!update) return;\n\n        const parameters = {\n            now: now(),\n            transition: extend({\n                duration: 300,\n                delay: 0\n            }, this.stylesheet.transition)\n        };\n\n        this.stylesheet.sky = skyOptions;\n        this.sky.setSky(skyOptions, options);\n        this.sky.updateTransitions(parameters);\n    }\n\n    _setProjectionInternal(name: ProjectionSpecification['type']): void {\n        const projectionObjects = createProjectionFromName(name, this.map._camera?.transform.constrainOverride, this._globalState);\n        this.projection = projectionObjects.projection;\n        this.map.migrateProjection(projectionObjects.transform, projectionObjects.cameraHelper);\n        for (const key in this.tileManagers) {\n            this.tileManagers[key].reload();\n        }\n    }\n\n    _validate(validate: Validator, key: string, value: any, props: any, options: StyleSetterOptions = {}): boolean {\n        return validateAndEmit(this, validate, {\n            key,\n            style: this.serialize(),\n            value,\n            ...props\n        }, options);\n    }\n\n    _remove(mapRemoved: boolean = true): void {\n        if (this._frameRequest) {\n            this._frameRequest.abort();\n            this._frameRequest = null;\n        }\n        if (this._loadStyleRequest) {\n            this._loadStyleRequest.abort();\n            this._loadStyleRequest = null;\n        }\n        if (this._spriteRequest) {\n            this._spriteRequest.abort();\n            this._spriteRequest = null;\n        }\n        rtlMainThreadPluginFactory().off(RTLPluginLoadedEventName, this._rtlPluginLoaded);\n        for (const layerId in this._layers) {\n            const layer: StyleLayer = this._layers[layerId];\n            layer.setEventedParent(null);\n        }\n        for (const id in this.tileManagers) {\n            const tileManager = this.tileManagers[id];\n            tileManager.setEventedParent(null);\n            tileManager.onRemove(this.map);\n        }\n        this.imageManager.setEventedParent(null);\n        this.setEventedParent(null);\n        if (mapRemoved) {\n            this.dispatcher.broadcast(MessageType.removeMap, undefined);\n        }\n        this.dispatcher.remove(mapRemoved);\n    }\n\n    _clearSource(id: string): void {\n        this.tileManagers[id].clearTiles();\n    }\n\n    _reloadSource(id: string): void {\n        this.tileManagers[id].resume();\n        this.tileManagers[id].reload();\n    }\n\n    _updateSources(transform: ITransform): void {\n        for (const id in this.tileManagers) {\n            this.tileManagers[id].update(transform, this.map.terrain);\n        }\n    }\n\n    _generateCollisionBoxes(): void {\n        for (const id in this.tileManagers) {\n            this._reloadSource(id);\n        }\n    }\n\n    _updatePlacement(transform: ITransform, showCollisionBoxes: boolean, fadeDuration: number, crossSourceCollisions: boolean, forceFullPlacement: boolean = false): boolean {\n        let symbolBucketsChanged = false;\n        let placementCommitted = false;\n\n        const layerTiles = {};\n\n        for (const layerID of this._order) {\n            const styleLayer = this._layers[layerID];\n            if (styleLayer.type !== 'symbol') continue;\n\n            if (!layerTiles[styleLayer.source]) {\n                const tileManager = this.tileManagers[styleLayer.source];\n                layerTiles[styleLayer.source] = tileManager.getRenderableIds(true)\n                    .map((id) => tileManager.getTileByID(id))\n                    .sort((a, b) => (b.tileID.overscaledZ - a.tileID.overscaledZ) || (a.tileID.isLessThan(b.tileID) ? -1 : 1));\n            }\n\n            const layerBucketsChanged = this.crossTileSymbolIndex.addLayer(styleLayer, layerTiles[styleLayer.source], transform.center.lng);\n            symbolBucketsChanged ||= layerBucketsChanged;\n        }\n        this.crossTileSymbolIndex.pruneUnusedLayers(this._order);\n\n        // Anything that changes our \"in progress\" layer and tile indices requires us\n        // to start over. When we start over, we do a full placement instead of incremental\n        // to prevent starvation.\n        // We need to restart placement to keep layer indices in sync.\n        // Also force full placement when fadeDuration === 0 to ensure that newly loaded\n        // tiles will fully display symbols in their first frame\n        forceFullPlacement ||= this._layerOrderChanged || fadeDuration === 0;\n\n        if (forceFullPlacement || !this.pauseablePlacement || (this.pauseablePlacement.isDone() && !this.placement.stillRecent(now(), transform.zoom))) {\n            this.pauseablePlacement = new PauseablePlacement(transform, this.map.terrain, this._order, forceFullPlacement, showCollisionBoxes, fadeDuration, crossSourceCollisions, this.placement);\n            this._layerOrderChanged = false;\n        }\n\n        if (this.pauseablePlacement.isDone()) {\n            // the last placement finished running, but the next one hasn’t\n            // started yet because of the `stillRecent` check immediately\n            // above, so mark it stale to ensure that we request another\n            // render frame\n            this.placement.setStale();\n        } else {\n            this.pauseablePlacement.continuePlacement(this._order, this._layers, layerTiles);\n\n            if (this.pauseablePlacement.isDone()) {\n                this.placement = this.pauseablePlacement.commit(now());\n                placementCommitted = true;\n            }\n\n            if (symbolBucketsChanged) {\n                // since the placement gets split over multiple frames it is possible\n                // these buckets were processed before they were changed and so the\n                // placement is already stale while it is in progress\n                this.pauseablePlacement.placement.setStale();\n            }\n        }\n\n        if (placementCommitted || symbolBucketsChanged) {\n            for (const layerID of this._order) {\n                const styleLayer = this._layers[layerID];\n                if (styleLayer.type !== 'symbol') continue;\n                this.placement.updateLayerOpacities(styleLayer, layerTiles[styleLayer.source]);\n            }\n        }\n\n        // false when we have just finished a placement that didn't change the visibility of any symbols\n        return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(now());\n    }\n\n    _releaseSymbolFadeTiles(): void {\n        for (const id in this.tileManagers) {\n            this.tileManagers[id].releaseSymbolFadeTiles();\n        }\n    }\n\n    // Callbacks from web workers\n\n    async getImages(mapId: string | number, params: GetImagesParameters): Promise<GetImagesResponse> {\n        const images = await this.imageManager.getImages(params.icons);\n\n        // Apply queued image changes before setting the tile's dependencies so that the tile\n        // is not reloaded unnecessarily. Without this forced update the reload could happen in cases\n        // like this one:\n        // - icons contains \"my-image\"\n        // - imageManager.getImages(...) resolves \"my-image\" with a missing-image resolver\n        // - addImage adds \"my-image\" to this._changedImages\n        // - the next frame triggers a reload of this tile even though it already has the latest version\n        this._updateTilesForChangedImages();\n\n        const tileManager = this.tileManagers[params.source];\n        if (tileManager) {\n            tileManager.setDependencies(params.tileID.key, params.type, params.icons);\n        }\n        return images;\n    }\n\n    async getGlyphs(mapId: string | number, params: GetGlyphsParameters): Promise<GetGlyphsResponse> {\n        const glyphs = await this.glyphManager.getGlyphs(params.stacks);\n        const tileManager = this.tileManagers[params.source];\n        if (tileManager) {\n            // we are not setting stacks as dependencies since for now\n            // we just need to know which tiles have glyph dependencies\n            tileManager.setDependencies(params.tileID.key, params.type, ['']);\n        }\n        return glyphs;\n    }\n\n    getGlyphsUrl(): string | null {\n        return this.stylesheet.glyphs || null;\n    }\n\n    setGlyphs(glyphsUrl: string | null | undefined, options: StyleSetterOptions = {}): void {\n        this._checkLoaded();\n\n        if (glyphsUrl && this._validate(validateStyle.glyphs, 'glyphs', glyphsUrl, null, options)) {\n            return;\n        }\n\n        this._glyphsDidChange = true;\n        this.stylesheet.glyphs = glyphsUrl;\n        this.glyphManager.entries = {};\n        this.glyphManager.setURL(glyphsUrl);\n    }\n\n    async getDashes(mapId: string | number, params: GetDashesParameters): Promise<GetDashesResponse> {\n        const result: GetDashesResponse = {};\n        for (const [key, dash] of Object.entries(params.dashes)) {\n            result[key] = this.lineAtlas.getDash(dash.dasharray, dash.round);\n        }\n        return result;\n    }\n\n    /**\n     * Add a sprite.\n     *\n     * @param id - The id of the desired sprite\n     * @param url - The url to load the desired sprite from\n     * @param options - The style setter options\n     * @param completion - The completion handler\n     */\n    addSprite(id: string, url: string, options: StyleSetterOptions = {}, completion?: (err: Error) => void): void {\n        this._checkLoaded();\n\n        const spriteToAdd = [{id, url}];\n        const updatedSprite = [\n            ...coerceSpriteToArray(this.stylesheet.sprite),\n            ...spriteToAdd\n        ];\n\n        if (this._validate(validateStyle.sprite, 'sprite', updatedSprite, null, options)) return;\n\n        this.stylesheet.sprite = updatedSprite;\n        this._loadSprite(spriteToAdd, true, completion);\n    }\n\n    /**\n     * Remove a sprite by its id. When the last sprite is removed, the whole `this.stylesheet.sprite` object becomes\n     * `undefined`. This falsy `undefined` value later prevents attempts to load the sprite when it's absent.\n     *\n     * @param id - the id of the sprite to remove\n     */\n    removeSprite(id: string): void {\n        this._checkLoaded();\n\n        const internalSpriteRepresentation = coerceSpriteToArray(this.stylesheet.sprite);\n\n        if (!internalSpriteRepresentation.find(sprite => sprite.id === id)) {\n            this.fire(new ErrorEvent(new Error(`Sprite \"${id}\" doesn't exists on this map.`)));\n            return;\n        }\n\n        if (this._spritesImagesIds[id]) {\n            for (const imageId of this._spritesImagesIds[id]) {\n                this.imageManager.removeImage(imageId);\n                this._changedImages[imageId] = true;\n            }\n        }\n\n        internalSpriteRepresentation.splice(internalSpriteRepresentation.findIndex(sprite => sprite.id === id), 1);\n        this.stylesheet.sprite = internalSpriteRepresentation.length > 0 ? internalSpriteRepresentation : undefined;\n\n        delete this._spritesImagesIds[id];\n        this._availableImages = this.imageManager.listImages();\n        this._imagesListDirty = true;\n        this._changed = true;\n        this.fire(new MapStyleDataEvent('data'));\n    }\n\n    /**\n     * Get the current sprite value.\n     *\n     * @returns empty array when no sprite is set; id-url pairs otherwise\n     */\n    getSprite(): Array<{id: string; url: string}> {\n        return coerceSpriteToArray(this.stylesheet.sprite);\n    }\n\n    /**\n     * Set a new value for the style's sprite.\n     *\n     * @param sprite - new sprite value\n     * @param options - style setter options\n     * @param completion - the completion handler\n     */\n    setSprite(sprite: SpriteSpecification, options: StyleSetterOptions = {}, completion?: (err: Error) => void): void {\n        this._checkLoaded();\n\n        if (sprite && this._validate(validateStyle.sprite, 'sprite', sprite, null, options)) {\n            return;\n        }\n\n        this.stylesheet.sprite = sprite;\n\n        if (sprite) {\n            this._loadSprite(sprite, true, completion);\n        } else {\n            this._unloadSprite();\n            if (completion) {\n                completion(null);\n            }\n        }\n    }\n\n    /**\n     * Destroys all internal resources of the style (sources, images, layers, etc.)\n     */\n    destroy(): void {\n        // cancel any pending requests\n        if (this._frameRequest) {\n            this._frameRequest.abort();\n            this._frameRequest = null;\n        }\n        if (this._loadStyleRequest) {\n            this._loadStyleRequest.abort();\n            this._loadStyleRequest = null;\n        }\n        if (this._spriteRequest) {\n            this._spriteRequest.abort();\n            this._spriteRequest = null;\n        }\n\n        // remove sourcecaches\n        for (const id in this.tileManagers) {\n            const tileManager = this.tileManagers[id];\n            tileManager.setEventedParent(null);\n            tileManager.onRemove(this.map);\n        }\n        this.tileManagers = {};\n\n        // Destroy imageManager and clear images\n        if (this.imageManager) {\n            this.imageManager.setEventedParent(null);\n            this.imageManager.destroy();\n            this._availableImages = [];\n            this._spritesImagesIds = {};\n        }\n\n        // Destroy glyphManager\n        if (this.glyphManager) {\n            this.glyphManager.destroy();\n        }\n\n        // Remove layers\n        for (const layerId in this._layers) {\n            const layer = this._layers[layerId];\n            layer.setEventedParent(null);\n            if (layer.onRemove) layer.onRemove(this.map);\n        }\n\n        // reset internal state\n        this._setInitialValues();\n\n        // Remove event listeners\n        this.setEventedParent(null);\n        this.dispatcher.unregisterMessageHandler(MessageType.getGlyphs);\n        this.dispatcher.unregisterMessageHandler(MessageType.getImages);\n        this.dispatcher.unregisterMessageHandler(MessageType.getDashes);\n        this.dispatcher.remove(true);\n        this._listeners = {};\n        this._oneTimeListeners = {};\n    }\n}\n","import {createLayout, type StructArrayLayout} from '../util/struct_array.ts';\n\nconst rasterBoundsAttributes: StructArrayLayout = createLayout([\n    {name: 'a_pos', type: 'Int16', components: 2},\n    {name: 'a_texture_pos', type: 'Int16', components: 2}\n]);\n\nexport default rasterBoundsAttributes;\n","\nimport type {Program} from './program.ts';\nimport type {VertexBuffer} from './vertex_buffer.ts';\nimport type {IndexBuffer} from './index_buffer.ts';\nimport type {Context} from './context.ts';\n\n/**\n * @internal\n * A vertex array object used to pass data to the webgl code\n */\nexport class VertexArrayObject {\n    context: Context;\n    boundProgram: Program<any>;\n    boundLayoutVertexBuffer: VertexBuffer;\n    boundPaintVertexBuffers: VertexBuffer[];\n    boundIndexBuffer: IndexBuffer;\n    boundVertexOffset: number;\n    boundDynamicVertexBuffer: VertexBuffer;\n    boundDynamicVertexBuffer2: VertexBuffer;\n    boundDynamicVertexBuffer3: VertexBuffer;\n    vao: any;\n\n    constructor() {\n        this.boundProgram = null;\n        this.boundLayoutVertexBuffer = null;\n        this.boundPaintVertexBuffers = [];\n        this.boundIndexBuffer = null;\n        this.boundVertexOffset = null;\n        this.boundDynamicVertexBuffer = null;\n        this.vao = null;\n    }\n\n    bind(context: Context,\n        program: Program<any>,\n        layoutVertexBuffer: VertexBuffer,\n        paintVertexBuffers: VertexBuffer[],\n        indexBuffer?: IndexBuffer | null,\n        vertexOffset?: number | null,\n        dynamicVertexBuffer?: VertexBuffer | null,\n        dynamicVertexBuffer2?: VertexBuffer | null,\n        dynamicVertexBuffer3?: VertexBuffer | null): void {\n\n        this.context = context;\n\n        let paintBuffersDiffer = this.boundPaintVertexBuffers.length !== paintVertexBuffers.length;\n        for (let i = 0; !paintBuffersDiffer && i < paintVertexBuffers.length; i++) {\n            if (this.boundPaintVertexBuffers[i] !== paintVertexBuffers[i]) {\n                paintBuffersDiffer = true;\n            }\n        }\n\n        const isFreshBindRequired = (\n            !this.vao ||\n            this.boundProgram !== program ||\n            this.boundLayoutVertexBuffer !== layoutVertexBuffer ||\n            paintBuffersDiffer ||\n            this.boundIndexBuffer !== indexBuffer ||\n            this.boundVertexOffset !== vertexOffset ||\n            this.boundDynamicVertexBuffer !== dynamicVertexBuffer ||\n            this.boundDynamicVertexBuffer2 !== dynamicVertexBuffer2 ||\n            this.boundDynamicVertexBuffer3 !== dynamicVertexBuffer3\n        );\n\n        if (isFreshBindRequired) {\n            this.freshBind(program, layoutVertexBuffer, paintVertexBuffers, indexBuffer, vertexOffset, dynamicVertexBuffer, dynamicVertexBuffer2, dynamicVertexBuffer3);\n        } else {\n            context.bindVertexArray.set(this.vao);\n\n            if (dynamicVertexBuffer) {\n                // The buffer may have been updated. Rebind to upload data.\n                dynamicVertexBuffer.bind();\n            }\n\n            if (indexBuffer?.dynamicDraw) {\n                indexBuffer.bind();\n            }\n\n            if (dynamicVertexBuffer2) {\n                dynamicVertexBuffer2.bind();\n            }\n\n            if (dynamicVertexBuffer3) {\n                dynamicVertexBuffer3.bind();\n            }\n        }\n    }\n\n    freshBind(program: Program<any>,\n        layoutVertexBuffer: VertexBuffer,\n        paintVertexBuffers: VertexBuffer[],\n        indexBuffer?: IndexBuffer | null,\n        vertexOffset?: number | null,\n        dynamicVertexBuffer?: VertexBuffer | null,\n        dynamicVertexBuffer2?: VertexBuffer | null,\n        dynamicVertexBuffer3?: VertexBuffer | null): void {\n\n        const numNextAttributes = program.numAttributes;\n\n        const context = this.context;\n        const gl = context.gl;\n\n        if (this.vao) this.destroy();\n        this.vao = context.createVertexArray();\n        context.bindVertexArray.set(this.vao);\n\n        // store the arguments so that we can verify them when the vao is bound again\n        this.boundProgram = program;\n        this.boundLayoutVertexBuffer = layoutVertexBuffer;\n        this.boundPaintVertexBuffers = paintVertexBuffers;\n        this.boundIndexBuffer = indexBuffer;\n        this.boundVertexOffset = vertexOffset;\n        this.boundDynamicVertexBuffer = dynamicVertexBuffer;\n        this.boundDynamicVertexBuffer2 = dynamicVertexBuffer2;\n        this.boundDynamicVertexBuffer3 = dynamicVertexBuffer3;\n\n        layoutVertexBuffer.enableAttributes(gl, program);\n        for (const vertexBuffer of paintVertexBuffers) {\n            vertexBuffer.enableAttributes(gl, program);\n        }\n\n        if (dynamicVertexBuffer) {\n            dynamicVertexBuffer.enableAttributes(gl, program);\n        }\n        if (dynamicVertexBuffer2) {\n            dynamicVertexBuffer2.enableAttributes(gl, program);\n        }\n        if (dynamicVertexBuffer3) {\n            dynamicVertexBuffer3.enableAttributes(gl, program);\n        }\n\n        layoutVertexBuffer.bind();\n        layoutVertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n        for (const vertexBuffer of paintVertexBuffers) {\n            vertexBuffer.bind();\n            vertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n        }\n\n        if (dynamicVertexBuffer) {\n            dynamicVertexBuffer.bind();\n            dynamicVertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n        }\n        if (indexBuffer) {\n            indexBuffer.bind();\n        }\n        if (dynamicVertexBuffer2) {\n            dynamicVertexBuffer2.bind();\n            dynamicVertexBuffer2.setVertexAttribPointers(gl, program, vertexOffset);\n        }\n        if (dynamicVertexBuffer3) {\n            dynamicVertexBuffer3.bind();\n            dynamicVertexBuffer3.setVertexAttribPointers(gl, program, vertexOffset);\n        }\n\n        context.currentNumAttributes = numNextAttributes;\n    }\n\n    destroy(): void {\n        if (this.vao) {\n            this.context.deleteVertexArray(this.vao);\n            this.vao = null;\n        }\n    }\n}\n","import {\n    Uniform1i,\n    Uniform1f,\n    Uniform4f,\n    UniformMatrix4f,\n    UniformColor\n} from '../uniform_binding.ts';\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport {type Sky} from '../../style/sky.ts';\nimport {Color} from '@maplibre/maplibre-gl-style-spec';\nimport {type mat4} from 'gl-matrix';\n\nexport type TerrainPreludeUniformsType = {\n    'u_depth': Uniform1i;\n    'u_terrain': Uniform1i;\n    'u_terrain_dim': Uniform1f;\n    'u_terrain_matrix': UniformMatrix4f;\n    'u_terrain_unpack': Uniform4f;\n    'u_terrain_exaggeration': Uniform1f;\n};\n\nexport type TerrainUniformsType = {\n    'u_texture': Uniform1i;\n    'u_ele_delta': Uniform1f;\n    'u_fog_matrix': UniformMatrix4f;\n    'u_fog_color': UniformColor;\n    'u_fog_ground_blend': Uniform1f;\n    'u_fog_ground_blend_opacity': Uniform1f;\n    'u_horizon_color': UniformColor;\n    'u_horizon_fog_blend': Uniform1f;\n    'u_is_globe_mode': Uniform1f;\n};\n\nexport type TerrainDepthUniformsType = {\n    'u_ele_delta': Uniform1f;\n};\n\nexport type TerrainCoordsUniformsType = {\n    'u_texture': Uniform1i;\n    'u_terrain_coords_id': Uniform1f;\n    'u_ele_delta': Uniform1f;\n};\n\nconst terrainPreludeUniforms = (context: Context, locations: UniformLocations): TerrainPreludeUniformsType => ({\n    'u_depth': new Uniform1i(context, locations.u_depth),\n    'u_terrain': new Uniform1i(context, locations.u_terrain),\n    'u_terrain_dim': new Uniform1f(context, locations.u_terrain_dim),\n    'u_terrain_matrix': new UniformMatrix4f(context, locations.u_terrain_matrix),\n    'u_terrain_unpack': new Uniform4f(context, locations.u_terrain_unpack),\n    'u_terrain_exaggeration': new Uniform1f(context, locations.u_terrain_exaggeration)\n});\n\nconst terrainUniforms = (context: Context, locations: UniformLocations): TerrainUniformsType => ({\n    'u_texture': new Uniform1i(context, locations.u_texture),\n    'u_ele_delta': new Uniform1f(context, locations.u_ele_delta),\n    'u_fog_matrix': new UniformMatrix4f(context, locations.u_fog_matrix),\n    'u_fog_color': new UniformColor(context, locations.u_fog_color),\n    'u_fog_ground_blend': new Uniform1f(context, locations.u_fog_ground_blend),\n    'u_fog_ground_blend_opacity': new Uniform1f(context, locations.u_fog_ground_blend_opacity),\n    'u_horizon_color': new UniformColor(context, locations.u_horizon_color),\n    'u_horizon_fog_blend': new Uniform1f(context, locations.u_horizon_fog_blend),\n    'u_is_globe_mode': new Uniform1f(context, locations.u_is_globe_mode)\n});\n\nconst terrainDepthUniforms = (context: Context, locations: UniformLocations): TerrainDepthUniformsType => ({\n    'u_ele_delta': new Uniform1f(context, locations.u_ele_delta)\n});\n\nconst terrainCoordsUniforms = (context: Context, locations: UniformLocations): TerrainCoordsUniformsType => ({\n    'u_texture': new Uniform1i(context, locations.u_texture),\n    'u_terrain_coords_id': new Uniform1f(context, locations.u_terrain_coords_id),\n    'u_ele_delta': new Uniform1f(context, locations.u_ele_delta)\n});\n\nconst terrainUniformValues = (\n    eleDelta: number,\n    fogMatrix: mat4,\n    sky: Sky,\n    pitch: number,\n    isGlobeMode: boolean): UniformValues<TerrainUniformsType> => ({\n    'u_texture': 0,\n    'u_ele_delta': eleDelta,\n    'u_fog_matrix': fogMatrix,\n    'u_fog_color': sky ? sky.properties.get('fog-color') : Color.white,\n    'u_fog_ground_blend': sky ? sky.properties.get('fog-ground-blend') : 1,\n    // Set opacity to 0 when in globe mode to disable fog\n    'u_fog_ground_blend_opacity': isGlobeMode ? 0 : (sky ? sky.calculateFogBlendOpacity(pitch) : 0),\n    'u_horizon_color': sky ? sky.properties.get('horizon-color') : Color.white,\n    'u_horizon_fog_blend': sky ? sky.properties.get('horizon-fog-blend') : 1,\n    'u_is_globe_mode': isGlobeMode ? 1 : 0\n});\n\nconst terrainDepthUniformValues = (\n    eleDelta: number\n): UniformValues<TerrainDepthUniformsType> => ({\n    'u_ele_delta': eleDelta\n});\n\nconst terrainCoordsUniformValues = (\n    coordsId: number,\n    eleDelta: number\n): UniformValues<TerrainCoordsUniformsType> => ({\n    'u_terrain_coords_id': coordsId / 255,\n    'u_texture': 0,\n    'u_ele_delta': eleDelta\n});\n\nexport {terrainUniforms, terrainDepthUniforms, terrainCoordsUniforms, terrainPreludeUniforms, terrainUniformValues, terrainDepthUniformValues, terrainCoordsUniformValues};\n","import {Uniform1f, Uniform1i, Uniform4f, type UniformLocations, type UniformValues, UniformMatrix4f} from '../uniform_binding.ts';\nimport {type Context} from '../../webgl/context.ts';\n\nimport type {ProjectionData} from '../../geo/projection/projection_data.ts';\n\nexport type ProjectionPreludeUniformsType = {\n    'u_projection_matrix': UniformMatrix4f;\n    'u_projection_tile_mercator_coords': Uniform4f;\n    'u_projection_clipping_plane': Uniform4f;\n    'u_projection_transition': Uniform1f;\n    'u_projection_fallback_matrix': UniformMatrix4f;\n    'u_projection_clip_antimeridian': Uniform1i;\n};\n\nexport const projectionUniforms = (context: Context, locations: UniformLocations): ProjectionPreludeUniformsType => ({\n    'u_projection_matrix': new UniformMatrix4f(context, locations.u_projection_matrix),\n    'u_projection_tile_mercator_coords': new Uniform4f(context, locations.u_projection_tile_mercator_coords),\n    'u_projection_clipping_plane': new Uniform4f(context, locations.u_projection_clipping_plane),\n    'u_projection_transition': new Uniform1f(context, locations.u_projection_transition),\n    'u_projection_fallback_matrix': new UniformMatrix4f(context, locations.u_projection_fallback_matrix),\n    'u_projection_clip_antimeridian': new Uniform1i(context, locations.u_projection_clip_antimeridian),\n});\n\n/**\n * Converts a {@link ProjectionData} object into the values expected by the projection prelude's uniforms.\n */\nexport const projectionUniformValues = (projectionData: ProjectionData): UniformValues<ProjectionPreludeUniformsType> => ({\n    'u_projection_matrix': projectionData.mainMatrix,\n    'u_projection_tile_mercator_coords': projectionData.tileMercatorCoords,\n    'u_projection_clipping_plane': projectionData.clippingPlane,\n    'u_projection_transition': projectionData.projectionTransition,\n    'u_projection_fallback_matrix': projectionData.fallbackMatrix,\n    'u_projection_clip_antimeridian': projectionData.clipAntimeridian ? 1 : 0,\n});\n","import {type PreparedShader, shaders} from '../shaders/shaders.ts';\nimport {type ProgramConfiguration} from '../data/program_configuration.ts';\nimport {VertexArrayObject} from './vertex_array_object.ts';\nimport {type Context} from './context.ts';\n\nimport type {SegmentVector} from '../data/segment.ts';\nimport type {VertexBuffer} from './vertex_buffer.ts';\nimport type {IndexBuffer} from './index_buffer.ts';\nimport type {DepthMode} from './depth_mode.ts';\nimport type {StencilMode} from './stencil_mode.ts';\nimport type {ColorMode} from './color_mode.ts';\nimport type {CullFaceMode} from './cull_face_mode.ts';\nimport type {UniformBindings, UniformValues, UniformLocations} from './uniform_binding.ts';\nimport type {BinderUniform} from '../data/program_configuration.ts';\nimport {terrainPreludeUniforms, type TerrainPreludeUniformsType} from './program/terrain_program.ts';\nimport type {TerrainData} from '../render/terrain.ts';\nimport {type ProjectionPreludeUniformsType, projectionUniforms, projectionUniformValues} from './program/projection_program.ts';\nimport type {ProjectionData} from '../geo/projection/projection_data.ts';\n\nexport type DrawMode = WebGLRenderingContextBase['LINES'] | WebGLRenderingContextBase['TRIANGLES'] | WebGL2RenderingContext['LINE_STRIP'];\n\nfunction getTokenizedAttributesAndUniforms(array: string[]): string[] {\n    const result = [];\n\n    for (const entry of array) {\n        if (entry === null) continue;\n        const token = entry.split(' ');\n        result.push(token.pop());\n    }\n    return result;\n}\n\n/**\n * @internal\n * A webgl program to execute in the GPU space\n */\nexport class Program<Us extends UniformBindings> {\n    program: WebGLProgram;\n    attributes: {[_: string]: number};\n    numAttributes: number;\n    fixedUniforms: Us;\n    terrainUniforms: TerrainPreludeUniformsType;\n    projectionUniforms: ProjectionPreludeUniformsType;\n    binderUniforms: BinderUniform[];\n    failedToCreate: boolean;\n\n    constructor(context: Context,\n        source: PreparedShader,\n        configuration: ProgramConfiguration,\n        fixedUniforms: (b: Context, a: UniformLocations) => Us,\n        showOverdrawInspector: boolean,\n        useTerrain: boolean,\n        projectionPrelude: PreparedShader,\n        projectionDefine: string,\n        extraDefines: string[] = []) {\n\n        const gl = context.gl;\n        this.program = gl.createProgram();\n\n        const staticAttrInfo = getTokenizedAttributesAndUniforms(source.staticAttributes);\n        const dynamicAttrInfo = configuration ? configuration.getBinderAttributes() : [];\n        const allAttrInfo = staticAttrInfo.concat(dynamicAttrInfo);\n\n        const preludeUniformsInfo = shaders.prelude.staticUniforms ? getTokenizedAttributesAndUniforms(shaders.prelude.staticUniforms) : [];\n        const projectionPreludeUniformsInfo = projectionPrelude.staticUniforms ? getTokenizedAttributesAndUniforms(projectionPrelude.staticUniforms) : [];\n        const staticUniformsInfo = source.staticUniforms ? getTokenizedAttributesAndUniforms(source.staticUniforms) : [];\n        const dynamicUniformsInfo = configuration ? configuration.getBinderUniforms() : [];\n        // remove duplicate uniforms\n        const uniformList = preludeUniformsInfo.concat(projectionPreludeUniformsInfo).concat(staticUniformsInfo).concat(dynamicUniformsInfo);\n        const allUniformsInfo = [];\n        for (const uniform of uniformList) {\n            if (!allUniformsInfo.includes(uniform)) allUniformsInfo.push(uniform);\n        }\n\n        const defines = configuration ? configuration.defines() : [];\n        defines.unshift('#version 300 es');\n        if (showOverdrawInspector) {\n            defines.push('#define OVERDRAW_INSPECTOR;');\n        }\n        if (useTerrain) {\n            defines.push('#define TERRAIN3D;');\n        }\n        if (projectionDefine) {\n            defines.push(projectionDefine);\n        }\n        if (extraDefines) {\n            defines.push(...extraDefines);\n        }\n\n        const fragmentSource = defines.concat(shaders.prelude.fragmentSource, projectionPrelude.fragmentSource, source.fragmentSource).join('\\n');\n        const vertexSource = defines.concat(shaders.prelude.vertexSource, projectionPrelude.vertexSource, source.vertexSource).join('\\n');\n\n        const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n        if (gl.isContextLost()) {\n            this.failedToCreate = true;\n            return;\n        }\n        gl.shaderSource(fragmentShader, fragmentSource);\n        gl.compileShader(fragmentShader);\n\n        if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n            throw new Error(`Could not compile fragment shader: ${gl.getShaderInfoLog(fragmentShader)}`);\n        }\n\n        gl.attachShader(this.program, fragmentShader);\n\n        const vertexShader = gl.createShader(gl.VERTEX_SHADER);\n        if (gl.isContextLost()) {\n            this.failedToCreate = true;\n            return;\n        }\n        gl.shaderSource(vertexShader, vertexSource);\n        gl.compileShader(vertexShader);\n\n        if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n            throw new Error(`Could not compile vertex shader: ${gl.getShaderInfoLog(vertexShader)}`);\n        }\n\n        gl.attachShader(this.program, vertexShader);\n\n        this.attributes = {};\n        const uniformLocations = {};\n\n        this.numAttributes = allAttrInfo.length;\n\n        for (let i = 0; i < this.numAttributes; i++) {\n            if (allAttrInfo[i]) {\n                this.attributes[allAttrInfo[i]] = i;\n            }\n        }\n\n        gl.linkProgram(this.program);\n\n        for (const name in this.attributes) {\n            const actual = gl.getAttribLocation(this.program, name);\n            if (actual >= 0) {\n                this.attributes[name] = actual;\n            } else {\n                delete this.attributes[name];\n            }\n        }\n\n        if (!gl.getProgramParameter(this.program, gl.LINK_STATUS)) {\n            throw new Error(`Program failed to link: ${gl.getProgramInfoLog(this.program)}`);\n        }\n\n        gl.deleteShader(vertexShader);\n        gl.deleteShader(fragmentShader);\n\n        for (const uniform of allUniformsInfo) {\n            if (uniform && !uniformLocations[uniform]) {\n                const uniformLocation = gl.getUniformLocation(this.program, uniform);\n                if (uniformLocation) {\n                    uniformLocations[uniform] = uniformLocation;\n                }\n            }\n        }\n\n        this.fixedUniforms = fixedUniforms(context, uniformLocations);\n        this.terrainUniforms = terrainPreludeUniforms(context, uniformLocations);\n        this.projectionUniforms = projectionUniforms(context, uniformLocations);\n        this.binderUniforms = configuration ? configuration.getUniforms(context, uniformLocations) : [];\n    }\n\n    draw(context: Context,\n        drawMode: DrawMode,\n        depthMode: Readonly<DepthMode>,\n        stencilMode: Readonly<StencilMode>,\n        colorMode: Readonly<ColorMode>,\n        cullFaceMode: Readonly<CullFaceMode>,\n        uniformValues: UniformValues<Us>,\n        terrain: TerrainData,\n        projectionData: ProjectionData,\n        layerID: string,\n        layoutVertexBuffer: VertexBuffer,\n        indexBuffer: IndexBuffer,\n        segments: SegmentVector,\n        currentProperties?: any,\n        zoom?: number | null,\n        configuration?: ProgramConfiguration | null,\n        dynamicLayoutBuffer?: VertexBuffer | null,\n        dynamicLayoutBuffer2?: VertexBuffer | null,\n        dynamicLayoutBuffer3?: VertexBuffer | null): void {\n\n        const gl = context.gl;\n\n        if (this.failedToCreate) return;\n\n        context.program.set(this.program);\n        context.setDepthMode(depthMode);\n        context.setStencilMode(stencilMode);\n        context.setColorMode(colorMode);\n        context.setCullFace(cullFaceMode);\n\n        // set variables used by the 3d functions defined in _prelude.vertex.glsl\n        if (terrain) {\n            context.activeTexture.set(gl.TEXTURE2);\n            gl.bindTexture(gl.TEXTURE_2D, terrain.depthTexture);\n            context.activeTexture.set(gl.TEXTURE3);\n            gl.bindTexture(gl.TEXTURE_2D, terrain.texture);\n            for (const name in this.terrainUniforms) {\n                this.terrainUniforms[name].set(terrain[name]);\n            }\n        }\n\n        if (projectionData) {\n            const values = projectionUniformValues(projectionData);\n            for (const name in this.projectionUniforms) {\n                this.projectionUniforms[name].set(values[name]);\n            }\n        }\n\n        if (uniformValues) {\n            for (const name in this.fixedUniforms) {\n                this.fixedUniforms[name].set(uniformValues[name]);\n            }\n        }\n\n        if (configuration) {\n            configuration.setUniforms(context, this.binderUniforms, currentProperties, {zoom});\n        }\n\n        let primitiveSize = 0;\n        switch (drawMode) {\n            case gl.LINES:\n                primitiveSize = 2;\n                break;\n            case gl.TRIANGLES:\n                primitiveSize = 3;\n                break;\n            case gl.LINE_STRIP:\n                primitiveSize = 1;\n                break;\n        }\n\n        for (const segment of segments.get()) {\n            segment.vaos ||= {};\n            segment.vaos[layerID] ||= new VertexArrayObject();\n            segment.vaos[layerID].bind(\n                context,\n                this,\n                layoutVertexBuffer,\n                configuration ? configuration.getPaintVertexBuffers() : [],\n                indexBuffer,\n                segment.vertexOffset,\n                dynamicLayoutBuffer,\n                dynamicLayoutBuffer2,\n                dynamicLayoutBuffer3\n            );\n\n            gl.drawElements(\n                drawMode,\n                segment.primitiveLength * primitiveSize,\n                gl.UNSIGNED_SHORT,\n                segment.primitiveOffset * primitiveSize * 2);\n        }\n    }\n}\n","import {\n    type Uniform1i,\n    type Uniform1f,\n    type Uniform2f,\n    type Uniform3f\n} from '../uniform_binding.ts';\nimport {pixelsToTileUnits} from '../../source/pixels_to_tile_units.ts';\n\nimport type {Painter} from '../../render/painter.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\nimport type {CrossFaded} from '../../style/properties.ts';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters.ts';\nimport type {UniformValues} from '../uniform_binding.ts';\nimport type {Tile} from '../../tile/tile.ts';\nimport type {ResolvedImage} from '@maplibre/maplibre-gl-style-spec';\n\ntype BackgroundPatternUniformsType = {\n    'u_image': Uniform1i;\n    'u_pattern_tl_a': Uniform2f;\n    'u_pattern_br_a': Uniform2f;\n    'u_pattern_tl_b': Uniform2f;\n    'u_pattern_br_b': Uniform2f;\n    'u_texsize': Uniform2f;\n    'u_mix': Uniform1f;\n    'u_pattern_size_a': Uniform2f;\n    'u_pattern_size_b': Uniform2f;\n    'u_scale_a': Uniform1f;\n    'u_scale_b': Uniform1f;\n    'u_pixel_coord_upper': Uniform2f;\n    'u_pixel_coord_lower': Uniform2f;\n    'u_tile_units_to_pixels': Uniform1f;\n};\n\nexport type PatternUniformsType = {\n    // pattern uniforms:\n    'u_image': Uniform1i;\n    'u_texsize': Uniform2f;\n    'u_scale': Uniform3f;\n    'u_fade': Uniform1f;\n    'u_pixel_coord_upper': Uniform2f;\n    'u_pixel_coord_lower': Uniform2f;\n};\n\nfunction patternUniformValues(crossfade: CrossfadeParameters, painter: Painter, tile: Tile): UniformValues<PatternUniformsType> {\n\n    const tileRatio = 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom);\n\n    const numTiles = Math.pow(2, tile.tileID.overscaledZ);\n    const tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom) / numTiles;\n\n    const pixelX = tileSizeAtNearestZoom * (tile.tileID.canonical.x + tile.tileID.wrap * numTiles);\n    const pixelY = tileSizeAtNearestZoom * tile.tileID.canonical.y;\n\n    return {\n        'u_image': 0,\n        'u_texsize': tile.imageAtlasTexture.size,\n        'u_scale': [tileRatio, crossfade.fromScale, crossfade.toScale],\n        'u_fade': crossfade.t,\n        // split the pixel coord into two pairs of 16 bit numbers. The glsl spec only guarantees 16 bits of precision.\n        'u_pixel_coord_upper': [pixelX >> 16, pixelY >> 16],\n        'u_pixel_coord_lower': [pixelX & 0xFFFF, pixelY & 0xFFFF]\n    };\n}\n\nfunction bgPatternUniformValues(\n    image: CrossFaded<ResolvedImage>,\n    crossfade: CrossfadeParameters,\n    painter: Painter,\n    tile: {\n        tileID: OverscaledTileID;\n        tileSize: number;\n    }\n): UniformValues<BackgroundPatternUniformsType> {\n    const imagePosA = painter.imageManager.getPattern(image.from.toString());\n    const imagePosB = painter.imageManager.getPattern(image.to.toString());\n    const {width, height} = painter.imageManager.getPixelSize();\n\n    const numTiles = Math.pow(2, tile.tileID.overscaledZ);\n    const tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom) / numTiles;\n\n    const pixelX = tileSizeAtNearestZoom * (tile.tileID.canonical.x + tile.tileID.wrap * numTiles);\n    const pixelY = tileSizeAtNearestZoom * tile.tileID.canonical.y;\n\n    return {\n        'u_image': 0,\n        'u_pattern_tl_a': (imagePosA as any).tl,\n        'u_pattern_br_a': (imagePosA as any).br,\n        'u_pattern_tl_b': (imagePosB as any).tl,\n        'u_pattern_br_b': (imagePosB as any).br,\n        'u_texsize': [width, height],\n        'u_mix': crossfade.t,\n        'u_pattern_size_a': (imagePosA as any).displaySize,\n        'u_pattern_size_b': (imagePosB as any).displaySize,\n        'u_scale_a': crossfade.fromScale,\n        'u_scale_b': crossfade.toScale,\n        'u_tile_units_to_pixels': 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom),\n        // split the pixel coord into two pairs of 16 bit numbers. The glsl spec only guarantees 16 bits of precision.\n        'u_pixel_coord_upper': [pixelX >> 16, pixelY >> 16],\n        'u_pixel_coord_lower': [pixelX & 0xFFFF, pixelY & 0xFFFF]\n    };\n}\nexport {bgPatternUniformValues, patternUniformValues};\n","import {patternUniformValues} from './pattern.ts';\nimport {\n    Uniform1i,\n    Uniform1f,\n    Uniform2f,\n    Uniform3f\n} from '../uniform_binding.ts';\n\nimport {mat3, vec3} from 'gl-matrix';\nimport {extend} from '../../util/util.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {Painter} from '../../render/painter.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters.ts';\nimport type {Tile} from '../../tile/tile.ts';\n\nexport type FillExtrusionUniformsType = {\n    'u_lightpos': Uniform3f;\n    'u_lightpos_globe': Uniform3f;\n    'u_lightintensity': Uniform1f;\n    'u_lightcolor': Uniform3f;\n    'u_vertical_gradient': Uniform1f;\n    'u_opacity': Uniform1f;\n    'u_fill_translate': Uniform2f;\n};\n\nexport type FillExtrusionPatternUniformsType = {\n    'u_lightpos': Uniform3f;\n    'u_lightpos_globe': Uniform3f;\n    'u_lightintensity': Uniform1f;\n    'u_lightcolor': Uniform3f;\n    'u_height_factor': Uniform1f;\n    'u_vertical_gradient': Uniform1f;\n    'u_opacity': Uniform1f;\n    'u_fill_translate': Uniform2f;\n    // pattern uniforms:\n    'u_texsize': Uniform2f;\n    'u_image': Uniform1i;\n    'u_pixel_coord_upper': Uniform2f;\n    'u_pixel_coord_lower': Uniform2f;\n    'u_scale': Uniform3f;\n    'u_fade': Uniform1f;\n};\n\nconst fillExtrusionUniforms = (context: Context, locations: UniformLocations): FillExtrusionUniformsType => ({\n    'u_lightpos': new Uniform3f(context, locations.u_lightpos),\n    'u_lightpos_globe': new Uniform3f(context, locations.u_lightpos_globe),\n    'u_lightintensity': new Uniform1f(context, locations.u_lightintensity),\n    'u_lightcolor': new Uniform3f(context, locations.u_lightcolor),\n    'u_vertical_gradient': new Uniform1f(context, locations.u_vertical_gradient),\n    'u_opacity': new Uniform1f(context, locations.u_opacity),\n    'u_fill_translate': new Uniform2f(context, locations.u_fill_translate),\n});\n\nconst fillExtrusionPatternUniforms = (context: Context, locations: UniformLocations): FillExtrusionPatternUniformsType => ({\n    'u_lightpos': new Uniform3f(context, locations.u_lightpos),\n    'u_lightpos_globe': new Uniform3f(context, locations.u_lightpos_globe),\n    'u_lightintensity': new Uniform1f(context, locations.u_lightintensity),\n    'u_lightcolor': new Uniform3f(context, locations.u_lightcolor),\n    'u_vertical_gradient': new Uniform1f(context, locations.u_vertical_gradient),\n    'u_height_factor': new Uniform1f(context, locations.u_height_factor),\n    'u_opacity': new Uniform1f(context, locations.u_opacity),\n    'u_fill_translate': new Uniform2f(context, locations.u_fill_translate),\n    // pattern uniforms\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n    'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n    'u_scale': new Uniform3f(context, locations.u_scale),\n    'u_fade': new Uniform1f(context, locations.u_fade)\n});\n\nconst fillExtrusionUniformValues = (\n    painter: Painter,\n    shouldUseVerticalGradient: boolean,\n    opacity: number,\n    translate: [number, number],\n): UniformValues<FillExtrusionUniformsType> => {\n    const light = painter.style.light;\n    const lightPos = light.getCartesianPosition();\n    const lightMat = mat3.create();\n    if (light.properties.get('anchor') === 'viewport') {\n        mat3.fromRotation(lightMat, painter.transform.bearingInRadians);\n    }\n    vec3.transformMat3(lightPos, lightPos, lightMat);\n    const transformedLightPos = painter.transform.transformLightDirection(lightPos);\n\n    const lightColor = light.properties.get('color');\n\n    return {\n        'u_lightpos': lightPos,\n        'u_lightpos_globe': transformedLightPos,\n        'u_lightintensity': light.properties.get('intensity'),\n        'u_lightcolor': [lightColor.r, lightColor.g, lightColor.b],\n        'u_vertical_gradient': +shouldUseVerticalGradient,\n        'u_opacity': opacity,\n        'u_fill_translate': translate,\n    };\n};\n\nconst fillExtrusionPatternUniformValues = (\n    painter: Painter,\n    shouldUseVerticalGradient: boolean,\n    opacity: number,\n    translate: [number, number],\n    coord: OverscaledTileID,\n    crossfade: CrossfadeParameters,\n    tile: Tile\n): UniformValues<FillExtrusionPatternUniformsType> => {\n    return extend(fillExtrusionUniformValues(painter, shouldUseVerticalGradient, opacity, translate),\n        patternUniformValues(crossfade, painter, tile),\n        {\n            'u_height_factor': -Math.pow(2, coord.overscaledZ) / tile.tileSize / 8\n        });\n};\n\nexport {\n    fillExtrusionUniforms,\n    fillExtrusionPatternUniforms,\n    fillExtrusionUniformValues,\n    fillExtrusionPatternUniformValues\n};\n","import {patternUniformValues} from './pattern.ts';\nimport {\n    Uniform1i,\n    Uniform1f,\n    Uniform2f,\n    Uniform3f,\n} from '../uniform_binding.ts';\nimport {extend} from '../../util/util.ts';\n\nimport type {Painter} from '../../render/painter.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {Context} from '../../webgl/context.ts';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters.ts';\nimport type {Tile} from '../../tile/tile.ts';\n\nexport type FillUniformsType = {\n    'u_fill_translate': Uniform2f;\n};\n\nexport type FillOutlineUniformsType = {\n    'u_world': Uniform2f;\n    'u_fill_translate': Uniform2f;\n};\n\nexport type FillPatternUniformsType = {\n    // pattern uniforms:\n    'u_texsize': Uniform2f;\n    'u_image': Uniform1i;\n    'u_pixel_coord_upper': Uniform2f;\n    'u_pixel_coord_lower': Uniform2f;\n    'u_scale': Uniform3f;\n    'u_fade': Uniform1f;\n    'u_fill_translate': Uniform2f;\n};\n\nexport type FillOutlinePatternUniformsType = {\n    'u_world': Uniform2f;\n    // pattern uniforms:\n    'u_texsize': Uniform2f;\n    'u_image': Uniform1i;\n    'u_pixel_coord_upper': Uniform2f;\n    'u_pixel_coord_lower': Uniform2f;\n    'u_scale': Uniform3f;\n    'u_fade': Uniform1f;\n    'u_fill_translate': Uniform2f;\n};\n\nconst fillUniforms = (context: Context, locations: UniformLocations): FillUniformsType => ({\n    'u_fill_translate': new Uniform2f(context, locations.u_fill_translate)\n});\n\nconst fillPatternUniforms = (context: Context, locations: UniformLocations): FillPatternUniformsType => ({\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n    'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n    'u_scale': new Uniform3f(context, locations.u_scale),\n    'u_fade': new Uniform1f(context, locations.u_fade),\n    'u_fill_translate': new Uniform2f(context, locations.u_fill_translate)\n});\n\nconst fillOutlineUniforms = (context: Context, locations: UniformLocations): FillOutlineUniformsType => ({\n    'u_world': new Uniform2f(context, locations.u_world),\n    'u_fill_translate': new Uniform2f(context, locations.u_fill_translate)\n});\n\nconst fillOutlinePatternUniforms = (context: Context, locations: UniformLocations): FillOutlinePatternUniformsType => ({\n    'u_world': new Uniform2f(context, locations.u_world),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n    'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n    'u_scale': new Uniform3f(context, locations.u_scale),\n    'u_fade': new Uniform1f(context, locations.u_fade),\n    'u_fill_translate': new Uniform2f(context, locations.u_fill_translate)\n});\n\nconst fillPatternUniformValues = (\n    painter: Painter,\n    crossfade: CrossfadeParameters,\n    tile: Tile,\n    translate: [number, number]\n): UniformValues<FillPatternUniformsType> => extend(\n    patternUniformValues(crossfade, painter, tile),\n    {\n        'u_fill_translate': translate,\n    }\n);\n\nconst fillUniformValues = (translate: [number, number]): UniformValues<FillUniformsType> => ({\n    'u_fill_translate': translate,\n});\n\nconst fillOutlineUniformValues = (drawingBufferSize: [number, number], translate: [number, number]): UniformValues<FillOutlineUniformsType> => ({\n    'u_world': drawingBufferSize,\n    'u_fill_translate': translate,\n});\n\nconst fillOutlinePatternUniformValues = (\n    painter: Painter,\n    crossfade: CrossfadeParameters,\n    tile: Tile,\n    drawingBufferSize: [number, number],\n    translate: [number, number]\n): UniformValues<FillOutlinePatternUniformsType> => extend(\n    fillPatternUniformValues(painter, crossfade, tile, translate),\n    {\n        'u_world': drawingBufferSize\n    }\n);\n\nexport {\n    fillUniforms,\n    fillPatternUniforms,\n    fillOutlineUniforms,\n    fillOutlinePatternUniforms,\n    fillUniformValues,\n    fillPatternUniformValues,\n    fillOutlineUniformValues,\n    fillOutlinePatternUniformValues\n};\n","import {Uniform1i, Uniform1f, Uniform2f} from '../uniform_binding.ts';\nimport {pixelsToTileUnits} from '../../source/pixels_to_tile_units.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {Tile} from '../../tile/tile.ts';\nimport type {CircleStyleLayer} from '../../style/style_layer/circle_style_layer.ts';\nimport type {Painter} from '../../render/painter.ts';\nimport {EXTENT} from '../../data/extent.ts';\n\nexport type CircleUniformsType = {\n    'u_camera_to_center_distance': Uniform1f;\n    'u_scale_with_map': Uniform1i;\n    'u_pitch_with_map': Uniform1i;\n    'u_extrude_scale': Uniform2f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_globe_extrude_scale': Uniform1f;\n    'u_translate': Uniform2f;\n};\n\nconst circleUniforms = (context: Context, locations: UniformLocations): CircleUniformsType => ({\n    'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n    'u_scale_with_map': new Uniform1i(context, locations.u_scale_with_map),\n    'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n    'u_extrude_scale': new Uniform2f(context, locations.u_extrude_scale),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_globe_extrude_scale': new Uniform1f(context, locations.u_globe_extrude_scale),\n    'u_translate': new Uniform2f(context, locations.u_translate),\n});\n\nconst circleUniformValues = (\n    painter: Painter,\n    tile: Tile,\n    layer: CircleStyleLayer,\n    translate: [number, number],\n    radiusCorrectionFactor: number\n): UniformValues<CircleUniformsType> => {\n    const transform = painter.transform;\n\n    let pitchWithMap: boolean, extrudeScale: [number, number];\n    let globeExtrudeScale: number = 0;\n    if (layer.paint.get('circle-pitch-alignment') === 'map') {\n        const pixelRatio = pixelsToTileUnits(tile, 1, transform.zoom);\n        pitchWithMap = true;\n        extrudeScale = [pixelRatio, pixelRatio];\n\n        // For globe rendering we need to know how much to extrude the circle as an *angle*.\n        // The calculation: (one pixel in tile units) / (earth circumference in tile units) * (2PI radians) * radiusCorrectionFactor\n        globeExtrudeScale = pixelRatio / (EXTENT * Math.pow(2, tile.tileID.overscaledZ)) * 2.0 * Math.PI * radiusCorrectionFactor;\n    } else {\n        pitchWithMap = false;\n        extrudeScale = transform.pixelsToGLUnits;\n    }\n\n    return {\n        'u_camera_to_center_distance': transform.cameraToCenterDistance,\n        'u_scale_with_map': +(layer.paint.get('circle-pitch-scale') === 'map'),\n        'u_pitch_with_map': +(pitchWithMap),\n        'u_device_pixel_ratio': painter.pixelRatio,\n        'u_extrude_scale': extrudeScale,\n        'u_globe_extrude_scale': globeExtrudeScale,\n        'u_translate': translate,\n    };\n};\n\nexport {circleUniforms, circleUniformValues};\n","import {Uniform2f} from '../uniform_binding.ts';\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {IReadonlyTransform} from '../../geo/transform_interface.ts';\n\nexport type CollisionUniformsType = {\n    'u_pixel_extrude_scale': Uniform2f;\n};\n\nexport type CollisionCircleUniformsType = {\n    'u_viewport_size': Uniform2f;\n};\n\nconst collisionUniforms = (context: Context, locations: UniformLocations): CollisionUniformsType => ({\n    'u_pixel_extrude_scale': new Uniform2f(context, locations.u_pixel_extrude_scale)\n});\n\nconst collisionCircleUniforms = (context: Context, locations: UniformLocations): CollisionCircleUniformsType => ({\n    'u_viewport_size': new Uniform2f(context, locations.u_viewport_size)\n});\n\nconst collisionUniformValues = (transform: {width: number; height: number}): UniformValues<CollisionUniformsType> => {\n    return {\n        'u_pixel_extrude_scale': [1.0 / transform.width, 1.0 / transform.height],\n    };\n};\n\nconst collisionCircleUniformValues = (transform: IReadonlyTransform): UniformValues<CollisionCircleUniformsType> => {\n    return {\n        'u_viewport_size': [transform.width, transform.height]\n    };\n};\n\nexport {collisionUniforms, collisionUniformValues, collisionCircleUniforms, collisionCircleUniformValues};\n","import {UniformColor, Uniform1i, Uniform1f} from '../uniform_binding.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {Color} from '@maplibre/maplibre-gl-style-spec';\n\nexport type DebugUniformsType = {\n    'u_color': UniformColor;\n    'u_overlay': Uniform1i;\n    'u_overlay_scale': Uniform1f;\n};\n\nconst debugUniforms = (context: Context, locations: UniformLocations): DebugUniformsType => ({\n    'u_color': new UniformColor(context, locations.u_color),\n    'u_overlay': new Uniform1i(context, locations.u_overlay),\n    'u_overlay_scale': new Uniform1f(context, locations.u_overlay_scale)\n});\n\nconst debugUniformValues = (color: Color, scaleRatio: number = 1): UniformValues<DebugUniformsType> => ({\n    'u_color': color,\n    'u_overlay': 0,\n    'u_overlay_scale': scaleRatio\n});\n\nexport {debugUniforms, debugUniformValues};\n","import {mat4} from 'gl-matrix';\n\nimport {\n    Uniform1i,\n    Uniform1f,\n    Uniform2f,\n    UniformMatrix4f\n} from '../uniform_binding.ts';\nimport {pixelsToTileUnits} from '../../source/pixels_to_tile_units.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {Tile} from '../../tile/tile.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {Painter} from '../../render/painter.ts';\nimport type {HeatmapStyleLayer} from '../../style/style_layer/heatmap_style_layer.ts';\nimport {EXTENT} from '../../data/extent.ts';\n\nexport type HeatmapUniformsType = {\n    'u_extrude_scale': Uniform1f;\n    'u_intensity': Uniform1f;\n    'u_globe_extrude_scale': Uniform1f;\n};\n\nexport type HeatmapTextureUniformsType = {\n    'u_matrix': UniformMatrix4f;\n    'u_world': Uniform2f;\n    'u_image': Uniform1i;\n    'u_color_ramp': Uniform1i;\n    'u_opacity': Uniform1f;\n};\n\nconst heatmapUniforms = (context: Context, locations: UniformLocations): HeatmapUniformsType => ({\n    'u_extrude_scale': new Uniform1f(context, locations.u_extrude_scale),\n    'u_intensity': new Uniform1f(context, locations.u_intensity),\n    'u_globe_extrude_scale': new Uniform1f(context, locations.u_globe_extrude_scale)\n});\n\nconst heatmapTextureUniforms = (context: Context, locations: UniformLocations): HeatmapTextureUniformsType => ({\n    'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n    'u_world': new Uniform2f(context, locations.u_world),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_color_ramp': new Uniform1i(context, locations.u_color_ramp),\n    'u_opacity': new Uniform1f(context, locations.u_opacity)\n});\n\nconst heatmapUniformValues = (tile: Tile, zoom: number, intensity: number, radiusCorrectionFactor: number): UniformValues<HeatmapUniformsType> => {\n    const pixelRatio = pixelsToTileUnits(tile, 1, zoom);\n    // See comment in circle_program.ts\n    const globeExtrudeScale = pixelRatio / (EXTENT * Math.pow(2, tile.tileID.overscaledZ)) * 2.0 * Math.PI * radiusCorrectionFactor;\n    return {\n        'u_extrude_scale': pixelsToTileUnits(tile, 1, zoom),\n        'u_intensity': intensity,\n        'u_globe_extrude_scale': globeExtrudeScale\n    };\n};\n\nconst heatmapTextureUniformValues = (\n    painter: Painter,\n    layer: HeatmapStyleLayer,\n    textureUnit: number,\n    colorRampUnit: number\n): UniformValues<HeatmapTextureUniformsType> => {\n    const matrix = mat4.create();\n    mat4.ortho(matrix, 0, painter.width, painter.height, 0, 0, 1);\n\n    const gl = painter.context.gl;\n\n    return {\n        'u_matrix': matrix,\n        'u_world': [gl.drawingBufferWidth, gl.drawingBufferHeight],\n        'u_image': textureUnit,\n        'u_color_ramp': colorRampUnit,\n        'u_opacity': layer.paint.get('heatmap-opacity')\n    };\n};\n\nexport {\n    heatmapUniforms,\n    heatmapTextureUniforms,\n    heatmapUniformValues,\n    heatmapTextureUniformValues\n};\n","import {mat4} from 'gl-matrix';\n\nimport {\n    Uniform1i,\n    Uniform1f,\n    Uniform2f,\n    UniformColor,\n    UniformFloatArray,\n    UniformColorArray,\n    UniformMatrix4f,\n    Uniform4f\n} from '../uniform_binding.ts';\nimport {EXTENT} from '../../data/extent.ts';\nimport {MercatorCoordinate} from '../../geo/mercator_coordinate.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {Tile} from '../../tile/tile.ts';\nimport type {Painter} from '../../render/painter.ts';\nimport type {HillshadeStyleLayer} from '../../style/style_layer/hillshade_style_layer.ts';\nimport type {DEMData} from '../../data/dem_data.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport type HillshadeUniformsType = {\n    'u_image': Uniform1i;\n    'u_latrange': Uniform2f;\n    'u_exaggeration': Uniform1f;\n    'u_altitudes': UniformFloatArray;\n    'u_azimuths': UniformFloatArray;\n    'u_accent': UniformColor;\n    'u_method': Uniform1i;\n    'u_shadows': UniformColorArray;\n    'u_highlights': UniformColorArray;\n};\n\nexport type HillshadePrepareUniformsType = {\n    'u_matrix': UniformMatrix4f;\n    'u_image': Uniform1i;\n    'u_dimension': Uniform2f;\n    'u_zoom': Uniform1f;\n    'u_unpack': Uniform4f;\n};\n\nconst hillshadeUniforms = (context: Context, locations: UniformLocations): HillshadeUniformsType => ({\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_latrange': new Uniform2f(context, locations.u_latrange),\n    'u_exaggeration': new Uniform1f(context, locations.u_exaggeration),\n    'u_altitudes': new UniformFloatArray(context, locations.u_altitudes),\n    'u_azimuths': new UniformFloatArray(context, locations.u_azimuths),\n    'u_accent': new UniformColor(context, locations.u_accent),\n    'u_method': new Uniform1i(context, locations.u_method),\n    'u_shadows': new UniformColorArray(context, locations.u_shadows),\n    'u_highlights': new UniformColorArray(context, locations.u_highlights)\n});\n\nconst hillshadePrepareUniforms = (context: Context, locations: UniformLocations): HillshadePrepareUniformsType => ({\n    'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_dimension': new Uniform2f(context, locations.u_dimension),\n    'u_zoom': new Uniform1f(context, locations.u_zoom),\n    'u_unpack': new Uniform4f(context, locations.u_unpack)\n});\n\nconst hillshadeUniformValues = (\n    painter: Painter,\n    tile: Tile,\n    layer: HillshadeStyleLayer,\n): UniformValues<HillshadeUniformsType> => {\n    const accent = layer.paint.get('hillshade-accent-color');\n    let method;\n    switch (layer.paint.get('hillshade-method')) {\n        case 'basic':\n            method = 4;\n            break;\n        case 'combined':\n            method = 1;\n            break;\n        case 'igor':\n            method = 2;\n            break;\n        case 'multidirectional':\n            method = 3;\n            break;\n        case 'standard':\n        default:\n            method = 0;\n            break;\n    }\n\n    const illumination = layer.getIlluminationProperties();\n\n    for (let i = 0; i < illumination.directionRadians.length; i++) {\n        // modify azimuthal angle by map rotation if light is anchored at the viewport\n        if (layer.paint.get('hillshade-illumination-anchor') === 'viewport') {\n            illumination.directionRadians[i] += painter.transform.bearingInRadians;\n        }\n    }\n    return {\n        'u_image': 0,\n        'u_latrange': getTileLatRange(painter, tile.tileID),\n        'u_exaggeration': layer.paint.get('hillshade-exaggeration'),\n        'u_altitudes': illumination.altitudeRadians,\n        'u_azimuths': illumination.directionRadians,\n        'u_accent': accent,\n        'u_method': method,\n        'u_highlights': illumination.highlightColor,\n        'u_shadows': illumination.shadowColor\n    };\n};\n\nconst hillshadeUniformPrepareValues = (tileID: OverscaledTileID, dem: DEMData): UniformValues<HillshadePrepareUniformsType> => {\n\n    const stride = dem.stride;\n    const matrix = mat4.create();\n    // Flip rendering at y axis.\n    mat4.ortho(matrix, 0, EXTENT, -EXTENT, 0, 0, 1);\n    mat4.translate(matrix, matrix, [0, -EXTENT, 0]);\n\n    return {\n        'u_matrix': matrix,\n        'u_image': 1,\n        'u_dimension': [stride, stride],\n        'u_zoom': tileID.overscaledZ,\n        'u_unpack': dem.getUnpackVector()\n    };\n};\n\nfunction getTileLatRange(painter: Painter, tileID: OverscaledTileID) {\n    // for scaling the magnitude of a points slope by its latitude\n    const tilesAtZoom = Math.pow(2, tileID.canonical.z);\n    const y = tileID.canonical.y;\n    return [\n        new MercatorCoordinate(0, y / tilesAtZoom).toLngLat().lat,\n        new MercatorCoordinate(0, (y + 1) / tilesAtZoom).toLngLat().lat];\n}\n\nexport {\n    hillshadeUniforms,\n    hillshadePrepareUniforms,\n    hillshadeUniformValues,\n    hillshadeUniformPrepareValues\n};\n","import {\n    Uniform1i,\n    Uniform1f,\n    Uniform2f,\n    Uniform4f\n} from '../uniform_binding.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {ColorReliefStyleLayer} from '../../style/style_layer/color_relief_style_layer.ts';\nimport type {DEMData} from '../../data/dem_data.ts';\n\nexport type ColorReliefUniformsType = {\n    'u_image': Uniform1i;\n    'u_unpack': Uniform4f;\n    'u_dimension': Uniform2f;\n    'u_elevation_stops': Uniform1i;\n    'u_color_stops': Uniform1i;\n    'u_color_ramp_size': Uniform1i;\n    'u_opacity': Uniform1f;\n};\n\nconst colorReliefUniforms = (context: Context, locations: UniformLocations): ColorReliefUniformsType => ({\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_unpack': new Uniform4f(context, locations.u_unpack),\n    'u_dimension': new Uniform2f(context, locations.u_dimension),\n    'u_elevation_stops': new Uniform1i(context, locations.u_elevation_stops),\n    'u_color_stops': new Uniform1i(context, locations.u_color_stops),\n    'u_color_ramp_size': new Uniform1i(context, locations.u_color_ramp_size),\n    'u_opacity': new Uniform1f(context, locations.u_opacity)\n});\n\nconst colorReliefUniformValues = (\n    layer: ColorReliefStyleLayer,\n    dem: DEMData,\n    colorRampSize: number = 0\n): UniformValues<ColorReliefUniformsType> => {\n\n    return {\n        'u_image': 0,\n        'u_unpack': dem.getUnpackVector(),\n        'u_dimension': [dem.stride, dem.stride],\n        'u_elevation_stops': 1,\n        'u_color_stops': 4,\n        'u_color_ramp_size': colorRampSize,\n        'u_opacity': layer.paint.get('color-relief-opacity')\n    };\n};\n\nexport {\n    colorReliefUniforms,\n    colorReliefUniformValues,\n};\n","import {Uniform1i, Uniform1f, Uniform2f, Uniform3f} from '../uniform_binding.ts';\nimport {pixelsToTileUnits} from '../../source/pixels_to_tile_units.ts';\nimport {extend, translatePosition} from '../../util/util.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {IReadonlyTransform} from '../../geo/transform_interface.ts';\nimport type {Tile} from '../../tile/tile.ts';\nimport type {LineStyleLayer} from '../../style/style_layer/line_style_layer.ts';\nimport type {Painter} from '../../render/painter.ts';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters.ts';\n\nexport type LineUniformsType = {\n    'u_translation': Uniform2f;\n    'u_ratio': Uniform1f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_units_to_pixels': Uniform2f;\n};\n\nexport type LineGradientUniformsType = {\n    'u_translation': Uniform2f;\n    'u_ratio': Uniform1f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_units_to_pixels': Uniform2f;\n    'u_image': Uniform1i;\n    'u_image_height': Uniform1f;\n};\n\nexport type LinePatternUniformsType = {\n    'u_translation': Uniform2f;\n    'u_texsize': Uniform2f;\n    'u_ratio': Uniform1f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_units_to_pixels': Uniform2f;\n    'u_image': Uniform1i;\n    'u_scale': Uniform3f;\n    'u_fade': Uniform1f;\n};\n\nexport type LineSDFUniformsType = {\n    'u_translation': Uniform2f;\n    'u_ratio': Uniform1f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_units_to_pixels': Uniform2f;\n    'u_tileratio': Uniform1f;\n    'u_crossfade_from': Uniform1f;\n    'u_crossfade_to': Uniform1f;\n    'u_image': Uniform1i;\n    'u_mix': Uniform1f;\n    'u_lineatlas_width': Uniform1f;\n    'u_lineatlas_height': Uniform1f;\n};\n\nexport type LineGradientSDFUniformsType = {\n    'u_translation': Uniform2f;\n    'u_ratio': Uniform1f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_units_to_pixels': Uniform2f;\n    'u_image': Uniform1i;\n    'u_image_height': Uniform1f;\n    'u_tileratio': Uniform1f;\n    'u_crossfade_from': Uniform1f;\n    'u_crossfade_to': Uniform1f;\n    'u_image_dash': Uniform1i;\n    'u_mix': Uniform1f;\n    'u_lineatlas_width': Uniform1f;\n    'u_lineatlas_height': Uniform1f;\n};\n\nconst lineUniforms = (context: Context, locations: UniformLocations): LineUniformsType => ({\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_ratio': new Uniform1f(context, locations.u_ratio),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels)\n});\n\nconst lineGradientUniforms = (context: Context, locations: UniformLocations): LineGradientUniformsType => ({\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_ratio': new Uniform1f(context, locations.u_ratio),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_image_height': new Uniform1f(context, locations.u_image_height)\n});\n\nconst linePatternUniforms = (context: Context, locations: UniformLocations): LinePatternUniformsType => ({\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_ratio': new Uniform1f(context, locations.u_ratio),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels),\n    'u_scale': new Uniform3f(context, locations.u_scale),\n    'u_fade': new Uniform1f(context, locations.u_fade)\n});\n\nconst lineSDFUniforms = (context: Context, locations: UniformLocations): LineSDFUniformsType => ({\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_ratio': new Uniform1f(context, locations.u_ratio),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_mix': new Uniform1f(context, locations.u_mix),\n    'u_tileratio': new Uniform1f(context, locations.u_tileratio),\n    'u_crossfade_from': new Uniform1f(context, locations.u_crossfade_from),\n    'u_crossfade_to': new Uniform1f(context, locations.u_crossfade_to),\n    'u_lineatlas_width': new Uniform1f(context, locations.u_lineatlas_width),\n    'u_lineatlas_height': new Uniform1f(context, locations.u_lineatlas_height)\n});\n\nconst lineGradientSDFUniforms = (context: Context, locations: UniformLocations): LineGradientSDFUniformsType => ({\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_ratio': new Uniform1f(context, locations.u_ratio),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_image_height': new Uniform1f(context, locations.u_image_height),\n    'u_tileratio': new Uniform1f(context, locations.u_tileratio),\n    'u_crossfade_from': new Uniform1f(context, locations.u_crossfade_from),\n    'u_crossfade_to': new Uniform1f(context, locations.u_crossfade_to),\n    'u_image_dash': new Uniform1i(context, locations.u_image_dash),\n    'u_mix': new Uniform1f(context, locations.u_mix),\n    'u_lineatlas_width': new Uniform1f(context, locations.u_lineatlas_width),\n    'u_lineatlas_height': new Uniform1f(context, locations.u_lineatlas_height)\n});\n\nconst lineUniformValues = (\n    painter: Painter,\n    tile: Tile,\n    layer: LineStyleLayer,\n    ratioScale: number,\n): UniformValues<LineUniformsType> => {\n    const transform = painter.transform;\n\n    return {\n        'u_translation': calculateTranslation(painter, tile, layer),\n        'u_ratio': ratioScale / pixelsToTileUnits(tile, 1, transform.zoom),\n        'u_device_pixel_ratio': painter.pixelRatio,\n        'u_units_to_pixels': [\n            1 / transform.pixelsToGLUnits[0],\n            1 / transform.pixelsToGLUnits[1]\n        ]\n    };\n};\n\nconst lineGradientUniformValues = (\n    painter: Painter,\n    tile: Tile,\n    layer: LineStyleLayer,\n    ratioScale: number,\n    imageHeight: number,\n): UniformValues<LineGradientUniformsType> => {\n    return extend(lineUniformValues(painter, tile, layer, ratioScale), {\n        'u_image': 0,\n        'u_image_height': imageHeight,\n    });\n};\n\nconst linePatternUniformValues = (\n    painter: Painter,\n    tile: Tile,\n    layer: LineStyleLayer,\n    ratioScale: number,\n    crossfade: CrossfadeParameters,\n): UniformValues<LinePatternUniformsType> => {\n    const transform = painter.transform;\n    const tileZoomRatio = calculateTileRatio(tile, transform);\n    return {\n        'u_translation': calculateTranslation(painter, tile, layer),\n        'u_texsize': tile.imageAtlasTexture.size,\n        // camera zoom ratio\n        'u_ratio': ratioScale / pixelsToTileUnits(tile, 1, transform.zoom),\n        'u_device_pixel_ratio': painter.pixelRatio,\n        'u_image': 0,\n        'u_scale': [tileZoomRatio, crossfade.fromScale, crossfade.toScale],\n        'u_fade': crossfade.t,\n        'u_units_to_pixels': [\n            1 / transform.pixelsToGLUnits[0],\n            1 / transform.pixelsToGLUnits[1]\n        ]\n    };\n};\n\nconst lineSDFUniformValues = (\n    painter: Painter,\n    tile: Tile,\n    layer: LineStyleLayer,\n    ratioScale: number,\n    crossfade: CrossfadeParameters,\n): UniformValues<LineSDFUniformsType> => {\n    const transform = painter.transform;\n    const tileRatio = calculateTileRatio(tile, transform);\n\n    return extend(lineUniformValues(painter, tile, layer, ratioScale), {\n        'u_tileratio': tileRatio,\n        'u_crossfade_from': crossfade.fromScale,\n        'u_crossfade_to': crossfade.toScale,\n        'u_image': 0,\n        'u_mix': crossfade.t,\n        'u_lineatlas_width': painter.lineAtlas.width,\n        'u_lineatlas_height': painter.lineAtlas.height,\n    });\n};\n\nconst lineGradientSDFUniformValues = (\n    painter: Painter,\n    tile: Tile,\n    layer: LineStyleLayer,\n    ratioScale: number,\n    crossfade: CrossfadeParameters,\n    imageHeight: number,\n): UniformValues<LineGradientSDFUniformsType> => {\n    const transform = painter.transform;\n    const tileRatio = calculateTileRatio(tile, transform);\n\n    return extend(lineUniformValues(painter, tile, layer, ratioScale), {\n        'u_image': 0,\n        'u_image_height': imageHeight,\n        'u_tileratio': tileRatio,\n        'u_crossfade_from': crossfade.fromScale,\n        'u_crossfade_to': crossfade.toScale,\n        'u_image_dash': 1,\n        'u_mix': crossfade.t,\n        'u_lineatlas_width': painter.lineAtlas.width,\n        'u_lineatlas_height': painter.lineAtlas.height,\n    });\n};\n\nfunction calculateTileRatio(tile: Tile, transform: IReadonlyTransform) {\n    return 1 / pixelsToTileUnits(tile, 1, transform.tileZoom);\n}\n\nfunction calculateTranslation(painter: Painter, tile: Tile, layer: LineStyleLayer): [number, number] {\n    // Translate line points prior to any transformation\n    return translatePosition(\n        painter.transform,\n        tile,\n        layer.paint.get('line-translate'),\n        layer.paint.get('line-translate-anchor')\n    );\n}\n\nexport {\n    lineUniforms,\n    lineGradientUniforms,\n    linePatternUniforms,\n    lineSDFUniforms,\n    lineGradientSDFUniforms,\n    lineUniformValues,\n    lineGradientUniformValues,\n    linePatternUniformValues,\n    lineSDFUniformValues,\n    lineGradientSDFUniformValues\n};\n","import {Uniform1i, Uniform1f} from '../uniform_binding.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\n\nexport type LayerOpacityUniformsType = {\n    'u_image': Uniform1i;\n    'u_opacity': Uniform1f;\n};\n\nexport const layerOpacityUniforms = (context: Context, locations: UniformLocations): LayerOpacityUniformsType => ({\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_opacity': new Uniform1f(context, locations.u_opacity)\n});\n\nexport const layerOpacityUniformValues = (\n    opacity: number,\n    textureUnit: number\n): UniformValues<LayerOpacityUniformsType> => ({\n    'u_image': textureUnit,\n    'u_opacity': opacity\n});\n","import {Uniform1i, Uniform1f, Uniform2f, Uniform3f, Uniform4f} from '../uniform_binding.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {RasterStyleLayer} from '../../style/style_layer/raster_style_layer.ts';\nimport type Point from '@mapbox/point-geometry';\n\nexport type RasterUniformsType = {\n    'u_tl_parent': Uniform2f;\n    'u_scale_parent': Uniform1f;\n    'u_buffer_scale': Uniform1f;\n    'u_fade_t': Uniform1f;\n    'u_opacity': Uniform1f;\n    'u_image0': Uniform1i;\n    'u_image1': Uniform1i;\n    'u_brightness_low': Uniform1f;\n    'u_brightness_high': Uniform1f;\n    'u_saturation_factor': Uniform1f;\n    'u_contrast_factor': Uniform1f;\n    'u_spin_weights': Uniform3f;\n    'u_coords_top': Uniform4f;\n    'u_coords_bottom': Uniform4f;\n};\n\nconst rasterUniforms = (context: Context, locations: UniformLocations): RasterUniformsType => ({\n    'u_tl_parent': new Uniform2f(context, locations.u_tl_parent),\n    'u_scale_parent': new Uniform1f(context, locations.u_scale_parent),\n    'u_buffer_scale': new Uniform1f(context, locations.u_buffer_scale),\n    'u_fade_t': new Uniform1f(context, locations.u_fade_t),\n    'u_opacity': new Uniform1f(context, locations.u_opacity),\n    'u_image0': new Uniform1i(context, locations.u_image0),\n    'u_image1': new Uniform1i(context, locations.u_image1),\n    'u_brightness_low': new Uniform1f(context, locations.u_brightness_low),\n    'u_brightness_high': new Uniform1f(context, locations.u_brightness_high),\n    'u_saturation_factor': new Uniform1f(context, locations.u_saturation_factor),\n    'u_contrast_factor': new Uniform1f(context, locations.u_contrast_factor),\n    'u_spin_weights': new Uniform3f(context, locations.u_spin_weights),\n    'u_coords_top': new Uniform4f(context, locations.u_coords_top),\n    'u_coords_bottom': new Uniform4f(context, locations.u_coords_bottom)\n});\n\nconst rasterUniformValues = (\n    parentTL: [number, number],\n    parentScaleBy: number,\n    fade: {\n        mix: number;\n        opacity: number;\n    },\n    layer: RasterStyleLayer,\n    cornerCoords: Point[],\n): UniformValues<RasterUniformsType> => ({\n    'u_tl_parent': parentTL,\n    'u_scale_parent': parentScaleBy,\n    // If u_buffer_scale is ever something else than a constant 1,\n    // the north/south pole handling in the vertex shader might need modification\n    // so that the texture coordinares for poles always lie beyond the edge of the texture.\n    // Right now the coordinates are placed right at the texture border.\n    'u_buffer_scale': 1,\n    'u_fade_t': fade.mix,\n    'u_opacity': fade.opacity * layer.paint.get('raster-opacity'),\n    'u_image0': 0,\n    'u_image1': 1,\n    'u_brightness_low': layer.paint.get('raster-brightness-min'),\n    'u_brightness_high': layer.paint.get('raster-brightness-max'),\n    'u_saturation_factor': saturationFactor(layer.paint.get('raster-saturation')),\n    'u_contrast_factor': contrastFactor(layer.paint.get('raster-contrast')),\n    'u_spin_weights': spinWeights(layer.paint.get('raster-hue-rotate')),\n    'u_coords_top': [cornerCoords[0].x, cornerCoords[0].y, cornerCoords[1].x, cornerCoords[1].y],\n    'u_coords_bottom': [cornerCoords[3].x, cornerCoords[3].y, cornerCoords[2].x, cornerCoords[2].y]\n});\n\nfunction spinWeights(angle) {\n    angle *= Math.PI / 180;\n    const s = Math.sin(angle);\n    const c = Math.cos(angle);\n    return [\n        (2 * c + 1) / 3,\n        (-Math.sqrt(3) * s - c + 1) / 3,\n        (Math.sqrt(3) * s - c + 1) / 3\n    ];\n}\n\nfunction contrastFactor(contrast) {\n    return contrast > 0 ?\n        1 / (1 - contrast) :\n        1 + contrast;\n}\n\nfunction saturationFactor(saturation) {\n    return saturation > 0 ?\n        1 - 1 / (1.001 - saturation) :\n        -saturation;\n}\n\nexport {rasterUniforms, rasterUniformValues};\n","import {Uniform1i, Uniform1f, Uniform2f, UniformMatrix4f} from '../uniform_binding.ts';\nimport {extend} from '../../util/util.ts';\n\nimport type {Context} from '../../webgl/context.ts';\nimport type {Painter} from '../../render/painter.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport {type mat4} from 'gl-matrix';\n\nexport type SymbolIconUniformsType = {\n    'u_is_size_zoom_constant': Uniform1i;\n    'u_is_size_feature_constant': Uniform1i;\n    'u_size_t': Uniform1f;\n    'u_size': Uniform1f;\n    'u_camera_to_center_distance': Uniform1f;\n    'u_pitch': Uniform1f;\n    'u_rotate_symbol': Uniform1i;\n    'u_aspect_ratio': Uniform1f;\n    'u_fade_change': Uniform1f;\n    'u_label_plane_matrix': UniformMatrix4f;\n    'u_coord_matrix': UniformMatrix4f;\n    'u_is_text': Uniform1i;\n    'u_pitch_with_map': Uniform1i;\n    'u_is_along_line': Uniform1i;\n    'u_is_variable_anchor': Uniform1i;\n    'u_texsize': Uniform2f;\n    'u_texture': Uniform1i;\n    'u_translation': Uniform2f;\n    'u_pitched_scale': Uniform1f;\n    'u_is_offset': Uniform1i;\n};\n\nexport type SymbolSDFUniformsType = {\n    'u_is_size_zoom_constant': Uniform1i;\n    'u_is_size_feature_constant': Uniform1i;\n    'u_size_t': Uniform1f;\n    'u_size': Uniform1f;\n    'u_camera_to_center_distance': Uniform1f;\n    'u_pitch': Uniform1f;\n    'u_rotate_symbol': Uniform1i;\n    'u_aspect_ratio': Uniform1f;\n    'u_fade_change': Uniform1f;\n    'u_label_plane_matrix': UniformMatrix4f;\n    'u_coord_matrix': UniformMatrix4f;\n    'u_is_text': Uniform1i;\n    'u_pitch_with_map': Uniform1i;\n    'u_is_along_line': Uniform1i;\n    'u_is_variable_anchor': Uniform1i;\n    'u_texsize': Uniform2f;\n    'u_texture': Uniform1i;\n    'u_gamma_scale': Uniform1f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_is_halo': Uniform1i;\n    'u_is_plain': Uniform1i;\n    'u_translation': Uniform2f;\n    'u_pitched_scale': Uniform1f;\n    'u_is_offset': Uniform1i;\n};\n\nexport type symbolTextAndIconUniformsType = {\n    'u_is_size_zoom_constant': Uniform1i;\n    'u_is_size_feature_constant': Uniform1i;\n    'u_size_t': Uniform1f;\n    'u_size': Uniform1f;\n    'u_camera_to_center_distance': Uniform1f;\n    'u_pitch': Uniform1f;\n    'u_rotate_symbol': Uniform1i;\n    'u_aspect_ratio': Uniform1f;\n    'u_fade_change': Uniform1f;\n    'u_label_plane_matrix': UniformMatrix4f;\n    'u_coord_matrix': UniformMatrix4f;\n    'u_is_text': Uniform1i;\n    'u_pitch_with_map': Uniform1i;\n    'u_is_along_line': Uniform1i;\n    'u_is_variable_anchor': Uniform1i;\n    'u_texsize': Uniform2f;\n    'u_texsize_icon': Uniform2f;\n    'u_texture': Uniform1i;\n    'u_texture_icon': Uniform1i;\n    'u_gamma_scale': Uniform1f;\n    'u_device_pixel_ratio': Uniform1f;\n    'u_is_halo': Uniform1i;\n    'u_translation': Uniform2f;\n    'u_pitched_scale': Uniform1f;\n    'u_is_offset': Uniform1i;\n};\n\nconst symbolIconUniforms = (context: Context, locations: UniformLocations): SymbolIconUniformsType => ({\n    'u_is_size_zoom_constant': new Uniform1i(context, locations.u_is_size_zoom_constant),\n    'u_is_size_feature_constant': new Uniform1i(context, locations.u_is_size_feature_constant),\n    'u_size_t': new Uniform1f(context, locations.u_size_t),\n    'u_size': new Uniform1f(context, locations.u_size),\n    'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n    'u_pitch': new Uniform1f(context, locations.u_pitch),\n    'u_rotate_symbol': new Uniform1i(context, locations.u_rotate_symbol),\n    'u_aspect_ratio': new Uniform1f(context, locations.u_aspect_ratio),\n    'u_fade_change': new Uniform1f(context, locations.u_fade_change),\n    'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),\n    'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),\n    'u_is_text': new Uniform1i(context, locations.u_is_text),\n    'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n    'u_is_along_line': new Uniform1i(context, locations.u_is_along_line),\n    'u_is_variable_anchor': new Uniform1i(context, locations.u_is_variable_anchor),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_texture': new Uniform1i(context, locations.u_texture),\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_pitched_scale': new Uniform1f(context, locations.u_pitched_scale),\n    'u_is_offset': new Uniform1i(context, locations.u_is_offset),\n});\n\nconst symbolSDFUniforms = (context: Context, locations: UniformLocations): SymbolSDFUniformsType => ({\n    'u_is_size_zoom_constant': new Uniform1i(context, locations.u_is_size_zoom_constant),\n    'u_is_size_feature_constant': new Uniform1i(context, locations.u_is_size_feature_constant),\n    'u_size_t': new Uniform1f(context, locations.u_size_t),\n    'u_size': new Uniform1f(context, locations.u_size),\n    'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n    'u_pitch': new Uniform1f(context, locations.u_pitch),\n    'u_rotate_symbol': new Uniform1i(context, locations.u_rotate_symbol),\n    'u_aspect_ratio': new Uniform1f(context, locations.u_aspect_ratio),\n    'u_fade_change': new Uniform1f(context, locations.u_fade_change),\n    'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),\n    'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),\n    'u_is_text': new Uniform1i(context, locations.u_is_text),\n    'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n    'u_is_along_line': new Uniform1i(context, locations.u_is_along_line),\n    'u_is_variable_anchor': new Uniform1i(context, locations.u_is_variable_anchor),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_texture': new Uniform1i(context, locations.u_texture),\n    'u_gamma_scale': new Uniform1f(context, locations.u_gamma_scale),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_is_halo': new Uniform1i(context, locations.u_is_halo),\n    'u_is_plain': new Uniform1i(context, locations.u_is_plain),\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_pitched_scale': new Uniform1f(context, locations.u_pitched_scale),\n    'u_is_offset': new Uniform1i(context, locations.u_is_offset),\n});\n\nconst symbolTextAndIconUniforms = (context: Context, locations: UniformLocations): symbolTextAndIconUniformsType => ({\n    'u_is_size_zoom_constant': new Uniform1i(context, locations.u_is_size_zoom_constant),\n    'u_is_size_feature_constant': new Uniform1i(context, locations.u_is_size_feature_constant),\n    'u_size_t': new Uniform1f(context, locations.u_size_t),\n    'u_size': new Uniform1f(context, locations.u_size),\n    'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n    'u_pitch': new Uniform1f(context, locations.u_pitch),\n    'u_rotate_symbol': new Uniform1i(context, locations.u_rotate_symbol),\n    'u_aspect_ratio': new Uniform1f(context, locations.u_aspect_ratio),\n    'u_fade_change': new Uniform1f(context, locations.u_fade_change),\n    'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),\n    'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),\n    'u_is_text': new Uniform1i(context, locations.u_is_text),\n    'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n    'u_is_along_line': new Uniform1i(context, locations.u_is_along_line),\n    'u_is_variable_anchor': new Uniform1i(context, locations.u_is_variable_anchor),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_texsize_icon': new Uniform2f(context, locations.u_texsize_icon),\n    'u_texture': new Uniform1i(context, locations.u_texture),\n    'u_texture_icon': new Uniform1i(context, locations.u_texture_icon),\n    'u_gamma_scale': new Uniform1f(context, locations.u_gamma_scale),\n    'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n    'u_is_halo': new Uniform1i(context, locations.u_is_halo),\n    'u_translation': new Uniform2f(context, locations.u_translation),\n    'u_pitched_scale': new Uniform1f(context, locations.u_pitched_scale),\n    'u_is_offset': new Uniform1i(context, locations.u_is_offset),\n});\n\nconst symbolIconUniformValues = (\n    functionType: string,\n    size: {\n        uSizeT: number;\n        uSize: number;\n    },\n    rotateInShader: boolean,\n    pitchWithMap: boolean,\n    isAlongLine: boolean,\n    isVariableAnchor: boolean,\n    painter: Painter,\n    labelPlaneMatrix: mat4,\n    glCoordMatrix: mat4,\n    translation: [number, number],\n    isText: boolean,\n    texSize: [number, number],\n    pitchedScale: number,\n    isOffset: boolean\n): UniformValues<SymbolIconUniformsType> => {\n    const transform = painter.transform;\n\n    return {\n        'u_is_size_zoom_constant': +(functionType === 'constant' || functionType === 'source'),\n        'u_is_size_feature_constant': +(functionType === 'constant' || functionType === 'camera'),\n        'u_size_t': size ? size.uSizeT : 0,\n        'u_size': size ? size.uSize : 0,\n        'u_camera_to_center_distance': transform.cameraToCenterDistance,\n        'u_pitch': transform.pitch / 360 * 2 * Math.PI,\n        'u_rotate_symbol': +rotateInShader,\n        'u_aspect_ratio': transform.width / transform.height,\n        'u_fade_change': painter.options.fadeDuration ? painter.symbolFadeChange : 1,\n        'u_label_plane_matrix': labelPlaneMatrix,\n        'u_coord_matrix': glCoordMatrix,\n        'u_is_text': +isText,\n        'u_pitch_with_map': +pitchWithMap,\n        'u_is_along_line': isAlongLine,\n        'u_is_variable_anchor': isVariableAnchor,\n        'u_texsize': texSize,\n        'u_texture': 0,\n        'u_translation': translation,\n        'u_pitched_scale': pitchedScale,\n        'u_is_offset': isOffset,\n    };\n};\n\nconst symbolSDFUniformValues = (\n    functionType: string,\n    size: {\n        uSizeT: number;\n        uSize: number;\n    },\n    rotateInShader: boolean,\n    pitchWithMap: boolean,\n    isAlongLine: boolean,\n    isVariableAnchor: boolean,\n    painter: Painter,\n    labelPlaneMatrix: mat4,\n    glCoordMatrix: mat4,\n    translation: [number, number],\n    isText: boolean,\n    texSize: [number, number],\n    isHalo: boolean,\n    pitchedScale: number,\n    isOffset: boolean\n): UniformValues<SymbolSDFUniformsType> => {\n    const transform = painter.transform;\n\n    return extend(symbolIconUniformValues(functionType, size,\n        rotateInShader, pitchWithMap, isAlongLine, isVariableAnchor, painter, labelPlaneMatrix,\n        glCoordMatrix, translation, isText, texSize, pitchedScale, isOffset), {\n        'u_gamma_scale': (pitchWithMap ? Math.cos(transform.pitch * Math.PI / 180.0) * transform.cameraToCenterDistance : 1),\n        'u_device_pixel_ratio': painter.pixelRatio,\n        'u_is_halo': isHalo ? 1 : 0,\n        'u_is_plain': 1\n    });\n};\n\nconst symbolTextAndIconUniformValues = (\n    functionType: string,\n    size: {\n        uSizeT: number;\n        uSize: number;\n    },\n    rotateInShader: boolean,\n    pitchWithMap: boolean,\n    isAlongLine: boolean,\n    isVariableAnchor: boolean,\n    painter: Painter,\n    labelPlaneMatrix: mat4,\n    glCoordMatrix: mat4,\n    translation: [number, number],\n    texSizeSDF: [number, number],\n    texSizeIcon: [number, number],\n    pitchedScale: number,\n    isOffset: boolean        \n): UniformValues<SymbolIconUniformsType> => {\n    return extend(symbolSDFUniformValues(functionType, size,\n        rotateInShader, pitchWithMap, isAlongLine, isVariableAnchor, painter, labelPlaneMatrix,\n        glCoordMatrix, translation, true, texSizeSDF, true, pitchedScale, isOffset), {\n        'u_texsize_icon': texSizeIcon,\n        'u_texture_icon': 1\n    });\n};\n\nexport {symbolIconUniforms, symbolSDFUniforms, symbolIconUniformValues, symbolSDFUniformValues, symbolTextAndIconUniformValues, symbolTextAndIconUniforms};\n","import {bgPatternUniformValues} from './pattern.ts';\nimport {\n    Uniform1i,\n    Uniform1f,\n    Uniform2f,\n    UniformColor\n} from '../uniform_binding.ts';\nimport {extend} from '../../util/util.ts';\n\nimport type {Painter} from '../../render/painter.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport type {Context} from '../../webgl/context.ts';\nimport type {Color, ResolvedImage} from '@maplibre/maplibre-gl-style-spec';\nimport type {CrossFaded} from '../../style/properties.ts';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport type BackgroundUniformsType = {\n    'u_opacity': Uniform1f;\n    'u_color': UniformColor;\n};\n\nexport type BackgroundPatternUniformsType = {\n    'u_opacity': Uniform1f;\n    // pattern uniforms:\n    'u_image': Uniform1i;\n    'u_pattern_tl_a': Uniform2f;\n    'u_pattern_br_a': Uniform2f;\n    'u_pattern_tl_b': Uniform2f;\n    'u_pattern_br_b': Uniform2f;\n    'u_texsize': Uniform2f;\n    'u_mix': Uniform1f;\n    'u_pattern_size_a': Uniform2f;\n    'u_pattern_size_b': Uniform2f;\n    'u_scale_a': Uniform1f;\n    'u_scale_b': Uniform1f;\n    'u_pixel_coord_upper': Uniform2f;\n    'u_pixel_coord_lower': Uniform2f;\n    'u_tile_units_to_pixels': Uniform1f;\n};\n\nconst backgroundUniforms = (context: Context, locations: UniformLocations): BackgroundUniformsType => ({\n    'u_opacity': new Uniform1f(context, locations.u_opacity),\n    'u_color': new UniformColor(context, locations.u_color)\n});\n\nconst backgroundPatternUniforms = (context: Context, locations: UniformLocations): BackgroundPatternUniformsType => ({\n    'u_opacity': new Uniform1f(context, locations.u_opacity),\n    'u_image': new Uniform1i(context, locations.u_image),\n    'u_pattern_tl_a': new Uniform2f(context, locations.u_pattern_tl_a),\n    'u_pattern_br_a': new Uniform2f(context, locations.u_pattern_br_a),\n    'u_pattern_tl_b': new Uniform2f(context, locations.u_pattern_tl_b),\n    'u_pattern_br_b': new Uniform2f(context, locations.u_pattern_br_b),\n    'u_texsize': new Uniform2f(context, locations.u_texsize),\n    'u_mix': new Uniform1f(context, locations.u_mix),\n    'u_pattern_size_a': new Uniform2f(context, locations.u_pattern_size_a),\n    'u_pattern_size_b': new Uniform2f(context, locations.u_pattern_size_b),\n    'u_scale_a': new Uniform1f(context, locations.u_scale_a),\n    'u_scale_b': new Uniform1f(context, locations.u_scale_b),\n    'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n    'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n    'u_tile_units_to_pixels': new Uniform1f(context, locations.u_tile_units_to_pixels)\n});\n\nconst backgroundUniformValues = (opacity: number, color: Color): UniformValues<BackgroundUniformsType> => ({\n    'u_opacity': opacity,\n    'u_color': color\n});\n\nconst backgroundPatternUniformValues = (\n    opacity: number,\n    painter: Painter,\n    image: CrossFaded<ResolvedImage>,\n    tile: {\n        tileID: OverscaledTileID;\n        tileSize: number;\n    },\n    crossfade: CrossfadeParameters\n): UniformValues<BackgroundPatternUniformsType> => extend(\n    bgPatternUniformValues(image, crossfade, painter, tile),\n    {\n        'u_opacity': opacity\n    }\n);\n\nexport {\n    backgroundUniforms,\n    backgroundPatternUniforms,\n    backgroundUniformValues,\n    backgroundPatternUniformValues\n};\n","import type {Context} from '../../webgl/context.ts';\nimport {type UniformValues, type UniformLocations, Uniform1f, Uniform3f, UniformMatrix4f} from '../uniform_binding.ts';\nimport {type mat4, type vec3} from 'gl-matrix';\n\nexport type atmosphereUniformsType = {\n    'u_sun_pos': Uniform3f;\n    'u_atmosphere_blend': Uniform1f;\n    'u_globe_position': Uniform3f;\n    'u_globe_radius': Uniform1f;\n    'u_inv_proj_matrix': UniformMatrix4f;\n};\n\nconst atmosphereUniforms = (context: Context, locations: UniformLocations): atmosphereUniformsType => ({\n    'u_sun_pos': new Uniform3f(context, locations.u_sun_pos),\n    'u_atmosphere_blend': new Uniform1f(context, locations.u_atmosphere_blend),\n    'u_globe_position': new Uniform3f(context, locations.u_globe_position),\n    'u_globe_radius': new Uniform1f(context, locations.u_globe_radius),\n    'u_inv_proj_matrix': new UniformMatrix4f(context, locations.u_inv_proj_matrix),\n});\n\nconst atmosphereUniformValues = (\n    sunPos: vec3,\n    atmosphereBlend: number,\n    globePosition: vec3,\n    globeRadius: number,\n    invProjMatrix: mat4,\n): UniformValues<atmosphereUniformsType> => ({\n    'u_sun_pos': sunPos,\n    'u_atmosphere_blend': atmosphereBlend,\n    'u_globe_position': globePosition,\n    'u_globe_radius': globeRadius,\n    'u_inv_proj_matrix': invProjMatrix,\n});\n\nexport {atmosphereUniforms, atmosphereUniformValues};\n","import {UniformColor, Uniform1f, Uniform2f} from '../uniform_binding.ts';\nimport type {Context} from '../../webgl/context.ts';\nimport type {UniformValues, UniformLocations} from '../uniform_binding.ts';\nimport {type IReadonlyTransform} from '../../geo/transform_interface.ts';\nimport {type Sky} from '../../style/sky.ts';\nimport {getMercatorHorizon} from '../../geo/projection/mercator_utils.ts';\n\nexport type SkyUniformsType = {\n    'u_sky_color': UniformColor;\n    'u_horizon_color': UniformColor;\n    'u_horizon': Uniform2f;\n    'u_horizon_normal': Uniform2f;\n    'u_sky_horizon_blend': Uniform1f;\n    'u_sky_blend': Uniform1f;\n};\n\nconst skyUniforms = (context: Context, locations: UniformLocations): SkyUniformsType => ({\n    'u_sky_color': new UniformColor(context, locations.u_sky_color),\n    'u_horizon_color': new UniformColor(context, locations.u_horizon_color),\n    'u_horizon': new Uniform2f(context, locations.u_horizon),\n    'u_horizon_normal': new Uniform2f(context, locations.u_horizon_normal),\n    'u_sky_horizon_blend': new Uniform1f(context, locations.u_sky_horizon_blend),\n    'u_sky_blend': new Uniform1f(context, locations.u_sky_blend),\n});\n\nconst skyUniformValues = (sky: Sky, transform: IReadonlyTransform, pixelRatio: number): UniformValues<SkyUniformsType> => {\n    const cosRoll = Math.cos(transform.rollInRadians);\n    const sinRoll = Math.sin(transform.rollInRadians);\n    const mercatorHorizon  = getMercatorHorizon(transform);\n    const projectionData = transform.getProjectionData({overscaledTileID: null, applyGlobeMatrix: true, applyTerrainMatrix: true});\n    const skyBlend = projectionData.projectionTransition;\n    return {\n        'u_sky_color': sky.properties.get('sky-color'),\n        'u_horizon_color': sky.properties.get('horizon-color'),\n        'u_horizon': [(transform.width / 2 - mercatorHorizon * sinRoll)  * pixelRatio,\n            (transform.height / 2 + mercatorHorizon * cosRoll) * pixelRatio],\n        'u_horizon_normal': [-sinRoll, cosRoll],\n        'u_sky_horizon_blend': (sky.properties.get('sky-horizon-blend') * transform.height / 2) * pixelRatio,\n        'u_sky_blend': skyBlend,\n    };\n};\n\nexport {skyUniforms, skyUniformValues};\n","import {fillExtrusionUniforms, fillExtrusionPatternUniforms, type FillExtrusionUniformsType, type FillExtrusionPatternUniformsType} from './fill_extrusion_program.ts';\nimport {fillPatternUniforms, fillOutlineUniforms, fillOutlinePatternUniforms, fillUniforms, type FillUniformsType, type FillPatternUniformsType, type FillOutlineUniformsType, type FillOutlinePatternUniformsType} from './fill_program.ts';\nimport {circleUniforms, type CircleUniformsType} from './circle_program.ts';\nimport {collisionUniforms, collisionCircleUniforms, type CollisionUniformsType, type CollisionCircleUniformsType} from './collision_program.ts';\nimport {debugUniforms, type DebugUniformsType} from './debug_program.ts';\nimport {heatmapUniforms, heatmapTextureUniforms, type HeatmapUniformsType, type HeatmapTextureUniformsType} from './heatmap_program.ts';\nimport {hillshadeUniforms, hillshadePrepareUniforms, type HillshadeUniformsType, type HillshadePrepareUniformsType} from './hillshade_program.ts';\nimport {colorReliefUniforms, type ColorReliefUniformsType} from './color_relief_program.ts';\nimport {lineUniforms, lineGradientUniforms, linePatternUniforms, lineSDFUniforms, lineGradientSDFUniforms, type LineUniformsType, type LineGradientUniformsType, type LinePatternUniformsType, type LineSDFUniformsType, type LineGradientSDFUniformsType} from './line_program.ts';\nimport {layerOpacityUniforms, type LayerOpacityUniformsType} from './layer_opacity_program.ts';\nimport {rasterUniforms, type RasterUniformsType} from './raster_program.ts';\nimport {symbolIconUniforms, symbolSDFUniforms, symbolTextAndIconUniforms, type SymbolIconUniformsType, type SymbolSDFUniformsType, type symbolTextAndIconUniformsType} from './symbol_program.ts';\nimport {backgroundUniforms, backgroundPatternUniforms, type BackgroundUniformsType, type BackgroundPatternUniformsType} from './background_program.ts';\nimport {terrainUniforms, terrainDepthUniforms, terrainCoordsUniforms, type TerrainUniformsType, type TerrainDepthUniformsType, type TerrainCoordsUniformsType} from './terrain_program.ts';\nimport {atmosphereUniforms, type atmosphereUniformsType} from './atmosphere_program.ts';\nimport {skyUniforms, type SkyUniformsType} from './sky_program.ts';\nimport type {Context} from '../context.ts';\nimport type {UniformLocations} from '../uniform_binding.ts';\n\nconst emptyUniforms = (_: any, __: any): any => {};\n\nexport const programUniforms: {\n    fillExtrusion: (context: Context, locations: UniformLocations) => FillExtrusionUniformsType;\n    fillExtrusionPattern: (context: Context, locations: UniformLocations) => FillExtrusionPatternUniformsType;\n    fill: (context: Context, locations: UniformLocations) => FillUniformsType;\n    fillPattern: (context: Context, locations: UniformLocations) => FillPatternUniformsType;\n    fillOutline: (context: Context, locations: UniformLocations) => FillOutlineUniformsType;\n    fillOutlinePattern: (context: Context, locations: UniformLocations) => FillOutlinePatternUniformsType;\n    circle: (context: Context, locations: UniformLocations) => CircleUniformsType;\n    collisionBox: (context: Context, locations: UniformLocations) => CollisionUniformsType;\n    collisionCircle: (context: Context, locations: UniformLocations) => CollisionCircleUniformsType;\n    debug: (context: Context, locations: UniformLocations) => DebugUniformsType;\n    depth: (_: any, __: any) => any;\n    clippingMask: (_: any, __: any) => any;\n    heatmap: (context: Context, locations: UniformLocations) => HeatmapUniformsType;\n    heatmapTexture: (context: Context, locations: UniformLocations) => HeatmapTextureUniformsType;\n    hillshade: (context: Context, locations: UniformLocations) => HillshadeUniformsType;\n    hillshadePrepare: (context: Context, locations: UniformLocations) => HillshadePrepareUniformsType;\n    colorRelief: (context: Context, locations: UniformLocations) => ColorReliefUniformsType;\n    line: (context: Context, locations: UniformLocations) => LineUniformsType;\n    lineGradient: (context: Context, locations: UniformLocations) => LineGradientUniformsType;\n    linePattern: (context: Context, locations: UniformLocations) => LinePatternUniformsType;\n    lineSDF: (context: Context, locations: UniformLocations) => LineSDFUniformsType;\n    lineGradientSDF: (context: Context, locations: UniformLocations) => LineGradientSDFUniformsType;\n    layerOpacity: (context: Context, locations: UniformLocations) => LayerOpacityUniformsType;\n    raster: (context: Context, locations: UniformLocations) => RasterUniformsType;\n    symbolIcon: (context: Context, locations: UniformLocations) => SymbolIconUniformsType;\n    symbolSDF: (context: Context, locations: UniformLocations) => SymbolSDFUniformsType;\n    symbolTextAndIcon: (context: Context, locations: UniformLocations) => symbolTextAndIconUniformsType;\n    background: (context: Context, locations: UniformLocations) => BackgroundUniformsType;\n    backgroundPattern: (context: Context, locations: UniformLocations) => BackgroundPatternUniformsType;\n    terrain: (context: Context, locations: UniformLocations) => TerrainUniformsType;\n    terrainDepth: (context: Context, locations: UniformLocations) => TerrainDepthUniformsType;\n    terrainCoords: (context: Context, locations: UniformLocations) => TerrainCoordsUniformsType;\n    atmosphere: (context: Context, locations: UniformLocations) => atmosphereUniformsType;\n    sky: (context: Context, locations: UniformLocations) => SkyUniformsType;\n} = {\n    fillExtrusion: fillExtrusionUniforms,\n    fillExtrusionPattern: fillExtrusionPatternUniforms,\n    fill: fillUniforms,\n    fillPattern: fillPatternUniforms,\n    fillOutline: fillOutlineUniforms,\n    fillOutlinePattern: fillOutlinePatternUniforms,\n    circle: circleUniforms,\n    collisionBox: collisionUniforms,\n    collisionCircle: collisionCircleUniforms,\n    debug: debugUniforms,\n    depth: emptyUniforms,\n    clippingMask: emptyUniforms,\n    heatmap: heatmapUniforms,\n    heatmapTexture: heatmapTextureUniforms,\n    hillshade: hillshadeUniforms,\n    hillshadePrepare: hillshadePrepareUniforms,\n    colorRelief: colorReliefUniforms,\n    line: lineUniforms,\n    lineGradient: lineGradientUniforms,\n    linePattern: linePatternUniforms,\n    lineSDF: lineSDFUniforms,\n    lineGradientSDF: lineGradientSDFUniforms,\n    layerOpacity: layerOpacityUniforms,\n    raster: rasterUniforms,\n    symbolIcon: symbolIconUniforms,\n    symbolSDF: symbolSDFUniforms,\n    symbolTextAndIcon: symbolTextAndIconUniforms,\n    background: backgroundUniforms,\n    backgroundPattern: backgroundPatternUniforms,\n    terrain: terrainUniforms,\n    terrainDepth: terrainDepthUniforms,\n    terrainCoords: terrainCoordsUniforms,\n    atmosphere: atmosphereUniforms,\n    sky: skyUniforms\n};\n","\nimport type {StructArray} from '../util/struct_array.ts';\nimport type {TriangleIndexArray, LineIndexArray, LineStripIndexArray} from '../data/index_array_type.ts';\nimport type {Context} from './context.ts';\n\n/**\n * @internal\n * an index buffer class\n */\nexport class IndexBuffer {\n    context: Context;\n    buffer: WebGLBuffer;\n    dynamicDraw: boolean;\n\n    constructor(context: Context, array: TriangleIndexArray | LineIndexArray | LineStripIndexArray, dynamicDraw?: boolean) {\n        this.context = context;\n        const gl = context.gl;\n        this.buffer = gl.createBuffer();\n        this.dynamicDraw = Boolean(dynamicDraw);\n\n        // The bound index buffer is part of vertex array object state. We don't want to\n        // modify whatever VAO happens to be currently bound, so make sure the default\n        // vertex array provided by the context is bound instead.\n        this.context.unbindVAO();\n\n        context.bindElementBuffer.set(this.buffer);\n        gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW);\n\n        if (!this.dynamicDraw) {\n            array.freeBufferAfterUpload();\n        }\n    }\n\n    bind(): void {\n        this.context.bindElementBuffer.set(this.buffer);\n    }\n\n    updateData(array: StructArray): void {\n        const gl = this.context.gl;\n        if (!this.dynamicDraw) throw new Error('Attempted to update data while not in dynamic mode.');\n        // The right VAO will get this buffer re-bound later in VertexArrayObject.bind\n        // See https://github.com/mapbox/mapbox-gl-js/issues/5620\n        this.context.unbindVAO();\n        this.bind();\n        gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, array.arrayBuffer);\n    }\n\n    destroy(): void {\n        const gl = this.context.gl;\n        if (this.buffer) {\n            gl.deleteBuffer(this.buffer);\n            delete this.buffer;\n        }\n    }\n}\n","\nimport type {\n    StructArray,\n    StructArrayMember\n} from '../util/struct_array.ts';\n\nimport type {Program} from './program.ts';\nimport type {Context} from './context.ts';\n\n/**\n * An Enum for AttributeType\n */\nconst AttributeType = {\n    Int8: 'BYTE',\n    Uint8: 'UNSIGNED_BYTE',\n    Int16: 'SHORT',\n    Uint16: 'UNSIGNED_SHORT',\n    Int32: 'INT',\n    Uint32: 'UNSIGNED_INT',\n    Float32: 'FLOAT'\n};\n\n/**\n * @internal\n * The `VertexBuffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's\n * Struct type is converted to a WebGL attribute.\n */\nexport class VertexBuffer {\n    length: number;\n    attributes: readonly StructArrayMember[];\n    itemSize: number;\n    dynamicDraw: boolean;\n    context: Context;\n    buffer: WebGLBuffer;\n\n    /**\n     * @param dynamicDraw - Whether this buffer will be repeatedly updated.\n     */\n    constructor(context: Context, array: StructArray, attributes: readonly StructArrayMember[], dynamicDraw?: boolean) {\n        this.length = array.length;\n        this.attributes = attributes;\n        this.itemSize = array.bytesPerElement;\n        this.dynamicDraw = dynamicDraw;\n\n        this.context = context;\n        const gl = context.gl;\n        this.buffer = gl.createBuffer();\n        context.bindVertexBuffer.set(this.buffer);\n        gl.bufferData(gl.ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW);\n\n        if (!this.dynamicDraw) {\n            array.freeBufferAfterUpload();\n        }\n    }\n\n    bind(): void {\n        this.context.bindVertexBuffer.set(this.buffer);\n    }\n\n    updateData(array: StructArray): void {\n        if (array.length !== this.length) throw new Error(`Length of new data is ${array.length}, which doesn't match current length of ${this.length}`);\n        const gl = this.context.gl;\n        this.bind();\n        gl.bufferSubData(gl.ARRAY_BUFFER, 0, array.arrayBuffer);\n    }\n\n    enableAttributes(gl: WebGL2RenderingContext, program: Program<any>): void {\n        for (const member of this.attributes) {\n            const attribIndex: number | void = program.attributes[member.name];\n            if (attribIndex !== undefined) {\n                gl.enableVertexAttribArray(attribIndex);\n            }\n        }\n    }\n\n    /**\n     * Set the attribute pointers in a WebGL context\n     * @param gl - The WebGL context\n     * @param program - The active WebGL program\n     * @param vertexOffset - Index of the starting vertex of the segment\n     */\n    setVertexAttribPointers(gl: WebGL2RenderingContext, program: Program<any>, vertexOffset?: number | null): void {\n        for (const member of this.attributes) {\n            const attribIndex: number | void = program.attributes[member.name];\n\n            if (attribIndex !== undefined) {\n                gl.vertexAttribPointer(\n                    attribIndex,\n                    member.components,\n                    gl[AttributeType[member.type]],\n                    false,\n                    this.itemSize,\n                    member.offset + (this.itemSize * (vertexOffset || 0))\n                );\n            }\n        }\n    }\n\n    /**\n     * Destroy the GL buffer bound to the given WebGL context\n     */\n    destroy(): void {\n        const gl = this.context.gl;\n        if (this.buffer) {\n            gl.deleteBuffer(this.buffer);\n            delete this.buffer;\n        }\n    }\n}\n","import {Color} from '@maplibre/maplibre-gl-style-spec';\n\nimport type {Context} from './context.ts';\nimport type {\n    BlendFuncType,\n    BlendEquationType,\n    ColorMaskType,\n    DepthRangeType,\n    DepthMaskType,\n    StencilFuncType,\n    StencilOpType,\n    DepthFuncType,\n    TextureUnitType,\n    ViewportType,\n    CullFaceModeType,\n    FrontFaceType,\n} from './types.ts';\n\nexport interface IValue<T> {\n    current: T;\n    default: T;\n    dirty: boolean;\n    get(): T;\n    setDefault(): void;\n    set(value: T): void;\n}\n\nclass BaseValue<T> implements IValue<T> {\n    gl: WebGL2RenderingContext;\n    current: T;\n    default: T;\n    dirty: boolean;\n\n    constructor(context: Context) {\n        this.gl = context.gl;\n        this.default = this.getDefault();\n        this.current = this.default;\n        this.dirty = false;\n    }\n\n    get(): T {\n        return this.current;\n    }\n    set(value: T): void { // eslint-disable-line\n        // overridden in child classes;\n    }\n\n    getDefault(): T {\n        return this.default; // overridden in child classes\n    }\n    setDefault(): void {\n        this.set(this.default);\n    }\n}\n\nexport class ClearColor extends BaseValue<Color> {\n    getDefault(): Color {\n        return Color.transparent;\n    }\n    set(v: Color): void {\n        const c = this.current;\n        if (v.r === c.r && v.g === c.g && v.b === c.b && v.a === c.a && !this.dirty) return;\n        this.gl.clearColor(v.r, v.g, v.b, v.a);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class ClearDepth extends BaseValue<number> {\n    getDefault(): number {\n        return 1;\n    }\n    set(v: number): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.clearDepth(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class ClearStencil extends BaseValue<number> {\n    getDefault(): number {\n        return 0;\n    }\n    set(v: number): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.clearStencil(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class ColorMask extends BaseValue<ColorMaskType> {\n    getDefault(): ColorMaskType {\n        return [true, true, true, true];\n    }\n    set(v: ColorMaskType): void {\n        const c = this.current;\n        if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && v[3] === c[3] && !this.dirty) return;\n        this.gl.colorMask(v[0], v[1], v[2], v[3]);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class DepthMask extends BaseValue<DepthMaskType> {\n    getDefault(): DepthMaskType {\n        return true;\n    }\n    set(v: DepthMaskType): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.depthMask(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class StencilMask extends BaseValue<number> {\n    getDefault(): number {\n        return 0xFF;\n    }\n    set(v: number): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.stencilMask(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class StencilFunc extends BaseValue<StencilFuncType> {\n    getDefault(): StencilFuncType {\n        return {\n            func: this.gl.ALWAYS,\n            ref: 0,\n            mask: 0xFF\n        };\n    }\n    set(v: StencilFuncType): void {\n        const c = this.current;\n        if (v.func === c.func && v.ref === c.ref && v.mask === c.mask && !this.dirty) return;\n        this.gl.stencilFunc(v.func, v.ref, v.mask);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class StencilOp extends BaseValue<StencilOpType> {\n    getDefault(): StencilOpType {\n        const gl = this.gl;\n        return [gl.KEEP, gl.KEEP, gl.KEEP];\n    }\n    set(v: StencilOpType): void {\n        const c = this.current;\n        if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && !this.dirty) return;\n        this.gl.stencilOp(v[0], v[1], v[2]);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class StencilTest extends BaseValue<boolean> {\n    getDefault(): boolean {\n        return false;\n    }\n    set(v: boolean): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        if (v) {\n            gl.enable(gl.STENCIL_TEST);\n        } else {\n            gl.disable(gl.STENCIL_TEST);\n        }\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class DepthRange extends BaseValue<DepthRangeType> {\n    getDefault(): DepthRangeType {\n        return [0, 1];\n    }\n    set(v: DepthRangeType): void {\n        const c = this.current;\n        if (v[0] === c[0] && v[1] === c[1] && !this.dirty) return;\n        this.gl.depthRange(v[0], v[1]);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class DepthTest extends BaseValue<boolean> {\n    getDefault(): boolean {\n        return false;\n    }\n    set(v: boolean): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        if (v) {\n            gl.enable(gl.DEPTH_TEST);\n        } else {\n            gl.disable(gl.DEPTH_TEST);\n        }\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class DepthFunc extends BaseValue<DepthFuncType> {\n    getDefault(): DepthFuncType {\n        return this.gl.LESS;\n    }\n    set(v: DepthFuncType): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.depthFunc(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class Blend extends BaseValue<boolean> {\n    getDefault(): boolean {\n        return false;\n    }\n    set(v: boolean): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        if (v) {\n            gl.enable(gl.BLEND);\n        } else {\n            gl.disable(gl.BLEND);\n        }\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BlendFunc extends BaseValue<BlendFuncType> {\n    getDefault(): BlendFuncType {\n        const gl = this.gl;\n        return [gl.ONE, gl.ZERO];\n    }\n    set(v: BlendFuncType): void {\n        const c = this.current;\n        if (v[0] === c[0] && v[1] === c[1] && !this.dirty) return;\n        this.gl.blendFunc(v[0], v[1]);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BlendColor extends BaseValue<Color> {\n    getDefault(): Color {\n        return Color.transparent;\n    }\n    set(v: Color): void {\n        const c = this.current;\n        if (v.r === c.r && v.g === c.g && v.b === c.b && v.a === c.a && !this.dirty) return;\n        this.gl.blendColor(v.r, v.g, v.b, v.a);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BlendEquation extends BaseValue<BlendEquationType> {\n    getDefault(): BlendEquationType {\n        return this.gl.FUNC_ADD;\n    }\n    set(v: BlendEquationType): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.blendEquation(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class CullFace extends BaseValue<boolean> {\n    getDefault(): boolean {\n        return false;\n    }\n    set(v: boolean): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        if (v) {\n            gl.enable(gl.CULL_FACE);\n        } else {\n            gl.disable(gl.CULL_FACE);\n        }\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class CullFaceSide extends BaseValue<CullFaceModeType> {\n    getDefault(): CullFaceModeType {\n        return this.gl.BACK;\n    }\n    set(v: CullFaceModeType): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.cullFace(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class FrontFace extends BaseValue<FrontFaceType> {\n    getDefault(): FrontFaceType {\n        return this.gl.CCW;\n    }\n    set(v: FrontFaceType): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.frontFace(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class ProgramValue extends BaseValue<WebGLProgram> {\n    getDefault(): WebGLProgram {\n        return null;\n    }\n    set(v?: WebGLProgram | null): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.useProgram(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class ActiveTextureUnit extends BaseValue<TextureUnitType> {\n    getDefault(): TextureUnitType {\n        return this.gl.TEXTURE0;\n    }\n    set(v: TextureUnitType): void {\n        if (v === this.current && !this.dirty) return;\n        this.gl.activeTexture(v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class Viewport extends BaseValue<ViewportType> {\n    getDefault(): ViewportType {\n        const gl = this.gl;\n        return [0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight];\n    }\n    set(v: ViewportType): void {\n        const c = this.current;\n        if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && v[3] === c[3] && !this.dirty) return;\n        this.gl.viewport(v[0], v[1], v[2], v[3]);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BindFramebuffer extends BaseValue<WebGLFramebuffer> {\n    getDefault(): WebGLFramebuffer {\n        return null;\n    }\n    set(v?: WebGLFramebuffer | null): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        gl.bindFramebuffer(gl.FRAMEBUFFER, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BindRenderbuffer extends BaseValue<WebGLRenderbuffer> {\n    getDefault(): WebGLRenderbuffer {\n        return null;\n    }\n    set(v?: WebGLRenderbuffer | null): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        gl.bindRenderbuffer(gl.RENDERBUFFER, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BindTexture extends BaseValue<WebGLTexture> {\n    getDefault(): WebGLTexture {\n        return null;\n    }\n    set(v?: WebGLTexture | null): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        gl.bindTexture(gl.TEXTURE_2D, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BindVertexBuffer extends BaseValue<WebGLBuffer> {\n    getDefault(): WebGLBuffer {\n        return null;\n    }\n    set(v?: WebGLBuffer | null): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        gl.bindBuffer(gl.ARRAY_BUFFER, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BindElementBuffer extends BaseValue<WebGLBuffer> {\n    getDefault(): WebGLBuffer {\n        return null;\n    }\n    set(v?: WebGLBuffer | null): void {\n        // Always rebind\n        const gl = this.gl;\n        gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class BindVertexArray extends BaseValue<WebGLVertexArrayObject | null> {\n    getDefault(): WebGLVertexArrayObject | null {\n        return null;\n    }\n    set(v: WebGLVertexArrayObject | null): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n\n        gl.bindVertexArray(v);\n\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class PixelStoreUnpack extends BaseValue<number> {\n    getDefault(): number {\n        return 4;\n    }\n    set(v: number): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        gl.pixelStorei(gl.UNPACK_ALIGNMENT, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class PixelStoreUnpackPremultiplyAlpha extends BaseValue<boolean> {\n    getDefault(): boolean {\n        return false;\n    }\n    set(v: boolean): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, ((v)));\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class PixelStoreUnpackFlipY extends BaseValue<boolean> {\n    getDefault(): boolean {\n        return false;\n    }\n    set(v: boolean): void {\n        if (v === this.current && !this.dirty) return;\n        const gl = this.gl;\n        gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, ((v)));\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nclass FramebufferAttachment<T> extends BaseValue<T> {\n    parent: WebGLFramebuffer;\n    context: Context;\n\n    constructor(context: Context, parent: WebGLFramebuffer) {\n        super(context);\n        this.context = context;\n        this.parent = parent;\n    }\n    getDefault(): T {\n        return null;\n    }\n}\n\nexport class ColorAttachment extends FramebufferAttachment<WebGLTexture> {\n    setDirty(): void {\n        this.dirty = true;\n    }\n    set(v?: WebGLTexture | null): void {\n        if (v === this.current && !this.dirty) return;\n        this.context.bindFramebuffer.set(this.parent);\n        // note: it's possible to attach a renderbuffer to the color\n        // attachment point, but thus far MBGL only uses textures for color\n        const gl = this.gl;\n        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, v, 0);\n\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class DepthAttachment extends FramebufferAttachment<WebGLRenderbuffer> {\n    set(v?: WebGLRenderbuffer | null): void {\n        if (v === this.current && !this.dirty) return;\n        this.context.bindFramebuffer.set(this.parent);\n        // note: it's possible to attach a texture to the depth attachment\n        // point, but thus far MBGL only uses renderbuffers for depth\n        const gl = this.gl;\n        gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n\nexport class DepthStencilAttachment extends FramebufferAttachment<WebGLRenderbuffer> {\n    set(v?: WebGLRenderbuffer | null): void {\n        if (v === this.current && !this.dirty) return;\n        this.context.bindFramebuffer.set(this.parent);\n        // note: it's possible to attach a texture to the depth attachment\n        // point, but thus far MBGL only uses renderbuffers for depth\n        const gl = this.gl;\n        gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, v);\n        this.current = v;\n        this.dirty = false;\n    }\n}\n","import {ColorAttachment, DepthAttachment, DepthStencilAttachment} from './value.ts';\n\nimport type {Context} from './context.ts';\n\n/**\n * @internal\n * A framebuffer holder object\n */\nexport class Framebuffer {\n    context: Context;\n    width: number;\n    height: number;\n    framebuffer: WebGLFramebuffer;\n    colorAttachment: ColorAttachment;\n    depthAttachment: DepthAttachment;\n\n    constructor(context: Context, width: number, height: number, hasDepth: boolean, hasStencil: boolean) {\n        this.context = context;\n        this.width = width;\n        this.height = height;\n        const gl = context.gl;\n        const fbo = this.framebuffer = gl.createFramebuffer();\n\n        this.colorAttachment = new ColorAttachment(context, fbo);\n        if (hasDepth) {\n            this.depthAttachment = hasStencil ? new DepthStencilAttachment(context, fbo) : new DepthAttachment(context, fbo);\n        } else if (hasStencil) {\n            throw new Error('Stencil cannot be set without depth');\n        }\n    }\n\n    destroy(): void {\n        const gl = this.context.gl;\n\n        const texture = this.colorAttachment.get();\n        if (texture) gl.deleteTexture(texture);\n\n        if (this.depthAttachment) {\n            const renderbuffer = this.depthAttachment.get();\n            if (renderbuffer) gl.deleteRenderbuffer(renderbuffer);\n        }\n\n        gl.deleteFramebuffer(this.framebuffer);\n    }\n}\n","import {Color} from '@maplibre/maplibre-gl-style-spec';\n\nimport type {BlendFuncType, ColorMaskType} from './types.ts';\n\nconst ZERO = 0x0000;\nconst ONE = 0x0001;\nconst ONE_MINUS_SRC_ALPHA = 0x0303;\n\nexport class ColorMode {\n    blendFunction: BlendFuncType;\n    blendColor: Color;\n    mask: ColorMaskType;\n\n    constructor(blendFunction: BlendFuncType, blendColor: Color, mask: ColorMaskType) {\n        this.blendFunction = blendFunction;\n        this.blendColor = blendColor;\n        this.mask = mask;\n    }\n\n    static Replace: BlendFuncType;\n\n    static disabled: Readonly<ColorMode>;\n    static unblended: Readonly<ColorMode>;\n    static alphaBlended: Readonly<ColorMode>;\n}\n\nColorMode.Replace = [ONE, ZERO];\n\nColorMode.disabled = new ColorMode(ColorMode.Replace, Color.transparent, [false, false, false, false]);\nColorMode.unblended = new ColorMode(ColorMode.Replace, Color.transparent, [true, true, true, true]);\nColorMode.alphaBlended = new ColorMode([ONE, ONE_MINUS_SRC_ALPHA], Color.transparent, [true, true, true, true]);\n","import {IndexBuffer} from './index_buffer.ts';\n\nimport {VertexBuffer} from './vertex_buffer.ts';\nimport {Framebuffer} from './framebuffer.ts';\nimport {type DepthMode} from './depth_mode.ts';\nimport {type StencilMode} from './stencil_mode.ts';\nimport {ColorMode} from './color_mode.ts';\nimport {type CullFaceMode} from './cull_face_mode.ts';\nimport {deepEqual} from '../util/util.ts';\nimport {ClearColor, ClearDepth, ClearStencil, ColorMask, DepthMask, StencilMask, StencilFunc, StencilOp, StencilTest, DepthRange, DepthTest, DepthFunc, Blend, BlendFunc, BlendColor, BlendEquation, CullFace, CullFaceSide, FrontFace, ProgramValue, ActiveTextureUnit, Viewport, BindFramebuffer, BindRenderbuffer, BindTexture, BindVertexBuffer, BindElementBuffer, BindVertexArray, PixelStoreUnpack, PixelStoreUnpackPremultiplyAlpha, PixelStoreUnpackFlipY} from './value.ts';\n\nimport type {TriangleIndexArray, LineIndexArray, LineStripIndexArray} from '../data/index_array_type.ts';\nimport type {\n    StructArray,\n    StructArrayMember\n} from '../util/struct_array.ts';\nimport type {Color} from '@maplibre/maplibre-gl-style-spec';\n\ntype ClearArgs = {\n    color?: Color;\n    depth?: number;\n    stencil?: number;\n};\n\n/**\n * @internal\n * A webgl wrapper class to allow injection, mocking and abstraction\n */\nexport class Context {\n    gl: WebGL2RenderingContext;\n\n    currentNumAttributes: number;\n    maxTextureSize: number;\n\n    clearColor: ClearColor;\n    clearDepth: ClearDepth;\n    clearStencil: ClearStencil;\n    colorMask: ColorMask;\n    depthMask: DepthMask;\n    stencilMask: StencilMask;\n    stencilFunc: StencilFunc;\n    stencilOp: StencilOp;\n    stencilTest: StencilTest;\n    depthRange: DepthRange;\n    depthTest: DepthTest;\n    depthFunc: DepthFunc;\n    blend: Blend;\n    blendFunc: BlendFunc;\n    blendColor: BlendColor;\n    blendEquation: BlendEquation;\n    cullFace: CullFace;\n    cullFaceSide: CullFaceSide;\n    frontFace: FrontFace;\n    program: ProgramValue;\n    activeTexture: ActiveTextureUnit;\n    viewport: Viewport;\n    bindFramebuffer: BindFramebuffer;\n    bindRenderbuffer: BindRenderbuffer;\n    bindTexture: BindTexture;\n    bindVertexBuffer: BindVertexBuffer;\n    bindElementBuffer: BindElementBuffer;\n    bindVertexArray: BindVertexArray;\n    pixelStoreUnpack: PixelStoreUnpack;\n    pixelStoreUnpackPremultiplyAlpha: PixelStoreUnpackPremultiplyAlpha;\n    pixelStoreUnpackFlipY: PixelStoreUnpackFlipY;\n\n    extTextureFilterAnisotropic: EXT_texture_filter_anisotropic | null;\n    extTextureFilterAnisotropicMax?: GLfloat;\n\n    constructor(gl: WebGL2RenderingContext) {\n        this.gl = gl;\n        this.clearColor = new ClearColor(this);\n        this.clearDepth = new ClearDepth(this);\n        this.clearStencil = new ClearStencil(this);\n        this.colorMask = new ColorMask(this);\n        this.depthMask = new DepthMask(this);\n        this.stencilMask = new StencilMask(this);\n        this.stencilFunc = new StencilFunc(this);\n        this.stencilOp = new StencilOp(this);\n        this.stencilTest = new StencilTest(this);\n        this.depthRange = new DepthRange(this);\n        this.depthTest = new DepthTest(this);\n        this.depthFunc = new DepthFunc(this);\n        this.blend = new Blend(this);\n        this.blendFunc = new BlendFunc(this);\n        this.blendColor = new BlendColor(this);\n        this.blendEquation = new BlendEquation(this);\n        this.cullFace = new CullFace(this);\n        this.cullFaceSide = new CullFaceSide(this);\n        this.frontFace = new FrontFace(this);\n        this.program = new ProgramValue(this);\n        this.activeTexture = new ActiveTextureUnit(this);\n        this.viewport = new Viewport(this);\n        this.bindFramebuffer = new BindFramebuffer(this);\n        this.bindRenderbuffer = new BindRenderbuffer(this);\n        this.bindTexture = new BindTexture(this);\n        this.bindVertexBuffer = new BindVertexBuffer(this);\n        this.bindElementBuffer = new BindElementBuffer(this);\n        this.bindVertexArray = new BindVertexArray(this);\n        this.pixelStoreUnpack = new PixelStoreUnpack(this);\n        this.pixelStoreUnpackPremultiplyAlpha = new PixelStoreUnpackPremultiplyAlpha(this);\n        this.pixelStoreUnpackFlipY = new PixelStoreUnpackFlipY(this);\n\n        this.extTextureFilterAnisotropic = gl.getExtension('EXT_texture_filter_anisotropic');\n\n        if (this.extTextureFilterAnisotropic) {\n            this.extTextureFilterAnisotropicMax = gl.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n        }\n\n        this.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\n        gl.getExtension('EXT_color_buffer_half_float');\n        gl.getExtension('EXT_color_buffer_float');\n    }\n\n    setDefault(): void {\n        this.unbindVAO();\n\n        this.clearColor.setDefault();\n        this.clearDepth.setDefault();\n        this.clearStencil.setDefault();\n        this.colorMask.setDefault();\n        this.depthMask.setDefault();\n        this.stencilMask.setDefault();\n        this.stencilFunc.setDefault();\n        this.stencilOp.setDefault();\n        this.stencilTest.setDefault();\n        this.depthRange.setDefault();\n        this.depthTest.setDefault();\n        this.depthFunc.setDefault();\n        this.blend.setDefault();\n        this.blendFunc.setDefault();\n        this.blendColor.setDefault();\n        this.blendEquation.setDefault();\n        this.cullFace.setDefault();\n        this.cullFaceSide.setDefault();\n        this.frontFace.setDefault();\n        this.program.setDefault();\n        this.activeTexture.setDefault();\n        this.bindFramebuffer.setDefault();\n        this.pixelStoreUnpack.setDefault();\n        this.pixelStoreUnpackPremultiplyAlpha.setDefault();\n        this.pixelStoreUnpackFlipY.setDefault();\n    }\n\n    setDirty(): void {\n        this.clearColor.dirty = true;\n        this.clearDepth.dirty = true;\n        this.clearStencil.dirty = true;\n        this.colorMask.dirty = true;\n        this.depthMask.dirty = true;\n        this.stencilMask.dirty = true;\n        this.stencilFunc.dirty = true;\n        this.stencilOp.dirty = true;\n        this.stencilTest.dirty = true;\n        this.depthRange.dirty = true;\n        this.depthTest.dirty = true;\n        this.depthFunc.dirty = true;\n        this.blend.dirty = true;\n        this.blendFunc.dirty = true;\n        this.blendColor.dirty = true;\n        this.blendEquation.dirty = true;\n        this.cullFace.dirty = true;\n        this.cullFaceSide.dirty = true;\n        this.frontFace.dirty = true;\n        this.program.dirty = true;\n        this.activeTexture.dirty = true;\n        this.viewport.dirty = true;\n        this.bindFramebuffer.dirty = true;\n        this.bindRenderbuffer.dirty = true;\n        this.bindTexture.dirty = true;\n        this.bindVertexBuffer.dirty = true;\n        this.bindElementBuffer.dirty = true;\n        this.bindVertexArray.dirty = true;\n        this.pixelStoreUnpack.dirty = true;\n        this.pixelStoreUnpackPremultiplyAlpha.dirty = true;\n        this.pixelStoreUnpackFlipY.dirty = true;\n    }\n\n    createIndexBuffer(array: TriangleIndexArray | LineIndexArray | LineStripIndexArray, dynamicDraw?: boolean): IndexBuffer {\n        return new IndexBuffer(this, array, dynamicDraw);\n    }\n\n    createVertexBuffer(array: StructArray, attributes: readonly StructArrayMember[], dynamicDraw?: boolean): VertexBuffer {\n        return new VertexBuffer(this, array, attributes, dynamicDraw);\n    }\n\n    createRenderbuffer(storageFormat: number, width: number, height: number): WebGLRenderbuffer {\n        const gl = this.gl;\n\n        const rbo = gl.createRenderbuffer();\n        this.bindRenderbuffer.set(rbo);\n        gl.renderbufferStorage(gl.RENDERBUFFER, storageFormat, width, height);\n        this.bindRenderbuffer.set(null);\n\n        return rbo;\n    }\n\n    createFramebuffer(width: number, height: number, hasDepth: boolean, hasStencil: boolean): Framebuffer {\n        return new Framebuffer(this, width, height, hasDepth, hasStencil);\n    }\n\n    clear({\n        color,\n        depth,\n        stencil\n    }: ClearArgs): void {\n        const gl = this.gl;\n        let mask = 0;\n\n        if (color) {\n            mask |= gl.COLOR_BUFFER_BIT;\n            this.clearColor.set(color);\n            this.colorMask.set([true, true, true, true]);\n        }\n\n        if (typeof depth !== 'undefined') {\n            mask |= gl.DEPTH_BUFFER_BIT;\n\n            // Workaround for platforms where clearDepth doesn't seem to work\n            // without resetting the depthRange. See https://github.com/mapbox/mapbox-gl-js/issues/3437\n            this.depthRange.set([0, 1]);\n\n            this.clearDepth.set(depth);\n            this.depthMask.set(true);\n        }\n\n        if (typeof stencil !== 'undefined') {\n            mask |= gl.STENCIL_BUFFER_BIT;\n            this.clearStencil.set(stencil);\n            this.stencilMask.set(0xFF);\n        }\n\n        gl.clear(mask);\n    }\n\n    setCullFace(cullFaceMode: Readonly<CullFaceMode>): void {\n        if (cullFaceMode.enable === false) {\n            this.cullFace.set(false);\n        } else {\n            this.cullFace.set(true);\n            this.cullFaceSide.set(cullFaceMode.mode);\n            this.frontFace.set(cullFaceMode.frontFace);\n        }\n    }\n\n    setDepthMode(depthMode: Readonly<DepthMode>): void {\n        if (depthMode.func === this.gl.ALWAYS && !depthMode.mask) {\n            this.depthTest.set(false);\n        } else {\n            this.depthTest.set(true);\n            this.depthFunc.set(depthMode.func);\n            this.depthMask.set(depthMode.mask);\n            this.depthRange.set(depthMode.range);\n        }\n    }\n\n    setStencilMode(stencilMode: Readonly<StencilMode>): void {\n        if (stencilMode.test.func === this.gl.ALWAYS && !stencilMode.mask) {\n            this.stencilTest.set(false);\n        } else {\n            this.stencilTest.set(true);\n            this.stencilMask.set(stencilMode.mask);\n            this.stencilOp.set([stencilMode.fail, stencilMode.depthFail, stencilMode.pass]);\n            this.stencilFunc.set({\n                func: stencilMode.test.func,\n                ref: stencilMode.ref,\n                mask: stencilMode.test.mask\n            });\n        }\n    }\n\n    setColorMode(colorMode: Readonly<ColorMode>): void {\n        if (deepEqual(colorMode.blendFunction, ColorMode.Replace)) {\n            this.blend.set(false);\n        } else {\n            this.blend.set(true);\n            this.blendFunc.set(colorMode.blendFunction);\n            this.blendColor.set(colorMode.blendColor);\n        }\n\n        this.colorMask.set(colorMode.mask);\n    }\n\n    createVertexArray(): WebGLVertexArrayObject | undefined {\n        return this.gl.createVertexArray();\n    }\n\n    deleteVertexArray(x: WebGLVertexArrayObject | undefined): void {\n        this.gl.deleteVertexArray(x);\n    }\n\n    unbindVAO(): void {\n        // Unbinding the VAO prevents other things (custom layers, new buffer creation) from\n        // unintentionally changing the state of the last VAO used.\n        this.bindVertexArray.set(null);\n    }\n}\n","import type {DepthFuncType, DepthMaskType, DepthRangeType} from './types.ts';\n\nconst ALWAYS = 0x0207;\n\nexport class DepthMode {\n    func: DepthFuncType;\n    mask: DepthMaskType;\n    range: DepthRangeType;\n\n    // DepthMask enums\n    static ReadOnly: boolean;\n    static ReadWrite: boolean;\n\n    constructor(depthFunc: DepthFuncType, depthMask: DepthMaskType, depthRange: DepthRangeType) {\n        this.func = depthFunc;\n        this.mask = depthMask;\n        this.range = depthRange;\n    }\n\n    static disabled: Readonly<DepthMode>;\n}\n\nDepthMode.ReadOnly = false;\nDepthMode.ReadWrite = true;\n\nDepthMode.disabled = new DepthMode(ALWAYS, DepthMode.ReadOnly, [0, 1]);\n","import type {StencilOpConstant, StencilTestGL} from './types.ts';\n\nconst ALWAYS = 0x0207;\nconst KEEP = 0x1E00;\n\nexport class StencilMode {\n    test: StencilTestGL;\n    ref: number;\n    mask: number;\n    fail: StencilOpConstant;\n    depthFail: StencilOpConstant;\n    pass: StencilOpConstant;\n\n    constructor(test: StencilTestGL, ref: number, mask: number, fail: StencilOpConstant,\n        depthFail: StencilOpConstant, pass: StencilOpConstant) {\n        this.test = test;\n        this.ref = ref;\n        this.mask = mask;\n        this.fail = fail;\n        this.depthFail = depthFail;\n        this.pass = pass;\n    }\n\n    static disabled: Readonly<StencilMode>;\n}\n\nStencilMode.disabled = new StencilMode({func: ALWAYS, mask: 0}, 0, 0, KEEP, KEEP, KEEP);\n","import type {CullFaceModeType, FrontFaceType} from './types.ts';\n\nconst FRONT = 0x0404;\nconst BACK = 0x0405;\nconst CCW = 0x0901;\n\nexport class CullFaceMode {\n    enable: boolean;\n    mode: CullFaceModeType;\n    frontFace: FrontFaceType;\n\n    constructor(enable: boolean, mode: CullFaceModeType, frontFace: FrontFaceType) {\n        this.enable = enable;\n        this.mode = mode;\n        this.frontFace = frontFace;\n    }\n\n    static disabled: Readonly<CullFaceMode>;\n\n    /**\n     * The standard GL cull mode. Culls backfacing triangles when counterclockwise vertex order is used.\n     * Use for 3D geometry such as terrain.\n     */\n    static backCCW: Readonly<CullFaceMode>;\n\n    /**\n     * Opposite of {@link backCCW}. Culls front-facing triangles when counterclockwise vertex order is used.\n     */\n    static frontCCW: Readonly<CullFaceMode>;\n}\n\nCullFaceMode.disabled = new CullFaceMode(false, BACK, CCW);\nCullFaceMode.backCCW = new CullFaceMode(true, BACK, CCW);\nCullFaceMode.frontCCW = new CullFaceMode(true, FRONT, CCW);\n","import type {Painter} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {StyleLayer} from '../../style/style_layer.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\nimport type {SymbolBucket} from '../../data/bucket/symbol_bucket.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {collisionUniformValues, collisionCircleUniformValues} from '../program/collision_program.ts';\nimport {QuadTriangleArray, CollisionCircleLayoutArray} from '../../data/array_types.g.ts';\nimport {collisionCircleLayout} from '../../data/bucket/symbol_attributes.ts';\nimport {SegmentVector} from '../../data/segment.ts';\nimport {type VertexBuffer} from '../vertex_buffer.ts';\nimport {type IndexBuffer} from '../index_buffer.ts';\n\ntype TileBatch = {\n    circleArray: number[];\n    circleOffset: number;\n    coord: OverscaledTileID;\n};\n\nlet quadTriangles: QuadTriangleArray;\n\nexport function drawCollisionDebug(painter: Painter, tileManager: TileManager, layer: StyleLayer, coords: OverscaledTileID[], isText: boolean): void {\n    const context = painter.context;\n    const transform = painter.transform;\n    const gl = context.gl;\n    const program = painter.useProgram('collisionBox');\n    const tileBatches: TileBatch[] = [];\n    let circleCount = 0;\n    let circleOffset = 0;\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n        const bucket: SymbolBucket = (tile.getBucket(layer) as any);\n        if (!bucket) {\n            continue;\n        }\n        const buffers = isText ? bucket.textCollisionBox : bucket.iconCollisionBox;\n        // Get collision circle data of this bucket\n        const circleArray: number[] = bucket.collisionCircleArray;\n        if (circleArray.length > 0) {\n            tileBatches.push({\n                circleArray,\n                circleOffset,\n                coord\n            });\n\n            circleCount += circleArray.length / 4;  // 4 values per circle\n            circleOffset = circleCount;\n        }\n\n        // Draw collision boxes\n        if (!buffers) {\n            continue;\n        }\n\n        program.draw(context, gl.LINES,\n            DepthMode.disabled, StencilMode.disabled,\n            painter.colorModeForRenderPass(),\n            CullFaceMode.disabled,\n            collisionUniformValues(painter.transform),\n            painter.style.map.terrain?.getTerrainData(coord),\n            transform.getProjectionData({overscaledTileID: coord, applyGlobeMatrix: true, applyTerrainMatrix: true}),\n            layer.id, buffers.layoutVertexBuffer, buffers.indexBuffer,\n            buffers.segments, null, painter.transform.zoom, null, null,\n            buffers.collisionVertexBuffer);\n    }\n\n    if (!isText || !tileBatches.length) {\n        return;\n    }\n\n    // Render collision circles\n    const circleProgram = painter.useProgram('collisionCircle');\n\n    // Construct vertex data\n    const vertexData = new CollisionCircleLayoutArray();\n    vertexData.resize(circleCount * 4);\n    vertexData._trim();\n\n    let vertexOffset = 0;\n\n    for (const batch of tileBatches) {\n        for (let i = 0; i < batch.circleArray.length / 4; i++) {\n            const circleIdx = i * 4;\n            const x = batch.circleArray[circleIdx + 0];\n            const y = batch.circleArray[circleIdx + 1];\n            const radius = batch.circleArray[circleIdx + 2];\n            const collision = batch.circleArray[circleIdx + 3];\n\n            // 4 floats per vertex, 4 vertices per quad\n            vertexData.emplace(vertexOffset++, x, y, radius, collision, 0);\n            vertexData.emplace(vertexOffset++, x, y, radius, collision, 1);\n            vertexData.emplace(vertexOffset++, x, y, radius, collision, 2);\n            vertexData.emplace(vertexOffset++, x, y, radius, collision, 3);\n        }\n    }\n    if (!quadTriangles || quadTriangles.length < circleCount * 2) {\n        quadTriangles = createQuadTriangles(circleCount);\n    }\n\n    const indexBuffer: IndexBuffer = context.createIndexBuffer(quadTriangles, true);\n    const vertexBuffer: VertexBuffer = context.createVertexBuffer(vertexData, collisionCircleLayout.members, true);\n\n    // Render batches\n    for (const batch of tileBatches) {\n        const uniforms = collisionCircleUniformValues(painter.transform);\n\n        circleProgram.draw(\n            context,\n            gl.TRIANGLES,\n            DepthMode.disabled,\n            StencilMode.disabled,\n            painter.colorModeForRenderPass(),\n            CullFaceMode.disabled,\n            uniforms,\n            painter.style.map.terrain?.getTerrainData(batch.coord),\n            null,\n            layer.id,\n            vertexBuffer,\n            indexBuffer,\n            SegmentVector.simpleSegment(0, batch.circleOffset * 2, batch.circleArray.length, batch.circleArray.length / 2),\n            null,\n            painter.transform.zoom,\n            null,\n            null,\n            null);\n    }\n\n    vertexBuffer.destroy();\n    indexBuffer.destroy();\n}\n\nfunction createQuadTriangles(quadCount: number): QuadTriangleArray {\n    const triCount = quadCount * 2;\n    const array = new QuadTriangleArray();\n\n    array.resize(triCount);\n    array._trim();\n\n    // Two triangles and 4 vertices per quad.\n    for (let i = 0; i < triCount; i++) {\n        const idx = i * 6;\n\n        array.uint16[idx + 0] = i * 4 + 0;\n        array.uint16[idx + 1] = i * 4 + 1;\n        array.uint16[idx + 2] = i * 4 + 2;\n        array.uint16[idx + 3] = i * 4 + 2;\n        array.uint16[idx + 4] = i * 4 + 3;\n        array.uint16[idx + 5] = i * 4 + 0;\n    }\n\n    return array;\n}\n","import Point from '@mapbox/point-geometry';\nimport {drawCollisionDebug} from './draw_collision_debug.ts';\n\nimport {SegmentVector} from '../../data/segment.ts';\nimport {pixelsToTileUnits} from '../../source/pixels_to_tile_units.ts';\nimport {type EvaluatedZoomSize, evaluateSizeForFeature, evaluateSizeForZoom} from '../../symbol/symbol_size.ts';\nimport {mat4} from 'gl-matrix';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {addDynamicAttributes} from '../../data/bucket/symbol_bucket.ts';\nimport {fastInvertTransformMat4} from '../../util/fast_maths.ts';\nimport {getAnchorAlignment, WritingMode} from '../../symbol/shaping.ts';\nimport ONE_EM from '../../symbol/one_em.ts';\n\nimport {\n    type SymbolIconUniformsType,\n    symbolIconUniformValues,\n    symbolSDFUniformValues,\n    symbolTextAndIconUniformValues\n} from '../program/symbol_program.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {SymbolStyleLayer} from '../../style/style_layer/symbol_style_layer.ts';\n\nimport type {Texture, TextureFilter} from '../texture.ts';\nimport type {OverscaledTileID, UnwrappedTileID} from '../../tile/tile_id.ts';\nimport type {UniformValues} from '../uniform_binding.ts';\nimport type {SymbolSDFUniformsType} from '../program/symbol_program.ts';\nimport type {CrossTileID, VariableOffset} from '../../symbol/placement.ts';\nimport type {SymbolBucket, SymbolBuffers} from '../../data/bucket/symbol_bucket.ts';\nimport type {TerrainData} from '../../render/terrain.ts';\nimport type {SymbolLayerSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {IReadonlyTransform} from '../../geo/transform_interface.ts';\nimport type {ColorMode} from '../color_mode.ts';\nimport type {Program} from '../program.ts';\nimport type {TextAnchor} from '../../style/style_layer/variable_text_anchor.ts';\nimport {getGlCoordMatrix, getPerspectiveRatio, getPitchedLabelPlaneMatrix, hideGlyphs, projectWithMatrix, projectTileCoordinatesToClipSpace, projectTileCoordinatesToLabelPlane, type SymbolProjectionContext, updateLineLabels} from '../../symbol/projection.ts';\nimport {translatePosition} from '../../util/util.ts';\nimport type {ProjectionData} from '../../geo/projection/projection_data.ts';\n\ntype SymbolTileRenderState = {\n    segments: SegmentVector;\n    sortKey: number;\n    terrainData: TerrainData;\n    state: {\n        program: Program<any>;\n        buffers: SymbolBuffers;\n        uniformValues: UniformValues<SymbolSDFUniformsType | SymbolIconUniformsType>;\n        projectionData: ProjectionData;\n        atlasTexture: Texture;\n        atlasTextureIcon: Texture | null;\n        atlasInterpolation: TextureFilter;\n        atlasInterpolationIcon: TextureFilter;\n        isSDF: boolean;\n        hasHalo: boolean;\n    };\n};\n\nconst identityMat4 = mat4.identity(new Float32Array(16));\n\nexport function drawSymbols(painter: Painter, tileManager: TileManager, layer: SymbolStyleLayer, coords: OverscaledTileID[], variableOffsets: {\n    [_ in CrossTileID]: VariableOffset;\n}, renderOptions: RenderOptions): void {\n    if (painter.renderPass !== 'translucent') return;\n\n    const {isRenderingToTexture} = renderOptions;\n    // Disable the stencil test so that labels aren't clipped to tile boundaries.\n    const stencilMode = StencilMode.disabled;\n    const colorMode = painter.colorModeForRenderPass();\n    const hasVariablePlacement = layer._unevaluatedLayout.hasValue('text-variable-anchor') || layer._unevaluatedLayout.hasValue('text-variable-anchor-offset');\n\n    // Compute variable-offsets before painting since icons and text data positioning\n    // depend on each other in this case.\n    if (hasVariablePlacement) {\n        updateVariableAnchors(coords, painter, layer, tileManager,\n            layer.layout.get('text-rotation-alignment'),\n            layer.layout.get('text-pitch-alignment'),\n            layer.paint.get('text-translate'),\n            layer.paint.get('text-translate-anchor'),\n            variableOffsets\n        );\n    }\n\n    if (layer.paint.get('icon-opacity').constantOr(1) !== 0) {\n        drawLayerSymbols(painter, tileManager, layer, coords, false,\n            layer.paint.get('icon-translate'),\n            layer.paint.get('icon-translate-anchor'),\n            layer.layout.get('icon-rotation-alignment'),\n            layer.layout.get('icon-pitch-alignment'),\n            layer.layout.get('icon-keep-upright'),\n            stencilMode, colorMode, isRenderingToTexture\n        );\n    }\n\n    if (layer.paint.get('text-opacity').constantOr(1) !== 0) {\n        drawLayerSymbols(painter, tileManager, layer, coords, true,\n            layer.paint.get('text-translate'),\n            layer.paint.get('text-translate-anchor'),\n            layer.layout.get('text-rotation-alignment'),\n            layer.layout.get('text-pitch-alignment'),\n            layer.layout.get('text-keep-upright'),\n            stencilMode, colorMode, isRenderingToTexture\n        );\n    }\n\n    if (tileManager.map.showCollisionBoxes) {\n        drawCollisionDebug(painter, tileManager, layer, coords, true);\n        drawCollisionDebug(painter, tileManager, layer, coords, false);\n    }\n}\n\nfunction calculateVariableRenderShift(\n    anchor: TextAnchor,\n    width: number,\n    height: number,\n    textOffset: [number, number],\n    textBoxScale: number,\n    renderTextSize: number): Point {\n    const {horizontalAlign, verticalAlign} = getAnchorAlignment(anchor);\n    const shiftX = -(horizontalAlign - 0.5) * width;\n    const shiftY = -(verticalAlign - 0.5) * height;\n    return new Point(\n        (shiftX / textBoxScale + textOffset[0]) * renderTextSize,\n        (shiftY / textBoxScale + textOffset[1]) * renderTextSize\n    );\n}\n\nfunction updateVariableAnchors(coords: OverscaledTileID[],\n    painter: Painter,\n    layer:SymbolStyleLayer, tileManager: TileManager,\n    rotationAlignment: SymbolLayerSpecification['layout']['text-rotation-alignment'],\n    pitchAlignment: SymbolLayerSpecification['layout']['text-pitch-alignment'],\n    translate: [number, number],\n    translateAnchor: 'map' | 'viewport',\n    variableOffsets: {[_ in CrossTileID]: VariableOffset}) {\n    const transform = painter.transform;\n    const terrain = painter.style.map.terrain;\n    const rotateWithMap = rotationAlignment === 'map';\n    const pitchWithMap = pitchAlignment === 'map';\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n        const bucket = tile.getBucket(layer) as SymbolBucket;\n        if (!bucket?.text?.segments.get().length) continue;\n\n        const sizeData = bucket.textSizeData;\n        const size = evaluateSizeForZoom(sizeData, transform.zoom);\n\n        const pixelToTileScale = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n        const pitchedLabelPlaneMatrix = getPitchedLabelPlaneMatrix(rotateWithMap, painter.transform, pixelToTileScale);\n        const updateTextFitIcon = layer.layout.get('icon-text-fit') !== 'none' && bucket.hasIconData();\n\n        if (size) {\n            const tileScale = Math.pow(2, transform.zoom - tile.tileID.overscaledZ);\n            const getElevation = terrain ? (x: number, y: number) => terrain.getElevation(coord, x, y) : null;\n            const translation = translatePosition(transform, tile, translate, translateAnchor);\n            updateVariableAnchorsForBucket(bucket, rotateWithMap, pitchWithMap, variableOffsets,\n                transform, pitchedLabelPlaneMatrix, tileScale, size, updateTextFitIcon, translation, coord.toUnwrapped(), getElevation);\n        }\n    }\n}\n\nfunction getShiftedAnchor(projectedAnchorPoint: Point, projectionContext: SymbolProjectionContext, rotateWithMap, shift: Point, transformAngle: number, pitchedTextShiftCorrection: number) {\n    // Usual case is that we take the projected anchor and add the pixel-based shift\n    // calculated earlier. In the (somewhat weird) case of pitch-aligned text, we add an equivalent\n    // tile-unit based shift to the anchor before projecting to the label plane.\n    const translatedAnchor = projectionContext.tileAnchorPoint.add(new Point(projectionContext.translation[0], projectionContext.translation[1]));\n    if (projectionContext.pitchWithMap) {\n        let adjustedShift = shift.mult(pitchedTextShiftCorrection);\n        if (!rotateWithMap) {\n            adjustedShift = adjustedShift.rotate(-transformAngle);\n        }\n        const tileAnchorShifted = translatedAnchor.add(adjustedShift);\n        return projectWithMatrix(tileAnchorShifted.x, tileAnchorShifted.y, projectionContext.pitchedLabelPlaneMatrix, projectionContext.getElevation).point;\n    } else {\n        if (rotateWithMap) {\n            // Compute the angle with which to rotate the anchor, so that it is aligned with\n            // the map's actual east-west axis. Very similar to what is done in the shader.\n            // Note that the label plane must be screen pixels here.\n            const projectedAnchorRight = projectTileCoordinatesToLabelPlane(projectionContext.tileAnchorPoint.x + 1, projectionContext.tileAnchorPoint.y, projectionContext);\n            const east = projectedAnchorRight.point.sub(projectedAnchorPoint);\n            const angle = Math.atan(east.y / east.x) + (east.x < 0 ? Math.PI : 0);\n            return projectedAnchorPoint.add(shift.rotate(angle));\n        } else {\n            return projectedAnchorPoint.add(shift);\n        }\n    }\n}\n\nfunction updateVariableAnchorsForBucket(\n    bucket: SymbolBucket,\n    rotateWithMap: boolean,\n    pitchWithMap: boolean,\n    variableOffsets: {[_ in CrossTileID]: VariableOffset},\n    transform: IReadonlyTransform,\n    pitchedLabelPlaneMatrix: mat4,\n    tileScale: number,\n    size: EvaluatedZoomSize,\n    updateTextFitIcon: boolean,\n    translation: [number, number],\n    unwrappedTileID: UnwrappedTileID,\n    getElevation: (x: number, y: number) => number) {\n    const placedSymbols = bucket.text.placedSymbolArray;\n    const dynamicTextLayoutVertexArray = bucket.text.dynamicLayoutVertexArray;\n    const dynamicIconLayoutVertexArray = bucket.icon.dynamicLayoutVertexArray;\n    const placedTextShifts = {};\n\n    dynamicTextLayoutVertexArray.clear();\n    for (let s = 0; s < placedSymbols.length; s++) {\n        const symbol = placedSymbols.get(s);\n        const skipOrientation = bucket.allowVerticalPlacement && !symbol.placedOrientation;\n        const variableOffset = (!symbol.hidden && symbol.crossTileID && !skipOrientation) ? variableOffsets[symbol.crossTileID] : null;\n\n        if (!variableOffset) {\n            // These symbols are from a justification that is not being used, or a label that wasn't placed\n            // so we don't need to do the extra math to figure out what incremental shift to apply.\n            hideGlyphs(symbol.numGlyphs, dynamicTextLayoutVertexArray);\n        } else  {\n            const tileAnchor = new Point(symbol.anchorX, symbol.anchorY);\n            const projectionContext: SymbolProjectionContext = {\n                getElevation,\n                width: transform.width,\n                height: transform.height,\n                pitchedLabelPlaneMatrix,\n                lineVertexArray: null,\n                pitchWithMap,\n                transform,\n                projectionCache: null,\n                tileAnchorPoint: tileAnchor,\n                translation,\n                unwrappedTileID\n            };\n            const projectedAnchor = pitchWithMap ?\n                projectTileCoordinatesToClipSpace(tileAnchor.x, tileAnchor.y, projectionContext) :\n                projectTileCoordinatesToLabelPlane(tileAnchor.x, tileAnchor.y, projectionContext);\n            const perspectiveRatio = getPerspectiveRatio(transform.cameraToCenterDistance, projectedAnchor.signedDistanceFromCamera);\n            let renderTextSize = evaluateSizeForFeature(bucket.textSizeData, size, symbol) * perspectiveRatio / ONE_EM;\n            if (pitchWithMap) {\n                // Go from size in pixels to equivalent size in tile units\n                renderTextSize *= bucket.tilePixelRatio / tileScale;\n            }\n\n            const {width, height, anchor, textOffset, textBoxScale} = variableOffset;\n            const shift = calculateVariableRenderShift(anchor, width, height, textOffset, textBoxScale, renderTextSize);\n\n            const pitchedTextCorrection = transform.getPitchedTextCorrection(tileAnchor.x + translation[0], tileAnchor.y + translation[1], unwrappedTileID);\n            const shiftedAnchor = getShiftedAnchor(projectedAnchor.point, projectionContext, rotateWithMap, shift, -transform.bearingInRadians, pitchedTextCorrection);\n\n            const angle = (bucket.allowVerticalPlacement && symbol.placedOrientation === WritingMode.vertical) ? Math.PI / 2 : 0;\n            for (let g = 0; g < symbol.numGlyphs; g++) {\n                addDynamicAttributes(dynamicTextLayoutVertexArray, shiftedAnchor, angle);\n            }\n            //Only offset horizontal text icons\n            if (updateTextFitIcon && symbol.associatedIconIndex >= 0) {\n                placedTextShifts[symbol.associatedIconIndex] = {shiftedAnchor, angle};\n            }\n        }\n    }\n\n    if (updateTextFitIcon) {\n        dynamicIconLayoutVertexArray.clear();\n        const placedIcons = bucket.icon.placedSymbolArray;\n        for (let i = 0; i < placedIcons.length; i++) {\n            const placedIcon = placedIcons.get(i);\n            if (placedIcon.hidden) {\n                hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);\n            } else {\n                const shift = placedTextShifts[i];\n                if (!shift) {\n                    hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);\n                } else {\n                    for (let g = 0; g < placedIcon.numGlyphs; g++) {\n                        addDynamicAttributes(dynamicIconLayoutVertexArray, shift.shiftedAnchor, shift.angle);\n                    }\n                }\n            }\n        }\n        bucket.icon.dynamicLayoutVertexBuffer.updateData(dynamicIconLayoutVertexArray);\n    }\n    bucket.text.dynamicLayoutVertexBuffer.updateData(dynamicTextLayoutVertexArray);\n}\n\nfunction getSymbolProgramName(isSDF: boolean, isText: boolean, bucket: SymbolBucket) {\n    if (bucket.iconsInText && isText) {\n        return 'symbolTextAndIcon';\n    } else if (isSDF) {\n        return 'symbolSDF';\n    } else {\n        return 'symbolIcon';\n    }\n}\n\nfunction drawLayerSymbols(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: SymbolStyleLayer,\n    coords: OverscaledTileID[],\n    isText: boolean,\n    translate: [number, number],\n    translateAnchor: 'map' | 'viewport',\n    rotationAlignment: SymbolLayerSpecification['layout']['text-rotation-alignment'],\n    pitchAlignment: SymbolLayerSpecification['layout']['text-pitch-alignment'],\n    keepUpright: boolean,\n    stencilMode: StencilMode,\n    colorMode: Readonly<ColorMode>,\n    isRenderingToTexture: boolean) {\n\n    const context = painter.context;\n    const gl = context.gl;\n    const transform = painter.transform;\n\n    const rotateWithMap = rotationAlignment === 'map';\n    const pitchWithMap = pitchAlignment === 'map';\n    const alongLine = rotationAlignment !== 'viewport' && layer.layout.get('symbol-placement') !== 'point';\n    // Line label rotation happens in `updateLineLabels`\n    // Pitched point labels are automatically rotated by the pitchedLabelPlaneMatrix projection\n    // Unpitched point labels need to have their rotation applied after projection\n    const rotateInShader = rotateWithMap && !pitchWithMap && !alongLine;\n\n    const hasSortKey = !layer.layout.get('symbol-sort-key').isConstant();\n    let sortFeaturesByKey = false;\n\n    const depthMode = painter.getDepthModeForSublayer(0, DepthMode.ReadOnly);\n\n    const hasVariablePlacement = layer._unevaluatedLayout.hasValue('text-variable-anchor') || layer._unevaluatedLayout.hasValue('text-variable-anchor-offset');\n\n    const tileRenderState: SymbolTileRenderState[] = [];\n\n    const pitchedTextRescaling = transform.getCircleRadiusCorrection();\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n        const bucket = tile.getBucket(layer) as SymbolBucket;\n        if (!bucket) continue;\n        const buffers = isText ? bucket.text : bucket.icon;\n\n        if (!buffers?.segments.get().length || !buffers.hasVisibleVertices) continue;\n        const programConfiguration = buffers.programConfigurations.get(layer.id);\n\n        const isSDF = isText || bucket.sdfIcons;\n\n        const sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n        const transformed = pitchWithMap || transform.pitch !== 0;\n\n        const program = painter.useProgram(getSymbolProgramName(isSDF, isText, bucket), programConfiguration);\n        const size = evaluateSizeForZoom(sizeData, transform.zoom);\n        const terrainData = painter.style.map.terrain?.getTerrainData(coord);\n\n        let texSize: [number, number];\n        let texSizeIcon: [number, number] = [0, 0];\n        let atlasTexture: Texture;\n        let atlasInterpolation: TextureFilter;\n        let atlasTextureIcon = null;\n        let atlasInterpolationIcon: TextureFilter;\n        if (isText) {\n            atlasTexture = tile.glyphAtlasTexture;\n            atlasInterpolation = gl.LINEAR;\n            texSize = tile.glyphAtlasTexture.size;\n            if (bucket.iconsInText) {\n                texSizeIcon = tile.imageAtlasTexture.size;\n                atlasTextureIcon = tile.imageAtlasTexture;\n                const zoomDependentSize = sizeData.kind === 'composite' || sizeData.kind === 'camera';\n                atlasInterpolationIcon = transformed || painter.options.rotating || painter.options.zooming || zoomDependentSize ? gl.LINEAR : gl.NEAREST;\n            }\n        } else {\n            const iconScaled = layer.layout.get('icon-size').constantOr(0) !== 1 || bucket.iconsNeedLinear;\n            atlasTexture = tile.imageAtlasTexture;\n            atlasInterpolation = isSDF || painter.options.rotating || painter.options.zooming || iconScaled || transformed ?\n                gl.LINEAR :\n                gl.NEAREST;\n            texSize = tile.imageAtlasTexture.size;\n        }\n\n        // See the comment at the beginning of src/symbol/projection.ts for an overview of the symbol projection process\n        const s = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n        const pitchedLabelPlaneMatrix = getPitchedLabelPlaneMatrix(rotateWithMap, painter.transform, s);\n        const glCoordMatrixForShader = getGlCoordMatrix(pitchWithMap, rotateWithMap, painter.transform, s);\n\n        const translation = translatePosition(transform, tile, translate, translateAnchor);\n        const projectionData = transform.getProjectionData({overscaledTileID: coord, applyGlobeMatrix: !isRenderingToTexture, applyTerrainMatrix: true});\n\n        const hasVariableAnchors = hasVariablePlacement && bucket.hasTextData();\n        const updateTextFitIcon = layer.layout.get('icon-text-fit') !== 'none' &&\n            hasVariableAnchors &&\n            bucket.hasIconData();\n        const isOffset = layer._unevaluatedLayout.hasValue('icon-offset');\n\n        if (alongLine) {\n            const pitchedLabelPlaneMatrixInverse = mat4.create();\n            fastInvertTransformMat4(pitchedLabelPlaneMatrixInverse, pitchedLabelPlaneMatrix);\n\n            const getElevation = painter.style.map.terrain ? (x: number, y: number) => painter.style.map.terrain.getElevation(coord, x, y) : null;\n            const rotateToLine = layer.layout.get('text-rotation-alignment') === 'map';\n            updateLineLabels(bucket, painter, isText, pitchedLabelPlaneMatrix, pitchedLabelPlaneMatrixInverse, pitchWithMap, keepUpright, rotateToLine, coord.toUnwrapped(), transform.width, transform.height, translation, getElevation);\n        }\n\n        const shaderVariableAnchor = (isText && hasVariablePlacement) || updateTextFitIcon;\n\n        // If the label plane matrix is used, it transforms either map-pitch-aligned pixels, or to screenspace pixels\n        const combinedLabelPlaneMatrix = pitchWithMap ? pitchedLabelPlaneMatrix : painter.transform.clipSpaceToPixelsMatrix;\n        // Label plane matrix is unused in the shader if variable anchors are used or the text is placed along a line\n        const noLabelPlane = (alongLine || shaderVariableAnchor);\n        const uLabelPlaneMatrix = noLabelPlane ? identityMat4 : combinedLabelPlaneMatrix;\n\n        const hasHalo = isSDF && layer.paint.get(isText ? 'text-halo-width' : 'icon-halo-width').constantOr(1) !== 0;\n\n        let uniformValues: UniformValues<SymbolSDFUniformsType | SymbolIconUniformsType>;\n        if (isSDF) {\n            if (!bucket.iconsInText) {\n                uniformValues = symbolSDFUniformValues(sizeData.kind,\n                    size, rotateInShader, pitchWithMap, alongLine, shaderVariableAnchor, painter,\n                    uLabelPlaneMatrix, glCoordMatrixForShader, translation, isText, texSize, hasHalo, pitchedTextRescaling, isOffset);\n            } else {\n                uniformValues = symbolTextAndIconUniformValues(sizeData.kind,\n                    size, rotateInShader, pitchWithMap, alongLine, shaderVariableAnchor, painter,\n                    uLabelPlaneMatrix, glCoordMatrixForShader, translation, texSize, texSizeIcon, pitchedTextRescaling, isOffset);\n            }\n        } else {\n            uniformValues = symbolIconUniformValues(sizeData.kind,\n                size, rotateInShader, pitchWithMap, alongLine, shaderVariableAnchor, painter,\n                uLabelPlaneMatrix, glCoordMatrixForShader, translation, isText, texSize, pitchedTextRescaling, isOffset);\n        }\n\n        const state = {\n            program,\n            buffers,\n            uniformValues,\n            projectionData,\n            atlasTexture,\n            atlasTextureIcon,\n            atlasInterpolation,\n            atlasInterpolationIcon,\n            isSDF,\n            hasHalo\n        };\n\n        if (hasSortKey && bucket.canOverlap) {\n            sortFeaturesByKey = true;\n            const oldSegments = buffers.segments.get();\n            for (const segment of oldSegments) {\n                tileRenderState.push({\n                    segments: new SegmentVector([segment]),\n                    sortKey: segment.sortKey,\n                    state,\n                    terrainData\n                });\n            }\n        } else {\n            tileRenderState.push({\n                segments: buffers.segments,\n                sortKey: 0,\n                state,\n                terrainData\n            });\n        }\n    }\n\n    if (sortFeaturesByKey) {\n        tileRenderState.sort((a, b) => a.sortKey - b.sortKey);\n    }\n\n    const haloWidthProperty = layer.paint.get(isText ? 'text-halo-width' : 'icon-halo-width');\n    const haloWidth = haloWidthProperty.constantOr(null) ?? Infinity;\n    const isGlyphOverlap = layer.layout.get('text-letter-spacing').constantOr(0) * ONE_EM < 0 || haloWidth > 1;\n\n    for (const segmentState of tileRenderState) {\n        const state = segmentState.state;\n\n        context.activeTexture.set(gl.TEXTURE0);\n        state.atlasTexture.bind(state.atlasInterpolation, gl.CLAMP_TO_EDGE);\n        if (state.atlasTextureIcon) {\n            context.activeTexture.set(gl.TEXTURE1);\n            if (state.atlasTextureIcon) {\n                state.atlasTextureIcon.bind(state.atlasInterpolationIcon, gl.CLAMP_TO_EDGE);\n            }\n        }\n\n        const isHalo = state.isSDF && state.hasHalo;\n        if (isHalo) {\n            const uniformValues = state.uniformValues;\n            uniformValues['u_is_halo'] = 1;\n            if (isGlyphOverlap){\n                // render halo in 2 pass (1 for the halo only, 1 for the text only)\n                uniformValues['u_is_plain'] = 0;\n                drawSymbolElements(state.buffers, segmentState.segments, layer, painter, state.program, depthMode, stencilMode, colorMode, uniformValues, state.projectionData, segmentState.terrainData);\n                uniformValues['u_is_halo'] = 0;\n                uniformValues['u_is_plain'] = 1;\n            }\n        }\n\n        drawSymbolElements(state.buffers, segmentState.segments, layer, painter, state.program, depthMode, stencilMode, colorMode, state.uniformValues, state.projectionData, segmentState.terrainData);\n\n        if (isHalo && !isGlyphOverlap) {\n            // for 1 pass halo rendering, restore the uniforms state\n            state.uniformValues['u_is_halo'] = 0;\n        }\n    }\n}\n\nfunction drawSymbolElements(\n    buffers: SymbolBuffers,\n    segments: SegmentVector,\n    layer: SymbolStyleLayer,\n    painter: Painter,\n    program: Program<any>,\n    depthMode: Readonly<DepthMode>,\n    stencilMode: StencilMode,\n    colorMode: Readonly<ColorMode>,\n    uniformValues: UniformValues<SymbolSDFUniformsType | SymbolIconUniformsType>,\n    projectionData: ProjectionData,\n    terrainData: TerrainData) {\n    const context = painter.context;\n    const gl = context.gl;\n    program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.backCCW,\n        uniformValues, terrainData, projectionData, layer.id, buffers.layoutVertexBuffer,\n        buffers.indexBuffer, segments, layer.paint,\n        painter.transform.zoom, buffers.programConfigurations.get(layer.id),\n        buffers.dynamicLayoutVertexBuffer, buffers.opacityVertexBuffer);\n}\n","import {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {type Program} from '../program.ts';\nimport {circleUniformValues} from '../program/circle_program.ts';\nimport {SegmentVector} from '../../data/segment.ts';\nimport {type OverscaledTileID} from '../../tile/tile_id.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {CircleStyleLayer} from '../../style/style_layer/circle_style_layer.ts';\nimport type {CircleBucket} from '../../data/bucket/circle_bucket.ts';\nimport type {ProgramConfiguration} from '../../data/program_configuration.ts';\nimport type {VertexBuffer} from '../vertex_buffer.ts';\nimport type {IndexBuffer} from '../index_buffer.ts';\nimport type {UniformValues} from '../uniform_binding.ts';\nimport type {CircleUniformsType} from '../program/circle_program.ts';\nimport type {TerrainData} from '../../render/terrain.ts';\nimport {translatePosition} from '../../util/util.ts';\nimport type {ProjectionData} from '../../geo/projection/projection_data.ts';\n\ntype TileRenderState = {\n    programConfiguration: ProgramConfiguration;\n    program: Program<any>;\n    layoutVertexBuffer: VertexBuffer;\n    indexBuffer: IndexBuffer;\n    uniformValues: UniformValues<CircleUniformsType>;\n    terrainData: TerrainData;\n    projectionData: ProjectionData;\n};\n\ntype SegmentsTileRenderState = {\n    segments: SegmentVector;\n    sortKey: number;\n    state: TileRenderState;\n};\n\nexport function drawCircles(painter: Painter, tileManager: TileManager, layer: CircleStyleLayer, coords: OverscaledTileID[], renderOptions: RenderOptions): void {\n    if (painter.renderPass !== 'translucent') return;\n\n    const {isRenderingToTexture} = renderOptions;\n    const opacity = layer.paint.get('circle-opacity');\n    const strokeWidth = layer.paint.get('circle-stroke-width');\n    const strokeOpacity = layer.paint.get('circle-stroke-opacity');\n    const sortFeaturesByKey = !layer.layout.get('circle-sort-key').isConstant();\n\n    if (opacity.constantOr(1) === 0 && (strokeWidth.constantOr(1) === 0 || strokeOpacity.constantOr(1) === 0)) {\n        return;\n    }\n\n    const context = painter.context;\n    const gl = context.gl;\n    const transform = painter.transform;\n\n    const depthMode = painter.getDepthModeForSublayer(0, DepthMode.ReadOnly);\n    // Turn off stencil testing to allow circles to be drawn across boundaries,\n    // so that large circles are not clipped to tiles\n    const stencilMode = StencilMode.disabled;\n    const colorMode = painter.colorModeForRenderPass();\n\n    const segmentsRenderStates: SegmentsTileRenderState[] = [];\n\n    // Note: due to how the shader is written, this value only has effect when globe rendering is enabled and `circle-pitch-alignment` is set to 'map'.\n    const radiusCorrectionFactor = transform.getCircleRadiusCorrection();\n\n    for (const coord of coords) {\n\n        const tile = tileManager.getTile(coord);\n        const bucket: CircleBucket<any> = (tile.getBucket(layer) as any);\n        if (!bucket) continue;\n\n        const styleTranslate = layer.paint.get('circle-translate');\n        const styleTranslateAnchor = layer.paint.get('circle-translate-anchor');\n        const translateForUniforms = translatePosition(transform, tile, styleTranslate, styleTranslateAnchor);\n\n        const programConfiguration = bucket.programConfigurations.get(layer.id);\n        const program = painter.useProgram('circle', programConfiguration);\n        const layoutVertexBuffer = bucket.layoutVertexBuffer;\n        const indexBuffer = bucket.indexBuffer;\n        const terrainData = painter.style.map.terrain?.getTerrainData(coord);\n        const uniformValues = circleUniformValues(painter, tile, layer, translateForUniforms, radiusCorrectionFactor);\n\n        const projectionData = transform.getProjectionData({overscaledTileID: coord, applyGlobeMatrix: !isRenderingToTexture, applyTerrainMatrix: true});\n\n        const state: TileRenderState = {\n            programConfiguration,\n            program,\n            layoutVertexBuffer,\n            indexBuffer,\n            uniformValues,\n            terrainData,\n            projectionData\n        };\n\n        if (sortFeaturesByKey) {\n            const oldSegments = bucket.segments.get();\n            for (const segment of oldSegments) {\n                segmentsRenderStates.push({\n                    segments: new SegmentVector([segment]),\n                    sortKey: (segment.sortKey),\n                    state\n                });\n            }\n        } else {\n            segmentsRenderStates.push({\n                segments: bucket.segments,\n                sortKey: 0,\n                state\n            });\n        }\n\n    }\n\n    if (sortFeaturesByKey) {\n        segmentsRenderStates.sort((a, b) => a.sortKey - b.sortKey);\n    }\n\n    for (const segmentsState of segmentsRenderStates) {\n        const {programConfiguration, program, layoutVertexBuffer, indexBuffer, uniformValues, terrainData, projectionData} = segmentsState.state;\n        const segments = segmentsState.segments;\n\n        program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.backCCW,\n            uniformValues, terrainData, projectionData, layer.id,\n            layoutVertexBuffer, indexBuffer, segments,\n            layer.paint, painter.transform.zoom, programConfiguration);\n    }\n}\n","import {Texture} from '../texture.ts';\nimport {Color} from '@maplibre/maplibre-gl-style-spec';\nimport {DepthMode} from '../depth_mode.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {ColorMode} from '../color_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {type Context} from '../context.ts';\nimport {type Framebuffer} from '../framebuffer.ts';\nimport {type Tile} from '../../tile/tile.ts';\nimport {\n    heatmapUniformValues,\n    heatmapTextureUniformValues\n} from '../program/heatmap_program.ts';\nimport {HEATMAP_FULL_RENDER_FBO_KEY} from '../../style/style_layer/heatmap_style_layer.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {HeatmapStyleLayer} from '../../style/style_layer/heatmap_style_layer.ts';\nimport type {HeatmapBucket} from '../../data/bucket/heatmap_bucket.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport function drawHeatmap(painter: Painter, tileManager: TileManager, layer: HeatmapStyleLayer, tileIDs: OverscaledTileID[], renderOptions: RenderOptions): void {\n    if (layer.paint.get('heatmap-opacity') === 0) {\n        return;\n    }\n    const context = painter.context;\n    const {isRenderingToTexture, isRenderingGlobe} = renderOptions;\n\n    if (painter.style.map.terrain) {\n        for (const coord of tileIDs) {\n            const tile = tileManager.getTile(coord);\n            // Skip tiles that have uncovered parents to avoid flickering; we don't need\n            // to use complex tile masking here because the change between zoom levels is subtle,\n            // so it's fine to simply render the parent until all its 4 children are loaded\n            if (tileManager.hasRenderableParent(coord)) continue;\n            if (painter.renderPass === 'offscreen') {\n                prepareHeatmapTerrain(painter, tile, layer, coord, isRenderingGlobe);\n            } else if (painter.renderPass === 'translucent') {\n                renderHeatmapTerrain(painter, layer, coord, isRenderingToTexture, isRenderingGlobe);\n            }\n        }\n        context.viewport.set([0, 0, painter.width, painter.height]);\n    } else {\n        if (painter.renderPass === 'offscreen') {\n            prepareHeatmapFlat(painter, tileManager, layer, tileIDs);\n        } else if (painter.renderPass === 'translucent') {\n            renderHeatmapFlat(painter, layer);\n        }\n\n    }\n}\n\nfunction prepareHeatmapFlat(painter: Painter, tileManager: TileManager, layer: HeatmapStyleLayer, coords: OverscaledTileID[]) {\n    const context = painter.context;\n    const gl = context.gl;\n    const transform = painter.transform;\n\n    // Allow kernels to be drawn across boundaries, so that\n    // large kernels are not clipped to tiles\n    const stencilMode = StencilMode.disabled;\n    // Turn on additive blending for kernels, which is a key aspect of kernel density estimation formula\n    const colorMode = new ColorMode([gl.ONE, gl.ONE], Color.transparent, [true, true, true, true]);\n\n    bindFramebuffer(context, painter, layer);\n\n    context.clear({color: Color.transparent});\n\n    for (const coord of coords) {\n\n        // Skip tiles that have uncovered parents to avoid flickering; we don't need\n        // to use complex tile masking here because the change between zoom levels is subtle,\n        // so it's fine to simply render the parent until all its 4 children are loaded\n        if (tileManager.hasRenderableParent(coord)) continue;\n\n        const tile = tileManager.getTile(coord);\n        const bucket: HeatmapBucket = (tile.getBucket(layer) as any);\n        if (!bucket) continue;\n\n        const programConfiguration = bucket.programConfigurations.get(layer.id);\n        const program = painter.useProgram('heatmap', programConfiguration);\n\n        const projectionData = transform.getProjectionData({overscaledTileID: coord, applyGlobeMatrix: true, applyTerrainMatrix: false});\n\n        const radiusCorrectionFactor = transform.getCircleRadiusCorrection();\n\n        program.draw(context, gl.TRIANGLES, DepthMode.disabled, stencilMode, colorMode, CullFaceMode.backCCW,\n            heatmapUniformValues(tile, transform.zoom, layer.paint.get('heatmap-intensity'), radiusCorrectionFactor),\n            null, projectionData,\n            layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer,\n            bucket.segments, layer.paint, transform.zoom,\n            programConfiguration);\n    }\n\n    context.viewport.set([0, 0, painter.width, painter.height]);\n}\n\nfunction renderHeatmapFlat(painter: Painter, layer: HeatmapStyleLayer) {\n    const context = painter.context;\n    const gl = context.gl;\n\n    context.setColorMode(painter.colorModeForRenderPass());\n\n    // Here we bind two different textures from which we'll sample in drawing\n    // heatmaps: the kernel texture, prepared in the offscreen pass, and a\n    // color ramp texture.\n    const fbo = layer.heatmapFbos.get(HEATMAP_FULL_RENDER_FBO_KEY);\n    if (!fbo) return;\n    context.activeTexture.set(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n\n    context.activeTexture.set(gl.TEXTURE1);\n    const colorRampTexture = getColorRampTexture(context, layer);\n    colorRampTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n    painter.useProgram('heatmapTexture').draw(context, gl.TRIANGLES,\n        DepthMode.disabled, StencilMode.disabled, painter.colorModeForRenderPass(), CullFaceMode.disabled,\n        heatmapTextureUniformValues(painter, layer, 0, 1), null, null,\n        layer.id, painter.viewportBuffer, painter.quadTriangleIndexBuffer,\n        painter.viewportSegments, layer.paint, painter.transform.zoom);\n}\n\nfunction prepareHeatmapTerrain(painter: Painter, tile: Tile, layer: HeatmapStyleLayer, coord: OverscaledTileID, isRenderingGlobe: boolean) {\n    const context = painter.context;\n    const gl = context.gl;\n\n    const stencilMode = StencilMode.disabled;\n    // Turn on additive blending for kernels, which is a key aspect of kernel density estimation formula\n    const colorMode = new ColorMode([gl.ONE, gl.ONE], Color.transparent, [true, true, true, true]);\n\n    const bucket: HeatmapBucket = (tile.getBucket(layer) as any);\n    if (!bucket) return;\n\n    const tileKey = coord.key;\n    let fbo = layer.heatmapFbos.get(tileKey);\n    if (!fbo) {\n        fbo = createHeatmapFbo(context, tile.tileSize, tile.tileSize);\n        layer.heatmapFbos.set(tileKey, fbo);\n    }\n\n    context.bindFramebuffer.set(fbo.framebuffer);\n    context.viewport.set([0, 0, tile.tileSize, tile.tileSize]);\n\n    context.clear({color: Color.transparent});\n\n    const programConfiguration = bucket.programConfigurations.get(layer.id);\n    const program = painter.useProgram('heatmap', programConfiguration, !isRenderingGlobe);\n\n    const projectionData = painter.transform.getProjectionData({overscaledTileID: tile.tileID, applyGlobeMatrix: true, applyTerrainMatrix: true});\n\n    const terrainData = painter.style.map.terrain.getTerrainData(coord);\n    program.draw(context, gl.TRIANGLES, DepthMode.disabled, stencilMode, colorMode, CullFaceMode.disabled,\n        heatmapUniformValues(tile, painter.transform.zoom, layer.paint.get('heatmap-intensity'), 1.0), terrainData, projectionData,\n        layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer,\n        bucket.segments, layer.paint, painter.transform.zoom,\n        programConfiguration);\n}\n\nfunction renderHeatmapTerrain(painter: Painter, layer: HeatmapStyleLayer, coord: OverscaledTileID, isRenderingToTexture: boolean, isRenderingGlobe: boolean) {\n    const context = painter.context;\n    const gl = context.gl;\n    const transform = painter.transform;\n\n    context.setColorMode(painter.colorModeForRenderPass());\n\n    const colorRampTexture = getColorRampTexture(context, layer);\n\n    // Here we bind two different textures from which we'll sample in drawing\n    // heatmaps: the kernel texture, prepared in the offscreen pass, and a\n    // color ramp texture.\n    const tileKey = coord.key;\n    const fbo = layer.heatmapFbos.get(tileKey);\n    if (!fbo) return;\n\n    context.activeTexture.set(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n\n    context.activeTexture.set(gl.TEXTURE1);\n    colorRampTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n    const projectionData = transform.getProjectionData({overscaledTileID: coord, applyTerrainMatrix: isRenderingGlobe, applyGlobeMatrix: !isRenderingToTexture});\n\n    painter.useProgram('heatmapTexture').draw(context, gl.TRIANGLES,\n        DepthMode.disabled, StencilMode.disabled, painter.colorModeForRenderPass(), CullFaceMode.disabled,\n        heatmapTextureUniformValues(painter, layer, 0, 1), null, projectionData,\n        layer.id, painter.rasterBoundsBuffer, painter.quadTriangleIndexBuffer,\n        painter.rasterBoundsSegments, layer.paint, transform.zoom);\n\n    // destroy the FBO after rendering\n    fbo.destroy();\n    layer.heatmapFbos.delete(tileKey);\n}\n\nfunction bindFramebuffer(context: Context, painter: Painter, layer: HeatmapStyleLayer) {\n    const gl = context.gl;\n    context.activeTexture.set(gl.TEXTURE1);\n\n    // Use a 4x downscaled screen texture for better performance\n    context.viewport.set([0, 0, painter.width / 4, painter.height / 4]);\n\n    let fbo = layer.heatmapFbos.get(HEATMAP_FULL_RENDER_FBO_KEY);\n\n    if (!fbo) {\n        fbo = createHeatmapFbo(context, painter.width / 4, painter.height / 4);\n        layer.heatmapFbos.set(HEATMAP_FULL_RENDER_FBO_KEY, fbo);\n    } else {\n        gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n        context.bindFramebuffer.set(fbo.framebuffer);\n    }\n}\n\nfunction createHeatmapFbo(context: Context, width: number, height: number): Framebuffer {\n    const gl = context.gl;\n    const texture = gl.createTexture();\n    gl.bindTexture(gl.TEXTURE_2D, texture);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n    gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA16F, width, height);\n\n    const fbo = context.createFramebuffer(width, height, false, false);\n    fbo.colorAttachment.set(texture);\n\n    return fbo;\n}\n\nfunction getColorRampTexture(context: Context, layer: HeatmapStyleLayer): Texture {\n    layer.colorRampTexture ||= new Texture(context, layer.colorRamp, context.gl.RGBA);\n    return layer.colorRampTexture;\n}\n","import {DepthMode} from '../depth_mode.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {layerOpacityUniformValues} from '../program/layer_opacity_program.ts';\nimport {Color} from '@maplibre/maplibre-gl-style-spec';\n\nimport type {Painter} from '../../render/painter.ts';\nimport type {LineStyleLayer} from '../../style/style_layer/line_style_layer.ts';\nimport type {FillStyleLayer} from '../../style/style_layer/fill_style_layer.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport type PrepareDrawLayerOpacityResult = {\n    compositeTarget: WebGLFramebuffer;\n    compositeViewport: [number, number, number, number];\n};\n\n/**\n * Partial line-layer-opacity\n * render the whole layer to a scratch FBO, then composite with `layerOpacity`.\n * Applies opacity uniformly to the layer instead of accumulating alpha across overlapping segments.\n */\nexport function prepareDrawLayerOpacity(painter: Painter, layer: LineStyleLayer | FillStyleLayer, coords: OverscaledTileID[], terrain: boolean): PrepareDrawLayerOpacityResult {\n    const context = painter.context;\n    const compositeTarget = context.bindFramebuffer.get();\n    const compositeViewport = context.viewport.get();\n    const [, , width, height] = compositeViewport;\n\n    bindLayerOpacity(painter, width, height);\n\n    context.viewport.set([0, 0, width, height]);\n    context.clear({color: Color.transparent, depth: 1, stencil: 0});\n\n    painter.currentStencilSource = undefined;\n    painter.renderTileClippingMasks(layer, coords, terrain);\n\n    return {\n        compositeTarget,\n        compositeViewport\n    };\n}\n\nfunction bindLayerOpacity(painter: Painter, width: number, height: number): void {\n    const gl = painter.context.gl;\n\n    if (!painter.layerOpacityFbo) {\n        const fbo = painter.context.createFramebuffer(width, height, true, true);\n        const texture = gl.createTexture();\n        gl.bindTexture(gl.TEXTURE_2D, texture);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n        fbo.colorAttachment.set(texture);\n        fbo.depthAttachment.set(painter.context.createRenderbuffer(gl.DEPTH_STENCIL, width, height));\n        painter.layerOpacityFbo = fbo;\n        painter.context.bindFramebuffer.set(painter.layerOpacityFbo.framebuffer);\n        return;\n    }\n    if (painter.layerOpacityFbo.width === width && painter.layerOpacityFbo.height === height) {\n        painter.context.bindFramebuffer.set(painter.layerOpacityFbo.framebuffer);\n        return;\n    }\n    const fbo = painter.layerOpacityFbo;\n    gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n    painter.context.bindRenderbuffer.set(fbo.depthAttachment.get());\n    gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);\n    painter.context.bindRenderbuffer.set(null);\n    fbo.width = width;\n    fbo.height = height;\n    painter.context.bindFramebuffer.set(fbo.framebuffer);\n}\n\nexport function drawLayerOpacity(painter: Painter, opacity: number, prepareDrawLayerOpacityResult: PrepareDrawLayerOpacityResult, layer: LineStyleLayer | FillStyleLayer): void {\n    const context = painter.context;\n    const gl = context.gl;\n\n    context.bindFramebuffer.set(prepareDrawLayerOpacityResult.compositeTarget);\n    context.viewport.set(prepareDrawLayerOpacityResult.compositeViewport);\n\n    context.activeTexture.set(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, painter.layerOpacityFbo.colorAttachment.get());\n\n    painter.useProgram('layerOpacity').draw(context, gl.TRIANGLES,\n        DepthMode.disabled, StencilMode.disabled, painter.colorModeForRenderPass(), CullFaceMode.disabled,\n        layerOpacityUniformValues(opacity, 0), null, null,\n        layer.id, painter.viewportBuffer, painter.quadTriangleIndexBuffer,\n        painter.viewportSegments, layer.paint, painter.transform.zoom);\n\n    // Clipping masks were drawn into the scratch FBO's stencil buffer, not the composite target's.\n    // Reset currentStencilSource so a later layer on the same source redraws its masks into the composite target instead of reusing stale ones.\n    painter.currentStencilSource = undefined;\n}\n","import {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {Texture} from '../texture.ts';\nimport {\n    lineUniformValues,\n    linePatternUniformValues,\n    lineSDFUniformValues,\n    lineGradientUniformValues,\n    lineGradientSDFUniformValues\n} from '../program/line_program.ts';\nimport {clamp, nextPowerOfTwo} from '../../util/util.ts';\nimport {renderColorRamp} from '../../util/color_ramp.ts';\nimport {EXTENT} from '../../data/extent.ts';\nimport {drawLayerOpacity, prepareDrawLayerOpacity} from './draw_layer_opacity.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {LineStyleLayer} from '../../style/style_layer/line_style_layer.ts';\nimport type {LineBucket} from '../../data/bucket/line_bucket.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\nimport type {Tile} from '../../tile/tile.ts';\nimport type {Context} from '../context.ts';\nimport type {ProgramConfiguration} from '../../data/program_configuration.ts';\nimport type {RGBAImage} from '../../util/image.ts';\n\ntype GradientTexture = {\n    texture?: Texture;\n    gradient?: RGBAImage;\n    version?: number;\n};\n\nfunction updateGradientTexture(\n    painter: Painter,\n    tileManager: TileManager,\n    context: Context,\n    gl: WebGLRenderingContext,\n    layer: LineStyleLayer,\n    bucket: LineBucket,\n    coord: OverscaledTileID,\n    layerGradient: GradientTexture\n): Texture {\n    let textureResolution = 256;\n    if (layer.stepInterpolant) {\n        const sourceMaxZoom = tileManager.getSource().maxzoom;\n        const potentialOverzoom = coord.canonical.z === sourceMaxZoom ?\n            Math.ceil(1 << (painter.transform.maxZoom - coord.canonical.z)) : 1;\n        const lineLength = bucket.maxLineLength / EXTENT;\n        // Logical pixel tile size is 512px, and 1024px right before current zoom + 1\n        const maxTilePixelSize = 1024;\n        // Maximum possible texture coverage heuristic, bound by hardware max texture size\n        const maxTextureCoverage = lineLength * maxTilePixelSize * potentialOverzoom;\n        textureResolution = clamp(nextPowerOfTwo(maxTextureCoverage), 256, context.maxTextureSize);\n    }\n    layerGradient.gradient = renderColorRamp({\n        expression: layer.gradientExpression(),\n        evaluationKey: 'lineProgress',\n        resolution: textureResolution,\n        image: layerGradient.gradient || undefined,\n        clips: bucket.lineClipsArray\n    });\n    if (layerGradient.texture) {\n        layerGradient.texture.update(layerGradient.gradient);\n    } else {\n        layerGradient.texture = new Texture(context, layerGradient.gradient, gl.RGBA);\n    }\n    layerGradient.version = layer.gradientVersion;\n    return layerGradient.texture;\n}\n\nfunction bindImagePatternTextures(\n    context: Context,\n    gl: WebGLRenderingContext,\n    tile: Tile,\n    programConfiguration: ProgramConfiguration,\n    crossfade: ReturnType<LineStyleLayer['getCrossfadeParameters']>\n) {\n    context.activeTexture.set(gl.TEXTURE0);\n    tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n    programConfiguration.updatePaintBuffers(crossfade);\n}\n\nfunction bindDasharrayTextures(\n    painter: Painter,\n    context: Context,\n    gl: WebGLRenderingContext,\n    programConfiguration: ProgramConfiguration,\n    programChanged: boolean,\n    crossfade: ReturnType<LineStyleLayer['getCrossfadeParameters']>\n) {\n    if (programChanged || painter.lineAtlas.dirty) {\n        context.activeTexture.set(gl.TEXTURE0);\n        painter.lineAtlas.bind(context);\n    }\n    programConfiguration.updatePaintBuffers(crossfade);\n}\n\nfunction bindGradientTextures(\n    painter: Painter,\n    tileManager: TileManager,\n    context: Context,\n    gl: WebGLRenderingContext,\n    layer: LineStyleLayer,\n    bucket: LineBucket,\n    coord: OverscaledTileID\n) {\n    const layerGradient = bucket.gradients[layer.id];\n    let gradientTexture = layerGradient.texture;\n    if (layer.gradientVersion !== layerGradient.version) {\n        gradientTexture = updateGradientTexture(painter, tileManager, context, gl, layer, bucket, coord, layerGradient);\n    }\n    context.activeTexture.set(gl.TEXTURE0);\n    gradientTexture.bind(layer.stepInterpolant ? gl.NEAREST : gl.LINEAR, gl.CLAMP_TO_EDGE);\n}\n\nfunction bindGradientAndDashTextures(\n    painter: Painter,\n    tileManager: TileManager,\n    context: Context,\n    gl: WebGLRenderingContext,\n    layer: LineStyleLayer,\n    bucket: LineBucket,\n    coord: OverscaledTileID,\n    programConfiguration: ProgramConfiguration,\n    crossfade: ReturnType<LineStyleLayer['getCrossfadeParameters']>\n) {\n    // Bind gradient texture to TEXTURE0\n    const layerGradient = bucket.gradients[layer.id];\n    let gradientTexture = layerGradient.texture;\n    if (layer.gradientVersion !== layerGradient.version) {\n        gradientTexture = updateGradientTexture(painter, tileManager, context, gl, layer, bucket, coord, layerGradient);\n    }\n    context.activeTexture.set(gl.TEXTURE0);\n    gradientTexture.bind(layer.stepInterpolant ? gl.NEAREST : gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n    // Bind dash atlas to TEXTURE1\n    context.activeTexture.set(gl.TEXTURE1);\n    painter.lineAtlas.bind(context);\n\n    programConfiguration.updatePaintBuffers(crossfade);\n}\n\nexport function drawLine(painter: Painter, tileManager: TileManager, layer: LineStyleLayer, coords: OverscaledTileID[], renderOptions: RenderOptions): void {\n    if (painter.renderPass !== 'translucent') return;\n\n    const opacity = layer.paint.get('line-opacity');\n    const width = layer.paint.get('line-width');\n    const layerOpacity = layer.paint.get('line-layer-opacity');\n    if (opacity.constantOr(1) === 0 || width.constantOr(1) === 0 || layerOpacity === 0) return;\n\n    const useTerrain = !!painter.style.map.terrain;\n\n    if (layerOpacity < 1) {\n        const results = prepareDrawLayerOpacity(painter, layer, coords, useTerrain);\n        drawLineTiles(painter, tileManager, layer, coords, renderOptions, useTerrain);\n        drawLayerOpacity(painter, layerOpacity, results, layer);\n        return;\n    }\n\n    drawLineTiles(painter, tileManager, layer, coords, renderOptions, useTerrain);\n}\n\nfunction drawLineTiles(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: LineStyleLayer,\n    coords: OverscaledTileID[],\n    renderOptions: RenderOptions,\n    useTerrain: boolean\n) {\n    const {isRenderingToTexture} = renderOptions;\n\n    const depthMode = painter.getDepthModeForSublayer(0, DepthMode.ReadOnly);\n    const colorMode = painter.colorModeForRenderPass();\n\n    const dasharrayProperty = layer.paint.get('line-dasharray');\n    const dasharray = dasharrayProperty.constantOr(1 as any);\n    const patternProperty = layer.paint.get('line-pattern');\n    const image = patternProperty.constantOr(1 as any);\n\n    const gradient = layer.paint.get('line-gradient');\n    const crossfade = layer.getCrossfadeParameters();\n\n    let programId: string;\n    if (image) programId = 'linePattern';\n    else if (dasharray && gradient) programId = 'lineGradientSDF';\n    else if (dasharray) programId = 'lineSDF';\n    else if (gradient) programId = 'lineGradient';\n    else programId = 'line';\n\n    const context = painter.context;\n    const gl = context.gl;\n    const transform = painter.transform;\n\n    let firstTile = true;\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n\n        if (image && !tile.patternsLoaded()) continue;\n\n        const bucket: LineBucket = (tile.getBucket(layer) as any);\n        if (!bucket) continue;\n\n        const programConfiguration = bucket.programConfigurations.get(layer.id);\n        const prevProgram = painter.context.program.get();\n        const program = painter.useProgram(programId, programConfiguration);\n        const programChanged = firstTile || program.program !== prevProgram;\n        const terrainData = useTerrain ? painter.getTerrainDataForTile(coord, isRenderingToTexture) : null;\n\n        const constantPattern = patternProperty.constantOr(null);\n        const constantDasharray = dasharrayProperty?.constantOr(null);\n\n        if (constantPattern && tile.imageAtlas) {\n            const atlas = tile.imageAtlas;\n            const posTo = atlas.patternPositions[constantPattern.to.toString()];\n            const posFrom = atlas.patternPositions[constantPattern.from.toString()];\n            if (posTo && posFrom) programConfiguration.setConstantPatternPositions(posTo, posFrom);\n        } else if (constantDasharray) {\n            const round = layer.layout.get('line-cap').constantOr(null) === 'round';\n            const dashTo = painter.lineAtlas.getDash(constantDasharray.to, round);\n            const dashFrom = painter.lineAtlas.getDash(constantDasharray.from, round);\n            programConfiguration.setConstantDashPositions(dashTo, dashFrom);\n        }\n\n        const projectionData = transform.getProjectionData({\n            overscaledTileID: coord,\n            applyGlobeMatrix: !isRenderingToTexture,\n            applyTerrainMatrix: true\n        });\n\n        const pixelRatio = transform.getPixelScale();\n\n        let uniformValues;\n        if (image) {\n            uniformValues = linePatternUniformValues(painter, tile, layer, pixelRatio, crossfade);\n            bindImagePatternTextures(context, gl, tile, programConfiguration, crossfade);\n        } else if (dasharray && gradient) {\n            uniformValues = lineGradientSDFUniformValues(painter, tile, layer, pixelRatio, crossfade, bucket.lineClipsArray.length);\n            bindGradientAndDashTextures(painter, tileManager, context, gl, layer, bucket, coord, programConfiguration, crossfade);\n        } else if (dasharray) {\n            uniformValues = lineSDFUniformValues(painter, tile, layer, pixelRatio, crossfade);\n            bindDasharrayTextures(painter, context, gl, programConfiguration, programChanged, crossfade);\n        } else if (gradient) {\n            uniformValues = lineGradientUniformValues(painter, tile, layer, pixelRatio, bucket.lineClipsArray.length);\n            bindGradientTextures(painter, tileManager, context, gl, layer, bucket, coord);\n        } else {\n            uniformValues = lineUniformValues(painter, tile, layer, pixelRatio);\n        }\n\n        const stencil = painter.stencilModeForClipping(coord);\n\n        program.draw(context, gl.TRIANGLES, depthMode,\n            stencil, colorMode, CullFaceMode.disabled, uniformValues, terrainData, projectionData,\n            layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer, bucket.segments,\n            layer.paint, painter.transform.zoom, programConfiguration, bucket.layoutVertexBuffer2);\n\n        firstTile = false;\n        // once refactored so that bound texture state is managed, we'll also be able to remove this firstTile/programChanged logic\n    }\n}\n","import type {CrossFaded} from '../style/properties.ts';\nimport type {ResolvedImage} from '@maplibre/maplibre-gl-style-spec';\nimport type {Tile} from '../tile/tile.ts';\nimport type {ProgramConfiguration} from '../data/program_configuration.ts';\nimport type {FillExtrusionStyleLayer} from '../style/style_layer/fill_extrusion_style_layer.ts';\nimport type {FillStyleLayer} from '../style/style_layer/fill_style_layer.ts';\n\n/**\n * A simple helper shared by draw_fill and draw_fill_extrusions to find the correct pattern positions AND update program.\n * For transitionable properties, especially 'fill-pattern' and 'fill-extrusion-pattern', while rendering certain frames\n * tile.imageAtlas has been updated by worker to hold the new pattern only, but rendering code is still looking for the previous image.\n * The mismatch was causing setConstantPatternPositions method not being called and pixelRatio was always the\n * default of 1, instead of actual values set by original map.addImage.\n *\n * @param programConfiguration - to be used to set pattern position and device pixel ratio.\n * @param propertyName - 'fill-pattern' or 'fill-extrusion-pattern' property key\n * @param constantPattern - either 'fill-pattern' or 'fill-extrusion-pattern' property value\n * @param tile - current tile being drawn\n * @param layer - current layer being rendered\n */\nexport function updatePatternPositionsInProgram(\n    programConfiguration: ProgramConfiguration,\n    propertyName: 'fill-pattern' | 'fill-extrusion-pattern',\n    constantPattern: CrossFaded<ResolvedImage>,\n    tile: Tile,\n    layer: FillStyleLayer | FillExtrusionStyleLayer): void {\n\n    if (!constantPattern || !tile?.imageAtlas) {\n        return;\n    }\n\n    const patternPositions = tile.imageAtlas.patternPositions;\n    let posTo = patternPositions[constantPattern.to.toString()];\n    let posFrom = patternPositions[constantPattern.from.toString()];\n\n    // https://github.com/maplibre/maplibre-gl-js/issues/3377\n    if (!posTo && posFrom) posTo = posFrom;\n    if (!posFrom && posTo) posFrom = posTo;\n\n    // try again in case patternPositions has been updated by worker\n    if (!posTo || !posFrom) {\n        const transitioned = layer.getPaintProperty(propertyName) as string;\n        posTo = patternPositions[transitioned];\n        posFrom = patternPositions[transitioned];\n    }\n\n    if (posTo && posFrom) {\n        programConfiguration.setConstantPatternPositions(posTo, posFrom);\n    }\n}\n","import {Color} from '@maplibre/maplibre-gl-style-spec';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {\n    fillUniformValues,\n    fillPatternUniformValues,\n    fillOutlineUniformValues,\n    fillOutlinePatternUniformValues\n} from '../program/fill_program.ts';\nimport {updatePatternPositionsInProgram} from '../../render/update_pattern_positions_in_program.ts';\nimport {translatePosition} from '../../util/util.ts';\nimport {drawLayerOpacity, prepareDrawLayerOpacity} from './draw_layer_opacity.ts';\n\nimport type {ColorMode} from '../color_mode.ts';\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {FillStyleLayer} from '../../style/style_layer/fill_style_layer.ts';\nimport type {FillBucket} from '../../data/bucket/fill_bucket.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport function drawFill(painter: Painter, tileManager: TileManager, layer: FillStyleLayer, coords: OverscaledTileID[], renderOptions: RenderOptions): void {\n    const color = layer.paint.get('fill-color');\n    const opacity = layer.paint.get('fill-opacity');\n    const layerOpacity = layer.paint.get('fill-layer-opacity');\n    if (opacity.constantOr(1) === 0 || layerOpacity === 0) return;\n\n    if (layerOpacity < 1) {\n        if (painter.renderPass !== 'translucent') return;\n        const useTerrain = !!painter.style.map.terrain;\n\n        const results = prepareDrawLayerOpacity(painter,layer, coords, useTerrain);\n        drawFillAndOutline(painter, tileManager, layer, coords, renderOptions);\n        drawLayerOpacity(painter, layerOpacity, results, layer);\n        return;\n    }\n\n    const pattern = layer.paint.get('fill-pattern');\n    const fillEligibleForOpaque = painter.opaquePassEnabledForLayer() &&\n        !pattern.constantOr(1 as any) &&\n        color.constantOr(Color.transparent).a === 1 &&\n        opacity.constantOr(0) === 1;\n\n    if (fillEligibleForOpaque && painter.renderPass === 'opaque') {\n        // Opaque-eligible fill draws standalone in the opaque pass with ReadWrite depth;\n        // its outline (always translucent) runs in the translucent pass below.\n        const {isRenderingToTexture} = renderOptions;\n        const colorMode = painter.colorModeForRenderPass();\n        const depthMode = painter.getDepthModeForSublayer(1, DepthMode.ReadWrite);\n        drawFillTiles(painter, tileManager, layer, coords, depthMode, colorMode, false, isRenderingToTexture);\n        return;\n    }\n    if (fillEligibleForOpaque && painter.renderPass === 'translucent') {\n        // Fill already drew in the opaque pass; just draw the outline here.\n        drawOutline(painter, tileManager, layer, coords, renderOptions);\n        return;\n    }\n    if (painter.renderPass === 'translucent') {\n        drawFillAndOutline(painter, tileManager, layer, coords, renderOptions);\n    }\n}\n\n/**\n * Draw fill + outline in a single translucent pass with ReadOnly depth.\n * Shared by the layer-opacity subpass (always) and the normal translucent path\n * (when the fill is not opaque-pass-eligible).\n */\nfunction drawFillAndOutline(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: FillStyleLayer,\n    coords: OverscaledTileID[],\n    renderOptions: RenderOptions\n) {\n    const {isRenderingToTexture} = renderOptions;\n    const colorMode = painter.colorModeForRenderPass();\n\n    const fillDepthMode = painter.getDepthModeForSublayer(1, DepthMode.ReadOnly);\n    drawFillTiles(painter, tileManager, layer, coords, fillDepthMode, colorMode, false, isRenderingToTexture);\n\n    drawOutline(painter, tileManager, layer, coords, renderOptions);\n}\n\nfunction drawOutline(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: FillStyleLayer,\n    coords: OverscaledTileID[],\n    renderOptions: RenderOptions\n) {\n    if (!layer.paint.get('fill-antialias')) return;\n\n    // If we defined a different color for the fill outline, we are\n    // going to ignore the bits in 0x07 and just care about the global\n    // clipping mask.\n    // Otherwise, we only want to drawFill the antialiased parts that are\n    // *outside* the current shape. This is important in case the fill\n    // or stroke color is translucent. If we wouldn't clip to outside\n    // the current shape, some pixels from the outline stroke overlapped\n    // the (non-antialiased) fill.\n    const {isRenderingToTexture} = renderOptions;\n    const colorMode = painter.colorModeForRenderPass();\n    const depthMode = painter.getDepthModeForSublayer(\n        layer.getPaintProperty('fill-outline-color') ? 2 : 0, DepthMode.ReadOnly);\n    drawFillTiles(painter, tileManager, layer, coords, depthMode, colorMode, true, isRenderingToTexture);\n}\n\nfunction drawFillTiles(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: FillStyleLayer,\n    coords: OverscaledTileID[],\n    depthMode: Readonly<DepthMode>,\n    colorMode: Readonly<ColorMode>,\n    isOutline: boolean,\n    isRenderingToTexture: boolean) {\n    const gl = painter.context.gl;\n    const fillPropertyName = 'fill-pattern';\n    const patternProperty = layer.paint.get(fillPropertyName);\n    const image = patternProperty?.constantOr(1 as any);\n    const crossfade = layer.getCrossfadeParameters();\n    let drawMode, programName, uniformValues, indexBuffer, segments;\n\n    const transform = painter.transform;\n\n    const propertyFillTranslate = layer.paint.get('fill-translate');\n    const propertyFillTranslateAnchor = layer.paint.get('fill-translate-anchor');\n\n    if (!isOutline) {\n        programName = image ? 'fillPattern' : 'fill';\n        drawMode = gl.TRIANGLES;\n    } else {\n        programName = image && !layer.getPaintProperty('fill-outline-color') ? 'fillOutlinePattern' : 'fillOutline';\n        drawMode = gl.LINES;\n    }\n\n    const constantPattern = patternProperty.constantOr(null);\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n        if (image && !tile.patternsLoaded()) continue;\n\n        const bucket: FillBucket = (tile.getBucket(layer) as any);\n        if (!bucket) continue;\n\n        const programConfiguration = bucket.programConfigurations.get(layer.id);\n        const program = painter.useProgram(programName, programConfiguration);\n        const terrainData = painter.getTerrainDataForTile(coord, isRenderingToTexture);\n\n        if (image) {\n            painter.context.activeTexture.set(gl.TEXTURE0);\n            tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n            programConfiguration.updatePaintBuffers(crossfade);\n        }\n\n        updatePatternPositionsInProgram(programConfiguration, fillPropertyName, constantPattern, tile, layer);\n\n        const projectionData = transform.getProjectionData({\n            overscaledTileID: coord,\n            applyGlobeMatrix: !isRenderingToTexture,\n            applyTerrainMatrix: true\n        });\n\n        const translateForUniforms = translatePosition(transform, tile, propertyFillTranslate, propertyFillTranslateAnchor);\n\n        if (!isOutline) {\n            indexBuffer = bucket.indexBuffer;\n            segments = bucket.segments;\n            uniformValues = image ? fillPatternUniformValues(painter, crossfade, tile, translateForUniforms) : fillUniformValues(translateForUniforms);\n        } else {\n            indexBuffer = bucket.indexBuffer2;\n            segments = bucket.segments2;\n            const drawingBufferSize = [gl.drawingBufferWidth, gl.drawingBufferHeight] as [number, number];\n            uniformValues = (programName === 'fillOutlinePattern' && image) ?\n                fillOutlinePatternUniformValues(painter, crossfade, tile, drawingBufferSize, translateForUniforms) :\n                fillOutlineUniformValues(drawingBufferSize, translateForUniforms);\n        }\n\n        const stencil = painter.stencilModeForClipping(coord);\n\n        program.draw(painter.context, drawMode, depthMode,\n            stencil, colorMode, CullFaceMode.backCCW, uniformValues, terrainData, projectionData,\n            layer.id, bucket.layoutVertexBuffer, indexBuffer, segments,\n            layer.paint, painter.transform.zoom, programConfiguration);\n    }\n}\n","import {DepthMode} from '../depth_mode.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {ColorMode} from '../color_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {\n    fillExtrusionUniformValues,\n    fillExtrusionPatternUniformValues,\n} from '../program/fill_extrusion_program.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {FillExtrusionStyleLayer} from '../../style/style_layer/fill_extrusion_style_layer.ts';\nimport type {FillExtrusionBucket} from '../../data/bucket/fill_extrusion_bucket.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nimport {updatePatternPositionsInProgram} from '../../render/update_pattern_positions_in_program.ts';\nimport {translatePosition} from '../../util/util.ts';\n\nexport function drawFillExtrusion(painter: Painter, tileManager: TileManager, layer: FillExtrusionStyleLayer, coords: OverscaledTileID[], renderOptions: RenderOptions): void {\n    const opacity = layer.paint.get('fill-extrusion-opacity');\n    if (opacity === 0) {\n        return;\n    }\n\n    const {isRenderingToTexture} = renderOptions;\n    if (painter.renderPass === 'translucent') {\n        const depthMode = new DepthMode(painter.context.gl.LEQUAL, DepthMode.ReadWrite, painter.depthRangeFor3D);\n\n        if (opacity === 1 && !layer.paint.get('fill-extrusion-pattern').constantOr(1 as any)) {\n            const colorMode = painter.colorModeForRenderPass();\n            drawExtrusionTiles(painter, tileManager, layer, coords, depthMode, StencilMode.disabled, colorMode, isRenderingToTexture);\n\n        } else {\n            // Draw transparent buildings in two passes so that only the closest surface is drawn.\n            // First draw all the extrusions into only the depth buffer. No colors are drawn.\n            drawExtrusionTiles(painter, tileManager, layer, coords, depthMode,\n                StencilMode.disabled,\n                ColorMode.disabled, isRenderingToTexture);\n\n            // Then draw all the extrusions a second type, only coloring fragments if they have the\n            // same depth value as the closest fragment in the previous pass. Use the stencil buffer\n            // to prevent the second draw in cases where we have coincident polygons.\n            drawExtrusionTiles(painter, tileManager, layer, coords, depthMode,\n                painter.stencilModeFor3D(),\n                painter.colorModeForRenderPass(), isRenderingToTexture);\n        }\n    }\n}\n\nfunction drawExtrusionTiles(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: FillExtrusionStyleLayer,\n    coords: OverscaledTileID[],\n    depthMode: DepthMode,\n    stencilMode: Readonly<StencilMode>,\n    colorMode: Readonly<ColorMode>,\n    isRenderingToTexture: boolean) {\n    const context = painter.context;\n    const gl = context.gl;\n    const fillPropertyName = 'fill-extrusion-pattern';\n    const patternProperty = layer.paint.get(fillPropertyName);\n    const image = patternProperty.constantOr(1 as any);\n    const crossfade = layer.getCrossfadeParameters();\n    const opacity = layer.paint.get('fill-extrusion-opacity');\n    const constantPattern = patternProperty.constantOr(null);\n    const transform = painter.transform;\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n        const bucket: FillExtrusionBucket = (tile.getBucket(layer) as any);\n        if (!bucket) continue;\n\n        const terrainData = painter.style.map.terrain?.getTerrainData(coord);\n        const programConfiguration = bucket.programConfigurations.get(layer.id);\n        const program = painter.useProgram(image ? 'fillExtrusionPattern' : 'fillExtrusion', programConfiguration);\n\n        if (image) {\n            painter.context.activeTexture.set(gl.TEXTURE0);\n            tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n            programConfiguration.updatePaintBuffers(crossfade);\n        }\n\n        const projectionData = transform.getProjectionData({overscaledTileID: coord, applyGlobeMatrix: !isRenderingToTexture, applyTerrainMatrix: true});\n        updatePatternPositionsInProgram(programConfiguration, fillPropertyName, constantPattern, tile, layer);\n\n        const translate = translatePosition(\n            transform,\n            tile,\n            layer.paint.get('fill-extrusion-translate'),\n            layer.paint.get('fill-extrusion-translate-anchor')\n        );\n\n        const shouldUseVerticalGradient = layer.paint.get('fill-extrusion-vertical-gradient');\n        const uniformValues = image ?\n            fillExtrusionPatternUniformValues(painter, shouldUseVerticalGradient, opacity, translate, coord, crossfade, tile) :\n            fillExtrusionUniformValues(painter, shouldUseVerticalGradient, opacity, translate);\n\n        program.draw(context, context.gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.backCCW,\n            uniformValues, terrainData, projectionData, layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer,\n            bucket.segments, layer.paint, painter.transform.zoom,\n            programConfiguration, painter.style.map.terrain && bucket.centroidVertexBuffer);\n    }\n}\n","import {Texture} from '../texture.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {type ColorMode} from '../color_mode.ts';\nimport {\n    hillshadeUniformValues,\n    hillshadeUniformPrepareValues\n} from '../program/hillshade_program.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {HillshadeStyleLayer} from '../../style/style_layer/hillshade_style_layer.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport function drawHillshade(painter: Painter, tileManager: TileManager, layer: HillshadeStyleLayer, tileIDs: OverscaledTileID[], renderOptions: RenderOptions): void {\n    if (painter.renderPass !== 'offscreen' && painter.renderPass !== 'translucent') return;\n\n    const {isRenderingToTexture} = renderOptions;\n    const context = painter.context;\n    const projection = painter.style.projection;\n    const useSubdivision = projection.useSubdivision;\n\n    const depthMode = painter.getDepthModeForSublayer(0, DepthMode.ReadOnly);\n    const colorMode = painter.colorModeForRenderPass();\n\n    if (painter.renderPass === 'offscreen') {\n        // Prepare tiles\n        prepareHillshade(painter, tileManager, tileIDs, layer, depthMode, StencilMode.disabled, colorMode);\n        context.viewport.set([0, 0, painter.width, painter.height]);\n    } else if (painter.renderPass === 'translucent') {\n        // Globe (or any projection with subdivision) needs two-pass rendering to avoid artifacts when rendering texture tiles.\n        // See comments in draw_raster.ts for more details.\n        if (useSubdivision) {\n            // Two-pass rendering\n            const [stencilBorderless, stencilBorders, coords] = painter.stencilConfigForOverlapTwoPass(tileIDs);\n            renderHillshade(painter, tileManager, layer, coords, stencilBorderless, depthMode, colorMode, false, isRenderingToTexture); // draw without borders\n            renderHillshade(painter, tileManager, layer, coords, stencilBorders, depthMode, colorMode, true, isRenderingToTexture); // draw with borders\n        } else {\n            // Simple rendering\n            const [stencil, coords] = painter.getStencilConfigForOverlapAndUpdateStencilID(tileIDs);\n            renderHillshade(painter, tileManager, layer, coords, stencil, depthMode, colorMode, false, isRenderingToTexture);\n        }\n    }\n}\n\nfunction renderHillshade(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: HillshadeStyleLayer,\n    coords: OverscaledTileID[],\n    stencilModes: {[_: number]: Readonly<StencilMode>},\n    depthMode: Readonly<DepthMode>,\n    colorMode: Readonly<ColorMode>,\n    useBorder: boolean,\n    isRenderingToTexture: boolean\n) {\n    const projection = painter.style.projection;\n    const context = painter.context;\n    const transform = painter.transform;\n    const gl = context.gl;\n\n    const defines = [`#define NUM_ILLUMINATION_SOURCES ${layer.paint.get('hillshade-highlight-color').values.length}`];\n    const program = painter.useProgram('hillshade', null, false, defines);\n    const align = !painter.options.moving;\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n        const fbo = tile.fbo;\n        if (!fbo) {\n            continue;\n        }\n        const mesh = projection.getMeshFromTileID(context, coord.canonical, useBorder, true, 'raster');\n\n        const terrainData = painter.getTerrainDataForTile(coord, isRenderingToTexture);\n\n        context.activeTexture.set(gl.TEXTURE0);\n        gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n\n        const projectionData = transform.getProjectionData({\n            overscaledTileID: coord,\n            aligned: align,\n            applyGlobeMatrix: !isRenderingToTexture,\n            applyTerrainMatrix: true\n        });\n\n        program.draw(context, gl.TRIANGLES, depthMode, stencilModes[coord.overscaledZ], colorMode, CullFaceMode.backCCW,\n            hillshadeUniformValues(painter, tile, layer), terrainData, projectionData, layer.id, mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);\n    }\n}\n\n// hillshade rendering is done in two steps. the prepare step first calculates the slope of the terrain in the x and y\n// directions for each pixel, and saves those values to a framebuffer texture in the r and g channels.\nfunction prepareHillshade(\n    painter: Painter,\n    tileManager: TileManager,\n    tileIDs: OverscaledTileID[],\n    layer: HillshadeStyleLayer,\n    depthMode: Readonly<DepthMode>,\n    stencilMode: Readonly<StencilMode>,\n    colorMode: Readonly<ColorMode>) {\n\n    const context = painter.context;\n    const gl = context.gl;\n\n    const textureFilter = layer.paint.get('resampling') === 'nearest' ?  gl.NEAREST : gl.LINEAR;\n\n    for (const coord of tileIDs) {\n        const tile = tileManager.getTile(coord);\n        const dem = tile.dem;\n\n        if (!dem?.data) {\n            continue;\n        }\n\n        if (!tile.needsHillshadePrepare) {\n            continue;\n        }\n\n        const tileSize = dem.dim;\n        const textureStride = dem.stride;\n\n        const pixelData = dem.getPixels();\n        context.activeTexture.set(gl.TEXTURE1);\n\n        context.pixelStoreUnpackPremultiplyAlpha.set(false);\n        tile.demTexture ||= painter.getTileTexture(textureStride);\n        if (tile.demTexture) {\n            const demTexture = tile.demTexture;\n            demTexture.update(pixelData, {premultiply: false});\n            demTexture.bind(gl.NEAREST, gl.CLAMP_TO_EDGE);\n        } else {\n            tile.demTexture = new Texture(context, pixelData, gl.RGBA, {premultiply: false});\n            tile.demTexture.bind(gl.NEAREST, gl.CLAMP_TO_EDGE);\n        }\n\n        context.activeTexture.set(gl.TEXTURE0);\n\n        let fbo = tile.fbo;\n\n        if (!fbo) {\n            const renderTexture = new Texture(context, {width: tileSize, height: tileSize, data: null}, gl.RGBA);\n            renderTexture.bind(textureFilter, gl.CLAMP_TO_EDGE);\n\n            fbo = tile.fbo = context.createFramebuffer(tileSize, tileSize, true, false);\n            fbo.colorAttachment.set(renderTexture.texture);\n        }\n\n        context.bindFramebuffer.set(fbo.framebuffer);\n        context.viewport.set([0, 0, tileSize, tileSize]);\n\n        painter.useProgram('hillshadePrepare').draw(context, gl.TRIANGLES,\n            depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n            hillshadeUniformPrepareValues(tile.tileID, dem),\n            null, null, layer.id, painter.rasterBoundsBuffer,\n            painter.quadTriangleIndexBuffer, painter.rasterBoundsSegments);\n\n        tile.needsHillshadePrepare = false;\n    }\n}\n","import {Texture} from '../texture.ts';\nimport type {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {type ColorMode} from '../color_mode.ts';\nimport {\n    colorReliefUniformValues\n} from '../program/color_relief_program.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {ColorReliefStyleLayer} from '../../style/style_layer/color_relief_style_layer.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport function drawColorRelief(painter: Painter, tileManager: TileManager, layer: ColorReliefStyleLayer, tileIDs: OverscaledTileID[], renderOptions: RenderOptions): void {\n    if (painter.renderPass !== 'translucent') return;\n    if (!tileIDs.length) return;\n\n    const {isRenderingToTexture} = renderOptions;\n    const projection = painter.style.projection;\n    const useSubdivision = projection.useSubdivision;\n\n    const depthMode = painter.getDepthModeForSublayer(0, DepthMode.ReadOnly);\n    const colorMode = painter.colorModeForRenderPass();\n\n    // Globe (or any projection with subdivision) needs two-pass rendering to avoid artifacts when rendering texture tiles.\n    // See comments in draw_raster.ts for more details.\n    if (useSubdivision) {\n        // Two-pass rendering\n        const [stencilBorderless, stencilBorders, coords] = painter.stencilConfigForOverlapTwoPass(tileIDs);\n        renderColorRelief(painter, tileManager, layer, coords, stencilBorderless, depthMode, colorMode, false, isRenderingToTexture); // draw without borders\n        renderColorRelief(painter, tileManager, layer, coords, stencilBorders, depthMode, colorMode, true, isRenderingToTexture); // draw with borders\n    } else {\n        // Simple rendering\n        const [stencil, coords] = painter.getStencilConfigForOverlapAndUpdateStencilID(tileIDs);\n        renderColorRelief(painter, tileManager, layer, coords, stencil, depthMode, colorMode, false, isRenderingToTexture);\n    }\n}\n\nlet textureMaxSize = 0;\nfunction renderColorRelief(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: ColorReliefStyleLayer,\n    coords: OverscaledTileID[],\n    stencilModes: {[_: number]: Readonly<StencilMode>},\n    depthMode: Readonly<DepthMode>,\n    colorMode: Readonly<ColorMode>,\n    useBorder: boolean,\n    isRenderingToTexture: boolean\n) {\n    const projection = painter.style.projection;\n    const context = painter.context;\n    const transform = painter.transform;\n    const gl = context.gl;\n    const program = painter.useProgram('colorRelief');\n    const align = !painter.options.moving;\n\n    const textureFilter = layer.paint.get('resampling') === 'nearest' ?  gl.NEAREST : gl.LINEAR;\n\n    let firstTile = true;\n    let colorRampSize = 0;\n\n    for (const coord of coords) {\n        const tile = tileManager.getTile(coord);\n        const dem = tile.dem;\n        if(firstTile) {\n            // we should avoid calling gl.getParameter at runtime (GPU stall risk)\n            textureMaxSize ||= gl.getParameter(gl.MAX_TEXTURE_SIZE);\n            const maxLength = textureMaxSize;\n            const {elevationTexture, colorTexture} = layer.getColorRampTextures(context, maxLength, dem.getUnpackVector());\n            context.activeTexture.set(gl.TEXTURE1);\n            elevationTexture.bind(gl.NEAREST, gl.CLAMP_TO_EDGE);\n            context.activeTexture.set(gl.TEXTURE4);\n            colorTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n            firstTile = false;\n            colorRampSize = elevationTexture.size[0];\n        }\n\n        if (!dem?.data) {\n            continue;\n        }\n\n        const textureStride = dem.stride;\n\n        const pixelData = dem.getPixels();\n        context.activeTexture.set(gl.TEXTURE0);\n\n        context.pixelStoreUnpackPremultiplyAlpha.set(false);\n        tile.demTexture ||= painter.getTileTexture(textureStride);\n        if (tile.demTexture) {\n            const demTexture = tile.demTexture;\n            demTexture.update(pixelData, {premultiply: false});\n            demTexture.bind(textureFilter, gl.CLAMP_TO_EDGE);\n        } else {\n            tile.demTexture = new Texture(context, pixelData, gl.RGBA, {premultiply: false});\n            tile.demTexture.bind(textureFilter, gl.CLAMP_TO_EDGE);\n        }\n\n        const mesh = projection.getMeshFromTileID(context, coord.canonical, useBorder, true, 'raster');\n\n        const terrainData = painter.getTerrainDataForTile(coord, isRenderingToTexture);\n\n        const projectionData = transform.getProjectionData({\n            overscaledTileID: coord,\n            aligned: align,\n            applyGlobeMatrix: !isRenderingToTexture,\n            applyTerrainMatrix: true\n        });\n\n        program.draw(context, gl.TRIANGLES, depthMode, stencilModes[coord.overscaledZ], colorMode, CullFaceMode.backCCW,\n            colorReliefUniformValues(layer, tile.dem, colorRampSize), terrainData, projectionData, layer.id, mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);\n    }\n}\n","import {clamp} from '../../util/util.ts';\n\nimport {ImageSource} from '../../source/image_source.ts';\nimport {now} from '../../util/time_control.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {rasterUniformValues} from '../program/raster_program.ts';\nimport {EXTENT} from '../../data/extent.ts';\nimport {FadingDirections} from '../../tile/tile.ts';\nimport Point from '@mapbox/point-geometry';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {RasterStyleLayer} from '../../style/style_layer/raster_style_layer.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\nimport type {Tile} from '../../tile/tile.ts';\n\ntype FadeProperties = {\n    parentTile: Tile;\n    parentScaleBy: number;\n    parentTopLeft: [number, number];\n    fadeValues: FadeValues;\n};\n\ntype FadeValues = {\n    tileOpacity: number;\n    parentTileOpacity?: number;\n    fadeMix: {opacity: number; mix: number};\n};\n\nconst cornerCoords = [\n    new Point(0, 0),\n    new Point(EXTENT, 0),\n    new Point(EXTENT, EXTENT),\n    new Point(0, EXTENT),\n];\n\nexport function drawRaster(painter: Painter, tileManager: TileManager, layer: RasterStyleLayer, tileIDs: OverscaledTileID[], renderOptions: RenderOptions): void {\n    if (painter.renderPass !== 'translucent') return;\n    if (layer.paint.get('raster-opacity') === 0) return;\n    if (!tileIDs.length) return;\n\n    const {isRenderingToTexture} = renderOptions;\n    const source = tileManager.getSource();\n\n    const projection = painter.style.projection;\n    const useSubdivision = projection.useSubdivision;\n\n    // When rendering globe (or any other subdivided projection), two passes are needed.\n    // Subdivided tiles with different granularities might have tiny gaps between them.\n    // To combat this, tile meshes for globe have a slight border region.\n    // However tiles borders will overlap, and a part of a tile often\n    // gets hidden by its neighbour's border, which displays an ugly stretched texture.\n    // To both hide the border stretch and avoid tiny gaps, tiles are first drawn without borders (with gaps),\n    // and then any missing pixels (gaps, not marked in stencil) get overdrawn with tile borders.\n    // This approach also avoids pixel shader overdraw, as any pixel is drawn at most once.\n\n    // Stencil mask and two-pass is not used for ImageSource sources regardless of projection.\n    if (source instanceof ImageSource) {\n        // Image source - no stencil is used\n        drawTiles(painter, tileManager, layer, tileIDs, null, false, false, source.tileCoords, source.flippedWindingOrder, isRenderingToTexture);\n    } else if (useSubdivision) {\n        // Two-pass rendering\n        const [stencilBorderless, stencilBorders, coords] = painter.stencilConfigForOverlapTwoPass(tileIDs);\n        drawTiles(painter, tileManager, layer, coords, stencilBorderless, false, true, cornerCoords, false, isRenderingToTexture); // draw without borders\n        drawTiles(painter, tileManager, layer, coords, stencilBorders, true, true, cornerCoords, false, isRenderingToTexture); // draw with borders\n    } else {\n        // Simple rendering\n        const [stencil, coords] = painter.getStencilConfigForOverlapAndUpdateStencilID(tileIDs);\n        drawTiles(painter, tileManager, layer, coords, stencil, false, true, cornerCoords, false, isRenderingToTexture);\n    }\n}\n\nfunction drawTiles(\n    painter: Painter,\n    tileManager: TileManager,\n    layer: RasterStyleLayer,\n    coords: OverscaledTileID[],\n    stencilModes: {[_: number]: Readonly<StencilMode>} | null,\n    useBorder: boolean,\n    allowPoles: boolean,\n    corners: Point[],\n    flipCullfaceMode: boolean = false,\n    isRenderingToTexture: boolean = false) {\n    const minTileZ = coords[coords.length - 1].overscaledZ;\n\n    const context = painter.context;\n    const gl = context.gl;\n    const program = painter.useProgram('raster');\n    const transform = painter.transform;\n\n    const projection = painter.style.projection;\n\n    const colorMode = painter.colorModeForRenderPass();\n    const align = !painter.options.moving;\n    const rasterOpacity = layer.paint.get('raster-opacity');\n    const useNearest = layer.paint.get('resampling') === 'nearest' || layer.paint.get('raster-resampling') === 'nearest';\n    const textureFilter = useNearest ?  gl.NEAREST : gl.LINEAR;\n    const fadeDuration = layer.paint.get('raster-fade-duration');\n    const isTerrain = !!painter.style.map.terrain;\n\n    // Draw all tiles\n    for (const coord of coords) {\n        // Set the lower zoom level to sublayer 0, and higher zoom levels to higher sublayers\n        // Use gl.LESS to prevent double drawing in areas where tiles overlap.\n        const depthMode = painter.getDepthModeForSublayer(coord.overscaledZ - minTileZ,\n            rasterOpacity === 1 ? DepthMode.ReadWrite : DepthMode.ReadOnly, gl.LESS);\n\n        const tile = tileManager.getTile(coord);\n\n        // create and bind first texture\n        context.activeTexture.set(gl.TEXTURE0);\n        tile.texture.bind(textureFilter, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n\n        // create second texture - use either the current tile or fade tile to bind second texture below\n        context.activeTexture.set(gl.TEXTURE1);\n        const {parentTile, parentScaleBy, parentTopLeft, fadeValues} = getFadeProperties(tile, tileManager, fadeDuration, isTerrain);\n        tile.fadeOpacity = fadeValues.tileOpacity;\n        if (parentTile) {\n            parentTile.fadeOpacity = fadeValues.parentTileOpacity;\n            parentTile.texture.bind(textureFilter, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n        } else {\n            tile.texture.bind(textureFilter, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n        }\n\n        // Enable anisotropic filtering only when the pitch is greater than the threshold pitch.\n        // The default threshold is 20 degrees to preserve image sharpness on flat or slightly tilted maps.\n        if (tile.texture.useMipmap && context.extTextureFilterAnisotropic && painter.transform.pitch > painter.options.anisotropicFilterPitch) {\n            gl.texParameterf(gl.TEXTURE_2D, context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,\n                context.extTextureFilterAnisotropicMax);\n        }\n\n        const terrainData = painter.getTerrainDataForTile(coord, isRenderingToTexture);\n        const projectionData = transform.getProjectionData({overscaledTileID: coord, aligned: align, applyGlobeMatrix: !isRenderingToTexture, applyTerrainMatrix: true});\n        const uniformValues = rasterUniformValues(parentTopLeft, parentScaleBy, fadeValues.fadeMix, layer, corners);\n\n        const mesh = projection.getMeshFromTileID(context, coord.canonical, useBorder, allowPoles, 'raster');\n        const stencilMode = stencilModes ? stencilModes[coord.overscaledZ] : StencilMode.disabled;\n\n        program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, flipCullfaceMode ? CullFaceMode.frontCCW : CullFaceMode.backCCW,\n            uniformValues, terrainData, projectionData, layer.id, mesh.vertexBuffer,\n            mesh.indexBuffer, mesh.segments);\n    }\n}\n\n/**\n * Get fade properties for current tile - either cross-fading or self-fading properties.\n */\nfunction getFadeProperties(tile: Tile, tileManager: TileManager, fadeDuration: number, isTerrain: boolean): FadeProperties {\n    const defaults: FadeProperties = {\n        parentTile: null,\n        parentScaleBy: 1,\n        parentTopLeft: [0, 0],\n        fadeValues: {tileOpacity: 1, parentTileOpacity: 1, fadeMix: {opacity: 1, mix: 0}}\n    };\n\n    if (fadeDuration === 0 || isTerrain) return defaults;\n\n    // cross-fade with parent first if available\n    if (tile.fadingParentID) {\n        const parentTile = tileManager.getLoadedTile(tile.fadingParentID);\n        if (!parentTile) return defaults;\n\n        const parentScaleBy = Math.pow(2, parentTile.tileID.overscaledZ - tile.tileID.overscaledZ);\n        const parentTopLeft: [number, number] = [\n            (tile.tileID.canonical.x * parentScaleBy) % 1,\n            (tile.tileID.canonical.y * parentScaleBy) % 1\n        ];\n\n        const fadeValues = getCrossFadeValues(tile, parentTile, fadeDuration);\n        return {parentTile, parentScaleBy, parentTopLeft, fadeValues};\n    }\n\n    // self-fade for edge tiles\n    if (tile.selfFading) {\n        const fadeValues = getSelfFadeValues(tile, fadeDuration);\n        return {parentTile: null, parentScaleBy: 1, parentTopLeft: [0, 0], fadeValues};\n    }\n\n    return defaults;\n}\n\n/**\n * Cross-fade values for a base tile with a parent tile (for zooming in/out)\n */\nfunction getCrossFadeValues(tile: Tile, parentTile: Tile, fadeDuration: number): FadeValues {\n    const currentTime = now();\n\n    const timeSinceTile = (currentTime - tile.timeAdded) / fadeDuration;\n    const timeSinceParent = (currentTime - parentTile.timeAdded) / fadeDuration;\n\n    // get fading opacity based on current fade direction\n    const doFadeIn = (tile.fadingDirection === FadingDirections.Incoming);\n    const opacity1 = clamp(timeSinceTile, 0, 1);\n    const opacity2 = clamp(1 - timeSinceParent, 0, 1);\n\n    const tileOpacity = doFadeIn ? opacity1 : opacity2;\n    const parentTileOpacity = doFadeIn ? opacity2 : opacity1;\n    const fadeMix = {\n        opacity: 1,\n        mix: 1 - tileOpacity\n    };\n\n    return {tileOpacity, parentTileOpacity, fadeMix};\n}\n\n/**\n * Simple fade-in values for tile without a parent (i.e. edge tiles)\n */\nfunction getSelfFadeValues(tile: Tile, fadeDuration: number): FadeValues {\n    const currentTime = now();\n\n    const timeSinceTile = (currentTime - tile.timeAdded) / fadeDuration;\n    const tileOpacity = clamp(timeSinceTile, 0, 1);\n    const fadeMix = {\n        opacity: tileOpacity,\n        mix: 0\n    };\n\n    return {tileOpacity, fadeMix};\n}\n","import {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {\n    backgroundUniformValues,\n    backgroundPatternUniformValues\n} from '../program/background_program.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {BackgroundStyleLayer} from '../../style/style_layer/background_style_layer.ts';\nimport {type OverscaledTileID} from '../../tile/tile_id.ts';\nimport {coveringTiles} from '../../geo/projection/covering_tiles.ts';\n\nexport function drawBackground(painter: Painter, tileManager: TileManager, layer: BackgroundStyleLayer, coords: OverscaledTileID[], renderOptions: RenderOptions): void {\n    const color = layer.paint.get('background-color');\n    const opacity = layer.paint.get('background-opacity');\n\n    if (opacity === 0) return;\n\n    const {isRenderingToTexture} = renderOptions;\n    const context = painter.context;\n    const gl = context.gl;\n    const projection = painter.style.projection;\n    const transform = painter.transform;\n    const tileSize = transform.tileSize;\n    const image = layer.paint.get('background-pattern');\n\n    if (painter.isPatternMissing(image)) return;\n\n    const pass = (!image && color.a === 1 && opacity === 1 && painter.opaquePassEnabledForLayer()) ? 'opaque' : 'translucent';\n    if (painter.renderPass !== pass) return;\n\n    const stencilMode = StencilMode.disabled;\n    const depthMode = painter.getDepthModeForSublayer(0, pass === 'opaque' ? DepthMode.ReadWrite : DepthMode.ReadOnly);\n    const colorMode = painter.colorModeForRenderPass();\n    const program = painter.useProgram(image ? 'backgroundPattern' : 'background');\n    const tileIDs = coords ? coords : coveringTiles(transform, {tileSize, terrain: painter.style.map.terrain});\n\n    if (image) {\n        context.activeTexture.set(gl.TEXTURE0);\n        painter.imageManager.bind(painter.context);\n    }\n\n    const crossfade = layer.getCrossfadeParameters();\n    \n    for (const tileID of tileIDs) {\n        const projectionData = transform.getProjectionData({\n            overscaledTileID: tileID,\n            applyGlobeMatrix: !isRenderingToTexture,\n            applyTerrainMatrix: true\n        });\n\n        const uniformValues = image ?\n            backgroundPatternUniformValues(opacity, painter, image, {tileID, tileSize}, crossfade) :\n            backgroundUniformValues(opacity, color);\n        const terrainData = painter.getTerrainDataForTile(tileID, isRenderingToTexture);\n\n        // For globe rendering, background uses tile meshes *without* borders and no stencil clipping.\n        // This works assuming the tileIDs list contains only tiles of the same zoom level.\n        // This seems to always be the case for background layers, but I'm leaving this comment\n        // here in case this assumption is false in the future.\n\n        // In case background starts having tiny holes at tile boundaries, switch to meshes with borders\n        // and also enable stencil clipping. Make sure to render a proper tile clipping mask into stencil\n        // first though, as that doesn't seem to happen for background layers as of writing this.\n\n        const mesh = projection.getMeshFromTileID(context, tileID.canonical, false, true, 'raster');\n        program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.backCCW,\n            uniformValues, terrainData, projectionData, layer.id,\n            mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);\n    }\n}\n","import {DepthMode} from '../depth_mode.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {debugUniformValues} from '../program/debug_program.ts';\nimport {Color} from '@maplibre/maplibre-gl-style-spec';\nimport {ColorMode} from '../color_mode.ts';\n\nimport type {Painter} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {OverscaledTileID} from '../../tile/tile_id.ts';\nimport {type Style} from '../../style/style.ts';\n\nconst topColor = new Color(1, 0, 0, 1);\nconst btmColor = new Color(0, 1, 0, 1);\nconst leftColor = new Color(0, 0, 1, 1);\nconst rightColor = new Color(1, 0, 1, 1);\nconst centerColor = new Color(0, 1, 1, 1);\n\nexport function drawDebugPadding(painter: Painter): void {\n    const padding = painter.transform.padding;\n    const lineWidth = 3;\n    // Top\n    drawHorizontalLine(painter, painter.transform.height - (padding.top || 0), lineWidth, topColor);\n    // Bottom\n    drawHorizontalLine(painter, padding.bottom || 0, lineWidth, btmColor);\n    // Left\n    drawVerticalLine(painter, padding.left || 0, lineWidth, leftColor);\n    // Right\n    drawVerticalLine(painter, painter.transform.width - (padding.right || 0), lineWidth, rightColor);\n    // Center\n    const center = painter.transform.centerPoint;\n    drawCrosshair(painter, center.x, painter.transform.height - center.y, centerColor);\n}\n\nfunction drawCrosshair(painter: Painter, x: number, y: number, color: Color) {\n    const size = 20;\n    const lineWidth = 2;\n    //Vertical line\n    drawDebugSSRect(painter, x - lineWidth / 2, y - size / 2, lineWidth, size, color);\n    //Horizontal line\n    drawDebugSSRect(painter, x - size / 2, y - lineWidth / 2, size, lineWidth, color);\n}\n\nfunction drawHorizontalLine(painter: Painter, y: number, lineWidth: number, color: Color) {\n    drawDebugSSRect(painter, 0, y  + lineWidth / 2, painter.transform.width,  lineWidth, color);\n}\n\nfunction drawVerticalLine(painter: Painter, x: number, lineWidth: number, color: Color) {\n    drawDebugSSRect(painter, x - lineWidth / 2, 0, lineWidth,  painter.transform.height, color);\n}\n\nfunction drawDebugSSRect(painter: Painter, x: number, y: number, width: number, height: number, color: Color) {\n    const context = painter.context;\n    const gl = context.gl;\n\n    gl.enable(gl.SCISSOR_TEST);\n    gl.scissor(x * painter.pixelRatio, y * painter.pixelRatio, width * painter.pixelRatio, height * painter.pixelRatio);\n    context.clear({color});\n    gl.disable(gl.SCISSOR_TEST);\n}\n\nexport function drawDebug(painter: Painter, tileManager: TileManager, coords: OverscaledTileID[]): void {\n    for (const coord of coords) {\n        drawDebugTile(painter, tileManager, coord);\n    }\n}\n\nfunction drawDebugTile(painter: Painter, tileManager: TileManager, coord: OverscaledTileID) {\n    const context = painter.context;\n    const gl = context.gl;\n\n    const program = painter.useProgram('debug');\n\n    const depthMode = DepthMode.disabled;\n    const stencilMode = StencilMode.disabled;\n    const colorMode = painter.colorModeForRenderPass();\n    const id = '$debug';\n    const terrainData = painter.style.map.terrain?.getTerrainData(coord);\n\n    context.activeTexture.set(gl.TEXTURE0);\n\n    const tileRawData = tileManager.getTileByID(coord.key).latestRawTileData;\n    const tileByteLength = (tileRawData?.byteLength) || 0;\n    const tileSizeKb = Math.floor(tileByteLength / 1024);\n    const tileSize = tileManager.getTile(coord).tileSize;\n    const scaleRatio = (512 / Math.min(tileSize, 512) * (coord.overscaledZ / painter.transform.zoom)) * 0.5;\n    let tileIdText = coord.canonical.toString();\n    if (coord.overscaledZ !== coord.canonical.z) {\n        tileIdText += ` => ${coord.overscaledZ}`;\n    }\n    const tileLabel = `${tileIdText} ${tileSizeKb}kB`;\n    drawTextToOverlay(painter, tileLabel);\n\n    const projectionData = painter.transform.getProjectionData({overscaledTileID: coord, applyGlobeMatrix: true, applyTerrainMatrix: true});\n\n    program.draw(context, gl.TRIANGLES, depthMode, stencilMode, ColorMode.alphaBlended, CullFaceMode.disabled,\n        debugUniformValues(Color.transparent, scaleRatio), null, projectionData, id,\n        painter.debugBuffer, painter.quadTriangleIndexBuffer, painter.debugSegments);\n    program.draw(context, gl.LINE_STRIP, depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n        debugUniformValues(Color.red), terrainData, projectionData, id,\n        painter.debugBuffer, painter.tileBorderIndexBuffer, painter.debugSegments);\n}\n\nfunction drawTextToOverlay(painter: Painter, text: string) {\n    painter.initDebugOverlayCanvas();\n    const canvas = painter.debugOverlayCanvas;\n    const gl = painter.context.gl;\n    const ctx2d = painter.debugOverlayCanvas.getContext('2d');\n    ctx2d.clearRect(0, 0, canvas.width, canvas.height);\n\n    ctx2d.shadowColor = 'white';\n    ctx2d.shadowBlur = 2;\n    ctx2d.lineWidth = 1.5;\n    ctx2d.strokeStyle = 'white';\n    ctx2d.textBaseline = 'top';\n    ctx2d.font = `bold ${36}px Open Sans, sans-serif`;\n    ctx2d.fillText(text, 5, 5);\n    ctx2d.strokeText(text, 5, 5);\n\n    painter.debugOverlayTexture.update(canvas);\n    painter.debugOverlayTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n}\n\nexport function selectDebugSource(style: Style, zoom: number): TileManager | null {\n    // Use vector source with highest maxzoom\n    // Else use source with highest maxzoom of any type\n    let selectedSource: TileManager = null;\n    const layers = Object.values(style._layers);\n    const sources = layers.flatMap((layer) => {\n        if (layer.source && !layer.isHidden(zoom)) {\n            const tileManager = style.tileManagers[layer.source];\n            return [tileManager];\n        } else {\n            return [];\n        }\n    });\n    const vectorSources = sources.filter((source) => source.getSource().type === 'vector');\n    const otherSources = sources.filter((source) => source.getSource().type !== 'vector');\n    const considerSource = (source: TileManager) => {\n        if (!selectedSource || (selectedSource.getSource().maxzoom < source.getSource().maxzoom)) {\n            selectedSource = source;\n        }\n    };\n    for (const source of vectorSources) {\n        considerSource(source);\n    }\n    if (!selectedSource) {\n        for (const source of otherSources) {\n            considerSource(source);\n        }\n    }\n    return selectedSource;\n}\n","import {DepthMode} from '../depth_mode.ts';\nimport {StencilMode} from '../stencil_mode.ts';\n\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {TileManager} from '../../tile/tile_manager.ts';\nimport type {CustomLayerProjectionDataParams, CustomRenderMethodInput, CustomStyleLayer} from '../../style/style_layer/custom_style_layer.ts';\nimport {OverscaledTileID} from '../../tile/tile_id.ts';\n\nexport function drawCustom(painter: Painter, tileManager: TileManager, layer: CustomStyleLayer, renderOptions: RenderOptions): void {\n\n    const {isRenderingGlobe} = renderOptions;\n    const context = painter.context;\n    const implementation = layer.implementation;\n    const projection = painter.style.projection;\n    const transform = painter.transform;\n\n    const projectionData = transform.getProjectionDataForCustomLayer(isRenderingGlobe);\n\n    const customLayerArgs: CustomRenderMethodInput = {\n        farZ: transform.farZ,\n        nearZ: transform.nearZ,\n        fov: transform.fov * Math.PI / 180, // fov converted to radians\n        modelViewProjectionMatrix: transform.modelViewProjectionMatrix,\n        projectionMatrix: transform.projectionMatrix,\n        shaderData: {\n            variantName: projection.shaderVariantName,\n            vertexShaderPrelude: `const float PI = 3.141592653589793;\\nuniform mat4 u_projection_matrix;\\n${projection.shaderPreludeCode.vertexSource}`,\n            define: projection.shaderDefine,\n        },\n        defaultProjectionData: projectionData,\n        getProjectionData: (params: CustomLayerProjectionDataParams) => {\n            return transform.getProjectionData({\n                overscaledTileID: new OverscaledTileID(\n                    params.tileID.canonical.z,\n                    params.tileID.wrap ?? 0,\n                    params.tileID.canonical.z,\n                    params.tileID.canonical.x,\n                    params.tileID.canonical.y,\n                ),\n                aligned: params.aligned,\n                applyGlobeMatrix: params.applyGlobeMatrix,\n                applyTerrainMatrix: params.applyTerrainMatrix,\n            });\n        }\n    };\n\n    const renderingMode = implementation.renderingMode ? implementation.renderingMode : '2d';\n\n    if (painter.renderPass === 'offscreen') {\n        const prerender = implementation.prerender;\n        if (prerender) {\n            painter.setCustomLayerDefaults();\n            context.setColorMode(painter.colorModeForRenderPass());\n\n            prerender.call(implementation, context.gl, customLayerArgs);\n\n            context.setDirty();\n            painter.setBaseState();\n        }\n    } else if (painter.renderPass === 'translucent') {\n\n        painter.setCustomLayerDefaults();\n\n        context.setColorMode(painter.colorModeForRenderPass());\n        context.setStencilMode(StencilMode.disabled);\n\n        const depthMode = renderingMode === '3d' ?\n            painter.getDepthModeFor3D() :\n            painter.getDepthModeForSublayer(0, DepthMode.ReadOnly);\n\n        context.setDepthMode(depthMode);\n\n        implementation.render(context.gl, customLayerArgs);\n\n        context.setDirty();\n        painter.setBaseState();\n        context.bindFramebuffer.set(null);\n    }\n}\n","import {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {terrainUniformValues, terrainDepthUniformValues, terrainCoordsUniformValues} from '../program/terrain_program.ts';\nimport type {Painter, RenderOptions} from '../../render/painter.ts';\nimport type {Tile} from '../../tile/tile.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {Color} from '@maplibre/maplibre-gl-style-spec';\nimport {ColorMode} from '../color_mode.ts';\nimport {type Terrain} from '../../render/terrain.ts';\n\n/**\n * Redraw the Depth Framebuffer\n * @param painter - the painter\n * @param terrain - the terrain\n */\nfunction drawDepth(painter: Painter, terrain: Terrain): void {\n    const context = painter.context;\n    const gl = context.gl;\n    const tr = painter.transform;\n    const colorMode = ColorMode.unblended;\n    const depthMode = new DepthMode(gl.LEQUAL, DepthMode.ReadWrite, [0, 1]);\n    const tiles = terrain.tileManager.getRenderableTiles();\n    const program = painter.useProgram('terrainDepth');\n    context.bindFramebuffer.set(terrain.getFramebuffer('depth').framebuffer);\n    context.viewport.set([0, 0, painter.width  / devicePixelRatio, painter.height / devicePixelRatio]);\n    context.clear({color: Color.transparent, depth: 1});\n    for (const tile of tiles) {\n        const mesh = terrain.getTerrainMesh(tile.tileID);\n        const terrainData = terrain.getTerrainData(tile.tileID);\n        const projectionData = tr.getProjectionData({overscaledTileID: tile.tileID, applyTerrainMatrix: false, applyGlobeMatrix: true});\n        const uniformValues = terrainDepthUniformValues(terrain.getSkirtLength(tr.zoom));\n        program.draw(context, gl.TRIANGLES, depthMode, StencilMode.disabled, colorMode, CullFaceMode.backCCW, uniformValues, terrainData, projectionData, 'terrain', mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);\n    }\n    context.bindFramebuffer.set(null);\n    context.viewport.set([0, 0, painter.width, painter.height]);\n}\n\n/**\n * Redraw the Coords Framebuffers\n * @param painter - the painter\n * @param terrain - the terrain\n */\nfunction drawCoords(painter: Painter, terrain: Terrain): void {\n    const context = painter.context;\n    const gl = context.gl;\n    const tr = painter.transform;\n    const colorMode = ColorMode.unblended;\n    const depthMode = new DepthMode(gl.LEQUAL, DepthMode.ReadWrite, [0, 1]);\n    const coords = terrain.getCoordsTexture();\n    const tiles = terrain.tileManager.getRenderableTiles();\n\n    // draw tile-coords into framebuffer\n    const program = painter.useProgram('terrainCoords');\n    context.bindFramebuffer.set(terrain.getFramebuffer('coords').framebuffer);\n    context.viewport.set([0, 0, painter.width  / devicePixelRatio, painter.height / devicePixelRatio]);\n    context.clear({color: Color.transparent, depth: 1});\n    terrain.coordsIndex = [];\n    for (const tile of tiles) {\n        const mesh = terrain.getTerrainMesh(tile.tileID);\n        const terrainData = terrain.getTerrainData(tile.tileID);\n        context.activeTexture.set(gl.TEXTURE0);\n        gl.bindTexture(gl.TEXTURE_2D, coords.texture);\n        const uniformValues = terrainCoordsUniformValues(255 - terrain.coordsIndex.length, terrain.getSkirtLength(tr.zoom));\n        const projectionData = tr.getProjectionData({overscaledTileID: tile.tileID, applyTerrainMatrix: false, applyGlobeMatrix: true});\n        program.draw(context, gl.TRIANGLES, depthMode, StencilMode.disabled, colorMode, CullFaceMode.backCCW, uniformValues, terrainData, projectionData, 'terrain', mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);\n        terrain.coordsIndex.push(tile.tileID.key);\n    }\n    context.bindFramebuffer.set(null);\n    context.viewport.set([0, 0, painter.width, painter.height]);\n}\n\nfunction drawTerrain(painter: Painter, terrain: Terrain, tiles: Tile[], renderOptions: RenderOptions): void {\n    const {isRenderingGlobe} = renderOptions;\n    const context = painter.context;\n    const gl = context.gl;\n    const tr = painter.transform;\n    const colorMode = painter.colorModeForRenderPass();\n    const depthMode = painter.getDepthModeFor3D();\n    const program = painter.useProgram('terrain');\n\n    context.bindFramebuffer.set(null);\n    context.viewport.set([0, 0, painter.width, painter.height]);\n\n    for (const tile of tiles) {\n        const mesh = terrain.getTerrainMesh(tile.tileID);\n        const texture = painter.renderToTexture.getTexture(tile);\n        const terrainData = terrain.getTerrainData(tile.tileID);\n        context.activeTexture.set(gl.TEXTURE0);\n        gl.bindTexture(gl.TEXTURE_2D, texture.texture);\n        const eleDelta = terrain.getSkirtLength(tr.zoom);\n        const fogMatrix = tr.calculateFogMatrix(tile.tileID.toUnwrapped());\n        const uniformValues = terrainUniformValues(eleDelta, fogMatrix, painter.style.sky, tr.pitch, isRenderingGlobe);\n        const projectionData = tr.getProjectionData({overscaledTileID: tile.tileID, applyTerrainMatrix: false, applyGlobeMatrix: true});\n        program.draw(context, gl.TRIANGLES, depthMode, StencilMode.disabled, colorMode, CullFaceMode.backCCW, uniformValues, terrainData, projectionData, 'terrain', mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);\n    }\n}\n\nexport {\n    drawTerrain,\n    drawDepth,\n    drawCoords\n};\n","import posAttributes from '../../data/pos_attributes.ts';\nimport {StencilMode} from '../stencil_mode.ts';\nimport {DepthMode} from '../depth_mode.ts';\nimport {CullFaceMode} from '../cull_face_mode.ts';\nimport {PosArray, TriangleIndexArray} from '../../data/array_types.g.ts';\nimport {SegmentVector} from '../../data/segment.ts';\nimport {skyUniformValues} from '../program/sky_program.ts';\nimport {atmosphereUniformValues} from '../program/atmosphere_program.ts';\nimport {getGlobeRadiusPixels} from '../../geo/projection/globe_utils.ts';\nimport {Mesh} from '../../render/mesh.ts';\nimport {mat4, vec3, vec4} from 'gl-matrix';\nimport {ColorMode} from '../color_mode.ts';\n\nimport type {Sky} from '../../style/sky.ts';\nimport type {Light} from '../../style/light.ts';\nimport type {IReadonlyTransform} from '../../geo/transform_interface.ts';\nimport type {Painter} from '../../render/painter.ts';\nimport type {Context} from '../context.ts';\n\nfunction getMesh(context: Context, sky: Sky): Mesh {\n    // Create the Sky mesh the first time we need it\n    if (!sky.mesh) {\n        const vertexArray = new PosArray();\n        vertexArray.emplaceBack(-1, -1);\n        vertexArray.emplaceBack(1, -1);\n        vertexArray.emplaceBack(1, 1);\n        vertexArray.emplaceBack(-1, 1);\n\n        const indexArray = new TriangleIndexArray();\n        indexArray.emplaceBack(0, 1, 2);\n        indexArray.emplaceBack(0, 2, 3);\n\n        sky.mesh = new Mesh(\n            context.createVertexBuffer(vertexArray, posAttributes.members),\n            context.createIndexBuffer(indexArray),\n            SegmentVector.simpleSegment(0, 0, vertexArray.length, indexArray.length)\n        );\n    }\n\n    return sky.mesh;\n}\n\nexport function drawSky(painter: Painter, sky: Sky): void {\n    const context = painter.context;\n    const gl = context.gl;\n\n    const skyUniforms = skyUniformValues(sky, painter.transform, painter.pixelRatio);\n\n    const depthMode = new DepthMode(gl.LEQUAL, DepthMode.ReadWrite, [0, 1]);\n    const stencilMode = StencilMode.disabled;\n    const colorMode = painter.colorModeForRenderPass();\n    const program = painter.useProgram('sky');\n\n    const mesh = getMesh(context, sky);\n\n    program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode,\n        CullFaceMode.disabled, skyUniforms, null, undefined, 'sky', mesh.vertexBuffer,\n        mesh.indexBuffer, mesh.segments);\n}\n\nfunction getSunPos(light: Light, transform: IReadonlyTransform): vec3 {\n    const lightPos = light.getCartesianPosition();\n    vec3.negate(lightPos, lightPos);\n\n    const lightMat = mat4.identity(new Float64Array(16));\n\n    if (light.properties.get('anchor') === 'map') {\n        mat4.rotateZ(lightMat, lightMat, transform.rollInRadians);\n        mat4.rotateX(lightMat, lightMat, -transform.pitchInRadians);\n        mat4.rotateZ(lightMat, lightMat, transform.bearingInRadians);\n        mat4.rotateX(lightMat, lightMat, transform.center.lat * Math.PI / 180.0);\n        mat4.rotateY(lightMat, lightMat, -transform.center.lng * Math.PI / 180.0);\n    }\n\n    vec3.transformMat4(lightPos, lightPos, lightMat);\n\n    return lightPos;\n}\n\nexport function drawAtmosphere(painter: Painter, sky: Sky, light: Light): void {\n    const context = painter.context;\n    const gl = context.gl;\n    const program = painter.useProgram('atmosphere');\n    const depthMode = new DepthMode(gl.LEQUAL, DepthMode.ReadOnly, [0, 1]);\n    const transform = painter.transform;\n\n    const sunPos = getSunPos(light, painter.transform);\n\n    const projectionData = transform.getProjectionData({overscaledTileID: null, applyGlobeMatrix: true, applyTerrainMatrix: true});\n    const atmosphereBlend = sky.properties.get('atmosphere-blend') * projectionData.projectionTransition;\n\n    if (atmosphereBlend === 0) {\n        // Don't draw anything if atmosphere is fully transparent\n        return;\n    }\n\n    const globeRadius = getGlobeRadiusPixels(transform.worldSize, transform.center.lat);\n    const invProjMatrix = transform.inverseProjectionMatrix;\n    const vec = new Float64Array(4) as any as vec4;\n    vec[3] = 1;\n    vec4.transformMat4(vec, vec, transform.modelViewProjectionMatrix);\n    vec[0] /= vec[3];\n    vec[1] /= vec[3];\n    vec[2] /= vec[3];\n    vec[3] = 1;\n    vec4.transformMat4(vec, vec, invProjMatrix);\n    vec[0] /= vec[3];\n    vec[1] /= vec[3];\n    vec[2] /= vec[3];\n    vec[3] = 1;\n    const globePosition = [vec[0], vec[1], vec[2]] as vec3;\n\n    const uniformValues = atmosphereUniformValues(sunPos, atmosphereBlend, globePosition, globeRadius, invProjMatrix);\n\n    const mesh = getMesh(context, sky);\n\n    program.draw(context, gl.TRIANGLES, depthMode, StencilMode.disabled, ColorMode.alphaBlended, CullFaceMode.disabled, uniformValues, null, null, 'atmosphere', mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);\n}\n","import {drawSymbols} from './draw_symbol.ts';\nimport {drawCircles} from './draw_circle.ts';\nimport {drawHeatmap} from './draw_heatmap.ts';\nimport {drawLine} from './draw_line.ts';\nimport {drawFill} from './draw_fill.ts';\nimport {drawFillExtrusion} from './draw_fill_extrusion.ts';\nimport {drawHillshade} from './draw_hillshade.ts';\nimport {drawColorRelief} from './draw_color_relief.ts';\nimport {drawRaster} from './draw_raster.ts';\nimport {drawBackground} from './draw_background.ts';\nimport {drawDebug, drawDebugPadding, selectDebugSource} from './draw_debug.ts';\nimport {drawCustom} from './draw_custom.ts';\nimport {drawDepth, drawCoords} from './draw_terrain.ts';\nimport {drawSky, drawAtmosphere} from './draw_sky.ts';\n\nexport {drawSymbols, drawCircles, drawHeatmap, drawLine, drawFill, drawFillExtrusion,\n    drawHillshade, drawColorRelief, drawRaster, drawBackground,\n    drawDebug, drawDebugPadding, selectDebugSource, drawCustom,\n    drawDepth, drawCoords, drawSky, drawAtmosphere};\n\nexport type DrawFunctions = {\n    symbol: typeof drawSymbols;\n    circle: typeof drawCircles;\n    heatmap: typeof drawHeatmap;\n    line: typeof drawLine;\n    fill: typeof drawFill;\n    fillExtrusion: typeof drawFillExtrusion;\n    hillshade: typeof drawHillshade;\n    colorRelief: typeof drawColorRelief;\n    raster: typeof drawRaster;\n    background: typeof drawBackground;\n    sky: typeof drawSky;\n    atmosphere: typeof drawAtmosphere;\n    custom: typeof drawCustom;\n    debug: typeof drawDebug;\n    debugPadding: typeof drawDebugPadding;\n    terrainDepth: typeof drawDepth;\n    terrainCoords: typeof drawCoords;\n};\n\nexport const webglDrawFunctions: DrawFunctions = {\n    symbol: drawSymbols,\n    circle: drawCircles,\n    heatmap: drawHeatmap,\n    line: drawLine,\n    fill: drawFill,\n    fillExtrusion: drawFillExtrusion,\n    hillshade: drawHillshade,\n    colorRelief: drawColorRelief,\n    raster: drawRaster,\n    background: drawBackground,\n    sky: drawSky,\n    atmosphere: drawAtmosphere,\n    custom: drawCustom,\n    debug: drawDebug,\n    debugPadding: drawDebugPadding,\n    terrainDepth: drawDepth,\n    terrainCoords: drawCoords,\n};\n","import {now} from '../util/time_control.ts';\nimport {mat4} from 'gl-matrix';\nimport {TileManager} from '../tile/tile_manager.ts';\nimport {EXTENT} from '../data/extent.ts';\nimport {SegmentVector} from '../data/segment.ts';\nimport {RasterBoundsArray, PosArray, TriangleIndexArray, LineStripIndexArray} from '../data/array_types.g.ts';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes.ts';\nimport posAttributes from '../data/pos_attributes.ts';\nimport {type ProgramConfiguration} from '../data/program_configuration.ts';\nimport {CrossTileSymbolIndex} from '../symbol/cross_tile_symbol_index.ts';\nimport {shaders} from '../shaders/shaders.ts';\nimport {Program} from '../webgl/program.ts';\nimport {programUniforms} from '../webgl/program/program_uniforms.ts';\nimport {Context} from '../webgl/context.ts';\nimport {DepthMode} from '../webgl/depth_mode.ts';\nimport {StencilMode} from '../webgl/stencil_mode.ts';\nimport {ColorMode} from '../webgl/color_mode.ts';\nimport {CullFaceMode} from '../webgl/cull_face_mode.ts';\nimport {Texture} from '../webgl/texture.ts';\nimport {Color} from '@maplibre/maplibre-gl-style-spec';\nimport {selectDebugSource, webglDrawFunctions, type DrawFunctions} from '../webgl/draw/index.ts';\nimport {type OverscaledTileID} from '../tile/tile_id.ts';\nimport {Mesh} from './mesh.ts';\nimport {MercatorShaderDefine, MercatorShaderVariantKey} from '../geo/projection/mercator_projection.ts';\n\nimport type {IReadonlyTransform} from '../geo/transform_interface.ts';\nimport type {Style} from '../style/style.ts';\nimport type {StyleLayer} from '../style/style_layer.ts';\nimport type {CrossFaded} from '../style/properties.ts';\nimport type {LineAtlas} from './line_atlas.ts';\nimport type {ImageManager} from './image_manager.ts';\nimport type {GlyphManager} from './glyph_manager.ts';\nimport type {VertexBuffer} from '../webgl/vertex_buffer.ts';\nimport type {IndexBuffer} from '../webgl/index_buffer.ts';\nimport type {DepthRangeType, DepthMaskType, DepthFuncType} from '../webgl/types.ts';\nimport type {ResolvedImage} from '@maplibre/maplibre-gl-style-spec';\nimport type {IRenderToTexture} from './render_to_texture_interface.ts';\nimport type {TerrainData} from './terrain.ts';\nimport type {ProjectionData} from '../geo/projection/projection_data.ts';\nimport type {Framebuffer} from '../webgl/framebuffer.ts';\nimport {coveringTiles} from '../geo/projection/covering_tiles.ts';\nimport {isSymbolStyleLayer} from '../style/style_layer/symbol_style_layer.ts';\nimport {isCircleStyleLayer} from '../style/style_layer/circle_style_layer.ts';\nimport {isHeatmapStyleLayer} from '../style/style_layer/heatmap_style_layer.ts';\nimport {isLineStyleLayer} from '../style/style_layer/line_style_layer.ts';\nimport {isFillStyleLayer} from '../style/style_layer/fill_style_layer.ts';\nimport {isFillExtrusionStyleLayer} from '../style/style_layer/fill_extrusion_style_layer.ts';\nimport {isHillshadeStyleLayer} from '../style/style_layer/hillshade_style_layer.ts';\nimport {isColorReliefStyleLayer} from '../style/style_layer/color_relief_style_layer.ts';\nimport {isRasterStyleLayer} from '../style/style_layer/raster_style_layer.ts';\nimport {isBackgroundStyleLayer} from '../style/style_layer/background_style_layer.ts';\nimport {isCustomStyleLayer} from '../style/style_layer/custom_style_layer.ts';\n\nexport type RenderPass = 'offscreen' | 'opaque' | 'translucent';\n\ntype PainterOptions = {\n    showOverdrawInspector: boolean;\n    showTileBoundaries: boolean;\n    showPadding: boolean;\n    rotating: boolean;\n    zooming: boolean;\n    moving: boolean;\n    fadeDuration: number;\n    anisotropicFilterPitch: number;\n};\n\nexport type RenderOptions = {\n    isRenderingToTexture: boolean;\n    isRenderingGlobe: boolean;\n};\n\n/**\n * Holds the texture used to render a 2D tile so it can be draped over 3D\n * terrain. All RTTObjects share a single FBO owned by the Painter; the\n * texture is swapped in via `Painter.bindRTT` before each render pass.\n * Owned by a `Tile` while in use, recycled via `Painter.releaseRTT` when\n * the tile no longer needs it.\n */\nexport type RTTObject = {\n    texture: Texture;\n    size: number;\n};\n\n/**\n * @internal\n * Initialize a new painter object.\n */\nexport class Painter {\n    drawFunctions: DrawFunctions;\n    context: Context;\n    transform: IReadonlyTransform;\n    renderToTexture: IRenderToTexture;\n    _tileTextures: {\n        [_: number]: Texture[];\n    };\n    /**\n     * A pool of recyclable {@link RTTObject}s (textures only; the FBO is shared).\n     */\n    _rttObjectRecyclePool: RTTObject[];\n    /**\n     * Shared FBO used by all RTT render passes. The color attachment is\n     * swapped to the target RTTObject's texture via {@link bindRTT}.\n     * Created lazily on first use.\n     */\n    _rttSharedFbo: {\n        fbo: Framebuffer;\n        depthRenderbuffer: WebGLRenderbuffer;\n        size: number;\n    } | null;\n    /**\n     * Shared scratch FBO (color + depth-stencil) used by `{line,fill}-layer-opacity`.\n     * The layer is rendered into this FBO, then composited into whatever framebuffer was previously bound\n     * The canvas in the flat case, the per-terrain-tile RTT texture in the terrain case.\n     * Resized in place to match the target dimensions.\n     */\n    layerOpacityFbo: Framebuffer | null;\n    numSublayers: number;\n    depthEpsilon: number;\n    emptyProgramConfiguration: ProgramConfiguration;\n    width: number;\n    height: number;\n    pixelRatio: number;\n    tileExtentBuffer: VertexBuffer;\n    tileExtentSegments: SegmentVector;\n    tileExtentMesh: Mesh;\n\n    debugBuffer: VertexBuffer;\n    debugSegments: SegmentVector;\n    rasterBoundsBuffer: VertexBuffer;\n    rasterBoundsSegments: SegmentVector;\n    rasterBoundsBufferPosOnly: VertexBuffer;\n    rasterBoundsSegmentsPosOnly: SegmentVector;\n    viewportBuffer: VertexBuffer;\n    viewportSegments: SegmentVector;\n    quadTriangleIndexBuffer: IndexBuffer;\n    tileBorderIndexBuffer: IndexBuffer;\n    _tileClippingMaskIDs: {[_: string]: number};\n    stencilClearMode: StencilMode;\n    style: Style;\n    options: PainterOptions;\n    lineAtlas: LineAtlas;\n    imageManager: ImageManager;\n    glyphManager: GlyphManager;\n    depthRangeFor3D: DepthRangeType;\n    opaquePassCutoff: number;\n    renderPass: RenderPass;\n    currentLayer: number;\n    currentStencilSource: string;\n    nextStencilID: number;\n    id: string;\n    _showOverdrawInspector: boolean;\n    cache: {[_: string]: Program<any>};\n    crossTileSymbolIndex: CrossTileSymbolIndex;\n    symbolFadeChange: number;\n    debugOverlayTexture: Texture;\n    debugOverlayCanvas: HTMLCanvasElement;\n    // this object stores the current camera-matrix and the last render time\n    // of the terrain-facilitators. e.g. depth & coords framebuffers\n    // every time the camera-matrix changes the terrain-facilitators will be redrawn.\n    terrainFacilitator: {depthDirty: boolean; coordsDirty: boolean; matrix: mat4; renderTime: number};\n\n    constructor(gl: WebGL2RenderingContext, transform: IReadonlyTransform) {\n        this.drawFunctions = webglDrawFunctions;\n        this.context = new Context(gl);\n        this.transform = transform;\n        this.layerOpacityFbo = null;\n        this._tileTextures = {};\n        this._rttObjectRecyclePool = [];\n        this._rttSharedFbo = null;\n        this.terrainFacilitator = {depthDirty: true, coordsDirty: false, matrix: mat4.identity(new Float64Array(16)), renderTime: 0};\n\n        this.setup();\n\n        // Within each layer there are multiple distinct z-planes that can be drawn to.\n        // This is implemented using the WebGL depth buffer.\n        this.numSublayers = TileManager.maxOverzooming + TileManager.maxUnderzooming + 1;\n        this.depthEpsilon = 1 / Math.pow(2, 16);\n\n        this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n    }\n\n    /*\n     * Update the GL viewport, projection matrix, and transforms to compensate\n     * for a new width and height value.\n     */\n    resize(width: number, height: number, pixelRatio: number): void {\n        this.width = Math.floor(width * pixelRatio);\n        this.height = Math.floor(height * pixelRatio);\n        this.pixelRatio = pixelRatio;\n        this.context.viewport.set([0, 0, this.width, this.height]);\n\n        if (this.style) {\n            for (const layerId of this.style._order) {\n                this.style._layers[layerId].resize();\n            }\n        }\n    }\n\n    setup(): void {\n        const context = this.context;\n\n        const tileExtentArray = new PosArray();\n        tileExtentArray.emplaceBack(0, 0);\n        tileExtentArray.emplaceBack(EXTENT, 0);\n        tileExtentArray.emplaceBack(0, EXTENT);\n        tileExtentArray.emplaceBack(EXTENT, EXTENT);\n        this.tileExtentBuffer = context.createVertexBuffer(tileExtentArray, posAttributes.members);\n        this.tileExtentSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n\n        const debugArray = new PosArray();\n        debugArray.emplaceBack(0, 0);\n        debugArray.emplaceBack(EXTENT, 0);\n        debugArray.emplaceBack(0, EXTENT);\n        debugArray.emplaceBack(EXTENT, EXTENT);\n        this.debugBuffer = context.createVertexBuffer(debugArray, posAttributes.members);\n        this.debugSegments = SegmentVector.simpleSegment(0, 0, 4, 5);\n\n        const rasterBoundsArray = new RasterBoundsArray();\n        rasterBoundsArray.emplaceBack(0, 0, 0, 0);\n        rasterBoundsArray.emplaceBack(EXTENT, 0, EXTENT, 0);\n        rasterBoundsArray.emplaceBack(0, EXTENT, 0, EXTENT);\n        rasterBoundsArray.emplaceBack(EXTENT, EXTENT, EXTENT, EXTENT);\n        this.rasterBoundsBuffer = context.createVertexBuffer(rasterBoundsArray, rasterBoundsAttributes.members);\n        this.rasterBoundsSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n\n        const rasterBoundsArrayPosOnly = new PosArray();\n        rasterBoundsArrayPosOnly.emplaceBack(0, 0);\n        rasterBoundsArrayPosOnly.emplaceBack(EXTENT, 0);\n        rasterBoundsArrayPosOnly.emplaceBack(0, EXTENT);\n        rasterBoundsArrayPosOnly.emplaceBack(EXTENT, EXTENT);\n        this.rasterBoundsBufferPosOnly = context.createVertexBuffer(rasterBoundsArrayPosOnly, posAttributes.members);\n        this.rasterBoundsSegmentsPosOnly = SegmentVector.simpleSegment(0, 0, 4, 5);\n\n        const viewportArray = new PosArray();\n        viewportArray.emplaceBack(0, 0);\n        viewportArray.emplaceBack(1, 0);\n        viewportArray.emplaceBack(0, 1);\n        viewportArray.emplaceBack(1, 1);\n        this.viewportBuffer = context.createVertexBuffer(viewportArray, posAttributes.members);\n        this.viewportSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n\n        const tileLineStripIndices = new LineStripIndexArray();\n        tileLineStripIndices.emplaceBack(0);\n        tileLineStripIndices.emplaceBack(1);\n        tileLineStripIndices.emplaceBack(3);\n        tileLineStripIndices.emplaceBack(2);\n        tileLineStripIndices.emplaceBack(0);\n        this.tileBorderIndexBuffer = context.createIndexBuffer(tileLineStripIndices);\n\n        const quadTriangleIndices = new TriangleIndexArray();\n        quadTriangleIndices.emplaceBack(1, 0, 2);\n        quadTriangleIndices.emplaceBack(1, 2, 3);\n        this.quadTriangleIndexBuffer = context.createIndexBuffer(quadTriangleIndices);\n\n        const gl = this.context.gl;\n        this.stencilClearMode = new StencilMode({func: gl.ALWAYS, mask: 0}, 0x0, 0xFF, gl.ZERO, gl.ZERO, gl.ZERO);\n\n        this.tileExtentMesh = new Mesh(this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);\n    }\n\n    /*\n     * Reset the drawing canvas by clearing the stencil buffer so that we can draw\n     * new tiles at the same location, while retaining previously drawn pixels.\n     */\n    clearStencil(): void {\n        const context = this.context;\n        const gl = context.gl;\n\n        this.nextStencilID = 1;\n        this.currentStencilSource = undefined;\n\n        // As a temporary workaround for https://github.com/mapbox/mapbox-gl-js/issues/5490,\n        // pending an upstream fix, we draw a fullscreen stencil=0 clipping mask here,\n        // effectively clearing the stencil buffer: once an upstream patch lands, remove\n        // this function in favor of context.clear({ stencil: 0x0 })\n\n        const matrix = mat4.create();\n        mat4.ortho(matrix, 0, this.width, this.height, 0, 0, 1);\n        mat4.scale(matrix, matrix, [gl.drawingBufferWidth, gl.drawingBufferHeight, 0]);\n\n        const projectionData: ProjectionData = {\n            mainMatrix: matrix,\n            tileMercatorCoords: [0, 0, 1, 1],\n            clippingPlane: [0, 0, 0, 0],\n            projectionTransition: 0.0,\n            fallbackMatrix: matrix,\n            clipAntimeridian: false,\n        };\n\n        // Note: we force a simple mercator projection for the shader, since we want to draw a fullscreen quad.\n        this.useProgram('clippingMask', null, true).draw(context, gl.TRIANGLES,\n            DepthMode.disabled, this.stencilClearMode, ColorMode.disabled, CullFaceMode.disabled,\n            null, null, projectionData,\n            '$clipping', this.viewportBuffer,\n            this.quadTriangleIndexBuffer, this.viewportSegments);\n    }\n\n    renderTileClippingMasks(layer: StyleLayer, tileIDs: OverscaledTileID[], renderToTexture: boolean): void {\n        if (this.currentStencilSource === layer.source || !layer.isTileClipped() || !tileIDs?.length) {\n            return;\n        }\n\n        this.currentStencilSource = layer.source;\n\n        if (this.nextStencilID + tileIDs.length > 256) {\n            // we'll run out of fresh IDs so we need to clear and start from scratch\n            this.clearStencil();\n        }\n\n        const context = this.context;\n        context.setColorMode(ColorMode.disabled);\n        context.setDepthMode(DepthMode.disabled);\n\n        const stencilRefs = {};\n\n        // Set stencil ref values for all tiles\n        for (const tileID of tileIDs) {\n            stencilRefs[tileID.key] = this.nextStencilID++;\n        }\n\n        // A two-pass approach is needed for subdivided projections. See comment in draw_raster.ts\n        // for more details. In non-subdivided projections the border flag does not change the mesh,\n        // so one pass produces the same stencil mask.\n        if (this.style.projection.useSubdivision) {\n            this._renderTileMasks(stencilRefs, tileIDs, renderToTexture, true);\n        }\n\n        // Final pass - draw borderless tiles with GL_ALWAYS\n        this._renderTileMasks(stencilRefs, tileIDs, renderToTexture, false);\n\n        this._tileClippingMaskIDs = stencilRefs;\n    }\n\n    _renderTileMasks(tileStencilRefs: {[_: string]: number}, tileIDs: OverscaledTileID[], renderToTexture: boolean, useBorders: boolean): void {\n        const context = this.context;\n        const gl = context.gl;\n        const projection = this.style.projection;\n        const transform = this.transform;\n\n        const program = this.useProgram('clippingMask');\n\n        // tiles are usually supplied in ascending order of z, then y, then x\n        for (const tileID of tileIDs) {\n            const stencilRef = tileStencilRefs[tileID.key];\n            const terrainData = this.getTerrainDataForTile(tileID, renderToTexture);\n\n            const mesh = projection.getMeshFromTileID(this.context, tileID.canonical, useBorders, true, 'stencil');\n\n            const projectionData = transform.getProjectionData({overscaledTileID: tileID, applyGlobeMatrix: !renderToTexture, applyTerrainMatrix: true});\n\n            program.draw(context, gl.TRIANGLES, DepthMode.disabled,\n                // Tests will always pass, and ref value will be written to stencil buffer.\n                new StencilMode({func: gl.ALWAYS, mask: 0}, stencilRef, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE),\n                ColorMode.disabled, renderToTexture ? CullFaceMode.disabled : CullFaceMode.backCCW, null,\n                terrainData, projectionData, '$clipping', mesh.vertexBuffer,\n                mesh.indexBuffer, mesh.segments);\n        }\n    }\n\n    getTerrainDataForTile(tileID: OverscaledTileID, isRenderingToTexture: boolean): TerrainData | null {\n        if (isRenderingToTexture && this.style.projection?.name === 'mercator') return null;\n        return this.style.map.terrain?.getTerrainData(tileID) || null;\n    }\n\n    /**\n     * Fills the depth buffer with the geometry of all supplied tiles.\n     * Does not change the color buffer or the stencil buffer.\n     */\n    _renderTilesDepthBuffer(): void {\n        const context = this.context;\n        const gl = context.gl;\n        const projection = this.style.projection;\n        const transform = this.transform;\n\n        const program = this.useProgram('depth');\n        const depthMode = this.getDepthModeFor3D();\n        const tileIDs = coveringTiles(transform, {tileSize: transform.tileSize});\n\n        // tiles are usually supplied in ascending order of z, then y, then x\n        for (const tileID of tileIDs) {\n            const terrainData = this.style.map.terrain?.getTerrainData(tileID);\n            const mesh = projection.getMeshFromTileID(this.context, tileID.canonical, true, true, 'raster');\n\n            const projectionData = transform.getProjectionData({overscaledTileID: tileID, applyGlobeMatrix: true, applyTerrainMatrix: true});\n\n            program.draw(context, gl.TRIANGLES, depthMode, StencilMode.disabled,\n                ColorMode.disabled, CullFaceMode.backCCW, null,\n                terrainData, projectionData, '$clipping', mesh.vertexBuffer,\n                mesh.indexBuffer, mesh.segments);\n        }\n    }\n\n    stencilModeFor3D(): StencilMode {\n        this.currentStencilSource = undefined;\n\n        if (this.nextStencilID + 1 > 256) {\n            this.clearStencil();\n        }\n\n        const id = this.nextStencilID++;\n        const gl = this.context.gl;\n        return new StencilMode({func: gl.NOTEQUAL, mask: 0xFF}, id, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE);\n    }\n\n    stencilModeForClipping(tileID: OverscaledTileID): StencilMode {\n        const gl = this.context.gl;\n        return new StencilMode({func: gl.EQUAL, mask: 0xFF}, this._tileClippingMaskIDs[tileID.key], 0x00, gl.KEEP, gl.KEEP, gl.REPLACE);\n    }\n\n    /*\n     * Sort coordinates by Z as drawing tiles is done in Z-descending order.\n     * All children with the same Z write the same stencil value.  Children\n     * stencil values are greater than parent's.  This is used only for raster\n     * and raster-dem tiles, which are already clipped to tile boundaries, to\n     * mask area of tile overlapped by children tiles.\n     * Stencil ref values continue range used in _tileClippingMaskIDs.\n     *\n     * Attention: This function changes this.nextStencilID even if the result of it\n     * is not used, which might cause problems when rendering due to invalid stencil\n     * values.\n     * Returns [StencilMode for tile overscaleZ map, sortedCoords].\n     */\n    getStencilConfigForOverlapAndUpdateStencilID(tileIDs: OverscaledTileID[]): [{\n        [_: number]: Readonly<StencilMode>;\n    }, OverscaledTileID[]] {\n        const gl = this.context.gl;\n        const coords = tileIDs.sort((a, b) => b.overscaledZ - a.overscaledZ);\n        const minTileZ = coords[coords.length - 1].overscaledZ;\n        const stencilValues = coords[0].overscaledZ - minTileZ + 1;\n        if (stencilValues > 1) {\n            this.currentStencilSource = undefined;\n            if (this.nextStencilID + stencilValues > 256) {\n                this.clearStencil();\n            }\n            const zToStencilMode = {};\n            for (let i = 0; i < stencilValues; i++) {\n                zToStencilMode[i + minTileZ] = new StencilMode({func: gl.GEQUAL, mask: 0xFF}, i + this.nextStencilID, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE);\n            }\n            this.nextStencilID += stencilValues;\n            return [zToStencilMode, coords];\n        }\n        return [{[minTileZ]: StencilMode.disabled}, coords];\n    }\n\n    stencilConfigForOverlapTwoPass(tileIDs: OverscaledTileID[]): [\n        { [_: number]: Readonly<StencilMode> }, // borderless tiles - high priority & high stencil values\n        { [_: number]: Readonly<StencilMode> }, // tiles with border - low priority\n        OverscaledTileID[]\n    ] {\n        const gl = this.context.gl;\n        const coords = tileIDs.sort((a, b) => b.overscaledZ - a.overscaledZ);\n        const minTileZ = coords[coords.length - 1].overscaledZ;\n        const stencilValues = coords[0].overscaledZ - minTileZ + 1;\n\n        this.clearStencil();\n\n        if (stencilValues > 1) {\n            const zToStencilModeHigh = {};\n            const zToStencilModeLow = {};\n            for (let i = 0; i < stencilValues; i++) {\n                zToStencilModeHigh[i + minTileZ] = new StencilMode({func: gl.GREATER, mask: 0xFF}, stencilValues + 1 + i, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE);\n                zToStencilModeLow[i + minTileZ] = new StencilMode({func: gl.GREATER, mask: 0xFF}, 1 + i, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE);\n            }\n            this.nextStencilID = stencilValues * 2 + 1;\n            return [\n                zToStencilModeHigh,\n                zToStencilModeLow,\n                coords\n            ];\n        } else {\n            this.nextStencilID = 3;\n            return [\n                {[minTileZ]: new StencilMode({func: gl.GREATER, mask: 0xFF}, 2, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE)},\n                {[minTileZ]: new StencilMode({func: gl.GREATER, mask: 0xFF}, 1, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE)},\n                coords\n            ];\n        }\n    }\n\n    colorModeForRenderPass(): Readonly<ColorMode> {\n        const gl = this.context.gl;\n        if (this._showOverdrawInspector) {\n            const numOverdrawSteps = 8;\n            const a = 1 / numOverdrawSteps;\n\n            return new ColorMode([gl.CONSTANT_COLOR, gl.ONE], new Color(a, a, a, 0), [true, true, true, true]);\n        } else if (this.renderPass === 'opaque') {\n            return ColorMode.unblended;\n        } else {\n            return ColorMode.alphaBlended;\n        }\n    }\n\n    getDepthModeForSublayer(n: number, mask: DepthMaskType, func?: DepthFuncType | null): Readonly<DepthMode> {\n        if (!this.opaquePassEnabledForLayer()) return DepthMode.disabled;\n        const depth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon;\n        return new DepthMode(func || this.context.gl.LEQUAL, mask, [depth, depth]);\n    }\n\n    getDepthModeFor3D(): Readonly<DepthMode> {\n        return new DepthMode(this.context.gl.LEQUAL, DepthMode.ReadWrite, this.depthRangeFor3D);\n    }\n\n    /*\n     * The opaque pass and 3D layers both use the depth buffer.\n     * Layers drawn above 3D layers need to be drawn using the\n     * painter's algorithm so that they appear above 3D features.\n     * This returns true for layers that can be drawn using the\n     * opaque pass.\n     */\n    opaquePassEnabledForLayer(): boolean {\n        return this.currentLayer < this.opaquePassCutoff;\n    }\n\n    render(style: Style, options: PainterOptions): void {\n        this.style = style;\n        this.options = options;\n\n        this.lineAtlas = style.lineAtlas;\n        this.imageManager = style.imageManager;\n        this.glyphManager = style.glyphManager;\n\n        this.symbolFadeChange = style.placement.symbolFadeChange(now());\n\n        this.imageManager.beginFrame();\n\n        const layerIds = this.style._order;\n        const tileManagers = this.style.tileManagers;\n\n        const coordsAscending: {[_: string]: OverscaledTileID[]} = {};\n        const coordsDescending: {[_: string]: OverscaledTileID[]} = {};\n        const coordsDescendingSymbol: {[_: string]: OverscaledTileID[]} = {};\n        const renderOptions: RenderOptions = {isRenderingToTexture: false, isRenderingGlobe: style.projection?.transitionState > 0};\n\n        for (const id in tileManagers) {\n            const tileManager = tileManagers[id];\n            if (tileManager.used) {\n                tileManager.prepare(this.context);\n            }\n\n            coordsAscending[id] = tileManager.getVisibleCoordinates(false);\n            coordsDescending[id] = coordsAscending[id].slice().reverse();\n            coordsDescendingSymbol[id] = tileManager.getVisibleCoordinates(true).reverse();\n        }\n\n        this.opaquePassCutoff = Infinity;\n        for (let i = 0; i < layerIds.length; i++) {\n            const layerId = layerIds[i];\n            if (this.style._layers[layerId].is3D()) {\n                this.opaquePassCutoff = i;\n                break;\n            }\n        }\n\n        this.maybeDrawDepth(false);\n\n        if (this.renderToTexture) {\n            this.renderToTexture.prepareForRender(this.style, this.transform.zoom);\n            // this is disabled, because render-to-texture is rendering all layers from bottom to top.\n            this.opaquePassCutoff = 0;\n        }\n\n        // Offscreen pass ===============================================\n        // We first do all rendering that requires rendering to a separate\n        // framebuffer, and then save those for rendering back to the map\n        // later: in doing this we avoid doing expensive framebuffer restores.\n        this.renderPass = 'offscreen';\n\n        for (const layerId of layerIds) {\n            const layer = this.style._layers[layerId];\n            if (!layer.hasOffscreenPass() || layer.isHidden(this.transform.zoom)) continue;\n\n            const coords = coordsDescending[layer.source];\n            if (layer.type !== 'custom' && !coords.length) continue;\n\n            this.renderLayer(this, tileManagers[layer.source], layer, coords, renderOptions);\n        }\n\n        // Rebind the main framebuffer now that all offscreen layers have been rendered:\n        this.context.viewport.set([0, 0, this.width, this.height]);\n        this.context.bindFramebuffer.set(null);\n\n        // Clear buffers in preparation for drawing to the main framebuffer\n        this.context.clear({color: options.showOverdrawInspector ? Color.black : Color.transparent, depth: 1});\n        this.clearStencil();\n\n        // draw sky first to not overwrite symbols\n        if (this.style.sky) this.drawFunctions.sky(this, this.style.sky);\n\n        this._showOverdrawInspector = options.showOverdrawInspector;\n        this.depthRangeFor3D = [0, 1 - ((style._order.length + 2) * this.numSublayers * this.depthEpsilon)];\n\n        // Opaque pass ===============================================\n        // Draw opaque layers top-to-bottom first.\n        if (!this.renderToTexture) {\n            this.renderPass = 'opaque';\n\n            for (this.currentLayer = layerIds.length - 1; this.currentLayer >= 0; this.currentLayer--) {\n                const layer = this.style._layers[layerIds[this.currentLayer]];\n                const tileManager = tileManagers[layer.source];\n                const coords = coordsAscending[layer.source];\n\n                this.renderTileClippingMasks(layer, coords, false);\n                this.renderLayer(this, tileManager, layer, coords, renderOptions);\n            }\n        }\n\n        // Translucent pass ===============================================\n        // Draw all other layers bottom-to-top.\n        this.renderPass = 'translucent';\n\n        let globeDepthRendered = false;\n\n        for (this.currentLayer = 0; this.currentLayer < layerIds.length; this.currentLayer++) {\n            const layer = this.style._layers[layerIds[this.currentLayer]];\n            const tileManager = tileManagers[layer.source];\n\n            if (this.renderToTexture?.renderLayer(layer, renderOptions)) continue;\n\n            if (!this.opaquePassEnabledForLayer() && !globeDepthRendered) {\n                globeDepthRendered = true;\n                // Render the globe sphere into the depth buffer - but only if globe is enabled and terrain is disabled.\n                // There should be no need for explicitly writing tile depths when terrain is enabled.\n                if (renderOptions.isRenderingGlobe && !this.style.map.terrain) {\n                    this._renderTilesDepthBuffer();\n                }\n            }\n\n            // For symbol layers in the translucent pass, we add extra tiles to the renderable set\n            // for cross-tile symbol fading. Symbol layers don't use tile clipping, so no need to render\n            // separate clipping masks\n            const coords = (layer.type === 'symbol' ? coordsDescendingSymbol : coordsDescending)[layer.source];\n\n            this.renderTileClippingMasks(layer, coordsAscending[layer.source], !!this.renderToTexture);\n            this.renderLayer(this, tileManager, layer, coords, renderOptions);\n        }\n\n        // Render atmosphere, only for Globe projection\n        if (renderOptions.isRenderingGlobe) {\n            this.drawFunctions.atmosphere(this, this.style.sky, this.style.light);\n        }\n\n        if (this.options.showTileBoundaries) {\n            const selectedSource = selectDebugSource(this.style, this.transform.zoom);\n            if (selectedSource) {\n                this.drawFunctions.debug(this, selectedSource, selectedSource.getVisibleCoordinates());\n            }\n        }\n\n        if (this.options.showPadding) {\n            this.drawFunctions.debugPadding(this);\n        }\n\n        // Set defaults for most GL values so that anyone using the state after the render\n        // encounters more expected values.\n        this.context.setDefault();\n    }\n\n    /**\n     * Update the depth framebuffer if the camera has moved or tiles have reloaded.\n     * Marks coords as depthDirty so they are re-rendered on next demand.\n     */\n    maybeDrawDepth(requireExact: boolean): void {\n        if (!this.style?.map?.terrain) {\n            return;\n        }\n        const prevMatrix = this.terrainFacilitator.matrix;\n        const currMatrix = this.transform.modelViewProjectionMatrix;\n\n        // Update depth-framebuffer on camera movement, or tile reloading\n        let doUpdate = this.terrainFacilitator.depthDirty;\n        doUpdate ||= requireExact ? !mat4.exactEquals(prevMatrix, currMatrix) : !mat4.equals(prevMatrix, currMatrix);\n        doUpdate ||= this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime);\n\n        if (!doUpdate) {\n            return;\n        }\n\n        mat4.copy(prevMatrix, currMatrix);\n        this.terrainFacilitator.renderTime = now();\n        this.terrainFacilitator.depthDirty = false;\n        this.terrainFacilitator.coordsDirty = true;\n        this.drawFunctions.terrainDepth(this, this.style.map.terrain);\n    }\n\n    /**\n     * Render the coords framebuffer if it is coordsDirty\n     */\n    maybeDrawCoords(): void {\n        if (!this.style?.map?.terrain || !this.terrainFacilitator.coordsDirty) {\n            return;\n        }\n        this.terrainFacilitator.coordsDirty = false;\n        this.drawFunctions.terrainCoords(this, this.style.map.terrain);\n    }\n\n    renderLayer(painter: Painter, tileManager: TileManager, layer: StyleLayer, coords: OverscaledTileID[], renderOptions: RenderOptions): void {\n        if (layer.isHidden(this.transform.zoom)) return;\n        if (layer.type !== 'background' && layer.type !== 'custom' && !(coords || []).length) return;\n        this.id = layer.id;\n\n        const draw = this.drawFunctions;\n        if (isSymbolStyleLayer(layer)) {\n            draw.symbol(painter, tileManager, layer, coords, this.style.placement.variableOffsets, renderOptions);\n        } else if (isCircleStyleLayer(layer)) {\n            draw.circle(painter, tileManager, layer, coords, renderOptions);\n        } else if (isHeatmapStyleLayer(layer)) {\n            draw.heatmap(painter, tileManager, layer, coords, renderOptions);\n        } else if (isLineStyleLayer(layer)) {\n            draw.line(painter, tileManager, layer, coords, renderOptions);\n        } else if (isFillStyleLayer(layer)) {\n            draw.fill(painter, tileManager, layer, coords, renderOptions);\n        } else if (isFillExtrusionStyleLayer(layer)) {\n            draw.fillExtrusion(painter, tileManager, layer, coords, renderOptions);\n        } else if (isHillshadeStyleLayer(layer)) {\n            draw.hillshade(painter, tileManager, layer, coords, renderOptions);\n        } else if (isColorReliefStyleLayer(layer)) {\n            draw.colorRelief(painter, tileManager, layer, coords, renderOptions);\n        } else if (isRasterStyleLayer(layer)) {\n            draw.raster(painter, tileManager, layer, coords, renderOptions);\n        } else if (isBackgroundStyleLayer(layer)) {\n            draw.background(painter, tileManager, layer, coords, renderOptions);\n        } else if (isCustomStyleLayer(layer)) {\n            draw.custom(painter, tileManager, layer, renderOptions);\n        }\n    }\n\n    static readonly MAX_TEXTURE_POOL_SIZE_PER_BUCKET = 50;\n\n    saveTileTexture(texture: Texture): void {\n        const textures = this._tileTextures[texture.size[0]];\n        if (!textures) {\n            this._tileTextures[texture.size[0]] = [texture];\n        } else if (textures.length < Painter.MAX_TEXTURE_POOL_SIZE_PER_BUCKET) {\n            textures.push(texture);\n        } else {\n            texture.destroy();\n        }\n    }\n\n    getTileTexture(size: number): Texture {\n        const textures = this._tileTextures[size];\n        return textures && textures.length > 0 ? textures.pop() : null;\n    }\n\n    acquireRTT(size: number): RTTObject {\n        const gl = this.context.gl;\n        const obj = this._rttObjectRecyclePool.pop();\n        if (obj) {\n            if (obj.size !== size) {\n                gl.bindTexture(gl.TEXTURE_2D, obj.texture.texture);\n                gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n                obj.texture.size = [size, size];\n                obj.size = size;\n            }\n            return obj;\n        }\n        const texture = new Texture(this.context, {width: size, height: size, data: null}, gl.RGBA);\n        texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n        if (this.context.extTextureFilterAnisotropic) {\n            gl.texParameterf(gl.TEXTURE_2D, this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, this.context.extTextureFilterAnisotropicMax);\n        }\n        return {texture, size};\n    }\n\n    /**\n     * Binds the shared RTT FBO with the given RTTObject's texture attached\n     * as color target. Creates / resizes the shared FBO and depth-stencil\n     * renderbuffer lazily.\n     */\n    bindRTT(obj: RTTObject): void {\n        const gl = this.context.gl;\n        const size = obj.size;\n\n        // Lazy-create the shared FBO + depth-stencil renderbuffer\n        if (!this._rttSharedFbo) {\n            const fbo = this.context.createFramebuffer(size, size, true, true);\n            const depthRenderbuffer = this.context.createRenderbuffer(gl.DEPTH_STENCIL, size, size);\n            fbo.depthAttachment.set(depthRenderbuffer);\n            this._rttSharedFbo = {fbo, depthRenderbuffer, size};\n        }\n\n        // Resize the shared depth-stencil renderbuffer if needed\n        if (this._rttSharedFbo.size !== size) {\n            this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer);\n            gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, size, size);\n            this.context.bindRenderbuffer.set(null);\n            this._rttSharedFbo.fbo.width = size;\n            this._rttSharedFbo.fbo.height = size;\n            this._rttSharedFbo.size = size;\n        }\n\n        // Swap in the target texture and bind\n        this._rttSharedFbo.fbo.colorAttachment.set(obj.texture.texture);\n        this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer);\n    }\n\n    releaseRTT(obj: RTTObject): void {\n        this._rttObjectRecyclePool.push(obj);\n    }\n\n    /**\n     * Checks whether a pattern image is needed, and if it is, whether it is not loaded.\n     *\n     * @returns true if a needed image is missing and rendering needs to be skipped.\n     */\n    isPatternMissing(image?: CrossFaded<ResolvedImage> | null): boolean {\n        if (!image) return false;\n        if (!image.from || !image.to) return true;\n        const imagePosA = this.imageManager.getPattern(image.from.toString());\n        const imagePosB = this.imageManager.getPattern(image.to.toString());\n        return !imagePosA || !imagePosB;\n    }\n\n    /**\n     * Finds the required shader and its variant (base/terrain/globe, etc.) and binds it, compiling a new shader if required.\n     * @param name - Name of the desired shader.\n     * @param programConfiguration - Configuration of shader's inputs.\n     * @param forceSimpleProjection - Whether to force the use of a shader variant with simple mercator projection vertex shader.\n     * @param defines - Additional macros to be injected at the beginning of the shader. Expected format is `['#define XYZ']`, etc.\n     * False by default. Use true when drawing with a simple projection matrix is desired, eg. when drawing a fullscreen quad.\n     * @returns\n     */\n    useProgram(name: string, programConfiguration?: ProgramConfiguration | null, forceSimpleProjection: boolean = false, defines: string[] = []): Program<any> {\n        this.cache ||= {};\n        const useTerrain = !!this.style.map.terrain;\n\n        const projection = this.style.projection;\n\n        const projectionPrelude = forceSimpleProjection ? shaders.projectionMercator : projection.shaderPreludeCode;\n        const projectionDefine = forceSimpleProjection ? MercatorShaderDefine : projection.shaderDefine;\n        const projectionKey = `/${forceSimpleProjection ? MercatorShaderVariantKey : projection.shaderVariantName}`;\n\n        const configurationKey = (programConfiguration ? programConfiguration.cacheKey : '');\n        const overdrawKey = (this._showOverdrawInspector ? '/overdraw' : '');\n        const terrainKey = (useTerrain ? '/terrain' : '');\n        const definesKey = (defines ? `/${defines.join('/')}` : '');\n\n        const key = name + configurationKey + projectionKey + overdrawKey + terrainKey + definesKey;\n\n        this.cache[key] ||= new Program(\n            this.context,\n            shaders[name],\n            programConfiguration,\n            programUniforms[name],\n            this._showOverdrawInspector,\n            useTerrain,\n            projectionPrelude,\n            projectionDefine,\n            defines\n        );\n        return this.cache[key];\n    }\n\n    /*\n     * Reset some GL state to default values to avoid hard-to-debug bugs\n     * in custom layers.\n     */\n    setCustomLayerDefaults(): void {\n        // Prevent custom layers from unintentionally modify the last VAO used.\n        // All other state is state is restored on it's own, but for VAOs it's\n        // simpler to unbind so that we don't have to track the state of VAOs.\n        this.context.unbindVAO();\n\n        // The default values for this state is meaningful and often expected.\n        // Leaving this state dirty could cause a lot of confusion for users.\n        this.context.cullFace.setDefault();\n        this.context.activeTexture.setDefault();\n        this.context.pixelStoreUnpack.setDefault();\n        this.context.pixelStoreUnpackPremultiplyAlpha.setDefault();\n        this.context.pixelStoreUnpackFlipY.setDefault();\n    }\n\n    /*\n     * Set GL state shared by all layers.\n     */\n    setBaseState(): void {\n        const gl = this.context.gl;\n        this.context.cullFace.set(false);\n        this.context.viewport.set([0, 0, this.width, this.height]);\n        this.context.blendEquation.set(gl.FUNC_ADD);\n    }\n\n    initDebugOverlayCanvas(): void {\n        if (this.debugOverlayCanvas == null) {\n            this.debugOverlayCanvas = document.createElement('canvas');\n            this.debugOverlayCanvas.width = 512;\n            this.debugOverlayCanvas.height = 512;\n            const gl = this.context.gl;\n            this.debugOverlayTexture = new Texture(this.context, this.debugOverlayCanvas, gl.RGBA);\n        }\n    }\n\n    destroy(): void {\n        if (this._tileTextures) {\n            for (const size in this._tileTextures) {\n                const textures = this._tileTextures[size];\n                if (textures) {\n                    for (const texture of textures) {\n                        texture.destroy();\n                    }\n                }\n            }\n            this._tileTextures = {};\n        }\n\n        for (const obj of this._rttObjectRecyclePool) {\n            obj.texture.destroy();\n        }\n        this._rttObjectRecyclePool = [];\n\n        if (this._rttSharedFbo) {\n            // Detach so Framebuffer.destroy() doesn't delete the texture/renderbuffer\n            // that we already manage separately.\n            this._rttSharedFbo.fbo.colorAttachment.set(null);\n            this._rttSharedFbo.fbo.depthAttachment.set(null);\n            const gl = this.context.gl;\n            gl.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer);\n            gl.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer);\n            this._rttSharedFbo = null;\n        }\n\n        this.layerOpacityFbo?.destroy();\n        this.layerOpacityFbo = null;\n\n        if (this.tileExtentBuffer) this.tileExtentBuffer.destroy();\n        if (this.debugBuffer) this.debugBuffer.destroy();\n        if (this.rasterBoundsBuffer) this.rasterBoundsBuffer.destroy();\n        if (this.rasterBoundsBufferPosOnly) this.rasterBoundsBufferPosOnly.destroy();\n        if (this.viewportBuffer) this.viewportBuffer.destroy();\n        if (this.tileBorderIndexBuffer) this.tileBorderIndexBuffer.destroy();\n        if (this.quadTriangleIndexBuffer) this.quadTriangleIndexBuffer.destroy();\n        if (this.tileExtentMesh) this.tileExtentMesh.vertexBuffer?.destroy();\n        if (this.tileExtentMesh) this.tileExtentMesh.indexBuffer?.destroy();\n\n        if (this.debugOverlayTexture) {\n            this.debugOverlayTexture.destroy();\n        }\n\n        if (this.cache) {\n            for (const key in this.cache) {\n                const program = this.cache[key];\n                if (program?.program) {\n                    this.context.gl.deleteProgram(program.program);\n                }\n            }\n            this.cache = {};\n        }\n\n        if (this.context) {\n            this.context.setDefault();\n        }\n    }\n\n    /*\n     * Return true if drawing buffer size is != from requested size.\n     * That means that we've reached GL limits somehow.\n     * Note: drawing buffer size changes only when canvas size changes\n     */\n    overLimit(): boolean {\n        const {drawingBufferWidth, drawingBufferHeight} = this.context.gl;\n        return this.width !== drawingBufferWidth || this.height !== drawingBufferHeight;\n    }\n}\n","/**\n * Thrown (via the map's `error` event) when a GPU rendering context cannot be created.\n *\n * Carries the canvas attributes that were requested and, when the browser provided one,\n * the originating `webglcontextcreationerror` `statusMessage`.\n * Consumers can branch on `instanceof GPUInitializationError` and inspect the cause programmatically.\n * @see https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL\n */\nexport class GPUInitializationError extends Error {\n    readonly requestedAttributes: WebGLContextAttributes;\n    readonly statusMessage: string | null;\n\n    constructor(requestedAttributes: WebGLContextAttributes, creationEvent: WebGLContextEvent | null) {\n        super('WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL');\n        this.name = 'GPUInitializationError';\n        this.requestedAttributes = requestedAttributes;\n        this.statusMessage = creationEvent?.statusMessage ?? null;\n    }\n}\n","/**\n * Throttle the given function to run at most every `period` milliseconds.\n */\nexport function throttle<T extends (...args: any) => void>(fn: T, time: number): (...args: Parameters<T>) => ReturnType<typeof setTimeout> {\n    let pending = false;\n    let timerId: ReturnType<typeof setTimeout> = null;\n    let lastCallArgs: Parameters<T>;\n\n    const later = () => {\n        timerId = null;\n        if (pending) {\n            fn(...lastCallArgs);\n            timerId = setTimeout(later, time);\n            pending = false;\n        }\n    };\n\n    return (...args: Parameters<T>) => {\n        pending = true;\n        lastCallArgs = args;\n        if (!timerId) {\n            later();\n        }\n        return timerId;\n    };\n}\n","import {throttle} from '../util/throttle.ts';\nimport {LngLat} from '../geo/lng_lat.ts';\n\nimport type {Map} from './map.ts';\n\n/**\n * Adds the map's position to its page's location hash.\n * Passed as an option to the map object.\n *\n * @group Markers and Controls\n */\nexport class Hash {\n    _map: Map;\n    _hashName: string;\n\n    constructor(hashName?: string | null) {\n        this._hashName = hashName && encodeURIComponent(hashName);\n    }\n\n    /**\n     * Map element to listen for coordinate changes\n     *\n     * @param map - The map object\n     */\n    addTo(map: Map): this {\n        this._map = map;\n        addEventListener('hashchange', this._onHashChange, false);\n        this._map.on('moveend', this._updateHash);\n        return this;\n    }\n\n    /**\n     * Removes hash\n     */\n    remove(): this {\n        removeEventListener('hashchange', this._onHashChange, false);\n        this._map.off('moveend', this._updateHash);\n        clearTimeout(this._updateHash());\n        this._removeHash();\n\n        delete this._map;\n        return this;\n    }\n\n    getHashString(mapFeedback?: boolean): string {\n        const center = this._map.getCenter(),\n            zoom = Math.round(this._map.getZoom() * 100) / 100,\n            // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px\n            precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10),\n            m = Math.pow(10, precision),\n            lng = Math.round(center.lng * m) / m,\n            lat = Math.round(center.lat * m) / m,\n            bearing = this._map.getBearing(),\n            pitch = this._map.getPitch();\n        let hash = '';\n        if (mapFeedback) {\n            // new map feedback site has some constraints that don't allow\n            // us to use the same hash format as we do for the Map hash option.\n            hash += `/${lng}/${lat}/${zoom}`;\n        } else {\n            hash += `${zoom}/${lat}/${lng}`;\n        }\n\n        if (bearing || pitch) hash += (`/${Math.round(bearing * 10) / 10}`);\n        if (pitch) hash += (`/${Math.round(pitch)}`);\n\n        if (this._hashName) {\n            const params = this._getHashParams();\n            params.set(this._hashName, hash);\n            return `#${decodeURIComponent(params.toString()).replace(/=&/g, '&').replace(/=$/g, '')}`;\n        }\n\n        return `#${hash}`;\n    }\n\n    _getHashParams = (): URLSearchParams => {\n        return new URLSearchParams(window.location.hash.replace('#', ''));\n    };\n\n    _getCurrentHash = (): string[] => {\n        const params = this._getHashParams();\n        if (this._hashName) {\n            return (params.get(this._hashName) || '').split('/');\n        }\n        // For unnamed hashes, get the first key\n        const hash = [...params.keys()][0] ?? '';\n        return hash.split('/');\n    };\n\n    _onHashChange = (): boolean => {\n        const hash = this._getCurrentHash();\n\n        if (!this._isValidHash(hash)) {\n            return false;\n        }\n\n        const bearing = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(hash[3] || 0) : this._map.getBearing();\n        this._map.jumpTo({\n            center: [+hash[2], +hash[1]],\n            zoom: +hash[0],\n            bearing,\n            pitch: +(hash[4] || 0)\n        });\n\n        return true;\n    };\n\n    _updateHashUnthrottled = (): void => {\n        const location = window.location.href.replace(/(#.*)?$/, this.getHashString());\n        window.history.replaceState(window.history.state, null, location);\n    };\n\n    _removeHash = (): void => {\n        const params = this._getHashParams();\n\n        if (this._hashName) {\n            params.delete(this._hashName);\n        } else {\n            // For unnamed hash (#zoom/lat/lng&other=params), remove first entry\n            const keys = Array.from(params.keys());\n            if (keys.length > 0) {\n                params.delete(keys[0]);\n            }\n        }\n\n        const newHash = decodeURIComponent(params.toString()).replace(/=&/g, '&').replace(/=$/g, '');\n        const replaceString = newHash ? `#${newHash}` : '';\n        let location = window.location.href.replace(/(#.+)?$/, replaceString);\n        location = location.replace('&&', '&');\n        window.history.replaceState(window.history.state, null, location);\n    };\n\n    /**\n     * Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.\n     */\n    _updateHash: () => ReturnType<typeof setTimeout> = throttle(this._updateHashUnthrottled, 30 * 1000 / 100);\n\n    _isValidHash(hash: string[]): boolean {\n        if (hash.length < 3 || hash.some(h => isNaN(+h))) {\n            return false;\n        }\n\n        // LngLat() throws error if latitude is out of range, and it's valid if it succeeds.\n        try {\n            new LngLat(+hash[2], +hash[1]);\n        } catch {\n            return false;\n        }\n\n        const zoom = +hash[0];\n        const bearing = +(hash[3] || 0);\n        const pitch = +(hash[4] || 0);\n\n        return zoom >= this._map.getMinZoom() && zoom <= this._map.getMaxZoom() &&\n            bearing >= -180 && bearing <= 180 &&\n            pitch >= this._map.getMinPitch() && pitch <= this._map.getMaxPitch();\n    };\n}\n","import {now} from '../util/time_control.ts';\nimport {bezier, clamp, extend, evaluateZoomSnap} from '../util/util.ts';\nimport Point from '@mapbox/point-geometry';\n\nimport type {DragPanOptions} from './handler/shim/drag_pan.ts';\nimport type {EaseToOptions} from './camera.ts';\nimport type {Map} from './map.ts';\n\nconst defaultInertiaOptions = {\n    linearity: 0.3,\n    easing: bezier(0, 0, 0.3, 1),\n};\n\nconst defaultPanInertiaOptions = extend({\n    deceleration: 2500,\n    maxSpeed: 1400\n}, defaultInertiaOptions);\n\nconst defaultZoomInertiaOptions = extend({\n    deceleration: 20,\n    maxSpeed: 1400\n}, defaultInertiaOptions);\n\nconst defaultBearingInertiaOptions = extend({\n    deceleration: 1000,\n    maxSpeed: 360\n}, defaultInertiaOptions);\n\nconst defaultPitchInertiaOptions = extend({\n    deceleration: 1000,\n    maxSpeed: 90\n}, defaultInertiaOptions);\n\nconst defaultRollInertiaOptions = extend({\n    deceleration: 1000,\n    maxSpeed: 360\n}, defaultInertiaOptions);\n\nexport type InertiaOptions = {\n    linearity: number;\n    easing: (t: number) => number;\n    deceleration: number;\n    maxSpeed: number;\n};\n\nexport class HandlerInertia {\n    _map: Map;\n    _inertiaBuffer: Array<{\n        time: number;\n        settings: any;\n    }>;\n\n    constructor(map: Map) {\n        this._map = map;\n        this.clear();\n    }\n\n    clear(): void {\n        this._inertiaBuffer = [];\n    }\n\n    record(settings: any): void {\n        this._drainInertiaBuffer();\n        this._inertiaBuffer.push({time: now(), settings});\n    }\n\n    _drainInertiaBuffer(): void {\n        const inertia = this._inertiaBuffer,\n            currentTime = now(),\n            cutoff = 160;   //msec\n\n        while (inertia.length > 0 && currentTime - inertia[0].time > cutoff)\n            inertia.shift();\n    }\n\n    _onMoveEnd(panInertiaOptions?: DragPanOptions | boolean): EaseToOptions {\n        this._drainInertiaBuffer();\n        if (this._inertiaBuffer.length < 2) {\n            return;\n        }\n\n        const deltas = {\n            zoom: 0,\n            bearing: 0,\n            pitch: 0,\n            roll: 0,\n            pan: new Point(0, 0),\n            pinchAround: undefined,\n            around: undefined\n        };\n\n        for (const {settings} of this._inertiaBuffer) {\n            deltas.zoom += settings.zoomDelta || 0;\n            deltas.bearing += settings.bearingDelta || 0;\n            deltas.pitch += settings.pitchDelta || 0;\n            deltas.roll += settings.rollDelta || 0;\n            if (settings.panDelta) deltas.pan._add(settings.panDelta);\n            if (settings.around) deltas.around = settings.around;\n            if (settings.pinchAround) deltas.pinchAround = settings.pinchAround;\n        }\n\n        const lastEntry = this._inertiaBuffer[this._inertiaBuffer.length - 1];\n        const duration = (lastEntry.time - this._inertiaBuffer[0].time);\n\n        const easeOptions = {} as any;\n\n        if (deltas.pan.mag()) {\n            const result = calculateEasing(deltas.pan.mag(), duration, extend({}, defaultPanInertiaOptions, panInertiaOptions || {}));\n            const finalPan = deltas.pan.mult(result.amount / deltas.pan.mag());\n            const computedEaseOptions = this._map._camera.cameraHelper.handlePanInertia(finalPan, this._map._camera.transform);\n            easeOptions.center = computedEaseOptions.easingCenter;\n            easeOptions.offset = computedEaseOptions.easingOffset;\n            extendDuration(easeOptions, result);\n        }\n\n        if (deltas.zoom) {\n            const result = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);\n            easeOptions.zoom = evaluateZoomSnap(this._map.getZoom() + result.amount, this._map.getZoomSnap(), result.amount);\n            extendDuration(easeOptions, result);\n        }\n\n        if (deltas.bearing) {\n            const result = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);\n            easeOptions.bearing = this._map.getBearing() + clamp(result.amount, -179, 179);\n            extendDuration(easeOptions, result);\n        }\n\n        if (deltas.pitch) {\n            const result = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);\n            easeOptions.pitch = this._map.getPitch() + result.amount;\n            extendDuration(easeOptions, result);\n        }\n\n        if (deltas.roll) {\n            const result = calculateEasing(deltas.roll, duration, defaultRollInertiaOptions);\n            easeOptions.roll = this._map.getRoll() + clamp(result.amount, -179, 179);\n            extendDuration(easeOptions, result);\n        }\n\n        if (easeOptions.zoom || easeOptions.bearing) {\n            const last = deltas.pinchAround === undefined ? deltas.around : deltas.pinchAround;\n            easeOptions.around = last ? this._map.unproject(last) : this._map.getCenter();\n        }\n\n        this.clear();\n        return extend(easeOptions, {\n            noMoveStart: true\n        });\n\n    }\n}\n\n// Unfortunately zoom, bearing, etc can't have different durations and easings so\n// we need to choose one. We use the longest duration and it's corresponding easing.\nfunction extendDuration(easeOptions, result) {\n    if (!easeOptions.duration || easeOptions.duration < result.duration) {\n        easeOptions.duration = result.duration;\n        easeOptions.easing = result.easing;\n    }\n}\n\nfunction calculateEasing(amount, inertiaDuration: number, inertiaOptions) {\n    const {maxSpeed, linearity, deceleration} = inertiaOptions;\n    const speed = clamp(\n        amount * linearity / (inertiaDuration / 1000),\n        -maxSpeed,\n        maxSpeed);\n    const duration = Math.abs(speed) / (deceleration * linearity);\n    return {\n        easing: inertiaOptions.easing,\n        duration: duration * 1000,\n        amount: speed * (duration / 2)\n    };\n}\n","import {MapMouseEvent, MapTouchEvent, MapWheelEvent} from '../events.ts';\nimport {type Handler, type HandlerResult} from '../handler_manager.ts';\nimport type {Map} from '../map.ts';\nimport type Point from '@mapbox/point-geometry';\n\nexport class MapEventHandler implements Handler {\n\n    _mousedownPos: Point;\n    _clickTolerance: number;\n    _map: Map;\n\n    constructor(map: Map, options: {\n        clickTolerance: number;\n    }) {\n        this._map = map;\n        this._clickTolerance = options.clickTolerance;\n    }\n\n    reset(): void {\n        delete this._mousedownPos;\n    }\n\n    wheel(e: WheelEvent): HandlerResult | void {\n        // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n        // - ScrollZoom\n        return this._firePreventable(new MapWheelEvent(this._map, e));\n    }\n\n    mousedown(e: MouseEvent, point: Point): HandlerResult | void {\n        this._mousedownPos = point;\n        // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n        // - MousePan\n        // - MouseRotate\n        // - MousePitch\n        // - DblclickHandler\n        return this._firePreventable(new MapMouseEvent(e.type, this._map, e));\n    }\n\n    mouseup(e: MouseEvent): void {\n        this._map.fire(new MapMouseEvent(e.type, this._map, e));\n    }\n\n    click(e: MouseEvent, point: Point): void {\n        if (this._mousedownPos && this._mousedownPos.dist(point) >= this._clickTolerance) return;\n        this._map.fire(new MapMouseEvent(e.type, this._map, e));\n    }\n\n    dblclick(e: MouseEvent): HandlerResult | void {\n        // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n        // - DblClickZoom\n        return this._firePreventable(new MapMouseEvent(e.type, this._map, e));\n    }\n\n    mouseover(e: MouseEvent): void {\n        this._map.fire(new MapMouseEvent(e.type, this._map, e));\n    }\n\n    mouseout(e: MouseEvent): void {\n        this._map.fire(new MapMouseEvent(e.type, this._map, e));\n    }\n\n    touchstart(e: TouchEvent): HandlerResult | void {\n        // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n        // - TouchPan\n        // - TouchZoom\n        // - TouchRotate\n        // - TouchPitch\n        // - TapZoom\n        // - SwipeZoom\n        return this._firePreventable(new MapTouchEvent(e.type, this._map, e));\n    }\n\n    touchmove(e: TouchEvent): void {\n        this._map.fire(new MapTouchEvent(e.type, this._map, e));\n    }\n\n    touchend(e: TouchEvent): void {\n        this._map.fire(new MapTouchEvent(e.type, this._map, e));\n    }\n\n    touchcancel(e: TouchEvent): void {\n        this._map.fire(new MapTouchEvent(e.type, this._map, e));\n    }\n\n    _firePreventable(mapEvent: MapMouseEvent | MapTouchEvent | MapWheelEvent): HandlerResult | void {\n        this._map.fire(mapEvent);\n        if (mapEvent.defaultPrevented) {\n            // returning an object marks the handler as active and resets other handlers\n            return {};\n        }\n    }\n\n    isEnabled(): boolean {\n        return true;\n    }\n\n    isActive(): boolean {\n        return false;\n    }\n    enable(): void {}\n    disable(): void {}\n}\n\nexport class BlockableMapEventHandler {\n    _map: Map;\n    _delayContextMenu: boolean;\n    _ignoreContextMenu: boolean;\n    _contextMenuEvent: MouseEvent;\n\n    constructor(map: Map) {\n        this._map = map;\n    }\n\n    reset(): void {\n        this._delayContextMenu = false;\n        this._ignoreContextMenu = true;\n        delete this._contextMenuEvent;\n    }\n\n    mousemove(e: MouseEvent): void {\n        // mousemove map events should not be fired when interaction handlers (pan, rotate, etc) are active\n        this._map.fire(new MapMouseEvent(e.type, this._map, e));\n    }\n\n    mousedown(): void {\n        this._delayContextMenu = true;\n        this._ignoreContextMenu = false;\n    }\n\n    mouseup(): void {\n        this._delayContextMenu = false;\n        if (this._contextMenuEvent) {\n            this._map.fire(new MapMouseEvent('contextmenu', this._map, this._contextMenuEvent));\n            delete this._contextMenuEvent;\n        }\n    }\n    contextmenu(e: MouseEvent): void {\n        if (this._delayContextMenu) {\n            // Mac: contextmenu fired on mousedown; we save it until mouseup for consistency's sake\n            this._contextMenuEvent = e;\n        } else if (!this._ignoreContextMenu) {\n            // Windows: contextmenu fired on mouseup, so fire event now\n            this._map.fire(new MapMouseEvent(e.type, this._map, e));\n        }\n\n        // prevent browser context menu when necessary\n        if (this._map.listens('contextmenu')) {\n            e.preventDefault();\n        }\n    }\n\n    isEnabled(): boolean {\n        return true;\n    }\n\n    isActive(): boolean {\n        return false;\n    }\n    enable(): void {}\n    disable(): void {}\n}\n","import {DOM} from '../../util/dom.ts';\nimport {MapBoxZoomEvent} from '../events.ts';\n\nimport type {Map} from '../map.ts';\nimport type {Handler} from '../handler_manager.ts';\nimport type {TransformProvider} from './transform-provider.ts';\nimport type Point from '@mapbox/point-geometry';\n\n/**\n * Callback for customizing what happens when a box zoom gesture ends.\n */\nexport type BoxZoomEndHandler = (map: Map, startPos: Point, endPos: Point, originalEvent: MouseEvent) => void;\n\n/**\n * A {@link BoxZoomHandler} options object.\n */\nexport type BoxZoomHandlerOptions = {\n    /**\n     * A callback that runs when the user completes the Shift-drag box gesture.\n     * Providing this callback suppresses the default fit-to-box zoom behavior.\n     */\n    boxZoomEnd?: BoxZoomEndHandler;\n};\n\n/**\n * The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.\n * The bounding box is defined by clicking and holding `shift` while dragging the cursor.\n *\n * @group Handlers\n */\nexport class BoxZoomHandler implements Handler {\n    _map: Map;\n    _tr: TransformProvider;\n    _el: HTMLElement;\n    _container: HTMLElement;\n    _enabled: boolean;\n    _active: boolean;\n    _startPos: Point;\n    _lastPos: Point;\n    _box: HTMLElement;\n    _clickTolerance: number;\n    _boxZoomEnd?: BoxZoomEndHandler;\n\n    /** @internal */\n    constructor(map: Map, options: {\n        clickTolerance: number;\n        boxZoom?: boolean | BoxZoomHandlerOptions;\n    }, transformProvider: TransformProvider) {\n        this._map = map;\n        this._tr = transformProvider;\n        this._el = map.getCanvasContainer();\n        this._container = map.getContainer();\n        this._clickTolerance = options.clickTolerance || 1;\n        if (options.boxZoom && typeof options.boxZoom === 'object') {\n            this._boxZoomEnd = options.boxZoom.boxZoomEnd;\n        }\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"box zoom\" interaction is enabled.\n     *\n     * @returns `true` if the \"box zoom\" interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return !!this._enabled;\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"box zoom\" interaction is active, i.e. currently being used.\n     *\n     * @returns `true` if the \"box zoom\" interaction is active.\n     */\n    isActive(): boolean {\n        return !!this._active;\n    }\n\n    /**\n     * Enables the \"box zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.boxZoom.enable();\n     * ```\n     */\n    enable(): void {\n        if (this.isEnabled()) return;\n        this._enabled = true;\n    }\n\n    /**\n     * Disables the \"box zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.boxZoom.disable();\n     * ```\n     */\n    disable(): void {\n        if (!this.isEnabled()) return;\n        this._enabled = false;\n    }\n\n    mousedown(e: MouseEvent, point: Point): void {\n        if (!this.isEnabled()) return;\n        if (!(e.shiftKey && e.button === 0)) return;\n\n        DOM.disableDrag();\n        this._startPos = this._lastPos = point;\n        this._active = true;\n    }\n\n    mousemoveWindow(e: MouseEvent, point: Point): void {\n        if (!this._active) return;\n\n        const pos = point;\n\n        if (this._lastPos.equals(pos) || (!this._box && pos.dist(this._startPos) < this._clickTolerance)) {\n            return;\n        }\n\n        const p0 = this._startPos;\n        this._lastPos = pos;\n\n        if (!this._box) {\n            this._box = DOM.create('div', 'maplibregl-boxzoom', this._container);\n            this._container.classList.add('maplibregl-crosshair');\n            this._fireEvent('boxzoomstart', e);\n        }\n\n        const minX = Math.min(p0.x, pos.x),\n            maxX = Math.max(p0.x, pos.x),\n            minY = Math.min(p0.y, pos.y),\n            maxY = Math.max(p0.y, pos.y);\n\n        this._box.style.transform = `translate(${minX}px,${minY}px)`;\n\n        this._box.style.width = `${maxX - minX}px`;\n        this._box.style.height = `${maxY - minY}px`;\n    }\n\n    mouseupWindow(e: MouseEvent, point: Point): {cameraAnimation: (map: Map) => Map} | void {\n        if (!this._active) return;\n\n        if (e.button !== 0) return;\n\n        const p0 = this._startPos,\n            p1 = point;\n\n        this.reset();\n\n        DOM.suppressClick();\n\n        if (p0.x === p1.x && p0.y === p1.y) {\n            this._fireEvent('boxzoomcancel', e);\n        } else {\n            this._map.fire(new MapBoxZoomEvent('boxzoomend', {originalEvent: e}));\n            if (this._boxZoomEnd) {\n                this._boxZoomEnd(this._map, p0, p1, e);\n                return;\n            }\n            return {\n                cameraAnimation: map => map.fitScreenCoordinates(p0, p1, this._tr.bearing, {linear: true})\n            };\n        }\n    }\n\n    keydown(e: KeyboardEvent): void {\n        if (!this._active) return;\n\n        if (e.keyCode === 27) {\n            this.reset();\n            this._fireEvent('boxzoomcancel', e);\n        }\n    }\n\n    reset(): void {\n        this._active = false;\n\n        this._container.classList.remove('maplibregl-crosshair');\n\n        if (this._box) {\n            this._box.remove();\n            this._box = null;\n        }\n\n        DOM.enableDrag();\n\n        delete this._startPos;\n        delete this._lastPos;\n    }\n\n    _fireEvent(type: string, e: MouseEvent | KeyboardEvent): Map {\n        return this._map.fire(new MapBoxZoomEvent(type, {originalEvent: e}));\n    }\n}\n","import type Point from '@mapbox/point-geometry';\n\nexport function indexTouches(touches: Touch[], points: Point[]): Record<number, Point> {\n    if (touches.length !== points.length) throw new Error(`The number of touches and points are not equal - touches ${touches.length}, points ${points.length}`);\n    const obj: Record<number, Point> = {};\n    for (let i = 0; i < touches.length; i++) {\n        obj[touches[i].identifier] = points[i];\n    }\n    return obj;\n}\n","import Point from '@mapbox/point-geometry';\nimport {indexTouches} from './handler_util.ts';\n\nfunction getCentroid(points: Point[]) {\n    const sum = new Point(0, 0);\n    for (const point of points) {\n        sum._add(point);\n    }\n    return sum.div(points.length);\n}\n\nexport const MAX_TAP_INTERVAL = 500;\nconst MAX_TOUCH_TIME = 500;\nexport const MAX_DIST = 30;\n\nexport class SingleTapRecognizer {\n\n    numTouches: number;\n    centroid: Point;\n    startTime: number;\n    aborted: boolean;\n    touches: {\n        [k in number | string]: Point;\n    };\n\n    constructor(options: {\n        numTouches: number;\n    }) {\n        this.reset();\n        this.numTouches = options.numTouches;\n    }\n\n    reset(): void {\n        delete this.centroid;\n        delete this.startTime;\n        delete this.touches;\n        this.aborted = false;\n    }\n\n    touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n\n        if (this.centroid || mapTouches.length > this.numTouches) {\n            this.aborted = true;\n        }\n        if (this.aborted) {\n            return;\n        }\n\n        if (this.startTime === undefined) {\n            this.startTime = e.timeStamp;\n        }\n\n        if (mapTouches.length === this.numTouches) {\n            this.centroid = getCentroid(points);\n            this.touches = indexTouches(mapTouches, points);\n        }\n    }\n\n    touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        if (this.aborted || !this.centroid) return;\n\n        const newTouches = indexTouches(mapTouches, points);\n        for (const id in this.touches) {\n            const prevPos = this.touches[id];\n            const pos = newTouches[id];\n            if (!pos || pos.dist(prevPos) > MAX_DIST) {\n                this.aborted = true;\n            }\n        }\n    }\n\n    touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): Point | void {\n        if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {\n            this.aborted = true;\n        }\n\n        if (mapTouches.length === 0) {\n            const centroid = !this.aborted && this.centroid;\n            this.reset();\n            if (centroid) return centroid;\n        }\n    }\n\n}\n\nexport class TapRecognizer {\n\n    singleTap: SingleTapRecognizer;\n    numTaps: number;\n    lastTime: number;\n    lastTap: Point;\n    count: number;\n\n    constructor(options: {\n        numTaps: number;\n        numTouches: number;\n    }) {\n        this.singleTap = new SingleTapRecognizer(options);\n        this.numTaps = options.numTaps;\n        this.reset();\n    }\n\n    reset(): void {\n        this.lastTime = Infinity;\n        delete this.lastTap;\n        this.count = 0;\n        this.singleTap.reset();\n    }\n\n    touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        this.singleTap.touchstart(e, points, mapTouches);\n    }\n\n    touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        this.singleTap.touchmove(e, points, mapTouches);\n    }\n\n    touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): Point | void {\n        const tap = this.singleTap.touchend(e, points, mapTouches);\n        if (tap) {\n            const soonEnough = e.timeStamp - this.lastTime < MAX_TAP_INTERVAL;\n            const closeEnough = !this.lastTap || this.lastTap.dist(tap) < MAX_DIST;\n\n            if (!soonEnough || !closeEnough) {\n                this.reset();\n            }\n\n            this.count++;\n            this.lastTime = e.timeStamp;\n            this.lastTap = tap;\n\n            if (this.count === this.numTaps) {\n                this.reset();\n                return tap;\n            }\n        }\n    }\n}\n","import {TapRecognizer} from './tap_recognizer.ts';\nimport {evaluateZoomSnap} from '../../util/util.ts';\nimport type Point from '@mapbox/point-geometry';\nimport type {Map} from '../map.ts';\nimport type {TransformProvider} from './transform-provider.ts';\nimport type {Handler} from '../handler_manager.ts';\n\n/**\n * A `TapZoomHandler` allows the user to zoom the map at a point by double tapping\n */\nexport class TapZoomHandler implements Handler {\n    _tr: TransformProvider;\n    _enabled: boolean;\n    _active: boolean;\n    _zoomIn: TapRecognizer;\n    _zoomOut: TapRecognizer;\n\n    constructor(map: Map, transformProvider: TransformProvider) {\n        this._tr = transformProvider;\n        this._zoomIn = new TapRecognizer({\n            numTouches: 1,\n            numTaps: 2\n        });\n\n        this._zoomOut = new TapRecognizer({\n            numTouches: 2,\n            numTaps: 1\n        });\n\n        this.reset();\n    }\n\n    reset(): void {\n        this._active = false;\n        this._zoomIn.reset();\n        this._zoomOut.reset();\n    }\n\n    touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        this._zoomIn.touchstart(e, points, mapTouches);\n        this._zoomOut.touchstart(e, points, mapTouches);\n    }\n\n    touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        this._zoomIn.touchmove(e, points, mapTouches);\n        this._zoomOut.touchmove(e, points, mapTouches);\n    }\n\n    touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): {cameraAnimation: (map: Map) => Map} | void {\n        const zoomInPoint = this._zoomIn.touchend(e, points, mapTouches);\n        const zoomOutPoint = this._zoomOut.touchend(e, points, mapTouches);\n        const tr = this._tr;\n\n        if (zoomInPoint) {\n            this._active = true;\n            e.preventDefault();\n            setTimeout(() => this.reset(), 0);\n            return {\n                cameraAnimation: (map: Map) => map.easeTo({\n                    duration: 300,\n                    zoom: evaluateZoomSnap(tr.zoom + 1, map.getZoomSnap()),\n                    around: tr.unproject(zoomInPoint)\n                }, {originalEvent: e})\n            };\n        } else if (zoomOutPoint) {\n            this._active = true;\n            e.preventDefault();\n            setTimeout(() => this.reset(), 0);\n            return {\n                cameraAnimation: (map: Map) => map.easeTo({\n                    duration: 300,\n                    zoom: evaluateZoomSnap(tr.zoom - 1, map.getZoomSnap()),\n                    around: tr.unproject(zoomOutPoint)\n                }, {originalEvent: e})\n            };\n        }\n    }\n\n    touchcancel(): void {\n        this.reset();\n    }\n\n    enable(): void {\n        this._enabled = true;\n    }\n\n    disable(): void {\n        this._enabled = false;\n        this.reset();\n    }\n\n    isEnabled(): boolean {\n        return this._enabled;\n    }\n\n    isActive(): boolean {\n        return this._active;\n    }\n}\n","import {DOM} from '../../util/dom.ts';\nimport type Point from '@mapbox/point-geometry';\nimport {type DragMoveStateManager} from './drag_move_state_manager.ts';\nimport {type Handler} from '../handler_manager.ts';\n\ntype DragMovementResult = {\n    bearingDelta?: number;\n    pitchDelta?: number;\n    rollDelta?: number;\n    around?: Point;\n    panDelta?: Point;\n};\n\nexport interface DragPanResult extends DragMovementResult {\n    around: Point;\n    panDelta: Point;\n}\n\nexport interface DragRotateResult extends DragMovementResult {\n    bearingDelta: number;\n}\n\nexport interface DragPitchResult extends DragMovementResult {\n    pitchDelta: number;\n}\n\nexport interface DragRollResult extends DragMovementResult {\n    rollDelta: number;\n}\n\ntype DragMoveFunction<T extends DragMovementResult> = (lastPoint: Point, currnetPoint: Point) => T;\n\nexport interface DragMoveHandler<T extends DragMovementResult, E extends Event> extends Handler {\n    dragStart: (e: E, point: Point) => void;\n    dragMove: (e: E, point: Point) => T | void;\n    dragEnd: (e: E) => void;\n}\n\nexport type DragMoveHandlerOptions<T, E extends Event> = {\n    /**\n     * If the movement is shorter than this value, consider it a click.\n     */\n    clickTolerance: number;\n    /**\n     * The move function to run on a valid movement.\n     */\n    move: DragMoveFunction<T>;\n    /**\n     * A class used to manage the state of the drag event - start, checking valid moves, end. See the class documentation for more details.\n     */\n    moveStateManager: DragMoveStateManager<E>;\n    /**\n     * A method used to assign the dragStart, dragMove, and dragEnd methods to the relevant event handlers, as well as assigning the contextmenu handler\n     * @param handler - the handler\n     */\n    assignEvents: (handler: DragMoveHandler<T, E>) => void;\n    /**\n     * Should the move start on the \"start\" event, or should it start on the first valid move.\n     */\n    activateOnStart?: boolean;\n    /**\n     * If true, handler will be enabled during construction\n     */\n    enable?: boolean;\n};\n\n/**\n * A generic class to create handlers for drag events, from both mouse and touch events.\n */\nexport class DragHandler<T extends DragMovementResult, E extends Event> implements DragMoveHandler<T, E> {\n    // Event handlers that may be assigned by the implementations of this class\n    contextmenu?: Handler['contextmenu'];\n    mousedown?: Handler['mousedown'];\n    mousemoveWindow?: Handler['mousemoveWindow'];\n    mouseup?: Handler['mouseup'];\n    touchstart?: Handler['touchstart'];\n    touchmoveWindow?: Handler['touchmoveWindow'];\n    touchend?: Handler['touchend'];\n\n    _clickTolerance: number;\n    _moveFunction: DragMoveFunction<T>;\n    _activateOnStart: boolean;\n    _active: boolean;\n    _enabled: boolean;\n    _moved: boolean;\n    _lastPoint: Point | null;\n    _moveStateManager: DragMoveStateManager<E>;\n\n    constructor(options: DragMoveHandlerOptions<T, E>) {\n        this._enabled = !!options.enable;\n        this._moveStateManager = options.moveStateManager;\n        this._clickTolerance = options.clickTolerance || 1;\n        this._moveFunction = options.move;\n        this._activateOnStart = !!options.activateOnStart;\n\n        options.assignEvents(this);\n\n        this.reset();\n    }\n\n    reset(e?: E): void {\n        this._active = false;\n        this._moved = false;\n        delete this._lastPoint;\n        this._moveStateManager.endMove(e);\n    }\n\n    _move(...params: Parameters<DragMoveFunction<T>>): T | void {\n        const move = this._moveFunction(...params);\n        if (move.bearingDelta || move.pitchDelta || move.rollDelta || move.around || move.panDelta) {\n            this._active = true;\n            return move;\n        }\n    }\n\n    dragStart(e: E, point: Point): void;\n    dragStart(e: E, point: Point[]): void;\n    dragStart(e: E, point: Point | Point[]): void {\n        if (!this.isEnabled() || this._lastPoint) return;\n\n        if (!this._moveStateManager.isValidStartEvent(e)) return;\n        this._moveStateManager.startMove(e);\n\n        this._lastPoint = Array.isArray(point) ? point[0] : point;\n\n        if (this._activateOnStart && this._lastPoint) this._active = true;\n    }\n\n    dragMove(e: E, point: Point): T | void;\n    dragMove(e: E, point: Point[]): T | void;\n    dragMove(e: E, point: Point | Point[]): T | void {\n        if (!this.isEnabled()) return;\n        const lastPoint = this._lastPoint;\n        if (!lastPoint) return;\n        e.preventDefault();\n\n        if (!this._moveStateManager.isValidMoveEvent(e)) {\n            this.reset(e);\n            return;\n        }\n\n        const movePoint = Array.isArray(point) ? point[0] : point;\n\n        if (!this._moved && movePoint.dist(lastPoint) < this._clickTolerance) return;\n        this._moved = true;\n        this._lastPoint = movePoint;\n\n        return this._move(lastPoint, movePoint);\n    }\n\n    dragEnd(e: E): void {\n        if (!this.isEnabled() || !this._lastPoint) return;\n        if (!this._moveStateManager.isValidEndEvent(e)) return;\n        if (this._moved) DOM.suppressClick();\n        this.reset(e);\n    }\n\n    enable(): void {\n        this._enabled = true;\n    }\n\n    disable(): void {\n        this._enabled = false;\n        this.reset();\n    }\n\n    isEnabled(): boolean {\n        return this._enabled;\n    }\n\n    isActive(): boolean {\n        return this._active;\n    }\n\n    getClickTolerance(): number {\n        return this._clickTolerance;\n    }\n}\n","const LEFT_BUTTON = 0;\nconst RIGHT_BUTTON = 2;\n\n// the values for each button in MouseEvent.buttons\nconst BUTTONS_FLAGS = {\n    [LEFT_BUTTON]: 1,\n    [RIGHT_BUTTON]: 2\n};\n\nfunction buttonNoLongerPressed(e: MouseEvent, button: number) {\n    const flag = BUTTONS_FLAGS[button];\n    return e.buttons === undefined || (e.buttons & flag) !== flag;\n}\n\n/*\n * Drag events are initiated by specific interaction which needs to be tracked until it ends.\n * This requires some state management:\n * 1. registering the initiating event,\n * 2. tracking that it was not canceled / not confusing it with another event firing.\n * 3. recognizing the ending event and cleaning up any internal state\n *\n * Concretely, we implement two state managers:\n * 1. MouseMoveStateManager\n *      Receives a functions that is used to recognize mouse events that should be registered as the\n *      relevant drag interactions - i.e. dragging with the right mouse button, or while CTRL is pressed.\n * 2. OneFingerTouchMoveStateManager\n *      Checks if a drag event is using one finger, and continuously tracking that this is the same event\n *      (i.e. to make sure not additional finger has started interacting with the screen before raising\n *      the first finger).\n */\nexport interface DragMoveStateManager<E extends Event> {\n    startMove: (e: E) => void;\n    endMove: (e?: E) => void;\n    isValidStartEvent: (e: E) => boolean;\n    isValidMoveEvent: (e: E) => boolean;\n    isValidEndEvent: (e?: E) => boolean;\n}\n\nexport class MouseMoveStateManager implements DragMoveStateManager<MouseEvent> {\n    _eventButton: number | undefined;\n    _correctEvent: (e: MouseEvent) => boolean;\n\n    constructor(options: {\n        checkCorrectEvent: (e: MouseEvent) => boolean;\n    }) {\n        this._correctEvent = options.checkCorrectEvent;\n    }\n\n    startMove(e: MouseEvent): void {\n        this._eventButton = e.button;\n    }\n\n    endMove(_e?: MouseEvent): void {\n        delete this._eventButton;\n    }\n\n    isValidStartEvent(e: MouseEvent): boolean {\n        return this._correctEvent(e);\n    }\n\n    isValidMoveEvent(e: MouseEvent): boolean {\n        // Some browsers don't fire a `mouseup` when the mouseup occurs outside\n        // the window or iframe:\n        // https://github.com/mapbox/mapbox-gl-js/issues/4622\n        //\n        // If the button is no longer pressed during this `mousemove` it may have\n        // been released outside of the window or iframe.\n        return !buttonNoLongerPressed(e, this._eventButton);\n    }\n\n    isValidEndEvent(e: MouseEvent): boolean {\n        const eventButton = e.button;\n        return eventButton === this._eventButton;\n    }\n}\n\nexport class OneFingerTouchMoveStateManager implements DragMoveStateManager<TouchEvent> {\n    _firstTouch: number | undefined;\n\n    constructor() {\n        this._firstTouch = undefined;\n    }\n\n    _isOneFingerTouch(e: TouchEvent): boolean {\n        return e.targetTouches.length === 1;\n    }\n\n    _isSameTouchEvent(e: TouchEvent): boolean {\n        return e.targetTouches[0].identifier === this._firstTouch;\n    }\n\n    startMove(e: TouchEvent): void {\n        this._firstTouch = e.targetTouches[0].identifier;\n    }\n\n    endMove(_e?: TouchEvent): void {\n        delete this._firstTouch;\n    }\n\n    isValidStartEvent(e: TouchEvent): boolean {\n        return this._isOneFingerTouch(e);\n    }\n\n    isValidMoveEvent(e: TouchEvent): boolean {\n        return this._isOneFingerTouch(e) && this._isSameTouchEvent(e);\n    }\n\n    isValidEndEvent(e: TouchEvent): boolean {\n        return this._isOneFingerTouch(e) && this._isSameTouchEvent(e);\n    }\n}\n\nexport class MouseOrTouchMoveStateManager implements DragMoveStateManager<MouseEvent | TouchEvent> {\n    constructor(\n        private mouseMoveStateManager: MouseMoveStateManager = new MouseMoveStateManager({checkCorrectEvent: () => true}),\n        private oneFingerTouchMoveStateManager: OneFingerTouchMoveStateManager = new OneFingerTouchMoveStateManager()\n    ) {}\n\n    _executeRelevantHandler(e: MouseEvent | TouchEvent, onMouseEvent: (e: MouseEvent) => boolean | void, onTouchEvent: (e: TouchEvent) => boolean | void): boolean | void {\n        if (e instanceof MouseEvent) return onMouseEvent(e);\n        if (typeof TouchEvent !== 'undefined' && e instanceof TouchEvent) return onTouchEvent(e);\n    }\n\n    startMove(e: MouseEvent | TouchEvent): void {\n        this._executeRelevantHandler(e,\n            e => { this.mouseMoveStateManager.startMove(e); },\n            e => { this.oneFingerTouchMoveStateManager.startMove(e); });\n    }\n\n    endMove(e?: MouseEvent | TouchEvent): void {\n        this._executeRelevantHandler(e,\n            e => { this.mouseMoveStateManager.endMove(e); },\n            e => { this.oneFingerTouchMoveStateManager.endMove(e); });\n    }\n\n    isValidStartEvent(e: MouseEvent | TouchEvent): boolean {\n        return !!this._executeRelevantHandler(e,\n            e => this.mouseMoveStateManager.isValidStartEvent(e),\n            e => this.oneFingerTouchMoveStateManager.isValidStartEvent(e));\n    }\n\n    isValidMoveEvent(e: MouseEvent | TouchEvent): boolean {\n        return !!this._executeRelevantHandler(e,\n            e => this.mouseMoveStateManager.isValidMoveEvent(e),\n            e => this.oneFingerTouchMoveStateManager.isValidMoveEvent(e));\n    }\n\n    isValidEndEvent(e?: MouseEvent | TouchEvent): boolean {\n        return !!this._executeRelevantHandler(e,\n            e => this.mouseMoveStateManager.isValidEndEvent(e),\n            e => this.oneFingerTouchMoveStateManager.isValidEndEvent(e));\n    }\n}\n","import Point from '@mapbox/point-geometry';\n\nimport {type DragMoveHandler, type DragPanResult, type DragRotateResult, type DragPitchResult, DragHandler, type DragRollResult} from './drag_handler.ts';\nimport {MouseMoveStateManager} from './drag_move_state_manager.ts';\nimport {getAngleDelta} from '../../util/util.ts';\n\n/**\n * `MousePanHandler` allows the user to pan the map by clicking and dragging\n */\nexport interface MousePanHandler extends DragMoveHandler<DragPanResult, MouseEvent> {}\n/**\n * `MouseRotateHandler` allows the user to rotate the map by clicking and dragging\n */\nexport interface MouseRotateHandler extends DragMoveHandler<DragRotateResult, MouseEvent> {}\n/**\n * `MousePitchHandler` allows the user to zoom the map by pitching\n */\nexport interface MousePitchHandler extends DragMoveHandler<DragPitchResult, MouseEvent> {}\n/**\n * `MouseRollHandler` allows the user to roll the camera by holding `Ctrl`, right-clicking and dragging\n */\nexport interface MouseRollHandler extends DragMoveHandler<DragRollResult, MouseEvent> {}\n\nconst LEFT_BUTTON = 0;\nconst RIGHT_BUTTON = 2;\n\nconst assignEvents = <T extends DragPanResult | DragRotateResult | DragPitchResult | DragRollResult>(handler: DragHandler<T, MouseEvent>): void => {\n    handler.mousedown = handler.dragStart;\n    handler.mousemoveWindow = handler.dragMove;\n    handler.mouseup = handler.dragEnd;\n    handler.contextmenu = (e: MouseEvent) => {\n        e.preventDefault();\n    };\n};\n\nexport function generateMousePanHandler({enable, clickTolerance}: {\n    clickTolerance: number;\n    enable?: boolean;\n}): MousePanHandler {\n    const mouseMoveStateManager = new MouseMoveStateManager({\n        checkCorrectEvent: (e: MouseEvent) => e.button === LEFT_BUTTON && !e.ctrlKey,\n    });\n    return new DragHandler<DragPanResult, MouseEvent>({\n        clickTolerance,\n        move: (lastPoint: Point, point: Point) =>\n            ({around: point, panDelta: point.sub(lastPoint)}),\n        activateOnStart: true,\n        moveStateManager: mouseMoveStateManager,\n        enable,\n        assignEvents,\n    });\n};\n\nexport function generateMouseRotationHandler({enable, clickTolerance, aroundCenter = true, minPixelCenterThreshold = 100, rotateSpeed = 0.8}: {\n    clickTolerance: number;\n    enable?: boolean;\n    aroundCenter?: boolean;\n    minPixelCenterThreshold?: number;\n    /**\n     * Degrees the bearing changes per pixel of horizontal drag.\n     * @defaultValue 0.8\n     */\n    rotateSpeed?: number;\n}, getCenter: () => Point): MouseRotateHandler {\n    const mouseMoveStateManager = new MouseMoveStateManager({\n        checkCorrectEvent: (e: MouseEvent): boolean =>\n            (e.button === LEFT_BUTTON && e.ctrlKey) ||\n            (e.button === RIGHT_BUTTON && !e.ctrlKey),\n    });\n    return new DragHandler<DragRotateResult, MouseEvent>({\n        clickTolerance,\n        move: (lastPoint: Point, currentPoint: Point) => {\n            const center = getCenter();\n            if (aroundCenter && Math.abs(center.y - lastPoint.y) > minPixelCenterThreshold) {\n                // Avoid rotation related to y axis since it is \"saved\" for pitch\n                return {bearingDelta: getAngleDelta(new Point(lastPoint.x, currentPoint.y), currentPoint, center)};\n            }\n            let bearingDelta = (currentPoint.x - lastPoint.x) * rotateSpeed;\n            if (aroundCenter && currentPoint.y < center.y) {\n                bearingDelta = -bearingDelta;\n            }\n            return {bearingDelta};\n        },\n        // prevent browser context menu when necessary; we don't allow it with rotation\n        // because we can't discern rotation gesture start from contextmenu on Mac\n        moveStateManager: mouseMoveStateManager,\n        enable,\n        assignEvents,\n    });\n};\n\nexport function generateMousePitchHandler({enable, clickTolerance, pitchSpeed = -0.5}: {\n    clickTolerance: number;\n    /**\n     * Degrees the pitch changes per pixel of vertical drag.\n     * @defaultValue -0.5\n     */\n    pitchSpeed?: number;\n    enable?: boolean;\n}): MousePitchHandler {\n    const mouseMoveStateManager = new MouseMoveStateManager({\n        checkCorrectEvent: (e: MouseEvent): boolean =>\n            (e.button === LEFT_BUTTON && e.ctrlKey) ||\n            (e.button === RIGHT_BUTTON),\n    });\n    return new DragHandler<DragPitchResult, MouseEvent>({\n        clickTolerance,\n        move: (lastPoint: Point, point: Point) =>\n            ({pitchDelta: (point.y - lastPoint.y) * pitchSpeed}),\n        // prevent browser context menu when necessary; we don't allow it with rotation\n        // because we can't discern rotation gesture start from contextmenu on Mac\n        moveStateManager: mouseMoveStateManager,\n        enable,\n        assignEvents,\n    });\n};\n\nexport function generateMouseRollHandler({enable, clickTolerance, rollDegreesPerPixelMoved = 0.3}: {\n    clickTolerance: number;\n    rollDegreesPerPixelMoved?: number;\n    enable?: boolean;\n}, getCenter: () => Point): MouseRollHandler {\n    const mouseMoveStateManager = new MouseMoveStateManager({\n        checkCorrectEvent: (e: MouseEvent): boolean =>\n            (e.button === RIGHT_BUTTON && e.ctrlKey),\n    });\n    return new DragHandler<DragRollResult, MouseEvent>({\n        clickTolerance,\n        move: (lastPoint: Point, currentPoint: Point) => {\n            const center = getCenter();\n            let rollDelta = (currentPoint.x - lastPoint.x) * rollDegreesPerPixelMoved;\n            if (currentPoint.y < center.y) {\n                rollDelta = -rollDelta;\n            }\n            return {rollDelta};\n        },\n        // prevent browser context menu when necessary; we don't allow it with roll\n        // because we can't discern roll gesture start from contextmenu on Mac\n        moveStateManager: mouseMoveStateManager,\n        enable,\n        assignEvents,\n    });\n};\n","import Point from '@mapbox/point-geometry';\nimport {indexTouches} from './handler_util.ts';\nimport {type Handler} from '../handler_manager.ts';\nimport type {Map} from '../map.ts';\n\n/**\n * A `TouchPanHandler` allows the user to pan the map using touch gestures.\n */\nexport class TouchPanHandler implements Handler {\n\n    _enabled: boolean;\n    _active: boolean;\n    _touches: {\n        [k in string | number]: Point;\n    };\n    _clickTolerance: number;\n    _sum: Point;\n    _map: Map;\n\n    constructor(options: {clickTolerance: number}, map: Map) {\n        this._clickTolerance = options.clickTolerance || 1;\n        this._map = map;\n        this.reset();\n    }\n\n    reset(): void {\n        this._active = false;\n        this._touches = {};\n        this._sum = new Point(0, 0);\n    }\n\n    _shouldBePrevented(touchesCount: number): boolean {\n        const minTouches = this._map.cooperativeGestures.isEnabled() ? 2 : 1;\n        return touchesCount < minTouches;\n    }\n\n    touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): {around: Point; panDelta: Point} | void {\n        return this._calculateTransform(e, points, mapTouches);\n    }\n\n    touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): {around: Point; panDelta: Point} | void {\n        if (!this._active) return;\n        if (this._shouldBePrevented(mapTouches.length)) {\n            this._map.cooperativeGestures.notifyGestureBlocked('touch_pan', e);\n            return;\n        }\n        e.preventDefault();\n        return this._calculateTransform(e, points, mapTouches);\n    }\n\n    touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        this._calculateTransform(e, points, mapTouches);\n\n        if (this._active && this._shouldBePrevented(mapTouches.length)) {\n            this.reset();\n        }\n    }\n\n    touchcancel(): void {\n        this.reset();\n    }\n\n    _calculateTransform(e: TouchEvent, points: Point[], mapTouches: Touch[]): {around: Point; panDelta: Point} | void {\n        if (mapTouches.length > 0) this._active = true;\n\n        const touches = indexTouches(mapTouches, points);\n\n        const touchPointSum = new Point(0, 0);\n        const touchDeltaSum = new Point(0, 0);\n        let touchDeltaCount = 0;\n\n        for (const identifier in touches) {\n            const point = touches[identifier];\n            const prevPoint = this._touches[identifier];\n            if (prevPoint) {\n                touchPointSum._add(point);\n                touchDeltaSum._add(point.sub(prevPoint));\n                touchDeltaCount++;\n                touches[identifier] = point;\n            }\n        }\n\n        this._touches = touches;\n\n        if (this._shouldBePrevented(touchDeltaCount) || !touchDeltaSum.mag()) return;\n\n        const panDelta = touchDeltaSum.div(touchDeltaCount);\n        this._sum._add(panDelta);\n        if (this._sum.mag() < this._clickTolerance) return;\n\n        const around = touchPointSum.div(touchDeltaCount);\n\n        return {\n            around,\n            panDelta\n        };\n    }\n\n    enable(): void {\n        this._enabled = true;\n    }\n\n    disable(): void {\n        this._enabled = false;\n        this.reset();\n    }\n\n    isEnabled(): boolean {\n        return this._enabled;\n    }\n\n    isActive(): boolean {\n        return this._active;\n    }\n}\n","import type Point from '@mapbox/point-geometry';\nimport {DOM} from '../../util/dom.ts';\nimport type {Map} from '../map.ts';\nimport {type Handler, type HandlerResult} from '../handler_manager.ts';\n\n/**\n * An options object sent to the enable function of some of the handlers\n */\nexport type AroundCenterOptions = {\n    /**\n     * If \"center\" is passed, map will zoom around the center of map\n     */\n    around: 'center';\n};\n\n/**\n * The `TwoFingersTouchHandler`s allows the user to zoom, pitch and rotate the map using two fingers\n *\n */\nabstract class TwoFingersTouchHandler implements Handler {\n\n    _enabled?: boolean;\n    _active?: boolean;\n    _firstTwoTouches?: [number, number];\n    _vector?: Point;\n    _startVector?: Point;\n    _aroundCenter?: boolean;\n\n    /** @internal */\n    constructor() {\n        this.reset();\n    }\n\n    reset(): void {\n        this._active = false;\n        delete this._firstTwoTouches;\n    }\n\n    abstract _start(points: [Point, Point]): void;\n    abstract _move(points: [Point, Point], pinchAround: Point | null, e: TouchEvent): HandlerResult | void;\n\n    touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        if (this._firstTwoTouches || mapTouches.length < 2) return;\n\n        this._firstTwoTouches = [\n            mapTouches[0].identifier,\n            mapTouches[1].identifier\n        ];\n\n        // implemented by child classes\n        this._start([points[0], points[1]]);\n    }\n\n    touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): HandlerResult | void {\n        if (!this._firstTwoTouches) return;\n\n        e.preventDefault();\n\n        const [idA, idB] = this._firstTwoTouches;\n        const a = getTouchById(mapTouches, points, idA);\n        const b = getTouchById(mapTouches, points, idB);\n        if (!a || !b) return;\n        const pinchAround = this._aroundCenter ? null : a.add(b).div(2);\n\n        // implemented by child classes\n        return this._move([a, b], pinchAround, e);\n\n    }\n\n    touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        if (!this._firstTwoTouches) return;\n\n        const [idA, idB] = this._firstTwoTouches;\n        const a = getTouchById(mapTouches, points, idA);\n        const b = getTouchById(mapTouches, points, idB);\n        if (a && b) return;\n\n        if (this._active) DOM.suppressClick();\n\n        this.reset();\n    }\n\n    touchcancel(): void {\n        this.reset();\n    }\n\n    /**\n     * Enables the \"drag to pitch\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.touchPitch.enable();\n     * ```\n     */\n    enable(options?: AroundCenterOptions | boolean | null): void {\n        this._enabled = true;\n        this._aroundCenter = !!options && (options as AroundCenterOptions).around === 'center';\n    }\n\n    /**\n     * Disables the \"drag to pitch\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.touchPitch.disable();\n     * ```\n     */\n    disable(): void {\n        this._enabled = false;\n        this.reset();\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"drag to pitch\" interaction is enabled.\n     *\n     * @returns  `true` if the \"drag to pitch\" interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return !!this._enabled;\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"drag to pitch\" interaction is active, i.e. currently being used.\n     *\n     * @returns `true` if the \"drag to pitch\" interaction is active.\n     */\n    isActive(): boolean {\n        return !!this._active;\n    }\n}\n\nfunction getTouchById(mapTouches: Touch[], points: Point[], identifier: number): Point | undefined {\n    for (let i = 0; i < mapTouches.length; i++) {\n        if (mapTouches[i].identifier === identifier) return points[i];\n    }\n    return undefined;\n}\n\n/* ZOOM */\n\nconst defaultZoomRate = 1;\nconst defaultZoomThreshold = 0.1;\n\nfunction getZoomDelta(distance: number, lastDistance: number): number {\n    return Math.log(distance / lastDistance) / Math.LN2;\n}\n\n/**\n * The `TwoFingersTouchHandler`s allows the user to zoom the map two fingers\n *\n * @group Handlers\n */\nexport class TwoFingersTouchZoomHandler extends TwoFingersTouchHandler {\n\n    _distance?: number;\n    _startDistance?: number;\n    _zoomRate: number;\n    _zoomThreshold: number;\n\n    constructor() {\n        super();\n        this._zoomRate = defaultZoomRate;\n        this._zoomThreshold = defaultZoomThreshold;\n    }\n\n    /**\n     * Sets the zoom rate of touch gestures.\n     * @param zoomRate - 1 The rate used to scale touch movement to a zoom value. Set to `undefined` to restore the default.\n     * @example\n     * Slow down touch zoom\n     * ```ts\n     * map.touchZoomRotate.setZoomRate(0.5);\n     * ```\n     */\n    setZoomRate(zoomRate?: number): void {\n        this._zoomRate = zoomRate ?? defaultZoomRate;\n    }\n\n    /**\n     * Sets the threshold before a pinch gesture starts zooming.\n     * @param zoomThreshold - 0.1 The minimum zoom delta before the pinch gesture becomes active. Set to `undefined` to restore the default.\n     * @example\n     * Make pinch zoom less sensitive\n     * ```ts\n     * map.touchZoomRotate.setZoomThreshold(0.3);\n     * ```\n     */\n    setZoomThreshold(zoomThreshold?: number): void {\n        this._zoomThreshold = zoomThreshold ?? defaultZoomThreshold;\n    }\n\n    reset(): void {\n        super.reset();\n        delete this._distance;\n        delete this._startDistance;\n    }\n\n    _start(points: [Point, Point]): void {\n        this._startDistance = this._distance = points[0].dist(points[1]);\n    }\n\n    _move(points: [Point, Point], pinchAround: Point | null): HandlerResult | void {\n        const lastDistance = this._distance;\n        this._distance = points[0].dist(points[1]);\n        if (!this._active && Math.abs(getZoomDelta(this._distance, this._startDistance)) < this._zoomThreshold) return;\n        this._active = true;\n        return {\n            zoomDelta: getZoomDelta(this._distance, lastDistance) * this._zoomRate,\n            pinchAround\n        };\n    }\n}\n\n/* ROTATE */\n\nconst ROTATION_THRESHOLD = 25; // pixels along circumference of touch circle\n\nfunction getBearingDelta(a: Point, b: Point): number {\n    return a.angleWith(b) * 180 / Math.PI;\n}\n\n/**\n * The `TwoFingersTouchHandler`s allows the user to rotate the map two fingers\n *\n * @group Handlers\n */\nexport class TwoFingersTouchRotateHandler extends TwoFingersTouchHandler {\n    _minDiameter?: number;\n\n    reset(): void {\n        super.reset();\n        delete this._minDiameter;\n        delete this._startVector;\n        delete this._vector;\n    }\n\n    _start(points: [Point, Point]): void {\n        this._startVector = this._vector = points[0].sub(points[1]);\n        this._minDiameter = points[0].dist(points[1]);\n    }\n\n    _move(points: [Point, Point], pinchAround: Point | null, _e: TouchEvent): HandlerResult | void {\n        const lastVector = this._vector;\n        this._vector = points[0].sub(points[1]);\n\n        if (!this._active && this._isBelowThreshold(this._vector)) return;\n        this._active = true;\n\n        return {\n            bearingDelta: getBearingDelta(this._vector, lastVector),\n            pinchAround\n        };\n    }\n\n    _isBelowThreshold(vector: Point): boolean {\n        /*\n         * The threshold before a rotation actually happens is configured in\n         * pixels along the circumference of the circle formed by the two fingers.\n         * This makes the threshold in degrees larger when the fingers are close\n         * together and smaller when the fingers are far apart.\n         *\n         * Use the smallest diameter from the whole gesture to reduce sensitivity\n         * when pinching in and out.\n         */\n\n        this._minDiameter = Math.min(this._minDiameter, vector.mag());\n        const circumference = Math.PI * this._minDiameter;\n        const threshold = ROTATION_THRESHOLD / circumference * 360;\n\n        const bearingDeltaSinceStart = getBearingDelta(vector, this._startVector);\n        return Math.abs(bearingDeltaSinceStart) < threshold;\n    }\n}\n\n/* PITCH */\n\nfunction isVertical(vector: Point): boolean {\n    return Math.abs(vector.y) > Math.abs(vector.x);\n}\n\nconst ALLOWED_SINGLE_TOUCH_TIME = 100;\n\n/**\n * The `TwoFingersTouchPitchHandler` allows the user to pitch the map by dragging up and down with two fingers.\n *\n * @group Handlers\n */\nexport class TwoFingersTouchPitchHandler extends TwoFingersTouchHandler {\n\n    _valid?: boolean;\n    _firstMove?: number;\n    _lastPoints?: [Point, Point];\n    _map: Map;\n    _currentTouchCount: number = 0;\n\n    constructor(map: Map) {\n        super();\n        this._map = map;\n    }\n\n    reset(): void {\n        super.reset();\n        this._valid = undefined;\n        delete this._firstMove;\n        delete this._lastPoints;\n    }\n\n    touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        super.touchstart(e, points, mapTouches);\n        this._currentTouchCount = mapTouches.length;\n    }\n\n    _start(points: [Point, Point]): void {\n        this._lastPoints = points;\n        if (isVertical(points[0].sub(points[1]))) {\n            // fingers are more horizontal than vertical\n            this._valid = false;\n        }\n    }\n\n    _move(points: [Point, Point], center: Point | null, e: TouchEvent): HandlerResult | void {\n        // If cooperative gestures is enabled, we need a 3-finger minimum for this gesture to register\n        if (this._map.cooperativeGestures.isEnabled() && this._currentTouchCount < 3) {\n            return;\n        }\n\n        const vectorA = points[0].sub(this._lastPoints[0]);\n        const vectorB = points[1].sub(this._lastPoints[1]);\n\n        this._valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);\n        if (!this._valid) return;\n\n        this._lastPoints = points;\n        this._active = true;\n        const yDeltaAverage = (vectorA.y + vectorB.y) / 2;\n        const degreesPerPixelMoved = -0.5;\n        return {\n            pitchDelta: yDeltaAverage * degreesPerPixelMoved\n        };\n    }\n\n    gestureBeginsVertically(vectorA: Point, vectorB: Point, timeStamp: number): boolean | undefined {\n        if (this._valid !== undefined) return this._valid;\n\n        const threshold = 2;\n        const movedA = vectorA.mag() >= threshold;\n        const movedB = vectorB.mag() >= threshold;\n\n        // neither finger has moved a meaningful amount, wait\n        if (!movedA && !movedB) return;\n\n        // One finger has moved and the other has not.\n        // If enough time has passed, decide it is not a pitch.\n        if (!movedA || !movedB) {\n            if (this._firstMove === undefined) {\n                this._firstMove = timeStamp;\n            }\n\n            if (timeStamp - this._firstMove < ALLOWED_SINGLE_TOUCH_TIME) {\n                // still waiting for a movement from the second finger\n                return undefined;\n            } else {\n                return false;\n            }\n        }\n\n        const isSameDirection = vectorA.y > 0 === vectorB.y > 0;\n        return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;\n    }\n}\n","import {evaluateZoomSnap} from '../../util/util.ts';\nimport type {Handler} from '../handler_manager.ts';\nimport type {Map} from '../map.ts';\nimport type {TransformProvider} from './transform-provider.ts';\n\nconst defaultOptions = {\n    panStep: 100,\n    bearingStep: 15,\n    pitchStep: 10\n};\n\n/**\n * The `KeyboardHandler` allows the user to zoom, rotate, and pan the map using\n * the following keyboard shortcuts:\n *\n * - `=` / `+`: Increase the zoom level by 1.\n * - `Shift-=` / `Shift-+`: Increase the zoom level by 2.\n * - `-`: Decrease the zoom level by 1.\n * - `Shift--`: Decrease the zoom level by 2.\n * - Arrow keys: Pan by 100 pixels.\n * - `Shift+⇢`: Increase the rotation by 15 degrees.\n * - `Shift+⇠`: Decrease the rotation by 15 degrees.\n * - `Shift+⇡`: Increase the pitch by 10 degrees.\n * - `Shift+⇣`: Decrease the pitch by 10 degrees.\n *\n * @group Handlers\n */\nexport class KeyboardHandler implements Handler {\n    _tr: TransformProvider;\n    _enabled: boolean;\n    _active: boolean;\n    _panStep: number;\n    _bearingStep: number;\n    _pitchStep: number;\n    _rotationDisabled: boolean;\n\n    /** @internal */\n    constructor(map: Map, transformProvider: TransformProvider) {\n        this._tr = transformProvider;\n        const stepOptions = defaultOptions;\n        this._panStep = stepOptions.panStep;\n        this._bearingStep = stepOptions.bearingStep;\n        this._pitchStep = stepOptions.pitchStep;\n        this._rotationDisabled = false;\n    }\n\n    reset(): void {\n        this._active = false;\n    }\n\n    keydown(e: KeyboardEvent): {cameraAnimation: (map: Map) => void} | void {\n        if (e.altKey || e.ctrlKey || e.metaKey) return;\n\n        let zoomDir = 0;\n        let bearingDir = 0;\n        let pitchDir = 0;\n        let xDir = 0;\n        let yDir = 0;\n\n        switch (e.keyCode) {\n            case 61:\n            case 107:\n            case 171:\n            case 187:\n                zoomDir = 1;\n                break;\n\n            case 189:\n            case 109:\n            case 173:\n                zoomDir = -1;\n                break;\n\n            case 37:\n                if (e.shiftKey) {\n                    bearingDir = -1;\n                } else {\n                    e.preventDefault();\n                    xDir = -1;\n                }\n                break;\n\n            case 39:\n                if (e.shiftKey) {\n                    bearingDir = 1;\n                } else {\n                    e.preventDefault();\n                    xDir = 1;\n                }\n                break;\n\n            case 38:\n                if (e.shiftKey) {\n                    pitchDir = 1;\n                } else {\n                    e.preventDefault();\n                    yDir = -1;\n                }\n                break;\n\n            case 40:\n                if (e.shiftKey) {\n                    pitchDir = -1;\n                } else {\n                    e.preventDefault();\n                    yDir = 1;\n                }\n                break;\n\n            default:\n                return;\n        }\n\n        if (this._rotationDisabled) {\n            bearingDir = 0;\n            pitchDir = 0;\n        }\n\n        return {\n            cameraAnimation: (map: Map) => {\n                const tr = this._tr;\n                map.easeTo({\n                    duration: 300,\n                    easeId: 'keyboardHandler',\n                    easing: easeOut,\n\n                    zoom: zoomDir ? evaluateZoomSnap(tr.zoom + zoomDir * (e.shiftKey ? 2 : 1), map.getZoomSnap()) : tr.zoom,\n                    bearing: tr.bearing + bearingDir * this._bearingStep,\n                    pitch: tr.pitch + pitchDir * this._pitchStep,\n                    offset: [-xDir * this._panStep, -yDir * this._panStep],\n                    center: tr.center\n                }, {originalEvent: e});\n            }\n        };\n    }\n\n    /**\n     * Enables the \"keyboard rotate and zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.keyboard.enable();\n     * ```\n     */\n    enable(): void {\n        this._enabled = true;\n    }\n\n    /**\n     * Disables the \"keyboard rotate and zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.keyboard.disable();\n     * ```\n     */\n    disable(): void {\n        this._enabled = false;\n        this.reset();\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"keyboard rotate and zoom\"\n     * interaction is enabled.\n     *\n     * @returns `true` if the \"keyboard rotate and zoom\"\n     * interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return this._enabled;\n    }\n\n    /**\n     * Returns true if the handler is enabled and has detected the start of a\n     * zoom/rotate gesture.\n     *\n     * @returns `true` if the handler is enabled and has detected the\n     * start of a zoom/rotate gesture.\n     */\n    isActive(): boolean {\n        return this._active;\n    }\n\n    /**\n     * Disables the \"keyboard pan/rotate\" interaction, leaving the\n     * \"keyboard zoom\" interaction enabled.\n     *\n     * @example\n     * ```ts\n     * map.keyboard.disableRotation();\n     * ```\n     */\n    disableRotation(): void {\n        this._rotationDisabled = true;\n    }\n\n    /**\n     * Enables the \"keyboard pan/rotate\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.keyboard.enable();\n     * map.keyboard.enableRotation();\n     * ```\n     */\n    enableRotation(): void {\n        this._rotationDisabled = false;\n    }\n}\n\nfunction easeOut(t: number) {\n    return t * (2 - t);\n}\n","import {DOM} from '../../util/dom.ts';\nimport {defaultEasing, bezier, zoomScale, scaleZoom, evaluateZoomSnap} from '../../util/util.ts';\nimport {now} from '../../util/time_control.ts';\nimport {interpolates} from '@maplibre/maplibre-gl-style-spec';\nimport {LngLat} from '../../geo/lng_lat.ts';\n\nimport type {TransformProvider} from './transform-provider.ts';\nimport type {Map} from '../map.ts';\nimport type {AroundCenterOptions} from './two_fingers_touch.ts';\nimport type {Handler} from '../handler_manager.ts';\nimport type Point from '@mapbox/point-geometry';\n\n// deltaY value for mouse scroll wheel identification\nconst wheelZoomDelta = 4.000244140625;\n\n// These magic numbers control the rate of zoom. Trackpad events fire at a greater\n// frequency than mouse scroll wheel, so reduce the zoom rate per wheel tick\nconst defaultZoomRate = 1 / 100;\nconst wheelZoomRate = 1 / 450;\n\n// upper bound on how much we scale the map in any single render frame; this\n// is used to limit zoom rate in the case of very fast scrolling\nconst maxScalePerFrame = 2;\n\n// Minimum time difference value to be used for calculating zoom easing in renderFrame();\n// this is used to normalise very fast (typically 0 to 0.3ms) repeating lastWheelEventTimeDiff\n// values generated by Chromium based browsers during fast scrolling wheel events.\nconst wheelEventTimeDiffAdjustment = 5;\n\n/**\n * The `ScrollZoomHandler` allows the user to zoom the map by scrolling.\n *\n * @group Handlers\n */\nexport class ScrollZoomHandler implements Handler {\n    _map: Map;\n    _tr: TransformProvider;\n    _enabled: boolean;\n    _active: boolean;\n    _zooming: boolean;\n    _aroundCenter: boolean;\n    _aroundPoint: Point;\n    _type: 'wheel' | 'trackpad' | null;\n    _lastValue: number;\n    _timeout: ReturnType<typeof setTimeout>; // used for delayed-handling of a single wheel movement\n    _finishTimeout: ReturnType<typeof setTimeout>; // used to delay final '{move,zoom}end' events\n\n    _lastWheelEvent: WheelEvent;\n    _lastWheelEventTime: number;\n\n    _lastExpectedZoom: number;\n    _startZoom: number;\n    _targetZoom: number;\n    _delta: number;\n    _easing: ((a: number) => number);\n    _prevEase: {\n        start: number;\n        duration: number;\n        easing: (_: number) => number;\n    };\n\n    _needsRerender: boolean;\n    _triggerRenderFrame: () => void;\n\n    _defaultZoomRate: number;\n    _wheelZoomRate: number;\n\n    /** @internal */\n    constructor(map: Map, triggerRenderFrame: () => void, transformProvider: TransformProvider) {\n        this._map = map;\n        this._tr = transformProvider;\n        this._triggerRenderFrame = triggerRenderFrame;\n\n        this._delta = 0;\n\n        this._defaultZoomRate = defaultZoomRate;\n        this._wheelZoomRate = wheelZoomRate;\n    }\n\n    /**\n     * Set the zoom rate of a trackpad\n     * @param zoomRate - 1/100 The rate used to scale trackpad movement to a zoom value.\n     * @example\n     * Speed up trackpad zoom\n     * ```ts\n     * map.scrollZoom.setZoomRate(1/25);\n     * ```\n     */\n    setZoomRate(zoomRate: number): void {\n        this._defaultZoomRate = zoomRate;\n    }\n\n    /**\n     * Set the zoom rate of a mouse wheel\n     * @param wheelZoomRate - 1/450 The rate used to scale mouse wheel movement to a zoom value.\n     * @example\n     * Slow down zoom of mouse wheel\n     * ```ts\n     * map.scrollZoom.setWheelZoomRate(1/600);\n     * ```\n     */\n    setWheelZoomRate(wheelZoomRate: number): void {\n        this._wheelZoomRate = wheelZoomRate;\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"scroll to zoom\" interaction is enabled.\n     * @returns `true` if the \"scroll to zoom\" interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return !!this._enabled;\n    }\n\n    /*\n    * Active state is turned on and off with every scroll wheel event and is set back to false before the map\n    * render is called, so _active is not a good candidate for determining if a scroll zoom animation is in\n    * progress.\n    */\n    isActive(): boolean {\n        return !!this._active || this._finishTimeout !== undefined;\n    }\n\n    isZooming(): boolean {\n        return !!this._zooming;\n    }\n\n    /**\n     * Enables the \"scroll to zoom\" interaction.\n     *\n     * @param options - Options object.\n     * @example\n     * ```ts\n     * map.scrollZoom.enable();\n     * map.scrollZoom.enable({ around: 'center' })\n     * ```\n     */\n    enable(options?: AroundCenterOptions | boolean): void {\n        if (this.isEnabled()) return;\n        this._enabled = true;\n        this._aroundCenter = !!options && (options as AroundCenterOptions).around === 'center';\n    }\n\n    /**\n     * Disables the \"scroll to zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.scrollZoom.disable();\n     * ```\n     */\n    disable(): void {\n        if (!this.isEnabled()) return;\n        this._enabled = false;\n    }\n\n    /**\n     * Determines whether or not the gesture is blocked due to cooperativeGestures.\n     */\n    _shouldBePrevented(e: WheelEvent): boolean {\n        if (!this._map.cooperativeGestures.isEnabled()) {\n            return false;\n        }\n\n        const isTrackpadPinch = e.ctrlKey;\n        const isBypassed = isTrackpadPinch || this._map.cooperativeGestures.isBypassed(e);\n\n        return !isBypassed;\n    }\n\n    wheel(e: WheelEvent): void {\n        if (!this.isEnabled()) return;\n        if (this._shouldBePrevented(e)) {\n            this._map.cooperativeGestures.notifyGestureBlocked('wheel_zoom', e);\n            return;\n        }\n        let value = e.deltaMode === WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;\n        const currentTime = now(),\n            timeDelta = currentTime - (this._lastWheelEventTime || 0);\n\n        this._lastWheelEventTime = currentTime;\n\n        if (value !== 0 && (value % wheelZoomDelta) === 0) {\n            // This one is definitely a mouse wheel event.\n            this._type = 'wheel';\n\n        } else if (value !== 0 && Math.abs(value) < 4) {\n            // This one is definitely a trackpad event because it is so small.\n            this._type = 'trackpad';\n\n        } else if (timeDelta > 400) {\n            // This is likely a new scroll action.\n            this._type = null;\n            this._lastValue = value;\n\n            // Start a timeout in case this was a singular event, and delay it by up to 40ms.\n            this._timeout = setTimeout(this._onTimeout, 40, e);\n\n        } else if (!this._type) {\n            // This is a repeating event, but we don't know the type of event just yet.\n            // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode.\n            this._type = (Math.abs(timeDelta * value) < 200) ? 'trackpad' : 'wheel';\n\n            // Make sure our delayed event isn't fired again, because we accumulate\n            // the previous event (which was less than 40ms ago) into this event.\n            if (this._timeout) {\n                clearTimeout(this._timeout);\n                this._timeout = null;\n                value += this._lastValue;\n            }\n        }\n\n        // Slow down zoom if shift key is held for more precise zooming\n        if (e.shiftKey && value) value = value / 4;\n\n        // Only fire the callback if we actually know what type of scrolling device the user uses.\n        if (this._type) {\n            this._lastWheelEvent = e;\n            this._delta -= value;\n            if (!this._active) {\n                this._start(e);\n            }\n        }\n\n        e.preventDefault();\n    }\n\n    _onTimeout = (initialEvent: MouseEvent): void => {\n        this._type = 'wheel';\n        this._delta -= this._lastValue;\n        if (!this._active) {\n            this._start(initialEvent);\n        }\n    };\n\n    _start(e: MouseEvent): void {\n        if (!this._delta) return;\n\n        this._needsRerender = false;\n\n        this._active = true;\n        if (!this.isZooming()) {\n            this._zooming = true;\n        }\n\n        if (this._finishTimeout) {\n            clearTimeout(this._finishTimeout);\n            delete this._finishTimeout;\n        }\n\n        const pos = DOM.mousePos(this._map.getCanvas(), e);\n        const tr = this._tr;\n\n        // Whether aroundPoint is actually unprojectable is not a problem to be solved here, but in handler_manager.ts instead.\n        if (this._aroundCenter) {\n            this._aroundPoint = tr.transform.locationToScreenPoint(LngLat.convert(tr.center));\n        } else {\n            this._aroundPoint = pos;\n        }\n\n        if (!this._needsRerender) {\n            this._needsRerender = true;\n            this._triggerRenderFrame();\n        }\n    }\n\n    renderFrame(): {\n        noInertia: boolean;\n        needsRenderFrame: boolean;\n        zoomDelta: number;\n        around: Point;\n        originalEvent: WheelEvent;\n    } | void {\n        if (!this._needsRerender) return;\n        this._needsRerender = false;\n\n        if (!this.isActive()) return;\n        const tr = this._tr.transform;\n\n        // When globe is enabled zoom might be modified by the map center latitude being changes (either by panning or by zoom moving the map)\n        if (typeof this._lastExpectedZoom === 'number') {\n            const externalZoomChange = tr.zoom - this._lastExpectedZoom;\n            if (typeof this._startZoom === 'number') {\n                this._startZoom += externalZoomChange;\n            }\n            if (typeof this._targetZoom === 'number') {\n                this._targetZoom += externalZoomChange;\n            }\n        }\n\n        // if we've had scroll events since the last render frame, consume the\n        // accumulated delta, and update the target zoom level accordingly\n        if (this._delta !== 0) {\n            // For trackpad events and single mouse wheel ticks, use the default zoom rate\n            const zoomRate = (this._type === 'wheel' && Math.abs(this._delta) > wheelZoomDelta) ? this._wheelZoomRate : this._defaultZoomRate;\n            // Scale by sigmoid of scroll wheel delta so the map responds to small scrolls and compresses large scrolls\n            let scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(this._delta * zoomRate)));\n\n            if (this._delta < 0 && scale !== 0) {\n                scale = 1 / scale;\n            }\n\n            const fromScale = typeof this._targetZoom !== 'number' ? tr.scale : zoomScale(this._targetZoom);\n            const target = tr.applyConstrain(tr.getCameraLngLat(), scaleZoom(fromScale * scale)).zoom;\n            const zoomSnap = this._map.getZoomSnap();\n\n            if (this._type === 'wheel' && zoomSnap > 0) {\n                const currentSnapped = evaluateZoomSnap(tr.zoom, zoomSnap);\n                this._targetZoom = evaluateZoomSnap(target, zoomSnap, target - currentSnapped);\n            } else {\n                this._targetZoom = target;\n            }\n\n            // if this is a mouse wheel, refresh the starting zoom and easing\n            // function we're using to smooth out the zooming between wheel\n            // events\n            if (this._type === 'wheel') {\n                this._startZoom = tr.zoom;\n                this._easing = this._smoothOutEasing(200);\n            }\n\n            this._delta = 0;\n        }\n\n        const targetZoom = typeof this._targetZoom !== 'number' ? tr.zoom : this._targetZoom;\n        const startZoom = this._startZoom;\n        const easing = this._easing;\n\n        let finished = false;\n        let zoom;\n\n        if (this._type === 'wheel' && startZoom && easing) {\n            const lastWheelEventTimeDiff = now() - this._lastWheelEventTime;\n\n            const t = Math.min((lastWheelEventTimeDiff + wheelEventTimeDiffAdjustment) / 200, 1);\n\n            const k = easing(t);\n            zoom = interpolates.number(startZoom, targetZoom, k);\n            if (t < 1) {\n                this._needsRerender = true;\n            } else {\n                finished = true;\n            }\n        } else {\n            zoom = targetZoom;\n            finished = true;\n        }\n\n        this._active = true;\n\n        if (finished) {\n            this._active = false;\n            this._finishTimeout = setTimeout(() => {\n                this._zooming = false;\n                this._triggerRenderFrame();\n                delete this._targetZoom;\n                delete this._lastExpectedZoom;\n                delete this._finishTimeout;\n            }, 200);\n        }\n\n        this._lastExpectedZoom = zoom;\n\n        return {\n            noInertia: true,\n            needsRenderFrame: !finished,\n            zoomDelta: zoom - tr.zoom,\n            around: this._aroundPoint,\n            originalEvent: this._lastWheelEvent\n        };\n    }\n\n    _smoothOutEasing(duration: number): (t: number) => number {\n        let easing = defaultEasing;\n\n        if (this._prevEase) {\n            const currentEase = this._prevEase;\n            const t = (now() - currentEase.start) / currentEase.duration;\n            const speed = currentEase.easing(t + 0.01) - currentEase.easing(t);\n\n            // Quick hack to make new bezier that is continuous with last\n            const x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01;\n            const y = Math.sqrt(0.27 * 0.27 - x * x);\n\n            easing = bezier(x, y, 0.25, 1);\n        }\n\n        this._prevEase = {\n            start: now(),\n            duration,\n            easing\n        };\n\n        return easing;\n    }\n\n    reset(): void {\n        this._active = false;\n        this._zooming = false;\n        delete this._targetZoom;\n        delete this._lastExpectedZoom;\n        if (this._finishTimeout) {\n            clearTimeout(this._finishTimeout);\n            delete this._finishTimeout;\n        }\n    }\n}\n","import type {ClickZoomHandler} from '../click_zoom.ts';\nimport type {TapZoomHandler} from './../tap_zoom.ts';\n\n/**\n * The `DoubleClickZoomHandler` allows the user to zoom the map at a point by\n * double clicking or double tapping.\n *\n * @group Handlers\n */\nexport class DoubleClickZoomHandler {\n\n    _clickZoom: ClickZoomHandler;\n    _tapZoom: TapZoomHandler;\n\n    /** @internal */\n    constructor(clickZoom: ClickZoomHandler, TapZoom: TapZoomHandler) {\n        this._clickZoom = clickZoom;\n        this._tapZoom = TapZoom;\n    }\n\n    /**\n     * Enables the \"double click to zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.doubleClickZoom.enable();\n     * ```\n     */\n    enable(): void {\n        this._clickZoom.enable();\n        this._tapZoom.enable();\n    }\n\n    /**\n     * Disables the \"double click to zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.doubleClickZoom.disable();\n     * ```\n     */\n    disable(): void {\n        this._clickZoom.disable();\n        this._tapZoom.disable();\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"double click to zoom\" interaction is enabled.\n     *\n     * @returns `true` if the \"double click to zoom\" interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return this._clickZoom.isEnabled() && this._tapZoom.isEnabled();\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"double click to zoom\" interaction is active, i.e. currently being used.\n     *\n     * @returns `true` if the \"double click to zoom\" interaction is active.\n     */\n    isActive(): boolean {\n        return this._clickZoom.isActive() || this._tapZoom.isActive();\n    }\n}\n","import {evaluateZoomSnap} from '../../util/util.ts';\nimport type Point from '@mapbox/point-geometry';\nimport type {Map} from '../map.ts';\nimport type {TransformProvider} from './transform-provider.ts';\nimport type {Handler} from '../handler_manager.ts';\n\n/**\n * The `ClickZoomHandler` allows the user to zoom the map at a point by double clicking\n * It is used by other handlers\n */\nexport class ClickZoomHandler implements Handler {\n\n    _tr: TransformProvider;\n    _enabled: boolean;\n    _active: boolean;\n\n    /** @internal */\n    constructor(map: Map, transformProvider: TransformProvider) {\n        this._tr = transformProvider;\n        this.reset();\n    }\n\n    reset(): void {\n        this._active = false;\n    }\n\n    dblclick(e: MouseEvent, point: Point): {cameraAnimation: (map: Map) => void} {\n        e.preventDefault();\n        return {\n            cameraAnimation: (map: Map): void => {\n                map.easeTo({\n                    duration: 300,\n                    zoom: evaluateZoomSnap(this._tr.zoom + (e.shiftKey ? -1 : 1), map.getZoomSnap()),\n                    around: this._tr.unproject(point)\n                }, {originalEvent: e});\n            }\n        };\n    }\n\n    enable(): void {\n        this._enabled = true;\n    }\n\n    disable(): void {\n        this._enabled = false;\n        this.reset();\n    }\n\n    isEnabled(): boolean {\n        return this._enabled;\n    }\n\n    isActive(): boolean {\n        return this._active;\n    }\n}\n","import {type Handler} from '../handler_manager.ts';\nimport {TapRecognizer, MAX_TAP_INTERVAL, MAX_DIST} from './tap_recognizer.ts';\nimport type Point from '@mapbox/point-geometry';\n\nconst defaultZoomRate = 1;\n\n/**\n * A `TapDragZoomHandler` allows the user to zoom the map at a point by double tapping. It also allows the user pan the map by dragging.\n */\nexport class TapDragZoomHandler implements Handler {\n\n    _enabled: boolean;\n    _active: boolean;\n    _swipePoint: Point;\n    _swipeTouch: number;\n    _tapTime: number;\n    _tapPoint: Point;\n    _tap: TapRecognizer;\n    _zoomRate: number;\n\n    constructor() {\n\n        this._tap = new TapRecognizer({\n            numTouches: 1,\n            numTaps: 1\n        });\n        this._zoomRate = defaultZoomRate;\n\n        this.reset();\n    }\n\n    setZoomRate(zoomRate?: number): void {\n        this._zoomRate = zoomRate ?? defaultZoomRate;\n    }\n\n    reset(): void {\n        this._active = false;\n        delete this._swipePoint;\n        delete this._swipeTouch;\n        delete this._tapTime;\n        delete this._tapPoint;\n        this._tap.reset();\n    }\n\n    touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        if (this._swipePoint) return;\n\n        if (!this._tapTime) {\n            this._tap.touchstart(e, points, mapTouches);\n        } else {\n            const swipePoint = points[0];\n\n            const soonEnough = e.timeStamp - this._tapTime < MAX_TAP_INTERVAL;\n            const closeEnough =  this._tapPoint.dist(swipePoint) < MAX_DIST;\n\n            if (!soonEnough || !closeEnough) {\n                this.reset();\n            } else if (mapTouches.length > 0) {\n                this._swipePoint = swipePoint;\n                this._swipeTouch = mapTouches[0].identifier;\n            }\n        }\n    }\n\n    touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): {zoomDelta: number} | void {\n        if (!this._tapTime) {\n            this._tap.touchmove(e, points, mapTouches);\n        } else if (this._swipePoint) {\n            if (mapTouches[0].identifier !== this._swipeTouch) {\n                return;\n            }\n\n            const newSwipePoint = points[0];\n            const dist = newSwipePoint.y - this._swipePoint.y;\n            this._swipePoint = newSwipePoint;\n\n            e.preventDefault();\n            this._active = true;\n\n            return {\n                zoomDelta: dist / 128 * this._zoomRate\n            };\n        }\n    }\n\n    touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void {\n        if (!this._tapTime) {\n            const point = this._tap.touchend(e, points, mapTouches);\n            if (point) {\n                this._tapTime = e.timeStamp;\n                this._tapPoint = point;\n            }\n        } else if (this._swipePoint) {\n            if (mapTouches.length === 0) {\n                this.reset();\n            }\n        }\n    }\n\n    touchcancel(): void {\n        this.reset();\n    }\n\n    enable(): void {\n        this._enabled = true;\n    }\n\n    disable(): void {\n        this._enabled = false;\n        this.reset();\n    }\n\n    isEnabled(): boolean {\n        return this._enabled;\n    }\n\n    isActive(): boolean {\n        return this._active;\n    }\n}\n","import type {MousePanHandler} from '../mouse.ts';\nimport type {TouchPanHandler} from './../touch_pan.ts';\n\n/**\n * A {@link DragPanHandler} options object\n */\nexport type DragPanOptions = {\n    /**\n     * factor used to scale the drag velocity\n     * @defaultValue 0\n     */\n    linearity?: number;\n    /**\n     * easing function applied to `map.panTo` when applying the drag.\n     * @param t - the easing function\n     * @defaultValue bezier(0, 0, 0.3, 1)\n     */\n    easing?: (t: number) => number;\n    /**\n     * the maximum value of the drag velocity.\n     * @defaultValue 1400\n     */\n    deceleration?: number;\n    /**\n     * the rate at which the speed reduces after the pan ends.\n     * @defaultValue 2500\n     */\n    maxSpeed?: number;\n};\n\n/**\n * The `DragPanHandler` allows the user to pan the map by clicking and dragging\n * the cursor.\n *\n * @group Handlers\n */\nexport class DragPanHandler {\n\n    _el: HTMLElement;\n    _mousePan: MousePanHandler;\n    _touchPan: TouchPanHandler;\n    _inertiaOptions: DragPanOptions | boolean;\n\n    /** @internal */\n    constructor(el: HTMLElement, mousePan: MousePanHandler, touchPan: TouchPanHandler) {\n        this._el = el;\n        this._mousePan = mousePan;\n        this._touchPan = touchPan;\n    }\n\n    /**\n     * Enables the \"drag to pan\" interaction.\n     *\n     * @param options - Options object\n     * @example\n     * ```ts\n     *   map.dragPan.enable();\n     *   map.dragPan.enable({\n     *      linearity: 0.3,\n     *      easing: bezier(0, 0, 0.3, 1),\n     *      maxSpeed: 1400,\n     *      deceleration: 2500,\n     *   });\n     * ```\n     */\n    enable(options?: DragPanOptions | boolean): void {\n        this._inertiaOptions = options || {};\n        this._mousePan.enable();\n        this._touchPan.enable();\n        this._el.classList.add('maplibregl-touch-drag-pan');\n    }\n\n    /**\n     * Disables the \"drag to pan\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.dragPan.disable();\n     * ```\n     */\n    disable(): void {\n        this._mousePan.disable();\n        this._touchPan.disable();\n        this._el.classList.remove('maplibregl-touch-drag-pan');\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"drag to pan\" interaction is enabled.\n     *\n     * @returns `true` if the \"drag to pan\" interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return this._mousePan.isEnabled() && this._touchPan.isEnabled();\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"drag to pan\" interaction is active, i.e. currently being used.\n     *\n     * @returns `true` if the \"drag to pan\" interaction is active.\n     */\n    isActive(): boolean {\n        return this._mousePan.isActive() || this._touchPan.isActive();\n    }\n}\n","import type {MousePitchHandler, MouseRollHandler, MouseRotateHandler} from '../mouse.ts';\n\n/**\n * Options object for `DragRotateHandler`.\n */\nexport type DragRotateHandlerOptions = {\n    /**\n     * Control the map pitch in addition to the bearing\n     * @defaultValue true\n     */\n    pitchWithRotate: boolean;\n    /**\n     * Control the map roll in addition to the bearing\n     * @defaultValue false\n     */\n    rollEnabled: boolean;\n};\n\n/**\n * The `DragRotateHandler` allows the user to rotate the map by clicking and\n * dragging the cursor while holding the right mouse button or `ctrl` key.\n *\n * @group Handlers\n */\nexport class DragRotateHandler {\n\n    _mouseRotate: MouseRotateHandler;\n    _mousePitch: MousePitchHandler;\n    _mouseRoll: MouseRollHandler;\n    _pitchWithRotate: boolean;\n    _rollEnabled: boolean;\n\n    /** @internal */\n    constructor(options: DragRotateHandlerOptions, mouseRotate: MouseRotateHandler, mousePitch: MousePitchHandler, mouseRoll: MouseRollHandler) {\n        this._pitchWithRotate = options.pitchWithRotate;\n        this._rollEnabled = options.rollEnabled;\n        this._mouseRotate = mouseRotate;\n        this._mousePitch = mousePitch;\n        this._mouseRoll = mouseRoll;\n    }\n\n    /**\n     * Enables the \"drag to rotate\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.dragRotate.enable();\n     * ```\n     */\n    enable(): void {\n        this._mouseRotate.enable();\n        if (this._pitchWithRotate) this._mousePitch.enable();\n        if (this._rollEnabled) this._mouseRoll.enable();\n    }\n\n    /**\n     * Disables the \"drag to rotate\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.dragRotate.disable();\n     * ```\n     */\n    disable(): void {\n        this._mouseRotate.disable();\n        this._mousePitch.disable();\n        this._mouseRoll.disable();\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"drag to rotate\" interaction is enabled.\n     *\n     * @returns `true` if the \"drag to rotate\" interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled()) && (!this._rollEnabled || this._mouseRoll.isEnabled());\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"drag to rotate\" interaction is active, i.e. currently being used.\n     *\n     * @returns `true` if the \"drag to rotate\" interaction is active.\n     */\n    isActive(): boolean {\n        return this._mouseRotate.isActive() || this._mousePitch.isActive() || this._mouseRoll.isActive();\n    }\n}\n","import type {TwoFingersTouchZoomHandler, TwoFingersTouchRotateHandler, AroundCenterOptions} from '../two_fingers_touch.ts';\nimport type {TapDragZoomHandler} from '../tap_drag_zoom.ts';\n\n/**\n * The `TwoFingersTouchZoomRotateHandler` allows the user to zoom and rotate the map by\n * pinching on a touchscreen.\n *\n * They can zoom with one finger by double tapping and dragging. On the second tap,\n * hold the finger down and drag up or down to zoom in or out.\n *\n * @group Handlers\n */\nexport class TwoFingersTouchZoomRotateHandler {\n\n    _el: HTMLElement;\n    _touchZoom: TwoFingersTouchZoomHandler;\n    _touchRotate: TwoFingersTouchRotateHandler;\n    _tapDragZoom: TapDragZoomHandler;\n    _rotationDisabled: boolean;\n    _enabled: boolean;\n\n    /** @internal */\n    constructor(el: HTMLElement, touchZoom: TwoFingersTouchZoomHandler, touchRotate: TwoFingersTouchRotateHandler, tapDragZoom: TapDragZoomHandler) {\n        this._el = el;\n        this._touchZoom = touchZoom;\n        this._touchRotate = touchRotate;\n        this._tapDragZoom = tapDragZoom;\n        this._rotationDisabled = false;\n        this._enabled = true;\n    }\n\n    /**\n     * Enables the \"pinch to rotate and zoom\" interaction.\n     *\n     * @param options - Options object.\n     *\n     * @example\n     * ```ts\n     * map.touchZoomRotate.enable();\n     * map.touchZoomRotate.enable({ around: 'center' });\n     * ```\n     */\n    enable(options?: AroundCenterOptions | boolean | null): void {\n        this._touchZoom.enable(options);\n        if (!this._rotationDisabled) this._touchRotate.enable(options);\n        this._tapDragZoom.enable();\n        this._el.classList.add('maplibregl-touch-zoom-rotate');\n    }\n\n    /**\n     * Disables the \"pinch to rotate and zoom\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.touchZoomRotate.disable();\n     * ```\n     */\n    disable(): void {\n        this._touchZoom.disable();\n        this._touchRotate.disable();\n        this._tapDragZoom.disable();\n        this._el.classList.remove('maplibregl-touch-zoom-rotate');\n    }\n\n    /**\n     * Returns a Boolean indicating whether the \"pinch to rotate and zoom\" interaction is enabled.\n     *\n     * @returns `true` if the \"pinch to rotate and zoom\" interaction is enabled.\n     */\n    isEnabled(): boolean {\n        return this._touchZoom.isEnabled() &&\n            (this._rotationDisabled || this._touchRotate.isEnabled()) &&\n            this._tapDragZoom.isEnabled();\n    }\n\n    /**\n     * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.\n     *\n     * @returns `true` if the handler is active, `false` otherwise\n     */\n    isActive(): boolean {\n        return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();\n    }\n\n    /**\n     * Sets the zoom rate of touch gestures.\n     * @param zoomRate - 1 The rate used to scale touch movement to a zoom value. Set to `undefined` to restore the default.\n     * @example\n     * Slow down touch zoom\n     * ```ts\n     * map.touchZoomRotate.setZoomRate(0.5);\n     * ```\n     */\n    setZoomRate(zoomRate?: number): void {\n        this._touchZoom.setZoomRate(zoomRate);\n        this._tapDragZoom.setZoomRate(zoomRate);\n    }\n\n    /**\n     * Sets the threshold before a pinch gesture starts zooming.\n     * @param zoomThreshold - 0.1 The minimum zoom delta before the pinch gesture becomes active. Set to `undefined` to restore the default.\n     * @example\n     * Make pinch zoom less sensitive\n     * ```ts\n     * map.touchZoomRotate.setZoomThreshold(0.3);\n     * ```\n     */\n    setZoomThreshold(zoomThreshold?: number): void {\n        this._touchZoom.setZoomThreshold(zoomThreshold);\n    }\n\n    /**\n     * Disables the \"pinch to rotate\" interaction, leaving the \"pinch to zoom\"\n     * interaction enabled.\n     *\n     * @example\n     * ```ts\n     * map.touchZoomRotate.disableRotation();\n     * ```\n     */\n    disableRotation(): void {\n        this._rotationDisabled = true;\n        this._touchRotate.disable();\n    }\n\n    /**\n     * Enables the \"pinch to rotate\" interaction.\n     *\n     * @example\n     * ```ts\n     * map.touchZoomRotate.enable();\n     * map.touchZoomRotate.enableRotation();\n     * ```\n     */\n    enableRotation(): void {\n        this._rotationDisabled = false;\n        if (this._touchZoom.isEnabled()) this._touchRotate.enable();\n    }\n}\n","import {DOM} from '../../util/dom.ts';\nimport {MapLibreEvent} from '../events.ts';\n\nimport {type Event} from '../../util/evented.ts';\nimport {type Handler} from '../handler_manager.ts';\n\nimport type {Map} from '../map.ts';\n\n/**\n * The {@link CooperativeGesturesHandler} options object for the gesture settings\n */\nexport type GestureOptions = boolean;\n\n/**\n * A `CooperativeGestureHandler` is a control that adds cooperative gesture info when user tries to zoom in/out.\n *\n * When the CooperativeGestureHandler blocks a gesture, it will emit a `cooperativegestureprevented` event.\n *\n * @group Handlers\n *\n * @example\n * ```ts\n * const map = new Map({\n *   cooperativeGestures: true\n * });\n * ```\n * @see [Example: cooperative gestures](https://maplibre.org/maplibre-gl-js/docs/examples/cooperative-gestures/)\n **/\nexport class CooperativeGesturesHandler implements Handler {\n    _options: GestureOptions;\n    _map: Map;\n    _container: HTMLElement;\n    /**\n     * This is the key that will allow to bypass the cooperative gesture protection\n     */\n    _bypassKey: 'metaKey' | 'ctrlKey' = navigator.userAgent.includes('Mac') ? 'metaKey' : 'ctrlKey';\n    _enabled: boolean;\n\n    constructor(map: Map, options: GestureOptions) {\n        this._map = map;\n        this._options = options;\n        this._enabled = false;\n    }\n    isActive(): boolean {\n        return false;\n    }\n    reset(): void {}\n\n    _setupUI(): void {\n        if (this._container) return;\n        const mapCanvasContainer = this._map.getCanvasContainer();\n        // Add a cooperative gestures class (enable touch-action: pan-x pan-y;)\n        mapCanvasContainer.classList.add('maplibregl-cooperative-gestures');\n        this._container = DOM.create('div', 'maplibregl-cooperative-gesture-screen', mapCanvasContainer);\n        let desktopMessage = this._map._getUIString('CooperativeGesturesHandler.WindowsHelpText');\n        if (this._bypassKey === 'metaKey') {\n            desktopMessage = this._map._getUIString('CooperativeGesturesHandler.MacHelpText');\n        }\n        const mobileMessage = this._map._getUIString('CooperativeGesturesHandler.MobileHelpText');\n        // Create and append the desktop message div\n        const desktopDiv = document.createElement('div');\n        desktopDiv.className = 'maplibregl-desktop-message';\n        desktopDiv.textContent = desktopMessage;\n        this._container.appendChild(desktopDiv);\n        // Create and append the mobile message div\n        const mobileDiv = document.createElement('div');\n        mobileDiv.className = 'maplibregl-mobile-message';\n        mobileDiv.textContent = mobileMessage;\n        this._container.appendChild(mobileDiv);\n        // Remove cooperative gesture screen from the accessibility tree since screenreaders cannot interact with the map using gestures\n        this._container.setAttribute('aria-hidden', 'true');\n    }\n\n    _destroyUI(): void {\n        if (this._container) {\n            this._container.remove();\n            const mapCanvasContainer = this._map.getCanvasContainer();\n            mapCanvasContainer.classList.remove('maplibregl-cooperative-gestures');\n        }\n        delete this._container;\n    }\n\n    enable(): void {\n        this._setupUI();\n        this._enabled = true;\n    }\n\n    disable(): void {\n        this._enabled = false;\n        this._destroyUI();\n    }\n\n    isEnabled(): boolean {\n        return this._enabled;\n    }\n\n    isBypassed(event: MouseEvent | WheelEvent | PointerEvent): boolean {\n        return event[this._bypassKey];\n    }\n\n    notifyGestureBlocked(gestureType: 'wheel_zoom' | 'touch_pan', originalEvent: Event): void {\n        if (!this._enabled) return;\n\n        // notify subscribers that a cooperative gesture was prevented\n        this._map.fire(new MapLibreEvent('cooperativegestureprevented', {gestureType, originalEvent}));\n\n        // Alert user how to scroll/pan\n        this._container.classList.add('maplibregl-show');\n        setTimeout(() => {\n            this._container.classList.remove('maplibregl-show');\n        }, 100);\n    }\n}\n","import type {Camera} from '../camera.ts';\nimport type {PointLike} from '../camera.ts';\nimport type {IReadonlyTransform} from '../../geo/transform_interface.ts';\nimport Point from '@mapbox/point-geometry';\nimport {type LngLat} from '../../geo/lng_lat.ts';\n\n/**\n * @internal\n * Shared utilities for the Handler classes to access the correct camera state.\n * If Camera.transformCameraUpdate is specified or terrain is enabled, the\n * \"desired state\" of camera may differ from the state used for rendering. The\n * handlers need the \"desired state\" to track accumulated changes.\n */\nexport class TransformProvider {\n    _camera: Camera;\n\n    constructor(camera: Camera) {\n        this._camera = camera;\n    }\n\n    get transform(): IReadonlyTransform {\n        return this._camera._requestedCameraState || this._camera.transform;\n    }\n\n    get center(): {lng: number; lat: number} {\n        return {lng: this.transform.center.lng, lat: this.transform.center.lat};\n    }\n\n    get zoom(): number {\n        return this.transform.zoom;\n    }\n\n    get pitch(): number {\n        return this.transform.pitch;\n    }\n\n    get bearing(): number {\n        return this.transform.bearing;\n    }\n\n    unproject(point: PointLike): LngLat {\n        return this.transform.screenPointToLocation(Point.convert(point), this._camera.terrain);\n    }\n}\n","import {Event} from '../util/evented.ts';\nimport {MapMovementEvent} from './events.ts';\nimport {DOM} from '../util/dom.ts';\nimport {HandlerInertia} from './handler_inertia.ts';\nimport {MapEventHandler, BlockableMapEventHandler} from './handler/map_event.ts';\nimport {BoxZoomHandler} from './handler/box_zoom.ts';\nimport {TapZoomHandler} from './handler/tap_zoom.ts';\nimport {generateMouseRotationHandler, generateMousePitchHandler, generateMousePanHandler, generateMouseRollHandler} from './handler/mouse.ts';\nimport {TouchPanHandler} from './handler/touch_pan.ts';\nimport {TwoFingersTouchZoomHandler, TwoFingersTouchRotateHandler, TwoFingersTouchPitchHandler} from './handler/two_fingers_touch.ts';\nimport {KeyboardHandler} from './handler/keyboard.ts';\nimport {ScrollZoomHandler} from './handler/scroll_zoom.ts';\nimport {DoubleClickZoomHandler} from './handler/shim/dblclick_zoom.ts';\nimport {ClickZoomHandler} from './handler/click_zoom.ts';\nimport {TapDragZoomHandler} from './handler/tap_drag_zoom.ts';\nimport {DragPanHandler} from './handler/shim/drag_pan.ts';\nimport {DragRotateHandler} from './handler/shim/drag_rotate.ts';\nimport {TwoFingersTouchZoomRotateHandler} from './handler/shim/two_fingers_touch.ts';\nimport {CooperativeGesturesHandler} from './handler/cooperative_gestures.ts';\nimport {TransformProvider} from './handler/transform-provider.ts';\nimport {extend, isPointableEvent, isTouchableEvent, isTouchableOrPointableType} from '../util/util.ts';\nimport {browser} from '../util/browser.ts';\nimport Point from '@mapbox/point-geometry';\n\nimport type {Map, CompleteMapOptions} from './map.ts';\nimport type {Camera} from './camera.ts';\nimport type {MapControlsDeltas} from '../geo/projection/camera_helper.ts';\nimport type {LngLat} from '../geo/lng_lat.ts';\nimport type {ITransform} from '../geo/transform_interface.ts';\nimport type {Terrain} from '../render/terrain.ts';\n\nconst isMoving = (p: EventsInProgress) => p.zoom || p.drag || p.roll || p.pitch || p.rotate;\n\nclass RenderFrameEvent extends Event {\n    type: 'renderFrame';\n    timeStamp: number;\n}\n\n/**\n * Handlers interpret dom events and return camera changes that should be\n * applied to the map (`HandlerResult`s). The camera changes are all deltas.\n * The handler itself should have no knowledge of the map's current state.\n * This makes it easier to merge multiple results and keeps handlers simpler.\n * For example, if there is a mousedown and mousemove, the mousePan handler\n * would return a `panDelta` on the mousemove.\n */\nexport interface Handler {\n    enable(): void;\n    disable(): void;\n    isEnabled(): boolean;\n    /**\n     * This is used to indicate if the handler is currently active or not.\n     * In case a handler is active, it will block other handlers from getting the relevant events.\n     * There is an allow list of handlers that can be active at the same time, which is configured when adding a handler.\n     */\n    isActive(): boolean;\n    /**\n     * `reset` can be called by the manager at any time and must reset everything to it's original state\n     */\n    reset(): void;\n    // Handlers can optionally implement these methods.\n    // They are called with dom events whenever those dom evens are received.\n    readonly touchstart?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => HandlerResult | void;\n    readonly touchmove?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => HandlerResult | void;\n    readonly touchmoveWindow?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => HandlerResult | void;\n    readonly touchend?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => HandlerResult | void;\n    readonly touchcancel?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => HandlerResult | void;\n    readonly mousedown?: (e: MouseEvent, point: Point) => HandlerResult | void;\n    readonly mousemove?: (e: MouseEvent, point: Point) => HandlerResult | void;\n    readonly mousemoveWindow?: (e: MouseEvent, point: Point) => HandlerResult | void;\n    readonly mouseup?: (e: MouseEvent, point: Point) => HandlerResult | void;\n    readonly mouseupWindow?: (e: MouseEvent, point: Point) => HandlerResult | void;\n    readonly dblclick?: (e: MouseEvent, point: Point) => HandlerResult | void;\n    readonly contextmenu?: (e: MouseEvent) => HandlerResult | void;\n    readonly wheel?: (e: WheelEvent, point: Point) => HandlerResult | void;\n    readonly keydown?: (e: KeyboardEvent) => HandlerResult | void;\n    readonly keyup?: (e: KeyboardEvent) => HandlerResult | void;\n    /**\n     * `renderFrame` is the only non-dom event. It is called during render\n     * frames and can be used to smooth camera changes (see scroll handler).\n     */\n    readonly renderFrame?: () => HandlerResult | void;\n}\n\n/**\n * All handler methods that are called with events can optionally return a `HandlerResult`.\n */\nexport type HandlerResult = {\n    panDelta?: Point;\n    zoomDelta?: number;\n    bearingDelta?: number;\n    pitchDelta?: number;\n    rollDelta?: number;\n    /**\n     * the point to not move when changing the camera\n     */\n    around?: Point | null;\n    /**\n     * same as above, except for pinch actions, which are given higher priority\n     */\n    pinchAround?: Point | null;\n    /**\n     * A method that can fire a one-off easing by directly changing the map's camera.\n     */\n    cameraAnimation?: (map: Map) => void;\n    /**\n     * The last three properties are needed by only one handler: scrollzoom.\n     * The DOM event to be used as the `originalEvent` on any camera change events.\n     */\n    originalEvent?: Event;\n    /**\n     * Makes the manager trigger a frame, allowing the handler to return multiple results over time (see scrollzoom).\n     */\n    needsRenderFrame?: boolean;\n    /**\n     * The camera changes won't get recorded for inertial zooming.\n     */\n    noInertia?: boolean;\n};\n\nexport type EventInProgress = {\n    handlerName: string;\n    originalEvent: Event;\n};\n\nexport type EventsInProgress = {\n    zoom?: EventInProgress;\n    roll?: EventInProgress;\n    pitch?: EventInProgress;\n    rotate?: EventInProgress;\n    drag?: EventInProgress;\n};\n\nexport type MapControlsScenarioOptions = {\n    terrain?: Terrain | null;\n    tr: ITransform;\n    deltasForHelper: MapControlsDeltas;\n    preZoomAroundLoc: LngLat;\n    combinedEventsInProgress: EventsInProgress;\n    panDelta?: Point;\n};\n\nfunction hasChange(result: HandlerResult) {\n    return result.panDelta?.mag() || result.zoomDelta || result.bearingDelta || result.pitchDelta || result.rollDelta;\n}\n\nexport class HandlerManager {\n    _map: Map;\n    _camera: Camera;\n    _transformProvider: TransformProvider;\n    _el: HTMLElement;\n    _handlers: Array<{\n        handlerName: string;\n        handler: Handler;\n        allowed: string[];\n    }>;\n    _eventsInProgress: EventsInProgress;\n    _frameId: number;\n    _inertia: HandlerInertia;\n    _bearingSnap: number;\n    _handlersById: {[x: string]: Handler};\n    _updatingCamera: boolean;\n    _changes: Array<[HandlerResult, EventsInProgress, {[handlerName: string]: Event}]>;\n    _terrainMovement: boolean;\n    _zoom: {handlerName: string};\n    _previousActiveHandlers: {[x: string]: Handler};\n    _listeners: Array<[Window | Document | HTMLElement, string, {\n        passive?: boolean;\n        capture?: boolean;\n    } | undefined]>;\n\n    /**\n     * @internal\n     * The document that contains the map container element, for cross-window support.\n     */\n    get _ownerDocument(): Document {\n        return this._el?.ownerDocument || document;\n    }\n\n    /**\n     * @internal\n     * The window that contains the map container element, for cross-window support.\n     */\n    get _ownerWindow(): Window {\n        return this._el?.ownerDocument?.defaultView || window;\n    }\n\n    constructor(map: Map, camera: Camera, options: CompleteMapOptions) {\n        this._map = map;\n        this._camera = camera;\n        this._transformProvider = new TransformProvider(this._camera);\n        this._el = this._map.getCanvasContainer();\n        this._handlers = [];\n        this._handlersById = {};\n        this._changes = [];\n\n        this._inertia = new HandlerInertia(map);\n        this._bearingSnap = options.bearingSnap;\n        this._previousActiveHandlers = {};\n\n        // Track whether map is currently moving, to compute start/move/end events\n        this._eventsInProgress = {};\n\n        this._addDefaultHandlers(options);\n\n        const el = this._el;\n\n        this._listeners = [\n            // This needs to be `passive: true` so that a double tap fires two\n            // pairs of touchstart/end events in iOS Safari 13. If this is set to\n            // `passive: false` then the second pair of events is only fired if\n            // preventDefault() is called on the first touchstart. Calling preventDefault()\n            // undesirably prevents click events.\n            [el, 'touchstart', {passive: true}],\n            // This needs to be `passive: false` so that scrolls and pinches can be\n            // prevented in browsers that don't support `touch-actions: none`, for example iOS Safari 12.\n            [el, 'touchmove', {passive: false}],\n            [el, 'touchend', undefined],\n            [el, 'touchcancel', undefined],\n\n            [el, 'mousedown', undefined],\n            [el, 'mousemove', undefined],\n            [el, 'mouseup', undefined],\n\n            // Bind window-level event listeners for move and up/end events. In the absence of\n            // the pointer capture API, which is not supported by all necessary platforms,\n            // window-level event listeners give us the best shot at capturing events that\n            // fall outside the map canvas element. Use `{capture: true}` for the move event\n            // to prevent map move events from being fired during a drag.\n            [this._ownerDocument, 'mousemove', {capture: true}],\n            [this._ownerDocument, 'mouseup', undefined],\n\n            [el, 'mouseover', undefined],\n            [el, 'mouseout', undefined],\n            [el, 'dblclick', undefined],\n            [el, 'click', undefined],\n\n            [el, 'keydown', {capture: false}],\n            [el, 'keyup', undefined],\n\n            [el, 'wheel', {passive: false}],\n            [el, 'contextmenu', undefined],\n\n            [this._ownerWindow, 'blur', undefined]\n        ];\n\n        for (const [target, type, listenerOptions] of this._listeners) {\n            target.addEventListener(type, target === this._ownerDocument ? this.handleWindowEvent : this.handleEvent, listenerOptions);\n        }\n    }\n\n    destroy(): void {\n        for (const [target, type, listenerOptions] of this._listeners) {\n            target.removeEventListener(type, target === this._ownerDocument ? this.handleWindowEvent : this.handleEvent, listenerOptions);\n        }\n    }\n\n    _addDefaultHandlers(options: CompleteMapOptions): void {\n        const map = this._map;\n        const el = map.getCanvasContainer();\n        this._add('mapEvent', new MapEventHandler(map, options));\n\n        const boxZoom = map.boxZoom = new BoxZoomHandler(map, options, this._transformProvider);\n        this._add('boxZoom', boxZoom);\n        if (options.interactive && options.boxZoom) {\n            boxZoom.enable();\n        }\n\n        const cooperativeGestures = map.cooperativeGestures = new CooperativeGesturesHandler(map, options.cooperativeGestures);\n        this._add('cooperativeGestures', cooperativeGestures);\n        if (options.cooperativeGestures) {\n            cooperativeGestures.enable();\n        }\n\n        const tapZoom = new TapZoomHandler(map, this._transformProvider);\n        const clickZoom = new ClickZoomHandler(map, this._transformProvider);\n        map.doubleClickZoom = new DoubleClickZoomHandler(clickZoom, tapZoom);\n        this._add('tapZoom', tapZoom);\n        this._add('clickZoom', clickZoom);\n        if (options.interactive && options.doubleClickZoom) {\n            map.doubleClickZoom.enable();\n        }\n\n        const tapDragZoom = new TapDragZoomHandler();\n        this._add('tapDragZoom', tapDragZoom);\n\n        const touchPitch = map.touchPitch = new TwoFingersTouchPitchHandler(map);\n        this._add('touchPitch', touchPitch);\n        if (options.interactive && options.touchPitch) {\n            map.touchPitch.enable(options.touchPitch);\n        }\n        const getCenter = () => map.project(map.getCenter());\n        const mouseRotate = generateMouseRotationHandler(options, getCenter);\n        const mousePitch = generateMousePitchHandler(options);\n        const mouseRoll = generateMouseRollHandler(options, getCenter);\n        map.dragRotate = new DragRotateHandler(options, mouseRotate, mousePitch, mouseRoll);\n        this._add('mouseRotate', mouseRotate, ['mousePitch']);\n        this._add('mousePitch', mousePitch, ['mouseRotate', 'mouseRoll']);\n        this._add('mouseRoll', mouseRoll, ['mousePitch']);\n        if (options.interactive && options.dragRotate) {\n            map.dragRotate.enable();\n        }\n\n        const mousePan = generateMousePanHandler(options);\n        const touchPan = new TouchPanHandler(options, map);\n        map.dragPan = new DragPanHandler(el, mousePan, touchPan);\n        this._add('mousePan', mousePan);\n        this._add('touchPan', touchPan, ['touchZoom', 'touchRotate']);\n        if (options.interactive && options.dragPan) {\n            map.dragPan.enable(options.dragPan);\n        }\n\n        const touchRotate = new TwoFingersTouchRotateHandler();\n        const touchZoom = new TwoFingersTouchZoomHandler();\n        map.touchZoomRotate = new TwoFingersTouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom);\n        this._add('touchRotate', touchRotate, ['touchPan', 'touchZoom']);\n        this._add('touchZoom', touchZoom, ['touchPan', 'touchRotate']);\n        if (options.interactive && options.touchZoomRotate) {\n            map.touchZoomRotate.enable(options.touchZoomRotate);\n        }\n\n        this._add('blockableMapEvent', new BlockableMapEventHandler(map));\n\n        const scrollZoom = map.scrollZoom = new ScrollZoomHandler(map, () => this._triggerRenderFrame(), this._transformProvider);\n        this._add('scrollZoom', scrollZoom, ['mousePan']);\n        if (options.interactive && options.scrollZoom) {\n            map.scrollZoom.enable(options.scrollZoom);\n        }\n\n        const keyboard = map.keyboard = new KeyboardHandler(map, this._transformProvider);\n        this._add('keyboard', keyboard);\n        if (options.interactive && options.keyboard) {\n            map.keyboard.enable();\n        }\n    }\n\n    _add(handlerName: string, handler: Handler, allowed?: string[]): void {\n        this._handlers.push({handlerName, handler, allowed});\n        this._handlersById[handlerName] = handler;\n    }\n\n    stop(allowEndAnimation: boolean): void {\n        // do nothing if this method was triggered by a gesture update\n        if (this._updatingCamera) return;\n\n        for (const {handler} of this._handlers) {\n            handler.reset();\n        }\n        this._inertia.clear();\n        this._fireEvents({}, {}, allowEndAnimation);\n        this._changes = [];\n    }\n\n    isActive(): boolean {\n        for (const {handler} of this._handlers) {\n            if (handler.isActive()) return true;\n        }\n        return false;\n    }\n\n    isZooming(): boolean {\n        return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();\n    }\n    isRotating(): boolean {\n        return !!this._eventsInProgress.rotate;\n    }\n\n    isMoving(): boolean {\n        return Boolean(isMoving(this._eventsInProgress)) || this.isZooming();\n    }\n\n    _blockedByActive(activeHandlers: {[x: string]: Handler}, allowed: string[], myName: string): boolean {\n        for (const name in activeHandlers) {\n            if (name === myName) continue;\n            if (!allowed?.includes(name)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    handleWindowEvent = (e: Event): void => {\n        this.handleEvent(e, `${e.type}Window` as keyof Handler);\n    };\n\n    _getMapTouches(touches: TouchList): TouchList {\n        const mapTouches = [];\n        for (const t of touches) {\n            const target = (t.target as any as Node);\n            if (this._el.contains(target)) {\n                mapTouches.push(t);\n            }\n        }\n        return mapTouches as any as TouchList;\n    }\n\n    handleEvent = (e: Event, eventName?: keyof Handler): void => {\n\n        if (e.type === 'blur') {\n            this.stop(true);\n            return;\n        }\n\n        this._updatingCamera = true;\n\n        const inputEvent = e.type === 'renderFrame' ? undefined : e as UIEvent;\n\n        /*\n         * We don't call e.preventDefault() for any events by default.\n         * Handlers are responsible for calling it where necessary.\n         */\n\n        const mergedHandlerResult: HandlerResult = {needsRenderFrame: false};\n        const eventsInProgress: EventsInProgress = {};\n        const activeHandlers = {};\n\n        for (const {handlerName, handler, allowed} of this._handlers) {\n            if (!handler.isEnabled()) continue;\n\n            let data: HandlerResult;\n            if (this._blockedByActive(activeHandlers, allowed, handlerName)) {\n                handler.reset();\n\n            } else {\n                if (handler[eventName || e.type]) {\n                    if (isPointableEvent(e, eventName || e.type)){\n                        const point = DOM.mousePos(this._map.getCanvas(), e);\n                        data = handler[eventName || e.type](e, point);\n                    } else if (isTouchableEvent(e, eventName || e.type)) {\n                        const eventTouches = e.touches;\n                        const mapTouches = this._getMapTouches(eventTouches);\n                        const points = DOM.touchPos(this._map.getCanvas(), mapTouches);\n                        data = handler[eventName || e.type](e, points, mapTouches);\n                    } else if (!isTouchableOrPointableType(eventName || e.type)) {\n                        data = handler[eventName || e.type](e);\n                    }\n                    this.mergeHandlerResult(mergedHandlerResult, eventsInProgress, data, handlerName, inputEvent);\n                    if (data?.needsRenderFrame) {\n                        this._triggerRenderFrame();\n                    }\n                }\n            }\n\n            if (data || handler.isActive()) {\n                activeHandlers[handlerName] = handler;\n            }\n        }\n\n        const deactivatedHandlers: {[handlerName: string]: Event} = {};\n        for (const name in this._previousActiveHandlers) {\n            if (!activeHandlers[name]) {\n                deactivatedHandlers[name] = inputEvent;\n            }\n        }\n        this._previousActiveHandlers = activeHandlers;\n\n        if (Object.keys(deactivatedHandlers).length || hasChange(mergedHandlerResult)) {\n            this._changes.push([mergedHandlerResult, eventsInProgress, deactivatedHandlers]);\n            this._triggerRenderFrame();\n        }\n\n        if (Object.keys(activeHandlers).length || hasChange(mergedHandlerResult)) {\n            this._camera.stop(true);\n        }\n\n        this._updatingCamera = false;\n\n        const {cameraAnimation} = mergedHandlerResult;\n        if (cameraAnimation) {\n            this._inertia.clear();\n            this._fireEvents({}, {}, true);\n            this._changes = [];\n            cameraAnimation(this._map);\n        }\n    };\n\n    mergeHandlerResult(mergedHandlerResult: HandlerResult,\n        eventsInProgress: EventsInProgress,\n        handlerResult: HandlerResult,\n        name: string,\n        e?: UIEvent): void {\n        if (!handlerResult) return;\n\n        extend(mergedHandlerResult, handlerResult);\n\n        const eventData = {handlerName: name, originalEvent: handlerResult.originalEvent || e};\n\n        // track which handler changed which camera property\n        if (handlerResult.zoomDelta !== undefined) {\n            eventsInProgress.zoom = eventData;\n        }\n        if (handlerResult.panDelta !== undefined) {\n            eventsInProgress.drag = eventData;\n        }\n        if (handlerResult.rollDelta !== undefined) {\n            eventsInProgress.roll = eventData;\n        }\n        if (handlerResult.pitchDelta !== undefined) {\n            eventsInProgress.pitch = eventData;\n        }\n        if (handlerResult.bearingDelta !== undefined) {\n            eventsInProgress.rotate = eventData;\n        }\n\n    }\n\n    _applyChanges(): void {\n        const combined: HandlerResult = {};\n        const combinedEventsInProgress: EventsInProgress = {};\n        const combinedDeactivatedHandlers = {};\n\n        for (const [change, eventsInProgress, deactivatedHandlers] of this._changes) {\n\n            if (change.panDelta) combined.panDelta = (combined.panDelta || new Point(0, 0))._add(change.panDelta);\n            if (change.zoomDelta) combined.zoomDelta = (combined.zoomDelta || 0) + change.zoomDelta;\n            if (change.bearingDelta) combined.bearingDelta = (combined.bearingDelta || 0) + change.bearingDelta;\n            if (change.pitchDelta) combined.pitchDelta = (combined.pitchDelta || 0) + change.pitchDelta;\n            if (change.rollDelta) combined.rollDelta = (combined.rollDelta || 0) + change.rollDelta;\n            if (change.around !== undefined) combined.around = change.around;\n            if (change.pinchAround !== undefined) combined.pinchAround = change.pinchAround;\n            if (change.noInertia) combined.noInertia = change.noInertia;\n\n            extend(combinedEventsInProgress, eventsInProgress);\n            extend(combinedDeactivatedHandlers, deactivatedHandlers);\n        }\n\n        this._updateMapTransform(combined, combinedEventsInProgress, combinedDeactivatedHandlers);\n        this._changes = [];\n    }\n\n    _updateMapTransform(combinedResult: HandlerResult,\n        combinedEventsInProgress: EventsInProgress,\n        deactivatedHandlers: {[handlerName: string]: Event}): void {\n        const map = this._map;\n        const tr = this._camera.getTransformForUpdate();\n        const terrain = map.terrain;\n\n        if (!hasChange(combinedResult) && !(terrain && this._terrainMovement)) {\n            this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true); return;\n        }\n\n        // stop any ongoing camera animations (easeTo, flyTo)\n        this._camera.stop(true);\n\n        let {panDelta, zoomDelta, bearingDelta, pitchDelta, rollDelta, around, pinchAround} = combinedResult;\n\n        if (pinchAround !== undefined) {\n            around = pinchAround;\n        }\n\n        around ||= this._camera.transform.centerPoint;\n\n        if (terrain && !tr.isPointOnMapSurface(around)) {\n            around = tr.centerPoint;\n        }\n\n        const deltasForHelper: MapControlsDeltas = {\n            panDelta,\n            zoomDelta,\n            rollDelta,\n            pitchDelta,\n            bearingDelta,\n            around,\n        };\n\n        // Pre-zoom location under the mouse cursor is required for accurate mercator panning and zooming\n        if (this._camera.cameraHelper.useGlobeControls && !tr.isPointOnMapSurface(around)) {\n            around = tr.centerPoint;\n        }\n        // If we are rotating about the center point, avoid numerical issues near the horizon by using the transform's\n        // center directly, instead of computing it from the screen point\n        const preZoomAroundLoc = around.distSqr(tr.centerPoint) < 1.0e-2 ?\n            tr.center :\n            tr.screenPointToLocation(panDelta ? around.sub(panDelta) : around);\n\n        this._handleMapControls({\n            terrain,\n            tr,\n            deltasForHelper,\n            preZoomAroundLoc,\n            combinedEventsInProgress,\n            panDelta,\n        });\n\n        this._camera.applyUpdatedTransform(tr);\n\n        this._map._update();\n        if (!combinedResult.noInertia) this._inertia.record(combinedResult);\n        this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true);\n\n    }\n\n    _handleMapControls({\n        terrain,\n        tr,\n        deltasForHelper,\n        preZoomAroundLoc,\n        combinedEventsInProgress,\n        panDelta}: MapControlsScenarioOptions): void {\n\n        const cameraHelper = this._camera.cameraHelper;\n\n        cameraHelper.handleMapControlsRollPitchBearingZoom(deltasForHelper, tr);\n\n        if (!terrain) {\n            cameraHelper.handleMapControlsPan(deltasForHelper, tr, preZoomAroundLoc);\n            return;\n        }\n\n        if (cameraHelper.useGlobeControls) {\n            if (!this._terrainMovement && (combinedEventsInProgress.drag || combinedEventsInProgress.zoom)) {\n                this._terrainMovement = true;\n                this._camera.elevationFreeze = true;\n            }\n            cameraHelper.handleMapControlsPan(deltasForHelper, tr, preZoomAroundLoc);\n            return;\n        }\n\n        if (!this._terrainMovement && (combinedEventsInProgress.drag || combinedEventsInProgress.zoom)) {\n            this._terrainMovement = true;\n            this._camera.elevationFreeze = true;\n            cameraHelper.handleMapControlsPan(deltasForHelper, tr, preZoomAroundLoc);\n            return;\n        }\n\n        if (combinedEventsInProgress.drag && this._terrainMovement && panDelta) {\n            tr.setCenter(tr.screenPointToLocation(tr.centerPoint.sub(panDelta)));\n            return;\n        }\n\n        cameraHelper.handleMapControlsPan(deltasForHelper, tr, preZoomAroundLoc);\n    }\n\n    _fireEvents(newEventsInProgress: EventsInProgress, deactivatedHandlers: {[handlerName: string]: Event}, allowEndAnimation: boolean): void {\n\n        const wasMoving = isMoving(this._eventsInProgress);\n        const nowMoving = isMoving(newEventsInProgress);\n\n        const startEvents = {};\n\n        for (const eventName in newEventsInProgress) {\n            const {originalEvent} = newEventsInProgress[eventName];\n            if (!this._eventsInProgress[eventName]) {\n                startEvents[`${eventName}start`] = originalEvent;\n            }\n            this._eventsInProgress[eventName] = newEventsInProgress[eventName];\n        }\n\n        // fire start events only after this._eventsInProgress has been updated\n        if (!wasMoving && nowMoving) {\n            this._fireEvent('movestart', nowMoving.originalEvent);\n        }\n\n        for (const name in startEvents) {\n            this._fireEvent(name, startEvents[name]);\n        }\n\n        if (nowMoving) {\n            this._fireEvent('move', nowMoving.originalEvent);\n        }\n\n        for (const eventName in newEventsInProgress) {\n            const {originalEvent} = newEventsInProgress[eventName];\n            this._fireEvent(eventName, originalEvent);\n        }\n\n        const endEvents = {};\n\n        let originalEndEvent;\n        for (const eventName in this._eventsInProgress) {\n            const {handlerName, originalEvent} = this._eventsInProgress[eventName];\n            if (!this._handlersById[handlerName].isActive()) {\n                delete this._eventsInProgress[eventName];\n                originalEndEvent = deactivatedHandlers[handlerName] || originalEvent;\n                endEvents[`${eventName}end`] = originalEndEvent;\n            }\n        }\n\n        for (const name in endEvents) {\n            this._fireEvent(name, endEvents[name]);\n        }\n\n        const stillMoving = isMoving(this._eventsInProgress);\n        const finishedMoving = (wasMoving || nowMoving) && !stillMoving;\n        if (finishedMoving && this._terrainMovement) {\n            this._camera.elevationFreeze = false;\n            this._terrainMovement = false;\n            const tr = this._camera.getTransformForUpdate();\n            if (this._map.getCenterClampedToGround()) {\n                tr.recalculateZoomAndCenter(this._map.terrain);\n            }\n            this._camera.applyUpdatedTransform(tr);\n        }\n        if (allowEndAnimation && finishedMoving) {\n            this._updatingCamera = true;\n            const inertialEase = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);\n\n            const shouldSnapToNorth = bearing => bearing !== 0 && -this._bearingSnap < bearing && bearing < this._bearingSnap;\n\n            if (inertialEase && (inertialEase.essential || !browser.prefersReducedMotion)) {\n                if (shouldSnapToNorth(inertialEase.bearing || this._map.getBearing())) {\n                    inertialEase.bearing = 0;\n                }\n                inertialEase.freezeElevation = true;\n                this._map.easeTo(inertialEase, {originalEvent: originalEndEvent});\n            } else {\n                this._map.fire(new MapMovementEvent('moveend', {originalEvent: originalEndEvent}));\n                if (shouldSnapToNorth(this._map.getBearing())) {\n                    this._map.resetNorth();\n                }\n            }\n            this._updatingCamera = false;\n        }\n\n    }\n\n    _fireEvent(type: string, e?: Event): void {\n        this._map.fire(new MapMovementEvent(type, e ? {originalEvent: e} : {}));\n    }\n\n    _requestFrame(): number {\n        this._map.triggerRepaint();\n        return this._map._renderTaskQueue.add(timeStamp => {\n            delete this._frameId;\n            this.handleEvent(new RenderFrameEvent('renderFrame', {timeStamp}));\n            this._applyChanges();\n        });\n    }\n\n    _triggerRenderFrame(): void {\n        if (this._frameId === undefined) {\n            this._frameId = this._requestFrame();\n        }\n    }\n}\n","import Point from '@mapbox/point-geometry';\nimport {extend, wrap, defaultEasing, pick, scaleZoom, evaluateZoomSnap} from '../util/util.ts';\nimport {interpolates} from '@maplibre/maplibre-gl-style-spec';\nimport {browser} from '../util/browser.ts';\nimport {now} from '../util/time_control.ts';\nimport {LngLat} from '../geo/lng_lat.ts';\nimport {LngLatBounds} from '../geo/lng_lat_bounds.ts';\nimport {Evented} from '../util/evented.ts';\nimport {MapMovementEvent} from './events.ts';\nimport {MercatorCoordinate} from '../geo/mercator_coordinate.ts';\nimport {MercatorTransform} from '../geo/projection/mercator_transform.ts';\nimport {MercatorCameraHelper} from '../geo/projection/mercator_camera_helper.ts';\n\nimport type {MapEventType} from './events.ts';\nimport type {Terrain} from '../render/terrain.ts';\nimport type {ITransform, TransformConstrainFunction} from '../geo/transform_interface.ts';\nimport type {LngLatLike} from '../geo/lng_lat.ts';\nimport type {LngLatBoundsLike} from '../geo/lng_lat_bounds.ts';\nimport type {TaskID} from '../util/task_queue.ts';\nimport type {PaddingOptions} from '../geo/edge_insets.ts';\nimport type {ICameraHelper} from '../geo/projection/camera_helper.ts';\n\n/**\n * A [Point](https://github.com/mapbox/point-geometry) or an array of two numbers representing `x` and `y` screen coordinates in pixels.\n *\n * @group Geography and Geometry\n *\n * @example\n * ```ts\n * let p1 = new Point(-77, 38); // a PointLike which is a Point\n * let p2 = [-77, 38]; // a PointLike which is an array of two numbers\n * ```\n */\nexport type PointLike = Point | [number, number];\n\n/**\n * Options common to {@link Map.jumpTo}, {@link Map.easeTo}, and {@link Map.flyTo}, controlling the desired location,\n * zoom, bearing, pitch, and roll of the camera. All properties are optional, and when a property is omitted, the current\n * camera value for that property will remain unchanged.\n *\n * @example\n * Set the map's initial perspective with CameraOptions\n * ```ts\n * let map = new Map({\n *   container: 'map',\n *   style: 'https://demotiles.maplibre.org/style.json',\n *   center: [-73.5804, 45.53483],\n *   pitch: 60,\n *   bearing: -60,\n *   zoom: 10\n * });\n * ```\n * @see [Set pitch and bearing](https://maplibre.org/maplibre-gl-js/docs/examples/set-pitch-and-bearing/)\n * @see [Jump to a series of locations](https://maplibre.org/maplibre-gl-js/docs/examples/jump-to-a-series-of-locations/)\n * @see [Fly to a location](https://maplibre.org/maplibre-gl-js/docs/examples/fly-to-a-location/)\n * @see [Display buildings in 3D](https://maplibre.org/maplibre-gl-js/docs/examples/display-buildings-in-3d/)\n */\nexport type CameraOptions = CenterZoomBearing & {\n    /**\n     * The desired pitch in degrees. The pitch is the angle towards the horizon\n     * measured in degrees with a range between 0 and 60 degrees. For example, pitch: 0 provides the appearance\n     * of looking straight down at the map, while pitch: 60 tilts the user's perspective towards the horizon.\n     * Increasing the pitch value is often used to display 3D objects.\n     */\n    pitch?: number;\n    /**\n     * The desired roll in degrees. The roll is the angle about the camera boresight.\n     */\n    roll?: number;\n    /**\n     * The elevation of the center point in meters above sea level.\n     */\n    elevation?: number;\n};\n\n/**\n * Holds center, zoom and bearing properties\n */\nexport type CenterZoomBearing = {\n    /**\n     * The desired center.\n     */\n    center?: LngLatLike;\n    /**\n     * The desired mercator zoom level.\n     */\n    zoom?: number;\n    /**\n     * The desired bearing in degrees. The bearing is the compass direction that\n     * is \"up\". For example, `bearing: 90` orients the map so that east is up.\n     */\n    bearing?: number;\n};\n\n/**\n * The options object related to the {@link Map.jumpTo} method\n */\nexport type JumpToOptions = CameraOptions & {\n    /**\n     * Dimensions in pixels applied on each side of the viewport for shifting the vanishing point.\n     */\n    padding?: PaddingOptions;\n};\n\n/**\n * A options object for the {@link Map.cameraForBounds} method\n */\nexport type CameraForBoundsOptions = CameraOptions & {\n    /**\n     * The amount of padding in pixels to add to the given bounds.\n     */\n    padding?: number | PaddingOptions;\n    /**\n     * The center of the given bounds relative to the map's center, measured in pixels.\n     * @defaultValue [0, 0]\n     */\n    offset?: PointLike;\n    /**\n     * The maximum zoom level to allow when the camera would transition to the specified bounds.\n     */\n    maxZoom?: number;\n};\n\n/**\n * The {@link Map.flyTo} options object\n */\nexport type FlyToOptions = AnimationOptions & CameraOptions & {\n    /**\n     * The zooming \"curve\" that will occur along the\n     * flight path. A high value maximizes zooming for an exaggerated animation, while a low\n     * value minimizes zooming for an effect closer to {@link Map.easeTo}. 1.42 is the average\n     * value selected by participants in the user study discussed in\n     * [van Wijk (2003)](https://www.win.tue.nl/~vanwijk/zoompan.pdf). A value of\n     * `Math.pow(6, 0.25)` would be equivalent to the root mean squared average velocity. A\n     * value of 1 would produce a circular motion.\n     * @defaultValue 1.42\n     */\n    curve?: number;\n    /**\n     * The minimum zoom level that the flight arc may reach. The animation will\n     * not zoom out beyond this level. If the natural flight arc stays within\n     * this boundary, the arc is unchanged. This acts as a ceiling on zoom-out\n     * even when `options.curve` is also specified.\n     */\n    minZoom?: number;\n    /**\n     * The average speed of the animation defined in relation to\n     * `options.curve`. A speed of 1.2 means that the map appears to move along the flight path\n     * by 1.2 times `options.curve` screenfulls every second. A _screenfull_ is the map's visible span.\n     * It does not correspond to a fixed physical distance, but varies by zoom level.\n     * @defaultValue 1.2\n     */\n    speed?: number;\n    /**\n     * The average speed of the animation measured in screenfulls\n     * per second, assuming a linear timing curve. If `options.speed` is specified, this option is ignored.\n     */\n    screenSpeed?: number;\n    /**\n     * The animation's maximum duration, measured in milliseconds.\n     * If duration exceeds maximum duration, it resets to 0.\n     */\n    maxDuration?: number;\n    /**\n     * The amount of padding in pixels to add to the given bounds.\n     */\n    padding?: number | PaddingOptions;\n};\n\n/**\n * The {@link Map.easeTo} options object\n */\nexport type EaseToOptions = AnimationOptions & CameraOptions & {\n    delayEndEvents?: number;\n    padding?: number | PaddingOptions;\n    /**\n     * If `zoom` is specified, `around` determines the point around which the zoom is centered.\n     */\n    around?: LngLatLike;\n    easeId?: string;\n    noMoveStart?: boolean;\n};\n\n/**\n * Options for {@link Map.fitBounds} method\n */\nexport type FitBoundsOptions = FlyToOptions & {\n    /**\n     * If `true`, the map transitions using {@link Map.easeTo}. If `false`, the map transitions using {@link Map.flyTo}.\n     * See those functions and {@link AnimationOptions} for information about options available.\n     * @defaultValue false\n     */\n    linear?: boolean;\n    /**\n     * The center of the given bounds relative to the map's center, measured in pixels.\n     * @defaultValue [0, 0]\n     */\n    offset?: PointLike;\n    /**\n     * The maximum zoom level to allow when the map view transitions to the specified bounds.\n     */\n    maxZoom?: number;\n};\n\n/**\n * Options common to map movement methods that involve animation, such as {@link Map.panBy} and\n * {@link Map.easeTo}, controlling the duration and easing function of the animation. All properties\n * are optional.\n *\n */\nexport type AnimationOptions = {\n    /**\n     * The animation's duration, measured in milliseconds.\n     */\n    duration?: number;\n    /**\n     * A function taking a time in the range 0..1 and returning a number where 0 is\n     * the initial state and 1 is the final state.\n     */\n    easing?: (_: number) => number;\n    /**\n     * of the target center relative to real map container center at the end of animation.\n     */\n    offset?: PointLike;\n    /**\n     * If `false`, no animation will occur.\n     */\n    animate?: boolean;\n    /**\n     * If `true`, then the animation is considered essential and will not be affected by\n     * [`prefers-reduced-motion`](https://developer.mozilla.org/en-US/docs/Web/CSS/\\@media/prefers-reduced-motion).\n     */\n    essential?: boolean;\n    /**\n     * Default false. Needed in 3D maps to let the camera stay in a constant\n     * height based on sea-level. After the animation finished the zoom-level will be recalculated in respect of\n     * the distance from the camera to the center-coordinate-altitude.\n     */\n    freezeElevation?: boolean;\n};\n\n/**\n * A callback hook that allows manipulating the camera and being notified about camera updates before they happen\n */\nexport type CameraUpdateTransformFunction =  (next: {\n    center: LngLat;\n    zoom: number;\n    roll: number;\n    pitch: number;\n    bearing: number;\n    elevation: number;\n}) => {\n    center?: LngLat;\n    zoom?: number;\n    roll?: number;\n    pitch?: number;\n    bearing?: number;\n    elevation?: number;\n};\n\nexport type CameraInitOptions = {\n    minZoom: number;\n    maxZoom: number;\n    minPitch: number;\n    maxPitch: number;\n    bearingSnap: number;\n    zoomSnap: number;\n    renderWorldCopies: boolean;\n    centerClampedToGround: boolean;\n    terrain: Terrain;\n    transformConstrain: TransformConstrainFunction;\n    requestRenderFrame: (a: () => void) => TaskID;\n    cancelRenderFrame: (_: TaskID) => void;\n    transformCameraUpdate: CameraUpdateTransformFunction | null;\n    /**\n     * @internal\n     * Callback invoked by {@link Camera.stop} to halt any in-progress user gestures.\n     * The `Camera` does not own the gesture handlers (the `Map` does), so it is injected\n     * with a way to stop them rather than holding a reference to the `HandlerManager`.\n     */\n    stopHandlers?: () => void;\n};\n\nexport class Camera extends Evented<MapEventType> {\n    transform: ITransform;\n    /**\n     * @internal\n     * Copy of the map's `terrain` (which the `Map` owns).\n     * The camera reads terrain for elevation handling but does not own it.\n     */\n    terrain: Terrain;\n    cameraHelper: ICameraHelper;\n    /**\n     * @internal\n     * Stops any in-progress user gestures. Injected by the owner so the camera does not need\n     * a reference to the `HandlerManager`. See {@link CameraInitOptions.stopHandlers}.\n     */\n    _stopHandlers: () => void;\n\n    _moving: boolean;\n    _zooming: boolean;\n    _rotating: boolean;\n    _pitching: boolean;\n    _rolling: boolean;\n    _padding: boolean;\n\n    _bearingSnap: number;\n    _zoomSnap: number;\n    _easeStart: number;\n    _easeOptions: {\n        duration?: number;\n        easing?: (_: number) => number;\n    };\n    _easeId: string | void;\n\n    _onEaseFrame: (_: number) => void;\n    _onEaseEnd: (easeId?: string) => void;\n    _easeFrameId: TaskID;\n\n    /**\n     * @internal\n     * holds the geographical coordinate of the target\n     */\n    _elevationCenter: LngLat;\n    /**\n     * @internal\n     * holds the targ altitude value, = center elevation of the target.\n     * This value may changes during flight, because new terrain-tiles loads during flight.\n     */\n    _elevationTarget: number;\n    /**\n     * @internal\n     * holds the start altitude value, = center elevation before animation begins\n     * this value will recalculated during flight in respect of changing _elevationTarget values,\n     * so the linear interpolation between start and target keeps smooth and without jumps.\n     */\n    _elevationStart: number;\n    /**\n     * @internal\n     * Saves the current state of the elevation freeze - this is used during map movement to prevent \"rocky\" camera movement.\n     */\n    elevationFreeze: boolean;\n    /**\n     * @internal\n     * Used to track accumulated changes during continuous interaction\n     */\n    _requestedCameraState?: ITransform;\n    /**\n     * A callback used to defer camera updates or apply arbitrary constraints.\n     * If specified, this Camera instance can be used as a stateless component in React etc.\n     */\n    transformCameraUpdate: CameraUpdateTransformFunction | null;\n\n    /**\n     * @internal\n     * If true, the elevation of the center point will automatically be set to the terrain elevation\n     * (or zero if terrain is not enabled). If false, the elevation of the center point will default\n     * to sea level and will not automatically update. Defaults to true. Needs to be set to false to\n     * keep the camera above ground when pitch \\> 90 degrees.\n     */\n    _centerClampedToGround: boolean;\n\n    _requestRenderFrame: (a: () => void) => TaskID;\n    _cancelRenderFrame: (_: TaskID) => void;\n\n    constructor(options: CameraInitOptions) {\n        super();\n        // For now we will use a temporary MercatorTransform instance.\n        // Transform specialization will later be set by style when it creates its projection instance.\n        // When this happens, the new transform will inherit all properties of this temporary transform.\n        this.transform = new MercatorTransform();\n        this.cameraHelper = new MercatorCameraHelper();\n        if (options.minZoom !== undefined) {\n            this.transform.setMinZoom(options.minZoom);\n        }\n        if (options.maxZoom !== undefined) {\n            this.transform.setMaxZoom(options.maxZoom);\n        }\n        if (options.minPitch !== undefined) {\n            this.transform.setMinPitch(options.minPitch);\n        }\n        if (options.maxPitch !== undefined) {\n            this.transform.setMaxPitch(options.maxPitch);\n        }\n        if (options.renderWorldCopies !== undefined) {\n            this.transform.setRenderWorldCopies(options.renderWorldCopies);\n        }\n        if (options.transformConstrain !== null) {\n            this.transform.setConstrainOverride(options.transformConstrain);\n        }\n        this._moving = false;\n        this._zooming = false;\n        this._bearingSnap = options.bearingSnap;\n        this._zoomSnap = options.zoomSnap;\n        this._requestRenderFrame = options.requestRenderFrame;\n        this._cancelRenderFrame = options.cancelRenderFrame;\n        this.terrain = options.terrain;\n        this._centerClampedToGround = options.centerClampedToGround ?? true;\n        this.transformCameraUpdate = options.transformCameraUpdate ?? null;\n        this._stopHandlers = options.stopHandlers ?? (() => {});\n\n        this.on('moveend', () => {\n            delete this._requestedCameraState;\n        });\n    }\n\n    migrateProjection(newTransform: ITransform, newCameraHelper: ICameraHelper): void {\n        newTransform.apply(this.transform, true);\n        this.transform = newTransform;\n        this.cameraHelper = newCameraHelper;\n    }\n\n    getCenter(): LngLat { return new LngLat(this.transform.center.lng, this.transform.center.lat); }\n\n    setCenter(center: LngLatLike, eventData?: Record<string, unknown>): this {\n        return this.jumpTo({center}, eventData);\n    }\n\n    getCenterElevation(): number { return this.transform.elevation; }\n\n    setCenterElevation(elevation: number, eventData?: any): this {\n        this.jumpTo({elevation}, eventData);\n        return this;\n    }\n\n    getCenterClampedToGround(): boolean { return this._centerClampedToGround; }\n\n    setCenterClampedToGround(centerClampedToGround: boolean): void {\n        this._centerClampedToGround = centerClampedToGround;\n    }\n\n    panBy(offset: PointLike, options?: EaseToOptions, eventData?: any): this {\n        offset = Point.convert(offset).mult(-1);\n        return this.panTo(this.transform.center, extend({offset}, options), eventData);\n    }\n\n    panTo(lnglat: LngLatLike, options?: EaseToOptions, eventData?: any): this {\n        return this.easeTo(extend({\n            center: lnglat\n        }, options), eventData);\n    }\n\n    getZoom(): number { return this.transform.zoom; }\n\n    setZoom(zoom: number, eventData?: any): this {\n        this.jumpTo({zoom}, eventData);\n        return this;\n    }\n\n    zoomTo(zoom: number, options?: EaseToOptions | null, eventData?: any): this {\n        return this.easeTo(extend({\n            zoom\n        }, options), eventData);\n    }\n\n    zoomIn(options?: AnimationOptions, eventData?: any): this {\n        this.zoomTo(evaluateZoomSnap(this.getZoom() + 1, this._zoomSnap), options, eventData);\n        return this;\n    }\n\n    zoomOut(options?: AnimationOptions, eventData?: any): this {\n        this.zoomTo(evaluateZoomSnap(this.getZoom() - 1, this._zoomSnap), options, eventData);\n        return this;\n    }\n\n    getVerticalFieldOfView(): number { return this.transform.fov; }\n\n    setVerticalFieldOfView(fov: number, eventData?: any): this {\n        if (fov != this.transform.fov) {\n            this.transform.setFov(fov);\n            this.fire(new MapMovementEvent('movestart', eventData))\n                .fire(new MapMovementEvent('move', eventData))\n                .fire(new MapMovementEvent('moveend', eventData));\n        }\n        return this;\n    }\n\n    getBearing(): number { return this.transform.bearing; }\n\n    setZoomSnap(snap: number): this {\n        this._zoomSnap = snap;\n        return this;\n    }\n\n    getZoomSnap(): number {\n        return this._zoomSnap;\n    }\n\n    setBearing(bearing: number, eventData?: any): this {\n        this.jumpTo({bearing}, eventData);\n        return this;\n    }\n\n    getPadding(): PaddingOptions { return this.transform.padding; }\n\n    setPadding(padding: PaddingOptions, eventData?: any): this {\n        this.jumpTo({padding}, eventData);\n        return this;\n    }\n\n    rotateTo(bearing: number, options?: EaseToOptions, eventData?: any): this {\n        return this.easeTo(extend({\n            bearing\n        }, options), eventData);\n    }\n\n    resetNorth(options?: AnimationOptions, eventData?: any): this {\n        this.rotateTo(0, extend({duration: 1000}, options), eventData);\n        return this;\n    }\n\n    resetNorthPitch(options?: AnimationOptions, eventData?: any): this {\n        this.easeTo(extend({\n            bearing: 0,\n            pitch: 0,\n            roll: 0,\n            duration: 1000\n        }, options), eventData);\n        return this;\n    }\n\n    snapToNorth(options?: AnimationOptions, eventData?: any): this {\n        if (Math.abs(this.getBearing()) < this._bearingSnap) {\n            return this.resetNorth(options, eventData);\n        }\n        return this;\n    }\n\n    getPitch(): number { return this.transform.pitch; }\n\n    setPitch(pitch: number, eventData?: any): this {\n        this.jumpTo({pitch}, eventData);\n        return this;\n    }\n\n    getRoll(): number { return this.transform.roll; }\n\n    setRoll(roll: number, eventData?: any): this {\n        this.jumpTo({roll}, eventData);\n        return this;\n    }\n\n    cameraForBounds(bounds: LngLatBoundsLike, options?: CameraForBoundsOptions): CenterZoomBearing | undefined {\n        bounds = LngLatBounds.convert(bounds).adjustAntiMeridian();\n        const bearing = options?.bearing || 0;\n\n        return this._cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), bearing, options);\n    }\n\n    /**\n     * @internal\n     * Calculate the center of these two points in the viewport and use\n     * the highest zoom level up to and including {@link Map.getMaxZoom} that fits\n     * the AABB defined by these points in the viewport at the specified bearing.\n     * @param p0 - First point\n     * @param p1 - Second point\n     * @param bearing - Desired map bearing at end of animation, in degrees\n     * @param options - the camera options\n     * @returns If map is able to fit to provided bounds, returns `center`, `zoom`, and `bearing`.\n     *      If map is unable to fit, method will warn and return undefined.\n     * @example\n     * ```ts\n     * let p0 = [-79, 43];\n     * let p1 = [-73, 45];\n     * let bearing = 90;\n     * let newCameraTransform = map._cameraForBoxAndBearing(p0, p1, bearing, {\n     *   padding: {top: 10, bottom:25, left: 15, right: 5}\n     * });\n     * ```\n     */\n    _cameraForBoxAndBearing(p0: LngLatLike, p1: LngLatLike, bearing: number, options?: CameraForBoundsOptions): CenterZoomBearing | undefined {\n        const defaultPadding = {\n            top: 0,\n            bottom: 0,\n            right: 0,\n            left: 0\n        };\n        options = extend({\n            padding: defaultPadding,\n            offset: [0, 0],\n            maxZoom: this.transform.maxZoom\n        }, options);\n\n        if (typeof options.padding === 'number') {\n            const p = options.padding;\n            options.padding = {\n                top: p,\n                bottom: p,\n                right: p,\n                left: p\n            };\n        }\n\n        const padding = extend(defaultPadding, options.padding) as PaddingOptions;\n        options.padding = padding;\n        const tr = this.transform;\n        const bounds = new LngLatBounds(p0, p1);\n\n        const result = this.cameraHelper.cameraForBoxAndBearing(options, padding, bounds, bearing, tr);\n        if (result && this._zoomSnap) {\n            result.zoom = evaluateZoomSnap(result.zoom, this._zoomSnap, -1);\n        }\n        return result;\n    }\n\n    fitBounds(bounds: LngLatBoundsLike, options?: FitBoundsOptions, eventData?: any): this {\n        return this._fitInternal(\n            this.cameraForBounds(bounds, options),\n            options,\n            eventData);\n    }\n\n    fitScreenCoordinates(p0: PointLike, p1: PointLike, bearing: number, options?: FitBoundsOptions, eventData?: any): this {\n        return this._fitInternal(\n            this._cameraForBoxAndBearing(\n                this.transform.screenPointToLocation(Point.convert(p0)),\n                this.transform.screenPointToLocation(Point.convert(p1)),\n                bearing,\n                options),\n            options,\n            eventData);\n    }\n\n    _fitInternal(calculatedOptions?: CenterZoomBearing, options?: FitBoundsOptions, eventData?: any): this {\n        // cameraForBounds warns + returns undefined if unable to fit:\n        if (!calculatedOptions) return this;\n\n        options = extend(calculatedOptions, options);\n        // Explicitly remove the padding field because, calculatedOptions already accounts for padding by setting zoom and center accordingly.\n        delete options.padding;\n\n        return options.linear ?\n            this.easeTo(options, eventData) :\n            this.flyTo(options, eventData);\n    }\n\n    jumpTo(options: JumpToOptions, eventData?: any): this {\n        this.stop();\n\n        if ('zoom' in options && this._zoomSnap) {\n            options.zoom = evaluateZoomSnap(options.zoom, this._zoomSnap);\n        }\n\n        const tr = this.getTransformForUpdate();\n        let bearingChanged = false,\n            pitchChanged = false;\n        let rollChanged = false;\n\n        const oldZoom = tr.zoom;\n        if (this.terrain) {\n            tr.setElevation(this.terrain.getElevationForLngLatZoom(options.center ? LngLat.convert(options.center) : tr.center, options.zoom || tr.tileZoom));\n        }\n        this.cameraHelper.handleJumpToCenterZoom(tr, options);\n\n        const zoomChanged = tr.zoom !== oldZoom;\n\n        if ('elevation' in options && tr.elevation !== +options.elevation) {\n            tr.setElevation(+options.elevation);\n        }\n\n        if ('bearing' in options && tr.bearing !== +options.bearing) {\n            bearingChanged = true;\n            tr.setBearing(+options.bearing);\n        }\n\n        if ('pitch' in options && tr.pitch !== +options.pitch) {\n            pitchChanged = true;\n            tr.setPitch(+options.pitch);\n        }\n\n        if ('roll' in options && tr.roll !== +options.roll) {\n            rollChanged = true;\n            tr.setRoll(+options.roll);\n        }\n\n        if (options.padding != null && !tr.isPaddingEqual(options.padding)) {\n            tr.setPadding(options.padding);\n        }\n        this.applyUpdatedTransform(tr);\n\n        this.fire(new MapMovementEvent('movestart', eventData))\n            .fire(new MapMovementEvent('move', eventData));\n\n        if (zoomChanged) {\n            this.fire(new MapMovementEvent('zoomstart', eventData))\n                .fire(new MapMovementEvent('zoom', eventData))\n                .fire(new MapMovementEvent('zoomend', eventData));\n        }\n\n        if (bearingChanged) {\n            this.fire(new MapMovementEvent('rotatestart', eventData))\n                .fire(new MapMovementEvent('rotate', eventData))\n                .fire(new MapMovementEvent('rotateend', eventData));\n        }\n\n        if (pitchChanged) {\n            this.fire(new MapMovementEvent('pitchstart', eventData))\n                .fire(new MapMovementEvent('pitch', eventData))\n                .fire(new MapMovementEvent('pitchend', eventData));\n        }\n\n        if (rollChanged) {\n            this.fire(new MapMovementEvent('rollstart', eventData))\n                .fire(new MapMovementEvent('roll', eventData))\n                .fire(new MapMovementEvent('rollend', eventData));\n        }\n\n        return this.fire(new MapMovementEvent('moveend', eventData));\n    }\n\n    calculateCameraOptionsFromTo(from: LngLatLike, altitudeFrom: number, to: LngLatLike, altitudeTo: number = 0): CameraOptions {\n        const fromMercator = MercatorCoordinate.fromLngLat(from, altitudeFrom);\n        const toMercator = MercatorCoordinate.fromLngLat(to, altitudeTo);\n        const dx = toMercator.x - fromMercator.x;\n        const dy = toMercator.y - fromMercator.y;\n        const dz = toMercator.z - fromMercator.z;\n\n        const distance3D = Math.hypot(dx, dy, dz);\n        if (distance3D === 0) throw new Error('Can\\'t calculate camera options with same From and To');\n\n        const groundDistance = Math.hypot(dx, dy);\n\n        const zoom = scaleZoom(this.transform.cameraToCenterDistance / distance3D / this.transform.tileSize);\n        const bearing = (Math.atan2(dx, -dy) * 180) / Math.PI;\n        let pitch = (Math.acos(groundDistance / distance3D) * 180) / Math.PI;\n        pitch = dz < 0 ? 90 - pitch : 90 + pitch;\n\n        return {\n            center: toMercator.toLngLat(),\n            elevation: altitudeTo,\n            zoom,\n            pitch,\n            bearing\n        };\n    }\n\n    calculateCameraOptionsFromCameraLngLatAltRotation(cameraLngLat: LngLatLike, cameraAlt: number, bearing: number, pitch: number, roll?: number): CameraOptions {\n        const centerInfo = this.transform.calculateCenterFromCameraLngLatAlt(cameraLngLat, cameraAlt, bearing, pitch);\n        return {\n            center: centerInfo.center,\n            elevation: centerInfo.elevation,\n            zoom: centerInfo.zoom,\n            bearing,\n            pitch,\n            roll\n        };\n    }\n\n    easeTo(options: EaseToOptions, eventData?: any): this {\n        this._stop(false, options.easeId);\n\n        options = extend({\n            offset: [0, 0],\n            duration: 500,\n            easing: defaultEasing\n        }, options);\n\n        if ('zoom' in options && this._zoomSnap) {\n            options.zoom = evaluateZoomSnap(options.zoom, this._zoomSnap);\n        }\n\n        if (options.animate === false || (!options.essential && browser.prefersReducedMotion)) {\n            options.duration = 0;\n        }\n\n        const tr = this.getTransformForUpdate();\n        const startBearing = this.getBearing(),\n            startPitch = tr.pitch,\n            startRoll = tr.roll,\n            bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing,\n            pitch = 'pitch' in options ? +options.pitch : startPitch,\n            roll = 'roll' in options ? this._normalizeBearing(options.roll, startRoll) : startRoll,\n            padding = ('padding' in options ? options.padding : tr.padding) as PaddingOptions;\n        const offsetAsPoint = Point.convert(options.offset);\n\n        let around, aroundPoint;\n\n        if (options.around) {\n            around = LngLat.convert(options.around);\n            aroundPoint = tr.locationToScreenPoint(around);\n        }\n\n        const currently = {\n            moving: this._moving,\n            zooming: this._zooming,\n            rotating: this._rotating,\n            pitching: this._pitching,\n            rolling: this._rolling\n        };\n\n        const easeHandler = this.cameraHelper.handleEaseTo(tr, {\n            bearing,\n            pitch,\n            roll,\n            padding,\n            around,\n            aroundPoint,\n            offsetAsPoint,\n            offset: options.offset,\n            zoom: options.zoom,\n            center: options.center,\n        });\n\n        this._rotating ||= (startBearing !== bearing);\n        this._pitching ||= (pitch !== startPitch);\n        this._rolling ||= (roll !== startRoll);\n        this._padding = !tr.isPaddingEqual(padding);\n        this._zooming ||= easeHandler.isZooming;\n        this._easeId = options.easeId;\n        this._prepareEase(eventData, options.noMoveStart, currently);\n\n        if (this.terrain) {\n            this._prepareElevation(easeHandler.elevationCenter);\n        }\n\n        this._ease((k) => {\n            easeHandler.easeFunc(k);\n\n            if (this.terrain && !options.freezeElevation) this._updateElevation(k);\n            this.applyUpdatedTransform(tr);\n            this._fireMoveEvents(eventData);\n\n        }, (interruptingEaseId?: string) => {\n            if (this.terrain && options.freezeElevation) this._finalizeElevation();\n            this._afterEase(eventData, interruptingEaseId);\n        }, options);\n\n        return this;\n    }\n\n    _prepareEase(eventData: any, noMoveStart: boolean,\n        currently: { moving?: boolean; zooming?: boolean; rotating?: boolean; pitching?: boolean; rolling?: boolean} = {}): void {\n        this._moving = true;\n        if (!noMoveStart && !currently.moving) {\n            this.fire(new MapMovementEvent('movestart', eventData));\n        }\n        if (this._zooming && !currently.zooming) {\n            this.fire(new MapMovementEvent('zoomstart', eventData));\n        }\n        if (this._rotating && !currently.rotating) {\n            this.fire(new MapMovementEvent('rotatestart', eventData));\n        }\n        if (this._pitching && !currently.pitching) {\n            this.fire(new MapMovementEvent('pitchstart', eventData));\n        }\n        if (this._rolling && !currently.rolling) {\n            this.fire(new MapMovementEvent('rollstart', eventData));\n        }\n    }\n\n    _prepareElevation(center: LngLat): void {\n        this._elevationCenter = center;\n        this._elevationStart = this.transform.elevation;\n        this._elevationTarget = this.terrain.getElevationForLngLatZoom(center, this.transform.tileZoom);\n        this.elevationFreeze = true;\n    }\n\n    _updateElevation(k: number): void {\n\n        if (this._elevationStart === undefined || this._elevationCenter === undefined) {\n            this._prepareElevation(this.transform.center);\n        }\n\n        this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom));\n        const elevation = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);\n        // target terrain updated during flight, slowly move camera to new height\n        if (k < 1 && elevation !== this._elevationTarget) {\n            const pitch1 = this._elevationTarget - this._elevationStart;\n            const pitch2 = (elevation - (pitch1 * k + this._elevationStart)) / (1 - k);\n            this._elevationStart += k * (pitch1 - pitch2);\n            this._elevationTarget = elevation;\n        }\n        this.transform.setElevation(interpolates.number(this._elevationStart, this._elevationTarget, k));\n    }\n\n    _finalizeElevation(): void {\n        this.elevationFreeze = false;\n        if (this.getCenterClampedToGround()) {\n            this.transform.recalculateZoomAndCenter(this.terrain);\n        }\n    }\n\n    /**\n     * @internal\n     * Called when the camera is about to be manipulated.\n     * If `transformCameraUpdate` is specified or terrain is enabled, a copy of\n     * the current transform is created to track the accumulated changes.\n     * This underlying transform represents the \"desired state\" proposed by input handlers / animations / UI controls.\n     * It may differ from the state used for rendering (`this.transform`).\n     * @returns Transform to apply changes to\n     */\n    getTransformForUpdate(): ITransform {\n        if (!this.transformCameraUpdate && !this.terrain) return this.transform;\n\n        this._requestedCameraState ||= this.transform.clone();\n        return this._requestedCameraState;\n    }\n\n    /**\n     * @internal\n     * Checks the given transform for the camera being below terrain surface and\n     * returns new pitch and zoom to fix that.\n     *\n     * With the new pitch and zoom, the camera will be at the same ground\n     * position but at higher altitude. It will still point to the same spot on\n     * the map.\n     *\n     * @param tr - The transform to check.\n     */\n    _elevateCameraIfInsideTerrain(tr: ITransform) : { pitch?: number; zoom?: number } {\n        if (!this.terrain && tr.elevation >= 0 && tr.pitch <= 90) {\n            return {};\n        }\n        const cameraLngLat = tr.getCameraLngLat();\n        const cameraAltitude = tr.getCameraAltitude();\n        const minAltitude = this.terrain ? this.terrain.getElevationForLngLatZoom(cameraLngLat, tr.zoom) : 0;\n        if (cameraAltitude < minAltitude) {\n            const newCamera = this.calculateCameraOptionsFromTo(\n                cameraLngLat, minAltitude, tr.center, tr.elevation);\n            return {\n                pitch: newCamera.pitch,\n                zoom: newCamera.zoom,\n            };\n        }\n        return {};\n    }\n\n    /**\n     * @internal\n     * Called after the camera is done being manipulated.\n     * @param tr - the requested camera end state\n     * If the camera is inside terrain, it gets elevated.\n     * Call `transformCameraUpdate` if present, and then apply the \"approved\" changes.\n     */\n    applyUpdatedTransform(tr: ITransform): void {\n        const modifiers : Array<(tr: ITransform) => ReturnType<CameraUpdateTransformFunction>> = [];\n        modifiers.push(tr => this._elevateCameraIfInsideTerrain(tr));\n        if (this.transformCameraUpdate) {\n            modifiers.push(tr => this.transformCameraUpdate(tr));\n        }\n        if (!modifiers.length) {\n            return;\n        }\n        const finalTransform = tr.clone();\n        for (const modifier of modifiers) {\n            const nextTransform = finalTransform.clone();\n            const {\n                center,\n                zoom,\n                roll,\n                pitch,\n                bearing,\n                elevation\n            } = modifier(nextTransform);\n            if (center) nextTransform.setCenter(center);\n            if (elevation !== undefined) nextTransform.setElevation(elevation);\n            if (zoom !== undefined) nextTransform.setZoom(zoom);\n            if (roll !== undefined) nextTransform.setRoll(roll);\n            if (pitch !== undefined) nextTransform.setPitch(pitch);\n            if (bearing !== undefined) nextTransform.setBearing(bearing);\n            finalTransform.apply(nextTransform, false);\n        }\n        this.transform.apply(finalTransform, false);\n    }\n\n    _fireMoveEvents(eventData?: Record<string, unknown>): void {\n        this.fire(new MapMovementEvent('move', eventData));\n        if (this._zooming) {\n            this.fire(new MapMovementEvent('zoom', eventData));\n        }\n        if (this._rotating) {\n            this.fire(new MapMovementEvent('rotate', eventData));\n        }\n        if (this._pitching) {\n            this.fire(new MapMovementEvent('pitch', eventData));\n        }\n        if (this._rolling) {\n            this.fire(new MapMovementEvent('roll', eventData));\n        }\n    }\n\n    _afterEase(eventData?: Record<string, unknown>, easeId?: string): void {\n        // if this easing is being stopped to start another easing with\n        // the same id then don't fire any events to avoid extra start/stop events\n        if (this._easeId && easeId && this._easeId === easeId) {\n            return;\n        }\n        delete this._easeId;\n\n        const wasZooming = this._zooming;\n        const wasRotating = this._rotating;\n        const wasPitching = this._pitching;\n        const wasRolling = this._rolling;\n        this._moving = false;\n        this._zooming = false;\n        this._rotating = false;\n        this._pitching = false;\n        this._rolling = false;\n        this._padding = false;\n\n        if (wasZooming) {\n            this.fire(new MapMovementEvent('zoomend', eventData));\n        }\n        if (wasRotating) {\n            this.fire(new MapMovementEvent('rotateend', eventData));\n        }\n        if (wasPitching) {\n            this.fire(new MapMovementEvent('pitchend', eventData));\n        }\n        if (wasRolling) {\n            this.fire(new MapMovementEvent('rollend', eventData));\n        }\n        this.fire(new MapMovementEvent('moveend', eventData));\n    }\n\n    flyTo(options: FlyToOptions, eventData?: any): this {\n        // Fall through to jumpTo if user has set prefers-reduced-motion\n        if (!options.essential && browser.prefersReducedMotion) {\n            const coercedOptions = pick(options, ['center', 'zoom', 'bearing', 'pitch', 'roll', 'elevation', 'padding']) as JumpToOptions;\n            return this.jumpTo(coercedOptions, eventData);\n        }\n\n        // This method implements an “optimal path” animation, as detailed in:\n        //\n        // Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS\n        //   ’03. pp. 15–22. <https://www.win.tue.nl/~vanwijk/zoompan.pdf#page=5>.\n        //\n        // Where applicable, local variable documentation begins with the associated variable or\n        // function in van Wijk (2003).\n\n        this.stop();\n\n        options = extend({\n            offset: [0, 0],\n            speed: 1.2,\n            curve: 1.42,\n            easing: defaultEasing\n        }, options);\n\n        if ('zoom' in options && this._zoomSnap) {\n            options.zoom = evaluateZoomSnap(options.zoom, this._zoomSnap);\n        }\n\n        const tr = this.getTransformForUpdate(),\n            startBearing = tr.bearing,\n            startPitch = tr.pitch,\n            startRoll = tr.roll,\n            startPadding = tr.padding;\n\n        const bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing;\n        const pitch = 'pitch' in options ? +options.pitch : startPitch;\n        const roll = 'roll' in options ? this._normalizeBearing(options.roll, startRoll) : startRoll;\n        const padding = ('padding' in options ? options.padding : tr.padding) as PaddingOptions;\n\n        const offsetAsPoint = Point.convert(options.offset);\n        let pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n        const locationAtOffset = tr.screenPointToLocation(pointAtOffset);\n\n        const flyToHandler = this.cameraHelper.handleFlyTo(tr, {\n            bearing,\n            pitch,\n            roll,\n            padding,\n            locationAtOffset,\n            offsetAsPoint,\n            center: options.center,\n            minZoom: options.minZoom,\n            zoom: options.zoom,\n        });\n\n        let rho = options.curve;\n\n        // w₀: Initial visible span, measured in pixels at the initial scale.\n        const w0 = Math.max(tr.width, tr.height);\n        // w₁: Final visible span, measured in pixels with respect to the initial scale.\n        const w1 = w0 / flyToHandler.scaleOfZoom;\n        // Length of the flight path as projected onto the ground plane, measured in pixels from\n        // the world image origin at the initial scale.\n        const u1 = flyToHandler.pixelPathLength;\n\n        // w<sub>m</sub>: Maximum visible span, measured in pixels with respect to the initial\n        // scale.\n        const wMax = w0 / flyToHandler.scaleOfMinZoom;\n        // Only reduce rho (limit zoom-out). If the natural arc stays within the minZoom\n        // boundary, preserve the default rho rather than forcing the arc deeper.\n        rho = Math.min(rho, Math.sqrt(wMax / u1 * 2));\n\n        // ρ²\n        const rho2 = rho * rho;\n\n        /**\n         * rᵢ: Returns the zoom-out factor at one end of the animation.\n         *\n         * @param descent - `true` for the descent, `false` for the ascent\n         */\n        function zoomOutFactor(descent: boolean) {\n            const b = (w1 * w1 - w0 * w0 + (descent ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (descent ? w1 : w0) * rho2 * u1);\n            return Math.log(Math.sqrt(b * b + 1) - b);\n        }\n\n        function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }\n        function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }\n        function tanh(n) { return sinh(n) / cosh(n); }\n\n        // r₀: Zoom-out factor during ascent.\n        const r0 = zoomOutFactor(false);\n\n        // w(s): Returns the visible span on the ground, measured in pixels with respect to the\n        // initial scale. Uses the current vertical field of view setting.\n        let w: (_: number) => number = function (s) {\n            return (cosh(r0) / cosh(r0 + rho * s));\n        };\n\n        // u(s): Returns the distance along the flight path as projected onto the ground plane,\n        // measured in pixels from the world image origin at the initial scale.\n        let u: (_: number) => number = function (s) {\n            return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1;\n        };\n\n        // S: Total length of the flight path, measured in ρ-screenfulls.\n        let S = (zoomOutFactor(true) - r0) / rho;\n\n        // When u₀ = u₁, the optimal path doesn’t require both ascent and descent.\n        if (Math.abs(u1) < 0.000002 || !isFinite(S)) {\n            // Perform a more or less instantaneous transition if the path is too short.\n            if (Math.abs(w0 - w1) < 0.000001) return this.easeTo(options, eventData);\n\n            const k = w1 < w0 ? -1 : 1;\n            S = Math.abs(Math.log(w1 / w0)) / rho;\n\n            u = () => 0;\n            w = (s) => Math.exp(k * rho * s);\n        }\n\n        if ('duration' in options) {\n            options.duration = +options.duration;\n        } else {\n            const V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed;\n            options.duration = 1000 * S / V;\n        }\n\n        if (options.maxDuration && options.duration > options.maxDuration) {\n            options.duration = 0;\n        }\n\n        this._zooming = true;\n        this._rotating = (startBearing !== bearing);\n        this._pitching = (pitch !== startPitch);\n        this._rolling = (roll !== startRoll);\n        this._padding = !tr.isPaddingEqual(padding);\n\n        this._prepareEase(eventData, false);\n        if (this.terrain) this._prepareElevation(flyToHandler.targetCenter);\n\n        this._ease((k) => {\n            // s: The distance traveled along the flight path, measured in ρ-screenfulls.\n            const s = k * S;\n            const scale = 1 / w(s);\n            const centerFactor = u(s);\n            if (this._rotating) {\n                tr.setBearing(interpolates.number(startBearing, bearing, k));\n            }\n            if (this._pitching) {\n                tr.setPitch(interpolates.number(startPitch, pitch, k));\n            }\n            if (this._rolling) {\n                tr.setRoll(interpolates.number(startRoll, roll, k));\n            }\n            if (this._padding) {\n                tr.interpolatePadding(startPadding, padding, k);\n                // When padding is being applied, Transform.centerPoint is changing continuously,\n                // thus we need to recalculate offsetPoint every frame\n                pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n            }\n\n            flyToHandler.easeFunc(k, scale, centerFactor, pointAtOffset);\n\n            if (this.terrain && !options.freezeElevation) this._updateElevation(k);\n            this.applyUpdatedTransform(tr);\n            this._fireMoveEvents(eventData);\n        }, () => {\n            if (this.terrain && options.freezeElevation) this._finalizeElevation();\n            this._afterEase(eventData);\n        }, options);\n\n        return this;\n    }\n\n    isEasing(): boolean {\n        return !!this._easeFrameId;\n    }\n\n    stop(allowGestures?: boolean): this {\n        return this._stop(allowGestures);\n    }\n\n    _stop(allowGestures?: boolean, easeId?: string): this {\n        if (this._easeFrameId) {\n            this._cancelRenderFrame(this._easeFrameId);\n            delete this._easeFrameId;\n            delete this._onEaseFrame;\n        }\n\n        if (this._onEaseEnd) {\n            // The _onEaseEnd function might emit events which trigger new\n            // animation, which sets a new _onEaseEnd. Ensure we don't delete\n            // it unintentionally.\n            const onEaseEnd = this._onEaseEnd;\n            delete this._onEaseEnd;\n            onEaseEnd.call(this, easeId);\n        }\n        if (!allowGestures) {\n            this._stopHandlers();\n        }\n        return this;\n    }\n\n    _ease(frame: (_: number) => void,\n        finish: () => void,\n        options: {\n            animate?: boolean;\n            duration?: number;\n            easing?: (_: number) => number;\n        }): void {\n        if (options.animate === false || options.duration === 0) {\n            frame(1);\n            finish();\n        } else {\n            this._easeStart = now();\n            this._easeOptions = options;\n            this._onEaseFrame = frame;\n            this._onEaseEnd = finish;\n            this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n        }\n    }\n\n    // Callback for map._requestRenderFrame\n    _renderFrameCallback = (): void => {\n        const t = Math.min((now() - this._easeStart) / this._easeOptions.duration, 1);\n        this._onEaseFrame(this._easeOptions.easing(t));\n\n        // if _stop is called during _onEaseFrame from _fireMoveEvents we should avoid a new _requestRenderFrame, checking it by ensuring _easeFrameId was not deleted\n        if (t < 1 && this._easeFrameId) {\n            this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n        } else {\n            this.stop();\n        }\n    };\n\n    // convert bearing so that it's numerically close to the current one so that it interpolates properly\n    _normalizeBearing(bearing: number, currentBearing: number): number {\n        bearing = wrap(bearing, -180, 180);\n        const diff = Math.abs(bearing - currentBearing);\n        if (Math.abs(bearing - 360 - currentBearing) < diff) bearing -= 360;\n        if (Math.abs(bearing + 360 - currentBearing) < diff) bearing += 360;\n        return bearing;\n    }\n\n    isMoving(): boolean {\n        return this._moving;\n    }\n\n    isZooming(): boolean {\n        return this._zooming;\n    }\n\n    isRotating(): boolean {\n        return this._rotating;\n    }\n}\n","import {DOM} from '../../util/dom.ts';\n\nimport type {Map} from '../map.ts';\nimport type {ControlPosition, IControl} from './control.ts';\nimport type {MapSourceDataEvent, MapStyleDataEvent, MapTerrainEvent} from '../events.ts';\nimport type {StyleSpecification} from '@maplibre/maplibre-gl-style-spec';\n/**\n * The {@link AttributionControl} options object\n */\nexport type AttributionControlOptions = {\n    /**\n     * If `true`, the attribution control will always collapse when moving the map. If `false`,\n     * force the expanded attribution control. The default is a responsive attribution that collapses when the user moves the map on maps less than 640 pixels wide.\n     * **Attribution should not be collapsed if it can comfortably fit on the map. `compact` should only be used to modify default attribution when map size makes it impossible to fit default attribution and when the automatic compact resizing for default settings are not sufficient.**\n     */\n    compact?: boolean;\n    /**\n     * Attributions to show in addition to any other attributions.\n     */\n    customAttribution?: string | string[];\n};\n\nexport const defaultAttributionControlOptions: AttributionControlOptions = {\n    compact: true,\n    customAttribution: '<a href=\"https://maplibre.org/\" target=\"_blank\">MapLibre</a>'\n};\n\n/**\n * An `AttributionControl` control presents the map's attribution information. By default, the attribution control is expanded (regardless of map width).\n * @group Markers and Controls\n * @example\n * ```ts\n * let map = new Map({attributionControl: false})\n *     .addControl(new AttributionControl({\n *         compact: true\n *     }));\n * ```\n * @see [Change the default position for attribution](https://maplibre.org/maplibre-gl-js/docs/examples/change-the-default-position-for-attribution/)\n */\nexport class AttributionControl implements IControl {\n    options: AttributionControlOptions;\n    _map: Map;\n    _compact: boolean | undefined;\n    _container: HTMLElement;\n    _innerContainer: HTMLElement;\n    _compactButton: HTMLElement;\n    _editLink: HTMLAnchorElement;\n    _attribHTML: string;\n    styleId: string;\n    styleOwner: string;\n\n    /**\n     * @param options - the attribution options\n     */\n    constructor(options: AttributionControlOptions = defaultAttributionControlOptions) {\n        this.options = options;\n    }\n\n    getDefaultPosition(): ControlPosition {\n        return 'bottom-right';\n    }\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        this._compact = this.options.compact;\n        this._container = DOM.create('details', 'maplibregl-ctrl maplibregl-ctrl-attrib');\n        this._compactButton = DOM.create('summary', 'maplibregl-ctrl-attrib-button', this._container);\n        this._compactButton.addEventListener('click', this._toggleAttribution);\n        this._setElementTitle(this._compactButton, 'ToggleAttribution');\n        this._innerContainer = DOM.create('div', 'maplibregl-ctrl-attrib-inner', this._container);\n\n        this._updateAttributions();\n        this._updateCompact();\n\n        this._map.on('styledata', this._updateData);\n        this._map.on('sourcedata', this._updateData);\n        this._map.on('terrain', this._updateData);\n        this._map.on('resize', this._updateCompact);\n        this._map.on('drag', this._updateCompactMinimize);\n\n        return this._container;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        this._container.remove();\n\n        this._map.off('styledata', this._updateData);\n        this._map.off('sourcedata', this._updateData);\n        this._map.off('terrain', this._updateData);\n        this._map.off('resize', this._updateCompact);\n        this._map.off('drag', this._updateCompactMinimize);\n\n        this._map = undefined;\n        this._compact = undefined;\n        this._attribHTML = undefined;\n    }\n\n    _setElementTitle(element: HTMLElement, title: 'ToggleAttribution' | 'MapFeedback'): void {\n        const str = this._map._getUIString(`AttributionControl.${title}`);\n        element.title = str;\n        element.setAttribute('aria-label', str);\n    }\n\n    _toggleAttribution = (): void => {\n        if (this._container.classList.contains('maplibregl-compact')) {\n            if (this._container.classList.contains('maplibregl-compact-show')) {\n                this._container.setAttribute('open', '');\n                this._container.classList.remove('maplibregl-compact-show');\n            } else {\n                this._container.classList.add('maplibregl-compact-show');\n                this._container.removeAttribute('open');\n            }\n        }\n    };\n\n    _updateData = (e: MapSourceDataEvent | MapStyleDataEvent | MapTerrainEvent): void => {\n        if (e && (e.type === 'terrain' || e.dataType === 'style' || (e.dataType === 'source' && (e.sourceDataType === 'metadata' || e.sourceDataType === 'visibility')))) {\n            this._updateAttributions();\n        }\n    };\n\n    _updateAttributions(): void {\n        if (!this._map.style) return;\n        let attributions: string[] = [];\n        if (this.options.customAttribution) {\n            if (Array.isArray(this.options.customAttribution)) {\n                attributions = attributions.concat(\n                    this.options.customAttribution.map(attribution => {\n                        if (typeof attribution !== 'string') return '';\n                        return attribution;\n                    })\n                );\n            } else if (typeof this.options.customAttribution === 'string') {\n                attributions.push(this.options.customAttribution);\n            }\n        }\n\n        if (this._map.style.stylesheet) {\n            const stylesheet = this._map.style.stylesheet as StyleSpecification & { owner: string; id: string };\n            this.styleOwner = stylesheet.owner;\n            this.styleId = stylesheet.id;\n        }\n\n        const tileManagers = this._map.style.tileManagers;\n        for (const id in tileManagers) {\n            const tileManager = tileManagers[id];\n            if (tileManager.used || tileManager.usedForTerrain) {\n                const source = tileManager.getSource();\n                if (source.attribution && !attributions.includes(source.attribution)) {\n                    attributions.push(source.attribution);\n                }\n            }\n        }\n\n        // remove any entries that are whitespace\n        attributions = attributions.filter(e => String(e).trim());\n\n        // remove any entries that are substrings of another entry.\n        // first sort by length so that substrings come first\n        attributions.sort((a, b) => a.length - b.length);\n        attributions = attributions.filter((attrib, i) => {\n            for (let j = i + 1; j < attributions.length; j++) {\n                if (attributions[j].includes(attrib)) { return false; }\n            }\n            return true;\n        });\n\n        // check if attribution string is different to minimize DOM changes\n        const attribHTML = attributions.join(' | ');\n        if (attribHTML === this._attribHTML) return;\n\n        this._attribHTML = attribHTML;\n\n        if (attributions.length) {\n            this._innerContainer.innerHTML = DOM.sanitize(attribHTML);\n            this._container.classList.remove('maplibregl-attrib-empty');\n        } else {\n            this._container.classList.add('maplibregl-attrib-empty');\n        }\n        this._updateCompact();\n        // remove old DOM node from _editLink\n        this._editLink = null;\n    }\n\n    _updateCompact = (): void => {\n        if (this._map.getCanvasContainer().offsetWidth <= 640 || this._compact) {\n            if (this._compact === false) {\n                this._container.setAttribute('open', '');\n            } else if (!this._container.classList.contains('maplibregl-compact') && !this._container.classList.contains('maplibregl-attrib-empty')) {\n                this._container.setAttribute('open', '');\n                this._container.classList.add('maplibregl-compact', 'maplibregl-compact-show');\n            }\n        } else {\n            this._container.setAttribute('open', '');\n            if (this._container.classList.contains('maplibregl-compact')) {\n                this._container.classList.remove('maplibregl-compact', 'maplibregl-compact-show');\n            }\n        }\n    };\n\n    _updateCompactMinimize = (): void => {\n        if (this._container.classList.contains('maplibregl-compact')) {\n            if (this._container.classList.contains('maplibregl-compact-show')) {\n                this._container.classList.remove('maplibregl-compact-show');\n            }\n        }\n    };\n}\n","import {DOM} from '../../util/dom.ts';\n\nimport type {Map} from '../map.ts';\nimport type {ControlPosition, IControl} from './control.ts';\n\n/**\n * The {@link LogoControl} options object\n */\nexport type LogoControlOptions = {\n    /**\n     * If `true`, force a compact logo.\n     * If `false`, force the full logo. The default is a responsive logo that collapses when the map is less than 640 pixels wide.\n     */\n    compact?: boolean;\n};\n\n/**\n * A `LogoControl` is a control that adds the watermark.\n *\n * @group Markers and Controls\n *\n * @example\n * ```ts\n * map.addControl(new LogoControl({compact: false}));\n * ```\n **/\nexport class LogoControl implements IControl {\n    options: LogoControlOptions;\n    _map: Map;\n    _compact: boolean;\n    _container: HTMLElement;\n\n    /**\n     * @param options - the control's options\n     */\n    constructor(options: LogoControlOptions = {}) {\n        this.options = options;\n    }\n\n    getDefaultPosition(): ControlPosition {\n        return 'bottom-left';\n    }\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        this._compact = this.options?.compact;\n        this._container = DOM.create('div', 'maplibregl-ctrl');\n        const anchor = DOM.create('a', 'maplibregl-ctrl-logo');\n        anchor.target = '_blank';\n        anchor.rel = 'noopener nofollow';\n        anchor.href = 'https://maplibre.org/';\n        anchor.setAttribute('aria-label', this._map._getUIString('LogoControl.Title'));\n        anchor.setAttribute('rel', 'noopener nofollow');\n        this._container.appendChild(anchor);\n        this._container.style.display = 'block';\n\n        this._map.on('resize', this._updateCompact);\n        this._updateCompact();\n\n        return this._container;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        this._container.remove();\n        this._map.off('resize', this._updateCompact);\n        this._map = undefined;\n        this._compact = undefined;\n    }\n\n    _updateCompact = (): void => {\n        const containerChildren = this._container.children;\n        if (containerChildren.length) {\n            const anchor = containerChildren[0];\n            if (this._map.getCanvasContainer().offsetWidth <= 640 || this._compact) {\n                if (this._compact !== false) {\n                    anchor.classList.add('maplibregl-compact');\n                }\n            } else {\n                anchor.classList.remove('maplibregl-compact');\n            }\n        }\n    };\n\n}\n","export type TaskID = number;\n\ntype Task = {\n    callback: (timeStamp: number) => void;\n    id: TaskID;\n    cancelled: boolean;\n};\n\nexport class TaskQueue {\n    _queue: Task[];\n    _id: TaskID;\n    _cleared: boolean;\n    _currentlyRunning: Task[] | false;\n\n    constructor()  {\n        this._queue = [];\n        this._id = 0;\n        this._cleared = false;\n        this._currentlyRunning = false;\n    }\n\n    add(callback: (timeStamp: number) => void): TaskID {\n        const id = ++this._id;\n        const queue = this._queue;\n        queue.push({callback, id, cancelled: false});\n        return id;\n    }\n\n    remove(id: TaskID): void {\n        const running = this._currentlyRunning;\n        const queue = running ? this._queue.concat(running) : this._queue;\n        for (const task of queue) {\n            if (task.id === id) {\n                task.cancelled = true;\n                return;\n            }\n        }\n    }\n\n    run(timeStamp: number = 0): void {\n        if (this._currentlyRunning) throw new Error('Attempting to run(), but is already running.');\n        const queue = this._currentlyRunning = this._queue;\n\n        // Tasks queued by callbacks in the current queue should be executed\n        // on the next run, not the current run.\n        this._queue = [];\n\n        for (const task of queue) {\n            if (task.cancelled) continue;\n            task.callback(timeStamp);\n            if (this._cleared) break;\n        }\n\n        this._cleared = false;\n        this._currentlyRunning = false;\n    }\n\n    clear(): void {\n        if (this._currentlyRunning) {\n            this._cleared = true;\n        }\n        this._queue = [];\n    }\n}\n","import {createLayout, type StructArrayLayout} from '../util/struct_array.ts';\n\nconst pos3dAttributes: StructArrayLayout = createLayout([\n    {name: 'a_pos3d', type: 'Int16', components: 3}\n]);\n\nexport default pos3dAttributes;\n","import {type OverscaledTileID} from './tile_id.ts';\nimport {Tile} from './tile.ts';\nimport {EXTENT} from '../data/extent.ts';\nimport {mat4} from 'gl-matrix';\nimport {Evented} from '../util/evented.ts';\nimport type {ITransform} from '../geo/transform_interface.ts';\nimport type {TileManager} from './tile_manager.ts';\nimport type {Source} from '../source/source.ts';\nimport {type Terrain} from '../render/terrain.ts';\nimport {now} from '../util/time_control.ts';\nimport {coveringTiles} from '../geo/projection/covering_tiles.ts';\nimport {createMat4f64} from '../util/util.ts';\nimport {type CanonicalTileRange} from '../source/image_source.ts';\n\n/**\n * @internal\n * This class is a helper for the Terrain-class, it:\n *\n * - loads raster-dem tiles\n * - manages all renderToTexture tiles.\n * - caches previous rendered tiles.\n * - finds all necessary renderToTexture tiles for a OverscaledTileID area\n * - finds the corresponding raster-dem tile for OverscaledTileID\n */\nexport class TerrainTileManager extends Evented {\n    /**\n     * tile manager for the raster-dem source.\n     */\n    tileManager: TileManager;\n    /**\n     * stores all render-to-texture tiles.\n     */\n    _tiles: {[_: string]: Tile};\n    /**\n     * contains a list of tileID-keys for the current scene. (only for performance)\n     */\n    _renderableTilesKeys: string[];\n    /**\n     * raster-dem-tile for a TileID cache.\n     */\n    _sourceTileCache: {[_: string]: string};\n    /**\n     * minimum zoomlevel to render the terrain.\n     */\n    minzoom: number;\n    /**\n     * maximum zoomlevel to render the terrain.\n     */\n    maxzoom: number;\n    /**\n     * render-to-texture tileSize in scene.\n     */\n    tileSize: number;\n    /**\n     * raster-dem tiles will load for performance the actualZoom - deltaZoom zoom-level.\n     */\n    deltaZoom: number;\n    /**\n     * used to determine whether depth & coord framebuffers need updating\n     */\n    _lastTilesetChange: number = now();\n\n    constructor(tileManager: TileManager) {\n        super();\n        this.tileManager = tileManager;\n        this._tiles = {};\n        this._renderableTilesKeys = [];\n        this._sourceTileCache = {};\n        this.minzoom = 0;\n        this.maxzoom = 22;\n        this.deltaZoom = 1;\n        this.tileSize = tileManager._source.tileSize * 2 ** this.deltaZoom;\n        tileManager.usedForTerrain = true;\n        tileManager.tileSize = this.tileSize;\n    }\n\n    destruct(): void {\n        this.tileManager.usedForTerrain = false;\n        this.tileManager.tileSize = null;\n        this.releaseAllRTT();\n    }\n\n    getSource(): Source {\n        return this.tileManager._source;\n    }\n\n    /**\n     * Load Terrain Tiles, create internal render-to-texture tiles, free GPU memory.\n     * @param transform - the operation to do\n     * @param terrain - the terrain\n     */\n    update(transform: ITransform, terrain: Terrain): void {\n        // load raster-dem tiles for the current scene.\n        this.tileManager.update(transform, terrain);\n        // create internal render-to-texture tiles for the current scene.\n        this._renderableTilesKeys = [];\n        const keys = {};\n        for (const tileID of coveringTiles(transform, {\n            tileSize: this.tileSize,\n            minzoom: this.minzoom,\n            maxzoom: this.maxzoom,\n            reparseOverscaled: false,\n            terrain,\n            calculateTileZoom: this.tileManager._source.calculateTileZoom\n        })) {\n            keys[tileID.key] = true;\n            this._renderableTilesKeys.push(tileID.key);\n            if (!this._tiles[tileID.key]) {\n                tileID.terrainRttPosMatrix32f = new Float32Array(16);\n                mat4.ortho(tileID.terrainRttPosMatrix32f, 0, EXTENT, EXTENT, 0, 0, 1);\n                this._tiles[tileID.key] = new Tile(tileID, this.tileSize);\n                this._lastTilesetChange = now();\n            }\n        }\n        // free unused tiles\n        for (const key in this._tiles) {\n            if (!keys[key]) {\n                this._tiles[key].releaseRTT(this.tileManager.map.painter);\n                delete this._tiles[key];\n            }\n        }\n    }\n\n    /**\n     * Release the RTT objects for `tileID` (and its ancestors/descendants),\n     */\n    releaseRTT(tileID: OverscaledTileID): void {\n        for (const key in this._tiles) {\n            const tile = this._tiles[key];\n            if (tile.tileID.equals(tileID) || tile.tileID.isChildOf(tileID) || tileID.isChildOf(tile.tileID))\n                tile.releaseRTT(this.tileManager.map.painter);\n        }\n    }\n\n    /**\n     * Release the A RTT objects for all tiles.\n     */\n    releaseAllRTT(): void {\n        for (const key in this._tiles) {\n            const tile = this._tiles[key];\n            tile.releaseRTT(this.tileManager.map.painter);\n        }\n    }\n\n    /**\n     * get a list of tiles, which are loaded and should be rendered in the current scene\n     * @returns the renderable tiles\n     */\n    getRenderableTiles(): Tile[] {\n        return this._renderableTilesKeys.map(key => this.getTileByID(key));\n    }\n\n    /**\n     * get terrain tile by the TileID key\n     * @param id - the tile id\n     * @returns the tile\n     */\n    getTileByID(id: string): Tile {\n        return this._tiles[id];\n    }\n\n    /**\n     * Searches for the corresponding current renderable terrain-tiles\n     * @param tileID - the tile to look for\n     * @returns the tiles that were found\n     */\n    getTerrainCoords(\n        tileID: OverscaledTileID,\n        terrainTileRanges?: {[zoom: string]: CanonicalTileRange}\n    ): Record<string, OverscaledTileID> {\n        if (terrainTileRanges) {\n            return this._getTerrainCoordsForTileRanges(tileID, terrainTileRanges);\n        } else {\n            return this._getTerrainCoordsForRegularTile(tileID);\n        }\n    }\n\n    /**\n     * Searches for the corresponding current renderable terrain-tiles.\n     * Includes terrain tiles that are either:\n     * - the same as the tileID\n     * - a parent of the tileID\n     * - a child of the tileID\n     * @param tileID - the tile to look for\n     * @returns the tiles that were found\n     */\n    _getTerrainCoordsForRegularTile(tileID: OverscaledTileID): Record<string, OverscaledTileID> {\n        const coords: Record<string, OverscaledTileID> = {};\n        for (const key of this._renderableTilesKeys) {\n            const terrainTileID = this._tiles[key].tileID;\n            const coord = tileID.clone();\n            const mat = createMat4f64();\n            if (terrainTileID.canonical.equals(tileID.canonical)) {\n                mat4.ortho(mat, 0, EXTENT, EXTENT, 0, 0, 1);\n            } else if (terrainTileID.canonical.isChildOf(tileID.canonical)) {\n                const dz = terrainTileID.canonical.z - tileID.canonical.z;\n                const dx = terrainTileID.canonical.x - (terrainTileID.canonical.x >> dz << dz);\n                const dy = terrainTileID.canonical.y - (terrainTileID.canonical.y >> dz << dz);\n                const size = EXTENT >> dz;\n                mat4.ortho(mat, 0, size, size, 0, 0, 1); // Note: we are using `size` instead of `EXTENT` here\n                mat4.translate(mat, mat, [-dx * size, -dy * size, 0]);\n            } else if (tileID.canonical.isChildOf(terrainTileID.canonical)) {\n                const dz = tileID.canonical.z - terrainTileID.canonical.z;\n                const dx = tileID.canonical.x - (tileID.canonical.x >> dz << dz);\n                const dy = tileID.canonical.y - (tileID.canonical.y >> dz << dz);\n                const size = EXTENT >> dz;\n                mat4.ortho(mat, 0, EXTENT, EXTENT, 0, 0, 1);\n                mat4.translate(mat, mat, [dx * size, dy * size, 0]);\n                mat4.scale(mat, mat, [1 / (2 ** dz), 1 / (2 ** dz), 0]);\n            } else {\n                continue;\n            }\n            coord.terrainRttPosMatrix32f = new Float32Array(mat);\n            coords[key] = coord;\n        }\n        return coords;\n    }\n\n    /**\n     * Searches for the corresponding current renderable terrain-tiles.\n     * Includes terrain tiles that are within terrain tile ranges.\n     * @param tileID - the tile to look for\n     * @returns the tiles that were found\n     */\n    _getTerrainCoordsForTileRanges(\n        tileID: OverscaledTileID,\n        terrainTileRanges: {[zoom: string]: CanonicalTileRange}\n    ): Record<string, OverscaledTileID> {\n        const coords: Record<string, OverscaledTileID> = {};\n        for (const key of this._renderableTilesKeys) {\n            const terrainTileID = this._tiles[key].tileID;\n            if (!this._isWithinTileRanges(terrainTileID, terrainTileRanges)) {\n                continue;\n            }\n\n            const coord = tileID.clone();\n            const mat = createMat4f64();\n            if (terrainTileID.canonical.z === tileID.canonical.z) {\n                const dx = tileID.canonical.x - terrainTileID.canonical.x\n                    + tileID.wrap * (1 << tileID.canonical.z); // include wrap shift\n                const dy = tileID.canonical.y - terrainTileID.canonical.y;\n                mat4.ortho(mat, 0, EXTENT, EXTENT, 0, 0, 1);\n                mat4.translate(mat, mat, [dx * EXTENT, dy * EXTENT, 0]);\n            } else if (terrainTileID.canonical.z > tileID.canonical.z) {\n                const dz = terrainTileID.canonical.z - tileID.canonical.z;\n                // this translation is needed to project tileID to terrainTileID zoom level\n                const dx = terrainTileID.canonical.x - (terrainTileID.canonical.x >> dz << dz)\n                    + tileID.wrap * (1 << terrainTileID.canonical.z); // include wrap shift\n                const dy = terrainTileID.canonical.y - (terrainTileID.canonical.y >> dz << dz);\n                // this translation is needed if terrainTileID is not a parent of tileID\n                const dx2 = tileID.canonical.x - (terrainTileID.canonical.x >> dz);\n                const dy2 = tileID.canonical.y - (terrainTileID.canonical.y >> dz);\n\n                const size = EXTENT >> dz;\n                mat4.ortho(mat, 0, size, size, 0, 0, 1);\n                mat4.translate(mat, mat, [-dx * size + dx2 * EXTENT, -dy * size + dy2 * EXTENT, 0]);\n            } else { // terrainTileID.canonical.z < tileID.canonical.z\n                const dz = tileID.canonical.z - terrainTileID.canonical.z;\n                // this translation is needed to project tileID to terrainTileID zoom level\n                const dx = tileID.canonical.x - (tileID.canonical.x >> dz << dz)\n                    + tileID.wrap * (1 << tileID.canonical.z); // include wrap shift\n                const dy = tileID.canonical.y - (tileID.canonical.y >> dz << dz);\n                // this translation is needed if terrainTileID is not a parent of tileID\n                const dx2 = (tileID.canonical.x >> dz) - terrainTileID.canonical.x;\n                const dy2 = (tileID.canonical.y >> dz) - terrainTileID.canonical.y;\n\n                const size = EXTENT << dz;\n                mat4.ortho(mat, 0, size, size, 0, 0, 1);\n                mat4.translate(mat, mat, [dx * EXTENT + dx2 * size, dy * EXTENT + dy2 * size, 0]);\n            }\n            coord.terrainRttPosMatrix32f = new Float32Array(mat);\n            coords[key] = coord;\n        }\n        return coords;\n    }\n\n    /**\n     * find the covering raster-dem tile\n     * @param tileID - the tile to look for\n     * @param searchForDEM - Optional parameter to search for (parent) source tiles with loaded dem.\n     * @returns the tile\n     */\n    getSourceTile(tileID: OverscaledTileID, searchForDEM?: boolean): Tile | undefined {\n        const source = this.tileManager._source;\n        let z = tileID.overscaledZ - this.deltaZoom;\n        if (z > source.maxzoom) z = source.maxzoom;\n        if (z < source.minzoom) return undefined;\n        // cache for tileID to terrain-tileID\n        this._sourceTileCache[tileID.key] ||= tileID.scaledTo(z).key;\n        let tile = this.findTileInCaches(this._sourceTileCache[tileID.key]);\n        // during tile-loading phase look if parent tiles (with loaded dem) are available.\n        if (!tile?.dem && searchForDEM) {\n            while (z >= source.minzoom && !tile?.dem)\n                tile = this.findTileInCaches(tileID.scaledTo(z--).key);\n        }\n        return tile;\n    }\n\n    findTileInCaches(key: string): Tile | undefined {\n        let tile = this.tileManager.getTileByID(key);\n        if (tile) {\n            return tile;\n        }\n        tile = this.tileManager._outOfViewCache.getByKey(key);\n        return tile;\n    }\n\n    /**\n     * gets whether any tiles were loaded after a specific time. This is used to update depth & coords framebuffers.\n     * @param time - the time\n     * @returns true if any tiles came into view at or after the specified time\n     */\n    anyTilesAfterTime(time: number = now()): boolean {\n        return this._lastTilesetChange >= time;\n    }\n\n    /**\n     * Checks whether a tile is within the canonical tile ranges.\n     * @param tileID - Tile to check\n     * @param canonicalTileRanges - Canonical tile ranges\n     * @returns\n     */\n    private _isWithinTileRanges(\n        tileID: OverscaledTileID,\n        canonicalTileRanges: {[zoom: string]: CanonicalTileRange}\n    ): boolean {\n        const range = canonicalTileRanges[tileID.canonical.z];\n\n        return !!range && (\n            tileID.wrap > range.minWrap || tileID.wrap < range.maxWrap ||\n            tileID.canonical.x >= range.minTileXWrapped &&\n            tileID.canonical.x <= range.maxTileXWrapped &&\n            tileID.canonical.y >= range.minTileY &&\n            tileID.canonical.y <= range.maxTileY\n        );\n    }\n}\n","import {mat4} from 'gl-matrix';\nimport {OverscaledTileID} from '../tile/tile_id.ts';\nimport {RGBAImage} from '../util/image.ts';\nimport {warnOnce} from '../util/util.ts';\nimport {Pos3dArray, TriangleIndexArray} from '../data/array_types.g.ts';\nimport pos3dAttributes from '../data/pos3d_attributes.ts';\nimport {SegmentVector} from '../data/segment.ts';\nimport {Texture} from '../webgl/texture.ts';\nimport {MercatorCoordinate} from '../geo/mercator_coordinate.ts';\nimport {TerrainTileManager} from '../tile/terrain_tile_manager.ts';\nimport {EXTENT} from '../data/extent.ts';\nimport {earthRadius, type LngLat} from '../geo/lng_lat.ts';\nimport {Mesh} from './mesh.ts';\nimport {isInBoundsForZoomLngLat} from '../util/world_bounds.ts';\nimport {NORTH_POLE_Y, SOUTH_POLE_Y} from './subdivision.ts';\nimport {coveringTiles} from '../geo/projection/covering_tiles.ts';\nimport type Point from '@mapbox/point-geometry';\nimport type {Tile} from '../tile/tile.ts';\nimport type {Framebuffer} from '../webgl/framebuffer.ts';\nimport type {TileManager} from '../tile/tile_manager.ts';\nimport type {TerrainSpecification} from '@maplibre/maplibre-gl-style-spec';\nimport type {Painter} from './painter.ts';\nimport type {IReadonlyTransform} from '../geo/transform_interface.ts';\n\n/**\n * @internal\n * A terrain GPU related object\n */\nexport type TerrainData = {\n    'u_depth': number;\n    'u_terrain': number;\n    'u_terrain_dim': number;\n    'u_terrain_matrix': mat4;\n    'u_terrain_unpack': number[];\n    'u_terrain_exaggeration': number;\n    texture: WebGLTexture;\n    depthTexture: WebGLTexture;\n    tile: Tile;\n};\n\ntype TerrainElevationSampler = (x: number, y: number, extent: number) => number;\n\n/**\n * @internal\n * This is the main class which handles most of the 3D Terrain logic. It has the following topics:\n *\n * 1. loads raster-dem tiles via the internal tileManager this.tileManager\n * 2. creates a depth-framebuffer, which is used to calculate the visibility of coordinates\n * 3. creates a coords-framebuffer, which is used the get to tile-coordinate for a screen-pixel\n * 4. stores all render-to-texture tiles in the this.tileManager._tiles\n * 5. calculates the elevation for a specific tile-coordinate\n * 6. creates a terrain-mesh\n *\n * A note about the GPU resource-usage:\n *\n * Framebuffers:\n *\n * - one for the depth & coords framebuffer with the size of the map-div.\n * - one for rendering a tile to texture with the size of tileSize (= 512x512).\n *\n * Textures:\n *\n * - one texture for an empty raster-dem tile with size 1x1\n * - one texture for an empty depth-buffer, when terrain is disabled with size 1x1\n * - one texture for an each loaded raster-dem with size of the source.tileSize\n * - one texture for the coords-framebuffer with the size of the map-div.\n * - one texture for the depth-framebuffer with the size of the map-div.\n * - one texture for the encoded tile-coords with the size 2*tileSize (=1024x1024)\n * - finally for each render-to-texture tile (= this._tiles) a set of textures\n * for each render stack (The stack-concept is documented in painter.ts).\n *\n * Normally there exists 1-3 Textures per tile, depending on the stylesheet.\n * Each Textures has the size 2*tileSize (= 1024x1024). Also there exists a\n * cache of the last 150 newest rendered tiles.\n *\n */\nexport class Terrain {\n    /**\n     * The style this terrain corresponds to\n     */\n    painter: Painter;\n    /**\n     * the tilemanager this terrain is based on\n     */\n    tileManager: TerrainTileManager;\n    /**\n     * the TerrainSpecification object passed to this instance\n     */\n    options: TerrainSpecification;\n    /**\n     * define the meshSize per tile.\n     */\n    meshSize: number;\n    /**\n     * multiplicator for the elevation. Used to make terrain more \"extreme\".\n     */\n    exaggeration: number;\n    /**\n     * to not see pixels in the render-to-texture tiles it is good to render them bigger\n     * this number is the multiplicator (must be a power of 2) for the current tileSize.\n     * So to get good results with not too much memory footprint a value of 2 should be fine.\n     */\n    qualityFactor: number;\n    /**\n     * holds the framebuffer object in size of the screen to render the coords & depth into a texture.\n     */\n    _fbo: Framebuffer;\n    _fboCoordsTexture: Texture;\n    _fboDepthTexture: Texture;\n    _emptyDepthTexture: Texture;\n    /**\n     * GL Objects for the terrain-mesh\n     * The mesh is a regular mesh, which has the advantage that it can be reused for all tiles.\n     */\n    _meshCache: { [key: string]: Mesh } = {};\n    /**\n     * coords index contains a list of tileID.keys. This index is used to identify\n     * the tile via the alpha-cannel in the coords-texture.\n     * As the alpha-channel has 1 Byte a max of 255 tiles can rendered without an error.\n     */\n    coordsIndex: string[];\n    /**\n     * tile-coords encoded in the rgb channel, _coordsIndex is in the alpha-channel.\n     */\n    _coordsTexture: Texture;\n    /**\n     * accuracy of the coords. 2 * tileSize should be enough.\n     */\n    _coordsTextureSize: number;\n    /**\n     * variables for an empty dem texture, which is used while the raster-dem tile is loading.\n     */\n    _emptyDemUnpack: number[];\n    _emptyDemTexture: Texture;\n    _emptyDemMatrix: mat4;\n    /**\n     * as of overzooming of raster-dem tiles in high zoomlevels, this cache contains\n     * matrices to transform from vector-tile coords to raster-dem-tile coords.\n     */\n    _demMatrixCache: Map<string, mat4>;\n    /**\n     * Per-render cache of resolved CPU elevation samplers. It is cleared after\n     * terrain tile selection updates and whenever the terrain source changes.\n     * Missing DEM data is deliberately not cached so a later sample can retry.\n     */\n    _elevationSamplerCache: Map<string, TerrainElevationSampler>;\n    /**\n     * Controls how terrain skirt length is calculated.\n     * @see {@link MapOptions.terrainSkirtLength}\n     */\n    _terrainSkirtLength: 'none' | 'auto';\n    constructor(painter: Painter, tileManager: TileManager, options: TerrainSpecification, terrainSkirtLength: 'none' | 'auto' = 'auto') {\n        this.painter = painter;\n        this.tileManager = new TerrainTileManager(tileManager);\n        this.options = options;\n        this.exaggeration = typeof options.exaggeration === 'number' ? options.exaggeration : 1.0;\n        this._terrainSkirtLength = terrainSkirtLength;\n        this.qualityFactor = 2;\n        this.meshSize = 128;\n        this._demMatrixCache = new Map();\n        this._elevationSamplerCache = new Map();\n        this.coordsIndex = [];\n        this._coordsTextureSize = 1024;\n    }\n\n    destroy(): void {\n        if (this._fbo) {\n            this._fbo.destroy();\n            this._fbo = null;\n        }\n        if (this._fboCoordsTexture) {\n            this._fboCoordsTexture.destroy();\n            this._fboCoordsTexture = null;\n        }\n        if (this._fboDepthTexture) {\n            this._fboDepthTexture.destroy();\n            this._fboDepthTexture = null;\n        }\n        if (this._emptyDemTexture) {\n            this._emptyDemTexture.destroy();\n            this._emptyDemTexture = null;\n        }\n        if (this._emptyDepthTexture) {\n            this._emptyDepthTexture.destroy();\n            this._emptyDepthTexture = null;\n        }\n        if (this._coordsTexture) {\n            this._coordsTexture.destroy();\n            this._coordsTexture = null;\n        }\n        for (const key in this._meshCache) {\n            this._meshCache[key].destroy();\n        }\n        this._meshCache = {};\n        this.tileManager.destruct();\n    }\n\n    /**\n     * Get the elevation-value from original dem-data for a given tile-coordinate.\n     * Coordinates that fall outside `[0, extent)` are normalized to the\n     * appropriate neighbor tile before lookup.\n     * @param tileID - the tile to get the elevation for\n     * @param x - x coordinate relative to the tile, may be outside `[0, extent)`\n     * @param y - y coordinate relative to the tile, may be outside `[0, extent)`\n     * @param extent - optional, default 8192\n     * @returns the elevation\n     */\n    getDEMElevation(tileID: OverscaledTileID, x: number, y: number, extent: number = EXTENT): number {\n        const normalized = tileID.normalizeCoordinates(x, y, extent);\n        if (!normalized) return 0;\n\n        const sampler = this._getElevationSampler(normalized.tileID);\n        return sampler ? sampler(normalized.x, normalized.y, extent) : 0;\n    }\n\n    /**\n     * Get the elevation for given {@link LngLat} in respect of exaggeration.\n     * @param lnglat - the location\n     * @param zoom - the zoom, use {@link getElevationForLngLat} if you don't want a specific zoom level, but more accurate results.\n     * @returns the elevation\n     */\n    getElevationForLngLatZoom(lnglat: LngLat, zoom: number): number {\n        if (!isInBoundsForZoomLngLat(zoom, lnglat.wrap())) return 0;\n        const {tileID, mercatorX, mercatorY} = this._getOverscaledTileIDFromLngLatZoom(lnglat, zoom);\n        return this.getElevation(tileID, mercatorX % EXTENT, mercatorY % EXTENT, EXTENT);\n    }\n\n    /**\n     * Get the elevation for given {@link LngLat} in respect of exaggeration.\n     * This will traverse up the zoom levels to find the first tile with data to return.\n     * @param lnglat - the location\n     * @returns the elevation\n     */\n    getElevationForLngLat(lnglat: LngLat, transform: IReadonlyTransform): number {\n        const terrainCoveringTiles = coveringTiles(transform, {maxzoom: this.tileManager.maxzoom, minzoom: this.tileManager.minzoom, tileSize: 512, terrain: this});\n        let zoom = 0;\n        for (const tile of terrainCoveringTiles) {\n            if (tile.canonical.z > zoom) {\n                zoom = Math.min(tile.canonical.z, this.tileManager.maxzoom);\n            }\n        }\n        return this.getElevationForLngLatZoom(lnglat, zoom);\n    }\n\n    /**\n     * Get the elevation for given coordinate in respect of exaggeration.\n     * @param tileID - the tile id\n     * @param x - x coordinate relative to the tile, may be outside `[0, extent)`\n     * @param y - y coordinate relative to the tile, may be outside `[0, extent)`\n     * @param extent - optional, default 8192\n     * @returns the elevation\n     */\n    getElevation(tileID: OverscaledTileID, x: number, y: number, extent: number = EXTENT): number {\n        return this.getDEMElevation(tileID, x, y, extent) * this.exaggeration;\n    }\n\n    /**\n     * Clear CPU elevation samplers that may retain a previously selected DEM tile.\n     * @internal\n     */\n    resetElevationCache(): void {\n        this._elevationSamplerCache.clear();\n    }\n\n    _getElevationSampler(tileID: OverscaledTileID): TerrainElevationSampler | null {\n        const key = tileID.key;\n        const cachedSampler = this._elevationSamplerCache.get(key);\n        if (cachedSampler) return cachedSampler;\n\n        const sourceTile = this.tileManager.getSourceTile(tileID, true);\n        const dem = sourceTile?.dem;\n        if (!sourceTile || !dem) return null;\n\n        const matrix = this._getDEMTileMatrix(tileID, sourceTile);\n        // Store the vector-tile to DEM-pixel transform once for the hot sampling loop.\n        const demPixelScaleX = matrix[0] * dem.dim;\n        const demPixelScaleY = matrix[5] * dem.dim;\n        const demPixelOffsetX = matrix[12] * dem.dim;\n        const demPixelOffsetY = matrix[13] * dem.dim;\n        const sampler = (x: number, y: number, extent: number): number => {\n            const extentScale = extent === EXTENT ? 1 : EXTENT / extent;\n            return dem.sampleBilinear(\n                x * extentScale * demPixelScaleX + demPixelOffsetX,\n                y * extentScale * demPixelScaleY + demPixelOffsetY\n            );\n        };\n        this._elevationSamplerCache.set(key, sampler);\n        return sampler;\n    }\n\n    _getDEMTileMatrix(tileID: OverscaledTileID, sourceTile: Tile): mat4 {\n        const matrixKey = `${sourceTile.tileID.key}/${tileID.key}`;\n        const cachedMatrix = this._demMatrixCache.get(matrixKey);\n        if (cachedMatrix) return cachedMatrix;\n\n        const maxzoom = this.tileManager.getSource().maxzoom;\n        let dz = tileID.canonical.z - sourceTile.tileID.canonical.z;\n        if (tileID.overscaledZ > tileID.canonical.z) {\n            if (tileID.canonical.z >= maxzoom) dz =  tileID.canonical.z - maxzoom;\n            else warnOnce('cannot calculate elevation if elevation maxzoom > source.maxzoom');\n        }\n        const dx = tileID.canonical.x - (tileID.canonical.x >> dz << dz);\n        const dy = tileID.canonical.y - (tileID.canonical.y >> dz << dz);\n        const demMatrix = mat4.fromScaling(new Float64Array(16), [1 / (EXTENT << dz), 1 / (EXTENT << dz), 0]);\n        mat4.translate(demMatrix, demMatrix, [dx * EXTENT, dy * EXTENT, 0]);\n        this._demMatrixCache.set(matrixKey, demMatrix);\n        return demMatrix;\n    }\n\n    /**\n     * returns a Terrain Object for a tile. Unless the tile corresponds to data (e.g. tile is loading), return a flat dem object\n     * @param tileID - the tile to get the terrain for\n     * @returns the terrain data to use in the program\n     */\n    getTerrainData(tileID: OverscaledTileID): TerrainData {\n        // create empty DEM Objects, which will used while raster-dem tiles are loading.\n        // creates an empty depth-buffer texture which is needed, during the initialization process of the 3d mesh..\n        if (!this._emptyDemTexture) {\n            const context = this.painter.context;\n            const image = new RGBAImage({width: 1, height: 1}, new Uint8Array(1 * 4));\n            this._emptyDepthTexture = new Texture(context, image, context.gl.RGBA, {premultiply: false});\n            this._emptyDemUnpack = [0, 0, 0, 0];\n            this._emptyDemTexture = new Texture(context, new RGBAImage({width: 1, height: 1}), context.gl.RGBA, {premultiply: false});\n            this._emptyDemTexture.bind(context.gl.NEAREST, context.gl.CLAMP_TO_EDGE);\n            this._emptyDemMatrix = mat4.identity([]);\n        }\n        // find covering dem tile and prepare demTexture\n        const sourceTile = this.tileManager.getSourceTile(tileID, true);\n        if (sourceTile?.dem && (!sourceTile.demTexture || sourceTile.needsTerrainPrepare)) {\n            const context = this.painter.context;\n            sourceTile.demTexture ||= this.painter.getTileTexture(sourceTile.dem.stride);\n            if (sourceTile.demTexture) sourceTile.demTexture.update(sourceTile.dem.getPixels(), {premultiply: false});\n            else sourceTile.demTexture = new Texture(context, sourceTile.dem.getPixels(), context.gl.RGBA, {premultiply: false});\n            sourceTile.demTexture.bind(context.gl.NEAREST, context.gl.CLAMP_TO_EDGE);\n            sourceTile.needsTerrainPrepare = false;\n        }\n        const terrainMatrix = sourceTile ? this._getDEMTileMatrix(tileID, sourceTile) : this._emptyDemMatrix;\n        // return uniform values & textures\n        return {\n            'u_depth': 2,\n            'u_terrain': 3,\n            'u_terrain_dim': sourceTile?.dem?.dim || 1,\n            'u_terrain_matrix': terrainMatrix,\n            'u_terrain_unpack': sourceTile?.dem?.getUnpackVector() || this._emptyDemUnpack,\n            'u_terrain_exaggeration': this.exaggeration,\n            texture: (sourceTile?.demTexture || this._emptyDemTexture).texture,\n            depthTexture: (this._fboDepthTexture || this._emptyDepthTexture).texture,\n            tile: sourceTile\n        };\n    }\n\n    /**\n     * get a framebuffer as big as the map-div, which will be used to render depth & coords into a texture\n     * @param texture - the texture\n     * @returns the frame buffer\n     */\n    getFramebuffer(texture: string): Framebuffer {\n        const painter = this.painter;\n        const width = painter.width / devicePixelRatio;\n        const height = painter.height / devicePixelRatio;\n        if (this._fbo && (this._fbo.width !== width || this._fbo.height !== height)) {\n            this._fbo.destroy();\n            this._fboCoordsTexture.destroy();\n            this._fboDepthTexture.destroy();\n            delete this._fbo;\n            delete this._fboDepthTexture;\n            delete this._fboCoordsTexture;\n        }\n        if (!this._fboCoordsTexture) {\n            this._fboCoordsTexture = new Texture(painter.context, {width, height, data: null}, painter.context.gl.RGBA, {premultiply: false});\n            this._fboCoordsTexture.bind(painter.context.gl.NEAREST, painter.context.gl.CLAMP_TO_EDGE);\n        }\n        if (!this._fboDepthTexture) {\n            this._fboDepthTexture = new Texture(painter.context, {width, height, data: null}, painter.context.gl.RGBA, {premultiply: false});\n            this._fboDepthTexture.bind(painter.context.gl.NEAREST, painter.context.gl.CLAMP_TO_EDGE);\n        }\n        if (!this._fbo) {\n            this._fbo = painter.context.createFramebuffer(width, height, true, false);\n            this._fbo.depthAttachment.set(painter.context.createRenderbuffer(painter.context.gl.DEPTH_COMPONENT16, width, height));\n        }\n        this._fbo.colorAttachment.set(texture === 'coords' ? this._fboCoordsTexture.texture : this._fboDepthTexture.texture);\n        return this._fbo;\n    }\n\n    /**\n     * create coords texture, needed to grab coordinates from canvas\n     * encode coords coordinate into 4 bytes:\n     *   - 8 lower bits for x\n     *   - 8 lower bits for y\n     *   - 4 higher bits for x\n     *   - 4 higher bits for y\n     *   - 8 bits for coordsIndex (1 .. 255) (= number of terraintile), is later set in draw_terrain uniform value\n     * @returns the texture\n     */\n    getCoordsTexture(): Texture {\n        const context = this.painter.context;\n        if (this._coordsTexture) return this._coordsTexture;\n        const data = new Uint8Array(this._coordsTextureSize * this._coordsTextureSize * 4);\n        for (let y = 0, i = 0; y < this._coordsTextureSize; y++) for (let x = 0; x < this._coordsTextureSize; x++, i += 4) {\n            data[i + 0] = x & 255;\n            data[i + 1] = y & 255;\n            data[i + 2] = ((x >> 8) << 4) | (y >> 8);\n            data[i + 3] = 0;\n        }\n        const image = new RGBAImage({width: this._coordsTextureSize, height: this._coordsTextureSize}, new Uint8Array(data.buffer));\n        const texture = new Texture(context, image, context.gl.RGBA, {premultiply: false});\n        texture.bind(context.gl.NEAREST, context.gl.CLAMP_TO_EDGE);\n        this._coordsTexture = texture;\n        return texture;\n    }\n\n    /**\n     * Reads a pixel from the coords-framebuffer and translate this to mercator, or null, if the pixel doesn't lie on the terrain's surface (but the sky instead).\n     * @param p - Screen-Coordinate\n     * @returns Mercator coordinate for a screen pixel, or null, if the pixel is not covered by terrain (is in the sky).\n     */\n    pointCoordinate(p: Point): MercatorCoordinate {\n        // First, ensure the coords framebuffer is up to date.\n        this.painter.maybeDrawDepth(true);\n        this.painter.maybeDrawCoords();\n\n        const rgba = new Uint8Array(4);\n        const context = this.painter.context, gl = context.gl;\n        const px = Math.round(p.x * this.painter.pixelRatio / devicePixelRatio);\n        const py = Math.round(p.y * this.painter.pixelRatio / devicePixelRatio);\n        const fbHeight = Math.round(this.painter.height / devicePixelRatio);\n        // grab coordinate pixel from coordinates framebuffer\n        context.bindFramebuffer.set(this.getFramebuffer('coords').framebuffer);\n        gl.readPixels(px, fbHeight - py - 1, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, rgba);\n        context.bindFramebuffer.set(null);\n        // decode coordinates (encoding see getCoordsTexture)\n        const x = rgba[0] + ((rgba[2] >> 4) << 8);\n        const y = rgba[1] + ((rgba[2] & 15) << 8);\n        const tileID = this.coordsIndex[255 - rgba[3]];\n        const tile = tileID && this.tileManager.getTileByID(tileID);\n\n        if (!tile) {\n            return null;\n        }\n\n        const coordsSize = this._coordsTextureSize;\n        const worldSize = (1 << tile.tileID.canonical.z) * coordsSize;\n        return new MercatorCoordinate(\n            (tile.tileID.canonical.x * coordsSize + x) / worldSize + tile.tileID.wrap,\n            (tile.tileID.canonical.y * coordsSize + y) / worldSize,\n            this.getElevation(tile.tileID, x, y, coordsSize)\n        );\n    }\n\n    /**\n     * Reads the depth value from the depth-framebuffer at a given screen pixel\n     * @param p - Screen coordinate\n     * @returns depth value in clip space (between 0 and 1)\n     */\n\n    depthAtPoint(p: Point): number {\n        const rgba = new Uint8Array(4);\n        const context = this.painter.context, gl = context.gl;\n        context.bindFramebuffer.set(this.getFramebuffer('depth').framebuffer);\n        gl.readPixels(p.x, this.painter.height / devicePixelRatio - p.y - 1, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, rgba);\n        context.bindFramebuffer.set(null);\n        // decode coordinates (encoding see terran_depth.fragment.glsl)\n        return (rgba[0] / (256 * 256 * 256) + rgba[1] / (256 * 256) + rgba[2] / 256 + rgba[3]) / 256;\n    }\n\n    /**\n     * create a regular mesh which will be used by all terrain-tiles\n     * @returns the created regular mesh\n     */\n    getTerrainMesh(tileId: OverscaledTileID): Mesh {\n        const globeEnabled = this.painter.style.projection?.transitionState > 0;\n        const northPole = globeEnabled && tileId.canonical.y === 0;\n        const southPole = globeEnabled && tileId.canonical.y === (1 << tileId.canonical.z) - 1;\n        const key = `m_${northPole ? 'n' : ''}_${southPole ? 's' : ''}`;\n        if (this._meshCache[key]) {\n            return this._meshCache[key];\n        }\n        const context = this.painter.context;\n\n        const vertexArray = new Pos3dArray();\n        const indexArray = new TriangleIndexArray();\n        const meshSize = this.meshSize;\n        const delta = EXTENT / meshSize;\n        const meshSize2 = meshSize * meshSize;\n        for (let y = 0; y <= meshSize; y++) for (let x = 0; x <= meshSize; x++) {\n            vertexArray.emplaceBack(x * delta, y * delta, 0);\n        }\n        for (let y = 0; y < meshSize2; y += meshSize + 1) for (let x = 0; x < meshSize; x++) {\n            indexArray.emplaceBack(x + y, meshSize + x + y + 1, meshSize + x + y + 2);\n            indexArray.emplaceBack(x + y, meshSize + x + y + 2, x + y + 1);\n        }\n        if (this._terrainSkirtLength !== 'none') {\n            this._buildSkirts(vertexArray, indexArray, meshSize, delta, northPole, southPole);\n        }\n\n        const mesh = new Mesh(\n            context.createVertexBuffer(vertexArray, pos3dAttributes.members),\n            context.createIndexBuffer(indexArray),\n            SegmentVector.simpleSegment(0, 0, vertexArray.length, indexArray.length)\n        );\n        this._meshCache[key] = mesh;\n        return mesh;\n    }\n\n    /**\n     * Calculates the height of the tile skirts for the \"auto\" strategy.\n     * @see {@link MapOptions.terrainSkirtLength}\n     * @param zoom - current zoomlevel\n     * @returns the elevation delta in meters\n     */\n    getSkirtLength(zoom: number): number {\n        // divide by 5 is evaluated by trial & error to get a frame in the right height\n        return 2 * Math.PI * earthRadius / Math.pow(2, Math.max(zoom, 0)) / 5;\n    }\n\n    getMinTileElevationForLngLatZoom(lnglat: LngLat, zoom: number): number {\n        if (!isInBoundsForZoomLngLat(zoom, lnglat.wrap())) return 0;\n        const {tileID} = this._getOverscaledTileIDFromLngLatZoom(lnglat, zoom);\n        return this.getMinMaxElevation(tileID).minElevation ?? 0;\n    }\n\n    /**\n     * Get the minimum and maximum elevation contained in a tile. This includes any\n     * exaggeration included in the terrain.\n     *\n     * @param tileID - ID of the tile to be used as a source for the min/max elevation\n     * @returns the minimum and maximum elevation found in the tile, including the terrain's\n     * exaggeration\n     */\n    getMinMaxElevation(tileID: OverscaledTileID): {minElevation: number | null; maxElevation: number | null} {\n        const tile = this.tileManager.getSourceTile(tileID, true);\n        const minMax: {minElevation: number | null; maxElevation: number | null} = {minElevation: null, maxElevation: null};\n        if (tile?.dem) {\n            minMax.minElevation = tile.dem.min * this.exaggeration;\n            minMax.maxElevation = tile.dem.max * this.exaggeration;\n        }\n        return minMax;\n    }\n\n    _getOverscaledTileIDFromLngLatZoom(lnglat: LngLat, zoom: number): { tileID: OverscaledTileID; mercatorX: number; mercatorY: number} {\n        const mercatorCoordinate = MercatorCoordinate.fromLngLat(lnglat.wrap());\n        const worldSize = (1 << zoom) * EXTENT;\n        const mercatorX = mercatorCoordinate.x * worldSize;\n        const mercatorY = mercatorCoordinate.y * worldSize;\n        const tileX = Math.floor(mercatorX / EXTENT), tileY = Math.floor(mercatorY / EXTENT);\n        const tileID = new OverscaledTileID(zoom, 0, zoom, tileX, tileY);\n        return {\n            tileID,\n            mercatorX,\n            mercatorY\n        };\n    }\n\n    /** Add an extra frame around the mesh to avoid hairline gaps (stitching) on tile boundaries with different zoomlevels.\n     * @see {@link MapOptions.terrainSkirtLength}\n    */\n    _buildSkirts(vertexArray: Pos3dArray, indexArray: TriangleIndexArray, meshSize: number, delta: number, northPole: boolean, southPole: boolean): void {\n        const offsetTop = vertexArray.length;\n        const offsetTopEdge = 0;\n        const offsetBottom = offsetTop + (meshSize + 1);\n        const offsetBottomEdge = (meshSize + 1) * meshSize;\n        const northY = northPole ? NORTH_POLE_Y : 0;\n        const northZ = northPole ? 0 : 1;\n        const southY = southPole ? SOUTH_POLE_Y : EXTENT;\n        const southZ = southPole ? 0 : 1;\n        for (let x = 0; x <= meshSize; x++) {\n            vertexArray.emplaceBack(x * delta, northY, northZ);\n        }\n        for (let x = 0; x <= meshSize; x++) {\n            vertexArray.emplaceBack(x * delta, southY, southZ);\n        }\n        for (let x = 0; x < meshSize; x++) {\n            indexArray.emplaceBack(offsetBottomEdge + x, offsetBottom + x, offsetBottom + x + 1);\n            indexArray.emplaceBack(offsetBottomEdge + x, offsetBottom + x + 1, offsetBottomEdge + x + 1);\n            indexArray.emplaceBack(offsetTopEdge + x, offsetTop + x + 1, offsetTop + x);\n            indexArray.emplaceBack(offsetTopEdge + x, offsetTopEdge + x + 1, offsetTop + x + 1);\n        }\n        // left-right frame\n        const offsetLeft = vertexArray.length;\n        const offsetRight = offsetLeft + (meshSize + 1) * 2;\n        for (const x of [0, 1]) for (let y = 0; y <= meshSize; y++) for (const z of [0, 1]) {\n            vertexArray.emplaceBack(x * EXTENT, y * delta, z);\n        }\n        for (let y = 0; y < meshSize * 2; y += 2) {\n            indexArray.emplaceBack(offsetLeft + y, offsetLeft + y + 1, offsetLeft + y + 3);\n            indexArray.emplaceBack(offsetLeft + y, offsetLeft + y + 3, offsetLeft + y + 2);\n            indexArray.emplaceBack(offsetRight + y, offsetRight + y + 3, offsetRight + y + 1);\n            indexArray.emplaceBack(offsetRight + y, offsetRight + y + 2, offsetRight + y + 3);\n        }\n    }\n}\n","import {type Painter, type RenderOptions} from '../render/painter.ts';\nimport {type Tile} from '../tile/tile.ts';\nimport {Color} from '@maplibre/maplibre-gl-style-spec';\nimport {type OverscaledTileID} from '../tile/tile_id.ts';\nimport {drawTerrain} from './draw/draw_terrain.ts';\nimport {type Style} from '../style/style.ts';\nimport {type Terrain} from '../render/terrain.ts';\nimport {type Texture} from './texture.ts';\nimport type {StyleLayer} from '../style/style_layer.ts';\nimport {ImageSource} from '../source/image_source.ts';\n\n/**\n * lookup table which layers should rendered to texture\n */\nconst LAYERS_TO_TEXTURES: { [keyof in StyleLayer['type']]?: boolean } = {\n    background: true,\n    fill: true,\n    line: true,\n    raster: true,\n    hillshade: true,\n    'color-relief': true\n};\n\n/**\n * @internal\n * Renders RTT-eligible layers into per-tile cached textures, then drapes\n * them onto the terrain mesh. Slots live on each Tile so their lifetime\n * tracks the tile itself; the underlying FBO+texture handles are recycled\n * via the painter's RTT pool.\n */\nexport class RenderToTexture {\n    painter: Painter;\n    terrain: Terrain;\n    /** RTT texture dimension in pixels (tile size × terrain quality factor). */\n    rttSize: number;\n    /**\n     * coordsAscending contains a list of all tiles which should be rendered for one render-to-texture tile\n     * e.g. render 4 raster-tiles with size 256px to the 512px render-to-texture tile\n     */\n    _coordsAscending: {[_: string]: {[_:string]: OverscaledTileID[]}};\n    /**\n     * fingerprint string representing the unique state of source tiles and revision\n     * for a given render-to-texture tile. Used to detect changes and trigger re-rendering.\n     * Format: \"sorted_tile_keys#revision\"\n     */\n    _rttFingerprints: {[sourceId: string]: {[rttTileKey: string]: string}};\n    /**\n     * store for render-stacks\n     * a render stack is a set of layers which should be rendered into one texture\n     * every stylesheet can have multiple stacks. A new stack is created if layers which should\n     * not rendered to texture sit between layers which should rendered to texture. e.g. hillshading or symbols\n     */\n    _stacks: string[][];\n    /**\n     * remember the previous processed layer to check if a new stack is needed\n     */\n    _prevType: string;\n    /**\n     * a list of tiles that can potentially rendered\n     */\n    _renderableTiles: Tile[];\n    /**\n     * a list of tiles that should be rendered to screen in the next render-call\n     */\n    _rttTiles: Tile[];\n    /**\n     * a list of all layer-ids which should be rendered\n     */\n    _renderableLayerIds: string[];\n    constructor(painter: Painter, terrain: Terrain) {\n        this.painter = painter;\n        this.terrain = terrain;\n        this.rttSize = terrain.tileManager.tileSize * terrain.qualityFactor;\n    }\n\n    getTexture(tile: Tile): Texture {\n        return tile.getRTT(this._stacks.length - 1).texture;\n    }\n\n    prepareForRender(style: Style, zoom: number): void {\n        this._stacks = [];\n        this._prevType = null;\n        this._rttTiles = [];\n        this._renderableTiles = this.terrain.tileManager.getRenderableTiles();\n        this._renderableLayerIds = style._order.filter(id => !style._layers[id].isHidden(zoom));\n\n        const rttSourceIds = new Set<string>();\n        for (const layerId of this._renderableLayerIds) {\n            const layer = style._layers[layerId];\n            const source = layer.source;\n            if (source && LAYERS_TO_TEXTURES[layer.type]) rttSourceIds.add(source);\n        }\n\n        this._coordsAscending = {};\n        this._rttFingerprints = {};\n        for (const sourceId of rttSourceIds) {\n            const tileManager = style.tileManagers[sourceId];\n            if (!tileManager) continue;\n\n            this._coordsAscending[sourceId] = {};\n            const coordsAscending = this._coordsAscending[sourceId];\n            const source = tileManager.getSource();\n            const terrainTileRanges = source instanceof ImageSource ? source.terrainTileRanges : null;\n            for (const tileID of tileManager.getVisibleCoordinates()) {\n                const keys = this.terrain.tileManager.getTerrainCoords(tileID, terrainTileRanges);\n                for (const key in keys) {\n                    coordsAscending[key] ||= [];\n                    coordsAscending[key].push(keys[key]);\n                }\n            }\n\n            this._rttFingerprints[sourceId] = {};\n            const fingerprints = this._rttFingerprints[sourceId];\n            const revision = tileManager.getState().revision;\n            for (const key in coordsAscending)\n                fingerprints[key] = `${coordsAscending[key].map(c => c.key).sort().join()}#${revision}`;\n        }\n\n        // check tiles to render\n        for (const tile of this._renderableTiles) {\n            for (const source in this._rttFingerprints) {\n                const fingerprint = this._rttFingerprints[source][tile.tileID.key];\n                if (fingerprint && fingerprint !== tile.rttFingerprint[source]) {\n                    tile.releaseRTT(this.painter);\n                }\n            }\n        }\n    }\n\n    /**\n     * due that switching textures is relatively slow, the render\n     * layer-by-layer context is not practicable. To bypass this problem\n     * this lines of code stack all layers and later render all at once.\n     * Because of the stylesheet possibility to mixing render-to-texture layers\n     * and 'live'-layers (f.e. symbols) it is necessary to create more stacks. For example\n     * a symbol-layer is in between of fill-layers.\n     * @param layer - the layer to render\n     * @param renderOptions - flags describing how to render the layer\n     * @returns if true layer is rendered to texture, otherwise false\n     */\n    renderLayer(layer: StyleLayer, renderOptions: RenderOptions): boolean {\n        if (layer.isHidden(this.painter.transform.zoom)) return false;\n\n        const options: RenderOptions = {...renderOptions, isRenderingToTexture: true};\n        const type = layer.type;\n        const painter = this.painter;\n        const isLastLayer = this._renderableLayerIds[this._renderableLayerIds.length - 1] === layer.id;\n\n        // remember background, fill, line & raster layer to render into a stack\n        if (LAYERS_TO_TEXTURES[type]) {\n            // create a new stack if previous layer was not rendered to texture (f.e. symbols)\n            if (!this._prevType || !LAYERS_TO_TEXTURES[this._prevType]) this._stacks.push([]);\n            // push current render-to-texture layer to render-stack\n            this._prevType = type;\n            this._stacks[this._stacks.length - 1].push(layer.id);\n            // rendering is done later, all in once\n            if (!isLastLayer) return true;\n        }\n\n        // in case a stack is finished render all collected stack-layers into a texture\n        if (LAYERS_TO_TEXTURES[this._prevType] || (LAYERS_TO_TEXTURES[type] && isLastLayer)) {\n            this._prevType = type;\n            const stack = this._stacks.length - 1, layers = this._stacks[stack] || [];\n            for (const tile of this._renderableTiles) {\n                this._rttTiles.push(tile);\n                // Cache hit: this tile already has a RTT object for this stack from a previous frame.\n                if (tile.getRTT(stack)) continue;\n                const obj = tile.acquireRTT(painter, stack, this.rttSize);\n                painter.bindRTT(obj);\n                painter.context.clear({color: Color.transparent, stencil: 0});\n                painter.currentStencilSource = undefined;\n                for (const layerId of layers) {\n                    const layer = painter.style._layers[layerId];\n                    const coords = layer.source ? this._coordsAscending[layer.source][tile.tileID.key] : [tile.tileID];\n                    painter.context.viewport.set([0, 0, this.rttSize, this.rttSize]);\n                    painter.renderTileClippingMasks(layer, coords, true);\n                    painter.renderLayer(painter, painter.style.tileManagers[layer.source], layer, coords, options);\n                    if (layer.source) tile.rttFingerprint[layer.source] = this._rttFingerprints[layer.source][tile.tileID.key];\n                }\n            }\n            drawTerrain(this.painter, this.terrain, this._rttTiles, options);\n            this._rttTiles = [];\n\n            return LAYERS_TO_TEXTURES[type];\n        }\n\n        return false;\n    }\n\n}\n","export const defaultLocale = {\n    'AttributionControl.ToggleAttribution': 'Toggle attribution',\n    'AttributionControl.MapFeedback': 'Map feedback',\n    'FullscreenControl.Enter': 'Enter fullscreen',\n    'FullscreenControl.Exit': 'Exit fullscreen',\n    'GeolocateControl.FindMyLocation': 'Find my location',\n    'GeolocateControl.LocationNotAvailable': 'Location not available',\n    'LogoControl.Title': 'MapLibre logo',\n    'Map.Title': 'Map',\n    'Marker.Title': 'Map marker',\n    'NavigationControl.ResetBearing': 'Drag to rotate map, click to reset north',\n    'NavigationControl.ZoomIn': 'Zoom in',\n    'NavigationControl.ZoomOut': 'Zoom out',\n    'Popup.Close': 'Close popup',\n    'ScaleControl.Feet': 'ft',\n    'ScaleControl.Meters': 'm',\n    'ScaleControl.Kilometers': 'km',\n    'ScaleControl.Miles': 'mi',\n    'ScaleControl.NauticalMiles': 'nm',\n    'GlobeControl.Enable': 'Enable globe',\n    'GlobeControl.Disable': 'Disable globe',\n    'TerrainControl.Enable': 'Enable terrain',\n    'TerrainControl.Disable': 'Disable terrain',\n    'CooperativeGesturesHandler.WindowsHelpText': 'Use Ctrl + scroll to zoom the map',\n    'CooperativeGesturesHandler.MacHelpText': 'Use ⌘ + scroll to zoom the map',\n    'CooperativeGesturesHandler.MobileHelpText': 'Use two fingers to move the map',\n};\n","import {ensureError, extend, warnOnce, uniqueId, isImageBitmap, type Complete, pick, type Subscription} from '../util/util.ts';\nimport {browser} from '../util/browser.ts';\nimport {now} from '../util/time_control.ts';\nimport {DOM} from '../util/dom.ts';\nimport packageJSON from '../../package.json' with {type: 'json'};\nimport {type GetResourceResponse, getJSON} from '../util/ajax.ts';\nimport {ImageRequest} from '../util/image_request.ts';\nimport {RequestManager, ResourceType} from '../util/request_manager.ts';\nimport {Style, type StyleSwapOptions} from '../style/style.ts';\nimport {validateStyle, validateAndEmit} from '../style/validate_style.ts';\nimport {EvaluationParameters} from '../style/evaluation_parameters.ts';\nimport {Painter} from '../render/painter.ts';\nimport {GPUInitializationError} from '../util/gpu_initialization_error.ts';\nimport {Hash} from './hash.ts';\nimport {HandlerManager} from './handler_manager.ts';\nimport {Camera, type CameraOptions, type CameraUpdateTransformFunction, type FitBoundsOptions, type EaseToOptions, type FlyToOptions, type JumpToOptions, type AnimationOptions, type CameraForBoundsOptions, type CenterZoomBearing} from './camera.ts';\nimport {LngLat} from '../geo/lng_lat.ts';\nimport {LngLatBounds} from '../geo/lng_lat_bounds.ts';\nimport Point from '@mapbox/point-geometry';\nimport {AttributionControl, type AttributionControlOptions, defaultAttributionControlOptions} from './control/attribution_control.ts';\nimport {LogoControl} from './control/logo_control.ts';\nimport {RGBAImage} from '../util/image.ts';\nimport {type Event, ErrorEvent, type Listener, Evented} from '../util/evented.ts';\nimport {type MapEventType, type MapLayerEventType, MapMouseEvent, MapSourceDataEvent, MapStyleDataEvent, MapLibreEvent, MapMovementEvent, MapTerrainEvent, MapProjectionEvent, MapContextEvent} from './events.ts';\nimport {TaskQueue} from '../util/task_queue.ts';\nimport {throttle} from '../util/throttle.ts';\nimport {Terrain} from '../render/terrain.ts';\nimport {RenderToTexture} from '../webgl/render_to_texture.ts';\nimport {config} from '../util/config.ts';\nimport {defaultLocale} from './default_locale.ts';\nimport {isAbortError} from '../util/abort_error.ts';\nimport {coveringTiles, type CoveringTilesOptions, createCalculateTileZoomFunction} from '../geo/projection/covering_tiles.ts';\nimport {CanonicalTileID, type OverscaledTileID} from '../tile/tile_id.ts';\n\nimport type {PaddingOptions} from '../geo/edge_insets.ts';\nimport type {Source} from '../source/source.ts';\nimport type {StyleLayer} from '../style/style_layer.ts';\nimport type {RequestTransformFunction} from '../util/request_manager.ts';\nimport type {LngLatLike} from '../geo/lng_lat.ts';\nimport type {LngLatBoundsLike} from '../geo/lng_lat_bounds.ts';\nimport type {AddLayerObject, FeatureIdentifier, StyleOptions, StyleSetterOptions} from '../style/style.ts';\nimport type {StyleImage, StyleImageInterface, StyleImageMetadata} from '../style/style_image.ts';\nimport type {PointLike} from './camera.ts';\nimport type {ScrollZoomHandler} from './handler/scroll_zoom.ts';\nimport type {BoxZoomHandler, BoxZoomHandlerOptions} from './handler/box_zoom.ts';\nimport type {AroundCenterOptions, TwoFingersTouchPitchHandler} from './handler/two_fingers_touch.ts';\nimport type {DragRotateHandler} from './handler/shim/drag_rotate.ts';\nimport type {DragPanHandler, DragPanOptions} from './handler/shim/drag_pan.ts';\nimport type {CooperativeGesturesHandler, GestureOptions} from './handler/cooperative_gestures.ts';\nimport type {KeyboardHandler} from './handler/keyboard.ts';\nimport type {DoubleClickZoomHandler} from './handler/shim/dblclick_zoom.ts';\nimport type {TwoFingersTouchZoomRotateHandler} from './handler/shim/two_fingers_touch.ts';\nimport type {TaskID} from '../util/task_queue.ts';\nimport type {\n    FilterSpecification,\n    StyleSpecification,\n    LightSpecification,\n    SourceSpecification,\n    TerrainSpecification,\n    ProjectionSpecification,\n    SkySpecification,\n    AllPaintProperties,\n    AllLayoutProperties,\n} from '@maplibre/maplibre-gl-style-spec';\nimport type {CanvasSourceSpecification} from '../source/canvas_source.ts';\nimport type {GeoJSONFeature, MapGeoJSONFeature} from '../util/vectortile_to_geojson.ts';\nimport type {ControlPosition, IControl} from './control/control.ts';\nimport type {QueryRenderedFeaturesOptions, QuerySourceFeatureOptions} from '../source/query_features.ts';\nimport type {ITransform, TransformConstrainFunction} from '../geo/transform_interface.ts';\nimport type {ICameraHelper} from '../geo/projection/camera_helper.ts';\n\nconst version = packageJSON.version;\n\nexport type ContextType = 'webgl2';\n/** @deprecated Use {@link ContextType} instead. */\nexport type WebGLSupportedVersions = ContextType | undefined;\nexport type WebGLContextAttributesWithType = WebGLContextAttributes & {contextType?: ContextType};\n\n/**\n * The {@link Map} options object.\n */\nexport type MapOptions = {\n    /**\n     * If `true`, the map's position (zoom, center latitude, center longitude, bearing, and pitch) will be synced with the hash fragment of the page's URL.\n     * For example, `https://example.com#2.59/39.26/53.07/-24.1/60`.\n     *\n     * An additional string may optionally be provided as an alternative to indicate a parameter-styled hash.\n     * For example, passing `hash: \"foo\"` will produce a hash like `https://example.com#foo=2.59/39.26/53.07/-24.1/60`.\n     * This is usefull for allowing multiple maps or other state.\n     * @defaultValue false\n     */\n    hash?: boolean | string;\n    /**\n     * If `false`, no mouse, touch, or keyboard listeners will be attached to the map, so it will not respond to interaction.\n     * @defaultValue true\n     */\n    interactive?: boolean;\n    /**\n     * The HTML element in which MapLibre GL JS will render the map, or the element's string `id`. The specified element must have no children.\n     */\n    container: HTMLElement | string;\n    /**\n     * The threshold, measured in degrees, that determines when the map's\n     * bearing will snap to north. For example, with a `bearingSnap` of 7, if the user rotates\n     * the map within 7 degrees of north, the map will automatically snap to exact north.\n     * @defaultValue 7\n     */\n    bearingSnap?: number;\n    /**\n     * The step increment the zoom level will snap to.\n     * For example, if `zoomSnap` is 1, the map will snap to whole integers during discrete zoom operations.\n     * If set to 0, zooming is continuous.\n     * @defaultValue 0\n     */\n    zoomSnap?: number;\n    /**\n     * If set, an {@link AttributionControl} will be added to the map with the provided options.\n     * To disable the attribution control, pass `false`.\n     * !!! note\n     *     Showing the logo of MapLibre is not required for using MapLibre.\n     * @defaultValue compact: true, customAttribution: \"MapLibre ...\".\n     */\n    attributionControl?: false | AttributionControlOptions;\n    /**\n     * If `true`, the MapLibre logo will be shown.\n     */\n    maplibreLogo?: boolean;\n    /**\n     * A string representing the position of the MapLibre wordmark on the map. Valid options are `top-left`,`top-right`, `bottom-left`, or `bottom-right`.\n     * @defaultValue 'bottom-left'\n     */\n    logoPosition?: ControlPosition;\n    /**\n     * Set of WebGLContextAttributes that are applied to the WebGL context of the map.\n     * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext for more details.\n     * `contextType` is restricted to `'webgl2'`. This option is kept as a forward-looking API for future WebGPU support.\n     * @defaultValue antialias: false, powerPreference: 'high-performance', preserveDrawingBuffer: false, failIfMajorPerformanceCaveat: false, desynchronized: false, contextType: 'webgl2'\n     */\n    canvasContextAttributes?: WebGLContextAttributesWithType;\n    /**\n     * If `false`, the map won't attempt to re-request tiles once they expire per their HTTP `cacheControl`/`expires` headers.\n     * @defaultValue true\n     */\n    refreshExpiredTiles?: boolean;\n    /**\n     * If set, the map will be constrained to the given bounds.\n     */\n    maxBounds?: LngLatBoundsLike;\n    /**\n     * If `true`, the \"scroll to zoom\" interaction is enabled. {@link AroundCenterOptions} are passed as options to {@link ScrollZoomHandler.enable}.\n     * @defaultValue true\n     */\n    scrollZoom?: boolean | AroundCenterOptions;\n    /**\n     * The minimum zoom level of the map. Users cannot zoom out beyond this level. (0–24)\n     * @defaultValue 0\n     */\n    minZoom?: number | null;\n    /**\n     * The maximum zoom level of the map. Users cannot zoom in beyond this level. (0–24)\n     * @defaultValue 22\n     */\n    maxZoom?: number | null;\n    /**\n     * The minimum pitch of the map (0-180).\n     * @defaultValue 0\n     */\n    minPitch?: number | null;\n    /**\n     * The maximum pitch of the map (0-180).\n     * @defaultValue 60\n     */\n    maxPitch?: number | null;\n    /**\n     * The pitch above which to apply anisotropic filtering to the map's raster layers (0-180).\n     * @defaultValue 20\n     */\n    anisotropicFilterPitch?: number | null;\n    /**\n     * If `true`, the \"box zoom\" interaction is enabled (see {@link BoxZoomHandler}).\n     * An `Object` value configures {@link BoxZoomHandler} options.\n     * If `boxZoomEnd` is provided, the callback runs instead of the default fit-to-box zoom.\n     * @defaultValue true\n     */\n    boxZoom?: boolean | BoxZoomHandlerOptions;\n    /**\n     * If `true`, the \"drag to rotate\" interaction is enabled (see {@link DragRotateHandler}).\n     * @defaultValue true\n     */\n    dragRotate?: boolean;\n    /**\n     * If `true`, the \"drag to pan\" interaction is enabled. An `Object` value is passed as options to {@link DragPanHandler.enable}.\n     * @defaultValue true\n     */\n    dragPan?: boolean | DragPanOptions;\n    /**\n     * If `true`, keyboard shortcuts are enabled (see {@link KeyboardHandler}).\n     * @defaultValue true\n     */\n    keyboard?: boolean;\n    /**\n     * If `true`, the \"double click to zoom\" interaction is enabled (see {@link DoubleClickZoomHandler}).\n     * @defaultValue true\n     */\n    doubleClickZoom?: boolean;\n    /**\n     * If `true`, the \"pinch to rotate and zoom\" interaction is enabled. An `Object` value is passed as options to {@link TwoFingersTouchZoomRotateHandler.enable}.\n     * @defaultValue true\n     */\n    touchZoomRotate?: boolean | AroundCenterOptions;\n    /**\n     * If `true`, the \"drag to pitch\" interaction is enabled. An `Object` value is passed as options to {@link TwoFingersTouchPitchHandler.enable}.\n     * @defaultValue true\n     */\n    touchPitch?: boolean | AroundCenterOptions;\n    /**\n     * If `true` or set to an options object, the map is only accessible on desktop while holding Command/Ctrl and only accessible on mobile with two fingers. Interacting with the map using normal gestures will trigger an informational screen. With this option enabled, \"drag to pitch\" requires a three-finger gesture. Cooperative gestures are disabled when a map enters fullscreen using {@link FullscreenControl}.\n     * @defaultValue false\n     */\n    cooperativeGestures?: GestureOptions;\n    /**\n     * If `true`, the map will automatically resize when the browser window resizes.\n     * @defaultValue true\n     */\n    trackResize?: boolean;\n    /**\n     * The initial geographical centerpoint of the map. If `center` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]`\n     * !!! note\n     *     MapLibre GL JS uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.\n     * @defaultValue [0, 0]\n     */\n    center?: LngLatLike;\n    /**\n     * The elevation of the initial geographical centerpoint of the map, in meters above sea level. If `elevation` is not specified in the constructor options, it will default to `0`.\n     * @defaultValue 0\n     */\n    elevation?: number;\n    /**\n     * The initial zoom level of the map. If `zoom` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n     * @defaultValue 0\n     */\n    zoom?: number;\n    /**\n     * The initial bearing (rotation) of the map, measured in degrees counter-clockwise from north. If `bearing` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n     * @defaultValue 0\n     */\n    bearing?: number;\n    /**\n     * The initial pitch (tilt) of the map, measured in degrees away from the plane of the screen (0-85). If `pitch` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`. Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project.\n     * @defaultValue 0\n     */\n    pitch?: number;\n    /**\n     * The initial roll angle of the map, measured in degrees counter-clockwise about the camera boresight. If `roll` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n     * @defaultValue 0\n     */\n    roll?: number;\n    /**\n     * If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:\n     *\n     * - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire\n     * container, there will be blank space beyond 180 and -180 degrees longitude.\n     * - Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the\n     * map and the other on the left edge of the map) at every zoom level.\n     * @defaultValue true\n     */\n    renderWorldCopies?: boolean;\n    /**\n     * The maximum number of tiles stored in the tile cache for a given source. If omitted, the cache will be dynamically sized based on the current viewport which can be set using `maxTileCacheZoomLevels` constructor options.\n     * @defaultValue null\n     */\n    maxTileCacheSize?: number | null;\n    /**\n     * The maximum number of zoom levels for which to store tiles for a given source. Tile cache dynamic size is calculated by multiplying `maxTileCacheZoomLevels` with the approximate number of tiles in the viewport for a given source.\n     * @defaultValue 5\n     */\n    maxTileCacheZoomLevels?: number;\n    /**\n     * A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.\n     * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties.\n     * @defaultValue null\n     */\n    transformRequest?: RequestTransformFunction | null;\n    /**\n     * A callback run before the map's camera is moved due to user input or animation. The callback can be used to modify the new center, zoom, pitch and bearing.\n     * Expected to return an object containing center, zoom, pitch or bearing values to overwrite.\n     * @defaultValue null\n     */\n    transformCameraUpdate?: CameraUpdateTransformFunction | null;\n    /**\n     * A callback that overrides how the map constrains the viewport's lnglat and zoom to respect the longitude and latitude bounds.\n     * @see [Customize the map transform constrain](https://maplibre.org/maplibre-gl-js/docs/examples/customize-the-map-transform-constrain/)\n     * Expected to return an object containing center and zoom.\n     * @defaultValue null\n     */\n    transformConstrain?: TransformConstrainFunction | null;\n    /**\n     * A patch to apply to the default localization table for UI strings, e.g. control tooltips. The `locale` object maps namespaced UI string IDs to translated strings in the target language; see `src/ui/default_locale.js` for an example with all supported string IDs. The object may specify all UI strings (thereby adding support for a new translation) or only a subset of strings (thereby patching the default translation table).\n     * For an example, see https://maplibre.org/maplibre-gl-js/docs/examples/locale-switching/\n     * Alternatively, search the official plugins page for plugins related to localization.\n     * @defaultValue null\n     */\n    locale?: Record<string, string>;\n    /**\n     * Controls the duration of the fade-in/fade-out animation for label collisions after initial map load, in milliseconds. This setting affects all symbol layers. This setting does not affect the duration of runtime styling transitions or raster tile cross-fading.\n     * @defaultValue 300\n     */\n    fadeDuration?: number;\n    /**\n     * If `true`, symbols from multiple sources can collide with each other during collision detection. If `false`, collision detection is run separately for the symbols in each source.\n     * @defaultValue true\n     */\n    crossSourceCollisions?: boolean;\n    /**\n     * If `true`, Resource Timing API information will be collected for requests made by GeoJSON and Vector Tile web workers (this information is normally inaccessible from the main Javascript thread). Information will be returned in a `resourceTiming` property of relevant `data` events.\n     * @defaultValue false\n     */\n    collectResourceTiming?: boolean;\n    /**\n     * The max number of pixels a user can shift the mouse pointer during a click for it to be considered a valid click (as opposed to a mouse drag).\n     * @defaultValue 3\n     */\n    clickTolerance?: number;\n    /**\n     * The initial bounds of the map. If `bounds` is specified, it overrides `center` and `zoom` constructor options.\n     */\n    bounds?: LngLatBoundsLike;\n    /**\n     * A {@link FitBoundsOptions} options object to use _only_ when fitting the initial `bounds` provided above.\n     */\n    fitBoundsOptions?: FitBoundsOptions;\n    /**\n     * Defines a CSS\n     * font-family for locally overriding generation of Chinese, Japanese, and Korean characters.\n     * For these characters, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).\n     * Set to `false`, to enable font settings from the map's style for these glyph ranges.\n     * The purpose of this option is to avoid bandwidth-intensive glyph server requests.\n     * @see [Use locally generated ideographs](https://maplibre.org/maplibre-gl-js/docs/examples/use-locally-generated-ideographs/)\n     * @defaultValue 'sans-serif'\n     */\n    localIdeographFontFamily?: string | false;\n    /**\n     * The map's MapLibre style. This must be a JSON object conforming to\n     * the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/),\n     * or a URL to such JSON.\n     * When the style is not specified, calling {@link Map.setStyle} is required to render the map.\n     */\n    style?: StyleSpecification | string;\n    /**\n     * If `false`, the map's pitch (tilt) control with \"drag to rotate\" interaction will be disabled.\n     * @defaultValue true\n     */\n    pitchWithRotate?: boolean;\n    /**\n     * If `false`, the map's roll control with \"drag to rotate\" interaction will be disabled.\n     * @defaultValue false\n     */\n    rollEnabled?: boolean;\n    /**\n     * Degrees the map's bearing changes per pixel of horizontal drag when rotating.\n     * @defaultValue 0.8\n     */\n    rotateSpeed?: number;\n    /**\n     * Degrees the map's pitch changes per pixel of vertical drag. Negative, so that\n     * dragging up pitches the map toward the horizon.\n     * @defaultValue -0.5\n     */\n    pitchSpeed?: number;\n    /**\n     * If `true`, gesture inertia (such as panning) is disabled. If not provided, gesture inertia defaults to the user's device settings.\n     * @defaultValue undefined\n     */\n    reduceMotion?: boolean | undefined;\n    /**\n     * The pixel ratio.\n     * The canvas' `width` attribute will be `container.clientWidth * pixelRatio` and its `height` attribute will be `container.clientHeight * pixelRatio`. Defaults to `devicePixelRatio` if not specified.\n     */\n    pixelRatio?: number;\n    /**\n     * If false, style validation will be skipped.\n     * Useful in production environments due to enabling tree-shaking of the validation code in some environments and minor performance improvements.\n     * Disabling this option comes at the cost of less clear error messages\n     * @defaultValue true\n     */\n    validateStyle?: boolean;\n    /**\n     * The canvas' `width` and `height` max size. The values are passed as an array where the first element is max width and the second element is max height.\n     * You shouldn't set this above WebGl `MAX_TEXTURE_SIZE`.\n     * @defaultValue [4096, 4096].\n     */\n    maxCanvasSize?: [number, number];\n    /**\n     * Determines whether to cancel, or retain, tiles from the current viewport which are still loading but which belong to a farther (smaller) zoom level than the current one.\n     * * If `true`, when zooming in, tiles which didn't manage to load for previous zoom levels will become canceled. This might save some computing resources for slower devices, but the map details might appear more abruptly at the end of the zoom.\n     * * If `false`, when zooming in, the previous zoom level(s) tiles will progressively appear, giving a smoother map details experience. However, more tiles will be rendered in a short period of time.\n     * @defaultValue true\n     */\n    cancelPendingTileRequestsWhileZooming?: boolean;\n    /**\n     * If true, the elevation of the center point will automatically be set to the terrain elevation\n     * (or zero if terrain is not enabled). If false, the elevation of the center point will default\n     * to sea level and will not automatically update. Defaults to true. Needs to be set to false to\n     * keep the camera above ground when pitch \\> 90 degrees.\n     */\n    centerClampedToGround?: boolean;\n    /**\n     * Controls the length of the vertical extensions which are added to the edges of terrain tiles.\n     *\n     * If the skirts are introducing visually unappealing vertical artifacts, consider avoiding transparent or semi-transparent backgrounds,\n     * for example, by having the first layer be a background layer with a [`background-color`](https://maplibre.org/maplibre-style-spec/layers/#background-color).\n     * If that is impossible or insufficient, you can entirely disable skirts,\n     * at the cost of potentially introducing some horizontal hairline gaps (stitches) on tile boundaries with different zoomlevels for some terrain datasets.\n     *\n     * - `\"none\"` disables skirts entirely.\n     * - `\"auto\"` renders skirts with an automatically chosen length.\n     * @defaultValue \"auto\"\n     */\n    terrainSkirtLength?: 'none' | 'auto';\n    /**\n     * Defines the number of zoom level that will overscale instead of split tiles below (inclusive) a map's `maxZoom`.\n     * When `undefined`, all zoom levels after source's max zoom will be overscaled.\n     *\n     * This can help in reducing the size of the overscaling and improve performance in high zoom levels.\n     * The drawback is that it changes rendering for polygon centered labels and changes the results of query rendered features.\n     *\n     * For example if map's `maxZoom` is 20, the source's `maxzoom` is 10 (tiles are avaliable until zoom 10) and `zoomLevelsToOverscale` is set to 3:\n     * - The zoom levels of 20, 19, 18 will be overscaled.\n     * - The zoom levels 11 to 17 will be split.\n     * @defaultValue 4\n     */\n    zoomLevelsToOverscale?: number;\n    /**\n     * Determines the rotation interaction model:\n     * - When true: Uses \"Orbital\" logic where rotation is relative to the pivot center.\n     *   Dragging right at the top rotates clockwise, while dragging right at the bottom\n     *   rotates counter-clockwise (like spinning a physical globe).\n     * - When false: Uses \"Linear\" logic where horizontal mouse movement translates directly\n     *   to bearing change regardless of cursor position.\n     */\n    aroundCenter?: boolean;\n};\n\nexport type AddImageOptions = {\n\n};\n\n/**\n * Image data accepted by {@link Map.addImage}.\n */\nexport type StyleImageSource = HTMLImageElement | ImageBitmap | ImageData | {\n    width: number;\n    height: number;\n    data: Uint8Array | Uint8ClampedArray;\n} | StyleImageInterface;\n\n/**\n * Callback used by {@link Map.setMissingStyleImageResolver} to resolve missing style images,\n * typically by calling {@link Map.addImage}. MapLibre awaits the returned promise before\n * treating the image as missing.\n */\nexport type MissingStyleImageResolver = (id: string) => void | Promise<void>;\n\n// This type is used inside map since all properties are assigned a default value.\nexport type CompleteMapOptions = Complete<MapOptions>;\n\ntype DelegatedListener = {\n    layers: string[];\n    listener: Listener;\n    delegates: {[E in keyof MapEventType]?: Delegate<MapEventType[E]>};\n};\n\ntype Delegate<E extends Event = Event> = (e: E) => void;\n\ntype LostContextStyle = {\n    style: StyleSpecification | null;\n    images: {[_: string]: StyleImage} | null;\n};\n\nconst defaultMinZoom = -2;\nconst defaultMaxZoom = 22;\n\n// the default values, but also the valid range\nconst defaultMinPitch = 0;\nconst defaultMaxPitch = 60;\nconst defaultAnisotropicFilterPitch = 20;\n\n// use this variable to check maxPitch and anisotropicFilterPitch for validity\nconst maxPitchThreshold = 180;\n\nconst defaultOptions: Readonly<Partial<MapOptions>> = {\n    hash: false,\n    interactive: true,\n    bearingSnap: 7,\n    zoomSnap: 0,\n    attributionControl: defaultAttributionControlOptions,\n    maplibreLogo: false,\n    refreshExpiredTiles: true,\n\n    canvasContextAttributes: {\n        antialias: false,\n        preserveDrawingBuffer: false,\n        powerPreference: 'high-performance',\n        failIfMajorPerformanceCaveat: false,\n        desynchronized: false,\n        contextType: undefined\n    },\n\n    scrollZoom: true,\n    minZoom: defaultMinZoom,\n    maxZoom: defaultMaxZoom,\n    minPitch: defaultMinPitch,\n    maxPitch: defaultMaxPitch,\n\n    boxZoom: true,\n    dragRotate: true,\n    dragPan: true,\n    keyboard: true,\n    doubleClickZoom: true,\n    touchZoomRotate: true,\n    touchPitch: true,\n    cooperativeGestures: false,\n\n    trackResize: true,\n\n    center: [0, 0],\n    elevation: 0,\n    zoom: 0,\n    bearing: 0,\n    pitch: 0,\n    roll: 0,\n\n    renderWorldCopies: true,\n    maxTileCacheSize: null,\n    maxTileCacheZoomLevels: config.MAX_TILE_CACHE_ZOOM_LEVELS,\n    transformRequest: null,\n    transformCameraUpdate: null,\n    transformConstrain: null,\n    fadeDuration: 300,\n    crossSourceCollisions: true,\n    clickTolerance: 3,\n    localIdeographFontFamily: 'sans-serif',\n    pitchWithRotate: true,\n    rollEnabled: false,\n    rotateSpeed: 0.8,\n    pitchSpeed: -0.5,\n    reduceMotion: undefined,\n    validateStyle: true,\n    /**Because GL MAX_TEXTURE_SIZE is usually at least 4096px. */\n    maxCanvasSize: [4096, 4096],\n    cancelPendingTileRequestsWhileZooming: true,\n    centerClampedToGround: true,\n    terrainSkirtLength: 'auto',\n    zoomLevelsToOverscale: 4,\n    anisotropicFilterPitch: defaultAnisotropicFilterPitch,\n};\n\n/**\n * The `Map` object represents the map on your page. It exposes methods\n * and properties that enable you to programmatically change the map,\n * and fires events as users interact with it.\n *\n * You create a `Map` by specifying a `container` and other options, see {@link MapOptions} for the full list.\n * Then MapLibre GL JS initializes the map on the page and returns your `Map` object.\n *\n * @group Main\n *\n * @example\n * ```ts\n * let map = new Map({\n *   container: 'map',\n *   center: [-122.420679, 37.772537],\n *   zoom: 13,\n *   style: style_object,\n *   hash: true,\n *   transformRequest: (url, resourceType)=> {\n *     if(resourceType === 'Source' && url.startsWith('http://myHost')) {\n *       return {\n *        url: url.replace('http', 'https'),\n *        headers: { 'my-custom-header': true},\n *        credentials: 'include'  // Include cookies for cross-origin requests\n *      }\n *     }\n *   }\n * });\n * ```\n * @see [Display a map](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-map/)\n */\nexport class Map extends Evented<MapEventType> {\n    terrain: Terrain;\n    style: Style;\n    painter: Painter;\n    _camera: Camera;\n    _handlers: HandlerManager;\n    _container: HTMLElement;\n    _canvasContainer: HTMLElement;\n    _controlContainer: HTMLElement;\n    _controlPositions: Partial<Record<ControlPosition, HTMLElement>>;\n    _interactive: boolean;\n    _showTileBoundaries: boolean;\n    _showCollisionBoxes: boolean;\n    _showPadding: boolean;\n    _showOverdrawInspector: boolean;\n    _repaint: boolean;\n    _vertices: boolean;\n    _canvas: HTMLCanvasElement;\n    _maxTileCacheSize: number | null;\n    _maxTileCacheZoomLevels: number;\n    _frameRequest: AbortController;\n    _styleDirty: boolean;\n    _sourcesDirty: boolean;\n    _placementDirty: boolean;\n    _anisotropicFilterPitch: number;\n\n    _loaded: boolean;\n    _idleTriggered = false;\n    // accounts for placement finishing as well\n    _fullyLoaded: boolean;\n    _trackResize: boolean;\n    _resizeObserver: ResizeObserver;\n    _canvasContextAttributes: WebGLContextAttributesWithType;\n    _refreshExpiredTiles: boolean;\n    _hash: Hash;\n    _delegatedListeners: Record<keyof MapEventType, DelegatedListener[]>;\n    _fadeDuration: number;\n    _crossSourceCollisions: boolean;\n    _crossFadingFactor = 1;\n    _collectResourceTiming: boolean;\n    _renderTaskQueue: TaskQueue = new TaskQueue();\n    _controls: IControl[] = [];\n    _mapId: number = uniqueId();\n    _localIdeographFontFamily: string | false;\n    _validateStyle: boolean;\n    _requestManager: RequestManager;\n    _locale: Record<string, string>;\n    _removed: boolean;\n    _diffStyleRequest: AbortController;\n    _clickTolerance: number;\n    _overridePixelRatio: number | null | undefined;\n    _maxCanvasSize: [number, number];\n    _terrainDataCallback: (e: MapStyleDataEvent | MapSourceDataEvent) => void;\n    _missingStyleImageResolver: MissingStyleImageResolver | null = null;\n    /** @internal */\n    _zoomLevelsToOverscale: number | undefined;\n    _terrainSkirtLength: 'none' | 'auto';\n\n    /**\n     * @internal\n     * The window that owns the map container element, for cross-window support.\n     * Returns `typeof window` to include global constructors like ResizeObserver.\n     */\n    get _ownerWindow(): typeof window {\n        return this._container?.ownerDocument?.defaultView || window;\n    }\n\n    /**\n     * @internal\n     * image queue throttling handle. To be used later when clean up\n     */\n    _imageQueueHandle: number;\n\n    /**\n     * @internal\n     * Used to store the previous style and images when a context loss occurs, so they can be restored.\n     */\n    _lostContextStyle: LostContextStyle = {\n        style: null,\n        images: null\n    };\n\n    /**\n     * The map's {@link ScrollZoomHandler}, which implements zooming in and out with a scroll wheel or trackpad.\n     * Find more details and examples using `scrollZoom` in the {@link ScrollZoomHandler} section.\n     */\n    scrollZoom: ScrollZoomHandler;\n\n    /**\n     * The map's {@link BoxZoomHandler}, which implements zooming using a drag gesture with the Shift key pressed.\n     * Find more details and examples using `boxZoom` in the {@link BoxZoomHandler} section.\n     */\n    boxZoom: BoxZoomHandler;\n\n    /**\n     * The map's {@link DragRotateHandler}, which implements rotating the map while dragging with the right\n     * mouse button or with the Control key pressed. Find more details and examples using `dragRotate`\n     * in the {@link DragRotateHandler} section.\n     */\n    dragRotate: DragRotateHandler;\n\n    /**\n     * The map's {@link DragPanHandler}, which implements dragging the map with a mouse or touch gesture.\n     * Find more details and examples using `dragPan` in the {@link DragPanHandler} section.\n     */\n    dragPan: DragPanHandler;\n\n    /**\n     * The map's {@link KeyboardHandler}, which allows the user to zoom, rotate, and pan the map using keyboard\n     * shortcuts. Find more details and examples using `keyboard` in the {@link KeyboardHandler} section.\n     */\n    keyboard: KeyboardHandler;\n\n    /**\n     * The map's {@link DoubleClickZoomHandler}, which allows the user to zoom by double clicking.\n     * Find more details and examples using `doubleClickZoom` in the {@link DoubleClickZoomHandler} section.\n     */\n    doubleClickZoom: DoubleClickZoomHandler;\n\n    /**\n     * The map's {@link TwoFingersTouchZoomRotateHandler}, which allows the user to zoom or rotate the map with touch gestures.\n     * Find more details and examples using `touchZoomRotate` in the {@link TwoFingersTouchZoomRotateHandler} section.\n     */\n    touchZoomRotate: TwoFingersTouchZoomRotateHandler;\n\n    /**\n     * The map's {@link TwoFingersTouchPitchHandler}, which allows the user to pitch the map with touch gestures.\n     * Find more details and examples using `touchPitch` in the {@link TwoFingersTouchPitchHandler} section.\n     */\n    touchPitch: TwoFingersTouchPitchHandler;\n\n    /**\n     * The map's {@link CooperativeGesturesHandler}, which allows the user to see cooperative gesture info when user tries to zoom in/out.\n     * Find more details and examples using `cooperativeGestures` in the {@link CooperativeGesturesHandler} section.\n     */\n    cooperativeGestures: CooperativeGesturesHandler;\n\n    /**\n     * The map's property which determines whether to cancel, or retain, tiles from the current viewport which are still loading but which belong to a farther (smaller) zoom level than the current one.\n     * * If `true`, when zooming in, tiles which didn't manage to load for previous zoom levels will become canceled. This might save some computing resources for slower devices, but the map details might appear more abruptly at the end of the zoom.\n     * * If `false`, when zooming in, the previous zoom level(s) tiles will progressively appear, giving a smoother map details experience. However, more tiles will be rendered in a short period of time.\n     * @defaultValue true\n     */\n    cancelPendingTileRequestsWhileZooming: boolean;\n\n    constructor(options: MapOptions) {\n        super();\n        const resolvedOptions = {...defaultOptions, ...options, canvasContextAttributes: {\n            ...defaultOptions.canvasContextAttributes,\n            ...options.canvasContextAttributes\n        }} as CompleteMapOptions;\n\n        if (resolvedOptions.minZoom != null && resolvedOptions.maxZoom != null && resolvedOptions.minZoom > resolvedOptions.maxZoom) {\n            throw new Error('maxZoom must be greater than or equal to minZoom');\n        }\n\n        if (resolvedOptions.minPitch != null && resolvedOptions.maxPitch != null && resolvedOptions.minPitch > resolvedOptions.maxPitch) {\n            throw new Error('maxPitch must be greater than or equal to minPitch');\n        }\n\n        if (resolvedOptions.minPitch != null && resolvedOptions.minPitch < defaultMinPitch) {\n            throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);\n        }\n\n        if (resolvedOptions.maxPitch != null && resolvedOptions.maxPitch > maxPitchThreshold) {\n            throw new Error(`maxPitch must be less than or equal to ${maxPitchThreshold}`);\n        }\n\n        this._camera = new Camera({\n            minZoom: resolvedOptions.minZoom,\n            maxZoom: resolvedOptions.maxZoom,\n            minPitch: resolvedOptions.minPitch,\n            maxPitch: resolvedOptions.maxPitch,\n            bearingSnap: resolvedOptions.bearingSnap,\n            zoomSnap: resolvedOptions.zoomSnap,\n            renderWorldCopies: resolvedOptions.renderWorldCopies,\n            centerClampedToGround: resolvedOptions.centerClampedToGround,\n            terrain: this.terrain,\n            transformConstrain: resolvedOptions.transformConstrain,\n            requestRenderFrame: (callback) => this._requestRenderFrame(callback),\n            cancelRenderFrame: (id) => this._cancelRenderFrame(id),\n            transformCameraUpdate: resolvedOptions.transformCameraUpdate,\n            stopHandlers: () => this._handlers?.stop(false),\n        });\n        this._camera.setEventedParent(this);\n\n        this._interactive = resolvedOptions.interactive;\n        this._maxTileCacheSize = resolvedOptions.maxTileCacheSize;\n        this._maxTileCacheZoomLevels = resolvedOptions.maxTileCacheZoomLevels;\n        this._canvasContextAttributes = {...resolvedOptions.canvasContextAttributes};\n        this._trackResize = resolvedOptions.trackResize === true;\n        this._terrainSkirtLength = resolvedOptions.terrainSkirtLength;\n        this._refreshExpiredTiles = resolvedOptions.refreshExpiredTiles === true;\n        this._fadeDuration = resolvedOptions.fadeDuration;\n        this._crossSourceCollisions = resolvedOptions.crossSourceCollisions === true;\n        this._collectResourceTiming = resolvedOptions.collectResourceTiming === true;\n        this._locale = {...defaultLocale, ...resolvedOptions.locale};\n        this._clickTolerance = resolvedOptions.clickTolerance;\n        this._overridePixelRatio = resolvedOptions.pixelRatio;\n        this._maxCanvasSize = resolvedOptions.maxCanvasSize;\n        this._zoomLevelsToOverscale = resolvedOptions.zoomLevelsToOverscale;\n        this.cancelPendingTileRequestsWhileZooming = resolvedOptions.cancelPendingTileRequestsWhileZooming === true;\n        this.setAnisotropicFilterPitch(resolvedOptions.anisotropicFilterPitch);\n\n        if (resolvedOptions.reduceMotion !== undefined) {\n            browser.prefersReducedMotion = resolvedOptions.reduceMotion;\n        }\n\n        this._imageQueueHandle = ImageRequest.addThrottleControl(() => this.isMoving());\n\n        this._requestManager = new RequestManager(resolvedOptions.transformRequest);\n\n        this._container = this._resolveContainer(resolvedOptions.container);\n\n        if (resolvedOptions.maxBounds) {\n            this.setMaxBounds(resolvedOptions.maxBounds);\n        }\n\n        this._setupContainer();\n        this._setupPainter();\n        if (!this.painter) return;\n\n        this.on('move', () => this._update(false));\n        this.on('moveend', () => this._update(false));\n        this.on('zoom', () => this._update(true));\n        this.on('terrain', () => {\n            this.painter.terrainFacilitator.depthDirty = true;\n            this._update(true);\n        });\n        this.once('idle', () => this._idleTriggered = true);\n\n        this._handlers = new HandlerManager(this, this._camera, resolvedOptions);\n\n        if (typeof window !== 'undefined') {\n            this._ownerWindow.addEventListener('online', this._onWindowOnline, false);\n            this._setupResizeObserver();\n        }\n\n        const hashName = (typeof resolvedOptions.hash === 'string' && resolvedOptions.hash) || undefined;\n        this._hash = resolvedOptions.hash ? (new Hash(hashName)).addTo(this) : undefined;\n        // don't set position from options if set through hash\n        if (!this._hash?._onHashChange()) {\n            this.jumpTo({\n                center: resolvedOptions.center,\n                elevation: resolvedOptions.elevation,\n                zoom: resolvedOptions.zoom,\n                bearing: resolvedOptions.bearing,\n                pitch: resolvedOptions.pitch,\n                roll: resolvedOptions.roll\n            });\n\n            if (resolvedOptions.bounds) {\n                this.resize();\n                this.fitBounds(resolvedOptions.bounds, extend({}, resolvedOptions.fitBoundsOptions, {duration: 0}));\n            }\n        }\n\n        // When no style is set or it's using something other than the globe projection, we can constrain the camera.\n        // When a style is set with other projections though, we can't constrain the camera until the style is loaded\n        // and the correct transform is used. Otherwise, valid points in the desired projection could be rejected\n        const shouldConstrainUsingMercatorTransform = typeof resolvedOptions.style === 'string' || !(resolvedOptions.style?.projection?.type === 'globe');\n        this.resize(null, shouldConstrainUsingMercatorTransform);\n\n        this._localIdeographFontFamily = resolvedOptions.localIdeographFontFamily;\n        this._validateStyle = resolvedOptions.validateStyle;\n\n        if (resolvedOptions.style) this.setStyle(resolvedOptions.style, {localIdeographFontFamily: resolvedOptions.localIdeographFontFamily});\n\n        if (resolvedOptions.attributionControl)\n            this.addControl(new AttributionControl(typeof resolvedOptions.attributionControl === 'boolean' ? undefined : resolvedOptions.attributionControl));\n\n        if (resolvedOptions.maplibreLogo)\n            this.addControl(new LogoControl(), resolvedOptions.logoPosition);\n\n        this.on('style.load', () => {\n            // If we didn't constrain the camera before, we do it now\n            if (!shouldConstrainUsingMercatorTransform) this._resizeTransform();\n            if (this._camera.transform.unmodified) {\n                const coercedOptions = pick(this.style.stylesheet, ['center', 'zoom', 'bearing', 'pitch', 'roll']) as CameraOptions;\n                this.jumpTo(coercedOptions);\n            }\n        });\n        this.on('data', (event: MapSourceDataEvent | MapStyleDataEvent) => {\n            this._update(event.dataType === 'style');\n            this.fire(event.dataType === 'style' ? new MapStyleDataEvent('styledata', event) : new MapSourceDataEvent('sourcedata', event));\n        });\n        this.on('dataloading', (event: MapSourceDataEvent | MapStyleDataEvent) => {\n            this.fire(event.dataType === 'style' ? new MapStyleDataEvent('styledataloading', event) : new MapSourceDataEvent('sourcedataloading', event));\n        });\n        this.on('dataabort', (event: MapSourceDataEvent | MapStyleDataEvent) => {\n            this.fire(new MapSourceDataEvent('sourcedataabort', event));\n        });\n    }\n\n    /**\n     * @internal\n     * Returns a unique number for this map instance which is used for the MapLoadEvent\n     * to make sure we only fire one event per instantiated map object.\n     * @returns the uniq map ID\n     */\n    _getMapId(): number {\n        return this._mapId;\n    }\n\n    /**\n     * Sets a global state property that can be retrieved with the [`global-state` expression](https://maplibre.org/maplibre-style-spec/expressions/#global-state).\n     * If the value is null, it resets the property to its default value defined in the [`state` style property](https://maplibre.org/maplibre-style-spec/root/#state).\n     *\n     * @param propertyName - The name of the state property to set.\n     * @param value - The value of the state property to set.\n     */\n    setGlobalStateProperty(propertyName: string, value: any): this {\n        this.style.setGlobalStateProperty(propertyName, value);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the global map state\n     *\n     * @returns The map state object.\n    */\n    getGlobalState(): Record<string, any> {\n        return this.style.getGlobalState();\n    }\n\n    /**\n     * Adds an {@link IControl} to the map, calling `control.onAdd(this)`.\n     *\n     * An {@link ErrorEvent} will be fired if the control is invalid.\n     *\n     * @param control - The {@link IControl} to add.\n     * @param position - position on the map to which the control will be added.\n     * Valid values are `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'`.\n     * @example\n     * Add zoom and rotation controls to the map.\n     * ```ts\n     * map.addControl(new NavigationControl());\n     * ```\n     * @see [Display map navigation controls](https://maplibre.org/maplibre-gl-js/docs/examples/display-map-navigation-controls/)\n     */\n    addControl(control: IControl, position?: ControlPosition): this {\n        if (position === undefined) {\n            if (control.getDefaultPosition) {\n                position = control.getDefaultPosition();\n            } else {\n                position = 'top-right';\n            }\n        }\n        if (!control?.onAdd) {\n            return this.fire(new ErrorEvent(new Error(\n                'Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.')));\n        }\n        const controlElement = control.onAdd(this);\n        this._controls.push(control);\n\n        const positionContainer = this._controlPositions[position];\n        if (position.includes('bottom')) {\n            positionContainer.insertBefore(controlElement, positionContainer.firstChild);\n        } else {\n            positionContainer.appendChild(controlElement);\n        }\n        return this;\n    }\n\n    /**\n     * Removes the control from the map.\n     *\n     * An {@link ErrorEvent} will be fired if the control is invalid.\n     *\n     * @param control - The {@link IControl} to remove.\n     * @example\n     * ```ts\n     * // Define a new navigation control.\n     * let navigation = new NavigationControl();\n     * // Add zoom and rotation controls to the map.\n     * map.addControl(navigation);\n     * // Remove zoom and rotation controls from the map.\n     * map.removeControl(navigation);\n     * ```\n     */\n    removeControl(control: IControl): this {\n        if (!control?.onRemove) {\n            return this.fire(new ErrorEvent(new Error(\n                'Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.')));\n        }\n        const ci = this._controls.indexOf(control);\n        if (ci > -1) this._controls.splice(ci, 1);\n        control.onRemove(this);\n        return this;\n    }\n\n    /**\n     * Checks if a control exists on the map.\n     *\n     * @param control - The {@link IControl} to check.\n     * @returns true if map contains control.\n     * @example\n     * ```ts\n     * // Define a new navigation control.\n     * let navigation = new NavigationControl();\n     * // Add zoom and rotation controls to the map.\n     * map.addControl(navigation);\n     * // Check that the navigation control exists on the map.\n     * map.hasControl(navigation);\n     * ```\n     */\n    hasControl(control: IControl): boolean {\n        return this._controls.includes(control);\n    }\n\n    /**\n    * Returns an array of `OverscaledTileID` objects that cover the current viewport for a given tile size.\n    * This method is useful for determining which tiles are visible in the current viewport.\n    *\n    * @param options - Options for calculating the covering tiles.\n    * @returns An array of `OverscaledTileID` objects.\n    * @example\n    * ```ts\n    * // Get the tiles to cover the view for a 512x512px tile source\n    * const tiles = map.coveringTiles({tileSize: 512});\n    * ```\n    */\n    coveringTiles(options: CoveringTilesOptions): OverscaledTileID[] {\n        return coveringTiles(this._camera.transform, options);\n    }\n\n    /**\n     * Sets the callback used to defer camera updates or apply arbitrary constraints.\n     * If specified, this Camera instance can be used as a stateless component in React etc.\n     */\n    setTransformCameraUpdate(value: CameraUpdateTransformFunction | null): void { this._camera.transformCameraUpdate = value; }\n\n    /**\n     * Returns the map's geographical centerpoint.\n     *\n     * @returns The map's geographical centerpoint.\n     * @example\n     * Return a LngLat object such as `{lng: 0, lat: 0}`\n     * ```ts\n     * let center = map.getCenter();\n     * // access longitude and latitude values directly\n     * let {lng, lat} = map.getCenter();\n     * ```\n     */\n    getCenter(): LngLat { return new LngLat(this._camera.transform.center.lng, this._camera.transform.center.lat); }\n    /**\n     * Sets the map's geographical centerpoint. Equivalent to `jumpTo({center: center})`.\n     *\n     * Triggers the following events: `movestart` and `moveend`.\n     *\n     * @param center - The centerpoint to set.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * ```ts\n     * map.setCenter([-74, 38]);\n     * ```\n     */\n    setCenter(center: LngLatLike, eventData?: Record<string, unknown>): this { this._camera.setCenter(center, eventData); return this; }\n    /**\n     * Returns the elevation of the map's center point.\n     *\n     * @returns The elevation of the map's center point, in meters above sea level.\n     */\n    getCenterElevation(): number { return this._camera.transform.elevation; }\n    /**\n     * Sets the elevation of the map's center point, in meters above sea level. Equivalent to `jumpTo({elevation: elevation})`.\n     *\n     * Triggers the following events: `movestart` and `moveend`.\n     *\n     * @param elevation - The elevation to set, in meters above sea level.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     */\n    setCenterElevation(elevation: number, eventData?: any): this { this._camera.setCenterElevation(elevation, eventData); return this; }\n    /**\n     * Sets the value of `centerClampedToGround`.\n     *\n     * If true, the elevation of the center point will automatically be set to the terrain elevation\n     * (or zero if terrain is not enabled). If false, the elevation of the center point will default\n     * to sea level and will not automatically update. Defaults to true. Needs to be set to false to\n     * keep the camera above ground when pitch \\> 90 degrees.\n     */\n    setCenterClampedToGround(centerClampedToGround: boolean): void { this._camera.setCenterClampedToGround(centerClampedToGround); }\n    /**\n     * Pans the map by the specified offset.\n     *\n     * Triggers the following events: `movestart` and `moveend`.\n     *\n     * @param offset - `x` and `y` coordinates by which to pan the map.\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js/docs/examples/navigate-the-map-with-game-like-controls/)\n     */\n    panBy(offset: PointLike, options?: EaseToOptions, eventData?: any): this { this._camera.panBy(offset, options, eventData); return this; }\n    /**\n     * Pans the map to the specified location with an animated transition.\n     *\n     * Triggers the following events: `movestart` and `moveend`.\n     *\n     * @param lnglat - The location to pan the map to.\n     * @param options - Options describing the destination and animation of the transition.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * ```ts\n     * map.panTo([-74, 38]);\n     * // Specify that the panTo animation should last 5000 milliseconds.\n     * map.panTo([-74, 38], {duration: 5000});\n     * ```\n     * @see [Update a feature in realtime](https://maplibre.org/maplibre-gl-js/docs/examples/update-a-feature-in-realtime/)\n     */\n    panTo(lnglat: LngLatLike, options?: EaseToOptions, eventData?: any): this { this._camera.panTo(lnglat, options, eventData); return this; }\n    /**\n     * Returns the map's current zoom level.\n     *\n     * @returns The map's current zoom level.\n     * @example\n     * ```ts\n     * map.getZoom();\n     * ```\n     */\n    getZoom(): number { return this._camera.transform.zoom; }\n    /**\n     * Sets the map's zoom level. Equivalent to `jumpTo({zoom: zoom})`.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.\n     *\n     * @param zoom - The zoom level to set (0-20).\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * Zoom to the zoom level 5 without an animated transition\n     * ```ts\n     * map.setZoom(5);\n     * ```\n     */\n    setZoom(zoom: number, eventData?: any): this { this._camera.setZoom(zoom, eventData); return this; }\n    /**\n     * Zooms the map to the specified zoom level, with an animated transition.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.\n     *\n     * @param zoom - The zoom level to transition to.\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * ```ts\n     * // Zoom to the zoom level 5 without an animated transition\n     * map.zoomTo(5);\n     * // Zoom to the zoom level 8 with an animated transition\n     * map.zoomTo(8, {\n     *   duration: 2000,\n     *   offset: [100, 50]\n     * });\n     * ```\n     */\n    zoomTo(zoom: number, options?: EaseToOptions | null, eventData?: any): this { this._camera.zoomTo(zoom, options, eventData); return this; }\n    /**\n     * Incrementally increases the map's zoom level by 1, first snapping to the nearest `zoomSnap` increment.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.\n     *\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * Zoom the map in one level with a custom animation duration\n     * ```ts\n     * map.zoomIn({duration: 1000});\n     * ```\n     */\n    zoomIn(options?: AnimationOptions, eventData?: any): this { this._camera.zoomIn(options, eventData); return this; }\n    /**\n     * Decreases the map's zoom level by 1, first snapping to the nearest `zoomSnap` increment.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.\n     *\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * Zoom the map out one level with a custom animation offset\n     * ```ts\n     * map.zoomOut({offset: [80, 60]});\n     * ```\n     */\n    zoomOut(options?: AnimationOptions, eventData?: any): this { this._camera.zoomOut(options, eventData); return this; }\n    /**\n     * Returns the map's current vertical field of view, in degrees.\n     *\n     * @returns The map's current vertical field of view.\n     * @defaultValue 36.87\n     * @example\n     * ```ts\n     * const verticalFieldOfView = map.getVerticalFieldOfView();\n     * ```\n     */\n    getVerticalFieldOfView(): number { return this._camera.transform.fov; }\n    /**\n     * Sets the map's vertical field of view, in degrees.\n     *\n     * Triggers the following events: `movestart`, `move`, and `moveend`.\n     *\n     * @param fov - The vertical field of view to set, in degrees (0-180).\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @defaultValue 36.87\n     * @example\n     * Change vertical field of view to 30 degrees\n     * ```ts\n     * map.setVerticalFieldOfView(30);\n     * ```\n     */\n    setVerticalFieldOfView(fov: number, eventData?: any): this { this._camera.setVerticalFieldOfView(fov, eventData); return this; }\n    /**\n     * Returns the map's current bearing. The bearing is the compass direction that is \"up\"; for example, a bearing\n     * of 90° orients the map so that east is up.\n     *\n     * @returns The map's current bearing.\n     * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js/docs/examples/navigate-the-map-with-game-like-controls/)\n     */\n    getBearing(): number { return this._camera.transform.bearing; }\n    /**\n     * Sets the map's bearing (rotation). The bearing is the compass direction that is \"up\"; for example, a bearing\n     * of 90° orients the map so that east is up.\n     *\n     * Equivalent to `jumpTo({bearing: bearing})`.\n     *\n     * Triggers the following events: `movestart`, `moveend`, and `rotate`.\n     *\n     * @param bearing - The desired bearing.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * Rotate the map to 90 degrees\n     * ```ts\n     * map.setBearing(90);\n     * ```\n     */\n    setBearing(bearing: number, eventData?: any): this { this._camera.setBearing(bearing, eventData); return this; }\n    /**\n     * Returns the map's current zoom snap level.\n     *\n     * @returns The map's current zoom snap level.\n     */\n    getZoomSnap(): number { return this._camera.getZoomSnap(); }\n    /**\n     * Sets the map's zoom snap level.\n     *\n     * @param snap - The zoom snap level to set.\n     */\n    setZoomSnap(snap: number): this { this._camera.setZoomSnap(snap); return this; }\n    /**\n     * Returns the current padding applied around the map viewport.\n     *\n     * @returns The current padding around the map viewport.\n     */\n    getPadding(): PaddingOptions { return this._camera.transform.padding; }\n    /**\n     * Sets the padding in pixels around the viewport.\n     *\n     * Equivalent to `jumpTo({padding: padding})`.\n     *\n     * Triggers the following events: `movestart` and `moveend`.\n     *\n     * @param padding - The desired padding.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * Sets a left padding of 300px, and a top padding of 50px\n     * ```ts\n     * map.setPadding({ left: 300, top: 50 });\n     * ```\n     */\n    setPadding(padding: PaddingOptions, eventData?: any): this { this._camera.setPadding(padding, eventData); return this; }\n    /**\n     * Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction\n     * that is \"up\"; for example, a bearing of 90° orients the map so that east is up.\n     *\n     * Triggers the following events: `movestart`, `moveend`, and `rotate`.\n     *\n     * @param bearing - The desired bearing.\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     */\n    rotateTo(bearing: number, options?: EaseToOptions, eventData?: any): this { this._camera.rotateTo(bearing, options, eventData); return this; }\n    /**\n     * Rotates the map so that north is up (0° bearing), with an animated transition.\n     *\n     * Triggers the following events: `movestart`, `moveend`, and `rotate`.\n     *\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     */\n    resetNorth(options?: AnimationOptions, eventData?: any): this { this._camera.resetNorth(options, eventData); return this; }\n    /**\n     * Rotates and pitches the map so that north is up (0° bearing) and pitch and roll are 0°, with an animated transition.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `pitchstart`, `pitch`, `pitchend`, `rollstart`, `roll`, `rollend`, and `rotate`.\n     *\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     */\n    resetNorthPitch(options?: AnimationOptions, eventData?: any): this { this._camera.resetNorthPitch(options, eventData); return this; }\n    /**\n     * Snaps the map so that north is up (0° bearing), if the current bearing is close enough to it (i.e. within the\n     * `bearingSnap` threshold).\n     *\n     * Triggers the following events: `movestart`, `moveend`, and `rotate`.\n     *\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     */\n    snapToNorth(options?: AnimationOptions, eventData?: any): this { this._camera.snapToNorth(options, eventData); return this; }\n    /**\n     * Returns the map's current pitch (tilt).\n     *\n     * @returns The map's current pitch, measured in degrees away from the plane of the screen.\n     */\n    getPitch(): number { return this._camera.transform.pitch; }\n    /**\n     * Sets the map's pitch (tilt). Equivalent to `jumpTo({pitch: pitch})`.\n     *\n     * Triggers the following events: `movestart`, `moveend`, `pitchstart`, and `pitchend`.\n     *\n     * @param pitch - The pitch to set, measured in degrees away from the plane of the screen (0-60).\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     */\n    setPitch(pitch: number, eventData?: any): this { this._camera.setPitch(pitch, eventData); return this; }\n    /**\n     * Returns the map's current roll angle.\n     *\n     * @returns The map's current roll, measured in degrees about the camera boresight.\n     */\n    getRoll(): number { return this._camera.transform.roll; }\n    /**\n     * Sets the map's roll angle. Equivalent to `jumpTo({roll: roll})`.\n     *\n     * Triggers the following events: `movestart`, `moveend`, `rollstart`, and `rollend`.\n     *\n     * @param roll - The roll to set, measured in degrees about the camera boresight\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     */\n    setRoll(roll: number, eventData?: any): this { this._camera.setRoll(roll, eventData); return this; }\n    /**\n     * @param bounds - Calculate the center for these bounds in the viewport and use\n     * the highest zoom level up to and including {@link Map.getMaxZoom} that fits\n     * in the viewport. LngLatBounds represent a box that is always axis-aligned with bearing 0.\n     * Bounds will be taken in `[sw, ne]` order. Southwest point will always be to the left of the northeast point.\n     * @param options - Options object\n     * @returns If map is able to fit to provided bounds, returns `center`, `zoom`, and `bearing`.\n     * If map is unable to fit, method will warn and return undefined.\n     * @example\n     * ```ts\n     * let bbox = [[-79, 43], [-73, 45]];\n     * let newCameraTransform = map.cameraForBounds(bbox, {\n     *   padding: {top: 10, bottom:25, left: 15, right: 5}\n     * });\n     * ```\n     */\n    cameraForBounds(bounds: LngLatBoundsLike, options?: CameraForBoundsOptions): CenterZoomBearing | undefined { return this._camera.cameraForBounds(bounds, options); }\n    /**\n     * Pans and zooms the map to contain its visible area within the specified geographical bounds.\n     * This function will also reset the map's bearing to 0 if bearing is nonzero.\n     *\n     * Triggers the following events: `movestart` and `moveend`.\n     *\n     * @param bounds - Center these bounds in the viewport and use the highest\n     * zoom level up to and including {@link Map.getMaxZoom} that fits them in the viewport.\n     * Bounds will be taken in `[sw, ne]` order. Southwest point will always be to the left of the northeast point.\n     * @param options - Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * ```ts\n     * let bbox = [[-79, 43], [-73, 45]];\n     * map.fitBounds(bbox, {\n     *   padding: {top: 10, bottom:25, left: 15, right: 5}\n     * });\n     * ```\n     * @see [Fit a map to a bounding box](https://maplibre.org/maplibre-gl-js/docs/examples/fit-a-map-to-a-bounding-box/)\n     */\n    fitBounds(bounds: LngLatBoundsLike, options?: FitBoundsOptions, eventData?: any): this { this._camera.fitBounds(bounds, options, eventData); return this; }\n    /**\n     * Pans, rotates and zooms the map to to fit the box made by points p0 and p1\n     * once the map is rotated to the specified bearing. To zoom without rotating,\n     * pass in the current map bearing.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend` and `rotate`.\n     *\n     * @param p0 - First point on screen, in pixel coordinates\n     * @param p1 - Second point on screen, in pixel coordinates\n     * @param bearing - Desired map bearing at end of animation, in degrees\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * ```ts\n     * let p0 = [220, 400];\n     * let p1 = [500, 900];\n     * map.fitScreenCoordinates(p0, p1, map.getBearing(), {\n     *   padding: {top: 10, bottom:25, left: 15, right: 5}\n     * });\n     * ```\n     * @see Used by {@link BoxZoomHandler}\n     */\n    fitScreenCoordinates(p0: PointLike, p1: PointLike, bearing: number, options?: FitBoundsOptions, eventData?: any): this { this._camera.fitScreenCoordinates(p0, p1, bearing, options, eventData); return this; }\n    /**\n     * Changes any combination of center, zoom, bearing, pitch, and roll, without\n     * an animated transition. The map will retain its current values for any\n     * details not specified in `options`.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,\n     * `pitch`, `pitchend`, `rollstart`, `roll`, `rollend` and `rotate`.\n     *\n     * @param options - Options object\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * ```ts\n     * // jump to coordinates at current zoom\n     * map.jumpTo({center: [0, 0]});\n     * // jump with zoom, pitch, and bearing options\n     * map.jumpTo({\n     *   center: [0, 0],\n     *   zoom: 8,\n     *   pitch: 45,\n     *   bearing: 90\n     * });\n     * ```\n     * @see [Jump to a series of locations](https://maplibre.org/maplibre-gl-js/docs/examples/jump-to-a-series-of-locations/)\n     * @see [Update a feature in realtime](https://maplibre.org/maplibre-gl-js/docs/examples/update-a-feature-in-realtime/)\n     */\n    jumpTo(options: JumpToOptions, eventData?: any): this { this._camera.jumpTo(options, eventData); return this; }\n    /**\n     * Given a camera position and rotation, calculates zoom and center point and returns them as {@link CameraOptions}.\n     * @param cameraLngLat - The lng, lat of the camera to look from\n     * @param cameraAlt - The altitude of the camera to look from, in meters above sea level\n     * @param bearing - Bearing of the camera, in degrees\n     * @param pitch - Pitch of the camera, in degrees\n     * @param roll - Roll of the camera, in degrees\n     * @returns the calculated camera options\n     * @example\n     * ```ts\n     * // Calculate options to look from camera position(1°, 0°, 1000m) with bearing = 90°, pitch = 30°, and roll = 45°\n     * const cameraLngLat = new LngLat(1, 0);\n     * const cameraAltitude = 1000;\n     * const bearing = 90;\n     * const pitch = 30;\n     * const roll = 45;\n     * const cameraOptions = map.calculateCameraOptionsFromCameraLngLatAltRotation(cameraLngLat, cameraAltitude, bearing, pitch, roll);\n     * // Apply calculated options\n     * map.jumpTo(cameraOptions);\n     * ```\n     */\n    calculateCameraOptionsFromCameraLngLatAltRotation(cameraLngLat: LngLatLike, cameraAlt: number, bearing: number, pitch: number, roll?: number): CameraOptions { return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(cameraLngLat, cameraAlt, bearing, pitch, roll); }\n    /**\n     * Changes any combination of `center`, `zoom`, `bearing`, `pitch`, `roll`, and `padding` with an animated transition\n     * between old and new values. The map will retain its current values for any\n     * details not specified in `options`.\n     *\n     * !!! note \"Reduced Motion\"\n     *     The transition will happen instantly if the user has enabled\n     *     the `reduced motion` accessibility feature enabled in their operating system,\n     *     unless `options` includes `essential: true`.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,\n     * `pitch`, `pitchend`, `rollstart`, `roll`, `rollend`, and `rotate`.\n     *\n     * @param options - Options describing the destination and animation of the transition.\n     * Accepts {@link CameraOptions} and {@link AnimationOptions}.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js/docs/examples/navigate-the-map-with-game-like-controls/)\n     */\n    easeTo(options: EaseToOptions, eventData?: any): this { this._camera.easeTo(options, eventData); return this; }\n    /**\n     * Changes any combination of center, zoom, bearing, pitch, and roll, animating the transition along a curve that\n     * evokes flight. The animation seamlessly incorporates zooming and panning to help\n     * the user maintain her bearings even after traversing a great distance.\n     *\n     * !!! note \"Reduced Motion\"\n     *     The animation will be skipped, and this will behave equivalently to `jumpTo`\n     *     if the user has the `reduced motion` accessibility feature enabled in their operating system,\n     *     unless 'options' includes `essential: true`.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,\n     * `pitch`, `pitchend`, `rollstart`, `roll`, `rollend`, and `rotate`.\n     *\n     * @param options - Options describing the destination and animation of the transition.\n     * Accepts {@link CameraOptions}, {@link AnimationOptions},\n     * and the following additional options.\n     * @param eventData - Additional properties to be added to event objects of events triggered by this method.\n     * @example\n     * ```ts\n     * // fly with default options to null island\n     * map.flyTo({center: [0, 0], zoom: 9});\n     * // using flyTo options\n     * map.flyTo({\n     *   center: [0, 0],\n     *   zoom: 9,\n     *   speed: 0.2,\n     *   curve: 1,\n     *   easing(t) {\n     *     return t;\n     *   }\n     * });\n     * ```\n     * @see [Fly to a location](https://maplibre.org/maplibre-gl-js/docs/examples/fly-to-a-location/)\n     * @see [Slowly fly to a location](https://maplibre.org/maplibre-gl-js/docs/examples/slowly-fly-to-a-location/)\n     * @see [Fly to a location based on scroll position](https://maplibre.org/maplibre-gl-js/docs/examples/fly-to-a-location-based-on-scroll-position/)\n     */\n    flyTo(options: FlyToOptions, eventData?: any): this { this._camera.flyTo(options, eventData); return this; }\n    /**\n     * Stops any animated transition underway.\n     */\n    stop(): this { this._camera.stop(); return this; }\n    /**\n     * Gets the elevation at a given location, in meters above sea level.\n     * Returns null if terrain is not enabled.\n     * If terrain is enabled with some exaggeration value, the value returned here will be reflective of (multiplied by) that exaggeration value.\n     * This method should be used for proper positioning of custom 3d objects, as explained [here](https://maplibre.org/maplibre-gl-js/docs/examples/adding-3d-models-using-threejs-on-terrain/)\n     * @param lngLatLike - `[x, y]` or LngLat coordinates of the location\n     * @returns elevation in meters\n     */\n    queryTerrainElevation(lngLatLike: LngLatLike): number | null { \n        if (!this.terrain) {\n            return null;\n        }\n        return this.terrain.getElevationForLngLat(LngLat.convert(lngLatLike), this._camera.transform);\n    }\n    /**\n     * Returns the value of `centerClampedToGround`.\n     *\n     * If true, the elevation of the center point will automatically be set to the terrain elevation\n     * (or zero if terrain is not enabled). If false, the elevation of the center point will default\n     * to sea level and will not automatically update. Defaults to true. Needs to be set to false to\n     * keep the camera above ground when pitch \\> 90 degrees.\n     */\n    getCenterClampedToGround(): boolean { return this._camera.getCenterClampedToGround(); }\n\n    /**\n     * Given a camera 'from' position and a position to look at (`to`), calculates zoom and camera rotation and returns them as {@link CameraOptions}.\n     * @param from - The camera to look from\n     * @param altitudeFrom - The altitude of the camera to look from\n     * @param to - The center to look at\n     * @param altitudeTo - Optional altitude of the center to look at. If none given the ground height will be used.\n     * @returns the calculated camera options\n     * @example\n     * ```ts\n     * // Calculate options to look from (1°, 0°, 1000m) to (1°, 1°, 0m)\n     * const cameraLngLat = new LngLat(1, 0);\n     * const cameraAltitude = 1000;\n     * const targetLngLat = new LngLat(1, 1);\n     * const targetAltitude = 0;\n     * const cameraOptions = map.calculateCameraOptionsFromTo(cameraLngLat, cameraAltitude, targetLngLat, targetAltitude);\n     * // Apply calculated options\n     * map.jumpTo(cameraOptions);\n     * ```\n     */\n    calculateCameraOptionsFromTo(from: LngLat, altitudeFrom: number, to: LngLat, altitudeTo?: number): CameraOptions {\n        if (altitudeTo == null && this.terrain) {\n            altitudeTo = this.terrain.getElevationForLngLat(to, this._camera.transform);\n        }\n        return this._camera.calculateCameraOptionsFromTo(from, altitudeFrom, to, altitudeTo);\n    }\n\n    /**\n     * Resizes the map according to the dimensions of its\n     * `container` element.\n     *\n     * Checks if the map container size changed and updates the map if it has changed.\n     * This method must be called after the map's `container` is resized programmatically\n     * or when the map is shown after being initially hidden with CSS.\n     *\n     * Triggers the following events: `movestart`, `move`, `moveend`, and `resize`.\n     *\n     * @param eventData - Additional properties to be passed to `movestart`, `move`, `resize`, and `moveend`\n     * events that get triggered as a result of resize. This can be useful for differentiating the\n     * source of an event (for example, user-initiated or programmatically-triggered events).\n     * @example\n     * Resize the map when the map container is shown after being initially hidden with CSS.\n     * ```ts\n     * let mapDiv = document.getElementById('map');\n     * if (mapDiv.style.visibility === true) map.resize();\n     * ```\n     */\n    resize(eventData?: any, constrainTransform = true): this {\n        // Early out if the context is lost\n        // causes a blank map otherwise\n        const isContextLost = this._lostContextStyle.style !== null;\n        if (isContextLost) return this;\n        this._resizeInternal(constrainTransform);\n\n        const fireMoving = !this._camera._moving;\n        if (fireMoving) {\n            this.stop();\n            this.fire(new MapMovementEvent('movestart', eventData))\n                .fire(new MapMovementEvent('move', eventData));\n        }\n\n        this.fire(new MapLibreEvent('resize', eventData));\n\n        if (fireMoving) this.fire(new MapMovementEvent('moveend', eventData));\n\n        return this;\n    }\n\n    /**\n     * Resizes the map according to the dimensions of its\n     * `container` element.\n     *\n     * It does not trigger any events, and does not check for context loss.\n     *\n     * It is used internally and by {@link Map.resize}.\n     *\n     * @internal\n     *\n     * @param constrainTransform - whether to constrain the transform after resizing.\n     */\n    _resizeInternal(constrainTransform = true): void {\n        const [width, height] = this._containerDimensions();\n\n        const clampedPixelRatio = this._getClampedPixelRatio(width, height);\n        this._resizeCanvas(width, height, clampedPixelRatio);\n        this.painter.resize(width, height, clampedPixelRatio);\n\n        // check if we've reached GL limits, in that case further clamps pixelRatio\n        if (this.painter.overLimit()) {\n            const gl = this.painter.context.gl;\n            // store updated _maxCanvasSize value\n            this._maxCanvasSize = [gl.drawingBufferWidth, gl.drawingBufferHeight];\n            const clampedPixelRatio = this._getClampedPixelRatio(width, height);\n            this._resizeCanvas(width, height, clampedPixelRatio);\n            this.painter.resize(width, height, clampedPixelRatio);\n        }\n\n        this._resizeTransform(constrainTransform);\n    }\n\n    _resizeTransform(constrainTransform = true): void {\n        const [width, height] = this._containerDimensions();\n\n        this._camera.transform.resize(width, height, constrainTransform);\n        this._camera._requestedCameraState?.resize(width, height, constrainTransform);\n    }\n\n    /**\n     * @internal\n     * Return the map's pixel ratio eventually scaled down to respect maxCanvasSize.\n     * Internally you should use this and not getPixelRatio().\n     */\n    _getClampedPixelRatio(width: number, height: number): number {\n        const {0: maxCanvasWidth, 1: maxCanvasHeight} = this._maxCanvasSize;\n        const pixelRatio = this.getPixelRatio();\n\n        const canvasWidth = width * pixelRatio;\n        const canvasHeight = height * pixelRatio;\n\n        const widthScaleFactor = canvasWidth > maxCanvasWidth ? (maxCanvasWidth / canvasWidth) : 1;\n        const heightScaleFactor = canvasHeight > maxCanvasHeight ? (maxCanvasHeight / canvasHeight) : 1;\n\n        return Math.min(widthScaleFactor, heightScaleFactor) * pixelRatio;\n    }\n\n    /**\n     * Returns the map's pixel ratio.\n     * Note that the pixel ratio actually applied may be lower to respect maxCanvasSize.\n     * @returns The pixel ratio.\n     */\n    getPixelRatio(): number {\n        return this._overridePixelRatio ?? devicePixelRatio;\n    }\n\n    /**\n     * Sets the map's pixel ratio. This allows to override `devicePixelRatio`.\n     * After this call, the canvas' `width` attribute will be `container.clientWidth * pixelRatio`\n     * and its height attribute will be `container.clientHeight * pixelRatio`.\n     * Set this to null to disable `devicePixelRatio` override.\n     * Note that the pixel ratio actually applied may be lower to respect maxCanvasSize.\n     * @param pixelRatio - The pixel ratio.\n     */\n    setPixelRatio(pixelRatio: number): void {\n        this._overridePixelRatio = pixelRatio;\n        this.resize();\n    }\n\n    /**\n     * Returns the map's geographical bounds. When the bearing or pitch is non-zero, the visible region is not\n     * an axis-aligned rectangle, and the result is the smallest bounds that encompasses the visible region.\n     * @returns The geographical bounds of the map as {@link LngLatBounds}.\n     * @example\n     * ```ts\n     * let bounds = map.getBounds();\n     * ```\n     */\n    getBounds(): LngLatBounds {\n        return this._camera.transform.getBounds();\n    }\n\n    /**\n     * Returns the maximum geographical bounds the map is constrained to, or `null` if none set.\n     * @returns The map object.\n     * @example\n     * ```ts\n     * let maxBounds = map.getMaxBounds();\n     * ```\n     */\n    getMaxBounds(): LngLatBounds | null {\n        return this._camera.transform.getMaxBounds();\n    }\n\n    /**\n     * Sets or clears the map's geographical bounds.\n     *\n     * Pan and zoom operations are constrained within these bounds.\n     * If a pan or zoom is performed that would\n     * display regions outside these bounds, the map will\n     * instead display a position and zoom level\n     * as close as possible to the operation's request while still\n     * remaining within the bounds.\n     *\n     * @param bounds - The maximum bounds to set. If `null` or `undefined` is provided, the function removes the map's maximum bounds.\n     * @example\n     * Define bounds that conform to the `LngLatBoundsLike` object as set the max bounds.\n     * ```ts\n     * let bounds = [\n     *   [-74.04728, 40.68392], // [west, south]\n     *   [-73.91058, 40.87764]  // [east, north]\n     * ];\n     * map.setMaxBounds(bounds);\n     * ```\n     */\n    setMaxBounds(bounds?: LngLatBoundsLike | null): this {\n        this._camera.transform.setMaxBounds(LngLatBounds.convert(bounds));\n        return this._update();\n    }\n\n    /**\n     * Sets or clears the map's minimum zoom level.\n     * If the map's current zoom level is lower than the new minimum,\n     * the map will zoom to the new minimum and trigger the following events:\n     * `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.\n     *\n     * It is not always possible to zoom out and reach the set `minZoom`.\n     * Other factors such as map height may restrict zooming. For example,\n     * if the map is 512px tall it will not be possible to zoom below zoom 0\n     * no matter what the `minZoom` is set to.\n     *\n     * A {@link ErrorEvent} event will be fired if minZoom is out of bounds.\n     *\n     * @param minZoom - The minimum zoom level to set (-2 - 24).\n     * If `null` or `undefined` is provided, the function removes the current minimum zoom (i.e. sets it to -2).\n     * @example\n     * ```ts\n     * map.setMinZoom(12.25);\n     * ```\n     */\n    setMinZoom(minZoom?: number | null): this {\n\n        minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;\n\n        if (minZoom >= defaultMinZoom && minZoom <= this._camera.transform.maxZoom) {\n            const zoomBefore = this._camera.transform.zoom;\n            const tr = this._camera.getTransformForUpdate();\n            tr.setMinZoom(minZoom);\n            this._camera.applyUpdatedTransform(tr);\n            this._update();\n            if (zoomBefore !== this._camera.transform.zoom) {\n                this.fire(new MapMovementEvent('zoomstart'))\n                    .fire(new MapMovementEvent('zoom'))\n                    .fire(new MapMovementEvent('zoomend'))\n                    .fire(new MapMovementEvent('movestart'))\n                    .fire(new MapMovementEvent('move'))\n                    .fire(new MapMovementEvent('moveend'));\n            }\n\n            return this;\n\n        } else throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);\n    }\n\n    /**\n     * Returns the map's minimum allowable zoom level.\n     *\n     * @returns minZoom\n     * @example\n     * ```ts\n     * let minZoom = map.getMinZoom();\n     * ```\n     */\n    getMinZoom(): number { return this._camera.transform.minZoom; }\n\n    /**\n     * Sets or clears the map's maximum zoom level.\n     * If the map's current zoom level is higher than the new maximum,\n     * the map will zoom to the new maximum and trigger the following events:\n     * `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.\n     *\n     * A {@link ErrorEvent} event will be fired if minZoom is out of bounds.\n     *\n     * @param maxZoom - The maximum zoom level to set.\n     * If `null` or `undefined` is provided, the function removes the current maximum zoom (sets it to 22).\n     * @example\n     * ```ts\n     * map.setMaxZoom(18.75);\n     * ```\n     */\n    setMaxZoom(maxZoom?: number | null): this {\n\n        maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;\n\n        if (maxZoom >= this._camera.transform.minZoom) {\n            const zoomBefore = this._camera.transform.zoom;\n            const tr = this._camera.getTransformForUpdate();\n            tr.setMaxZoom(maxZoom);\n            this._camera.applyUpdatedTransform(tr);\n            this._update();\n            if (zoomBefore !== this._camera.transform.zoom) {\n                this.fire(new MapMovementEvent('zoomstart'))\n                    .fire(new MapMovementEvent('zoom'))\n                    .fire(new MapMovementEvent('zoomend'))\n                    .fire(new MapMovementEvent('movestart'))\n                    .fire(new MapMovementEvent('move'))\n                    .fire(new MapMovementEvent('moveend'));\n            }\n\n            return this;\n\n        } else throw new Error('maxZoom must be greater than the current minZoom');\n    }\n\n    /**\n     * Returns the map's maximum allowable zoom level.\n     *\n     * @returns The maxZoom\n     * @example\n     * ```ts\n     * let maxZoom = map.getMaxZoom();\n     * ```\n     */\n    getMaxZoom(): number { return this._camera.transform.maxZoom; }\n\n    /**\n     * Sets or clears the map's minimum pitch.\n     * If the map's current pitch is lower than the new minimum,\n     * the map will pitch to the new minimum and trigger the following events:\n     * `movestart`, `move`, `moveend`, `pitchstart`, `pitch`, and `pitchend`.\n     *\n     * A {@link ErrorEvent} event will be fired if minPitch is out of bounds.\n     *\n     * @param minPitch - The minimum pitch to set (0-180). Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project.\n     * If `null` or `undefined` is provided, the function removes the current minimum pitch (i.e. sets it to 0).\n     */\n    setMinPitch(minPitch?: number | null): this {\n\n        minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;\n\n        if (minPitch < defaultMinPitch) {\n            throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);\n        }\n\n        if (minPitch >= defaultMinPitch && minPitch <= this._camera.transform.maxPitch) {\n            const pitchBefore = this._camera.transform.pitch;\n            const tr = this._camera.getTransformForUpdate();\n            tr.setMinPitch(minPitch);\n            this._camera.applyUpdatedTransform(tr);\n            this._update();\n            if (pitchBefore !== this._camera.transform.pitch) {\n                this.fire(new MapMovementEvent('pitchstart'))\n                    .fire(new MapMovementEvent('pitch'))\n                    .fire(new MapMovementEvent('pitchend'))\n                    .fire(new MapMovementEvent('movestart'))\n                    .fire(new MapMovementEvent('move'))\n                    .fire(new MapMovementEvent('moveend'));\n            }\n\n            return this;\n\n        } else throw new Error(`minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`);\n    }\n\n    /**\n     * Returns the map's minimum allowable pitch.\n     *\n     * @returns The minPitch\n     */\n    getMinPitch(): number { return this._camera.transform.minPitch; }\n\n    /**\n     * Sets or clears the map's maximum pitch.\n     * If the map's current pitch is higher than the new maximum,\n     * the map will pitch to the new maximum and trigger the following events:\n     * `movestart`, `move`, `moveend`, `pitchstart`, `pitch`, and `pitchend`.\n     *\n     * A {@link ErrorEvent} event will be fired if maxPitch is out of bounds.\n     *\n     * @param maxPitch - The maximum pitch to set (0-180). Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project.\n     * If `null` or `undefined` is provided, the function removes the current maximum pitch (sets it to 60).\n     */\n    setMaxPitch(maxPitch?: number | null): this {\n\n        maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;\n\n        if (maxPitch > maxPitchThreshold) {\n            throw new Error(`maxPitch must be less than or equal to ${maxPitchThreshold}`);\n        }\n\n        if (maxPitch >= this._camera.transform.minPitch) {\n            const pitchBefore = this._camera.transform.pitch;\n            const tr = this._camera.getTransformForUpdate();\n            tr.setMaxPitch(maxPitch);\n            this._camera.applyUpdatedTransform(tr);\n            this._update();\n            if (pitchBefore !== this._camera.transform.pitch) {\n                this.fire(new MapMovementEvent('pitchstart'))\n                    .fire(new MapMovementEvent('pitch'))\n                    .fire(new MapMovementEvent('pitchend'))\n                    .fire(new MapMovementEvent('movestart'))\n                    .fire(new MapMovementEvent('move'))\n                    .fire(new MapMovementEvent('moveend'));\n            }\n\n            return this;\n\n        } else throw new Error('maxPitch must be greater than the current minPitch');\n    }\n\n    /**\n     * Returns the map's maximum allowable pitch.\n     *\n     * @returns The maxPitch\n     */\n    getMaxPitch(): number { return this._camera.transform.maxPitch; }\n\n    /**\n     * Returns the map's anisotropic filter pitch.\n     * If the map is pitched beyond this threshold, anisotropic filtering will be applied to all raster layers.\n     *\n     * @returns The anisotropicFilterPitch\n     * @example\n     * ```ts\n     * let anisotropicFilterPitch = map.getAnisotropicFilterPitch();\n     * ```\n     */\n    getAnisotropicFilterPitch(): number { return this._anisotropicFilterPitch; }\n\n    /**\n     * Sets the map's anisotropic filter pitch or reverts it to its default.\n     *\n     * A {@link ErrorEvent} event will be fired if anisotropicFilterPitch is out of bounds.\n     *\n     * @param anisotropicFilterPitch - The pitch above which to apply anisotropic filtering to the map's raster layers (0-180).\n     * If `null` or `undefined` is provided, the function reverts to the default pitch threshold (20).\n     *\n     *\n     * @example\n     * ```ts\n     * map.setAnisotropicFilterPitch(85);\n     * ```\n     */\n    setAnisotropicFilterPitch(anisotropicFilterPitch?: number | null): this {\n\n        anisotropicFilterPitch = anisotropicFilterPitch === null || anisotropicFilterPitch === undefined ? defaultAnisotropicFilterPitch : anisotropicFilterPitch;\n\n        if (anisotropicFilterPitch > maxPitchThreshold) {\n            throw new Error(`anisotropicFilterPitch must be less than or equal to ${maxPitchThreshold}`);\n        }\n\n        if (anisotropicFilterPitch < defaultMinPitch) {\n            throw new Error(`anisotropicFilterPitch must be greater than or equal to ${defaultMinPitch}`);\n        }\n\n        this._anisotropicFilterPitch = anisotropicFilterPitch;\n        return this._update();\n    }\n\n    /**\n     * Returns the state of `renderWorldCopies`. If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:\n     *\n     * - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire\n     * container, there will be blank space beyond 180 and -180 degrees longitude.\n     * - Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the\n     * map and the other on the left edge of the map) at every zoom level.\n     * @returns The renderWorldCopies\n     * @example\n     * ```ts\n     * let worldCopiesRendered = map.getRenderWorldCopies();\n     * ```\n     * @see [Render world copies](https://maplibre.org/maplibre-gl-js/docs/examples/render-world-copies/)\n     */\n    getRenderWorldCopies(): boolean { return this._camera.transform.renderWorldCopies; }\n\n    /**\n     * Sets the state of `renderWorldCopies`.\n     *\n     * @param renderWorldCopies - If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:\n     *\n     * - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire\n     * container, there will be blank space beyond 180 and -180 degrees longitude.\n     * - Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the\n     * map and the other on the left edge of the map) at every zoom level.\n     *\n     * `undefined` is treated as `true`, `null` is treated as `false`.\n     * @example\n     * ```ts\n     * map.setRenderWorldCopies(true);\n     * ```\n     * @see [Render world copies](https://maplibre.org/maplibre-gl-js/docs/examples/render-world-copies/)\n     */\n    setRenderWorldCopies(renderWorldCopies?: boolean | null): this {\n        this._camera.transform.setRenderWorldCopies(renderWorldCopies);\n        return this._update();\n    }\n\n    /** Sets or clears the callback overriding how the map constrains the viewport's lnglat and zoom to respect the longitude and latitude bounds.\n     *\n     * @param constrain - A {@link TransformConstrainFunction} callback defining how the viewport should respect the bounds.\n     *\n     * `null` clears the callback and reverts the constrain to the map transform's default constrain function.\n     * @example\n     * ```ts\n     * function customTransformConstrain(lngLat, zoom) {\n     *   return {center: lngLat, zoom: zoom ?? 0};\n     * };\n     * map.setTransformConstrain(customTransformConstrain);\n     * ```\n     * @see [Customize the map transform constrain](https://maplibre.org/maplibre-gl-js/docs/examples/customize-the-map-transform-constrain/)\n     */\n    setTransformConstrain(constrain?: TransformConstrainFunction | null): this {\n        this._camera.transform.setConstrainOverride(constrain);\n        return this._update();\n    }\n\n    /**\n     * Returns a [Point](https://github.com/mapbox/point-geometry) representing pixel coordinates, relative to the map's `container`,\n     * that correspond to the specified geographical location.\n     *\n     * @param lnglat - The geographical location to project.\n     * @returns The [Point](https://github.com/mapbox/point-geometry) corresponding to `lnglat`, relative to the map's `container`.\n     * @example\n     * ```ts\n     * let coordinate = [-122.420679, 37.772537];\n     * let point = map.project(coordinate);\n     * ```\n     */\n    project(lnglat: LngLatLike): Point {\n        return this._camera.transform.locationToScreenPoint(LngLat.convert(lnglat), this.style && this.terrain);\n    }\n\n    /**\n     * Returns a {@link LngLat} representing geographical coordinates that correspond\n     * to the specified pixel coordinates.\n     *\n     * @param point - The pixel coordinates to unproject.\n     * @returns The {@link LngLat} corresponding to `point`.\n     * @example\n     * ```ts\n     * map.on('click', (e) => {\n     *   // When the map is clicked, get the geographic coordinate.\n     *   let coordinate = map.unproject(e.point);\n     * });\n     * ```\n     */\n    unproject(point: PointLike): LngLat {\n        return this._camera.transform.screenPointToLocation(Point.convert(point), this.terrain);\n    }\n\n    /**\n     * Returns true if the map is panning, zooming, rotating, or pitching due to a camera animation or user gesture.\n     * @returns true if the map is moving.\n     * @example\n     * ```ts\n     * let isMoving = map.isMoving();\n     * ```\n     */\n    isMoving(): boolean {\n        return this._camera.isMoving() || this._handlers?.isMoving() || false;\n    }\n\n    /**\n     * Returns true if the map is zooming due to a camera animation or user gesture.\n     * @returns true if the map is zooming.\n     * @example\n     * ```ts\n     * let isZooming = map.isZooming();\n     * ```\n     */\n    isZooming(): boolean {\n        return this._camera.isZooming() || this._handlers?.isZooming() || false;\n    }\n\n    /**\n     * Returns true if the map is rotating due to a camera animation or user gesture.\n     * @returns true if the map is rotating.\n     * @example\n     * ```ts\n     * map.isRotating();\n     * ```\n     */\n    isRotating(): boolean {\n        return this._camera.isRotating() || this._handlers?.isRotating() || false;\n    }\n\n    _createDelegatedListener(type: keyof MapEventType | string, layerIds: string[], listener: Listener): DelegatedListener {\n        if (type === 'mouseenter' || type === 'mouseover') {\n            let mousein = false;\n            const mousemove = (e) => {\n                const existingLayers = layerIds.filter((layerId) => this.getLayer(layerId));\n                const features = existingLayers.length !== 0 ? this.queryRenderedFeatures(e.point, {layers: existingLayers}) : [];\n                if (!features.length) {\n                    mousein = false;\n                } else if (!mousein) {\n                    mousein = true;\n                    listener.call(this, new MapMouseEvent(type, this, e.originalEvent, {features}));\n                }\n            };\n            const mouseout = () => {\n                mousein = false;\n            };\n            return {layers: layerIds, listener, delegates: {mousemove, mouseout}};\n        } else if (type === 'mouseleave' || type === 'mouseout') {\n            let mousein = false;\n            const mousemove = (e) => {\n                const existingLayers = layerIds.filter((layerId) => this.getLayer(layerId));\n                const features = existingLayers.length !== 0 ? this.queryRenderedFeatures(e.point, {layers: existingLayers}) : [];\n                if (features.length) {\n                    mousein = true;\n                } else if (mousein) {\n                    mousein = false;\n                    listener.call(this, new MapMouseEvent(type, this, e.originalEvent));\n                }\n            };\n            const mouseout = (e) => {\n                if (mousein) {\n                    mousein = false;\n                    listener.call(this, new MapMouseEvent(type, this, e.originalEvent));\n                }\n            };\n            return {layers: layerIds, listener, delegates: {mousemove, mouseout}};\n        } else {\n            const delegate = (e) => {\n                const existingLayers = layerIds.filter((layerId) => this.getLayer(layerId));\n                const features = existingLayers.length !== 0 ? this.queryRenderedFeatures(e.point, {layers: existingLayers}) : [];\n                if (features.length) {\n                    // Here we need to mutate the original event, so that preventDefault works as expected.\n                    e.features = features;\n                    listener.call(this, e);\n                    delete e.features;\n                }\n            };\n            return {layers: layerIds, listener, delegates: {[type]: delegate}};\n        }\n    }\n\n    _saveDelegatedListener(type: keyof MapEventType | string, delegatedListener: DelegatedListener): void {\n        this._delegatedListeners ||= {} as Record<keyof MapEventType, DelegatedListener[]>;\n        this._delegatedListeners[type] ||= [];\n        this._delegatedListeners[type].push(delegatedListener);\n    }\n\n    _removeDelegatedListener(type: string, layerIds: string[], listener: Listener): void {\n        if (!this._delegatedListeners?.[type]) {\n            return;\n        }\n\n        const listeners = this._delegatedListeners[type];\n        for (let i = 0; i < listeners.length; i++) {\n            const delegatedListener = listeners[i];\n            if (\n                delegatedListener.listener === listener &&\n                delegatedListener.layers.length === layerIds.length &&\n                delegatedListener.layers.every((layerId: string) => layerIds.includes(layerId))\n            ) {\n                for (const event in delegatedListener.delegates) {\n                    this.off(event as keyof MapEventType, delegatedListener.delegates[event]);\n                }\n                listeners.splice(i, 1);\n                return;\n            }\n        }\n    }\n\n    /**\n     * @event\n     * Adds a listener for events of a specified type, optionally limited to features in a specified style layer(s).\n     * See {@link MapEventType} and {@link MapLayerEventType} for a full list of events and their description.\n     *\n     * | Event                  | Compatible with `layerId` |\n     * |------------------------|---------------------------|\n     * | `mousedown`            | yes                       |\n     * | `mouseup`              | yes                       |\n     * | `mouseover`            | yes                       |\n     * | `mouseout`             | yes                       |\n     * | `mousemove`            | yes                       |\n     * | `mouseenter`           | yes (required)            |\n     * | `mouseleave`           | yes (required)            |\n     * | `click`                | yes                       |\n     * | `dblclick`             | yes                       |\n     * | `contextmenu`          | yes                       |\n     * | `touchstart`           | yes                       |\n     * | `touchend`             | yes                       |\n     * | `touchcancel`          | yes                       |\n     * | `wheel`                |                           |\n     * | `resize`               |                           |\n     * | `remove`               |                           |\n     * | `touchmove`            |                           |\n     * | `movestart`            |                           |\n     * | `move`                 |                           |\n     * | `moveend`              |                           |\n     * | `dragstart`            |                           |\n     * | `drag`                 |                           |\n     * | `dragend`              |                           |\n     * | `zoomstart`            |                           |\n     * | `zoom`                 |                           |\n     * | `zoomend`              |                           |\n     * | `rotatestart`          |                           |\n     * | `rotate`               |                           |\n     * | `rotateend`            |                           |\n     * | `pitchstart`           |                           |\n     * | `pitch`                |                           |\n     * | `pitchend`             |                           |\n     * | `boxzoomstart`         |                           |\n     * | `boxzoomend`           |                           |\n     * | `boxzoomcancel`        |                           |\n     * | `webglcontextlost`     |                           |\n     * | `webglcontextrestored` |                           |\n     * | `load`                 |                           |\n     * | `render`               |                           |\n     * | `idle`                 |                           |\n     * | `error`                |                           |\n     * | `data`                 |                           |\n     * | `styledata`            |                           |\n     * | `sourcedata`           |                           |\n     * | `dataloading`          |                           |\n     * | `styledataloading`     |                           |\n     * | `sourcedataloading`    |                           |\n     * | `styleimagemissing`    |                           |\n     * | `dataabort`            |                           |\n     * | `sourcedataabort`      |                           |\n     *\n     * @param type - The event type to listen for. Events compatible with the optional `layerId` parameter are triggered\n     * when the cursor enters a visible portion of the specified layer from outside that layer or outside the map canvas.\n     * @param layer - The ID of a style layer or a listener if no ID is provided. Event will only be triggered if its location\n     * is within a visible feature in this layer. The event will have a `features` property containing\n     * an array of the matching features. If `layer` is not supplied, the event will not have a `features` property.\n     * Please note that many event types are not compatible with the optional `layer` parameter.\n     * @param listener - The function to be called when the event is fired.\n     * @example\n     * ```ts\n     * // Set an event listener that will fire\n     * // when the map has finished loading\n     * map.on('load', () => {\n     *   // Once the map has finished loading,\n     *   // add a new layer\n     *   map.addLayer({\n     *     id: 'points-of-interest',\n     *     source: {\n     *       type: 'vector',\n     *       url: 'https://maplibre.org/maplibre-style-spec/'\n     *     },\n     *     'source-layer': 'poi_label',\n     *     type: 'circle',\n     *     paint: {\n     *       // MapLibre Style Specification paint properties\n     *     },\n     *     layout: {\n     *       // MapLibre Style Specification layout properties\n     *     }\n     *   });\n     * });\n     * ```\n     * @example\n     * ```ts\n     * // Set an event listener that will fire\n     * // when a feature on the countries layer of the map is clicked\n     * map.on('click', 'countries', (e) => {\n     *   new Popup()\n     *     .setLngLat(e.lngLat)\n     *     .setHTML(`Country name: ${e.features[0].properties.name}`)\n     *     .addTo(map);\n     * });\n     * ```\n     * @see [Display popup on click](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-click/)\n     * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js/docs/examples/center-the-map-on-a-clicked-symbol/)\n     * @see [Create a hover effect](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-hover-effect/)\n     * @see [Create a draggable marker](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    on<T extends keyof MapLayerEventType>(\n        type: T,\n        layer: string,\n        listener: (ev: MapLayerEventType[T] & Object) => void,\n    ): Subscription;\n    /**\n     * Overload of the `on` method that allows to listen to events specifying multiple layers.\n     * @event\n     * @param type - The type of the event.\n     * @param layerIds - The array of style layer IDs.\n     * @param listener - The listener callback.\n     */\n    on<T extends keyof MapLayerEventType>(\n        type: T,\n        layerIds: string[],\n        listener: (ev: MapLayerEventType[T] & Object) => void\n    ): Subscription;\n    /**\n     * Overload of the `on` method that allows to listen to events without specifying a layer.\n     * @event\n     * @param type - The type of the event.\n     * @param listener - The listener callback.\n     */\n    on<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & Object) => void): Subscription;\n    /**\n     * Overload of the `on` method that allows to listen to events without specifying a layer.\n     * @event\n     * @param type - The type of the event.\n     * @param listener - The listener callback.\n     */\n    on(type: keyof MapEventType, listener: Listener): Subscription;\n    on(type: keyof MapEventType, layerIdsOrListener: string | string[] | Listener, listener?: Listener): Subscription {\n        if (listener === undefined) {\n            return super.on(type, layerIdsOrListener as Listener);\n        }\n\n        const layerIds = typeof layerIdsOrListener === 'string' ? [layerIdsOrListener] : layerIdsOrListener as string[];\n\n        const delegatedListener = this._createDelegatedListener(type, layerIds, listener);\n\n        this._saveDelegatedListener(type, delegatedListener);\n\n        for (const event in delegatedListener.delegates) {\n            this.on(event as keyof MapEventType, delegatedListener.delegates[event]);\n        }\n\n        return {\n            unsubscribe: () => {\n                this._removeDelegatedListener(type, layerIds, listener);\n            }\n        };\n    }\n\n    /**\n     * Adds a listener that will be called only once to a specified event type, optionally limited to features in a specified style layer.\n     *\n     * @event\n     * @param type - The event type to listen for; one of `'mousedown'`, `'mouseup'`, `'click'`, `'dblclick'`,\n     * `'mousemove'`, `'mouseenter'`, `'mouseleave'`, `'mouseover'`, `'mouseout'`, `'contextmenu'`, `'touchstart'`,\n     * `'touchend'`, or `'touchcancel'`. `mouseenter` and `mouseover` events are triggered when the cursor enters\n     * a visible portion of the specified layer from outside that layer or outside the map canvas. `mouseleave`\n     * and `mouseout` events are triggered when the cursor leaves a visible portion of the specified layer, or leaves\n     * the map canvas.\n     * @param layer - The ID of a style layer or a listener if no ID is provided. Only events whose location is within a visible\n     * feature in this layer will trigger the listener. The event will have a `features` property containing\n     * an array of the matching features.\n     * @param listener - The function to be called when the event is fired.\n     * @returns `this` if listener is provided, promise otherwise to allow easier usage of async/await\n     */\n    once<T extends keyof MapLayerEventType>(\n        type: T,\n        layer: string,\n        listener: (ev: MapLayerEventType[T] & Object) => void,\n    ): this;\n    /**\n     * Overload of the `once` method that, with a single layer and no listener, returns a promise\n     * resolving with the event for easier usage of async/await.\n     * @event\n     * @param type - The type of the event.\n     * @param layer - The ID of the style layer.\n     */\n    once<T extends keyof MapLayerEventType>(\n        type: T,\n        layer: string,\n    ): Promise<MapLayerEventType[T] & Object>;\n    /**\n     * Overload of the `once` method that allows to listen to events specifying multiple layers.\n     * @event\n     * @param type - The type of the event.\n     * @param layerIds - The array of style layer IDs.\n     * @param listener - The listener callback.\n     */\n    once<T extends keyof MapLayerEventType>(\n        type: T,\n        layerIds: string[],\n        listener: (ev: MapLayerEventType[T] & Object) => void\n    ): this;\n    /**\n     * Overload of the `once` method that, with multiple layers and no listener, returns a promise\n     * resolving with the event for easier usage of async/await.\n     * @event\n     * @param type - The type of the event.\n     * @param layerIds - The array of style layer IDs.\n     */\n    once<T extends keyof MapLayerEventType>(\n        type: T,\n        layerIds: string[],\n    ): Promise<MapLayerEventType[T] & Object>;\n    /**\n     * Overload of the `once` method that allows to listen to events without specifying a layer.\n     * @event\n     * @param type - The type of the event.\n     * @param listener - The listener callback.\n     */\n    once<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & Object) => void): this;\n    /**\n     * Overload of the `once` method that returns a promise resolving with the event,\n     * for easier usage of async/await, when no listener is provided.\n     * @event\n     * @param type - The type of the event.\n     */\n    once<T extends keyof MapEventType>(type: T): Promise<MapEventType[T] & Object>;\n    /**\n     * Overload of the `once` method that allows to listen to events without specifying a layer.\n     * @event\n     * @param type - The type of the event.\n     * @param listener - The listener callback.\n     */\n    once(type: keyof MapEventType, listener?: Listener): this | Promise<any>;\n    once(type: keyof MapEventType, layerIdsOrListener?: string | string[] | Listener, listener?: Listener): this | Promise<any> {\n        if (listener === undefined) {\n            return super.once(type, layerIdsOrListener as Listener);\n        }\n\n        const layerIds = typeof layerIdsOrListener === 'string' ? [layerIdsOrListener] : layerIdsOrListener as string[];\n\n        const delegatedListener = this._createDelegatedListener(type, layerIds, listener);\n\n        for (const key in delegatedListener.delegates) {\n            const delegate: Delegate = delegatedListener.delegates[key];\n            delegatedListener.delegates[key] = (...args: Parameters<Delegate>) => {\n                this._removeDelegatedListener(type, layerIds, listener);\n                delegate(...args);\n            };\n        }\n\n        this._saveDelegatedListener(type, delegatedListener);\n\n        for (const event in delegatedListener.delegates) {\n            this.once(event as keyof MapEventType, delegatedListener.delegates[event]);\n        }\n\n        return this;\n    }\n\n    /**\n     * Removes an event listener for events previously added with `{@link Map.on}`.\n     *\n     * @event\n     * @param type - The event type previously used to install the listener.\n     * @param layer - The layer ID or listener previously used to install the listener.\n     * @param listener - The function previously installed as a listener.\n     */\n    off<T extends keyof MapLayerEventType>(\n        type: T,\n        layer: string,\n        listener: (ev: MapLayerEventType[T] & Object) => void,\n    ): this;\n    /**\n     * Overload of the `off` method that allows to remove an event created with multiple layers.\n     * Provide the same layer IDs as to `on` or `once`, when the listener was registered.\n     * @event\n     * @param type - The type of the event.\n     * @param layers - The layer IDs previously used to install the listener.\n     * @param listener - The function previously installed as a listener.\n     */\n    off<T extends keyof MapLayerEventType>(\n        type: T,\n        layers: string[],\n        listener: (ev: MapLayerEventType[T] & Object) => void,\n    ): this;\n    /**\n     * Overload of the `off` method that allows to remove an event created without specifying a layer.\n     * @event\n     * @param type - The type of the event.\n     * @param listener - The function previously installed as a listener.\n     */\n    off<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & Object) => void): this;\n    /**\n     * Overload of the `off` method that allows to remove an event created without specifying a layer.\n     * @event\n     * @param type - The type of the event.\n     * @param listener - The function previously installed as a listener.\n     */\n    off(type: keyof MapEventType, listener: Listener): this;\n    off(type: keyof MapEventType, layerIdsOrListener: string | string[] | Listener, listener?: Listener): this {\n        if (listener === undefined) {\n            return super.off(type, layerIdsOrListener as Listener);\n        }\n\n        const layerIds = typeof layerIdsOrListener === 'string' ? [layerIdsOrListener] : layerIdsOrListener as string[];\n        this._removeDelegatedListener(type, layerIds, listener);\n\n        return this;\n    }\n\n    /**\n     * Returns an array of MapGeoJSONFeature objects\n     * representing visible features that satisfy the query parameters.\n     *\n     * @param geometryOrOptions - (optional) The geometry of the query region in pixel points within the map viewport:\n     * either a single pixel point or a pair of top-left and bottom-right pixel points describing a bounding box.\n     * The origin of the pixel points is at the top-left of the map viewport.\n     * Omitting this parameter (i.e. calling {@link Map.queryRenderedFeatures} with zero arguments,\n     * or with only a `options` argument) is equivalent to passing a bounding box encompassing the entire\n     * map viewport.\n     * The geometryOrOptions can receive a {@link QueryRenderedFeaturesOptions} only to support a situation where the function receives only one parameter which is the options parameter.\n     * @param options - (optional) Options object.\n     *\n     * @returns An array of MapGeoJSONFeature objects.\n     *\n     * The `properties` value of each returned feature object contains the properties of its source feature. For GeoJSON sources, only\n     * string and numeric property values are supported (i.e. `null`, `Array`, and `Object` values are not supported).\n     *\n     * Each feature includes top-level `layer`, `source`, and `sourceLayer` properties. The `layer` property is an object\n     * representing the style layer to  which the feature belongs. Layout and paint properties in this object contain values\n     * which are fully evaluated for the given zoom level and feature.\n     *\n     * Only features that are currently rendered are included. Some features will **not** be included, like:\n     *\n     * - Features from layers whose `visibility` property is `\"none\"`.\n     * - Features from layers whose zoom range excludes the current zoom level.\n     * - Symbol features that have been hidden due to text or icon collision.\n     *\n     * Features from all other layers are included, including features that may have no visible\n     * contribution to the rendered result; for example, because the layer's opacity or color alpha component is set to\n     * 0.\n     *\n     * The topmost rendered feature appears first in the returned array, and subsequent features are sorted by\n     * descending z-order. Features that are rendered multiple times (due to wrapping across the antemeridian at low\n     * zoom levels) are returned only once (though subject to the following caveat).\n     *\n     * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature\n     * geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple\n     * times in query results. For example, suppose there is a highway running through the bounding rectangle of a query.\n     * The results of the query will be those parts of the highway that lie within the map tiles covering the bounding\n     * rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile\n     * will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple\n     * tiles due to tile buffering.\n     *\n     * @example\n     * Find all features at a point\n     * ```ts\n     * let features = map.queryRenderedFeatures(\n     *   [20, 35],\n     *   { layers: ['my-layer-name'] }\n     * );\n     * ```\n     *\n     * @example\n     * Find all features within a static bounding box\n     * ```ts\n     * let features = map.queryRenderedFeatures(\n     *   [[10, 20], [30, 50]],\n     *   { layers: ['my-layer-name'] }\n     * );\n     * ```\n     *\n     * @example\n     * Find all features within a bounding box around a point\n     * ```ts\n     * let width = 10;\n     * let height = 20;\n     * let features = map.queryRenderedFeatures([\n     *   [point.x - width / 2, point.y - height / 2],\n     *   [point.x + width / 2, point.y + height / 2]\n     * ], { layers: ['my-layer-name'] });\n     * ```\n     *\n     * @example\n     * Query all rendered features from a single layer\n     * ```ts\n     * let features = map.queryRenderedFeatures({ layers: ['my-layer-name'] });\n     * ```\n     * @see [Get features under the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-features-under-the-mouse-pointer/)\n     */\n    queryRenderedFeatures(geometryOrOptions?: PointLike | [PointLike, PointLike] | QueryRenderedFeaturesOptions, options?: QueryRenderedFeaturesOptions): MapGeoJSONFeature[] {\n        if (!this.style) {\n            return [];\n        }\n        let queryGeometry: Point[];\n        const isGeometry = geometryOrOptions instanceof Point || Array.isArray(geometryOrOptions);\n        const geometry = isGeometry ? geometryOrOptions : [[0, 0], [this._camera.transform.width, this._camera.transform.height]];\n        options ||= (isGeometry ? {} : geometryOrOptions) || {};\n\n        if (geometry instanceof Point || typeof geometry[0] === 'number') {\n            queryGeometry = [Point.convert(geometry as PointLike)];\n        } else {\n            const tl = Point.convert(geometry[0] as PointLike);\n            const br = Point.convert(geometry[1] as PointLike);\n            queryGeometry = [tl, new Point(br.x, tl.y), br, new Point(tl.x, br.y), tl];\n        }\n\n        return this.style.queryRenderedFeatures(queryGeometry, options, this._camera.transform);\n    }\n\n    /**\n     * Returns an array of MapGeoJSONFeature objects\n     * representing features within the specified vector tile or GeoJSON source that satisfy the query parameters.\n     *\n     * @param sourceId - The ID of the vector tile or GeoJSON source to query.\n     * @param parameters - The options object.\n     * @returns An array of MapGeoJSONFeature objects.\n     *\n     * In contrast to {@link Map.queryRenderedFeatures}, this function returns all features matching the query parameters,\n     * whether or not they are rendered by the current style (i.e. visible). The domain of the query includes all currently-loaded\n     * vector tiles and GeoJSON source tiles: this function does not check tiles outside the currently\n     * visible viewport.\n     *\n     * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature\n     * geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple\n     * times in query results. For example, suppose there is a highway running through the bounding rectangle of a query.\n     * The results of the query will be those parts of the highway that lie within the map tiles covering the bounding\n     * rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile\n     * will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple\n     * tiles due to tile buffering.\n     *\n     * @example\n     * Find all features in one source layer in a vector source\n     * ```ts\n     * let features = map.querySourceFeatures('your-source-id', {\n     *   sourceLayer: 'your-source-layer'\n     * });\n     * ```\n     *\n     */\n    querySourceFeatures(sourceId: string, parameters?: QuerySourceFeatureOptions | null): GeoJSONFeature[] {\n        return this.style.querySourceFeatures(sourceId, parameters);\n    }\n\n    /**\n     * Updates the map's MapLibre style object with a new value.\n     *\n     * If a style is already set when this is used and options.diff is set to true, the map renderer will attempt to compare the given style\n     * against the map's current state and perform only the changes necessary to make the map style match the desired state. Changes in sprites\n     * (images used for icons and patterns) and glyphs (fonts for label text) **cannot** be diffed. If the sprites or fonts used in the current\n     * style and the given style are different in any way, the map renderer will force a full update, removing the current style and building\n     * the given one from scratch.\n     *\n     *\n     * @param style - A JSON object conforming to the schema described in the\n     * [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL to such JSON.\n     * @param options - The options object.\n     *\n     * @example\n     * ```ts\n     * map.setStyle(\"https://demotiles.maplibre.org/style.json\");\n     *\n     * map.setStyle('https://demotiles.maplibre.org/style.json', {\n     *   transformStyle: (previousStyle, nextStyle) => ({\n     *       ...nextStyle,\n     *       sources: {\n     *           ...nextStyle.sources,\n     *           // copy a source from previous style\n     *           'osm': previousStyle.sources.osm\n     *       },\n     *       layers: [\n     *           // background layer\n     *           nextStyle.layers[0],\n     *           // copy a layer from previous style\n     *           previousStyle.layers[0],\n     *           // other layers from the next style\n     *           ...nextStyle.layers.slice(1).map(layer => {\n     *               // hide the layers we don't need from demotiles style\n     *               if (layer.id.startsWith('geolines')) {\n     *                   layer.layout = {...layer.layout || {}, visibility: 'none'};\n     *               // filter out US polygons\n     *               } else if (layer.id.startsWith('coastline') || layer.id.startsWith('countries')) {\n     *                   layer.filter = ['!=', ['get', 'ADM0_A3'], 'USA'];\n     *               }\n     *               return layer;\n     *           })\n     *       ]\n     *   })\n     * });\n     * ```\n     */\n    setStyle(style: StyleSpecification | string | null, options?: StyleSwapOptions & StyleOptions): this {\n        options = extend({},\n            {\n                localIdeographFontFamily: this._localIdeographFontFamily,\n                validate: this._validateStyle\n            }, options);\n\n        if ((options.diff !== false && options.localIdeographFontFamily === this._localIdeographFontFamily) && this.style && style) {\n            this._diffStyle(style, options);\n            return this;\n        } else {\n            this._localIdeographFontFamily = options.localIdeographFontFamily;\n            return this._updateStyle(style, options);\n        }\n    }\n\n    /**\n     *  Updates the requestManager's transform request with a new function\n     *\n     * @param transformRequest - A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.\n     * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties\n     *\n     * @example\n     * ```ts\n     * map.setTransformRequest((url: string, resourceType: string) => {});\n     * ```\n     */\n    setTransformRequest(transformRequest: RequestTransformFunction | null): this {\n        this._requestManager.setTransformRequest(transformRequest);\n        return this;\n    }\n\n    _getUIString(key: keyof typeof defaultLocale): string {\n        const str = this._locale[key];\n        if (str == null) {\n            throw new Error(`Missing UI string '${key}'`);\n        }\n\n        return str;\n    }\n\n    _updateStyle(style: StyleSpecification | string | null, options?: StyleSwapOptions & StyleOptions): this {\n        this._diffStyleRequest?.abort();\n        this._diffStyleRequest = null;\n        // transformStyle relies on having previous style serialized, if it is not loaded yet, delay _updateStyle until previous style is loaded\n        if (options.transformStyle && this.style && !this.style._loaded) {\n            this.style.once('style.load', () => this._updateStyle(style, options));\n            return;\n        }\n\n        const previousStyle = this.style && options.transformStyle ? this.style.serialize() : undefined;\n        if (this.style) {\n            this.style.setEventedParent(null);\n\n            // Only release workers when map is getting disposed\n            this.style._remove(!style);\n        }\n\n        if (!style) {\n            if (this._frameRequest) {\n                this._frameRequest.abort();\n                this._frameRequest = null;\n            }\n            this.style?.projection?.destroy();\n            delete this.style;\n            return this;\n        } else {\n            this.style = new Style(this, options || {});\n        }\n\n        this.style.setEventedParent(this, {style: this.style});\n\n        if (typeof style === 'string') {\n            this.style.loadURL(style, options, previousStyle);\n        } else {\n            this.style.loadJSON(style, options, previousStyle);\n        }\n\n        return this;\n    }\n\n    _lazyInitEmptyStyle(): void {\n        if (!this.style) {\n            this.style = new Style(this, {});\n            this.style.setEventedParent(this, {style: this.style});\n            this.style.loadEmpty();\n        }\n    }\n\n    async _diffStyle(style: StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): Promise<void> {\n        this._diffStyleRequest?.abort();\n        if (typeof style === 'string') {\n            const url = style;\n            this._diffStyleRequest = new AbortController();\n            const abortController = this._diffStyleRequest;\n            try {\n                const request = await this._requestManager.transformRequest(url, ResourceType.Style);\n                if (abortController.signal.aborted) {\n                    this._diffStyleRequest = null;\n                    return;\n                }\n\n                const response = await getJSON<StyleSpecification>(request, abortController);\n                this._diffStyleRequest = null;\n                this._updateDiff(response.data, options);\n            } catch (error) {\n                this._diffStyleRequest = null;\n                if (!isAbortError(error)) {\n                    this.fire(new ErrorEvent(ensureError(error)));\n                }\n            }\n        } else if (typeof style === 'object') {\n            this._diffStyleRequest = null;\n            this._updateDiff(style, options);\n        }\n    }\n\n    _updateDiff(style: StyleSpecification, options?: StyleSwapOptions & StyleOptions): void {\n        try {\n            if (this.style.setState(style, options)) {\n                this._update(true);\n            }\n        } catch (e) {\n            warnOnce(\n                `Unable to perform style diff: ${ensureError(e).message}.  Rebuilding the style from scratch.`\n            );\n            this._updateStyle(style, options);\n        }\n    }\n\n    /**\n     * Returns the map's MapLibre style object, a JSON object which can be used to recreate the map's style.\n     *\n     * @returns The map's style JSON object.\n     *\n     * @example\n     * ```ts\n     * let styleJson = map.getStyle();\n     * ```\n     *\n     */\n    getStyle(): StyleSpecification {\n        if (this.style) {\n            return this.style.serialize();\n        }\n    }\n\n    /**\n     * @internal\n     * Returns the map's style and cloned images to restore context.\n     * @returns An object containing the style and images.\n     */\n    _getStyleAndImages(): LostContextStyle {\n        if (this.style) {\n            return {\n                style: this.style.serialize(),\n                images: this.style.imageManager.cloneImages()\n            };\n        }\n        return {style: null, images: {}};\n    }\n\n    /**\n     * Returns a Boolean indicating whether the map's style is fully loaded.\n     *\n     * @returns A Boolean indicating whether the style is fully loaded.\n     *\n     * @example\n     * ```ts\n     * let styleLoadStatus = map.isStyleLoaded();\n     * ```\n     */\n    isStyleLoaded(): boolean | void {\n        if (!this.style) {\n            warnOnce('There is no style added to the map.');\n            return;\n        }\n        return this.style.loaded();\n    }\n\n    /**\n     * Adds a source to the map's style.\n     *\n     * Events triggered:\n     *\n     * Triggers the `source.add` event.\n     *\n     * @param id - The ID of the source to add. Must not conflict with existing sources.\n     * @param source - The source object, conforming to the\n     * MapLibre Style Specification's [source definition](https://maplibre.org/maplibre-style-spec/sources) or\n     * {@link CanvasSourceSpecification}.\n     * @example\n     * ```ts\n     * map.addSource('my-data', {\n     *   type: 'vector',\n     *   url: 'https://demotiles.maplibre.org/tiles/tiles.json'\n     * });\n     * ```\n     * @example\n     * ```ts\n     * map.addSource('my-data', {\n     *   \"type\": \"geojson\",\n     *   \"data\": {\n     *     \"type\": \"Feature\",\n     *     \"geometry\": {\n     *       \"type\": \"Point\",\n     *       \"coordinates\": [-77.0396, 38.8891]\n     *     },\n     *     \"properties\": {\n     *       \"title\": \"Washington DC\",\n     *       \"marker-symbol\": \"monument\"\n     *     }\n     *   }\n     * });\n     * ```\n     * @see GeoJSON source: [Add live realtime data](https://maplibre.org/maplibre-gl-js/docs/examples/add-live-realtime-data/)\n     */\n    addSource(id: string, source: SourceSpecification | CanvasSourceSpecification): this {\n        this._lazyInitEmptyStyle();\n        this.style.addSource(id, source);\n        return this._update(true);\n    }\n\n    /**\n     * Returns a Boolean indicating whether the source is loaded. Returns `true` if the source with\n     * the given ID in the map's style has no outstanding network requests, otherwise `false`.\n     *\n     * A {@link ErrorEvent} event will be fired if there is no source with the specified ID.\n     *\n     * @param id - The ID of the source to be checked.\n     * @returns A Boolean indicating whether the source is loaded.\n     * @example\n     * ```ts\n     * let sourceLoaded = map.isSourceLoaded('bathymetry-data');\n     * ```\n     */\n    isSourceLoaded(id: string): boolean {\n        const tileManager = this.style?.tileManagers[id];\n        if (tileManager === undefined) {\n            this.fire(new ErrorEvent(new Error(`There is no tile manager with ID '${id}'`)));\n            return;\n        }\n        return tileManager.loaded();\n    }\n\n    /**\n     * Loads a 3D terrain mesh, based on a \"raster-dem\" source.\n     *\n     * Triggers the `terrain` event.\n     *\n     * @param options - Options object.\n     * @example\n     * ```ts\n     * map.setTerrain({ source: 'terrain' });\n     * ```\n     */\n    setTerrain(options: TerrainSpecification | null, styleOptions: StyleSetterOptions = {}): this {\n        this.style._checkLoaded();\n\n        if (options && validateAndEmit(this, validateStyle.terrain, {value: options}, styleOptions)) {\n            return this;\n        }\n\n        // clear event handlers\n        if (this._terrainDataCallback) this.style.off('data', this._terrainDataCallback);\n\n        if (!options) {\n            // remove terrain\n            if (this.terrain) {\n                this.terrain.destroy();\n            }\n            this.terrain = null;\n            this.painter.renderToTexture = null;\n            this._camera.terrain = null;\n            this._camera.transform.setMinElevationForCurrentTile(0);\n            if (this.getCenterClampedToGround()) {\n                this._camera.transform.setElevation(0);\n            }\n        } else {\n            // add terrain\n            const tileManager = this.style.tileManagers[options.source];\n            if (!tileManager) throw new Error(`cannot load terrain, because there exists no source with ID: ${options.source}`);\n            // Update terrain tiles when adding new terrain\n            if (this.terrain === null) tileManager.reload();\n            // Warn once if user is using the same source for hillshade/color-relief and terrain\n            for (const index in this.style._layers) {\n                const thisLayer = this.style._layers[index];\n                if (thisLayer.type === 'hillshade' && thisLayer.source === options.source) {\n                    warnOnce('You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.');\n                }\n                if (thisLayer.type === 'color-relief' && thisLayer.source === options.source) {\n                    warnOnce('You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.');\n                }\n            }\n            if (this.terrain) {\n                this.terrain.destroy();\n            }\n            this.terrain = new Terrain(this.painter, tileManager, options, this._terrainSkirtLength);\n            this.painter.renderToTexture = new RenderToTexture(this.painter, this.terrain);\n            this._camera.terrain = this.terrain;\n            this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center, this._camera.transform.tileZoom));\n            this._camera.transform.setElevation(this.terrain.getElevationForLngLatZoom(this._camera.transform.center, this._camera.transform.tileZoom));\n            this._terrainDataCallback = e => this._handleTerrainDataEvent(e, options.source);\n            this.style.on('data', this._terrainDataCallback);\n        }\n\n        this.fire(new MapTerrainEvent({terrain: options}));\n        return this;\n    }\n\n    private _handleTerrainDataEvent(event: MapStyleDataEvent | MapSourceDataEvent, terrainSourceId: string): void {\n        if (event.dataType === 'style') {\n            this.terrain.tileManager.releaseAllRTT();\n            return;\n        }\n\n        const isTerrainSourceEvent = event.sourceId === terrainSourceId;\n        if (isTerrainSourceEvent) {\n            this.terrain.resetElevationCache();\n        }\n        if (isTerrainSourceEvent && event.tile && !this._camera.elevationFreeze) {\n            this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center, this._camera.transform.tileZoom));\n            if (this.getCenterClampedToGround()) {\n                this._camera.transform.setElevation(this.terrain.getElevationForLngLatZoom(this._camera.transform.center, this._camera.transform.tileZoom));\n            }\n        }\n\n        if (!event.tile) return;\n        if (event.source?.type === 'image') {\n            this.terrain.tileManager.releaseAllRTT();\n            return;\n        }\n        this.terrain.tileManager.releaseRTT(event.tile.tileID);\n    }\n\n    /**\n     * Get the terrain-options if terrain is loaded\n     * @returns the TerrainSpecification passed to setTerrain\n     * @example\n     * ```ts\n     * map.getTerrain(); // { source: 'terrain' };\n     * ```\n     */\n    getTerrain(): TerrainSpecification | null {\n        return this.terrain?.options ?? null;\n    }\n\n    /**\n     * Returns a Boolean indicating whether all tiles in the viewport from all sources on\n     * the style are loaded.\n     *\n     * @returns A Boolean indicating whether all tiles are loaded.\n     * @example\n     * ```ts\n     * let tilesLoaded = map.areTilesLoaded();\n     * ```\n     */\n    areTilesLoaded(): boolean {\n        const tileManagers = this.style?.tileManagers;\n        for (const tileManager of Object.values(tileManagers)) {\n            if (!tileManager.areTilesLoaded()) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * Removes a source from the map's style.\n     *\n     * @param id - The ID of the source to remove.\n     * @example\n     * ```ts\n     * map.removeSource('bathymetry-data');\n     * ```\n     */\n    removeSource(id: string): this {\n        this.style.removeSource(id);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the source with the specified ID in the map's style.\n     *\n     * This method is often used to update a source using the instance members for the relevant\n     * source type as defined in classes that derive from {@link Source}.\n     * For example, setting the `data` for a GeoJSON source or updating the `url` and `coordinates`\n     * of an image source.\n     *\n     * @param id - The ID of the source to get.\n     * @returns The style source with the specified ID or `undefined` if the ID\n     * corresponds to no existing sources.\n     * The shape of the object varies by source type.\n     * A list of options for each source type is available on the MapLibre Style Specification's\n     * [Sources](https://maplibre.org/maplibre-style-spec/sources/) page.\n     * @example\n     * ```ts\n     * let sourceObject = map.getSource('points');\n     * ```\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     * @see [Animate a point](https://maplibre.org/maplibre-gl-js/docs/examples/animate-a-point/)\n     * @see [Add live realtime data](https://maplibre.org/maplibre-gl-js/docs/examples/add-live-realtime-data/)\n     */\n    getSource<TSource extends Source>(id: string): TSource | undefined {\n        return this.style?.getSource(id) as TSource | undefined;\n    }\n\n    /**\n     * Change the tile Level of Detail behavior of the specified source. These parameters have no effect when\n     * pitch == 0, and the largest effect when the horizon is visible on screen.\n     *\n     * @param maxZoomLevelsOnScreen - The maximum number of distinct zoom levels allowed on screen at a time.\n     * There will generally be fewer zoom levels on the screen, the maximum can only be reached when the horizon\n     * is at the top of the screen. Increasing the maximum number of zoom levels causes the zoom level to decay\n     * faster toward the horizon.\n     * @param tileCountMaxMinRatio - The ratio of the maximum number of tiles loaded (at high pitch) to the minimum\n     * number of tiles loaded. Increasing this ratio allows more tiles to be loaded at high pitch angles. If the ratio\n     * would otherwise be exceeded, the zoom level is reduced uniformly to keep the number of tiles within the limit.\n     * @param sourceId - The ID of the source to set tile LOD parameters for. All sources will be updated if unspecified.\n     * If `sourceId` is specified but a corresponding source does not exist, an error is thrown.\n     * @example\n     * ```ts\n     * map.setSourceTileLodParams(4.0, 3.0, 'terrain');\n     * ```\n     * @see [Modify Level of Detail behavior](https://maplibre.org/maplibre-gl-js/docs/examples/level-of-detail-control/)\n\n     */\n    setSourceTileLodParams(maxZoomLevelsOnScreen: number, tileCountMaxMinRatio: number, sourceId?: string) : this {\n        if (sourceId) {\n            const source = this.getSource(sourceId);\n            if(!source) {\n                throw new Error(`There is no source with ID \"${sourceId}\", cannot set LOD parameters`);\n            }\n            source.calculateTileZoom = createCalculateTileZoomFunction(Math.max(1, maxZoomLevelsOnScreen), Math.max(1, tileCountMaxMinRatio));\n        } else {\n            for (const id in this.style.tileManagers) {\n                this.style.tileManagers[id].getSource().calculateTileZoom = createCalculateTileZoomFunction(Math.max(1, maxZoomLevelsOnScreen), Math.max(1, tileCountMaxMinRatio));\n            }\n        }\n        this._update(true);\n        return this;\n    }\n\n    /**\n     * Triggers a reload of the selected tiles\n     *\n     * @param sourceId - The ID of the source\n     * @param tileIds - An array of tile IDs to be reloaded. If not defined, all tiles will be reloaded.\n     * @example\n     * ```ts\n     * map.refreshTiles('satellite', [{x:1024, y: 1023, z: 11}, {x:1023, y: 1023, z: 11}]);\n     * ```\n     */\n    refreshTiles(sourceId: string, tileIds?: Array<{x: number; y: number; z: number}>): void {\n        const tileManager = this.style.tileManagers[sourceId];\n        if(!tileManager) {\n            throw new Error(`There is no tile manager with ID \"${sourceId}\", cannot refresh tile`);\n        }\n        if (tileIds === undefined) {\n            tileManager.reload(true);\n        } else {\n            tileManager.refreshTiles(tileIds.map((tileId) => {return new CanonicalTileID(tileId.z, tileId.x, tileId.y);}));\n        }\n    }\n\n    /**\n     * Add an image to the style. This image can be displayed on the map like any other icon in the style's\n     * sprite using the image's ID with\n     * [`icon-image`](https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-image),\n     * [`background-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-background-background-pattern),\n     * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-fill-fill-pattern),\n     * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-line-line-pattern).\n     *\n     * A {@link ErrorEvent} event will be fired if the image parameter is invalid or there is not enough space in the sprite to add this image.\n     *\n     * @param id - The ID of the image.\n     * @param image - The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`\n     * properties with the same format as `ImageData`.\n     * @param options - Options object.\n     * @example\n     * ```ts\n     * // If the style's sprite does not already contain an image with ID 'cat',\n     * // add the image 'cat-icon.png' to the style's sprite with the ID 'cat'.\n     * const image = await map.loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Cat_silhouette.svg/400px-Cat_silhouette.svg.png');\n     * if (!map.hasImage('cat')) map.addImage('cat', image.data);\n     *\n     * // Add a stretchable image that can be used with `icon-text-fit`\n     * // In this example, the image is 600px wide by 400px high.\n     * const image = await map.loadImage('https://upload.wikimedia.org/wikipedia/commons/8/89/Black_and_White_Boxed_%28bordered%29.png');\n     * if (map.hasImage('border-image')) return;\n     * map.addImage('border-image', image.data, {\n     *     content: [16, 16, 300, 384], // place text over left half of image, avoiding the 16px border\n     *     stretchX: [[16, 584]], // stretch everything horizontally except the 16px border\n     *     stretchY: [[16, 384]], // stretch everything vertically except the 16px border\n     * });\n     * ```\n     * @see Use `HTMLImageElement`: [Add an icon to the map](https://maplibre.org/maplibre-gl-js/docs/examples/add-an-icon-to-the-map/)\n     * @see Use `ImageData`: [Add a generated icon to the map](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-generated-icon-to-the-map/)\n     */\n    addImage(id: string, image: StyleImageSource, options: Partial<StyleImageMetadata> = {}): this {\n        this._lazyInitEmptyStyle();\n        const styleImage = this._createStyleImage(image, options);\n        if (!styleImage) {\n            return this;\n        }\n\n        this.style.addImage(id, styleImage);\n        if (styleImage.userImage?.onAdd) {\n            styleImage.userImage.onAdd(this, id);\n        }\n        return this;\n    }\n\n    /**\n     * Sets a callback that is invoked when an icon or pattern needed by the style is missing.\n     *\n     * The resolver typically loads or generates the image and registers it with {@link Map.addImage}.\n     * MapLibre awaits the returned promise before treating the image as missing, so async work is\n     * supported. If the image is still missing afterwards, the `styleimagemissing` event is fired.\n     *\n     * @param resolver - Callback used to resolve missing images, or `null` to remove the resolver.\n     * @example\n     * ```ts\n     * map.setMissingStyleImageResolver(async (id) => {\n     *     const response = await fetch(`/icons/${id}.png`);\n     *     const image = await createImageBitmap(await response.blob());\n     *     map.addImage(id, image, {pixelRatio: 2});\n     * });\n     * ```\n     */\n    setMissingStyleImageResolver(resolver: MissingStyleImageResolver | null): this {\n        this._missingStyleImageResolver = resolver;\n        this.style?.setMissingImageResolver(resolver);\n        return this;\n    }\n\n    _createStyleImage(image: StyleImageSource, options: Partial<StyleImageMetadata> = {}): StyleImage | null {\n        const {\n            pixelRatio = 1,\n            sdf = false,\n            stretchX,\n            stretchY,\n            content,\n            textFitWidth,\n            textFitHeight\n        } = options;\n        const version = 0;\n\n        if (image instanceof HTMLImageElement || isImageBitmap(image)) {\n            const {width, height, data} = browser.getImageData(image);\n            return {data: new RGBAImage({width, height}, data), pixelRatio, stretchX, stretchY, content, textFitWidth, textFitHeight, sdf, version};\n        } else if (image.width === undefined || image.height === undefined) {\n            this.fire(new ErrorEvent(new Error(\n                'Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, ' +\n                'or object with `width`, `height`, and `data` properties with the same format as `ImageData`')));\n            return null;\n        } else {\n            const {width, height, data} = image as ImageData;\n            const userImage = (image as any as StyleImageInterface);\n\n            return {\n                data: new RGBAImage({width, height}, new Uint8Array(data)),\n                pixelRatio,\n                stretchX,\n                stretchY,\n                content,\n                textFitWidth,\n                textFitHeight,\n                sdf,\n                version,\n                userImage\n            };\n        }\n    }\n\n    /**\n     * Update an existing image in a style. This image can be displayed on the map like any other icon in the style's\n     * sprite using the image's ID with\n     * [`icon-image`](https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-image),\n     * [`background-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-background-background-pattern),\n     * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-fill-fill-pattern),\n     * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-line-line-pattern).\n     *\n     * An {@link ErrorEvent} will be fired if the image parameter is invalid.\n     *\n     * @param id - The ID of the image.\n     * @param image - The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`\n     * properties with the same format as `ImageData`.\n     * @example\n     * ```ts\n     * // If an image with the ID 'cat' already exists in the style's sprite,\n     * // replace that image with a new image, 'other-cat-icon.png'.\n     * if (map.hasImage('cat')) map.updateImage('cat', './other-cat-icon.png');\n     * ```\n     */\n    updateImage(id: string, image: StyleImageSource): this {\n\n        const existingImage = this.style.getImage(id);\n        if (!existingImage) {\n            return this.fire(new ErrorEvent(new Error(\n                'The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.')));\n        }\n        const imageData = (image instanceof HTMLImageElement || isImageBitmap(image)) ?\n            browser.getImageData(image) :\n            image;\n        const {width, height, data} = imageData;\n\n        if (width === undefined || height === undefined) {\n            return this.fire(new ErrorEvent(new Error(\n                'Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, ' +\n                'or object with `width`, `height`, and `data` properties with the same format as `ImageData`')));\n        }\n\n        if (width !== existingImage.data.width || height !== existingImage.data.height) {\n            return this.fire(new ErrorEvent(new Error(\n                'The width and height of the updated image must be that same as the previous version of the image')));\n        }\n\n        const copy = !(image instanceof HTMLImageElement || isImageBitmap(image));\n        existingImage.data.replace(data, copy);\n\n        this.style.updateImage(id, existingImage);\n        return this;\n    }\n\n    /**\n     * Returns an image, specified by ID, currently available in the map.\n     * This includes both images from the style's original sprite\n     * and any images that have been added at runtime using {@link Map.addImage}.\n     *\n     * @param id - The ID of the image.\n     * @returns An image in the map with the specified ID.\n     *\n     * @example\n     * ```ts\n     * let coffeeShopIcon = map.getImage(\"coffee_cup\");\n     * ```\n     */\n    getImage(id: string): StyleImage {\n        return this.style.getImage(id);\n    }\n\n    /**\n     * Check whether or not an image with a specific ID exists in the style. This checks both images\n     * in the style's original sprite and any images\n     * that have been added at runtime using {@link Map.addImage}.\n     *\n     * An {@link ErrorEvent} will be fired if the image ID is missing.\n     *\n     * @param id - The ID of the image.\n     *\n     * @returns A Boolean indicating whether the image exists.\n     * @example\n     * Check if an image with the ID 'cat' exists in the style's sprite.\n     * ```ts\n     * let catIconExists = map.hasImage('cat');\n     * ```\n     */\n    hasImage(id: string): boolean {\n        if (!id) {\n            this.fire(new ErrorEvent(new Error('Missing required image id')));\n            return false;\n        }\n\n        return !!this.style.getImage(id);\n    }\n\n    /**\n     * Remove an image from a style. This can be an image from the style's original\n     * sprite or any images\n     * that have been added at runtime using {@link Map.addImage}.\n     *\n     * @param id - The ID of the image.\n     *\n     * @example\n     * ```ts\n     * // If an image with the ID 'cat' exists in\n     * // the style's sprite, remove it.\n     * if (map.hasImage('cat')) map.removeImage('cat');\n     * ```\n     */\n    removeImage(id: string): void {\n        this.style.removeImage(id);\n    }\n\n    /**\n     * Load an image from an external URL to be used with {@link Map.addImage}. External\n     * domains must support [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS).\n     *\n     * @param url - The URL of the image file. Image file must be in png, webp, or jpg format.\n     * @returns a promise that is resolved when the image is loaded\n     *\n     * @example\n     * Load an image from an external URL.\n     * ```ts\n     * const response = await map.loadImage('https://picsum.photos/50/50');\n     * // Add the loaded image to the style's sprite with the ID 'photo'.\n     * map.addImage('photo', response.data);\n     * ```\n     * @see [Add an icon to the map](https://maplibre.org/maplibre-gl-js/docs/examples/add-an-icon-to-the-map/)\n     */\n    async loadImage(url: string): Promise<GetResourceResponse<HTMLImageElement | ImageBitmap>> {\n        return ImageRequest.getImage(await this._requestManager.transformRequest(url, ResourceType.Image), new AbortController());\n    }\n\n    /**\n     * Returns an Array of strings containing the IDs of all images currently available in the map.\n     * This includes both images from the style's original sprite\n     * and any images that have been added at runtime using {@link Map.addImage}.\n     *\n     * @returns An Array of strings containing the names of all sprites/images currently available in the map.\n     *\n     * @example\n     * ```ts\n     * let allImages = map.listImages();\n     * ```\n     */\n    listImages(): string[] {\n        return this.style?.listImages() ?? [];\n    }\n\n    /**\n     * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)\n     * to the map's style.\n     *\n     * A layer defines how data from a specified source will be styled. Read more about layer types\n     * and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).\n     *\n     * @param layer - The layer to add,\n     * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,\n     * less commonly, the {@link CustomLayerInterface} specification. Can also be a layer definition with an embedded source definition.\n     * The MapLibre Style Specification's layer definition is appropriate for most layers.\n     *\n     * @param beforeId - The ID of an existing layer to insert the new layer before,\n     * resulting in the new layer appearing visually beneath the existing layer.\n     * If this argument is not specified, the layer will be appended to the end of the layers array\n     * and appear visually above all other layers.\n     *\n     * @example\n     * Add a circle layer with a vector source\n     * ```ts\n     * map.addLayer({\n     *   id: 'points-of-interest',\n     *   source: {\n     *     type: 'vector',\n     *     url: 'https://demotiles.maplibre.org/tiles/tiles.json'\n     *   },\n     *   'source-layer': 'poi_label',\n     *   type: 'circle',\n     *   paint: {\n     *     // MapLibre Style Specification paint properties\n     *   },\n     *   layout: {\n     *     // MapLibre Style Specification layout properties\n     *   }\n     * });\n     * ```\n     *\n     * @example\n     * Define a source before using it to create a new layer\n     * ```ts\n     * map.addSource('state-data', {\n     *   type: 'geojson',\n     *   data: 'path/to/data.geojson'\n     * });\n     *\n     * map.addLayer({\n     *   id: 'states',\n     *   // References the GeoJSON source defined above\n     *   // and does not require a `source-layer`\n     *   source: 'state-data',\n     *   type: 'symbol',\n     *   layout: {\n     *     // Set the label content to the\n     *     // feature's `name` property\n     *     text-field: ['get', 'name']\n     *   }\n     * });\n     * ```\n     *\n     * @example\n     * Add a new symbol layer before an existing layer\n     * ```ts\n     * map.addLayer({\n     *   id: 'states',\n     *   // References a source that's already been defined\n     *   source: 'state-data',\n     *   type: 'symbol',\n     *   layout: {\n     *     // Set the label content to the\n     *     // feature's `name` property\n     *     text-field: ['get', 'name']\n     *   }\n     * // Add the layer before the existing `cities` layer\n     * }, 'cities');\n     * ```\n     * @see [Create and style clusters](https://maplibre.org/maplibre-gl-js/docs/examples/create-and-style-clusters/)\n     * @see [Add a vector tile source](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-vector-tile-source/)\n     * @see [Add a WMS source](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-wms-source/)\n     */\n    addLayer(layer: AddLayerObject, beforeId?: string): this {\n        this._lazyInitEmptyStyle();\n        this.style.addLayer(layer, beforeId);\n        return this._update(true);\n    }\n\n    /**\n     * Moves a layer to a different z-position.\n     *\n     * @param id - The ID of the layer to move.\n     * @param beforeId - The ID of an existing layer to insert the new layer before. When viewing the map, the `id` layer will appear beneath the `beforeId` layer. If `beforeId` is omitted, the layer will be appended to the end of the layers array and appear above all other layers on the map.\n     *\n     * @example\n     * Move a layer with ID 'polygon' before the layer with ID 'country-label'. The `polygon` layer will appear beneath the `country-label` layer on the map.\n     * ```ts\n     * map.moveLayer('polygon', 'country-label');\n     * ```\n     */\n    moveLayer(id: string, beforeId?: string): this {\n        this.style.moveLayer(id, beforeId);\n        return this._update(true);\n    }\n\n    /**\n     * Removes the layer with the given ID from the map's style.\n     *\n     * An {@link ErrorEvent} will be fired if no such layer exists.\n     *\n     * @param id - The ID of the layer to remove\n     *\n     * @example\n     * If a layer with ID 'state-data' exists, remove it.\n     * ```ts\n     * if (map.getLayer('state-data')) map.removeLayer('state-data');\n     * ```\n     */\n    removeLayer(id: string): this {\n        this.style.removeLayer(id);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the layer with the specified ID in the map's style.\n     *\n     * @param id - The ID of the layer to get.\n     * @returns The layer with the specified ID, or `undefined`\n     * if the ID corresponds to no existing layers.\n     *\n     * @example\n     * ```ts\n     * let stateDataLayer = map.getLayer('state-data');\n     * ```\n     * @see [Filter symbols by toggling a list](https://maplibre.org/maplibre-gl-js/docs/examples/filter-symbols-by-toggling-a-list/)\n     * @see [Filter symbols by text input](https://maplibre.org/maplibre-gl-js/docs/examples/filter-symbols-by-text-input/)\n     */\n    getLayer(id: string): StyleLayer | undefined {\n        return this.style?.getLayer(id);\n    }\n\n    /**\n     * Return the ids of all layers currently in the style, including custom layers, in order.\n     *\n     * @returns ids of layers, in order\n     *\n     * @example\n     * ```ts\n     * const orderedLayerIds = map.getLayersOrder();\n     * ```\n     */\n    getLayersOrder(): string[] {\n        return this.style?.getLayersOrder() ?? [];\n    }\n\n    /**\n     * Sets the zoom extent for the specified style layer. The zoom extent includes the\n     * [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)\n     * and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))\n     * at which the layer will be rendered.\n     *\n     * !!! note\n     *     For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the\n     *     minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum\n     *     zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style\n     *     layer will not be rendered at all zoom levels in the zoom range.\n     *\n     * @param layerId - The ID of the layer to which the zoom extent will be applied.\n     * @param minzoom - The minimum zoom to set (0-24).\n     * @param maxzoom - The maximum zoom to set (0-24).\n     *\n     * @example\n     * ```ts\n     * map.setLayerZoomRange('my-layer', 2, 5);\n     * ```\n     */\n    setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this {\n        this.style.setLayerZoomRange(layerId, minzoom, maxzoom);\n        return this._update(true);\n    }\n\n    /**\n     * Sets the filter for the specified style layer.\n     *\n     * Filters control which features a style layer renders from its source.\n     * Any feature for which the filter expression evaluates to `true` will be\n     * rendered on the map. Those that are false will be hidden.\n     *\n     * Use `setFilter` to show a subset of your source data.\n     *\n     * To clear the filter, pass `null` or `undefined` as the second parameter.\n     *\n     * @param layerId - The ID of the layer to which the filter will be applied.\n     * @param filter - The filter, conforming to the MapLibre Style Specification's\n     * [filter definition](https://maplibre.org/maplibre-style-spec/layers/#filter).  If `null` or `undefined` is provided, the function removes any existing filter from the layer.\n     * @param options - Options object.\n     *\n     * @example\n     * Display only features with the 'name' property 'USA'\n     * ```ts\n     * map.setFilter('my-layer', ['==', ['get', 'name'], 'USA']);\n     * ```\n     * @example\n     * Display only features with five or more 'available-spots'\n     * ```ts\n     * map.setFilter('bike-docks', ['>=', ['get', 'available-spots'], 5]);\n     * ```\n     * @example\n     * Remove the filter for the 'bike-docks' style layer\n     * ```ts\n     * map.setFilter('bike-docks', null);\n     * ```\n     * @see [Create a timeline animation](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-time-slider/)\n     */\n    setFilter(layerId: string, filter?: FilterSpecification | null, options: StyleSetterOptions = {}): this {\n        this.style?.setFilter(layerId, filter, options);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the filter applied to the specified style layer.\n     *\n     * @param layerId - The ID of the style layer whose filter to get.\n     * @returns The layer's filter.\n     */\n    getFilter(layerId: string): FilterSpecification | void {\n        return this.style.getFilter(layerId);\n    }\n\n    /**\n     * Sets the value of a paint property in the specified style layer.\n     *\n     * @param layerId - The ID of the layer to set the paint property in.\n     * @param name - The name of the paint property to set.\n     * @param value - The value of the paint property to set.\n     * Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).\n     * Pass `null` to unset the existing value.\n     * @param options - Options object.\n     * @example\n     * ```ts\n     * map.setPaintProperty('my-layer', 'fill-color', '#faafee');\n     * ```\n     * @see [Change a layer's color with buttons](https://maplibre.org/maplibre-gl-js/docs/examples/change-a-layers-color-with-buttons/)\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    setPaintProperty<K extends keyof AllPaintProperties>(layerId: string, name: K, value: AllPaintProperties[K], options: StyleSetterOptions = {}): this {\n        this.style?.setPaintProperty(layerId, name, value, options);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the value of a paint property in the specified style layer.\n     *\n     * @param layerId - The ID of the layer to get the paint property from.\n     * @param name - The name of a paint property to get.\n     * @returns The value of the specified paint property.\n     */\n    getPaintProperty<K extends keyof AllPaintProperties>(layerId: string, name: K): AllPaintProperties[K] {\n        return this.style.getPaintProperty(layerId, name);\n    }\n\n    /**\n     * Sets the value of a layout property in the specified style layer.\n     *\n     * @param layerId - The ID of the layer to set the layout property in.\n     * @param name - The name of the layout property to set.\n     * @param value - The value of the layout property. Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).\n     * @param options - The options object.\n     * @example\n     * ```ts\n     * map.setLayoutProperty('my-layer', 'visibility', 'none');\n     * ```\n     */\n    setLayoutProperty<K extends keyof AllLayoutProperties>(layerId: string, name: K, value: AllLayoutProperties[K], options: StyleSetterOptions = {}): this {\n        this.style.setLayoutProperty(layerId, name, value, options);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the value of a layout property in the specified style layer.\n     *\n     * @param layerId - The ID of the layer to get the layout property from.\n     * @param name - The name of the layout property to get.\n     * @returns The value of the specified layout property.\n     */\n    getLayoutProperty<K extends keyof AllLayoutProperties>(layerId: string, name: K): AllLayoutProperties[K] | undefined {\n        return this.style.getLayoutProperty(layerId, name);\n    }\n\n    /**\n    * Sets the value of the style's glyphs property. Pass a falsy value (null or undefined)\n    * to unset glyphs.\n     *\n     * @param glyphsUrl - Glyph URL to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/glyphs/).\n     * @param options - Options object.\n     * @example\n     * ```ts\n     * map.setGlyphs('https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf');\n     * ```\n     */\n    setGlyphs(glyphsUrl: string | null | undefined, options: StyleSetterOptions = {}): this {\n        this._lazyInitEmptyStyle();\n        this.style.setGlyphs(glyphsUrl, options);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the value of the style's glyphs URL\n     *\n     * @returns glyphs Style's glyphs url, or `null` if glyphs are unset.\n     */\n    getGlyphs(): string | null {\n        return this.style.getGlyphsUrl();\n    }\n\n    /**\n     * Adds a sprite to the map's style. Fires the `style` event.\n     *\n     * @param id - The ID of the sprite to add. Must not conflict with existing sprites.\n     * @param url - The URL to load the sprite from\n     * @param options - Options object.\n     * @example\n     * ```ts\n     * map.addSprite('sprite-two', 'http://example.com/sprite-two');\n     * ```\n     */\n    addSprite(id: string, url: string, options: StyleSetterOptions = {}): this {\n        this._lazyInitEmptyStyle();\n        this.style.addSprite(id, url, options, (err) => {\n            if (!err) {\n                this._update(true);\n            }\n        });\n        return this;\n    }\n\n    /**\n     * Removes the sprite from the map's style. Fires the `style` event.\n     *\n     * @param id - The ID of the sprite to remove. If the sprite is declared as a single URL, the ID must be \"default\".\n     * @example\n     * ```ts\n     * map.removeSprite('sprite-two');\n     * map.removeSprite('default');\n     * ```\n     */\n    removeSprite(id: string): this {\n        this._lazyInitEmptyStyle();\n        this.style.removeSprite(id);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the as-is value of the style's sprite.\n     *\n     * @returns style's sprite list of id-url pairs\n     */\n    getSprite(): Array<{id: string; url: string}> {\n        return this.style.getSprite();\n    }\n\n    /**\n     * Sets the value of the style's sprite property.\n     *\n     * @param spriteUrl - Sprite URL to set.\n     * @param options - Options object.\n     * @example\n     * ```ts\n     * map.setSprite('YOUR_SPRITE_URL');\n     * ```\n     */\n    setSprite(spriteUrl: string | null, options: StyleSetterOptions = {}): this {\n        this._lazyInitEmptyStyle();\n        this.style.setSprite(spriteUrl, options, (err) => {\n            if (!err) {\n                this._update(true);\n            }\n        });\n        return this;\n    }\n\n    /**\n     * Sets the any combination of light values.\n     *\n     * @param light - Light properties to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/light).\n     * @param options - Options object.\n     *\n     * @example\n     * ```ts\n     * let layerVisibility = map.getLayoutProperty('my-layer', 'visibility');\n     * ```\n     */\n    setLight(light: LightSpecification, options: StyleSetterOptions = {}): this {\n        this._lazyInitEmptyStyle();\n        this.style.setLight(light, options);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the value of the light object.\n     *\n     * @returns light Light properties of the style.\n     */\n    getLight(): LightSpecification {\n        return this.style.getLight();\n    }\n\n    /**\n     * Sets the value of style's sky properties.\n     *\n     * @param sky - Sky properties to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/sky/).\n     * @param options - Options object.\n     *\n     * @example\n     * ```ts\n     * map.setSky({'atmosphere-blend': 1.0});\n     * ```\n     */\n    setSky(sky: SkySpecification, options: StyleSetterOptions = {}): this {\n        this._lazyInitEmptyStyle();\n        this.style.setSky(sky, options);\n        return this._update(true);\n    }\n\n    /**\n     * Returns the value of the style's sky.\n     *\n     * @returns the sky properties of the style.\n     * @example\n     * ```ts\n     * map.getSky();\n     * ```\n     */\n    getSky(): SkySpecification {\n        return this.style.getSky();\n    }\n\n    /**\n     * Sets the `state` of a feature.\n     * A feature's `state` is a set of user-defined key-value pairs that are assigned to a feature at runtime.\n     * When using this method, the `state` object is merged with any existing key-value pairs in the feature's state.\n     * Features are identified by their `feature.id` attribute, which can be any number or string.\n     *\n     * This method can only be used with sources that have a `feature.id` attribute. The `feature.id` attribute can be defined in three ways:\n     *\n     * - For vector or GeoJSON sources, including an `id` attribute in the original data file.\n     * - For vector or GeoJSON sources, using the [`promoteId`](https://maplibre.org/maplibre-style-spec/sources/#promoteid) option at the time the source is defined.\n     * - For GeoJSON sources, using the [`generateId`](https://maplibre.org/maplibre-style-spec/sources/#generateid) option to auto-assign an `id` based on the feature's index in the source data. If you change feature data using `map.getSource('some id').setData(..)`, you may need to re-apply state taking into account updated `id` values.\n     *\n     * !!! note\n     *     You can use the [`feature-state` expression](https://maplibre.org/maplibre-style-spec/expressions/#feature-state) to access the values in a feature's state object for the purposes of styling.\n     *\n     * @param feature - Feature identifier. Feature objects returned from\n     * {@link Map.queryRenderedFeatures} or event handlers can be used as feature identifiers.\n     * @param state - A set of key-value pairs. The values should be valid JSON types.\n     *\n     * @example\n     * ```ts\n     * // When the mouse moves over the `my-layer` layer, update\n     * // the feature state for the feature under the mouse\n     * map.on('mousemove', 'my-layer', (e) => {\n     *   if (e.features.length > 0) {\n     *     map.setFeatureState({\n     *       source: 'my-source',\n     *       sourceLayer: 'my-source-layer',\n     *       id: e.features[0].id,\n     *     }, {\n     *       hover: true\n     *     });\n     *   }\n     * });\n     * ```\n     * @see [Create a hover effect](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-hover-effect/)\n     */\n    setFeatureState(feature: FeatureIdentifier, state: any): this {\n        this.style.setFeatureState(feature, state);\n        return this._update();\n    }\n\n    /**\n     * Removes the `state` of a feature, setting it back to the default behavior.\n     * If only a `target.source` is specified, it will remove the state for all features from that source.\n     * If `target.id` is also specified, it will remove all keys for that feature's state.\n     * If `key` is also specified, it removes only that key from that feature's state.\n     * Features are identified by their `feature.id` attribute, which can be any number or string.\n     *\n     * @param target - Identifier of where to remove state. It can be a source, a feature, or a specific key of feature.\n     * Feature objects returned from {@link Map.queryRenderedFeatures} or event handlers can be used as feature identifiers.\n     * @param key - (optional) The key in the feature state to reset.\n     * @example\n     * Reset the entire state object for all features in the `my-source` source\n     * ```ts\n     * map.removeFeatureState({\n     *   source: 'my-source'\n     * });\n     * ```\n     *\n     * @example\n     * When the mouse leaves the `my-layer` layer,\n     * reset the entire state object for the\n     * feature under the mouse\n     * ```ts\n     * map.on('mouseleave', 'my-layer', (e) => {\n     *   map.removeFeatureState({\n     *     source: 'my-source',\n     *     sourceLayer: 'my-source-layer',\n     *     id: e.features[0].id\n     *   });\n     * });\n     * ```\n     *\n     * @example\n     * When the mouse leaves the `my-layer` layer,\n     * reset only the `hover` key-value pair in the\n     * state for the feature under the mouse\n     * ```ts\n     * map.on('mouseleave', 'my-layer', (e) => {\n     *   map.removeFeatureState({\n     *     source: 'my-source',\n     *     sourceLayer: 'my-source-layer',\n     *     id: e.features[0].id\n     *   }, 'hover');\n     * });\n     * ```\n     */\n    removeFeatureState(target: FeatureIdentifier, key?: string): this {\n        this.style.removeFeatureState(target, key);\n        return this._update();\n    }\n\n    /**\n     * Gets the `state` of a feature.\n     * A feature's `state` is a set of user-defined key-value pairs that are assigned to a feature at runtime.\n     * Features are identified by their `feature.id` attribute, which can be any number or string.\n     *\n     * !!! note\n     *     To access the values in a feature's state object for the purposes of styling the feature, use the [`feature-state` expression](https://maplibre.org/maplibre-style-spec/expressions/#feature-state).\n     *\n     * @param feature - Feature identifier. Feature objects returned from\n     * {@link Map.queryRenderedFeatures} or event handlers can be used as feature identifiers.\n     * @returns The state of the feature: a set of key-value pairs that was assigned to the feature at runtime.\n     *\n     * @example\n     * When the mouse moves over the `my-layer` layer,\n     * get the feature state for the feature under the mouse\n     * ```ts\n     * map.on('mousemove', 'my-layer', (e) => {\n     *   if (e.features.length > 0) {\n     *     map.getFeatureState({\n     *       source: 'my-source',\n     *       sourceLayer: 'my-source-layer',\n     *       id: e.features[0].id\n     *     });\n     *   }\n     * });\n     * ```\n     */\n    getFeatureState(feature: FeatureIdentifier): any {\n        return this.style.getFeatureState(feature);\n    }\n\n    /**\n     * Returns the map's containing HTML element.\n     *\n     * @returns The map's container.\n     */\n    getContainer(): HTMLElement {\n        return this._container;\n    }\n\n    /**\n     * Returns the HTML element containing the map's `<canvas>` element.\n     *\n     * If you want to add non-GL overlays to the map, you should append them to this element.\n     *\n     * This is the element to which event bindings for map interactivity (such as panning and zooming) are\n     * attached. It will receive bubbled events from child elements such as the `<canvas>`, but not from\n     * map controls.\n     *\n     * @returns The container of the map's `<canvas>`.\n     * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-point/)\n     */\n    getCanvasContainer(): HTMLElement {\n        return this._canvasContainer;\n    }\n\n    /**\n     * Returns the map's `<canvas>` element.\n     *\n     * @returns The map's `<canvas>` element.\n     * @see [Measure distances](https://maplibre.org/maplibre-gl-js/docs/examples/measure-distances/)\n     * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n     * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js/docs/examples/center-the-map-on-a-clicked-symbol/)\n     */\n    getCanvas(): HTMLCanvasElement {\n        return this._canvas;\n    }\n\n    _containerDimensions(): number[] {\n        let width = 0;\n        let height = 0;\n\n        if (this._container) {\n            width = this._container.clientWidth || 400;\n            height = this._container.clientHeight || 300;\n        }\n\n        return [width, height];\n    }\n\n    /**\n     * @internal\n     * Sets up the ResizeObserver to track container size changes.\n     * Uses the owning window's ResizeObserver for cross-window support.\n     */\n    private _setupResizeObserver() {\n        let initialResizeEventCaptured = false;\n        const throttledResizeCallback = throttle((entries: ResizeObserverEntry[]) => {\n            if (this._trackResize && !this._removed) {\n                this.resize(entries);\n                this.redraw();\n            }\n        }, 50);\n        // Use owning window's ResizeObserver for cross-window support\n        const ResizeObserverClass = this._ownerWindow.ResizeObserver ?? ResizeObserver;\n        this._resizeObserver = new ResizeObserverClass((entries: ResizeObserverEntry[]) => {\n            if (!initialResizeEventCaptured) {\n                initialResizeEventCaptured = true;\n                return;\n            }\n            throttledResizeCallback(entries);\n        });\n        this._resizeObserver.observe(this._container);\n    }\n\n    /**\n     * @internal\n     * Resolves the container option to an HTMLElement.\n     * Supports string ID, HTMLElement, or cross-window elements (using nodeType check).\n     */\n    private _resolveContainer(container: string | HTMLElement): HTMLElement {\n        if (typeof container === 'string') {\n            const element = document.getElementById(container);\n            if (!element) {\n                throw new Error(`Container '${container}' not found.`);\n            }\n            return element;\n        }\n        if (container instanceof HTMLElement) {\n            return container;\n        }\n        // Cross-window support: use nodeType check as instanceof fails across windows\n        if (container && typeof container === 'object' && (container as Node).nodeType === 1) {\n            return container as HTMLElement;\n        }\n        throw new Error('Invalid type: \\'container\\' must be a String or HTMLElement.');\n    }\n\n    _setupContainer(): void {\n        const container = this._container;\n        container.classList.add('maplibregl-map');\n\n        const canvasContainer = this._canvasContainer = DOM.create('div', 'maplibregl-canvas-container', container);\n        if (this._interactive) {\n            canvasContainer.classList.add('maplibregl-interactive');\n        }\n\n        this._canvas = DOM.create('canvas', 'maplibregl-canvas', canvasContainer);\n        this._canvas.addEventListener('webglcontextlost', this._contextLost, false);\n        this._canvas.addEventListener('webglcontextrestored', this._contextRestored, false);\n        this._canvas.setAttribute('tabindex', this._interactive ? '0' : '-1');\n        this._canvas.setAttribute('aria-label', this._getUIString('Map.Title'));\n        this._canvas.setAttribute('role', 'region');\n\n        const dimensions = this._containerDimensions();\n        const clampedPixelRatio = this._getClampedPixelRatio(dimensions[0], dimensions[1]);\n        this._resizeCanvas(dimensions[0], dimensions[1], clampedPixelRatio);\n\n        const controlContainer = this._controlContainer = DOM.create('div', 'maplibregl-control-container', container);\n        const positions = this._controlPositions = {};\n        for (const positionName of ['top-left', 'top-right', 'bottom-left', 'bottom-right'] as const) {\n            positions[positionName] = DOM.create('div', `maplibregl-ctrl-${positionName} `, controlContainer);\n        }\n\n        this._container.addEventListener('scroll', this._onMapScroll, false);\n    }\n\n    _resizeCanvas(width: number, height: number, pixelRatio: number): void {\n        // Request the required canvas size taking the pixelratio into account.\n        this._canvas.width = Math.floor(pixelRatio * width);\n        this._canvas.height = Math.floor(pixelRatio * height);\n\n        // Maintain the same canvas size, potentially downscaling it for HiDPI displays\n        this._canvas.style.width = `${width}px`;\n        this._canvas.style.height = `${height}px`;\n    }\n\n    _setupPainter(): void {\n\n        // Maplibre WebGL context requires alpha, depth and stencil buffers. It also forces premultipliedAlpha: true.\n        // We use the values provided in the map constructor for the rest of context attributes\n        const attributes = {\n            ...this._canvasContextAttributes,\n            alpha: true,\n            depth: true,\n            stencil: true,\n            premultipliedAlpha: true\n        };\n\n        let creationEvent: WebGLContextEvent | null = null;\n        this._canvas.addEventListener('webglcontextcreationerror', (event: WebGLContextEvent) => {\n            creationEvent = event;\n        }, {once: true});\n\n        const gl: WebGL2RenderingContext | null = this._canvas.getContext('webgl2', attributes);\n\n        if (!gl) {\n            this.fire(new ErrorEvent(new GPUInitializationError(attributes, creationEvent)));\n            return;\n        }\n\n        this.painter = new Painter(gl, this._camera.transform);\n    }\n\n    /**\n     * @internal\n     * Creates a new specialized transform instance from a projection instance and migrates\n     * to this new transform, carrying over all the properties of the old transform (center, pitch, etc.).\n     * When the style's projection is changed (or first set), this function should be called.\n     */\n    migrateProjection(newTransform: ITransform, newCameraHelper: ICameraHelper): void {\n        this._camera.migrateProjection(newTransform, newCameraHelper);\n        this.painter.transform = newTransform;\n        this.fire(new MapProjectionEvent({\n            newProjection: this.style.projection.name,\n        }));\n    }\n\n    _contextLost = (event: WebGLContextEvent): void => {\n        event.preventDefault();\n        if (this._frameRequest) {\n            this._frameRequest.abort();\n            this._frameRequest = null;\n        }\n        this.painter.destroy();\n\n        this._lostContextStyle = this._getStyleAndImages();\n\n        if (!this.style) {\n            this.fire(new MapContextEvent('webglcontextlost', {originalEvent: event}));\n            return;\n        }\n\n        // check if style contains custom layers to warn user that they can't be restored automatically\n        for (const layer of Object.values(this.style._layers)) {\n            if (layer.type === 'custom') {\n                console.warn(`Custom layer with id '${layer.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`);\n            }\n\n            if (layer._listeners) {\n                for (const [event] of Object.entries(layer._listeners)) {\n                    console.warn(`Custom layer with id '${layer.id}' had event listeners for event '${event}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);\n                }\n            }\n        }\n\n        this.style.destroy();\n        this.style = null;\n\n        this.fire(new MapContextEvent('webglcontextlost', {originalEvent: event}));\n    };\n\n    _contextRestored = (event: WebGLContextEvent): void => {\n        if (this._lostContextStyle.style) {\n            this.setStyle(this._lostContextStyle.style, {diff: false});\n        }\n\n        if (this._lostContextStyle.images && this.style) {\n            this.style.imageManager.images = this._lostContextStyle.images;\n        }\n\n        this._lostContextStyle = {style: null, images: null};\n\n        this._setupPainter();\n        if (!this.painter) return;\n        this.resize();\n        this._update();\n        this._resizeInternal();\n        this.fire(new MapContextEvent('webglcontextrestored', {originalEvent: event}));\n    };\n\n    _onMapScroll = (event: UIEvent): boolean => {\n        if (event.target !== this._container) return;\n\n        // Revert any scroll which would move the canvas outside of the view\n        this._container.scrollTop = 0;\n        this._container.scrollLeft = 0;\n        return false;\n    };\n\n    /**\n     * Returns a Boolean indicating whether the map is fully loaded.\n     *\n     * Returns `false` if the style is not yet fully loaded,\n     * or if there has been a change to the sources or style that\n     * has not yet fully loaded.\n     *\n     * @returns A Boolean indicating whether the map is fully loaded.\n     */\n    loaded(): boolean {\n        return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();\n    }\n\n    /**\n     * @internal\n     * Update this map's style and sources, and re-render the map.\n     *\n     * @param updateStyle - mark the map's style for reprocessing as\n     * well as its sources\n     */\n    _update(updateStyle?: boolean): this {\n        if (!this.style?._loaded) return this;\n\n        this._styleDirty ||= updateStyle;\n        this._sourcesDirty = true;\n        this.triggerRepaint();\n\n        return this;\n    }\n\n    /**\n     * @internal\n     * Request that the given callback be executed during the next render\n     * frame.  Schedule a render frame if one is not already scheduled.\n     *\n     * @returns An id that can be used to cancel the callback\n     */\n    _requestRenderFrame(callback: () => void): TaskID {\n        this._update();\n        return this._renderTaskQueue.add(callback);\n    }\n\n    _cancelRenderFrame(id: TaskID): void {\n        this._renderTaskQueue.remove(id);\n    }\n\n    /**\n     * @internal\n     * Call when a (re-)render of the map is required:\n     *\n     * - The style has changed (`setPaintProperty()`, etc.)\n     * - Source data has changed (e.g. tiles have finished loading)\n     * - The map has is moving (or just finished moving)\n     * - A transition is in progress\n     *\n     * @param paintStartTimeStamp - The time when the animation frame began executing.\n     */\n    _render(paintStartTimeStamp: number): this {\n        const fadeDuration = this._idleTriggered ? this._fadeDuration : 0;\n\n        const isGlobeRendering = this.style.projection?.transitionState > 0;\n\n        // A custom layer may have used the context asynchronously. Mark the state as dirty.\n        this.painter.context.setDirty();\n        this.painter.setBaseState();\n\n        this._renderTaskQueue.run(paintStartTimeStamp);\n        // A task queue callback may have fired a user event which may have removed the map\n        if (this._removed) return;\n\n        let crossFading = false;\n\n        // If the style has changed, the map is being zoomed, or a transition or fade is in progress:\n        //  - Apply style changes (in a batch)\n        //  - Recalculate paint properties.\n        if (this.style && this._styleDirty) {\n            this._styleDirty = false;\n\n            const zoom = this._camera.transform.zoom;\n            const currentTime = now();\n            this.style.zoomHistory.update(zoom, currentTime);\n\n            const parameters = new EvaluationParameters(zoom, {\n                now: currentTime,\n                fadeDuration,\n                zoomHistory: this.style.zoomHistory,\n                transition: this.style.getTransition()\n            });\n\n            const factor = parameters.crossFadingFactor();\n            if (factor !== 1 || factor !== this._crossFadingFactor) {\n                crossFading = true;\n                this._crossFadingFactor = factor;\n            }\n\n            this.style.update(parameters);\n        }\n\n        const globeRenderingChanged = this.style.projection?.transitionState > 0 !== isGlobeRendering;\n        this._camera.transform.setTransitionState(this.style.projection?.transitionState);\n\n        // If we are in _render for any reason other than an in-progress paint\n        // transition, update tile managers to check for and load any tiles we\n        // need for the current transform\n        if (this.style && (this._sourcesDirty || globeRenderingChanged)) {\n            this._sourcesDirty = false;\n            this.style._updateSources(this._camera.transform);\n        }\n\n        // update terrain stuff\n        if (this.terrain) {\n            this.terrain.tileManager.update(this._camera.transform, this.terrain);\n            // Tile selection can change with the transform or cache state without a data event.\n            this.terrain.resetElevationCache();\n            this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center, this._camera.transform.tileZoom));\n            if (!this._camera.elevationFreeze && this.getCenterClampedToGround()) {\n                this._camera.transform.setElevation(this.terrain.getElevationForLngLatZoom(this._camera.transform.center, this._camera.transform.tileZoom));\n            }\n        } else {\n            this._camera.transform.setMinElevationForCurrentTile(0);\n            if (this.getCenterClampedToGround()) {\n                this._camera.transform.setElevation(0);\n            }\n        }\n\n        this._placementDirty = this.style?._updatePlacement(this._camera.transform, this.showCollisionBoxes, fadeDuration, this._crossSourceCollisions, globeRenderingChanged);\n\n        // Actually draw\n        this.painter.render(this.style, {\n            showTileBoundaries: this.showTileBoundaries,\n            showOverdrawInspector: this._showOverdrawInspector,\n            rotating: this.isRotating(),\n            zooming: this.isZooming(),\n            moving: this.isMoving(),\n            fadeDuration,\n            showPadding: this.showPadding,\n            anisotropicFilterPitch: this.getAnisotropicFilterPitch(),\n        });\n\n        this.fire(new MapLibreEvent('render'));\n\n        if (this.loaded() && !this._loaded) {\n            this._loaded = true;\n            this.fire(new MapLibreEvent('load'));\n        }\n\n        if (this.style && (this.style.hasTransitions() || crossFading)) {\n            this._styleDirty = true;\n        }\n\n        if (this.style && !this._placementDirty) {\n            // Since no fade operations are in progress, we can release\n            // all tiles held for fading. If we didn't do this, the tiles\n            // would just sit in the TileManagers until the next render\n            this.style._releaseSymbolFadeTiles();\n        }\n\n        // Schedule another render frame if it's needed.\n        //\n        // Even though `_styleDirty` and `_sourcesDirty` are reset in this\n        // method, synchronous events fired during Style.update or\n        // Style._updateSources could have caused them to be set again.\n        const somethingDirty = this._sourcesDirty || this._styleDirty || this._placementDirty;\n        if (somethingDirty || this._repaint) {\n            this.triggerRepaint();\n        } else if (!this.isMoving() && this.loaded()) {\n            this.fire(new MapLibreEvent('idle'));\n        }\n\n        if (this._loaded && !this._fullyLoaded && !somethingDirty) {\n            this._fullyLoaded = true;\n        }\n\n        return this;\n    }\n\n    /**\n     * Force a synchronous redraw of the map.\n     * @example\n     * ```ts\n     * map.redraw();\n     * ```\n     */\n    redraw(): this {\n        if (this.style) {\n            // cancel the scheduled update\n            if (this._frameRequest) {\n                this._frameRequest.abort();\n                this._frameRequest = null;\n            }\n            this._render(0);\n        }\n        return this;\n    }\n\n    /**\n     * Clean up and release all internal resources associated with this map.\n     *\n     * This includes DOM elements, event bindings, web workers, and WebGL resources.\n     *\n     * Use this method when you are done using the map and wish to ensure that it no\n     * longer consumes browser resources. Afterwards, you must not call any other\n     * methods on the map.\n     */\n    remove(): void {\n        if (this._hash) this._hash.remove();\n\n        for (const control of this._controls) control.onRemove(this);\n        this._controls = [];\n\n        if (this._frameRequest) {\n            this._frameRequest.abort();\n            this._frameRequest = null;\n        }\n        this._renderTaskQueue.clear();\n        this._diffStyleRequest?.abort();\n        this.painter.destroy();\n        this._handlers.destroy();\n        this.setStyle(null);\n        if (typeof window !== 'undefined') {\n            this._ownerWindow.removeEventListener('online', this._onWindowOnline, false);\n        }\n\n        ImageRequest.removeThrottleControl(this._imageQueueHandle);\n\n        this._resizeObserver?.disconnect();\n        const extension = this.painter.context.gl.getExtension('WEBGL_lose_context');\n        if (extension?.loseContext) extension.loseContext();\n        this._canvas.removeEventListener('webglcontextrestored', this._contextRestored, false);\n        this._canvas.removeEventListener('webglcontextlost', this._contextLost, false);\n        this._canvasContainer.remove();\n        this._controlContainer.remove();\n        this._container.removeEventListener('scroll', this._onMapScroll, false);\n        this._container.classList.remove('maplibregl-map');\n\n        this._removed = true;\n        this.fire(new MapLibreEvent('remove'));\n    }\n\n    /**\n     * Trigger the rendering of a single frame. Use this method with custom layers to\n     * repaint the map when the layer changes. Calling this multiple times before the\n     * next frame is rendered will still result in only a single frame being rendered.\n     * @example\n     * ```ts\n     * map.triggerRepaint();\n     * ```\n     * @see [Add a 3D model](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-3d-model-using-threejs/)\n     * @see [Add an animated icon to the map](https://maplibre.org/maplibre-gl-js/docs/examples/add-an-animated-icon-to-the-map/)\n     */\n    triggerRepaint(): void {\n        if (this.style && !this._frameRequest) {\n            this._frameRequest = new AbortController();\n            browser.frame(\n                this._frameRequest,\n                (paintStartTimeStamp) => {\n                    this._frameRequest = null;\n                    try {\n                        this._render(paintStartTimeStamp);\n                    } catch(error) {\n                        if (!isAbortError(error)) {\n                            throw error;\n                        }\n                    }\n                },\n                () => {},\n                this._ownerWindow\n            );\n        }\n    }\n\n    _onWindowOnline = (): void => {\n        this._update();\n    };\n\n    /**\n     * Gets and sets a Boolean indicating whether the map will render an outline\n     * around each tile and the tile ID. These tile boundaries are useful for\n     * debugging.\n     *\n     * The uncompressed file size of the first vector source is drawn in the top left\n     * corner of each tile, next to the tile ID.\n     *\n     * @example\n     * ```ts\n     * map.showTileBoundaries = true;\n     * ```\n     */\n    get showTileBoundaries(): boolean { return !!this._showTileBoundaries; }\n    set showTileBoundaries(value: boolean) {\n        if (this._showTileBoundaries === value) return;\n        this._showTileBoundaries = value;\n        this._update();\n    }\n\n    /**\n     * Gets and sets a Boolean indicating whether the map will visualize\n     * the padding offsets.\n     */\n    get showPadding(): boolean { return !!this._showPadding; }\n    set showPadding(value: boolean) {\n        if (this._showPadding === value) return;\n        this._showPadding = value;\n        this._update();\n    }\n\n    /**\n     * Gets and sets a Boolean indicating whether the map will render boxes\n     * around all symbols in the data source, revealing which symbols\n     * were rendered or which were hidden due to collisions.\n     * This information is useful for debugging.\n     */\n    get showCollisionBoxes(): boolean { return !!this._showCollisionBoxes; }\n    set showCollisionBoxes(value: boolean) {\n        if (this._showCollisionBoxes === value) return;\n        this._showCollisionBoxes = value;\n        if (value) {\n            // When we turn collision boxes on we have to generate them for existing tiles\n            // When we turn them off, there's no cost to leaving existing boxes in place\n            this.style._generateCollisionBoxes();\n        } else {\n            // Otherwise, call an update to remove collision boxes\n            this._update();\n        }\n    }\n\n    /**\n     * Gets and sets a Boolean indicating whether the map should color-code\n     * each fragment to show how many times it has been shaded.\n     * White fragments have been shaded 8 or more times.\n     * Black fragments have been shaded 0 times.\n     * This information is useful for debugging.\n     */\n    get showOverdrawInspector(): boolean { return !!this._showOverdrawInspector; }\n    set showOverdrawInspector(value: boolean) {\n        if (this._showOverdrawInspector === value) return;\n        this._showOverdrawInspector = value;\n        this._update();\n    }\n\n    /**\n     * Gets and sets a Boolean indicating whether the map will\n     * continuously repaint. This information is useful for analyzing performance.\n     */\n    get repaint(): boolean { return !!this._repaint; }\n    set repaint(value: boolean) {\n        if (this._repaint !== value) {\n            this._repaint = value;\n            this.triggerRepaint();\n        }\n    }\n    // show vertices\n    get vertices(): boolean { return !!this._vertices; }\n    set vertices(value: boolean) { this._vertices = value; this._update(); }\n\n    /**\n     * Returns the package version of the library\n     * @returns Package version of the library\n     */\n    get version(): string {\n        return version;\n    }\n\n    /**\n     * Returns the elevation for the point where the camera is looking.\n     * This value corresponds to:\n     * \"meters above sea level\" * \"exaggeration\"\n     * @returns The elevation.\n     */\n    getCameraTargetElevation(): number {\n        return this._camera.transform.elevation;\n    }\n\n    /**\n     * Gets the {@link ProjectionSpecification}.\n     * @returns the projection specification.\n     * @example\n     * ```ts\n     * let projection = map.getProjection();\n     * ```\n     */\n    getProjection(): ProjectionSpecification { return this.style.getProjection(); }\n\n    /**\n     * Sets the {@link ProjectionSpecification}.\n     * @param projection - the projection specification to set\n     * @returns\n     */\n    setProjection(projection: ProjectionSpecification): this {\n        this._lazyInitEmptyStyle();\n        this.style.setProjection(projection);\n        return this._update(true);\n    }\n}\n","import Point from '@mapbox/point-geometry';\n\nimport {DOM} from '../../util/dom.ts';\nimport {degreesToRadians, extend, getAngleDelta} from '../../util/util.ts';\nimport {DragHandler, type DragMoveHandler, type DragRotateResult} from '../handler/drag_handler.ts';\nimport {MouseOrTouchMoveStateManager} from '../handler/drag_move_state_manager.ts';\n\nimport type {Map} from '../map.ts';\nimport type {IControl} from './control.ts';\n\n/**\n * The {@link NavigationControl} options object\n */\nexport type NavigationControlOptions = {\n    /**\n     * If `true` the compass button is included.\n     */\n    showCompass?: boolean;\n    /**\n     * If `true` the zoom-in and zoom-out buttons are included.\n     */\n    showZoom?: boolean;\n    /**\n     * If `true` the pitch is visualized by rotating X-axis of compass.\n     */\n    visualizePitch?: boolean;\n    /**\n     * If `true` the roll is visualized by rotating the compass.\n     */\n    visualizeRoll?: boolean;\n};\n\nconst defaultOptions: NavigationControlOptions = {\n    showCompass: true,\n    showZoom: true,\n    visualizePitch: false,\n    visualizeRoll: true\n};\n\n/**\n * A `NavigationControl` control contains zoom buttons and a compass.\n *\n * @group Markers and Controls\n *\n * @example\n * ```ts\n * let nav = new NavigationControl();\n * map.addControl(nav, 'top-left');\n * ```\n * @see [Display map navigation controls](https://maplibre.org/maplibre-gl-js/docs/examples/display-map-navigation-controls/)\n */\nexport class NavigationControl implements IControl {\n    _map: Map;\n    options: NavigationControlOptions;\n    _container: HTMLElement;\n    _zoomInButton: HTMLButtonElement;\n    _zoomOutButton: HTMLButtonElement;\n    _compass: HTMLButtonElement;\n    _compassIcon: HTMLElement;\n    _handler: MouseRotateWrapper;\n\n    /**\n     * @param options - the control's options\n     */\n    constructor(options?: NavigationControlOptions) {\n        this.options = extend({}, defaultOptions, options);\n\n        this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-group');\n        this._container.addEventListener('contextmenu', (e) => e.preventDefault());\n\n        if (this.options.showZoom) {\n            this._zoomInButton = this._createButton('maplibregl-ctrl-zoom-in', (e) => this._map.zoomIn({}, {originalEvent: e}));\n            DOM.create('span', 'maplibregl-ctrl-icon', this._zoomInButton).setAttribute('aria-hidden', 'true');\n            this._zoomOutButton = this._createButton('maplibregl-ctrl-zoom-out', (e) => this._map.zoomOut({}, {originalEvent: e}));\n            DOM.create('span', 'maplibregl-ctrl-icon', this._zoomOutButton).setAttribute('aria-hidden', 'true');\n        }\n        if (this.options.showCompass) {\n            this._compass = this._createButton('maplibregl-ctrl-compass', (e) => {\n                if (this.options.visualizePitch) {\n                    this._map.resetNorthPitch({}, {originalEvent: e});\n                } else {\n                    this._map.resetNorth({}, {originalEvent: e});\n                }\n            });\n            this._compassIcon = DOM.create('span', 'maplibregl-ctrl-icon', this._compass);\n            this._compassIcon.setAttribute('aria-hidden', 'true');\n        }\n    }\n\n    _updateZoomButtons = (): void => {\n        const zoom = this._map.getZoom();\n        const isMax = zoom === this._map.getMaxZoom();\n        const isMin = zoom === this._map.getMinZoom();\n        this._zoomInButton.disabled = isMax;\n        this._zoomOutButton.disabled = isMin;\n        this._zoomInButton.setAttribute('aria-disabled', isMax.toString());\n        this._zoomOutButton.setAttribute('aria-disabled', isMin.toString());\n    };\n\n    _rotateCompassArrow = (): void => {\n        const pitch = this._map.getPitch();\n        const roll = this._map.getRoll();\n        const bearing = this._map.getBearing();\n        const pitchScale = 1 / Math.pow(Math.cos(degreesToRadians(pitch)), 0.5);\n        if (this.options.visualizePitch && this.options.visualizeRoll) {\n            this._compassIcon.style.transform = `scale(${pitchScale}) rotateZ(${-roll}deg) rotateX(${pitch}deg) rotateZ(${-bearing}deg)`;\n            return;\n        }\n        if (this.options.visualizePitch) {\n            this._compassIcon.style.transform = `scale(${pitchScale}) rotateX(${pitch}deg) rotateZ(${-bearing}deg)`;\n            return;\n        }\n        if (this.options.visualizeRoll) {\n            this._compassIcon.style.transform = `rotate(${-bearing - roll}deg)`;\n            return;\n        }\n        this._compassIcon.style.transform = `rotate(${-bearing}deg)`;\n    };\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        if (this.options.showZoom) {\n            this._setButtonTitle(this._zoomInButton, 'ZoomIn');\n            this._setButtonTitle(this._zoomOutButton, 'ZoomOut');\n            this._map.on('zoom', this._updateZoomButtons);\n            this._updateZoomButtons();\n        }\n        if (this.options.showCompass) {\n            this._setButtonTitle(this._compass, 'ResetBearing');\n            if (this.options.visualizePitch) {\n                this._map.on('pitch', this._rotateCompassArrow);\n            }\n            if (this.options.visualizeRoll) {\n                this._map.on('roll', this._rotateCompassArrow);\n            }\n            this._map.on('rotate', this._rotateCompassArrow);\n            this._rotateCompassArrow();\n            this._handler = new MouseRotateWrapper(this._map, this._compass, this.options.visualizePitch);\n        }\n        return this._container;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        this._container.remove();\n        if (this.options.showZoom) {\n            this._map.off('zoom', this._updateZoomButtons);\n        }\n        if (this.options.showCompass) {\n            if (this.options.visualizePitch) {\n                this._map.off('pitch', this._rotateCompassArrow);\n            }\n            if (this.options.visualizeRoll) {\n                this._map.off('roll', this._rotateCompassArrow);\n            }\n            this._map.off('rotate', this._rotateCompassArrow);\n            this._handler.off();\n            delete this._handler;\n        }\n\n        delete this._map;\n    }\n\n    _createButton(className: string, fn: (e?: MouseEvent) => unknown): HTMLButtonElement {\n        const a = DOM.create('button', className, this._container);\n        a.type = 'button';\n        a.addEventListener('click', fn);\n        return a;\n    }\n\n    _setButtonTitle = (button: HTMLButtonElement, title: 'ZoomIn' | 'ZoomOut' | 'ResetBearing'): void => {\n        const str = this._map._getUIString(`NavigationControl.${title}`);\n        button.title = str;\n        button.setAttribute('aria-label', str);\n    };\n}\n\nclass MouseRotateWrapper {\n\n    map: Map;\n    _clickTolerance: number;\n    element: HTMLElement;\n    _rotatePitchHandler: DragMoveHandler<DragRotateResult, MouseEvent | TouchEvent>;\n    _startPos: Point;\n    _lastPos: Point;\n\n    constructor(map: Map, element: HTMLElement, pitch: boolean = false) {\n        this._clickTolerance = 10;\n        this.element = element;\n\n        const moveStateManager = new MouseOrTouchMoveStateManager();\n        this._rotatePitchHandler = new DragHandler<DragRotateResult, MouseEvent | TouchEvent>({\n            clickTolerance: 3,\n            move: (lastPoint: Point, currentPoint: Point) => {\n                const rect = element.getBoundingClientRect();\n                const center = new Point((rect.bottom - rect.top) / 2, (rect.right - rect.left) / 2);\n                const bearingDelta = getAngleDelta(new Point(lastPoint.x, currentPoint.y), currentPoint, center);\n                const pitchDelta = pitch ? (currentPoint.y - lastPoint.y) * -0.5 : undefined;\n                return {bearingDelta, pitchDelta};\n            },\n            moveStateManager,\n            enable: true,\n            assignEvents: () => {},\n        });\n        this.map = map;\n\n        element.addEventListener('mousedown', this.mousedown);\n        element.addEventListener('touchstart', this.touchstart, {passive: false});\n        element.addEventListener('touchcancel', this.reset);\n    }\n\n    startMove(e: MouseEvent | TouchEvent, point: Point): void {\n        this._rotatePitchHandler.dragStart(e, point);\n        DOM.disableDrag();\n    }\n\n    move(e: MouseEvent | TouchEvent, point: Point): void {\n        const map = this.map;\n        const {bearingDelta, pitchDelta} = this._rotatePitchHandler.dragMove(e, point) || {};\n        if (bearingDelta) map.setBearing(map.getBearing() + bearingDelta);\n        if (pitchDelta) map.setPitch(map.getPitch() + pitchDelta);\n    }\n\n    off(): void {\n        const element = this.element;\n        element.removeEventListener('mousedown', this.mousedown);\n        element.removeEventListener('touchstart', this.touchstart);\n        window.removeEventListener('touchmove', this.touchmove);\n        window.removeEventListener('touchend', this.touchend);\n        element.removeEventListener('touchcancel', this.reset);\n        this.offTemp();\n    }\n\n    offTemp(): void {\n        DOM.enableDrag();\n        window.removeEventListener('mousemove', this.mousemove);\n        window.removeEventListener('mouseup', this.mouseup);\n        window.removeEventListener('touchmove', this.touchmove);\n        window.removeEventListener('touchend', this.touchend);\n    }\n\n    mousedown = (e: MouseEvent): void => {\n        this.startMove(e, DOM.mousePos(this.element, e));\n        window.addEventListener('mousemove', this.mousemove);\n        window.addEventListener('mouseup', this.mouseup);\n    };\n\n    mousemove = (e: MouseEvent): void => {\n        this.move(e, DOM.mousePos(this.element, e));\n    };\n\n    mouseup = (e: MouseEvent): void => {\n        this._rotatePitchHandler.dragEnd(e);\n        this.offTemp();\n    };\n\n    touchstart = (e: TouchEvent): void => {\n        if (e.targetTouches.length !== 1) {\n            this.reset();\n        } else {\n            this._startPos = this._lastPos = DOM.touchPos(this.element, e.targetTouches)[0];\n            this.startMove(e, this._startPos);\n            window.addEventListener('touchmove', this.touchmove, {passive: false});\n            window.addEventListener('touchend', this.touchend);\n        }\n    };\n\n    touchmove = (e: TouchEvent): void => {\n        if (e.targetTouches.length !== 1) {\n            this.reset();\n        } else {\n            this._lastPos = DOM.touchPos(this.element, e.targetTouches)[0];\n            this.move(e, this._lastPos);\n        }\n    };\n\n    touchend = (e: TouchEvent): void => {\n        if (e.targetTouches.length === 0 &&\n            this._startPos &&\n            this._lastPos &&\n            this._startPos.dist(this._lastPos) < this._clickTolerance) {\n            this.element.click();\n        }\n        delete this._startPos;\n        delete this._lastPos;\n        this.offTemp();\n    };\n\n    reset = (): void => {\n        this._rotatePitchHandler.reset();\n        delete this._startPos;\n        delete this._lastPos;\n        this.offTemp();\n    };\n}\n","let supportsGeolocation;\n\nexport async function checkGeolocationSupport(forceRecalculation = false): Promise<boolean> {\n    if (supportsGeolocation !== undefined && !forceRecalculation) {\n        return supportsGeolocation;\n    }\n    if (window.navigator.permissions === undefined) {\n        supportsGeolocation = !!window.navigator.geolocation;\n        return supportsGeolocation;\n    }\n    // navigator.permissions has incomplete browser support\n    // https://caniuse.com/#feat=permissions-api\n    // Test for the case where a browser disables Geolocation because of an\n    // insecure origin\n    try {\n        const permissions = await window.navigator.permissions.query({name: 'geolocation'});\n        supportsGeolocation = permissions.state !== 'denied';\n    } catch {\n        // Fix for iOS16 which rejects query but still supports geolocation\n        supportsGeolocation = !!window.navigator.geolocation;\n    }\n    return supportsGeolocation;\n}\n","import {LngLat} from '../geo/lng_lat.ts';\n\nimport type Point from '@mapbox/point-geometry';\nimport type {IReadonlyTransform} from '../geo/transform_interface.ts';\n\n/**\n * Given a LngLat, prior projected position, and a transform, return a new LngLat shifted\n * n × 360° east or west for some n ≥ 0 such that:\n *\n * * the projected location of the result is on screen, if possible, and secondarily:\n * * the difference between the projected location of the result and the prior position\n *   is minimized.\n *\n * The object is to preserve perceived object constancy for Popups and Markers as much as\n * possible; they should avoid shifting large distances across the screen, even when the\n * map center changes by ±360° due to automatic wrapping, and when about to go off screen,\n * should wrap just enough to avoid doing so.\n */\nexport function smartWrap(lngLat: LngLat, priorPos: Point, transform: IReadonlyTransform, useNormalWrap: boolean = false): LngLat {\n    if (useNormalWrap || !transform.getCoveringTilesDetailsProvider().allowWorldCopies()) {\n        return lngLat?.wrap();\n    }\n    const originalLngLat = new LngLat(lngLat.lng, lngLat.lat);\n    lngLat = new LngLat(lngLat.lng, lngLat.lat);\n\n    // First, try shifting one world in either direction, and see if either is closer to the\n    // prior position. This preserves object constancy when the map center is auto-wrapped\n    // during animations.\n    if (priorPos) {\n        const left  = new LngLat(lngLat.lng - 360, lngLat.lat);\n        const right = new LngLat(lngLat.lng + 360, lngLat.lat);\n        const delta = transform.locationToScreenPoint(lngLat).distSqr(priorPos);\n        if (transform.locationToScreenPoint(left).distSqr(priorPos) < delta) {\n            lngLat = left;\n        } else if (transform.locationToScreenPoint(right).distSqr(priorPos) < delta) {\n            lngLat = right;\n        }\n    }\n\n    // Second, wrap toward the center until the new position is on screen, or we can't get\n    // any closer.\n    while (Math.abs(lngLat.lng - transform.center.lng) > 180) {\n        const pos = transform.locationToScreenPoint(lngLat);\n        if (pos.x >= 0 && pos.y >= 0 && pos.x <= transform.width && pos.y <= transform.height) {\n            break;\n        }\n        if (lngLat.lng > transform.center.lng) {\n            lngLat.lng -= 360;\n        } else {\n            lngLat.lng += 360;\n        }\n    }\n\n    // Apply the change only if new coord is below horizon\n    if (lngLat.lng !== originalLngLat.lng && transform.isPointOnMapSurface(transform.locationToScreenPoint(lngLat))) {\n        return lngLat;\n    }\n\n    return originalLngLat;\n}\n","/**\n * Where to position the anchor.\n * Used by a popup and a marker.\n */\nexport type PositionAnchor = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n\nexport const anchorTranslate: {\n    [_ in PositionAnchor]: string;\n} = {\n    'center': 'translate(-50%,-50%)',\n    'top': 'translate(-50%,0)',\n    'top-left': 'translate(0,0)',\n    'top-right': 'translate(-100%,0)',\n    'bottom': 'translate(-50%,-100%)',\n    'bottom-left': 'translate(0,-100%)',\n    'bottom-right': 'translate(-100%,-100%)',\n    'left': 'translate(0,-50%)',\n    'right': 'translate(-100%,-50%)'\n};\n\nexport function applyAnchorClass(element: HTMLElement, anchor: PositionAnchor, prefix: string): void {\n    const classList = element.classList;\n    for (const key in anchorTranslate) {\n        classList.remove(`maplibregl-${prefix}-anchor-${key}`);\n    }\n    classList.add(`maplibregl-${prefix}-anchor-${anchor}`);\n}\n","import {DOM} from '../util/dom.ts';\nimport {browser} from '../util/browser.ts';\nimport {LngLat} from '../geo/lng_lat.ts';\nimport {smartWrap} from '../util/smart_wrap.ts';\nimport {anchorTranslate, applyAnchorClass} from './anchor.ts';\nimport {Event, Evented} from '../util/evented.ts';\nimport Point from '@mapbox/point-geometry';\n\nimport type {PositionAnchor} from './anchor.ts';\nimport type {Map} from './map.ts';\nimport type {Popup, Offset} from './popup.ts';\nimport type {LngLatLike} from '../geo/lng_lat.ts';\nimport type {MapMouseEvent, MapTouchEvent} from './events.ts';\nimport type {PointLike} from './camera.ts';\n\n/**\n * Alignment options of rotation and pitch\n */\nexport type Alignment = 'map' | 'viewport' | 'auto';\n\n/**\n * The {@link Marker} options object\n */\nexport type MarkerOptions = {\n    /**\n     * DOM element to use as a marker. The default is a light blue, droplet-shaped SVG marker.\n     */\n    element?: HTMLElement;\n    /**\n     * Space-separated CSS class names to add to marker element.\n     */\n    className?: string;\n    /**\n     * The offset in pixels as a {@link PointLike} object to apply relative to the element's center. Negatives indicate left and up.\n     */\n    offset?: PointLike;\n    /**\n     * A string indicating the part of the Marker that should be positioned closest to the coordinate set via {@link Marker.setLngLat}.\n     * Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`.\n     * @defaultValue 'center'\n     * */\n    anchor?: PositionAnchor;\n    /**\n     * The color to use for the default marker if options.element is not provided. The default is light blue.\n     * @defaultValue '#3FB1CE'\n     */\n    color?: string;\n    /**\n     * The scale to use for the default marker if options.element is not provided. The default scale corresponds to a height of `41px` and a width of `27px`.\n     * @defaultValue 1\n     */\n    scale?: number;\n    /**\n     * A boolean indicating whether or not a marker is able to be dragged to a new position on the map.\n     * @defaultValue false\n     */\n    draggable?: boolean;\n    /**\n     * The max number of pixels a user can shift the mouse pointer during a click on the marker for it to be considered a valid click (as opposed to a marker drag). The default is to inherit map's clickTolerance.\n     * @defaultValue 0\n     */\n    clickTolerance?: number;\n    /**\n     * The rotation angle of the marker in degrees, relative to its respective `rotationAlignment` setting. A positive value will rotate the marker clockwise.\n     * @defaultValue 0\n     */\n    rotation?: number;\n    /**\n     * `map` aligns the `Marker`'s rotation relative to the map, maintaining a bearing as the map rotates. `viewport` aligns the `Marker`'s rotation relative to the viewport, agnostic to map rotations. `auto` is equivalent to `viewport`.\n     * @defaultValue 'auto'\n     */\n    rotationAlignment?: Alignment;\n    /**\n     * `map` aligns the `Marker` to the plane of the map. `viewport` aligns the `Marker` to the plane of the viewport. `auto` automatically matches the value of `rotationAlignment`.\n     * @defaultValue 'auto'\n     */\n    pitchAlignment?: Alignment;\n    /**\n     * Marker's opacity when it's in clear view (not behind 3d terrain)\n     * Accepts any valid CSS opacity value as a number or string.\n     * @defaultValue 1\n     */\n    opacity?: string | number;\n    /**\n     * Marker's opacity when it's behind 3d terrain\n     * Accepts any valid CSS opacity value as a number or string.\n     * @defaultValue 0.2\n     */\n    opacityWhenCovered?: string | number;\n    /**\n      * If `true`, rounding is disabled for placement of the marker, allowing for\n      * subpixel positioning and smoother movement when the marker is translated.\n      * @defaultValue false\n      */\n    subpixelPositioning?: boolean;\n};\n\n/**\n * The event class for marker drag events (`dragstart`, `drag` and `dragend`).\n *\n * @group Event Related\n */\nexport class MarkerDragEvent extends Event {\n    type: 'dragstart' | 'drag' | 'dragend';\n    /**\n     * The `Marker` object that fired the event.\n     */\n    target: Marker;\n}\n\n/**\n * The event class for the marker `click` event.\n *\n * @group Event Related\n */\nexport class MarkerClickEvent extends Event {\n    type: 'click';\n    /**\n     * The `Marker` object that fired the event.\n     */\n    target: Marker;\n    /**\n     * The DOM event which caused the marker click event.\n     */\n    originalEvent: MouseEvent;\n}\n\n/**\n * `MarkerEventType` - a mapping between the marker event name and the event value.\n * These events are used with the {@link Marker.on} method.\n *\n * @group Event Related\n */\nexport type MarkerEventType = {\n    /**\n     * Fired when dragging starts.\n     */\n    dragstart: MarkerDragEvent;\n    /**\n     * Fired while dragging.\n     */\n    drag: MarkerDragEvent;\n    /**\n     * Fired when the marker is finished being dragged.\n     */\n    dragend: MarkerDragEvent;\n    /**\n     * Fired when the marker is clicked.\n     */\n    click: MarkerClickEvent;\n};\n\n/**\n * Creates a marker component\n *\n * @group Markers and Controls\n *\n * @example\n * ```ts\n * let marker = new Marker()\n *   .setLngLat([30.5, 50.5])\n *   .addTo(map);\n * ```\n *\n * @example\n * Set options\n * ```ts\n * let marker = new Marker({\n *     color: \"#FFFFFF\",\n *     draggable: true\n *   }).setLngLat([30.5, 50.5])\n *   .addTo(map);\n * ```\n * @see [Add a default marker](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-default-marker/)\n * @see [Add custom icons with Markers](https://maplibre.org/maplibre-gl-js/docs/examples/add-custom-icons-with-markers/)\n * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-marker/)\n * @see [Animate a marker](https://maplibre.org/maplibre-gl-js/docs/examples/animate-a-marker/)\n * @see [Attach a popup to a marker instance](https://maplibre.org/maplibre-gl-js/docs/examples/attach-a-popup-to-a-marker-instance/)\n *\n * ## Events\n *\n * **Event** `dragstart` of type {@link MarkerDragEvent} will be fired when dragging starts.\n *\n * **Event** `drag` of type {@link MarkerDragEvent} will be fired while dragging.\n *\n * **Event** `dragend` of type {@link MarkerDragEvent} will be fired when the marker is finished being dragged.\n *\n * **Event** `click` of type {@link MarkerClickEvent} will be fired when the marker is clicked.\n *\n * ## CSS Classes\n *\n * **CSS class** `maplibregl-marker-covered` is toggled on the marker element when the marker\n * is hidden behind 3D terrain or on the back of a globe.\n * Use this class to apply custom styles to covered markers.\n *\n * @example\n * ```css\n * .maplibregl-marker-covered {\n *     pointer-events: none;\n *     cursor: default;\n * }\n * ```\n */\nexport class Marker extends Evented<MarkerEventType> {\n    _map: Map;\n    _anchor: PositionAnchor;\n    _offset: Point;\n    _element: HTMLElement;\n    _popup: Popup;\n    _lngLat: LngLat;\n    _pos: Point;\n    _flatPos: Point;\n    _color: string;\n    _scale: number;\n    _defaultMarker: boolean;\n    _draggable: boolean;\n    _clickTolerance: number;\n    _isDragging: boolean;\n    _state: 'inactive' | 'pending' | 'active'; // used for handling drag events\n    _positionDelta: Point;\n    _pointerdownPos: Point;\n    _rotation: number;\n    _pitchAlignment: Alignment;\n    _rotationAlignment: Alignment;\n    _originalTabIndex: string; // original tabindex of _element\n    _opacity: string;\n    _opacityWhenCovered: string;\n    _opacityTimeout: ReturnType<typeof setTimeout>;\n    _subpixelPositioning: boolean;\n    _roleManaged: boolean;\n\n    /**\n     * @param options - the options\n     */\n    constructor(options?: MarkerOptions) {\n        super();\n\n        this._anchor = options?.anchor || 'center';\n        this._color = options?.color || '#3FB1CE';\n        this._scale = options?.scale || 1;\n        this._draggable = options?.draggable || false;\n        this._clickTolerance = options?.clickTolerance || 0;\n        this._subpixelPositioning = options?.subpixelPositioning || false;\n        this._isDragging = false;\n        this._roleManaged = false;\n        this._state = 'inactive';\n        this._rotation = options?.rotation || 0;\n        this._rotationAlignment = options?.rotationAlignment || 'auto';\n        this._pitchAlignment = options?.pitchAlignment && options.pitchAlignment !== 'auto' ?  options.pitchAlignment : this._rotationAlignment;\n        this.setOpacity(options?.opacity, options?.opacityWhenCovered);\n\n        if (!options?.element) {\n            this._defaultMarker = true;\n            this._element = DOM.create('div');\n\n            // create default map marker SVG\n            const svg = DOM.createNS('http://www.w3.org/2000/svg', 'svg');\n            const defaultHeight = 41;\n            const defaultWidth = 27;\n            svg.setAttributeNS(null, 'display', 'block');\n            svg.setAttributeNS(null, 'height', `${defaultHeight}px`);\n            svg.setAttributeNS(null, 'width', `${defaultWidth}px`);\n            svg.setAttributeNS(null, 'viewBox', `0 0 ${defaultWidth} ${defaultHeight}`);\n\n            const markerLarge = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n            markerLarge.setAttributeNS(null, 'stroke', 'none');\n            markerLarge.setAttributeNS(null, 'stroke-width', '1');\n            markerLarge.setAttributeNS(null, 'fill', 'none');\n            markerLarge.setAttributeNS(null, 'fill-rule', 'evenodd');\n\n            const page1 = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n            page1.setAttributeNS(null, 'fill-rule', 'nonzero');\n\n            const shadow = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n            shadow.setAttributeNS(null, 'transform', 'translate(3.0, 29.0)');\n            shadow.setAttributeNS(null, 'fill', '#000000');\n\n            const ellipses = [\n                {'rx': '10.5', 'ry': '5.25002273'},\n                {'rx': '10.5', 'ry': '5.25002273'},\n                {'rx': '9.5', 'ry': '4.77275007'},\n                {'rx': '8.5', 'ry': '4.29549936'},\n                {'rx': '7.5', 'ry': '3.81822308'},\n                {'rx': '6.5', 'ry': '3.34094679'},\n                {'rx': '5.5', 'ry': '2.86367051'},\n                {'rx': '4.5', 'ry': '2.38636864'}\n            ];\n\n            for (const data of ellipses) {\n                const ellipse = DOM.createNS('http://www.w3.org/2000/svg', 'ellipse');\n                ellipse.setAttributeNS(null, 'opacity', '0.04');\n                ellipse.setAttributeNS(null, 'cx', '10.5');\n                ellipse.setAttributeNS(null, 'cy', '5.80029008');\n                ellipse.setAttributeNS(null, 'rx', data['rx']);\n                ellipse.setAttributeNS(null, 'ry', data['ry']);\n                shadow.appendChild(ellipse);\n            }\n\n            const background = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n            background.setAttributeNS(null, 'fill', this._color);\n\n            const bgPath = DOM.createNS('http://www.w3.org/2000/svg', 'path');\n            bgPath.setAttributeNS(null, 'd', 'M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z');\n\n            background.appendChild(bgPath);\n\n            const border = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n            border.setAttributeNS(null, 'opacity', '0.25');\n            border.setAttributeNS(null, 'fill', '#000000');\n\n            const borderPath = DOM.createNS('http://www.w3.org/2000/svg', 'path');\n            borderPath.setAttributeNS(null, 'd', 'M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z');\n\n            border.appendChild(borderPath);\n\n            const maki = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n            maki.setAttributeNS(null, 'transform', 'translate(6.0, 7.0)');\n            maki.setAttributeNS(null, 'fill', '#FFFFFF');\n\n            const circleContainer = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n            circleContainer.setAttributeNS(null, 'transform', 'translate(8.0, 8.0)');\n\n            const circle1 = DOM.createNS('http://www.w3.org/2000/svg', 'circle');\n            circle1.setAttributeNS(null, 'fill', '#000000');\n            circle1.setAttributeNS(null, 'opacity', '0.25');\n            circle1.setAttributeNS(null, 'cx', '5.5');\n            circle1.setAttributeNS(null, 'cy', '5.5');\n            circle1.setAttributeNS(null, 'r', '5.4999962');\n\n            const circle2 = DOM.createNS('http://www.w3.org/2000/svg', 'circle');\n            circle2.setAttributeNS(null, 'fill', '#FFFFFF');\n            circle2.setAttributeNS(null, 'cx', '5.5');\n            circle2.setAttributeNS(null, 'cy', '5.5');\n            circle2.setAttributeNS(null, 'r', '5.4999962');\n\n            circleContainer.appendChild(circle1);\n            circleContainer.appendChild(circle2);\n\n            page1.appendChild(shadow);\n            page1.appendChild(background);\n            page1.appendChild(border);\n            page1.appendChild(maki);\n            page1.appendChild(circleContainer);\n\n            svg.appendChild(page1);\n\n            svg.setAttributeNS(null, 'height', `${defaultHeight * this._scale}px`);\n            svg.setAttributeNS(null, 'width', `${defaultWidth * this._scale}px`);\n\n            this._element.appendChild(svg);\n\n            // if no element and no offset option given apply an offset for the default marker\n            // the -14 as the y value of the default marker offset was determined as follows\n            //\n            // the marker tip is at the center of the shadow ellipse from the default svg\n            // the y value of the center of the shadow ellipse relative to the svg top left is \"shadow transform translate-y (29.0) + ellipse cy (5.80029008)\"\n            // offset to the svg center \"height (41 / 2)\" gives (29.0 + 5.80029008) - (41 / 2) and rounded for an integer pixel offset gives 14\n            // negative is used to move the marker up from the center so the tip is at the Marker lngLat\n            this._offset = Point.convert(options?.offset || [0, -14]);\n        } else {\n            this._element = options.element;\n            this._offset = Point.convert(options?.offset || [0, 0]);\n        }\n\n        this._element.classList.add('maplibregl-marker');\n        this._element.addEventListener('dragstart', (e: DragEvent) => {\n            e.preventDefault();\n        });\n        this._element.addEventListener('mousedown', (e: MouseEvent) => {\n            // prevent focusing on click\n            e.preventDefault();\n        });\n        applyAnchorClass(this._element, this._anchor, 'marker');\n\n        if (options?.className) {\n            for (const name of options.className.split(' ')) {\n                this._element.classList.add(name);\n            }\n        }\n\n        this._popup = null;\n    }\n\n    /**\n     * Attaches the `Marker` to a `Map` object.\n     * @param map - The MapLibre GL JS map to add the marker to.\n     * @example\n     * ```ts\n     * let marker = new Marker()\n     *   .setLngLat([30.5, 50.5])\n     *   .addTo(map); // add the marker to the map\n     * ```\n     */\n    addTo(map: Map): this {\n        this.remove();\n        this._map = map;\n\n        if (this._defaultMarker && !this._element.hasAttribute('aria-label')) {\n            this._element.setAttribute('aria-label', map._getUIString('Marker.Title'));\n        }\n\n        this._updateAccessibilityRole();\n\n        map.getCanvasContainer().appendChild(this._element);\n        map.on('move', this._update);\n        map.on('moveend', this._update);\n        map.on('terrain', this._update);\n        map.on('projectiontransition', this._update);\n\n        this._element.addEventListener('click', this._onClick);\n        this.setDraggable(this._draggable);\n        this._update();\n\n        // If we attached the `click` listener to the marker element, the popup\n        // would close once the event propagated to `map` due to the\n        // `Popup._onClickClose` listener.\n        this._map.on('click', this._onMapClick);\n\n        return this;\n    }\n\n    /**\n     * Removes the marker from a map\n     * @example\n     * ```ts\n     * let marker = new Marker().addTo(map);\n     * marker.remove();\n     * ```\n     */\n    remove(): this {\n        if (this._opacityTimeout) {\n            clearTimeout(this._opacityTimeout);\n            delete this._opacityTimeout;\n        }\n        if (this._map) {\n            this._map.off('click', this._onMapClick);\n            this._map.off('move', this._update);\n            this._map.off('moveend', this._update);\n            this._map.off('terrain', this._update);\n            this._map.off('projectiontransition', this._update);\n            this._map.off('mousedown', this._addDragHandler);\n            this._map.off('touchstart', this._addDragHandler);\n            this._map.off('mouseup', this._onUp);\n            this._map.off('touchend', this._onUp);\n            this._map.off('mousemove', this._onMove);\n            this._map.off('touchmove', this._onMove);\n            delete this._map;\n        }\n        this._element.removeEventListener('click', this._onClick);\n        this._element.remove();\n        if (this._popup) this._popup.remove();\n        return this;\n    }\n\n    /**\n     * Get the marker's geographical location.\n     *\n     * The longitude of the result may differ by a multiple of 360 degrees from the longitude previously\n     * set by `setLngLat` because `Marker` wraps the anchor longitude across copies of the world to keep\n     * the marker on screen.\n     *\n     * @returns A {@link LngLat} describing the marker's location.\n     * @example\n     * ```ts\n     * // Store the marker's longitude and latitude coordinates in a variable\n     * let lngLat = marker.getLngLat();\n     * // Print the marker's longitude and latitude values in the console\n     * console.log('Longitude: ' + lngLat.lng + ', Latitude: ' + lngLat.lat )\n     * ```\n     * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-marker/)\n     */\n    getLngLat(): LngLat {\n        return this._lngLat;\n    }\n\n    /**\n     * Set the marker's geographical position and move it.\n     * @param lnglat - A {@link LngLat} describing where the marker should be located.\n     * @example\n     * Create a new marker, set the longitude and latitude, and add it to the map\n     * ```ts\n     * new Marker()\n     *   .setLngLat([-65.017, -16.457])\n     *   .addTo(map);\n     * ```\n     * @see [Add custom icons with Markers](https://maplibre.org/maplibre-gl-js/docs/examples/add-custom-icons-with-markers/)\n     * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-draggable-marker/)\n     */\n    setLngLat(lnglat: LngLatLike): this {\n        this._lngLat = LngLat.convert(lnglat);\n        this._pos = null;\n        if (this._popup) this._popup.setLngLat(this._lngLat);\n        this._update();\n        return this;\n    }\n\n    /**\n     * Returns the `Marker`'s HTML element.\n     * @returns element\n     */\n    getElement(): HTMLElement {\n        return this._element;\n    }\n\n    /**\n     * Binds a {@link Popup} to the {@link Marker}.\n     * @param popup - An instance of the {@link Popup} class. If undefined or null, any popup\n     * set on this {@link Marker} instance is unset.\n     * @example\n     * ```ts\n     * let marker = new Marker()\n     *  .setLngLat([0, 0])\n     *  .setPopup(new Popup().setHTML(\"<h1>Hello World!</h1>\")) // add popup\n     *  .addTo(map);\n     * ```\n     * @see [Attach a popup to a marker instance](https://maplibre.org/maplibre-gl-js/docs/examples/attach-a-popup-to-a-marker-instance/)\n     */\n    setPopup(popup?: Popup | null): this {\n        if (this._popup) {\n            this._popup.remove();\n            this._popup = null;\n            this._element.removeEventListener('keypress', this._onKeyPress);\n\n            if (!this._originalTabIndex) {\n                this._element.removeAttribute('tabindex');\n            }\n        }\n\n        if (popup) {\n            if (!('offset' in popup.options)) {\n                const markerHeight = 41 - (5.8 / 2);\n                const markerRadius = 13.5;\n                const linearOffset = Math.abs(markerRadius) / Math.SQRT2;\n                popup.options.offset = this._defaultMarker ? {\n                    'top': [0, 0],\n                    'top-left': [0, 0],\n                    'top-right': [0, 0],\n                    'bottom': [0, -markerHeight],\n                    'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n                    'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n                    'left': [markerRadius, (markerHeight - markerRadius) * -1],\n                    'right': [-markerRadius, (markerHeight - markerRadius) * -1]\n                } as Offset : this._offset;\n            }\n            this._popup = popup;\n\n            this._originalTabIndex = this._element.getAttribute('tabindex');\n            if (!this._originalTabIndex) {\n                this._element.setAttribute('tabindex', '0');\n            }\n            this._element.addEventListener('keypress', this._onKeyPress);\n        }\n\n        this._updateAccessibilityRole();\n        return this;\n    }\n\n    /**\n      * Set the option to allow subpixel positioning of the marker by passing a boolean\n      *\n      * @param value - when set to `true`, subpixel positioning is enabled for the marker.\n      *\n      * @example\n      * ```ts\n      * let marker = new Marker()\n      * marker.setSubpixelPositioning(true);\n      * ```\n      */\n    setSubpixelPositioning(value: boolean): this {\n        this._subpixelPositioning = value;\n        return this;\n    }\n\n    _onClick = (e: MouseEvent): void => {\n        this.fire(new MarkerClickEvent('click', {originalEvent: e}));\n    };\n\n    _onKeyPress = (e: KeyboardEvent): void => {\n        if (e.code === 'Space' || e.code === 'Enter') {\n            this.togglePopup();\n        }\n    };\n\n    _onMapClick = (e: MapMouseEvent): void => {\n        const targetElement = e.originalEvent.target;\n        const element = this._element;\n\n        if (this._popup && (targetElement === element || element.contains(targetElement as any))) {\n            this.togglePopup();\n        }\n    };\n\n    /**\n     * Returns the {@link Popup} instance that is bound to the {@link Marker}.\n     * @returns popup\n     * @example\n     * ```ts\n     * let marker = new Marker()\n     *  .setLngLat([0, 0])\n     *  .setPopup(new Popup().setHTML(\"<h1>Hello World!</h1>\"))\n     *  .addTo(map);\n     *\n     * console.log(marker.getPopup()); // return the popup instance\n     * ```\n     */\n    getPopup(): Popup {\n        return this._popup;\n    }\n\n    /**\n     * Opens or closes the {@link Popup} instance that is bound to the {@link Marker}, depending on the current state of the {@link Popup}.\n     * @example\n     * ```ts\n     * let marker = new Marker()\n     *  .setLngLat([0, 0])\n     *  .setPopup(new Popup().setHTML(\"<h1>Hello World!</h1>\"))\n     *  .addTo(map);\n     *\n     * marker.togglePopup(); // toggle popup open or closed\n     * ```\n     */\n    togglePopup(): this {\n        const popup = this._popup;\n\n        if (this._element.style.opacity === this._opacityWhenCovered) return this;\n\n        if (!popup) return this;\n        else if (popup.isOpen()) popup.remove();\n        else {\n            popup.setLngLat(this._lngLat);\n            popup.addTo(this._map);\n        }\n        return this;\n    }\n\n    _updateOpacity(force: boolean = false): void {\n        const terrain = this._map?.terrain;\n        const occluded = this._map._camera.transform.isLocationOccluded(this._lngLat);\n        if (!terrain || occluded) {\n            const targetOpacity = occluded ? this._opacityWhenCovered : this._opacity;\n            if (this._element.style.opacity !== targetOpacity) {\n                this._element.style.opacity = targetOpacity;\n                this._element.classList.toggle('maplibregl-marker-covered', occluded);\n            }\n            return;\n        }\n        if (force) {\n            this._opacityTimeout = null;\n        } else {\n            if (this._opacityTimeout) { return; }\n            this._opacityTimeout = setTimeout(() => {\n                this._opacityTimeout = null;\n            }, 100);\n        }\n\n        const map = this._map;\n\n        // Read depth framebuffer, getting position of terrain in line of sight to marker\n        const terrainDistance = map.terrain.depthAtPoint(this._pos);\n        // Transform marker position to clip space\n        const elevation = map.terrain.getElevationForLngLat(this._lngLat, map._camera.transform);\n        const markerDistance = map._camera.transform.lngLatToCameraDepth(this._lngLat, elevation);\n        const forgiveness = .006;\n        if (markerDistance - terrainDistance < forgiveness) {\n            this._element.style.opacity = this._opacity;\n            this._element.classList.remove('maplibregl-marker-covered');\n            return;\n        }\n        // If the base is obscured, use the offset to check if the marker's center is obscured.\n        const metersToCenter = -this._offset.y / map._camera.transform.pixelsPerMeter;\n        const elevationToCenter = Math.sin(map.getPitch() * Math.PI / 180) * metersToCenter;\n        const terrainDistanceCenter = map.terrain.depthAtPoint(new Point(this._pos.x, this._pos.y - this._offset.y));\n        const markerDistanceCenter = map._camera.transform.lngLatToCameraDepth(this._lngLat, elevation + elevationToCenter);\n        // Display at full opacity if center is visible.\n        const centerIsInvisible = markerDistanceCenter - terrainDistanceCenter > forgiveness;\n\n        if (this._popup?.isOpen() && centerIsInvisible) this._popup.remove();\n        this._element.style.opacity = centerIsInvisible ? this._opacityWhenCovered : this._opacity;\n        this._element.classList.toggle('maplibregl-marker-covered', centerIsInvisible);\n    }\n\n    _update = (e?: { type: 'move' | 'moveend' | 'terrain' | 'render' }): void => {\n        if (!this._map) return;\n\n        const isFullyLoaded = this._map.loaded() && !this._map.isMoving();\n        if (e?.type === 'terrain' || (e?.type === 'render' && !isFullyLoaded)) {\n            this._map.once('render', this._update);\n        }\n\n        this._lngLat = smartWrap(this._lngLat, this._flatPos, this._map._camera.transform);\n\n        this._flatPos = this._pos = this._map.project(this._lngLat)._add(this._offset);\n        if (this._map.terrain) {\n            // flat position is saved because smartWrap needs non-elevated points\n            this._flatPos = this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset);\n        }\n\n        let rotation = '';\n        if (this._rotationAlignment === 'viewport' || this._rotationAlignment === 'auto') {\n            rotation = `rotateZ(${this._rotation}deg)`;\n        } else if (this._rotationAlignment === 'map') {\n            rotation = `rotateZ(${this._rotation - this._map.getBearing()}deg)`;\n        }\n\n        let pitch = '';\n        if (this._pitchAlignment === 'viewport' || this._pitchAlignment === 'auto') {\n            pitch = 'rotateX(0deg)';\n        } else if (this._pitchAlignment === 'map') {\n            pitch = `rotateX(${this._map.getPitch()}deg)`;\n        }\n\n        // because rounding the coordinates at every `move` event causes stuttered zooming\n        // we only round them when _update is called with `moveend` or when its called with\n        // no arguments (when the Marker is initialized or Marker.setLngLat is invoked).\n        if (!this._subpixelPositioning && (!e || e.type === 'moveend')) {\n            this._pos = this._pos.round();\n        }\n\n        this._element.style.transform = `${anchorTranslate[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${pitch} ${rotation}`;\n\n        browser.frameAsync(new AbortController(), this._map._ownerWindow).then(() => { // Run _updateOpacity only after painter.render and drawDepth\n            this._updateOpacity(e?.type === 'moveend');\n        }).catch(() => {});\n    };\n\n    /**\n     * Get the marker's offset.\n     * @returns The marker's screen coordinates in pixels.\n     */\n    getOffset(): Point {\n        return this._offset;\n    }\n\n    /**\n     * Sets the offset of the marker\n     * @param offset - The offset in pixels as a {@link PointLike} object to apply relative to the element's center. Negatives indicate left and up.\n     */\n    setOffset(offset: PointLike): this {\n        this._offset = Point.convert(offset);\n        this._update();\n        return this;\n    }\n\n    /**\n     * Adds a CSS class to the marker element.\n     *\n     * @param className - on-empty string with CSS class name to add to marker element\n     *\n     * @example\n     * ```\n     * let marker = new Marker()\n     * marker.addClassName('some-class')\n     * ```\n     */\n    addClassName(className: string): void {\n        this._element.classList.add(className);\n    }\n\n    /**\n     * Removes a CSS class from the marker element.\n     *\n     * @param className - Non-empty string with CSS class name to remove from marker element\n     *\n     * @example\n     * ```ts\n     * let marker = new Marker()\n     * marker.removeClassName('some-class')\n     * ```\n     */\n    removeClassName(className: string): void {\n        this._element.classList.remove(className);\n    }\n\n    /**\n     * Add or remove the given CSS class on the marker element, depending on whether the element currently has that class.\n     *\n     * @param className - Non-empty string with CSS class name to add/remove\n     *\n     * @returns if the class was removed return false, if class was added, then return true\n     *\n     * @example\n     * ```ts\n     * let marker = new Marker()\n     * marker.toggleClassName('toggleClass')\n     * ```\n     */\n    toggleClassName(className: string): boolean {\n        return this._element.classList.toggle(className);\n    }\n\n    _onMove = (e: MapMouseEvent | MapTouchEvent): void => {\n        if (!this._isDragging) {\n            const clickTolerance = this._clickTolerance || this._map._clickTolerance;\n            this._isDragging = e.point.dist(this._pointerdownPos) >= clickTolerance;\n        }\n        if (!this._isDragging) return;\n\n        this._pos = e.point.sub(this._positionDelta);\n        this._lngLat = this._map.unproject(this._pos);\n        this.setLngLat(this._lngLat);\n        // suppress click event so that popups don't toggle on drag\n        this._element.style.pointerEvents = 'none';\n\n        // make sure dragstart only fires on the first move event after mousedown.\n        // this can't be on mousedown because that event doesn't necessarily\n        // imply that a drag is about to happen.\n        if (this._state === 'pending') {\n            this._state = 'active';\n            this.fire(new MarkerDragEvent('dragstart'));\n        }\n        this.fire(new MarkerDragEvent('drag'));\n    };\n\n    _onUp = (): void => {\n        // revert to normal pointer event handling\n        this._element.style.pointerEvents = 'auto';\n        this._positionDelta = null;\n        this._pointerdownPos = null;\n        this._isDragging = false;\n        this._map.off('mousemove', this._onMove);\n        this._map.off('touchmove', this._onMove);\n\n        // only fire dragend if it was preceded by at least one drag event\n        if (this._state === 'active') {\n            this.fire(new MarkerDragEvent('dragend'));\n        }\n\n        this._state = 'inactive';\n    };\n\n    _addDragHandler = (e: MapMouseEvent | MapTouchEvent): void => {\n        if (this._element.contains(e.originalEvent.target as any)) {\n            e.preventDefault();\n\n            // We need to calculate the pixel distance between the click point\n            // and the marker position, with the offset accounted for. Then we\n            // can subtract this distance from the mousemove event's position\n            // to calculate the new marker position.\n            // If we don't do this, the marker 'jumps' to the click position\n            // creating a jarring UX effect.\n            this._positionDelta = e.point.sub(this._pos).add(this._offset);\n\n            this._pointerdownPos = e.point;\n\n            this._state = 'pending';\n            this._map.on('mousemove', this._onMove);\n            this._map.on('touchmove', this._onMove);\n            this._map.once('mouseup', this._onUp);\n            this._map.once('touchend', this._onUp);\n        }\n    };\n\n    /**\n     * Sets the `draggable` property and functionality of the marker\n     * @param shouldBeDraggable - Turns drag functionality on/off\n     */\n    setDraggable(shouldBeDraggable?: boolean): this {\n        this._draggable = !!shouldBeDraggable; // convert possible undefined value to false\n        this._element.classList.toggle('maplibregl-marker-draggable', this._draggable);\n\n        // handle case where map may not exist yet\n        // e.g. when setDraggable is called before addTo\n        if (this._map) {\n            if (shouldBeDraggable) {\n                this._map.on('mousedown', this._addDragHandler);\n                this._map.on('touchstart', this._addDragHandler);\n            } else {\n                this._map.off('mousedown', this._addDragHandler);\n                this._map.off('touchstart', this._addDragHandler);\n            }\n        }\n\n        this._updateAccessibilityRole();\n        return this;\n    }\n\n    /**\n     * Returns true if the marker can be dragged\n     * @returns True if the marker is draggable.\n     */\n    isDraggable(): boolean {\n        return this._draggable;\n    }\n\n    /**\n     * Keep the default marker role aligned with interactivity.\n     * Default markers need a role because `aria-label` is set in {@link Marker.addTo}.\n     * Non-interactive markers use `role=img`; interactive ones (draggable or with a popup) use `role=button`.\n     * Click listeners are application-owned and do not automatically change the role.\n     * Custom marker elements are left alone so applications own their a11y tree.\n     * Explicit roles set by the application are preserved.\n     */\n    _updateAccessibilityRole(): void {\n        if (!this._defaultMarker) {\n            return;\n        }\n\n        // Preserve an explicit role chosen by the application unless we previously managed it.\n        if (this._element.hasAttribute('role') && !this._roleManaged) {\n            return;\n        }\n\n        const role = (this._draggable || !!this._popup) ? 'button' : 'img';\n        this._element.setAttribute('role', role);\n        this._roleManaged = true;\n    }\n\n    /**\n     * Sets the `rotation` property of the marker.\n     * @param rotation - The rotation angle of the marker (clockwise, in degrees), relative to its respective {@link Marker.setRotationAlignment} setting.\n     */\n    setRotation(rotation?: number): this {\n        this._rotation = rotation || 0;\n        this._update();\n        return this;\n    }\n\n    /**\n     * Returns the current rotation angle of the marker (in degrees).\n     * @returns The current rotation angle of the marker.\n     */\n    getRotation(): number {\n        return this._rotation;\n    }\n\n    /**\n     * Sets the `rotationAlignment` property of the marker.\n     * @param alignment - Sets the `rotationAlignment` property of the marker. defaults to 'auto'\n     */\n    setRotationAlignment(alignment?: Alignment): this {\n        this._rotationAlignment = alignment || 'auto';\n        this._update();\n        return this;\n    }\n\n    /**\n     * Returns the current `rotationAlignment` property of the marker.\n     * @returns The current rotational alignment of the marker.\n     */\n    getRotationAlignment(): Alignment {\n        return this._rotationAlignment;\n    }\n\n    /**\n     * Sets the `pitchAlignment` property of the marker.\n     * @param alignment - Sets the `pitchAlignment` property of the marker. If alignment is 'auto', it will automatically match `rotationAlignment`.\n     */\n    setPitchAlignment(alignment?: Alignment): this {\n        this._pitchAlignment = alignment && alignment !== 'auto' ? alignment : this._rotationAlignment;\n        this._update();\n        return this;\n    }\n\n    /**\n     * Returns the current `pitchAlignment` property of the marker.\n     * @returns The current pitch alignment of the marker in degrees.\n     */\n    getPitchAlignment(): Alignment {\n        return this._pitchAlignment;\n    }\n\n    /**\n     * Sets the `opacity` and `opacityWhenCovered` properties of the marker.\n     * When called without arguments, resets opacity and opacityWhenCovered to defaults\n     * @param opacity - Sets the `opacity` property of the marker.\n     * @param opacityWhenCovered - Sets the `opacityWhenCovered` property of the marker.\n     */\n    setOpacity(opacity?: string | number, opacityWhenCovered?: string | number): this {\n        // Reset opacity when called without params or from constructor\n        if (this._opacity === undefined || (opacity === undefined && opacityWhenCovered === undefined)) {\n            this._opacity = '1';\n            this._opacityWhenCovered = '0.2';\n        }\n\n        if (opacity !== undefined) {\n            this._opacity = String(opacity);\n        }\n        if (opacityWhenCovered !== undefined) {\n            this._opacityWhenCovered = String(opacityWhenCovered);\n        }\n\n        if (this._map) {\n            this._updateOpacity(true);\n        }\n        return this;\n    }\n}\n","import {Event, Evented} from '../../util/evented.ts';\nimport {DOM} from '../../util/dom.ts';\nimport {extend, warnOnce} from '../../util/util.ts';\nimport {checkGeolocationSupport} from '../../util/geolocation_support.ts';\nimport {LngLat} from '../../geo/lng_lat.ts';\nimport {Marker} from '../marker.ts';\n\nimport type {Map} from '../map.ts';\nimport type {FitBoundsOptions} from '../camera.ts';\nimport type {IControl} from './control.ts';\nimport {LngLatBounds} from '../../geo/lng_lat_bounds.ts';\n\n/**\n * The {@link GeolocateControl} options object\n */\nexport type GeolocateControlOptions = {\n    /**\n     * A Geolocation API [PositionOptions](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions) object.\n     * @defaultValue `{enableHighAccuracy: false, timeout: 6000}`\n     */\n    positionOptions?: PositionOptions;\n    /**\n     * A options object to use when the map is panned and zoomed to the user's location. The default is to use a `maxZoom` of 15 to limit how far the map will zoom in for very accurate locations.\n     */\n    fitBoundsOptions?: FitBoundsOptions;\n    /**\n     * If `true` the `GeolocateControl` becomes a toggle button and when active the map will receive updates to the user's location as it changes.\n     * @defaultValue false\n     */\n    trackUserLocation?: boolean;\n    /**\n     * By default, if `showUserLocation` is `true`, a transparent circle will be drawn around the user location indicating the accuracy (95% confidence level) of the user's location. Set to `false` to disable. Always disabled when `showUserLocation` is `false`.\n     * @defaultValue true\n     */\n    showAccuracyCircle?: boolean;\n    /**\n     * By default a dot will be shown on the map at the user's location. Set to `false` to disable.\n     * @defaultValue true\n     */\n    showUserLocation?: boolean;\n};\n\nconst defaultOptions: GeolocateControlOptions = {\n    positionOptions: {\n        enableHighAccuracy: false,\n        maximumAge: 0,\n        timeout: 6000 /* 6 sec */\n    },\n    fitBoundsOptions: {\n        maxZoom: 15\n    },\n    trackUserLocation: false,\n    showAccuracyCircle: true,\n    showUserLocation: true\n};\n\nlet numberOfWatches = 0;\nlet noTimeout = false;\n\n/**\n * The event class for geolocate control state events\n * (`trackuserlocationstart`, `trackuserlocationend`, `userlocationfocus` and `userlocationlostfocus`).\n *\n * @group Event Related\n */\nexport class GeolocateEvent extends Event {\n    type: 'trackuserlocationstart' | 'trackuserlocationend' | 'userlocationfocus' | 'userlocationlostfocus';\n    /**\n     * The `GeolocateControl` object that fired the event.\n     */\n    target: GeolocateControl;\n}\n\n/**\n * The event class for the geolocate control `geolocate` and `outofmaxbounds` events.\n * Carries the [Position](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPosition) returned by the Geolocation API.\n *\n * @group Event Related\n */\nexport class GeolocatePositionEvent extends Event {\n    type: 'geolocate' | 'outofmaxbounds';\n    /**\n     * The `GeolocateControl` object that fired the event.\n     */\n    target: GeolocateControl;\n    /**\n     * The geographic position returned by the Geolocation API.\n     */\n    coords: GeolocationCoordinates;\n    /**\n     * The time at which the position was acquired, in milliseconds since the Unix epoch.\n     */\n    timestamp: number;\n}\n\n/**\n * The event class for the geolocate control `error` event.\n * Carries the [PositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError) returned by the Geolocation API.\n *\n * @group Event Related\n */\nexport class GeolocateErrorEvent extends Event {\n    type: 'error';\n    /**\n     * The `GeolocateControl` object that fired the event.\n     */\n    target: GeolocateControl;\n    /**\n     * The error code returned by the Geolocation API.\n     */\n    code: number;\n    /**\n     * The error message returned by the Geolocation API.\n     */\n    message: string;\n}\n\n/**\n * `GeolocateControlEventType` - a mapping between the geolocate control event name and the event value.\n * These events are used with the {@link GeolocateControl.on} method.\n *\n * @group Event Related\n */\nexport type GeolocateControlEventType = {\n    /**\n     * Fired on each Geolocation API position update which returned as success.\n     */\n    geolocate: GeolocatePositionEvent;\n    /**\n     * Fired on each Geolocation API position update which returned as an error.\n     */\n    error: GeolocateErrorEvent;\n    /**\n     * Fired on each Geolocation API position update which returned as success but the user position is out of map `maxBounds`.\n     */\n    outofmaxbounds: GeolocatePositionEvent;\n    /**\n     * Fired when the geolocate control changes to the active lock state.\n     */\n    trackuserlocationstart: GeolocateEvent;\n    /**\n     * Fired when the geolocate control changes to the background state.\n     */\n    trackuserlocationend: GeolocateEvent;\n    /**\n     * Fired when the geolocate control's button is clicked in the active lock state.\n     */\n    userlocationfocus: GeolocateEvent;\n    /**\n     * Fired when the user changes the viewport while in the active lock state.\n     */\n    userlocationlostfocus: GeolocateEvent;\n};\n\n/**\n * A `GeolocateControl` control provides a button that uses the browser's geolocation\n * API to locate the user on the map.\n *\n * Not all browsers support geolocation,\n * and some users may disable the feature. Geolocation support for modern\n * browsers including Chrome requires sites to be served over HTTPS. If\n * geolocation support is not available, the `GeolocateControl` will show\n * as disabled.\n *\n * The zoom level applied will depend on the accuracy of the geolocation provided by the device.\n *\n * The `GeolocateControl` has two modes. If `trackUserLocation` is `false` (default) the control acts as a button, which when pressed will set the map's camera to target the user location. If the user moves, the map won't update. This is most suited for the desktop. If `trackUserLocation` is `true` the control acts as a toggle button that when active the user's location is actively monitored for changes. In this mode the `GeolocateControl` has three interaction states:\n * * active - the map's camera automatically updates as the user's location changes, keeping the location dot in the center. Initial state and upon clicking the `GeolocateControl` button.\n * * passive - the user's location dot automatically updates, but the map's camera does not. Occurs upon the user initiating a map movement.\n * * disabled - occurs if Geolocation is not available, disabled or denied.\n *\n * These interaction states can't be controlled programmatically, rather they are set based on user interactions.\n *\n * ## State Diagram\n * ![GeolocateControl state diagram](https://github.com/maplibre/maplibre-gl-js/assets/3269297/78e720e5-d781-4da8-9803-a7a0e6aaaa9f)\n *\n * @group Markers and Controls\n *\n * @example\n * ```ts\n * map.addControl(new GeolocateControl({\n *     positionOptions: {\n *         enableHighAccuracy: true\n *     },\n *     trackUserLocation: true\n * }));\n * ```\n * @see [Locate the user](https://maplibre.org/maplibre-gl-js/docs/examples/locate-the-user/)\n *\n * ## Events\n *\n * **Event** `trackuserlocationend` of type {@link Event} will be fired when the `GeolocateControl` changes to the background state, which happens when a user changes the camera during an active position lock. This only applies when `trackUserLocation` is `true`. In the background state, the dot on the map will update with location updates but the camera will not.\n *\n * **Event** `trackuserlocationstart` of type {@link Event} will be fired when the `GeolocateControl` changes to the active lock state, which happens either upon first obtaining a successful Geolocation API position for the user (a `geolocate` event will follow), or the user clicks the geolocate button when in the background state which uses the last known position to recenter the map and enter active lock state (no `geolocate` event will follow unless the users's location changes).\n *\n * **Event** `userlocationlostfocus` of type {@link Event} will be fired when the `GeolocateControl` changes to the background state, which happens when a user changes the camera during an active position lock. This only applies when `trackUserLocation` is `true`. In the background state, the dot on the map will update with location updates but the camera will not.\n *\n * **Event** `userlocationfocus` of type {@link Event} will be fired when the `GeolocateControl` changes to the active lock state, which happens upon the user clicks the geolocate button when in the background state which uses the last known position to recenter the map and enter active lock state.\n *\n * **Event** `geolocate` of type {@link Event} will be fired on each Geolocation API position update which returned as success.\n * `data` - The returned [Position](https://developer.mozilla.org/en-US/docs/Web/API/Position) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n *\n * **Event** `error` of type {@link Event} will be fired on each Geolocation API position update which returned as an error.\n * `data` - The returned [PositionError](https://developer.mozilla.org/en-US/docs/Web/API/PositionError) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n *\n * **Event** `outofmaxbounds` of type {@link Event} will be fired on each Geolocation API position update which returned as success but user position is out of map `maxBounds`.\n * `data` - The returned [Position](https://developer.mozilla.org/en-US/docs/Web/API/Position) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n *\n * @example\n * ```ts\n * // Initialize the geolocate control.\n * let geolocate = new GeolocateControl({\n *   positionOptions: {\n *       enableHighAccuracy: true\n *   },\n *   trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when a trackuserlocationend event occurs.\n * geolocate.on('trackuserlocationend', () => {\n *   console.log('A trackuserlocationend event has occurred.')\n * });\n * ```\n *\n * @example\n * ```ts\n * // Initialize the geolocate control.\n * let geolocate = new GeolocateControl({\n *   positionOptions: {\n *       enableHighAccuracy: true\n *   },\n *   trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when a trackuserlocationstart event occurs.\n * geolocate.on('trackuserlocationstart', () => {\n *   console.log('A trackuserlocationstart event has occurred.')\n * });\n * ```\n *\n * @example\n * ```ts\n * // Initialize the geolocate control.\n * let geolocate = new GeolocateControl({\n *   positionOptions: {\n *       enableHighAccuracy: true\n *   },\n *   trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when an userlocationlostfocus event occurs.\n * geolocate.on('userlocationlostfocus', function() {\n *   console.log('An userlocationlostfocus event has occurred.')\n * });\n * ```\n *\n * @example\n * ```ts\n * // Initialize the geolocate control.\n * let geolocate = new GeolocateControl({\n *   positionOptions: {\n *       enableHighAccuracy: true\n *   },\n *   trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when an userlocationfocus event occurs.\n * geolocate.on('userlocationfocus', function() {\n *   console.log('An userlocationfocus event has occurred.')\n * });\n * ```\n *\n * @example\n * ```ts\n * // Initialize the geolocate control.\n * let geolocate = new GeolocateControl({\n *   positionOptions: {\n *       enableHighAccuracy: true\n *   },\n *   trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when a geolocate event occurs.\n * geolocate.on('geolocate', () => {\n *   console.log('A geolocate event has occurred.')\n * });\n * ```\n *\n * @example\n * ```ts\n * // Initialize the geolocate control.\n * let geolocate = new GeolocateControl({\n *   positionOptions: {\n *       enableHighAccuracy: true\n *   },\n *   trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when an error event occurs.\n * geolocate.on('error', () => {\n *   console.log('An error event has occurred.')\n * });\n * ```\n *\n * @example\n * ```ts\n * // Initialize the geolocate control.\n * let geolocate = new GeolocateControl({\n *   positionOptions: {\n *       enableHighAccuracy: true\n *   },\n *   trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when an outofmaxbounds event occurs.\n * geolocate.on('outofmaxbounds', () => {\n *   console.log('An outofmaxbounds event has occurred.')\n * });\n * ```\n */\nexport class GeolocateControl extends Evented<GeolocateControlEventType> implements IControl {\n    _map: Map;\n    options: GeolocateControlOptions;\n    _container: HTMLElement;\n    _dotElement: HTMLElement;\n    _circleElement: HTMLElement;\n    _geolocateButton: HTMLButtonElement;\n    _geolocationWatchID: number;\n    _timeoutId: ReturnType<typeof setTimeout>;\n    /* Geolocate Control Watch States\n     * This is the private state of the control.\n     *\n     * OFF\n     *    off/inactive\n     * WAITING_ACTIVE\n     *    Geolocate Control was clicked but still waiting for Geolocation API response with user location\n     * ACTIVE_LOCK\n     *    Showing the user location as a dot AND tracking the camera to be fixed to their location. If their location changes the map moves to follow.\n     * ACTIVE_ERROR\n     *    There was en error from the Geolocation API while trying to show and track the user location.\n     * BACKGROUND\n     *    Showing the user location as a dot but the camera doesn't follow their location as it changes.\n     * BACKGROUND_ERROR\n     *    There was an error from the Geolocation API while trying to show (but not track) the user location.\n     */\n    _watchState: 'OFF' | 'ACTIVE_LOCK' | 'WAITING_ACTIVE' | 'ACTIVE_ERROR' | 'BACKGROUND' | 'BACKGROUND_ERROR';\n    _lastKnownPosition: any;\n    _userLocationDotMarker: Marker;\n    _accuracyCircleMarker: Marker;\n    _accuracy: number;\n    _setup: boolean; // set to true once the control has been setup\n\n    /**\n     * @param options - the control's options\n     */\n    constructor(options: GeolocateControlOptions) {\n        super();\n        this.options = extend({}, defaultOptions, options);\n    }\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-group');\n        this._setupUI();\n        checkGeolocationSupport().then((supported) => this._finishSetupUI(supported));\n        return this._container;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        // clear the geolocation watch if exists\n        if (this._geolocationWatchID !== undefined) {\n            window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n            this._geolocationWatchID = undefined;\n        }\n\n        // clear the markers from the map\n        if (this.options.showUserLocation && this._userLocationDotMarker) {\n            this._userLocationDotMarker.remove();\n        }\n        if (this.options.showAccuracyCircle && this._accuracyCircleMarker) {\n            this._accuracyCircleMarker.remove();\n        }\n\n        this._container.remove();\n        this._map.off('movestart', this._onMoveStart);\n        this._map.off('zoom', this._onUpdate);\n        this._map.off('move', this._onUpdate);\n        this._map.off('rotate', this._onUpdate);\n        this._map.off('pitch', this._onUpdate);\n        this._map = undefined;\n        numberOfWatches = 0;\n        noTimeout = false;\n    }\n\n    /**\n     * Check if the Geolocation API Position is outside the map's `maxBounds`.\n     *\n     * @param position - the Geolocation API Position\n     * @returns `true` if position is outside the map's `maxBounds`, otherwise returns `false`.\n     */\n    _isOutOfMapMaxBounds(position: GeolocationPosition): boolean {\n        const bounds = this._map.getMaxBounds();\n        const coordinates = position.coords;\n\n        return bounds && (\n            coordinates.longitude < bounds.getWest() ||\n            coordinates.longitude > bounds.getEast() ||\n            coordinates.latitude < bounds.getSouth() ||\n            coordinates.latitude > bounds.getNorth()\n        );\n    }\n\n    _setErrorState(): void {\n        switch (this._watchState) {\n            case 'WAITING_ACTIVE':\n                this._watchState = 'ACTIVE_ERROR';\n                this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active');\n                this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active-error');\n                break;\n            case 'ACTIVE_LOCK':\n                this._watchState = 'ACTIVE_ERROR';\n                this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active');\n                this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active-error');\n                this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting');\n                // turn marker grey\n                break;\n            case 'BACKGROUND':\n                this._watchState = 'BACKGROUND_ERROR';\n                this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background');\n                this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background-error');\n                this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting');\n                // turn marker grey\n                break;\n            case 'ACTIVE_ERROR':\n            case 'BACKGROUND_ERROR':\n                // already in error state\n                break;\n            case 'OFF':\n            case undefined:\n                // when trackUserLocation is false, watchState is undefined\n                // when trackUserLocation is true but not activated, watchState is 'OFF'\n                // in both cases, no error state transition is needed\n                break;\n            default:\n                throw new Error(`Unexpected watchState ${this._watchState}`);\n        }\n    }\n\n    /**\n     * When the Geolocation API returns a new location, update the `GeolocateControl`.\n     *\n     * @param position - the Geolocation API Position\n     */\n    _onSuccess = (position: GeolocationPosition): void => {\n        if (!this._map) {\n            // control has since been removed\n            return;\n        }\n\n        if (this._isOutOfMapMaxBounds(position)) {\n            this._setErrorState();\n\n            this.fire(new GeolocatePositionEvent('outofmaxbounds', position));\n            this._updateMarker();\n            this._finish();\n\n            return;\n        }\n\n        if (this.options.trackUserLocation) {\n            // keep a record of the position so that if the state is BACKGROUND and the user\n            // clicks the button, we can move to ACTIVE_LOCK immediately without waiting for\n            // watchPosition to trigger _onSuccess\n            this._lastKnownPosition = position;\n\n            switch (this._watchState) {\n                case 'WAITING_ACTIVE':\n                case 'ACTIVE_LOCK':\n                case 'ACTIVE_ERROR':\n                    this._watchState = 'ACTIVE_LOCK';\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting');\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active-error');\n                    this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active');\n                    break;\n                case 'BACKGROUND':\n                case 'BACKGROUND_ERROR':\n                    this._watchState = 'BACKGROUND';\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting');\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background-error');\n                    this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background');\n                    break;\n                default:\n                    throw new Error(`Unexpected watchState ${this._watchState}`);\n            }\n        }\n\n        // if showUserLocation and the watch state isn't off then update the marker location\n        if (this.options.showUserLocation && this._watchState !== 'OFF') {\n            this._updateMarker(position);\n        }\n\n        // if in normal mode (not watch mode), or if in watch mode and the state is active watch\n        // then update the camera\n        if (!this.options.trackUserLocation || this._watchState === 'ACTIVE_LOCK') {\n            this._updateCamera(position);\n        }\n\n        if (this.options.showUserLocation) {\n            this._dotElement.classList.remove('maplibregl-user-location-dot-stale');\n        }\n\n        this.fire(new GeolocatePositionEvent('geolocate', position));\n        this._finish();\n    };\n\n    /**\n     * Update the camera location to center on the current position\n     *\n     * @param position - the Geolocation API Position\n     */\n    _updateCamera = (position: GeolocationPosition): void => {\n        const center = new LngLat(position.coords.longitude, position.coords.latitude);\n        const radius = position.coords.accuracy;\n        const bearing = this._map.getBearing();\n        const options = extend({bearing}, this.options.fitBoundsOptions);\n        const newBounds = LngLatBounds.fromLngLat(center, radius);\n\n        this._map.fitBounds(newBounds, options, {\n            geolocateSource: true // tag this camera change so it won't cause the control to change to background state\n        });\n    };\n\n    /**\n     * Update the user location dot Marker to the current position\n     *\n     * @param position - the Geolocation API Position\n     */\n    _updateMarker = (position?: GeolocationPosition | null): void => {\n        if (position) {\n            const center = new LngLat(position.coords.longitude, position.coords.latitude);\n            this._accuracyCircleMarker.setLngLat(center).addTo(this._map);\n            this._userLocationDotMarker.setLngLat(center).addTo(this._map);\n            this._accuracy = position.coords.accuracy;\n            this._updateCircleRadiusIfNeeded();\n        } else {\n            this._userLocationDotMarker.remove();\n            this._accuracyCircleMarker.remove();\n        }\n    };\n\n    _updateCircleRadiusIfNeeded(): void {\n        const userLocation = this._userLocationDotMarker.getLngLat();\n        if (!this.options.showUserLocation || !this.options.showAccuracyCircle || !this._accuracy || !userLocation) {\n            return;\n        }\n        const screenPosition = this._map.project(userLocation);\n        const userLocationWith100Px = this._map.unproject([screenPosition.x + 100, screenPosition.y]);\n        const pixelsToMeters = userLocation.distanceTo(userLocationWith100Px) / 100;\n        const circleDiameter = 2 * this._accuracy / pixelsToMeters;\n        this._circleElement.style.width = `${circleDiameter.toFixed(2)}px`;\n        this._circleElement.style.height = `${circleDiameter.toFixed(2)}px`;\n    }\n\n    _onUpdate = (): void => {\n        this._updateCircleRadiusIfNeeded();\n    };\n\n    _onError = (error: GeolocationPositionError): void => {\n        if (!this._map) {\n            // control has since been removed\n            return;\n        }\n\n        if (error.code === 1) {\n            // PERMISSION_DENIED\n            this._watchState = 'OFF';\n            this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting');\n            this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active');\n            this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active-error');\n            this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background');\n            this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background-error');\n            this._geolocateButton.disabled = true;\n            const title = this._map._getUIString('GeolocateControl.LocationNotAvailable');\n            this._geolocateButton.title = title;\n            this._geolocateButton.setAttribute('aria-label', title);\n\n            if (this._geolocationWatchID !== undefined) {\n                this._clearWatch();\n            }\n        } else if (error.code === 3 && noTimeout) {\n            // this represents a forced error state\n            // this was triggered to force immediate geolocation when a watch is already present\n            // see https://github.com/mapbox/mapbox-gl-js/issues/8214\n            // and https://w3c.github.io/geolocation-api/#example-5-forcing-the-user-agent-to-return-a-fresh-cached-position\n            return;\n        } else {\n            this._setErrorState();\n        }\n\n        if (this._watchState !== 'OFF' && this.options.showUserLocation) {\n            this._dotElement.classList.add('maplibregl-user-location-dot-stale');\n        }\n\n        this.fire(new GeolocateErrorEvent('error', error));\n\n        this._finish();\n    };\n\n    _finish = (): void => {\n        if (this._timeoutId) { clearTimeout(this._timeoutId); }\n        this._timeoutId = undefined;\n    };\n\n    _onMoveStart = (event: any): void => {\n        if (!this._map) return;\n        const fromResize = event?.[0] instanceof ResizeObserverEntry;\n        if (!event.geolocateSource && this._watchState === 'ACTIVE_LOCK' && !fromResize && !this._map.isZooming()) {\n            this._watchState = 'BACKGROUND';\n            this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background');\n            this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active');\n\n            this.fire(new GeolocateEvent('trackuserlocationend'));\n            this.fire(new GeolocateEvent('userlocationlostfocus'));\n        }\n    };\n\n    _setupUI = (): void => {\n        // the control could have been removed before reaching here\n        if (!this._map) {\n            return;\n        }\n\n        this._container.addEventListener('contextmenu', (e: MouseEvent) => { e.preventDefault(); });\n        this._geolocateButton = DOM.create('button', 'maplibregl-ctrl-geolocate', this._container);\n        DOM.create('span', 'maplibregl-ctrl-icon', this._geolocateButton).setAttribute('aria-hidden', 'true');\n        this._geolocateButton.type = 'button';\n        this._geolocateButton.disabled = true;\n    };\n\n    _finishSetupUI = (supported: boolean): void => {\n        // this method is called asynchronously during onAdd\n        if (!this._map) {\n            // control has since been removed\n            return;\n        }\n\n        if (supported === false) {\n            warnOnce('Geolocation support is not available so the GeolocateControl will be disabled.');\n            const title = this._map._getUIString('GeolocateControl.LocationNotAvailable');\n            this._geolocateButton.disabled = true;\n            this._geolocateButton.title = title;\n            this._geolocateButton.setAttribute('aria-label', title);\n        } else {\n            const title = this._map._getUIString('GeolocateControl.FindMyLocation');\n            this._geolocateButton.disabled = false;\n            this._geolocateButton.title = title;\n            this._geolocateButton.setAttribute('aria-label', title);\n        }\n\n        if (this.options.trackUserLocation) {\n            this._geolocateButton.setAttribute('aria-pressed', 'false');\n            this._watchState = 'OFF';\n        }\n\n        // when showUserLocation is enabled, keep the Geolocate button disabled until the device location marker is setup on the map\n        if (this.options.showUserLocation) {\n            this._dotElement = DOM.create('div', 'maplibregl-user-location-dot');\n\n            this._userLocationDotMarker = new Marker({element: this._dotElement});\n\n            this._circleElement = DOM.create('div', 'maplibregl-user-location-accuracy-circle');\n            this._accuracyCircleMarker = new Marker({element: this._circleElement, pitchAlignment: 'map'});\n\n            if (this.options.trackUserLocation) this._watchState = 'OFF';\n\n            this._map.on('zoom', this._onUpdate);\n            this._map.on('move', this._onUpdate);\n            this._map.on('rotate', this._onUpdate);\n            this._map.on('pitch', this._onUpdate);\n        }\n\n        this._geolocateButton.addEventListener('click', () => this.trigger());\n\n        this._setup = true;\n\n        // when the camera is changed (and it's not as a result of the Geolocation Control) change\n        // the watch mode to background watch, so that the marker is updated but not the camera.\n        if (this.options.trackUserLocation) {\n            this._map.on('movestart', this._onMoveStart);\n        }\n    };\n\n    /**\n     * Programmatically request and move the map to the user's location.\n     *\n     * @returns `false` if called before control was added to a map, otherwise returns `true`.\n     * @example\n     * ```ts\n     * // Initialize the geolocate control.\n     * let geolocate = new GeolocateControl({\n     *  positionOptions: {\n     *    enableHighAccuracy: true\n     *  },\n     *  trackUserLocation: true\n     * });\n     * // Add the control to the map.\n     * map.addControl(geolocate);\n     * map.on('load', () => {\n     *   geolocate.trigger();\n     * });\n     * ```\n     */\n    trigger(): boolean {\n        if (!this._setup) {\n            warnOnce('Geolocate control triggered before added to a map');\n            return false;\n        }\n        if (this.options.trackUserLocation) {\n            // update watchState and do any outgoing state cleanup\n            switch (this._watchState) {\n                case 'OFF':\n                // turn on the Geolocate Control\n                    this._watchState = 'WAITING_ACTIVE';\n\n                    this.fire(new GeolocateEvent('trackuserlocationstart'));\n                    break;\n                case 'WAITING_ACTIVE':\n                case 'ACTIVE_LOCK':\n                case 'ACTIVE_ERROR':\n                case 'BACKGROUND_ERROR':\n                // turn off the Geolocate Control\n                    numberOfWatches--;\n                    noTimeout = false;\n                    this._watchState = 'OFF';\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting');\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active');\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active-error');\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background');\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background-error');\n\n                    this.fire(new GeolocateEvent('trackuserlocationend'));\n                    break;\n                case 'BACKGROUND':\n                    this._watchState = 'ACTIVE_LOCK';\n                    this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background');\n                    // set camera to last known location\n                    if (this._lastKnownPosition) this._updateCamera(this._lastKnownPosition);\n\n                    this.fire(new GeolocateEvent('trackuserlocationstart'));\n                    this.fire(new GeolocateEvent('userlocationfocus'));\n                    break;\n                default:\n                    throw new Error(`Unexpected watchState ${this._watchState}`);\n            }\n\n            // incoming state setup\n            switch (this._watchState) {\n                case 'WAITING_ACTIVE':\n                    this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting');\n                    this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active');\n                    break;\n                case 'ACTIVE_LOCK':\n                    this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active');\n                    break;\n                case 'OFF':\n                    break;\n                default:\n                    throw new Error(`Unexpected watchState ${this._watchState}`);\n            }\n\n            // manage geolocation.watchPosition / geolocation.clearWatch\n            if (this._watchState === 'OFF' && this._geolocationWatchID !== undefined) {\n                // clear watchPosition as we've changed to an OFF state\n                this._clearWatch();\n            } else if (this._geolocationWatchID === undefined) {\n                // enable watchPosition since watchState is not OFF and there is no watchPosition already running\n\n                this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting');\n                this._geolocateButton.setAttribute('aria-pressed', 'true');\n\n                numberOfWatches++;\n                let positionOptions;\n                if (numberOfWatches > 1) {\n                    positionOptions = {maximumAge: 600000, timeout: 0};\n                    noTimeout = true;\n                } else {\n                    positionOptions = this.options.positionOptions;\n                    noTimeout = false;\n                }\n\n                this._geolocationWatchID = window.navigator.geolocation.watchPosition(\n                    this._onSuccess, this._onError, positionOptions);\n            }\n        } else {\n            window.navigator.geolocation.getCurrentPosition(\n                this._onSuccess, this._onError, this.options.positionOptions);\n\n            // This timeout ensures that we still call finish() even if\n            // the user declines to share their location in Firefox\n            this._timeoutId = setTimeout(this._finish, 10000 /* 10sec */);\n        }\n\n        return true;\n    }\n\n    _clearWatch(): void {\n        window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n\n        this._geolocationWatchID = undefined;\n        this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting');\n        this._geolocateButton.setAttribute('aria-pressed', 'false');\n\n        if (this.options.showUserLocation) {\n            this._updateMarker(null);\n        }\n    }\n}\n","import {DOM} from '../../util/dom.ts';\n\nimport type {Map} from '../map.ts';\nimport type {ControlPosition, IControl} from './control.ts';\n\n/**\n * The unit type for length to use for the {@link ScaleControl}\n */\nexport type Unit = 'imperial' | 'metric' | 'nautical';\n\n/**\n * The {@link ScaleControl} options object\n */\nexport type ScaleControlOptions = {\n    /**\n     * The maximum length of the scale control in pixels.\n     * @defaultValue 100\n     */\n    maxWidth?: number;\n    /**\n     * Unit of the distance (`'imperial'`, `'metric'` or `'nautical'`).\n     * @defaultValue 'metric'\n     */\n    unit?: Unit;\n};\n\nconst defaultOptions: ScaleControlOptions = {\n    maxWidth: 100,\n    unit: 'metric'\n};\n\n/**\n * A `ScaleControl` control displays the ratio of a distance on the map to the corresponding distance on the ground.\n *\n * @group Markers and Controls\n *\n * @example\n * ```ts\n * let scale = new ScaleControl({\n *     maxWidth: 80,\n *     unit: 'imperial'\n * });\n * map.addControl(scale);\n *\n * scale.setUnit('metric');\n * ```\n */\nexport class ScaleControl implements IControl {\n    _map: Map;\n    _container: HTMLElement;\n    options: ScaleControlOptions;\n\n    /**\n     * @param options - the control's options\n     */\n    constructor(options?: ScaleControlOptions) {\n        this.options = {...defaultOptions, ...options};\n    }\n\n    getDefaultPosition(): ControlPosition {\n        return 'bottom-left';\n    }\n\n    _onMove = (): void => {\n        updateScale(this._map, this._container, this.options);\n    };\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-scale', map.getContainer());\n\n        this._map.on('move', this._onMove);\n        this._onMove();\n\n        return this._container;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        this._container.remove();\n        this._map.off('move', this._onMove);\n        this._map = undefined;\n    }\n\n    /**\n     * Set the scale's unit of the distance\n     *\n     * @param unit - Unit of the distance (`'imperial'`, `'metric'` or `'nautical'`).\n     */\n    setUnit = (unit: Unit): void => {\n        this.options.unit = unit;\n        updateScale(this._map, this._container, this.options);\n    };\n}\n\nfunction updateScale(map: Map, container: HTMLElement, options: ScaleControlOptions): void {\n    // A horizontal scale is imagined to be present at center of the map\n    // container with maximum length (Default) as 100px.\n    // Using spherical law of cosines approximation, the real distance is\n    // found between the two coordinates.\n    // Minimum maxWidth is calculated for the scale box.\n    const optWidth = options?.maxWidth || 100;\n    const y = map._container.clientHeight / 2;\n    const x = map._container.clientWidth / 2;\n    const left = map.unproject([x - optWidth / 2, y]);\n    const right = map.unproject([x + optWidth / 2, y]);\n\n    const globeWidth = Math.round(map.project(right).x - map.project(left).x);\n    const maxWidth = Math.min(optWidth, globeWidth, map._container.clientWidth);\n\n    const maxMeters = left.distanceTo(right);\n    // The real distance corresponding to 100px scale length is rounded off to\n    // near pretty number and the scale length for the same is found out.\n    // Default unit of the scale is based on User's locale.\n    if (options?.unit === 'imperial') {\n        const maxFeet = 3.2808 * maxMeters;\n        if (maxFeet > 5280) {\n            const maxMiles = maxFeet / 5280;\n            setScale(container, maxWidth, maxMiles, map._getUIString('ScaleControl.Miles'));\n        } else {\n            setScale(container, maxWidth, maxFeet, map._getUIString('ScaleControl.Feet'));\n        }\n    } else if (options?.unit === 'nautical') {\n        const maxNauticals = maxMeters / 1852;\n        setScale(container, maxWidth, maxNauticals, map._getUIString('ScaleControl.NauticalMiles'));\n    } else if (maxMeters >= 1000) {\n        setScale(container, maxWidth, maxMeters / 1000, map._getUIString('ScaleControl.Kilometers'));\n    } else {\n        setScale(container, maxWidth, maxMeters, map._getUIString('ScaleControl.Meters'));\n    }\n}\n\nfunction setScale(container: HTMLElement, maxWidth: number, maxDistance: number, unit: string): void {\n    const distance = getRoundNum(maxDistance);\n    const ratio = distance / maxDistance;\n    container.style.width = `${maxWidth * ratio}px`;\n    container.innerHTML = `${distance}&nbsp;${unit}`;\n}\n\nfunction getDecimalRoundNum(d) {\n    const multiplier = Math.pow(10, Math.ceil(-Math.log(d) / Math.LN10));\n    return Math.round(d * multiplier) / multiplier;\n}\n\nfunction getRoundNum(num) {\n    const pow10 = Math.pow(10, (`${Math.floor(num)}`).length - 1);\n    let d = num / pow10;\n\n    d = d >= 10 ? 10 :\n        d >= 5 ? 5 :\n            d >= 3 ? 3 :\n                d >= 2 ? 2 :\n                    d >= 1 ? 1 : getDecimalRoundNum(d);\n\n    return pow10 * d;\n}\n","import {DOM} from '../../util/dom.ts';\n\nimport {warnOnce} from '../../util/util.ts';\n\nimport {Event, Evented} from '../../util/evented.ts';\nimport type {Map} from '../map.ts';\nimport type {IControl} from './control.ts';\n\n/**\n * The {@link FullscreenControl} options object\n */\nexport type FullscreenControlOptions = {\n    /**\n     * `container` is the [compatible DOM element](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen#Compatible_elements) which should be made full screen. By default, the map container element will be made full screen.\n     */\n    container?: HTMLElement;\n    /**\n     * If `true`, the fullscreen control will always use pseudo fullscreen mode (CSS-based, expanding to browser viewport) instead of native fullscreen API.\n     * This can be useful for faster transitions and to allow multiple maps to be \"fullscreen\" simultaneously in different browser windows.\n     * @defaultValue false\n     */\n    pseudo?: boolean;\n};\n\n/**\n * The event class for fullscreen control events (`fullscreenstart` and `fullscreenend`).\n *\n * @group Event Related\n */\nexport class FullscreenEvent extends Event {\n    type: 'fullscreenstart' | 'fullscreenend';\n    /**\n     * The `FullscreenControl` object that fired the event.\n     */\n    target: FullscreenControl;\n}\n\n/**\n * `FullscreenControlEventType` - a mapping between the fullscreen control event name and the event value.\n * These events are used with the {@link FullscreenControl.on} method.\n *\n * @group Event Related\n */\nexport type FullscreenControlEventType = {\n    /**\n     * Fired when fullscreen mode has started.\n     */\n    fullscreenstart: FullscreenEvent;\n    /**\n     * Fired when fullscreen mode has ended.\n     */\n    fullscreenend: FullscreenEvent;\n};\n\n/**\n * A `FullscreenControl` control contains a button for toggling the map in and out of fullscreen mode.\n * When [requestFullscreen](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen) is not supported, fullscreen is handled via CSS properties.\n * The map's `cooperativeGestures` option is temporarily disabled while the map\n * is in fullscreen mode, and is restored when the map exist fullscreen mode.\n *\n * @group Markers and Controls\n * @param options - the full screen control options\n *\n * @example\n * ```ts\n * map.addControl(new FullscreenControl({container: document.querySelector('body')}));\n * ```\n * @see [View a fullscreen map](https://maplibre.org/maplibre-gl-js/docs/examples/view-a-fullscreen-map/)\n *\n * ## Events\n *\n * **Event** `fullscreenstart` of type {@link FullscreenEvent} will be fired when fullscreen mode has started.\n *\n * **Event** `fullscreenend` of type {@link FullscreenEvent} will be fired when fullscreen mode has ended.\n */\nexport class FullscreenControl extends Evented<FullscreenControlEventType> implements IControl {\n    _map: Map;\n    _controlContainer: HTMLElement;\n    _fullscreen: boolean;\n    _fullscreenchange: string;\n    _fullscreenButton: HTMLButtonElement;\n    _container: HTMLElement;\n    _prevCooperativeGesturesEnabled: boolean;\n    _pseudo: boolean;\n\n    /**\n     * @param options - the control's options\n     */\n    constructor(options: FullscreenControlOptions = {}) {\n        super();\n        this._fullscreen = false;\n        this._pseudo = options.pseudo ?? false;\n\n        if (options?.container) {\n            if (options.container instanceof HTMLElement) {\n                this._container = options.container;\n            } else {\n                warnOnce('Full screen control \\'container\\' must be a DOM element.');\n            }\n        }\n\n        if ('onfullscreenchange' in document) {\n            this._fullscreenchange = 'fullscreenchange';\n        } else if ('onmozfullscreenchange' in document) {\n            this._fullscreenchange = 'mozfullscreenchange';\n        } else if ('onwebkitfullscreenchange' in document) {\n            this._fullscreenchange = 'webkitfullscreenchange';\n        } else if ('onmsfullscreenchange' in document) {\n            this._fullscreenchange = 'MSFullscreenChange';\n        }\n    }\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        this._container ||= this._map.getContainer();\n        this._controlContainer = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-group');\n        this._setupUI();\n        return this._controlContainer;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        this._controlContainer.remove();\n        this._map = null;\n        window.document.removeEventListener(this._fullscreenchange, this._onFullscreenChange);\n    }\n\n    _setupUI(): void {\n        const button = this._fullscreenButton = DOM.create('button', (('maplibregl-ctrl-fullscreen')), this._controlContainer);\n        DOM.create('span', 'maplibregl-ctrl-icon', button).setAttribute('aria-hidden', 'true');\n        button.type = 'button';\n        this._updateTitle();\n        this._fullscreenButton.addEventListener('click', this._onClickFullscreen);\n        window.document.addEventListener(this._fullscreenchange, this._onFullscreenChange);\n    }\n\n    _updateTitle(): void {\n        const title = this._getTitle();\n        this._fullscreenButton.setAttribute('aria-label', title);\n        this._fullscreenButton.title = title;\n    }\n\n    _getTitle(): string {\n        return this._map._getUIString(this._isFullscreen() ? 'FullscreenControl.Exit' : 'FullscreenControl.Enter');\n    }\n\n    _isFullscreen(): boolean {\n        return this._fullscreen;\n    }\n\n    _onFullscreenChange = (): void => {\n        // WebKit due to https://caniuse.com/mdn-api_document_fullscreenelement\n        let fullscreenElement =\n            window.document.fullscreenElement ||\n            (window.document as any).webkitFullscreenElement;\n\n        while (fullscreenElement?.shadowRoot?.fullscreenElement) {\n            fullscreenElement = fullscreenElement.shadowRoot.fullscreenElement;\n        }\n\n        if ((fullscreenElement === this._container) !== this._fullscreen) {\n            this._handleFullscreenChange();\n        }\n    };\n\n    _handleFullscreenChange(): void {\n        this._fullscreen = !this._fullscreen;\n        this._fullscreenButton.classList.toggle('maplibregl-ctrl-shrink');\n        this._fullscreenButton.classList.toggle('maplibregl-ctrl-fullscreen');\n        this._updateTitle();\n\n        if (this._fullscreen) {\n            this.fire(new FullscreenEvent('fullscreenstart'));\n            this._prevCooperativeGesturesEnabled = this._map.cooperativeGestures.isEnabled();\n            this._map.cooperativeGestures.disable();\n        } else {\n            this.fire(new FullscreenEvent('fullscreenend'));\n            if (this._prevCooperativeGesturesEnabled) {\n                this._map.cooperativeGestures.enable();\n            }\n        }\n    }\n\n    _onClickFullscreen = (): void => {\n        if (this._isFullscreen()) {\n            this._exitFullscreen();\n        } else {\n            this._requestFullscreen();\n        }\n    };\n\n    _exitFullscreen(): void {\n        if (this._pseudo) {\n            this._togglePseudoFullScreen();\n        } else if (window.document.exitFullscreen) {\n            (window.document as any).exitFullscreen();\n        } else if ((window.document as any).webkitCancelFullScreen) {\n            // due to https://caniuse.com/mdn-api_document_exitfullscreen\n            (window.document as any).webkitCancelFullScreen();\n        } else {\n            this._togglePseudoFullScreen();\n        }\n    }\n\n    _requestFullscreen(): void {\n        if (this._pseudo) {\n            this._togglePseudoFullScreen();\n        } else if (this._container.requestFullscreen) {\n            this._container.requestFullscreen();\n        } else if ((this._container as any).webkitRequestFullscreen) {\n            // due to https://caniuse.com/mdn-api_element_requestfullscreen\n            (this._container as any).webkitRequestFullscreen();\n        } else {\n            this._togglePseudoFullScreen();\n        }\n    }\n\n    _togglePseudoFullScreen(): void {\n        this._container.classList.toggle('maplibregl-pseudo-fullscreen');\n        this._handleFullscreenChange();\n        this._map.resize();\n    }\n}\n","import {DOM} from '../../util/dom.ts';\n\nimport type {Map} from '../map.ts';\nimport type {IControl} from './control.ts';\nimport type {TerrainSpecification} from '@maplibre/maplibre-gl-style-spec';\n\n/**\n * A `TerrainControl` control contains a button for turning the terrain on and off.\n *\n * @group Markers and Controls\n *\n * @example\n * ```ts\n * let map = new Map({TerrainControl: false})\n *     .addControl(new TerrainControl({\n *         source: \"terrain\"\n *     }));\n * ```\n * @see [3D Terrain](https://maplibre.org/maplibre-gl-js/docs/examples/3d-terrain/)\n * @see [Create a Heatmap layer on a globe with terrain elevation](https://maplibre.org/maplibre-gl-js/docs/examples/create-a-heatmap-layer-on-a-globe-with-terrain-elevation/)\n * @see [Display a hybrid satellite map with terrain elevation](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-hybrid-satellite-map-with-terrain-elevation/)\n * @see [Sky, Fog, Terrain](https://maplibre.org/maplibre-gl-js/docs/examples/sky-fog-terrain/)\n */\nexport class TerrainControl implements IControl {\n    options: TerrainSpecification;\n    _map: Map;\n    _container: HTMLElement;\n    _terrainButton: HTMLButtonElement;\n\n    /**\n     * @param options - the control's options\n     */\n    constructor(options: TerrainSpecification) {\n        this.options = options;\n    }\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-group');\n        this._terrainButton = DOM.create('button', 'maplibregl-ctrl-terrain', this._container);\n        DOM.create('span', 'maplibregl-ctrl-icon', this._terrainButton).setAttribute('aria-hidden', 'true');\n        this._terrainButton.type = 'button';\n        this._terrainButton.addEventListener('click', this._toggleTerrain);\n\n        this._updateTerrainIcon();\n        this._map.on('terrain', this._updateTerrainIcon);\n        return this._container;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        this._container.remove();\n        this._map.off('terrain', this._updateTerrainIcon);\n        this._map = undefined;\n    }\n\n    _toggleTerrain = (): void => {\n        if (this._map.getTerrain()) {\n            this._map.setTerrain(null);\n        } else {\n            this._map.setTerrain(this.options);\n        }\n        this._updateTerrainIcon();\n    };\n\n    _updateTerrainIcon = (): void => {\n        this._terrainButton.classList.remove('maplibregl-ctrl-terrain');\n        this._terrainButton.classList.remove('maplibregl-ctrl-terrain-enabled');\n        if (this._map.terrain) {\n            this._terrainButton.classList.add('maplibregl-ctrl-terrain-enabled');\n            this._terrainButton.title = this._map._getUIString('TerrainControl.Disable');\n        } else {\n            this._terrainButton.classList.add('maplibregl-ctrl-terrain');\n            this._terrainButton.title = this._map._getUIString('TerrainControl.Enable');\n        }\n    };\n}\n","import {DOM} from '../../util/dom.ts';\n\nimport type {Map} from '../map.ts';\nimport type {IControl} from './control.ts';\n\n/**\n * A `GlobeControl` control contains a button for toggling the map projection between \"mercator\" and \"globe\".\n *\n * @group Markers and Controls\n *\n * @example\n * ```ts\n * let map = new Map()\n *     .addControl(new GlobeControl());\n * ```\n *\n * @see [Display a globe with a fill extrusion layer](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-globe-with-a-fill-extrusion-layer/)\n * @see [Sky, Fog, Terrain](https://maplibre.org/maplibre-gl-js/docs/examples/sky-fog-terrain/)\n */\nexport class GlobeControl implements IControl {\n    _map: Map;\n    _container: HTMLElement;\n    _globeButton: HTMLButtonElement;\n\n    /** {@inheritDoc IControl.onAdd} */\n    onAdd(map: Map): HTMLElement {\n        this._map = map;\n        this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-group');\n        this._globeButton = DOM.create('button', 'maplibregl-ctrl-globe', this._container);\n        DOM.create('span', 'maplibregl-ctrl-icon', this._globeButton).setAttribute('aria-hidden', 'true');\n        this._globeButton.type = 'button';\n        this._globeButton.addEventListener('click', this._toggleProjection);\n\n        this._updateGlobeIcon();\n        this._map.on('styledata', this._updateGlobeIcon);\n        this._map.on('projectiontransition', this._updateGlobeIcon);\n        return this._container;\n    }\n\n    /** {@inheritDoc IControl.onRemove} */\n    onRemove(): void {\n        this._container.remove();\n        this._map.off('styledata', this._updateGlobeIcon);\n        this._map.off('projectiontransition', this._updateGlobeIcon);\n        this._globeButton.removeEventListener('click', this._toggleProjection);\n        this._map = undefined;\n    }\n\n    _toggleProjection = (): void => {\n        const currentProjection = this._map.getProjection()?.type;\n        if (currentProjection === 'mercator' || !currentProjection) {\n            this._map.setProjection({type: 'globe'});\n        } else {\n            this._map.setProjection({type: 'mercator'});\n        }\n        this._updateGlobeIcon();\n    };\n\n    _updateGlobeIcon = (): void => {\n        this._globeButton.classList.remove('maplibregl-ctrl-globe');\n        this._globeButton.classList.remove('maplibregl-ctrl-globe-enabled');\n        if (this._map.getProjection()?.type === 'globe') {\n            this._globeButton.classList.add('maplibregl-ctrl-globe-enabled');\n            this._globeButton.title = this._map._getUIString('GlobeControl.Disable');\n        } else {\n            this._globeButton.classList.add('maplibregl-ctrl-globe');\n            this._globeButton.title = this._map._getUIString('GlobeControl.Enable');\n        }\n    };\n}\n","import {extend} from '../util/util.ts';\nimport {Event, Evented} from '../util/evented.ts';\nimport {DOM} from '../util/dom.ts';\nimport {LngLat} from '../geo/lng_lat.ts';\nimport {smartWrap} from '../util/smart_wrap.ts';\nimport {anchorTranslate, applyAnchorClass} from './anchor.ts';\nimport Point from '@mapbox/point-geometry';\n\nimport type {MapLibreEvent, MapMouseEvent} from './events.ts';\nimport type {PositionAnchor} from './anchor.ts';\nimport type {Map} from './map.ts';\nimport type {LngLatLike} from '../geo/lng_lat.ts';\nimport type {PointLike} from './camera.ts';\nimport type {PaddingOptions} from '../geo/edge_insets.ts';\n\nconst defaultOptions = {\n    closeButton: true,\n    closeOnClick: true,\n    focusAfterOpen: true,\n    className: '',\n    maxWidth: '240px',\n    subpixelPositioning: false,\n    locationOccludedOpacity: undefined,\n    padding: undefined,\n};\n\n/**\n * A pixel offset specified as:\n *\n * - A single number specifying a distance from the location\n * - A {@link PointLike} specifying a constant offset\n * - An object of {@link PointLike}s specifying an offset for each anchor position\n *\n * Negative offsets indicate left and up.\n */\nexport type Offset = number | PointLike | {\n    [_ in PositionAnchor]: PointLike;\n};\n\n/**\n * The {@link Popup} options object\n */\nexport type PopupOptions = {\n    /**\n     * If `true`, a close button will appear in the top right corner of the popup.\n     * @defaultValue true\n     */\n    closeButton?: boolean;\n    /**\n     * If `true`, the popup will closed when the map is clicked.\n     * @defaultValue true\n     */\n    closeOnClick?: boolean;\n    /**\n     * If `true`, the popup will closed when the map moves.\n     * @defaultValue false\n     */\n    closeOnMove?: boolean;\n    /**\n     * If `true`, the popup will try to focus the first focusable element inside the popup.\n     * @defaultValue true\n     */\n    focusAfterOpen?: boolean;\n    /**\n     * A string indicating the part of the Popup that should\n     * be positioned closest to the coordinate set via {@link Popup.setLngLat}.\n     * Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`,\n     * `'top-right'`, `'bottom-left'`, and `'bottom-right'`. If unset the anchor will be\n     * dynamically set to ensure the popup falls within the map container with a preference\n     * for `'bottom'`.\n     */\n    anchor?: PositionAnchor;\n    /**\n     * A pixel offset applied to the popup's location\n     */\n    offset?: Offset;\n    /**\n     * Space-separated CSS class names to add to popup container\n     */\n    className?: string;\n    /**\n     * A string that sets the CSS property of the popup's maximum width, eg `'300px'`.\n     * To ensure the popup resizes to fit its content, set this property to `'none'`.\n     * Available values can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/max-width\n     * @defaultValue '240px'\n     */\n    maxWidth?: string;\n    /**\n     * If `true`, rounding is disabled for placement of the popup, allowing for\n     * subpixel positioning and smoother movement when the popup is translated.\n     * @defaultValue false\n     */\n    subpixelPositioning?: boolean;\n    /**\n     * Optional opacity when the location is behind the globe.\n     * Note that if a number is provided, it will be converted to a string.\n     * @defaultValue undefined\n     */\n    locationOccludedOpacity?: number | string;\n    /**\n     * A pixel padding applied to the popup's positioning constraints.\n     * The popup will be positioned to avoid being placed within this padding area\n     * from the edges of the map container.\n     * @defaultValue undefined\n     */\n    padding?: PaddingOptions;\n};\n\nconst focusQuerySelector = [\n    'a[href]',\n    '[tabindex]:not([tabindex=\\'-1\\'])',\n    '[contenteditable]:not([contenteditable=\\'false\\'])',\n    'button:not([disabled])',\n    'input:not([disabled])',\n    'select:not([disabled])',\n    'textarea:not([disabled])',\n].join(', ');\n\n/**\n * The event class for popup events (`open` and `close`).\n *\n * @group Event Related\n */\nexport class PopupEvent extends Event {\n    type: keyof PopupEventType;\n    /**\n     * The `Popup` object that fired the event.\n     */\n    target: Popup;\n}\n\n/**\n * `PopupEventType` - a mapping between the popup event name and the event value.\n * These events are used with the {@link Popup.on} method.\n *\n * @group Event Related\n */\nexport type PopupEventType = {\n    /**\n     * Fired when the popup is opened manually or programmatically.\n     */\n    open: PopupEvent;\n    /**\n     * Fired when the popup is closed manually or programmatically.\n     */\n    close: PopupEvent;\n};\n\n/**\n * A popup component.\n *\n * @group Markers and Controls\n *\n *\n * @example\n * Create a popup\n * ```ts\n * let popup = new Popup();\n * // Set an event listener that will fire\n * // any time the popup is opened\n * popup.on('open', () => {\n *   console.log('popup was opened');\n * });\n * ```\n *\n * @example\n * Create a popup\n * ```ts\n * let popup = new Popup();\n * // Set an event listener that will fire\n * // any time the popup is closed\n * popup.on('close', () => {\n *   console.log('popup was closed');\n * });\n * ```\n *\n * @example\n * ```ts\n * let markerHeight = 50, markerRadius = 10, linearOffset = 25;\n * let popupOffsets = {\n *  'top': [0, 0],\n *  'top-left': [0,0],\n *  'top-right': [0,0],\n *  'bottom': [0, -markerHeight],\n *  'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n *  'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n *  'left': [markerRadius, (markerHeight - markerRadius) * -1],\n *  'right': [-markerRadius, (markerHeight - markerRadius) * -1]\n *  };\n * let popup = new Popup({offset: popupOffsets, className: 'my-class'})\n *   .setLngLat(e.lngLat)\n *   .setHTML(\"<h1>Hello World!</h1>\")\n *   .setMaxWidth(\"300px\")\n *   .addTo(map);\n * ```\n * @see [Display a popup](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup/)\n * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-click/)\n * @see [Attach a popup to a marker instance](https://maplibre.org/maplibre-gl-js/docs/examples/attach-a-popup-to-a-marker-instance/)\n * @see [Show polygon information on click](https://maplibre.org/maplibre-gl-js/docs/examples/show-polygon-information-on-click/)\n *\n * ## Events\n *\n * **Event** `open` of type {@link PopupEvent} will be fired when the popup is opened manually or programmatically.\n *\n * **Event** `close` of type {@link PopupEvent} will be fired when the popup is closed manually or programmatically.\n */\nexport class Popup extends Evented<PopupEventType> {\n    _map: Map;\n    options: PopupOptions;\n    _content: HTMLElement;\n    _container: HTMLElement;\n    _closeButton: HTMLButtonElement;\n    _tip: HTMLElement;\n    _lngLat: LngLat;\n    _trackPointer: boolean;\n    _pos: Point;\n    _flatPos: Point;\n\n    /**\n     * @param options - the options\n     */\n    constructor(options?: PopupOptions) {\n        super();\n        this.options = extend(Object.create(defaultOptions), options);\n    }\n\n    /**\n     * Adds the popup to a map.\n     *\n     * @param map - The MapLibre GL JS map to add the popup to.\n     * @example\n     * ```ts\n     * new Popup()\n     *   .setLngLat([0, 0])\n     *   .setHTML(\"<h1>Null Island</h1>\")\n     *   .addTo(map);\n     * ```\n     * @see [Display a popup](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup/)\n     * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n     * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-click/)\n     * @see [Show polygon information on click](https://maplibre.org/maplibre-gl-js/docs/examples/show-polygon-information-on-click/)\n     */\n    addTo(map: Map): this {\n        if (this._map) this.remove();\n\n        this._map = map;\n        if (this.options.closeOnClick) {\n            this._map.on('click', this._onClose);\n        }\n\n        if (this.options.closeOnMove) {\n            this._map.on('move', this._onClose);\n        }\n\n        this._map.on('remove', this.remove);\n        this._map.on('terrain', this._update);\n        this._map.on('projectiontransition', this._update);\n        this._update();\n        this._focusFirstElement();\n\n        if (this._trackPointer) {\n            this._map.on('mousemove', this._update);\n            this._map.on('mouseup', this._update);\n            if (this._container) {\n                this._container.classList.add('maplibregl-popup-track-pointer');\n            }\n            this._map._canvasContainer.classList.add('maplibregl-track-pointer');\n        } else {\n            this._map.on('move', this._update);\n        }\n\n        this.fire(new PopupEvent('open'));\n\n        return this;\n    }\n\n    /**\n     * Add opacity to popup if in globe projection and location is behind view\n     */\n    _updateOpacity = (): void => {\n        if (this.options.locationOccludedOpacity === undefined) {\n            return;\n        }\n        if (this._map._camera.transform.isLocationOccluded(this.getLngLat())) {\n            this._container.style.opacity = `${this.options.locationOccludedOpacity}`;\n        } else {\n            this._container.style.opacity = '';\n        }\n    };\n\n    /**\n     * @returns `true` if the popup is open, `false` if it is closed.\n     */\n    isOpen(): boolean {\n        return !!this._map;\n    }\n\n    /**\n     * Removes the popup from the map it has been added to.\n     *\n     * @example\n     * ```ts\n     * let popup = new Popup().addTo(map);\n     * popup.remove();\n     * ```\n     */\n    remove = (): this => {\n        if (this._content) {\n            this._content.remove();\n        }\n\n        if (this._container) {\n            this._container.remove();\n            delete this._container;\n        }\n\n        if (this._map) {\n            this._map.off('move', this._update);\n            this._map.off('move', this._onClose);\n            this._map.off('click', this._onClose);\n            this._map.off('remove', this.remove);\n            this._map.off('terrain', this._update);\n            this._map.off('projectiontransition', this._update);\n            this._map.off('mousemove', this._update);\n            this._map.off('mouseup', this._update);\n            this._map.off('drag', this._update);\n            this._map._canvasContainer.classList.remove('maplibregl-track-pointer');\n            delete this._map;\n            this.fire(new PopupEvent('close'));\n        }\n\n        return this;\n    };\n\n    /**\n     * Returns the geographical location of the popup's anchor.\n     *\n     * The longitude of the result may differ by a multiple of 360 degrees from the longitude previously\n     * set by `setLngLat` because `Popup` wraps the anchor longitude across copies of the world to keep\n     * the popup on screen.\n     *\n     * @returns The geographical location of the popup's anchor.\n     */\n    getLngLat(): LngLat {\n        return this._lngLat;\n    }\n\n    /**\n     * Sets the geographical location of the popup's anchor, and moves the popup to it. Replaces trackPointer() behavior.\n     *\n     * @param lnglat - The geographical location to set as the popup's anchor.\n     */\n    setLngLat(lnglat: LngLatLike): this {\n        this._lngLat = LngLat.convert(lnglat);\n        this._pos = null;\n        this._flatPos = null;\n\n        this._trackPointer = false;\n\n        this._update();\n\n        if (this._map) {\n            this._map.on('move', this._update);\n            this._map.off('mousemove', this._update);\n            if (this._container) {\n                this._container.classList.remove('maplibregl-popup-track-pointer');\n            }\n            this._map._canvasContainer.classList.remove('maplibregl-track-pointer');\n        }\n\n        return this;\n    }\n\n    /**\n     * Tracks the popup anchor to the cursor position on screens with a pointer device (it will be hidden on touchscreens). Replaces the `setLngLat` behavior.\n     * For most use cases, set `closeOnClick` and `closeButton` to `false`.\n     * @example\n     * ```ts\n     * let popup = new Popup({ closeOnClick: false, closeButton: false })\n     *   .setHTML(\"<h1>Hello World!</h1>\")\n     *   .trackPointer()\n     *   .addTo(map);\n     * ```\n     */\n    trackPointer(): this {\n        this._trackPointer = true;\n        this._pos = null;\n        this._flatPos = null;\n        this._update();\n        if (this._map) {\n            this._map.off('move', this._update);\n            this._map.on('mousemove', this._update);\n            this._map.on('drag', this._update);\n            if (this._container) {\n                this._container.classList.add('maplibregl-popup-track-pointer');\n            }\n            this._map._canvasContainer.classList.add('maplibregl-track-pointer');\n        }\n\n        return this;\n\n    }\n\n    /**\n     * Returns the `Popup`'s HTML element.\n     * @example\n     * Change the `Popup` element's font size\n     * ```ts\n     * let popup = new Popup()\n     *   .setLngLat([-96, 37.8])\n     *   .setHTML(\"<p>Hello World!</p>\")\n     *   .addTo(map);\n     * let popupElem = popup.getElement();\n     * popupElem.style.fontSize = \"25px\";\n     * ```\n     * @returns element\n     */\n    getElement(): HTMLElement {\n        return this._container;\n    }\n\n    /**\n     * Sets the popup's content to a string of text.\n     *\n     * This function creates a [Text](https://developer.mozilla.org/en-US/docs/Web/API/Text) node in the DOM,\n     * so it cannot insert raw HTML. Use this method for security against XSS\n     * if the popup content is user-provided.\n     *\n     * @param text - Textual content for the popup.\n     * @example\n     * ```ts\n     * let popup = new Popup()\n     *   .setLngLat(e.lngLat)\n     *   .setText('Hello, world!')\n     *   .addTo(map);\n     * ```\n     */\n    setText(text: string): this {\n        return this.setDOMContent(document.createTextNode(text));\n    }\n\n    /**\n     * Sets the popup's content to the HTML provided as a string.\n     *\n     * This method does not perform HTML filtering or sanitization, and must be\n     * used only with trusted content. Consider {@link Popup.setText} if\n     * the content is an untrusted text string.\n     *\n     * @param html - A string representing HTML content for the popup.\n     * @example\n     * ```ts\n     * let popup = new Popup()\n     *   .setLngLat(e.lngLat)\n     *   .setHTML(\"<h1>Hello World!</h1>\")\n     *   .addTo(map);\n     * ```\n     * @see [Display a popup](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup/)\n     * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-hover/)\n     * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-popup-on-click/)\n     * @see [Attach a popup to a marker instance](https://maplibre.org/maplibre-gl-js/docs/examples/attach-a-popup-to-a-marker-instance/)\n     */\n    setHTML(html: string): this {\n        const frag = document.createDocumentFragment();\n        const temp = document.createElement('body');\n        let child: ChildNode;\n        temp.innerHTML = html;\n        while (true) {\n            child = temp.firstChild;\n            if (!child) break;\n            frag.appendChild(child);\n        }\n\n        return this.setDOMContent(frag);\n    }\n\n    /**\n     * Returns the popup's maximum width.\n     *\n     * @returns The maximum width of the popup.\n     */\n    getMaxWidth(): string {\n        return this._container?.style.maxWidth;\n    }\n\n    /**\n     * Sets the popup's maximum width. This is setting the CSS property `max-width`.\n     * Available values can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/max-width\n     *\n     * @param maxWidth - A string representing the value for the maximum width.\n     */\n    setMaxWidth(maxWidth: string): this {\n        this.options.maxWidth = maxWidth;\n        this._update();\n        return this;\n    }\n\n    /**\n     * Sets the popup's content to the element provided as a DOM node.\n     *\n     * @param htmlNode - A DOM node to be used as content for the popup.\n     * @example\n     * Create an element with the popup content\n     * ```ts\n     * let div = document.createElement('div');\n     * div.innerHTML = 'Hello, world!';\n     * let popup = new Popup()\n     *   .setLngLat(e.lngLat)\n     *   .setDOMContent(div)\n     *   .addTo(map);\n     * ```\n     */\n    setDOMContent(htmlNode: Node): this {\n        if (this._content) {\n            // Clear out children first.\n            while (this._content.hasChildNodes()) {\n                if (this._content.firstChild) {\n                    this._content.removeChild(this._content.firstChild);\n                }\n            }\n        } else {\n            this._content = DOM.create('div', 'maplibregl-popup-content', this._container);\n        }\n\n        // The close button should be the last tabbable element inside the popup for a good keyboard UX.\n        this._content.appendChild(htmlNode);\n        this._createCloseButton();\n        this._update();\n        this._focusFirstElement();\n        return this;\n    }\n\n    /**\n     * Adds a CSS class to the popup container element.\n     *\n     * @param className - Non-empty string with CSS class name to add to popup container\n     *\n     * @example\n     * ```ts\n     * let popup = new Popup()\n     * popup.addClassName('some-class')\n     * ```\n     */\n    addClassName(className: string): this {\n        if (this._container) {\n            this._container.classList.add(className);\n        }\n        return this;\n    }\n\n    /**\n     * Removes a CSS class from the popup container element.\n     *\n     * @param className - Non-empty string with CSS class name to remove from popup container\n     *\n     * @example\n     * ```ts\n     * let popup = new Popup()\n     * popup.removeClassName('some-class')\n     * ```\n     */\n    removeClassName(className: string): this {\n        if (this._container) {\n            this._container.classList.remove(className);\n        }\n        return this;\n    }\n\n    /**\n     * Sets the popup's offset.\n     *\n     * @param offset - Sets the popup's offset.\n     */\n    setOffset (offset?: Offset): this {\n        this.options.offset = offset;\n        this._update();\n        return this;\n    }\n\n    /**\n     * Add or remove the given CSS class on the popup container, depending on whether the container currently has that class.\n     *\n     * @param className - Non-empty string with CSS class name to add/remove\n     *\n     * @returns if the class was removed return false, if class was added, then return true, undefined if there is no container\n     *\n     * @example\n     * ```ts\n     * let popup = new Popup()\n     * popup.toggleClassName('toggleClass')\n     * ```\n     */\n    toggleClassName(className: string): boolean | undefined {\n        if (this._container) {\n            return this._container.classList.toggle(className);\n        }\n    }\n\n    /**\n     * Set the option to allow subpixel positioning of the popup by passing a boolean\n     *\n     * @param value - When boolean is true, subpixel positioning is enabled for the popup.\n     *\n     * @example\n     * ```ts\n     * let popup = new Popup()\n     * popup.setSubpixelPositioning(true);\n     * ```\n     */\n    setSubpixelPositioning(value: boolean): void {\n        this.options.subpixelPositioning = value;\n    }\n\n    /**\n     * Sets the popup's padding constraints for positioning.\n     *\n     * @param padding - The padding to apply as a {@link PaddingOptions} object.\n     * @example\n     * ```ts\n     * popup.setPadding({ top: 10, right: 20, bottom: 30, left: 40 });\n     * ```\n     */\n    setPadding(padding?: PaddingOptions): void {\n        this.options.padding = padding;\n        this._update();\n    }\n\n    _createCloseButton(): void {\n        if (this.options.closeButton) {\n            this._closeButton = DOM.create('button', 'maplibregl-popup-close-button', this._content);\n            this._closeButton.type = 'button';\n            this._closeButton.innerHTML = '&#215;';\n            this._closeButton.addEventListener('click', this._onClose);\n        }\n    }\n\n    _update = (event?: MapLibreEvent | MapMouseEvent): void => {\n        \n        const hasPosition = this._lngLat || this._trackPointer;\n\n        if (!this._map || !hasPosition || !this._content) { return; }\n\n        if (!this._container) {\n            this._container = DOM.create('div', 'maplibregl-popup', this._map.getContainer());\n            this._tip       = DOM.create('div', 'maplibregl-popup-tip', this._container);\n            this._container.appendChild(this._content);\n            if (this.options.className) {\n                for (const name of this.options.className.split(' ')) {\n                    this._container.classList.add(name);\n                }\n            }\n\n            if (this._closeButton) {\n                this._closeButton.setAttribute('aria-label', this._map._getUIString('Popup.Close'));\n            }\n\n            if (this._trackPointer) {\n                this._container.classList.add('maplibregl-popup-track-pointer');\n            }\n        }\n\n        if (this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth) {\n            this._container.style.maxWidth = this.options.maxWidth;\n        }\n\n        this._lngLat = smartWrap(this._lngLat, this._flatPos, this._map._camera.transform, this._trackPointer);\n\n        let cursor: Point;\n        if (event && 'point' in event && event.point) {\n            cursor = event.point;\n        }\n        if (this._trackPointer && !cursor) return;\n\n        const pos = this._flatPos = this._pos = this._trackPointer && cursor ? cursor : this._map.project(this._lngLat);\n        if (this._map.terrain) {\n            // flat position is saved because smartWrap needs non-elevated points\n            this._flatPos = this._trackPointer && cursor ? cursor : this._map._camera.transform.locationToScreenPoint(this._lngLat);\n        }\n\n        let anchor = this.options.anchor;\n        const offset = normalizeOffset(this.options.offset);\n\n        if (!anchor) {\n            const width = this._container.offsetWidth;\n            const height = this._container.offsetHeight;\n            const padding = normalizePadding(this.options.padding);\n            let anchorComponents: string[];\n\n            if (pos.y + offset.bottom.y < height + padding.top) {\n                anchorComponents = ['top'];\n            } else if (pos.y > this._map._camera.transform.height - height - padding.bottom) {\n                anchorComponents = ['bottom'];\n            } else {\n                anchorComponents = [];\n            }\n\n            if (pos.x < width / 2 + padding.left) {\n                anchorComponents.push('left');\n            } else if (pos.x > this._map._camera.transform.width - width / 2 - padding.right) {\n                anchorComponents.push('right');\n            }\n\n            if (anchorComponents.length === 0) {\n                anchor = 'bottom';\n            } else {\n                anchor = (anchorComponents.join('-') as any);\n            }\n        }\n\n        let offsetedPos = pos.add(offset[anchor]);\n\n        if (!this.options.subpixelPositioning) {\n            offsetedPos = offsetedPos.round();\n        }\n\n        this._container.style.transform = `${anchorTranslate[anchor]} translate(${offsetedPos.x}px,${offsetedPos.y}px)`;\n        applyAnchorClass(this._container, anchor, 'popup');\n\n        this._updateOpacity();\n    };\n\n    _focusFirstElement(): void {\n        if (!this.options.focusAfterOpen || !this._container) return;\n\n        const firstFocusable = this._container.querySelector<HTMLElement>(focusQuerySelector);\n\n        if (firstFocusable) firstFocusable.focus();\n    }\n\n    _onClose = (): void => {\n        this.remove();\n    };\n}\n\nfunction normalizeOffset(offset?: Offset | null) {\n    if (!offset) {\n        return normalizeOffset(new Point(0, 0));\n\n    } else if (typeof offset === 'number') {\n        // input specifies a radius from which to calculate offsets at all positions\n        const cornerOffset = Math.round(Math.abs(offset) / Math.SQRT2);\n        return {\n            'center': new Point(0, 0),\n            'top': new Point(0, offset),\n            'top-left': new Point(cornerOffset, cornerOffset),\n            'top-right': new Point(-cornerOffset, cornerOffset),\n            'bottom': new Point(0, -offset),\n            'bottom-left': new Point(cornerOffset, -cornerOffset),\n            'bottom-right': new Point(-cornerOffset, -cornerOffset),\n            'left': new Point(offset, 0),\n            'right': new Point(-offset, 0)\n        };\n\n    } else if (offset instanceof Point || Array.isArray(offset)) {\n        // input specifies a single offset to be applied to all positions\n        const convertedOffset = Point.convert(offset);\n        return {\n            'center': convertedOffset,\n            'top': convertedOffset,\n            'top-left': convertedOffset,\n            'top-right': convertedOffset,\n            'bottom': convertedOffset,\n            'bottom-left': convertedOffset,\n            'bottom-right': convertedOffset,\n            'left': convertedOffset,\n            'right': convertedOffset\n        };\n\n    } else {\n        // input specifies an offset per position\n        return {\n            'center': Point.convert(offset['center'] || [0, 0]),\n            'top': Point.convert(offset['top'] || [0, 0]),\n            'top-left': Point.convert(offset['top-left'] || [0, 0]),\n            'top-right': Point.convert(offset['top-right'] || [0, 0]),\n            'bottom': Point.convert(offset['bottom'] || [0, 0]),\n            'bottom-left': Point.convert(offset['bottom-left'] || [0, 0]),\n            'bottom-right': Point.convert(offset['bottom-right'] || [0, 0]),\n            'left': Point.convert(offset['left'] || [0, 0]),\n            'right': Point.convert(offset['right'] || [0, 0])\n        };\n    }\n}\n\nfunction normalizePadding(padding?: PaddingOptions | null): {top: number; right: number; bottom: number; left: number} {\n    if (!padding) {\n        return {top: 0, right: 0, bottom: 0, left: 0};\n    }\n\n    return {\n        top: padding.top ?? 0,\n        right: padding.right ?? 0,\n        bottom: padding.bottom ?? 0,\n        left: padding.left ?? 0\n    };\n}\n","import packageJSON from '../package.json' with {type: 'json'};\nimport {Map, type MapOptions, type MissingStyleImageResolver, type StyleImageSource, type WebGLContextAttributesWithType} from './ui/map.ts';\nimport {NavigationControl, type NavigationControlOptions} from './ui/control/navigation_control.ts';\nimport {GeolocateControl, GeolocateEvent, GeolocatePositionEvent, GeolocateErrorEvent, type GeolocateControlEventType, type GeolocateControlOptions} from './ui/control/geolocate_control.ts';\nimport {AttributionControl, type AttributionControlOptions} from './ui/control/attribution_control.ts';\nimport {LogoControl, type LogoControlOptions} from './ui/control/logo_control.ts';\nimport {ScaleControl, type ScaleControlOptions, type Unit} from './ui/control/scale_control.ts';\nimport {FullscreenControl, FullscreenEvent, type FullscreenControlEventType, type FullscreenControlOptions} from './ui/control/fullscreen_control.ts';\nimport {TerrainControl} from './ui/control/terrain_control.ts';\nimport {GlobeControl} from './ui/control/globe_control.ts';\nimport {type Offset, Popup, PopupEvent, type PopupEventType, type PopupOptions} from './ui/popup.ts';\nimport {type Alignment, Marker, MarkerDragEvent, MarkerClickEvent, type MarkerEventType, type MarkerOptions} from './ui/marker.ts';\nimport {type AddLayerObject, type FeatureIdentifier, Style, type StyleOptions, type StyleSetterOptions, type StyleSwapOptions, type TransformStyleFunction} from './style/style.ts';\nimport {LngLat, type LngLatLike} from './geo/lng_lat.ts';\nimport {LngLatBounds, type LngLatBoundsLike} from './geo/lng_lat_bounds.ts';\nimport Point from '@mapbox/point-geometry';\nimport {MercatorCoordinate} from './geo/mercator_coordinate.ts';\nimport {Evented, ErrorEvent, Event, type Listener} from './util/evented.ts';\nimport {type AddProtocolAction, config} from './util/config.ts';\nimport {rtlMainThreadPluginFactory} from './source/rtl_text_plugin_main_thread.ts';\nimport {now, setNow, restoreNow, isTimeFrozen} from './util/time_control.ts';\nimport {WorkerPool} from './util/worker_pool.ts';\nimport {prewarm, clearPrewarmedResources} from './util/global_worker_pool.ts';\nimport {AJAXError, type ExpiryData, type GetResourceResponse, type RequestParameters} from './util/ajax.ts';\nimport {GeoJSONSource, type GetClusterOptions, type SetClusterOptions} from './source/geojson_source.ts';\nimport {CanvasSource, type CanvasSourceSpecification} from './source/canvas_source.ts';\nimport {type CanonicalTileRange, type Coordinates, type ImageSourceImage, ImageSource, type UpdateImageOptions} from './source/image_source.ts';\nimport {RasterDEMTileSource} from './source/raster_dem_tile_source.ts';\nimport {RasterTileSource} from './source/raster_tile_source.ts';\nimport {VectorTileSource, type LoadTileResult} from './source/vector_tile_source.ts';\nimport {VideoSource} from './source/video_source.ts';\nimport {type Source, type SourceClass, addSourceType} from './source/source.ts';\nimport {addProtocol, removeProtocol} from './source/protocol_crud.ts';\nimport {type Dispatcher, getGlobalDispatcher} from './util/dispatcher.ts';\nimport {EdgeInsets, type PaddingOptions} from './geo/edge_insets.ts';\nimport {MapTerrainEvent, MapStyleImageMissingEvent, MapStyleDataEvent, MapStyleLoadEvent, MapSourceDataEvent, MapBoxZoomEvent, MapLibreEvent, MapMovementEvent, type MapLayerTouchEvent, type MapLayerMouseEvent, type MapLayerEventType, type MapEventType, MapContextEvent, MapWheelEvent, MapTouchEvent, MapMouseEvent, type MapSourceDataType, type SourceEventType, MapProjectionEvent} from './ui/events.ts';\nimport {BoxZoomHandler, type BoxZoomEndHandler, type BoxZoomHandlerOptions} from './ui/handler/box_zoom.ts';\nimport {DragRotateHandler} from './ui/handler/shim/drag_rotate.ts';\nimport {DragPanHandler, type DragPanOptions} from './ui/handler/shim/drag_pan.ts';\nimport {ScrollZoomHandler} from './ui/handler/scroll_zoom.ts';\nimport {TwoFingersTouchZoomRotateHandler} from './ui/handler/shim/two_fingers_touch.ts';\nimport {Hash} from './ui/hash.ts';\nimport {CooperativeGesturesHandler, type GestureOptions} from './ui/handler/cooperative_gestures.ts';\nimport {DoubleClickZoomHandler} from './ui/handler/shim/dblclick_zoom.ts';\nimport {KeyboardHandler} from './ui/handler/keyboard.ts';\nimport {TwoFingersTouchPitchHandler, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, type AroundCenterOptions} from './ui/handler/two_fingers_touch.ts';\nimport {MessageType, type ActorMessage, type RequestResponseMessageMap} from './util/actor_messages.ts';\nimport {createTileMesh, type CreateTileMeshOptions, type IndicesType, type TileMesh} from './util/create_tile_mesh.ts';\nimport {GPUInitializationError} from './util/gpu_initialization_error.ts';\nimport {EXTENT} from './data/extent.ts';\n\nimport type {ControlPosition, IControl} from './ui/control/control.ts';\nimport type {CustomRenderMethod, CustomLayerInterface, CustomRenderMethodInput, CustomLayerProjectionDataParams, UnwrappedTileIDLiteral} from './style/style_layer/custom_style_layer.ts';\nimport type {AnimationOptions, CameraForBoundsOptions, CameraOptions, CameraUpdateTransformFunction, CenterZoomBearing, EaseToOptions, FitBoundsOptions, FlyToOptions, JumpToOptions, PointLike} from './ui/camera.ts';\nimport type {DistributiveKeys, DistributiveOmit, GeoJSONFeature, MapGeoJSONFeature} from './util/vectortile_to_geojson.ts';\nimport type {Handler, HandlerResult} from './ui/handler_manager.ts';\nimport type {Complete, Mat4f32, Mat4f64, RequireAtLeastOne, Subscription} from './util/util.ts';\nimport type {CalculateTileZoomFunction, CoveringTilesOptions} from './geo/projection/covering_tiles.ts';\nimport type {TransformConstrainFunction} from './geo/transform_interface.ts';\nimport type {StyleImage, StyleImageData, StyleImageInterface, StyleImageMetadata, TextFit} from './style/style_image.ts';\nimport type {StyleLayer, PaintPropertyEntry} from './style/style_layer.ts';\nimport type {Tile} from './tile/tile.ts';\nimport type {GeoJSONFeatureDiff, GeoJSONFeatureId, GeoJSONSourceDiff} from './source/geojson_source_diff.ts';\nimport type {QueryRenderedFeaturesOptions, QuerySourceFeatureOptions} from './source/query_features.ts';\nimport type {RequestTransformFunction, ResourceType} from './util/request_manager.ts';\nimport type {OverscaledTileID} from './tile/tile_id.ts';\nimport type {PositionAnchor} from './ui/anchor.ts';\nimport type {CustomLayerProjectionData, ProjectionData, ProjectionDataParams, ProjectionMatrix, RendererProjectionData} from './geo/projection/projection_data.ts';\nimport type {WorkerTileResult} from './source/worker_source.ts';\nimport type {Actor, IActor} from './util/actor.ts';\nimport type {Bucket} from './data/bucket.ts';\nimport type {CollisionBoxArray} from './data/array_types.g.ts';\nimport type {AlphaImage} from './util/image.ts';\nimport type {GlyphPosition, GlyphPositions} from './render/glyph_atlas.ts';\nimport type {ImageAtlas} from './render/image_atlas.ts';\nimport type {StyleGlyph} from './style/style_glyph.ts';\nimport type {FeatureIndex} from './data/feature_index.ts';\nimport type {DashEntry} from './render/line_atlas.ts';\nimport type {Painter} from './render/painter.ts';\nimport type {WorkerGlobalScopeInterface} from './util/web_worker.ts';\nconst version = packageJSON.version;\n\nexport type * from '@maplibre/maplibre-gl-style-spec';\n\n/**\n * Sets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text).\n * Necessary for supporting the Arabic and Hebrew languages, which are written right-to-left.\n *\n * @param pluginURL - URL pointing to the Mapbox RTL text plugin source.\n * @param lazy - If set to `true`, maplibre will defer loading the plugin until rtl text is encountered,\n * rtl text will then be rendered only after the plugin finishes loading.\n * @example\n * ```ts\n * setRTLTextPlugin('https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js', false);\n * ```\n * @see [Add support for right-to-left scripts](https://maplibre.org/maplibre-gl-js/docs/examples/add-support-for-right-to-left-scripts/)\n * @see [Display and style rich text labels](https://maplibre.org/maplibre-gl-js/docs/examples/display-and-style-rich-text-labels/)\n */\nfunction setRTLTextPlugin(pluginURL: string, lazy: boolean): Promise<void> {\n    return rtlMainThreadPluginFactory().setRTLTextPlugin(pluginURL, lazy);\n}\n/**\n * Gets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text) status.\n * The status can be `unavailable` (i.e. not requested or removed), `loading`, `loaded` or `error`.\n * If the status is `loaded` and the plugin is requested again, an error will be thrown.\n *\n * @example\n * ```ts\n * const pluginStatus = getRTLTextPluginStatus();\n * ```\n */\nfunction getRTLTextPluginStatus(): string {\n    return rtlMainThreadPluginFactory().getRTLTextPluginStatus();\n}\n/**\n * Returns the package version of the library\n * @returns Package version of the library\n */\nfunction getVersion(): string { return version; }\n/**\n * Gets the number of web workers instantiated on a page with GL JS maps.\n * By default, workerCount is 1 except for Safari browser where it is set to half the number of CPU cores (capped at 3).\n * Make sure to set this property before creating any map instances for it to have effect.\n *\n * @returns Number of workers currently configured.\n * @example\n * ```ts\n * const workerCount = getWorkerCount()\n * ```\n */\nfunction getWorkerCount(): number { return WorkerPool.workerCount; }\n/**\n * Sets the number of web workers instantiated on a page with GL JS maps.\n * By default, workerCount is 1 except for Safari browser where it is set to half the number of CPU cores (capped at 3).\n * Make sure to set this property before creating any map instances for it to have effect.\n *\n * @example\n * ```ts\n * setWorkerCount(2);\n * ```\n */\nfunction setWorkerCount(count: number): void { WorkerPool.workerCount = count; }\n/**\n * Gets and sets the maximum number of images (raster tiles, sprites, icons) to load in parallel,\n * which affects performance in raster-heavy maps. 16 by default.\n *\n * @returns Number of parallel requests currently configured.\n * @example\n * ```ts\n * getMaxParallelImageRequests();\n * ```\n */\nfunction getMaxParallelImageRequests(): number { return config.MAX_PARALLEL_IMAGE_REQUESTS; }\n/**\n * Sets the maximum number of images (raster tiles, sprites, icons) to load in parallel,\n * which affects performance in raster-heavy maps. 16 by default.\n *\n * @example\n * ```ts\n * setMaxParallelImageRequests(10);\n * ```\n */\nfunction setMaxParallelImageRequests(numRequests: number): void { config.MAX_PARALLEL_IMAGE_REQUESTS = numRequests; }\n/**\n * Gets the worker url\n * @returns The worker url\n */\nfunction getWorkerUrl(): string { return config.WORKER_URL; }\n/**\n * Sets the worker url\n */\nfunction setWorkerUrl(value: string): void { config.WORKER_URL = value; }\n/**\n * Allows loading javascript code in the worker thread.\n * *Note* that since this is using some very internal classes and flows it is considered experimental and can break at any point.\n *\n * It can be useful for the following examples:\n * 1. Using `self.addProtocol` in the worker thread - note that you might need to also register the protocol on the main thread.\n * 2. Using `self.registerWorkerSource(workerSource: WorkerSource)` to register a worker source, which should come with `addSourceType` usually.\n * 3. using `self.actor.registerMessageHandler` to override some internal worker operations\n * @param workerUrl - the worker url e.g. a url of a javascript file to load in the worker\n * @returns\n *\n * @example\n * ```ts\n * // below is an example of sending a js file to the worker to load the method there\n * // Note that you'll need to call the global function `addProtocol` in the worker to register the protocol there.\n * // add-protocol-worker.js\n * async function loadFn(params, abortController) {\n *     const t = await fetch(`https://${params.url.split(\"://\")[1]}`);\n *     if (t.status == 200) {\n *         const buffer = await t.arrayBuffer();\n *         return {data: buffer}\n *     } else {\n *         throw new Error(`Tile fetch error: ${t.statusText}`);\n *     }\n * }\n * self.addProtocol('custom', loadFn);\n *\n * // main.js\n * importScriptInWorkers('add-protocol-worker.js');\n * ```\n */\nasync function importScriptInWorkers(workerUrl: string): Promise<void> { await getGlobalDispatcher().broadcast(MessageType.importScript, workerUrl); }\n\nexport {\n    Map,\n    Map as MapLibreMap,\n    NavigationControl,\n    GeolocateControl,\n    GeolocateEvent,\n    GeolocatePositionEvent,\n    GeolocateErrorEvent,\n    AttributionControl,\n    LogoControl,\n    ScaleControl,\n    FullscreenControl,\n    FullscreenEvent,\n    TerrainControl,\n    GlobeControl,\n    Hash,\n    Popup,\n    PopupEvent,\n    Marker,\n    MarkerDragEvent,\n    MarkerClickEvent,\n    Style,\n    LngLat,\n    LngLatBounds,\n    Point,\n    MercatorCoordinate,\n    Evented,\n    Event,\n    AJAXError,\n    GPUInitializationError,\n    config,\n    CanvasSource,\n    GeoJSONSource,\n    ImageSource,\n    RasterDEMTileSource,\n    RasterTileSource,\n    VectorTileSource,\n    LoadTileResult,\n    VideoSource,\n    EdgeInsets,\n    BoxZoomHandler,\n    DragRotateHandler,\n    DragPanHandler,\n    ScrollZoomHandler,\n    TwoFingersTouchZoomRotateHandler,\n    CooperativeGesturesHandler,\n    DoubleClickZoomHandler,\n    KeyboardHandler,\n    TwoFingersTouchZoomHandler,\n    TwoFingersTouchRotateHandler,\n    TwoFingersTouchPitchHandler,\n    MapWheelEvent,\n    MapTouchEvent,\n    MapMouseEvent,\n    MapProjectionEvent,\n    MapTerrainEvent,\n    MapStyleImageMissingEvent,\n    MapStyleDataEvent,\n    MapStyleLoadEvent,\n    MapSourceDataEvent,\n    MapBoxZoomEvent,\n    MapLibreEvent,\n    MapMovementEvent,\n    MapContextEvent,\n    ErrorEvent,\n    type Handler,\n    type RequireAtLeastOne,\n    type CameraUpdateTransformFunction,\n    type TransformConstrainFunction,\n    type CustomRenderMethod,\n    type CalculateTileZoomFunction,\n    type MapSourceDataType,\n    type TileMesh,\n    type CreateTileMeshOptions,\n    type ControlPosition,\n    type Subscription,\n    type Complete,\n    type CameraOptions,\n    type CenterZoomBearing,\n    type StyleImage,\n    type StyleImageData,\n    type StyleImageMetadata,\n    type StyleLayer,\n    type PaintPropertyEntry,\n    type GetResourceResponse,\n    type MapGeoJSONFeature,\n    type Alignment,\n    type AddProtocolAction,\n    type SourceClass,\n    type IndicesType,\n    type AttributionControlOptions,\n    type CanonicalTileRange,\n    type Tile,\n    type Listener,\n    type Coordinates,\n    type ImageSourceImage,\n    type UpdateImageOptions,\n    type DragPanOptions,\n    type FullscreenControlOptions,\n    type GetClusterOptions,\n    type SetClusterOptions,\n    type GeoJSONSourceDiff,\n    type GeolocateControlOptions,\n    type LogoControlOptions,\n    type StyleImageInterface,\n    type AddLayerObject,\n    type StyleSetterOptions,\n    type CameraForBoundsOptions,\n    type EaseToOptions,\n    type FitBoundsOptions,\n    type FlyToOptions,\n    type FeatureIdentifier,\n    type JumpToOptions,\n    type QueryRenderedFeaturesOptions,\n    type QuerySourceFeatureOptions,\n    type AnimationOptions,\n    type StyleSwapOptions,\n    type StyleOptions,\n    type RequestTransformFunction,\n    type MarkerOptions,\n    type NavigationControlOptions,\n    type PopupOptions,\n    type Offset,\n    type OverscaledTileID,\n    type ScaleControlOptions,\n    type Unit,\n    type AroundCenterOptions,\n    type BoxZoomEndHandler,\n    type BoxZoomHandlerOptions,\n    type HandlerResult,\n    type CustomRenderMethodInput,\n    type ExpiryData,\n    type PositionAnchor,\n    type ProjectionData,\n    type ProjectionDataParams,\n    type CustomLayerProjectionData,\n    type Mat4f32,\n    type Mat4f64,\n    type ProjectionMatrix,\n    type RendererProjectionData,\n    type GeoJSONFeatureId,\n    type GeoJSONFeatureDiff,\n    type TextFit,\n    type TransformStyleFunction,\n    type DistributiveOmit,\n    type DistributiveKeys,\n    type RequestParameters,\n    type RequestResponseMessageMap,\n    type WorkerTileResult,\n    type ResourceType,\n    type Dispatcher,\n    type Actor,\n    type IActor,\n    type ActorMessage,\n    type Bucket,\n    type CollisionBoxArray,\n    type FeatureIndex,\n    type AlphaImage,\n    type GlyphPositions,\n    type GlyphPosition,\n    type ImageAtlas,\n    type MessageType,\n    type StyleGlyph,\n    type MapOptions,\n    type MissingStyleImageResolver,\n    type StyleImageSource,\n    type GestureOptions,\n    type WebGLContextAttributesWithType,\n    type IControl,\n    type CustomLayerInterface,\n    type CustomLayerProjectionDataParams,\n    type UnwrappedTileIDLiteral,\n    type CanvasSourceSpecification,\n    type PaddingOptions,\n    type LngLatLike,\n    type PointLike,\n    type LngLatBoundsLike,\n    type Source,\n    type MapLayerTouchEvent,\n    type MapLayerMouseEvent,\n    type MapLayerEventType,\n    type MapEventType,\n    type SourceEventType,\n    type GeolocateControlEventType,\n    type FullscreenControlEventType,\n    type PopupEventType,\n    type MarkerEventType,\n    type GeoJSONFeature,\n    type CoveringTilesOptions,\n    type DashEntry,\n    type Painter,\n    type WorkerGlobalScopeInterface,\n    setRTLTextPlugin,\n    getRTLTextPluginStatus,\n    prewarm,\n    clearPrewarmedResources,\n    getVersion,\n    getWorkerCount,\n    setWorkerCount,\n    getMaxParallelImageRequests,\n    setMaxParallelImageRequests,\n    getWorkerUrl,\n    setWorkerUrl,\n    addProtocol,\n    removeProtocol,\n    addSourceType,\n    importScriptInWorkers,\n    createTileMesh,\n    now,\n    setNow,\n    restoreNow,\n    isTimeFrozen,\n    getGlobalDispatcher,\n    EXTENT\n};\n"],"x_google_ignoreList":[11,56],"mappings":";;;;;;;;;ACGA,IAAI;AAEJ,IAAI;AACJ,IAAI;;AAGJ,MAAa,UAAU;;;;;;;;;;;CAWnB,MAAM,iBAAkC,IAA2C,QAAgC,cAA6B;EAC5I,MAAM,MAAM,gBAAgB;EAC5B,MAAM,UAAU,IAAI,uBAAuB,wBAAsB;GAC7D,YAAY;GACZ,GAAG,mBAAmB;EAC1B,CAAC;EAED,MAAM,EAAC,gBAAe,UAAU,gBAAgB,QAAQ,eAAe;GACnE,YAAY;GACZ,IAAI,qBAAqB,OAAO;GAChC,OAAO,IAAI,WAAW,gBAAgB,OAAO,MAAM,CAAC;EACxD,GAAG,KAAK;C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