@itwin/map-layers-formats 4.6.0-dev.18 → 4.6.0-dev.19

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.
Files changed (141) hide show
  1. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +15 -6
  2. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
  3. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +61 -51
  4. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  5. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +7 -11
  6. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
  7. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +3 -19
  8. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
  9. package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +3 -3
  10. package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -1
  11. package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js +3 -4
  12. package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
  13. package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.d.ts +3 -3
  14. package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -1
  15. package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js +2 -3
  16. package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
  17. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +35 -15
  18. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
  19. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +53 -47
  20. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  21. package/lib/cjs/ArcGisFeature/EsriSymbology.d.ts +2 -1
  22. package/lib/cjs/ArcGisFeature/EsriSymbology.d.ts.map +1 -1
  23. package/lib/cjs/ArcGisFeature/EsriSymbology.js +2 -1
  24. package/lib/cjs/ArcGisFeature/EsriSymbology.js.map +1 -1
  25. package/lib/cjs/Feature/DefaultMarkerIcon.d.ts +10 -0
  26. package/lib/cjs/Feature/DefaultMarkerIcon.d.ts.map +1 -0
  27. package/lib/cjs/Feature/DefaultMarkerIcon.js +31 -0
  28. package/lib/cjs/Feature/DefaultMarkerIcon.js.map +1 -0
  29. package/lib/cjs/Feature/FeatureCanvasRenderer.d.ts +20 -0
  30. package/lib/cjs/Feature/FeatureCanvasRenderer.d.ts.map +1 -0
  31. package/lib/cjs/{ArcGisFeature/ArcGisCanvasRenderer.js → Feature/FeatureCanvasRenderer.js} +7 -6
  32. package/lib/cjs/Feature/FeatureCanvasRenderer.js.map +1 -0
  33. package/lib/cjs/Feature/FeatureInfoReader.d.ts +11 -0
  34. package/lib/cjs/Feature/FeatureInfoReader.d.ts.map +1 -0
  35. package/lib/cjs/Feature/FeatureInfoReader.js +34 -0
  36. package/lib/cjs/Feature/FeatureInfoReader.js.map +1 -0
  37. package/lib/cjs/Feature/FeatureSymbology.d.ts +8 -0
  38. package/lib/cjs/Feature/FeatureSymbology.d.ts.map +1 -0
  39. package/lib/cjs/Feature/FeatureSymbology.js +12 -0
  40. package/lib/cjs/Feature/FeatureSymbology.js.map +1 -0
  41. package/lib/cjs/Feature/RandomMapColor.d.ts +8 -0
  42. package/lib/cjs/Feature/RandomMapColor.d.ts.map +1 -0
  43. package/lib/cjs/Feature/RandomMapColor.js +29 -0
  44. package/lib/cjs/Feature/RandomMapColor.js.map +1 -0
  45. package/lib/cjs/GeoJSON/GeoJSONGeometry.d.ts +18 -0
  46. package/lib/cjs/GeoJSON/GeoJSONGeometry.d.ts.map +1 -0
  47. package/lib/cjs/GeoJSON/GeoJSONGeometry.js +11 -0
  48. package/lib/cjs/GeoJSON/GeoJSONGeometry.js.map +1 -0
  49. package/lib/cjs/GeoJSON/GeoJSONGeometryReader.d.ts +11 -0
  50. package/lib/cjs/GeoJSON/GeoJSONGeometryReader.d.ts.map +1 -0
  51. package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js +83 -0
  52. package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js.map +1 -0
  53. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.d.ts +9 -0
  54. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.d.ts.map +1 -0
  55. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js +94 -0
  56. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -0
  57. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.d.ts +54 -0
  58. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.d.ts.map +1 -0
  59. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js +477 -0
  60. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -0
  61. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.d.ts +23 -0
  62. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.d.ts.map +1 -0
  63. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js +139 -0
  64. package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -0
  65. package/lib/cjs/mapLayersFormats.d.ts.map +1 -1
  66. package/lib/cjs/mapLayersFormats.js +4 -1
  67. package/lib/cjs/mapLayersFormats.js.map +1 -1
  68. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +15 -6
  69. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
  70. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +61 -51
  71. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  72. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +7 -11
  73. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
  74. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +3 -19
  75. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
  76. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +3 -3
  77. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -1
  78. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js +3 -4
  79. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
  80. package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.d.ts +3 -3
  81. package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -1
  82. package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js +2 -3
  83. package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
  84. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +35 -15
  85. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
  86. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +51 -45
  87. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  88. package/lib/esm/ArcGisFeature/EsriSymbology.d.ts +2 -1
  89. package/lib/esm/ArcGisFeature/EsriSymbology.d.ts.map +1 -1
  90. package/lib/esm/ArcGisFeature/EsriSymbology.js +2 -1
  91. package/lib/esm/ArcGisFeature/EsriSymbology.js.map +1 -1
  92. package/lib/esm/Feature/DefaultMarkerIcon.d.ts +10 -0
  93. package/lib/esm/Feature/DefaultMarkerIcon.d.ts.map +1 -0
  94. package/lib/esm/Feature/DefaultMarkerIcon.js +27 -0
  95. package/lib/esm/Feature/DefaultMarkerIcon.js.map +1 -0
  96. package/lib/esm/Feature/FeatureCanvasRenderer.d.ts +20 -0
  97. package/lib/esm/Feature/FeatureCanvasRenderer.d.ts.map +1 -0
  98. package/lib/esm/{ArcGisFeature/ArcGisCanvasRenderer.js → Feature/FeatureCanvasRenderer.js} +6 -5
  99. package/lib/esm/Feature/FeatureCanvasRenderer.js.map +1 -0
  100. package/lib/esm/Feature/FeatureInfoReader.d.ts +11 -0
  101. package/lib/esm/Feature/FeatureInfoReader.d.ts.map +1 -0
  102. package/lib/esm/Feature/FeatureInfoReader.js +30 -0
  103. package/lib/esm/Feature/FeatureInfoReader.js.map +1 -0
  104. package/lib/esm/Feature/FeatureSymbology.d.ts +8 -0
  105. package/lib/esm/Feature/FeatureSymbology.d.ts.map +1 -0
  106. package/lib/esm/Feature/FeatureSymbology.js +8 -0
  107. package/lib/esm/Feature/FeatureSymbology.js.map +1 -0
  108. package/lib/esm/Feature/RandomMapColor.d.ts +8 -0
  109. package/lib/esm/Feature/RandomMapColor.d.ts.map +1 -0
  110. package/lib/esm/Feature/RandomMapColor.js +26 -0
  111. package/lib/esm/Feature/RandomMapColor.js.map +1 -0
  112. package/lib/esm/GeoJSON/GeoJSONGeometry.d.ts +18 -0
  113. package/lib/esm/GeoJSON/GeoJSONGeometry.d.ts.map +1 -0
  114. package/lib/esm/GeoJSON/GeoJSONGeometry.js +7 -0
  115. package/lib/esm/GeoJSON/GeoJSONGeometry.js.map +1 -0
  116. package/lib/esm/GeoJSON/GeoJSONGeometryReader.d.ts +11 -0
  117. package/lib/esm/GeoJSON/GeoJSONGeometryReader.d.ts.map +1 -0
  118. package/lib/esm/GeoJSON/GeoJSONGeometryReader.js +79 -0
  119. package/lib/esm/GeoJSON/GeoJSONGeometryReader.js.map +1 -0
  120. package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.d.ts +9 -0
  121. package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.d.ts.map +1 -0
  122. package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js +91 -0
  123. package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -0
  124. package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.d.ts +54 -0
  125. package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.d.ts.map +1 -0
  126. package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js +473 -0
  127. package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -0
  128. package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.d.ts +23 -0
  129. package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.d.ts.map +1 -0
  130. package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js +135 -0
  131. package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -0
  132. package/lib/esm/mapLayersFormats.d.ts.map +1 -1
  133. package/lib/esm/mapLayersFormats.js +4 -1
  134. package/lib/esm/mapLayersFormats.js.map +1 -1
  135. package/package.json +15 -13
  136. package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.d.ts +0 -19
  137. package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.d.ts.map +0 -1
  138. package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.js.map +0 -1
  139. package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.d.ts +0 -19
  140. package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.d.ts.map +0 -1
  141. package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.js.map +0 -1
