@honua/react 0.1.0-beta.0 → 0.1.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contract/discovery.d.ts +231 -0
- package/contract/discovery.d.ts.map +1 -0
- package/contract/discovery.js +554 -0
- package/contract/edit-sketch.d.ts +8 -0
- package/contract/edit-sketch.d.ts.map +1 -1
- package/contract/edit-sketch.js +15 -0
- package/contract/edit-snapping.d.ts +160 -0
- package/contract/edit-snapping.d.ts.map +1 -0
- package/contract/edit-snapping.js +675 -0
- package/contract/generated/projjson-v0.7-crs-validator.d.ts +35 -0
- package/contract/generated/projjson-v0.7-crs-validator.d.ts.map +1 -0
- package/contract/generated/projjson-v0.7-crs-validator.js +3941 -0
- package/contract/index.d.ts +11 -2
- package/contract/index.d.ts.map +1 -1
- package/contract/index.js +4 -1
- package/contract/pmtiles.d.ts +31 -0
- package/contract/pmtiles.d.ts.map +1 -1
- package/contract/pmtiles.js +60 -20
- package/contract/protocol-module.d.ts +70 -0
- package/contract/protocol-module.d.ts.map +1 -0
- package/contract/protocol-module.js +1 -0
- package/contract/schema-envelope.d.ts +26 -0
- package/contract/schema-envelope.d.ts.map +1 -0
- package/contract/schema-envelope.js +25 -0
- package/contract/schema.d.ts +582 -0
- package/contract/schema.d.ts.map +1 -0
- package/contract/schema.js +2483 -0
- package/contract/source-capability-support.d.ts +6 -0
- package/contract/source-capability-support.d.ts.map +1 -0
- package/contract/source-capability-support.js +154 -0
- package/contract/source.d.ts +35 -17
- package/contract/source.d.ts.map +1 -1
- package/contract/source.js +267 -71
- package/contract/types.d.ts +140 -4
- package/contract/types.d.ts.map +1 -1
- package/contract/types.js +6 -14
- package/core/bounded-json.d.ts +4 -0
- package/core/bounded-json.d.ts.map +1 -0
- package/core/bounded-json.js +38 -0
- package/core/cache-state.d.ts +9 -0
- package/core/cache-state.d.ts.map +1 -1
- package/core/cache-state.js +10 -0
- package/core/capabilities-xml.d.ts +33 -0
- package/core/capabilities-xml.d.ts.map +1 -0
- package/core/capabilities-xml.js +331 -0
- package/core/client.d.ts +4 -1
- package/core/client.d.ts.map +1 -1
- package/core/client.js +115 -29
- package/core/error-classifications.d.ts +153 -0
- package/core/error-classifications.d.ts.map +1 -0
- package/core/error-classifications.js +140 -0
- package/core/error-code-registry.d.ts +158 -0
- package/core/error-code-registry.d.ts.map +1 -0
- package/core/error-code-registry.js +143 -0
- package/core/error-envelope.d.ts +68 -0
- package/core/error-envelope.d.ts.map +1 -0
- package/core/error-envelope.js +357 -0
- package/core/errors.d.ts +45 -29
- package/core/errors.d.ts.map +1 -1
- package/core/errors.js +97 -50
- package/core/geoparquet-sql.d.ts +30 -2
- package/core/geoparquet-sql.d.ts.map +1 -1
- package/core/geoparquet-sql.js +38 -3
- package/core/odata-key-path.d.ts +12 -0
- package/core/odata-key-path.d.ts.map +1 -0
- package/core/odata-key-path.js +28 -0
- package/core/odata-write-codec.d.ts +66 -0
- package/core/odata-write-codec.d.ts.map +1 -0
- package/core/odata-write-codec.js +1083 -0
- package/core/odata.d.ts +59 -7
- package/core/odata.d.ts.map +1 -1
- package/core/odata.js +431 -99
- package/core/ogc-features.d.ts.map +1 -1
- package/core/ogc-features.js +3 -0
- package/core/ogc-maps.d.ts +7 -0
- package/core/ogc-maps.d.ts.map +1 -1
- package/core/ogc-maps.js +46 -7
- package/core/ogc-processes.d.ts +2 -1
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +33 -5
- package/core/ogc-records.d.ts +9 -0
- package/core/ogc-records.d.ts.map +1 -1
- package/core/ogc-records.js +78 -29
- package/core/ogc-tiles.d.ts +10 -1
- package/core/ogc-tiles.d.ts.map +1 -1
- package/core/ogc-tiles.js +56 -17
- package/core/path-utils.d.ts +9 -0
- package/core/path-utils.d.ts.map +1 -1
- package/core/path-utils.js +19 -0
- package/core/protocol-transport.d.ts +1 -0
- package/core/protocol-transport.d.ts.map +1 -1
- package/core/request-pipeline.d.ts.map +1 -1
- package/core/request-pipeline.js +1 -1
- package/core/spatial-filter.d.ts +8 -4
- package/core/spatial-filter.d.ts.map +1 -1
- package/core/spatial-filter.js +206 -16
- package/core/stac-static.d.ts +6 -2
- package/core/stac-static.d.ts.map +1 -1
- package/core/stac-static.js +260 -69
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +69 -5
- package/core/types.d.ts +125 -7
- package/core/types.d.ts.map +1 -1
- package/core/wfs-capabilities.d.ts +2 -0
- package/core/wfs-capabilities.d.ts.map +1 -1
- package/core/wfs-capabilities.js +8 -1
- package/core/wfs.d.ts.map +1 -1
- package/core/wfs.js +10 -0
- package/core/wms-capabilities.d.ts +56 -84
- package/core/wms-capabilities.d.ts.map +1 -1
- package/core/wms-capabilities.js +212 -509
- package/core/wmts-capabilities.d.ts +62 -62
- package/core/wmts-capabilities.d.ts.map +1 -1
- package/core/wmts-capabilities.js +224 -371
- package/esri-compat/editor.d.ts +8 -0
- package/esri-compat/editor.d.ts.map +1 -1
- package/esri-compat/editor.js +13 -0
- package/esri-compat/feature-layer.d.ts +2 -0
- package/esri-compat/feature-layer.d.ts.map +1 -1
- package/esri-compat/feature-layer.js +1 -0
- package/esri-compat/layer-list.d.ts +11 -0
- package/esri-compat/layer-list.d.ts.map +1 -1
- package/esri-compat/layer-list.js +49 -0
- package/esri-compat/legend.d.ts +10 -0
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +27 -0
- package/esri-compat/portal.d.ts +197 -0
- package/esri-compat/portal.d.ts.map +1 -0
- package/esri-compat/portal.js +251 -0
- package/esri-compat/renderer-objects.d.ts +40 -0
- package/esri-compat/renderer-objects.d.ts.map +1 -0
- package/esri-compat/renderer-objects.js +62 -0
- package/esri-compat/sketch.d.ts +43 -0
- package/esri-compat/sketch.d.ts.map +1 -1
- package/esri-compat/sketch.js +46 -0
- package/esri-compat/snapping.d.ts +43 -0
- package/esri-compat/snapping.d.ts.map +1 -0
- package/esri-compat/snapping.js +45 -0
- package/esri-compat/url.d.ts.map +1 -1
- package/esri-compat/url.js +1 -1
- package/esri-compat/widget-host.d.ts +84 -0
- package/esri-compat/widget-host.d.ts.map +1 -0
- package/esri-compat/widget-host.js +159 -0
- package/filter-registry/index.d.ts +145 -0
- package/filter-registry/index.d.ts.map +1 -0
- package/filter-registry/index.js +531 -0
- package/generated-app/errors.d.ts +18 -2
- package/generated-app/errors.d.ts.map +1 -1
- package/generated-app/errors.js +44 -11
- package/map/automatic-mount-integration.d.ts +134 -0
- package/map/automatic-mount-integration.d.ts.map +1 -0
- package/map/automatic-mount-integration.js +305 -0
- package/map/automatic-source-strategy.d.ts +125 -0
- package/map/automatic-source-strategy.d.ts.map +1 -0
- package/map/automatic-source-strategy.js +494 -0
- package/map/data-to-map-bridge.d.ts +293 -0
- package/map/data-to-map-bridge.d.ts.map +1 -0
- package/map/data-to-map-bridge.js +817 -0
- package/map/geojson-projection.d.ts +33 -0
- package/map/geojson-projection.d.ts.map +1 -0
- package/map/geojson-projection.js +118 -0
- package/map/index.d.ts +14 -0
- package/map/index.d.ts.map +1 -1
- package/map/index.js +8 -0
- package/map/raster-source-spec.d.ts +30 -0
- package/map/raster-source-spec.d.ts.map +1 -0
- package/map/raster-source-spec.js +190 -0
- package/map/raster-source-strategy.d.ts +65 -0
- package/map/raster-source-strategy.d.ts.map +1 -0
- package/map/raster-source-strategy.js +232 -0
- package/map/source-to-maplibre.d.ts +91 -0
- package/map/source-to-maplibre.d.ts.map +1 -0
- package/map/source-to-maplibre.js +454 -0
- package/map/temporal-playback.d.ts +139 -0
- package/map/temporal-playback.d.ts.map +1 -0
- package/map/temporal-playback.js +247 -0
- package/package.json +14 -1
- package/query-planner/canonical.d.ts +7 -0
- package/query-planner/canonical.d.ts.map +1 -0
- package/query-planner/canonical.js +145 -0
- package/query-planner/cql2-json.d.ts +17 -0
- package/query-planner/cql2-json.d.ts.map +1 -0
- package/query-planner/cql2-json.js +646 -0
- package/query-planner/diagnostics.d.ts +35 -0
- package/query-planner/diagnostics.d.ts.map +1 -0
- package/query-planner/diagnostics.js +373 -0
- package/query-planner/duckdb.d.ts +79 -0
- package/query-planner/duckdb.d.ts.map +1 -0
- package/query-planner/duckdb.js +758 -0
- package/query-planner/execution-context.d.ts +5 -0
- package/query-planner/execution-context.d.ts.map +1 -0
- package/query-planner/execution-context.js +50 -0
- package/query-planner/executor.d.ts +5 -0
- package/query-planner/executor.d.ts.map +1 -0
- package/query-planner/executor.js +223 -0
- package/query-planner/geoservices.d.ts +91 -0
- package/query-planner/geoservices.d.ts.map +1 -0
- package/query-planner/geoservices.js +667 -0
- package/query-planner/grpc.d.ts +100 -0
- package/query-planner/grpc.d.ts.map +1 -0
- package/query-planner/grpc.js +736 -0
- package/query-planner/index.d.ts +44 -0
- package/query-planner/index.d.ts.map +1 -0
- package/query-planner/index.js +30 -0
- package/query-planner/ir.d.ts +20 -0
- package/query-planner/ir.d.ts.map +1 -0
- package/query-planner/ir.js +417 -0
- package/query-planner/local-aggregate.d.ts +5 -0
- package/query-planner/local-aggregate.d.ts.map +1 -0
- package/query-planner/local-aggregate.js +126 -0
- package/query-planner/odata.d.ts +48 -0
- package/query-planner/odata.d.ts.map +1 -0
- package/query-planner/odata.js +662 -0
- package/query-planner/ogc-compiler.d.ts +55 -0
- package/query-planner/ogc-compiler.d.ts.map +1 -0
- package/query-planner/ogc-compiler.js +480 -0
- package/query-planner/ogc-features.d.ts +53 -0
- package/query-planner/ogc-features.d.ts.map +1 -0
- package/query-planner/ogc-features.js +617 -0
- package/query-planner/planner.d.ts +17 -0
- package/query-planner/planner.d.ts.map +1 -0
- package/query-planner/planner.js +818 -0
- package/query-planner/resource.d.ts +94 -0
- package/query-planner/resource.d.ts.map +1 -0
- package/query-planner/resource.js +526 -0
- package/query-planner/semantic-canonical.d.ts +15 -0
- package/query-planner/semantic-canonical.d.ts.map +1 -0
- package/query-planner/semantic-canonical.js +62 -0
- package/query-planner/semantic-compat.d.ts +10 -0
- package/query-planner/semantic-compat.d.ts.map +1 -0
- package/query-planner/semantic-compat.js +35 -0
- package/query-planner/semantic-compiler.d.ts +64 -0
- package/query-planner/semantic-compiler.d.ts.map +1 -0
- package/query-planner/semantic-compiler.js +81 -0
- package/query-planner/semantic-literals.d.ts +30 -0
- package/query-planner/semantic-literals.d.ts.map +1 -0
- package/query-planner/semantic-literals.js +133 -0
- package/query-planner/semantic-types.d.ts +265 -0
- package/query-planner/semantic-types.d.ts.map +1 -0
- package/query-planner/semantic-types.js +1 -0
- package/query-planner/semantic.d.ts +54 -0
- package/query-planner/semantic.d.ts.map +1 -0
- package/query-planner/semantic.js +1421 -0
- package/query-planner/types.d.ts +560 -0
- package/query-planner/types.d.ts.map +1 -0
- package/query-planner/types.js +49 -0
- package/query-planner/wfs-semantic.d.ts +58 -0
- package/query-planner/wfs-semantic.d.ts.map +1 -0
- package/query-planner/wfs-semantic.js +547 -0
- package/query-planner/wfs.d.ts +6 -0
- package/query-planner/wfs.d.ts.map +1 -0
- package/query-planner/wfs.js +71 -0
- package/react/external-map.d.ts +67 -0
- package/react/external-map.d.ts.map +1 -0
- package/react/external-map.js +63 -0
- package/react/honua-map.d.ts.map +1 -1
- package/react/honua-map.js +3 -2
- package/react/honua-source-layer.d.ts +110 -0
- package/react/honua-source-layer.d.ts.map +1 -0
- package/react/honua-source-layer.js +101 -0
- package/react/hooks.d.ts +28 -0
- package/react/hooks.d.ts.map +1 -1
- package/react/hooks.js +26 -4
- package/react/index.d.ts +8 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +5 -0
- package/react/query-cache.d.ts +26 -4
- package/react/query-cache.d.ts.map +1 -1
- package/react/query-cache.js +51 -8
- package/react/selection.d.ts +177 -0
- package/react/selection.d.ts.map +1 -0
- package/react/selection.js +0 -0
- package/react/use-mounted-source.d.ts +69 -0
- package/react/use-mounted-source.d.ts.map +1 -0
- package/react/use-mounted-source.js +346 -0
- package/runtime/edit-snapping.d.ts +107 -0
- package/runtime/edit-snapping.d.ts.map +1 -0
- package/runtime/edit-snapping.js +190 -0
- package/runtime/errors.d.ts +3 -2
- package/runtime/errors.d.ts.map +1 -1
- package/runtime/errors.js +19 -2
- package/runtime/index.d.ts +6 -0
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +3 -0
- package/runtime/maplibre-renderer.d.ts +41 -0
- package/runtime/maplibre-renderer.d.ts.map +1 -0
- package/runtime/maplibre-renderer.js +322 -0
- package/runtime/query-tiles.d.ts +2 -1
- package/runtime/query-tiles.d.ts.map +1 -1
- package/runtime/query-tiles.js +6 -2
- package/runtime/source-bridge.d.ts +4 -4
- package/runtime/source-bridge.d.ts.map +1 -1
- package/runtime/source-bridge.js +9 -56
- package/runtime/style-interactions.d.ts +3 -2
- package/runtime/style-interactions.d.ts.map +1 -1
- package/runtime/style-interactions.js +11 -3
- package/runtime/terra-draw-sketch.d.ts +275 -0
- package/runtime/terra-draw-sketch.d.ts.map +1 -0
- package/runtime/terra-draw-sketch.js +404 -0
- package/source-capability-registry.d.ts +1 -0
- package/source-capability-registry.js +1 -0
- package/source-capability-types.d.ts +186 -0
- package/source-capability-types.js +7 -0
- package/style/index.d.ts +2 -0
- package/style/index.d.ts.map +1 -1
- package/style/index.js +2 -0
- package/style/renderers.d.ts +326 -0
- package/style/renderers.d.ts.map +1 -0
- package/style/renderers.js +517 -0
- package/webmap/convert-renderer.d.ts +24 -3
- package/webmap/convert-renderer.d.ts.map +1 -1
- package/webmap/convert-renderer.js +93 -112
- package/webmap/index.d.ts +1 -1
- package/webmap/index.d.ts.map +1 -1
- package/webmap/index.js +1 -1
package/runtime/source-bridge.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @module
|
|
21
21
|
*/
|
|
22
22
|
import { PROTOCOL_DEFAULT_CAPABILITIES, } from "../contract/index.js";
|
|
23
|
-
import {
|
|
23
|
+
import { buildWmsRasterSourceSpec as buildMapWmsRasterSourceSpec, buildWmtsRasterSourceSpec as buildMapWmtsRasterSourceSpec, } from "../map/raster-source-spec.js";
|
|
24
24
|
import { HonuaMapPackageError } from "./errors.js";
|
|
25
25
|
/**
|
|
26
26
|
* Project the bindings on a MapPackage into SDK contract descriptors and
|
|
@@ -145,42 +145,14 @@ export function toHonuaSourceSpec(descriptor, filter) {
|
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* Build a MapLibre `raster` source spec for a WMS descriptor. The
|
|
148
|
-
* `tiles` template uses MapLibre's
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* URLs themselves.
|
|
148
|
+
* `tiles` template uses MapLibre's exact `{bbox-epsg-3857}` runtime
|
|
149
|
+
* placeholder plus validated (1–4096) literal WIDTH / HEIGHT values
|
|
150
|
+
* equal to `tileSize`, so each tile request is a pre-baked KVP URL —
|
|
151
|
+
* consumers do not have to hand-assemble GetMap URLs themselves.
|
|
152
152
|
*/
|
|
153
153
|
export function buildWmsRasterSourceSpec(descriptor, options = {}) {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
const format = options.format ?? "image/png";
|
|
157
|
-
const transparent = options.transparent ?? true;
|
|
158
|
-
const layers = descriptor.locator.typeName ?? "";
|
|
159
|
-
const styles = descriptor.locator.styleId ?? "";
|
|
160
|
-
const params = new URLSearchParams();
|
|
161
|
-
params.set("SERVICE", "WMS");
|
|
162
|
-
params.set("VERSION", "1.3.0");
|
|
163
|
-
params.set("REQUEST", "GetMap");
|
|
164
|
-
params.set("LAYERS", layers);
|
|
165
|
-
params.set("STYLES", styles);
|
|
166
|
-
params.set("CRS", "EPSG:3857");
|
|
167
|
-
params.set("FORMAT", format);
|
|
168
|
-
params.set("TRANSPARENT", String(transparent).toUpperCase());
|
|
169
|
-
// MapLibre substitutes these placeholders at fetch-time. They are
|
|
170
|
-
// intentionally appended verbatim (no encoding) so MapLibre's
|
|
171
|
-
// template parser sees the literal tokens. WIDTH and HEIGHT are
|
|
172
|
-
// emitted only as placeholders — duplicating them as fixed params
|
|
173
|
-
// would produce ambiguous query keys that honua-server's
|
|
174
|
-
// TryGetRequiredQueryValue / int.TryParse pair rejects.
|
|
175
|
-
const baseUrl = `${url}?${params.toString()}&BBOX={bbox-epsg3857}&WIDTH={width}&HEIGHT={height}`;
|
|
176
|
-
const out = {
|
|
177
|
-
type: "raster",
|
|
178
|
-
tiles: [baseUrl],
|
|
179
|
-
tileSize,
|
|
180
|
-
};
|
|
181
|
-
if (descriptor.attribution)
|
|
182
|
-
out.attribution = descriptor.attribution;
|
|
183
|
-
return out;
|
|
154
|
+
const spec = buildMapWmsRasterSourceSpec(descriptor, options);
|
|
155
|
+
return { ...spec, tiles: [...spec.tiles] };
|
|
184
156
|
}
|
|
185
157
|
/**
|
|
186
158
|
* Build a MapLibre `raster` source spec for a WMTS descriptor using the
|
|
@@ -188,27 +160,8 @@ export function buildWmsRasterSourceSpec(descriptor, options = {}) {
|
|
|
188
160
|
* (MapLibre's standard tile placeholders).
|
|
189
161
|
*/
|
|
190
162
|
export function buildWmtsRasterSourceSpec(descriptor, options = {}) {
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
const format = options.format ?? "image/png";
|
|
194
|
-
const ext = wmtsExtensionForFormat(format);
|
|
195
|
-
const layer = descriptor.locator.typeName ?? "";
|
|
196
|
-
const style = descriptor.locator.styleId ?? "default";
|
|
197
|
-
const tms = descriptor.locator.tileMatrixSetId ?? "WebMercatorQuad";
|
|
198
|
-
const tileTemplate = `${url}/${encodeURIComponent(layer)}/${encodeURIComponent(style)}/${encodeURIComponent(tms)}/{z}/{y}/{x}.${ext}`;
|
|
199
|
-
const out = {
|
|
200
|
-
type: "raster",
|
|
201
|
-
tiles: [tileTemplate],
|
|
202
|
-
tileSize,
|
|
203
|
-
scheme: "xyz",
|
|
204
|
-
};
|
|
205
|
-
if (options.minzoom !== undefined)
|
|
206
|
-
out.minzoom = options.minzoom;
|
|
207
|
-
if (options.maxzoom !== undefined)
|
|
208
|
-
out.maxzoom = options.maxzoom;
|
|
209
|
-
if (descriptor.attribution)
|
|
210
|
-
out.attribution = descriptor.attribution;
|
|
211
|
-
return out;
|
|
163
|
+
const spec = buildMapWmtsRasterSourceSpec(descriptor, options);
|
|
164
|
+
return { ...spec, tiles: [...spec.tiles] };
|
|
212
165
|
}
|
|
213
166
|
function toSdkProtocol(protocol) {
|
|
214
167
|
switch (protocol) {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
import type { FeatureId } from "../contract/types.js";
|
|
13
|
+
import { type HonuaErrorMetadata, HonuaSdkError } from "../core/error-envelope.js";
|
|
13
14
|
import type { SourceQualifiedFeatureSelectionTarget } from "../exploration/types.js";
|
|
14
15
|
import type { HonuaLayerSpecification, HonuaSourceSpecification, HonuaStyleSpecification } from "../style/specification.js";
|
|
15
16
|
import type { HonuaMapPackage } from "./map-package.js";
|
|
@@ -26,10 +27,10 @@ export interface HonuaRuntimeDiagnostic {
|
|
|
26
27
|
readonly capability?: string;
|
|
27
28
|
readonly context?: Readonly<Record<string, unknown>>;
|
|
28
29
|
}
|
|
29
|
-
export declare class HonuaRuntimeDiagnosticError extends
|
|
30
|
+
export declare class HonuaRuntimeDiagnosticError extends HonuaSdkError {
|
|
30
31
|
readonly diagnostics: readonly HonuaRuntimeDiagnostic[];
|
|
31
32
|
readonly cause: unknown;
|
|
32
|
-
constructor(message: string, diagnostics: readonly HonuaRuntimeDiagnostic[], cause?: unknown);
|
|
33
|
+
constructor(message: string, diagnostics: readonly HonuaRuntimeDiagnostic[], cause?: unknown, metadata?: HonuaErrorMetadata);
|
|
33
34
|
}
|
|
34
35
|
export interface NativeMapLibreSourceSpecification {
|
|
35
36
|
readonly type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-interactions.d.ts","sourceRoot":"","sources":["../../../src/runtime/style-interactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"style-interactions.d.ts","s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CACnC,KAAK,EAAE,uBAAuB,EAC9B,UAAU,EAAE,eAAe,GAAG,SAAS,EACvC,OAAO,EAAE,MAAM,GACd;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,CAQjG;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,SAAS,GACZ,yBAAyB,GAAG,SAAS,CAQvC;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,SAAS,GACZ,qCAAqC,GAAG,SAAS,CAInD;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qCAAqC,GAC5C,yBAAyB,CAM3B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,yBAAyB,GAAG,MAAM,CAE/E;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,uBAAuB,EAC9B,UAAU,EAAE,eAAe,GAAG,SAAS,EACvC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAMpB;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,8BAAmC,GAC3C,SAAS,GAAG,SAAS,CAevB"}
|
|
@@ -9,15 +9,23 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
|
+
import { HonuaSdkError, mergeHonuaErrorContext } from "../core/error-envelope.js";
|
|
12
13
|
import { sourceFeatureSelectionTarget } from "../exploration/selection.js";
|
|
13
14
|
import { Expr } from "../expr/index.js";
|
|
14
15
|
import { isHonuaSource } from "../style/specification.js";
|
|
15
16
|
import { validateRuntimeFilterStyleSpecSync, validateRuntimeLayerStyleSpecSync, validateRuntimeSourceStyleSpecSync, validateRuntimeStyleExpressionStyleSpecSync, } from "./style-spec-validation.js";
|
|
16
|
-
export class HonuaRuntimeDiagnosticError extends
|
|
17
|
+
export class HonuaRuntimeDiagnosticError extends HonuaSdkError {
|
|
17
18
|
diagnostics;
|
|
18
19
|
cause;
|
|
19
|
-
constructor(message, diagnostics, cause) {
|
|
20
|
-
super(message
|
|
20
|
+
constructor(message, diagnostics, cause, metadata = {}) {
|
|
21
|
+
super("runtime.diagnostic", message, {
|
|
22
|
+
...metadata,
|
|
23
|
+
cause,
|
|
24
|
+
context: mergeHonuaErrorContext(metadata.context, {
|
|
25
|
+
diagnosticCount: diagnostics.length,
|
|
26
|
+
diagnosticCodes: diagnostics.map(({ code }) => code),
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
21
29
|
this.name = "HonuaRuntimeDiagnosticError";
|
|
22
30
|
this.diagnostics = diagnostics;
|
|
23
31
|
this.cause = cause;
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* terra-draw binding for edit-sketch workflows.
|
|
3
|
+
*
|
|
4
|
+
* Adapts [terra-draw](https://terradraw.io) draw modes (point, linestring,
|
|
5
|
+
* polygon, rectangle, circle, freehand, select) to the renderer-neutral
|
|
6
|
+
* {@link EditSketchWorkflowModel}, so completed and edited geometries flow
|
|
7
|
+
* through the contract edit-session path — undo/redo, validation, and
|
|
8
|
+
* `applyEdits` submission all apply unchanged.
|
|
9
|
+
*
|
|
10
|
+
* terra-draw is an OPTIONAL peer dependency. This module never imports it at
|
|
11
|
+
* module scope: {@link bindTerraDrawSketch} accepts a duck-typed instance the
|
|
12
|
+
* app constructed itself, and {@link createTerraDrawSketch} pulls in
|
|
13
|
+
* `terra-draw` + `terra-draw-maplibre-gl-adapter` lazily via dynamic
|
|
14
|
+
* `import()` the first time it is called. Importing the SDK without terra-draw
|
|
15
|
+
* installed stays side-effect free.
|
|
16
|
+
*
|
|
17
|
+
* Snapping bridges through terra-draw's own pointer pipeline:
|
|
18
|
+
* {@link createTerraDrawSnapping} produces a function with terra-draw's
|
|
19
|
+
* `Snapping.toCustom` shape backed by the SDK {@link SnapIndex}, so the
|
|
20
|
+
* linestring / polygon / polyline modes snap against SDK-indexed features.
|
|
21
|
+
* Modes without a `snapping` option (point, rectangle, circle, freehand) keep
|
|
22
|
+
* terra-draw's native behavior; that seam is documented rather than papered
|
|
23
|
+
* over.
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
import type { EditSketchTool, EditSketchToolCapability, EditSketchToolCapabilityInput, EditSketchWorkflowModel } from "../contract/edit-sketch.js";
|
|
28
|
+
import { type SnapIndex, type SnapResolution, type SnappingConfig } from "../contract/edit-snapping.js";
|
|
29
|
+
/** terra-draw feature ids are strings (uuid4 by default) or numbers. @experimental */
|
|
30
|
+
export type TerraDrawSketchFeatureId = string | number;
|
|
31
|
+
/** GeoJSON-shaped feature as stored by terra-draw. @experimental */
|
|
32
|
+
export interface TerraDrawSketchFeature {
|
|
33
|
+
id?: TerraDrawSketchFeatureId;
|
|
34
|
+
type?: string;
|
|
35
|
+
geometry: Record<string, unknown>;
|
|
36
|
+
properties?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/** Context passed to terra-draw `finish` listeners. @experimental */
|
|
39
|
+
export interface TerraDrawSketchFinishContext {
|
|
40
|
+
/** The terra-draw mode that finished (e.g. `"polygon"`). */
|
|
41
|
+
mode: string;
|
|
42
|
+
/** The finishing action (`"draw"`, `"dragCoordinate"`, `"dragFeature"`, ...). */
|
|
43
|
+
action: string;
|
|
44
|
+
}
|
|
45
|
+
type TerraDrawFinishListener = (id: TerraDrawSketchFeatureId, context: TerraDrawSketchFinishContext) => void;
|
|
46
|
+
type TerraDrawChangeListener = (ids: TerraDrawSketchFeatureId[], type: string, context?: unknown) => void;
|
|
47
|
+
type TerraDrawSelectionListener = (id: TerraDrawSketchFeatureId) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Minimal duck-typed subset of a terra-draw `TerraDraw` instance used by the
|
|
50
|
+
* binding, so the SDK carries no compile- or run-time dependency on the
|
|
51
|
+
* optional `terra-draw` peer (same pattern as `SnappingMap`).
|
|
52
|
+
*
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
export interface TerraDrawSketchInstance {
|
|
56
|
+
on(event: "finish", listener: TerraDrawFinishListener): void;
|
|
57
|
+
on(event: "change", listener: TerraDrawChangeListener): void;
|
|
58
|
+
on(event: "select", listener: TerraDrawSelectionListener): void;
|
|
59
|
+
on(event: "deselect", listener: TerraDrawSelectionListener): void;
|
|
60
|
+
off(event: "finish", listener: TerraDrawFinishListener): void;
|
|
61
|
+
off(event: "change", listener: TerraDrawChangeListener): void;
|
|
62
|
+
off(event: "select", listener: TerraDrawSelectionListener): void;
|
|
63
|
+
off(event: "deselect", listener: TerraDrawSelectionListener): void;
|
|
64
|
+
setMode(mode: string): void;
|
|
65
|
+
getSnapshot(): TerraDrawSketchFeature[];
|
|
66
|
+
getSnapshotFeature?(id: TerraDrawSketchFeatureId): TerraDrawSketchFeature | undefined;
|
|
67
|
+
addFeatures?(features: TerraDrawSketchFeature[]): unknown;
|
|
68
|
+
removeFeatures?(ids: TerraDrawSketchFeatureId[]): void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Canonical terra-draw mode for each {@link EditSketchTool}. `buffer` has no
|
|
72
|
+
* terra-draw equivalent (it needs geometry-service support) and maps to
|
|
73
|
+
* `undefined`.
|
|
74
|
+
*
|
|
75
|
+
* @experimental
|
|
76
|
+
*/
|
|
77
|
+
export declare const TERRA_DRAW_SKETCH_TOOL_MODES: Readonly<Record<EditSketchTool, string | undefined>>;
|
|
78
|
+
/**
|
|
79
|
+
* Map a terra-draw mode name to the {@link EditSketchTool} it produces.
|
|
80
|
+
* Freehand and sector/sensor modes draw polygons; marker draws points.
|
|
81
|
+
* Returns `undefined` for modes with no sketch-tool equivalent (`select`,
|
|
82
|
+
* `render`, `static`, custom modes).
|
|
83
|
+
*
|
|
84
|
+
* @experimental
|
|
85
|
+
*/
|
|
86
|
+
export declare function editSketchToolForTerraDrawMode(mode: string): EditSketchTool | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Sketch-tool capability overrides for a workflow driven by terra-draw.
|
|
89
|
+
*
|
|
90
|
+
* The contract defaults mark `rectangle` and `circle` as unsupported because
|
|
91
|
+
* they need renderer support; terra-draw provides it. Pass the registered
|
|
92
|
+
* terra-draw mode names (defaults to every canonical drawing mode) and feed
|
|
93
|
+
* the result to `createEditSketchWorkflow({ sketchTools })`.
|
|
94
|
+
*
|
|
95
|
+
* @experimental
|
|
96
|
+
*/
|
|
97
|
+
export declare function terraDrawSketchToolCapabilities(modes?: readonly string[]): Partial<Record<EditSketchTool, EditSketchToolCapabilityInput>>;
|
|
98
|
+
/** A finished terra-draw sketch as applied (or not) to the workflow model. @experimental */
|
|
99
|
+
export interface TerraDrawSketchFinishEvent {
|
|
100
|
+
featureId: TerraDrawSketchFeatureId;
|
|
101
|
+
/** The sketch tool the finished mode mapped to, when one exists. */
|
|
102
|
+
tool?: EditSketchTool;
|
|
103
|
+
/** The terra-draw mode that produced the feature. */
|
|
104
|
+
mode: string;
|
|
105
|
+
/** The terra-draw finishing action (`"draw"`, `"dragFeature"`, ...). */
|
|
106
|
+
action: string;
|
|
107
|
+
/** Geometry handed to the model (after `transformGeometry`). */
|
|
108
|
+
geometry: Record<string, unknown> | null;
|
|
109
|
+
/** Whether the model accepted the geometry (mapped + supported tool). */
|
|
110
|
+
applied: boolean;
|
|
111
|
+
}
|
|
112
|
+
/** @experimental */
|
|
113
|
+
export interface BindTerraDrawSketchOptions<T = Record<string, unknown>> {
|
|
114
|
+
/** Sketch workflow that receives finished geometries. */
|
|
115
|
+
model: EditSketchWorkflowModel<T>;
|
|
116
|
+
/**
|
|
117
|
+
* Transform a completed terra-draw geometry (always EPSG:4326 GeoJSON)
|
|
118
|
+
* before it reaches the model — e.g. `(g) => toWebMercator(g, 4326)` from
|
|
119
|
+
* `@honua/sdk-js/geometry` when the edit source stores Web Mercator.
|
|
120
|
+
*/
|
|
121
|
+
transformGeometry?(geometry: Record<string, unknown>): Record<string, unknown>;
|
|
122
|
+
/**
|
|
123
|
+
* Inverse of {@link BindTerraDrawSketchOptions.transformGeometry}, used when
|
|
124
|
+
* pushing model geometry back into terra-draw after undo/redo.
|
|
125
|
+
*/
|
|
126
|
+
restoreGeometry?(geometry: Record<string, unknown>): Record<string, unknown>;
|
|
127
|
+
/**
|
|
128
|
+
* Scope which terra-draw features drive the model. Features rejected by the
|
|
129
|
+
* filter still surface through {@link BindTerraDrawSketchOptions.onFinish}
|
|
130
|
+
* with `applied: false`.
|
|
131
|
+
*/
|
|
132
|
+
featureFilter?(id: TerraDrawSketchFeatureId, feature: TerraDrawSketchFeature): boolean;
|
|
133
|
+
/** Override the terra-draw mode → sketch tool mapping. */
|
|
134
|
+
toolForMode?(mode: string): EditSketchTool | undefined;
|
|
135
|
+
/** Fired after every terra-draw `finish` event, applied or not. */
|
|
136
|
+
onFinish?(event: TerraDrawSketchFinishEvent): void;
|
|
137
|
+
/** Fired when the tracked sketch feature is deleted in terra-draw. */
|
|
138
|
+
onDelete?(featureId: TerraDrawSketchFeatureId): void;
|
|
139
|
+
onSelect?(featureId: TerraDrawSketchFeatureId): void;
|
|
140
|
+
onDeselect?(featureId: TerraDrawSketchFeatureId): void;
|
|
141
|
+
}
|
|
142
|
+
/** @experimental */
|
|
143
|
+
export interface TerraDrawSketchHandle {
|
|
144
|
+
/** The terra-draw feature currently backing the model geometry. */
|
|
145
|
+
readonly activeFeatureId: TerraDrawSketchFeatureId | undefined;
|
|
146
|
+
/** The feature currently selected in terra-draw select mode, if any. */
|
|
147
|
+
readonly selectedFeatureId: TerraDrawSketchFeatureId | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Activate the terra-draw mode for `tool` and arm the model
|
|
150
|
+
* (`model.startSketch`). Returns the tool capability; unsupported tools do
|
|
151
|
+
* not change the terra-draw mode.
|
|
152
|
+
*/
|
|
153
|
+
setTool(tool: EditSketchTool): EditSketchToolCapability;
|
|
154
|
+
/** Switch terra-draw to select mode for update/reshape editing. */
|
|
155
|
+
select(): void;
|
|
156
|
+
/** Leave any drawing/select mode (terra-draw `"static"`). */
|
|
157
|
+
cancel(): void;
|
|
158
|
+
/** Undo via the workflow model, then sync terra-draw to the model. */
|
|
159
|
+
undo(): boolean;
|
|
160
|
+
/** Redo via the workflow model, then sync terra-draw to the model. */
|
|
161
|
+
redo(): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Replace the tracked terra-draw feature with the model's current geometry
|
|
164
|
+
* (applying `restoreGeometry` first). Returns `false` when the instance
|
|
165
|
+
* cannot mutate features (`addFeatures`/`removeFeatures` missing).
|
|
166
|
+
*/
|
|
167
|
+
syncFromModel(): boolean;
|
|
168
|
+
/** Detach every terra-draw listener. */
|
|
169
|
+
remove(): void;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Bind a terra-draw instance to an {@link EditSketchWorkflowModel} (REQ-001).
|
|
173
|
+
*
|
|
174
|
+
* Every terra-draw `finish` event (freshly drawn features and select-mode
|
|
175
|
+
* edits: dragged features, dragged/inserted/deleted coordinates) maps the
|
|
176
|
+
* finishing mode to an {@link EditSketchTool} and applies the feature geometry
|
|
177
|
+
* through `model.setSketchGeometry`, so workflow undo/redo and validation
|
|
178
|
+
* cover terra-draw edits. Deleting the tracked feature stages a `null`
|
|
179
|
+
* geometry through the same undoable path.
|
|
180
|
+
*
|
|
181
|
+
* The caller owns the terra-draw instance lifecycle (`start`/`stop`); the
|
|
182
|
+
* binding only attaches listeners and detaches them in `remove()`.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* const workflow = createEditSketchWorkflow({ source, sketchTools: terraDrawSketchToolCapabilities() });
|
|
187
|
+
* const handle = bindTerraDrawSketch(draw, { model: workflow });
|
|
188
|
+
* handle.setTool("polygon"); // draw.setMode("polygon") + workflow arming
|
|
189
|
+
* // ... user draws; workflow.snapshot().sketch.geometry now tracks terra-draw
|
|
190
|
+
* handle.undo(); // workflow history, mirrored back into terra-draw
|
|
191
|
+
* await workflow.submit(); // edit-session applyEdits path, unchanged
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* @experimental
|
|
195
|
+
*/
|
|
196
|
+
export declare function bindTerraDrawSketch<T = Record<string, unknown>>(draw: TerraDrawSketchInstance, options: BindTerraDrawSketchOptions<T>): TerraDrawSketchHandle;
|
|
197
|
+
/** Pointer event shape terra-draw hands to `Snapping.toCustom`. @experimental */
|
|
198
|
+
export interface TerraDrawSnapEvent {
|
|
199
|
+
lng: number;
|
|
200
|
+
lat: number;
|
|
201
|
+
containerX: number;
|
|
202
|
+
containerY: number;
|
|
203
|
+
}
|
|
204
|
+
/** Context shape terra-draw hands to `Snapping.toCustom`. @experimental */
|
|
205
|
+
export interface TerraDrawSnapContext {
|
|
206
|
+
project(lng: number, lat: number): {
|
|
207
|
+
x: number;
|
|
208
|
+
y: number;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/** @experimental */
|
|
212
|
+
export interface CreateTerraDrawSnappingOptions<T = Record<string, unknown>> {
|
|
213
|
+
/** Snap index over the loaded snap-source features. */
|
|
214
|
+
index: SnapIndex;
|
|
215
|
+
/** Workflow whose live snapping config gates resolution. */
|
|
216
|
+
model?: EditSketchWorkflowModel<T>;
|
|
217
|
+
/** Snapping configuration when no model is bound (or one-off overrides). */
|
|
218
|
+
config?: Partial<SnappingConfig>;
|
|
219
|
+
/** Fired on every resolved pointer position (snapped or not). */
|
|
220
|
+
onResolve?(resolution: SnapResolution): void;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Build a snapping function with terra-draw's `Snapping.toCustom` shape backed
|
|
224
|
+
* by the SDK snapping engine (REQ-004).
|
|
225
|
+
*
|
|
226
|
+
* terra-draw exposes per-mode snapping on its linestring, polygon, and
|
|
227
|
+
* polyline modes; pass the result as `snapping.toCustom` when constructing
|
|
228
|
+
* those modes and every drawn vertex snaps against the {@link SnapIndex}
|
|
229
|
+
* with the SDK's deterministic candidate ordering. Point, rectangle, circle,
|
|
230
|
+
* and freehand modes do not accept a `snapping` option in terra-draw — for
|
|
231
|
+
* those, terra-draw's pointer pipeline has no custom-snapping seam, so only
|
|
232
|
+
* terra-draw-native behavior applies.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```ts
|
|
236
|
+
* const snap = createTerraDrawSnapping({ index, model: workflow });
|
|
237
|
+
* new TerraDrawPolygonMode({ snapping: { toCustom: snap } });
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* @experimental
|
|
241
|
+
*/
|
|
242
|
+
export declare function createTerraDrawSnapping<T = Record<string, unknown>>(options: CreateTerraDrawSnappingOptions<T>): (event: TerraDrawSnapEvent, context: TerraDrawSnapContext) => [number, number] | undefined;
|
|
243
|
+
/** @experimental */
|
|
244
|
+
export interface CreateTerraDrawSketchOptions<T = Record<string, unknown>> extends Omit<BindTerraDrawSketchOptions<T>, never> {
|
|
245
|
+
/** Wire SDK snapping into the linestring/polygon modes' `toCustom` hook. */
|
|
246
|
+
snapping?: CreateTerraDrawSnappingOptions<T>;
|
|
247
|
+
}
|
|
248
|
+
/** @experimental */
|
|
249
|
+
export interface TerraDrawSketchController<T = Record<string, unknown>> extends TerraDrawSketchHandle {
|
|
250
|
+
/** The constructed terra-draw instance (duck-typed). */
|
|
251
|
+
readonly draw: TerraDrawSketchInstance;
|
|
252
|
+
/** The bound workflow model. */
|
|
253
|
+
readonly model: EditSketchWorkflowModel<T>;
|
|
254
|
+
/** Stop terra-draw and detach the binding. */
|
|
255
|
+
stop(): void;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* One-call terra-draw sketch setup for a MapLibre map.
|
|
259
|
+
*
|
|
260
|
+
* Dynamically imports the optional `terra-draw` and
|
|
261
|
+
* `terra-draw-maplibre-gl-adapter` peers (throwing a descriptive error when
|
|
262
|
+
* either is missing), registers the canonical drawing modes (point,
|
|
263
|
+
* linestring, polygon, rectangle, circle, freehand, select), wires SDK
|
|
264
|
+
* snapping into the modes that accept a custom snapping hook, starts the
|
|
265
|
+
* instance, and returns it bound to the workflow model via
|
|
266
|
+
* {@link bindTerraDrawSketch}.
|
|
267
|
+
*
|
|
268
|
+
* Apps that need custom mode options should construct terra-draw themselves
|
|
269
|
+
* and call {@link bindTerraDrawSketch} directly.
|
|
270
|
+
*
|
|
271
|
+
* @experimental
|
|
272
|
+
*/
|
|
273
|
+
export declare function createTerraDrawSketch<T = Record<string, unknown>>(map: unknown, options: CreateTerraDrawSketchOptions<T>): Promise<TerraDrawSketchController<T>>;
|
|
274
|
+
export {};
|
|
275
|
+
//# sourceMappingURL=terra-draw-sketch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terra-draw-sketch.d.ts","sourceRoot":"","sources":["../../../src/runtime/terra-draw-sketch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,6BAA6B,EAC7B,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EAGpB,MAAM,8BAA8B,CAAC;AAItC,sFAAsF;AACtF,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD,oEAAoE;AACpE,MAAM,WAAW,sBAAsB;IACrC,EAAE,CAAC,EAAE,wBAAwB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,qEAAqE;AACrE,MAAM,WAAW,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