@@ -0,0 +1,18 @@
1
+ import * as GeoJson from "geojson";
2
+ /** @internal */
3
+ export type Coord = number[];
4
+ /** @internal */ export type RingCoords = Coord[];
5
+ /** @internal */
6
+ export type MultiRingCoords = RingCoords[];
7
+ /** @internal */
8
+ export interface MultiPath {
9
+ lengths: number[];
10
+ coords: number[];
11
+ }
12
+ /** @internal */
13
+ export declare class GeoJSONGeometryUtils {
14
+ static isRingOrPath(geom: GeoJson.Geometry): boolean;
15
+ static isFilled(geom: GeoJson.Geometry): boolean;
16
+ static isPoint(geom: GeoJson.Geometry): boolean;
17
+ }
18
+ //# sourceMappingURL=GeoJSONGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoJSONGeometry.d.ts","sourceRoot":"","sources":["../../../src/GeoJSON/GeoJSONGeometry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,gBAAgB;AAChB,MAAM,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC;AAE7B,gBAAgB,CAChB,MAAM,MAAM,UAAU,GAAG,KAAK,EAAE,CAAC;AAEjC,gBAAgB;AAChB,MAAM,MAAM,eAAe,GAAG,UAAU,EAAE,CAAC;AAE3C,gBAAgB;AAChB,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,gBAAgB;AAChB,qBAAa,oBAAoB;WACjB,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ;WACnC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ;WAC/B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ;CAC7C"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeoJSONGeometryUtils = void 0;
4
+ /** @internal */
5
+ class GeoJSONGeometryUtils {
6
+ static isRingOrPath(geom) { return geom.type === "LineString" || geom.type === "MultiLineString" || geom.type === "Polygon" || geom.type === "MultiPolygon"; }
7
+ static isFilled(geom) { return geom.type === "Polygon" || geom.type === "MultiPolygon"; }
8
+ static isPoint(geom) { return geom.type === "Point" || geom.type === "MultiPoint"; }
9
+ }
10
+ exports.GeoJSONGeometryUtils = GeoJSONGeometryUtils;
11
+ //# sourceMappingURL=GeoJSONGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoJSONGeometry.js","sourceRoot":"","sources":["../../../src/GeoJSON/GeoJSONGeometry.ts"],"names":[],"mappings":";;;AAqBA,gBAAgB;AAChB,MAAa,oBAAoB;IACxB,MAAM,CAAC,YAAY,CAAC,IAAsB,IAAG,OAAO,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,CAAA,CAAC;IAC9K,MAAM,CAAC,QAAQ,CAAC,IAAsB,IAAG,OAAQ,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,CAAA,CAAC;IAC1G,MAAM,CAAC,OAAO,CAAC,IAAsB,IAAG,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,CAAA,CAAC;CAC5G;AAJD,oDAIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as GeoJson from \"geojson\";\r\n\r\n/** @internal */\r\nexport type Coord = number[];\r\n\r\n/** @internal */ // Array of 2 or 3 numbers\r\nexport type RingCoords = Coord[];\r\n\r\n/** @internal */\r\nexport type MultiRingCoords = RingCoords[];\r\n\r\n/** @internal */\r\nexport interface MultiPath {\r\n lengths: number[];\r\n coords: number[];\r\n}\r\n\r\n/** @internal */\r\nexport class GeoJSONGeometryUtils {\r\n public static isRingOrPath(geom: GeoJson.Geometry) {return geom.type === \"LineString\" || geom.type === \"MultiLineString\" || geom.type === \"Polygon\" || geom.type === \"MultiPolygon\";}\r\n public static isFilled(geom: GeoJson.Geometry) {return geom.type === \"Polygon\" || geom.type === \"MultiPolygon\";}\r\n public static isPoint(geom: GeoJson.Geometry) {return geom.type === \"Point\" || geom.type === \"MultiPoint\";}\r\n}\r\n"]}
@@ -0,0 +1,11 @@
1
+ import { FeatureGeometryRenderer } from "@itwin/core-frontend";
2
+ import * as GeoJson from "geojson";
3
+ /** @internal */
4
+ export declare class GeoJSONGeometryReader {
5
+ private _renderer;
6
+ constructor(renderer: FeatureGeometryRenderer);
7
+ readGeometry(geometry: GeoJson.Geometry): Promise<void>;
8
+ private readRingsAndPaths;
9
+ private readPoints;
10
+ }
11
+ //# sourceMappingURL=GeoJSONGeometryReader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoJSONGeometryReader.d.ts","sourceRoot":"","sources":["../../../src/GeoJSON/GeoJSONGeometryReader.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,gBAAgB;AAChB,qBAAa,qBAAqB;IAChC,OAAO,CAAC,SAAS,CAA0B;gBAExB,QAAQ,EAAE,uBAAuB;IAIvC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAWtC,iBAAiB;YAwCjB,UAAU;CAkBzB"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.GeoJSONGeometryReader = void 0;
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const core_frontend_1 = require("@itwin/core-frontend");
10
+ const GeoJSONGeometry_1 = require("./GeoJSONGeometry");
11
+ const loggerCategory = "MapLayersFormats.GeoJSONGeometryReader";
12
+ /** @internal */
13
+ class GeoJSONGeometryReader {
14
+ constructor(renderer) {
15
+ this._renderer = renderer;
16
+ }
17
+ async readGeometry(geometry) {
18
+ if (GeoJSONGeometry_1.GeoJSONGeometryUtils.isRingOrPath(geometry)) {
19
+ await this.readRingsAndPaths(geometry, this._renderer, GeoJSONGeometry_1.GeoJSONGeometryUtils.isFilled(geometry), false /* relativeCoords*/);
20
+ }
21
+ else if (GeoJSONGeometry_1.GeoJSONGeometryUtils.isPoint(geometry)) {
22
+ await this.readPoints(geometry, this._renderer, false /* relativeCoords*/);
23
+ }
24
+ else {
25
+ core_bentley_1.Logger.logError(loggerCategory, `GeoJSONGeometryReader:readGeometry - Unknown geometry type '${geometry.type}'`);
26
+ }
27
+ }
28
+ async readRingsAndPaths(geometry, renderer, fill, relativeCoords) {
29
+ const multiPath = { coords: [], lengths: [] };
30
+ let polys;
31
+ const readPath = (ring, offset, result) => {
32
+ const newOffset = (0, core_frontend_1.deflateCoordinates)(ring, result.coords, 2, offset);
33
+ result.lengths.push(ring.length);
34
+ return newOffset;
35
+ };
36
+ const readMultiPath = (multiRings, result) => {
37
+ let offset = 0;
38
+ for (const ring of multiRings) {
39
+ offset = readPath(ring, offset, result);
40
+ }
41
+ };
42
+ if (geometry.type === "LineString") {
43
+ readPath(geometry.coordinates, 0, multiPath);
44
+ }
45
+ else if (geometry.type === "MultiLineString" || geometry.type === "Polygon") {
46
+ readMultiPath(geometry.coordinates, multiPath);
47
+ }
48
+ else if (geometry.type === "MultiPolygon") {
49
+ polys = [];
50
+ for (const poly of geometry.coordinates) {
51
+ const tmpMultiPath = { coords: [], lengths: [] };
52
+ readMultiPath(poly, tmpMultiPath);
53
+ polys.push(tmpMultiPath);
54
+ }
55
+ }
56
+ if (polys) {
57
+ for (const poly of polys) {
58
+ await renderer.renderPath(poly.lengths, poly.coords, fill, 2, relativeCoords);
59
+ }
60
+ }
61
+ else {
62
+ await renderer.renderPath(multiPath.lengths, multiPath.coords, fill, 2, relativeCoords);
63
+ }
64
+ }
65
+ async readPoints(geom, renderer, relativeCoords) {
66
+ const lengths = [];
67
+ const coords = [];
68
+ const readPoint = (coord) => {
69
+ lengths.push(1);
70
+ coords.push(coord[0]);
71
+ coords.push(coord[1]);
72
+ };
73
+ if (geom.type === "MultiPoint") {
74
+ geom.coordinates.forEach(readPoint);
75
+ }
76
+ else if (geom.type === "Point") {
77
+ readPoint(geom.coordinates);
78
+ }
79
+ await renderer.renderPoint(lengths, coords, 2, relativeCoords);
80
+ }
81
+ }
82
+ exports.GeoJSONGeometryReader = GeoJSONGeometryReader;
83
+ //# sourceMappingURL=GeoJSONGeometryReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoJSONGeometryReader.js","sourceRoot":"","sources":["../../../src/GeoJSON/GeoJSONGeometryReader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAA6C;AAC7C,wDAAmF;AACnF,uDAAwG;AAGxG,MAAM,cAAc,GAAG,wCAAwC,CAAC;AAEhE,gBAAgB;AAChB,MAAa,qBAAqB;IAGhC,YAAmB,QAAiC;QAClD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,QAA0B;QAElD,IAAI,sCAAoB,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;YAC/C,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,sCAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;SAC5H;aAAM,IAAI,sCAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACjD,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAA,mBAAmB,CAAC,CAAC;SAC3E;aAAM;YACL,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,+DAA+D,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;SAClH;IACH,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAC,QAA0B,EAAE,QAAiC,EAAE,IAAa,EAAE,cAAuB;QACnI,MAAM,SAAS,GAAc,EAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;QACvD,IAAI,KAA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E;gBACxB,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;aAC/E;SACF;aAAM;YACL,MAAM,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;SACzF;IAEH,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,IAAsB,EAAE,QAAiC,EAAE,cAAuB;QAEzG,MAAM,OAAO,GAAU,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAU,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,CAAC,KAAY,EAAE,EAAE;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE;YAC9B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACrC;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;YAChC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC7B;QAED,MAAM,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;IACjE,CAAC;CACF;AA5ED,sDA4EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { deflateCoordinates, FeatureGeometryRenderer } from \"@itwin/core-frontend\";\r\nimport { Coord, GeoJSONGeometryUtils, MultiPath, MultiRingCoords, RingCoords } from \"./GeoJSONGeometry\";\r\nimport * as GeoJson from \"geojson\";\r\n\r\nconst loggerCategory = \"MapLayersFormats.GeoJSONGeometryReader\";\r\n\r\n/** @internal */\r\nexport class GeoJSONGeometryReader {\r\n private _renderer: FeatureGeometryRenderer;\r\n\r\n public constructor(renderer: FeatureGeometryRenderer) {\r\n this._renderer = renderer;\r\n }\r\n\r\n public async readGeometry(geometry: GeoJson.Geometry) {\r\n\r\n if (GeoJSONGeometryUtils.isRingOrPath(geometry)) {\r\n await this.readRingsAndPaths(geometry, this._renderer, GeoJSONGeometryUtils.isFilled(geometry), false /* relativeCoords*/);\r\n } else if (GeoJSONGeometryUtils.isPoint(geometry)) {\r\n await this.readPoints(geometry, this._renderer, false/* relativeCoords*/);\r\n } else {\r\n Logger.logError(loggerCategory, `GeoJSONGeometryReader:readGeometry - Unknown geometry type '${geometry.type}'`);\r\n }\r\n }\r\n\r\n private async readRingsAndPaths(geometry: GeoJson.Geometry, renderer: FeatureGeometryRenderer, fill: boolean, relativeCoords: boolean) {\r\n const multiPath: MultiPath = {coords: [], lengths: []};\r\n let polys: MultiPath[] | undefined;\r\n\r\n const readPath = (ring: RingCoords, offset: number, result: MultiPath) => {\r\n const newOffset = deflateCoordinates(ring, result.coords, 2, offset);\r\n result.lengths.push(ring.length);\r\n return newOffset;\r\n };\r\n\r\n const readMultiPath = (multiRings: MultiRingCoords, result: MultiPath) => {\r\n let offset = 0;\r\n for (const ring of multiRings) {\r\n offset = readPath(ring, offset, result);\r\n }\r\n };\r\n\r\n if (geometry.type === \"LineString\") {\r\n readPath(geometry.coordinates, 0, multiPath);\r\n } else if (geometry.type === \"MultiLineString\" || geometry.type === \"Polygon\") {\r\n readMultiPath(geometry.coordinates, multiPath);\r\n } else if (geometry.type === \"MultiPolygon\") {\r\n polys = [];\r\n for (const poly of geometry.coordinates) {\r\n const tmpMultiPath: MultiPath = {coords: [], lengths: [] };\r\n readMultiPath(poly, tmpMultiPath);\r\n polys.push(tmpMultiPath);\r\n }\r\n }\r\n\r\n if (polys) {\r\n for (const poly of polys) {\r\n await renderer.renderPath(poly.lengths, poly.coords, fill, 2, relativeCoords);\r\n }\r\n } else {\r\n await renderer.renderPath(multiPath.lengths, multiPath.coords, fill, 2, relativeCoords);\r\n }\r\n\r\n }\r\n\r\n private async readPoints(geom: GeoJson.Geometry, renderer: FeatureGeometryRenderer, relativeCoords: boolean) {\r\n\r\n const lengths: Coord = [];\r\n const coords: Coord = [];\r\n const readPoint = (coord: Coord) => {\r\n lengths.push(1);\r\n coords.push(coord[0]);\r\n coords.push(coord[1]);\r\n };\r\n\r\n if (geom.type === \"MultiPoint\") {\r\n geom.coordinates.forEach(readPoint);\r\n } else if (geom.type === \"Point\") {\r\n readPoint(geom.coordinates);\r\n }\r\n\r\n await renderer.renderPoint(lengths, coords, 2, relativeCoords);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,9 @@
1
+ import { ImageMapLayerSettings } from "@itwin/core-common";
2
+ import { ImageryMapLayerFormat, MapLayerImageryProvider, MapLayerSourceValidation, ValidateSourceArgs } from "@itwin/core-frontend";
3
+ /** @internal */
4
+ export declare class OgcApiFeaturesMapLayerFormat extends ImageryMapLayerFormat {
5
+ static formatId: string;
6
+ static createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined;
7
+ static validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation>;
8
+ }
9
+ //# sourceMappingURL=OgcApiFeaturesFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OgcApiFeaturesFormat.d.ts","sourceRoot":"","sources":["../../../src/OgcApiFeatures/OgcApiFeaturesFormat.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAqB,qBAAqB,EAAE,uBAAuB,EAAwB,wBAAwB,EAAyB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGpM,gBAAgB;AAChB,qBAAa,4BAA6B,SAAQ,qBAAqB;IACrE,OAAuB,QAAQ,SAAoB;WAC5B,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,GAAG,SAAS;WAErF,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAuFnG"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OgcApiFeaturesMapLayerFormat = void 0;
4
+ const core_frontend_1 = require("@itwin/core-frontend");
5
+ const OgcApiFeaturesProvider_1 = require("./OgcApiFeaturesProvider");
6
+ /** @internal */
7
+ class OgcApiFeaturesMapLayerFormat extends core_frontend_1.ImageryMapLayerFormat {
8
+ static createImageryProvider(settings) { return new OgcApiFeaturesProvider_1.OgcApiFeaturesProvider(settings); }
9
+ static async validate(args) {
10
+ const { source } = args;
11
+ const { userName, password } = source;
12
+ let status = core_frontend_1.MapLayerSourceStatus.InvalidUrl;
13
+ try {
14
+ let headers;
15
+ if (userName && password) {
16
+ headers = new Headers();
17
+ (0, core_frontend_1.setBasicAuthorization)(headers, userName, password);
18
+ }
19
+ const opts = {
20
+ method: "GET",
21
+ headers,
22
+ };
23
+ let url = (0, core_frontend_1.appendQueryParams)(source.url, source.savedQueryParams);
24
+ url = (0, core_frontend_1.appendQueryParams)(url, source.unsavedQueryParams);
25
+ let response = await fetch(url, opts);
26
+ let json = await response.json();
27
+ if (!json) {
28
+ return { status };
29
+ }
30
+ const createCollectionsList = (data) => {
31
+ let array;
32
+ for (const collection of data.collections) {
33
+ if (collection.itemType === "feature") {
34
+ const subLayerProps = {
35
+ id: collection.id,
36
+ name: collection.id,
37
+ title: collection.title,
38
+ visible: true,
39
+ parent: undefined,
40
+ children: undefined,
41
+ };
42
+ if (array)
43
+ array.push(subLayerProps);
44
+ else
45
+ array = [subLayerProps];
46
+ }
47
+ }
48
+ return array;
49
+ };
50
+ let subLayers;
51
+ if (Array.isArray(json.collections)) {
52
+ subLayers = createCollectionsList(json);
53
+ status = core_frontend_1.MapLayerSourceStatus.Valid;
54
+ }
55
+ else if (json.itemType === "feature" || json.type === "FeatureCollection") {
56
+ // We expect one of the following URL:
57
+ // http://server/collections/<collectionName>
58
+ // http://server/collections/<collectionName>/items
59
+ subLayers = [{
60
+ id: json.id,
61
+ name: json.id,
62
+ title: json.title,
63
+ visible: true,
64
+ parent: undefined,
65
+ children: undefined,
66
+ }];
67
+ status = core_frontend_1.MapLayerSourceStatus.Valid;
68
+ }
69
+ else if (Array.isArray(json.links)) {
70
+ // This might be the main landing page
71
+ const collectionsLink = json.links.find((link) => link.rel.includes("data") && link.type === "application/json");
72
+ let collectionsUrl = (0, core_frontend_1.appendQueryParams)(collectionsLink.href, source.savedQueryParams);
73
+ collectionsUrl = (0, core_frontend_1.appendQueryParams)(collectionsUrl, source.unsavedQueryParams);
74
+ response = await fetch(collectionsUrl, opts);
75
+ json = await response.json();
76
+ if (Array.isArray(json.collections)) {
77
+ subLayers = createCollectionsList(json);
78
+ status = core_frontend_1.MapLayerSourceStatus.Valid;
79
+ }
80
+ }
81
+ return { status, subLayers };
82
+ }
83
+ catch (err) {
84
+ status = core_frontend_1.MapLayerSourceStatus.InvalidUrl;
85
+ if (err?.status === 401) {
86
+ status = ((userName && password) ? core_frontend_1.MapLayerSourceStatus.InvalidCredentials : core_frontend_1.MapLayerSourceStatus.RequireAuth);
87
+ }
88
+ return { status };
89
+ }
90
+ }
91
+ }
92
+ OgcApiFeaturesMapLayerFormat.formatId = "OgcApiFeatures";
93
+ exports.OgcApiFeaturesMapLayerFormat = OgcApiFeaturesMapLayerFormat;
94
+ //# sourceMappingURL=OgcApiFeaturesFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OgcApiFeaturesFormat.js","sourceRoot":"","sources":["../../../src/OgcApiFeatures/OgcApiFeaturesFormat.ts"],"names":[],"mappings":";;;AAKA,w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AAC,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,CAAC;gBACrH,IAAI,cAAc,GAAG,IAAA,iCAAiB,EAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACtF,cAAc,GAAG,IAAA,iCAAiB,EAAC,cAAc,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;gBAC9E,QAAQ,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;gBAC7C,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;oBACnC,SAAS,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;oBACxC,MAAM,GAAG,oCAAoB,CAAC,KAAK,CAAC;iBACrC;aAEF;YAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;SAE9B;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,GAAG,oCAAoB,CAAC,UAAU,CAAC;YACzC,IAAI,GAAG,EAAE,MAAM,KAAK,GAAG,EAAE;gBACvB,MAAM,GAAG,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,oCAAoB,CAAC,kBAAkB,CAAC,CAAC,CAAC,oCAAoB,CAAC,WAAW,CAAC,CAAC;aAChH;YACD,OAAO,EAAE,MAAM,EAAC,CAAC;SAClB;IACH,CAAC;;AAzFsB,qCAAQ,GAAG,gBAAgB,CAAC;AADxC,oEAA4B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { ImageMapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { appendQueryParams, ImageryMapLayerFormat, MapLayerImageryProvider, MapLayerSourceStatus, MapLayerSourceValidation, setBasicAuthorization, ValidateSourceArgs } from \"@itwin/core-frontend\";\r\nimport { OgcApiFeaturesProvider } from \"./OgcApiFeaturesProvider\";\r\n\r\n/** @internal */\r\nexport class OgcApiFeaturesMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"OgcApiFeatures\";\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined { return new OgcApiFeaturesProvider(settings); }\r\n\r\n public static override async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n\r\n const {source} = args;\r\n const { userName, password } = source;\r\n let status = MapLayerSourceStatus.InvalidUrl;\r\n try {\r\n\r\n let headers: Headers | undefined;\r\n if (userName && password) {\r\n headers = new Headers();\r\n setBasicAuthorization(headers, userName, password);\r\n }\r\n const opts: RequestInit = {\r\n method: \"GET\",\r\n headers,\r\n };\r\n\r\n let url = appendQueryParams(source.url, source.savedQueryParams);\r\n url = appendQueryParams(url, source.unsavedQueryParams);\r\n let response = await fetch(url, opts);\r\n let json = await response.json();\r\n if (!json) {\r\n return { status };\r\n }\r\n\r\n const createCollectionsList = (data: any) => {\r\n let array: MapSubLayerProps[] | undefined;\r\n for (const collection of data.collections) {\r\n if (collection.itemType === \"feature\") {\r\n const subLayerProps = {\r\n id: collection.id,\r\n name: collection.id,\r\n title: collection.title,\r\n visible: true,\r\n parent: undefined,\r\n children: undefined,\r\n };\r\n if (array)\r\n array.push(subLayerProps);\r\n else\r\n array = [subLayerProps];\r\n }\r\n }\r\n return array;\r\n };\r\n\r\n let subLayers: MapSubLayerProps[] | undefined;\r\n if (Array.isArray(json.collections)) {\r\n subLayers = createCollectionsList(json);\r\n status = MapLayerSourceStatus.Valid;\r\n } else if (json.itemType === \"feature\" || json.type === \"FeatureCollection\") {\r\n // We expect one of the following URL:\r\n // http://server/collections/<collectionName>\r\n // http://server/collections/<collectionName>/items\r\n subLayers = [{\r\n id: json.id,\r\n name: json.id,\r\n title: json.title,\r\n visible: true,\r\n parent: undefined,\r\n children: undefined,\r\n }];\r\n status = MapLayerSourceStatus.Valid;\r\n } else if (Array.isArray(json.links)) {\r\n // This might be the main landing page\r\n const collectionsLink = json.links.find((link: any)=> link.rel.includes(\"data\") && link.type === \"application/json\");\r\n let collectionsUrl = appendQueryParams(collectionsLink.href, source.savedQueryParams);\r\n collectionsUrl = appendQueryParams(collectionsUrl, source.unsavedQueryParams);\r\n response = await fetch(collectionsUrl, opts);\r\n json = await response.json();\r\n if (Array.isArray(json.collections)) {\r\n subLayers = createCollectionsList(json);\r\n status = MapLayerSourceStatus.Valid;\r\n }\r\n\r\n }\r\n\r\n return { status, subLayers };\r\n\r\n } catch (err: any) {\r\n status = MapLayerSourceStatus.InvalidUrl;\r\n if (err?.status === 401) {\r\n status = ((userName && password) ? MapLayerSourceStatus.InvalidCredentials : MapLayerSourceStatus.RequireAuth);\r\n }\r\n return { status};\r\n }\r\n }\r\n}\r\n"]}
@@ -0,0 +1,54 @@
1
+ import { HitDetail, ImageryMapTileTree, MapFeatureInfoOptions, MapLayerFeatureInfo, MapLayerImageryProvider, QuadId } from "@itwin/core-frontend";
2
+ import { EsriSymbol } from "../ArcGisFeature/EsriSymbology";
3
+ import { Cartographic, ImageMapLayerSettings, ImageSource } from "@itwin/core-common";
4
+ import { FeatureDefaultSymbology } from "../Feature/FeatureSymbology";
5
+ import { RandomMapColor } from "../Feature/RandomMapColor";
6
+ /** Provide tiles from a ESRI ArcGIS Feature service
7
+ * @internal
8
+ */
9
+ export declare class DefaultOgcSymbology implements FeatureDefaultSymbology {
10
+ private static readonly _defaultPMSProps;
11
+ private _defaultPMS;
12
+ private static readonly _defaultSLSProps;
13
+ private _defaultSLS;
14
+ private static readonly _defaultSFSProps;
15
+ private _defaultSFS;
16
+ constructor(randomColor?: RandomMapColor);
17
+ initialize(): Promise<void>;
18
+ getSymbology(geometryType: string): EsriSymbol;
19
+ }
20
+ /** @internal */
21
+ export declare class OgcApiFeaturesProvider extends MapLayerImageryProvider {
22
+ private readonly _drawDebugInfo;
23
+ private readonly _limitParamMaxValue;
24
+ private readonly _tiledModeMinLod;
25
+ private readonly _staticModeFetchTimeout;
26
+ private readonly _tileModeFetchTimeout;
27
+ private readonly _forceTileMode;
28
+ private _spatialIdx;
29
+ private _defaultSymbol;
30
+ private _renderer;
31
+ private _collectionUrl;
32
+ private _itemsUrl;
33
+ private readonly _itemsCrs;
34
+ private _queryables;
35
+ serviceJson: any;
36
+ private _staticData;
37
+ constructor(settings: ImageMapLayerSettings);
38
+ get supportsMapFeatureInfo(): boolean;
39
+ get minimumZoomLevel(): number;
40
+ get staticMode(): boolean;
41
+ initialize(): Promise<void>;
42
+ private fetchMetadata;
43
+ private fetchAllItems;
44
+ private fetchItems;
45
+ private indexStaticData;
46
+ get tileSize(): number;
47
+ constructUrl(_row: number, _column: number, _zoomLevel: number): Promise<string>;
48
+ drawTileDebugInfo(row: number, column: number, zoomLevel: number, context: CanvasRenderingContext2D): void;
49
+ computeTileWorld2CanvasTransform(row: number, column: number, zoomLevel: number): import("@itwin/core-geometry").Transform | undefined;
50
+ loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined>;
51
+ private createImageSourceFromDataURL;
52
+ getFeatureInfo(featureInfos: MapLayerFeatureInfo[], quadId: QuadId, carto: Cartographic, _tree: ImageryMapTileTree, hit: HitDetail, options?: MapFeatureInfoOptions): Promise<void>;
53
+ }
54
+ //# sourceMappingURL=OgcApiFeaturesProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OgcApiFeaturesProvider.d.ts","sourceRoot":"","sources":["../../../src/OgcApiFeatures/OgcApiFeaturesProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,SAAS,EAAE,kBAAkB,EAAqB,qBAAqB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,EAAe,MAAM,sBAAsB,CAAC;AAC3M,OAAO,EAAqF,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC/I,OAAO,EAAE,YAAY,EAA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