@hybridcore/ui 1.6.13 → 1.6.16

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 (100) hide show
  1. package/dist/AccordionSummary-DUtr16g6.js +781 -0
  2. package/dist/Add-Bk8R160M.js +403 -0
  3. package/dist/Button-Cem3nbwc.js +357 -0
  4. package/dist/ButtonBase-DObmf4Q_.js +886 -0
  5. package/dist/Delete-CVJ6FeDn.js +203 -0
  6. package/dist/FormGroup-BRj1o7-E.js +89 -0
  7. package/dist/InputLabel-CjD30ZHz.js +341 -0
  8. package/dist/MenuItem-BKvRGLvM.js +233 -0
  9. package/dist/Modal-BVYydOr5.js +1156 -0
  10. package/dist/Paper-B1HV8GyO.js +582 -0
  11. package/dist/Select-Bfhvigsx.js +3914 -0
  12. package/dist/Source-BSZST_GH.js +4410 -0
  13. package/dist/SwitchBase-BEK49kdS.js +235 -0
  14. package/dist/Text-ChJRuaD8.js +2197 -0
  15. package/dist/TextField-Ca9ykixI.js +696 -0
  16. package/dist/TransitionGroupContext-Ja2CgIob.js +96 -0
  17. package/dist/Typography-D3X-Y5fh.js +178 -0
  18. package/dist/Vector-BmuhQO4p.js +3606 -0
  19. package/dist/Vector-DfTqQEln.js +1735 -0
  20. package/dist/WKT-2wsDT-nq.js +2310 -0
  21. package/dist/{_commonjsHelpers-BVfed4GL.js → _commonjsHelpers-BkfeUUK-.js} +2 -2
  22. package/dist/assertThisInitialized-C1dAyb4j.js +7 -0
  23. package/dist/assets/index.css +1 -1
  24. package/dist/assets/index2.css +1 -1
  25. package/dist/assets/index3.css +1 -0
  26. package/dist/assets/index4.css +1 -0
  27. package/dist/clsx-OuTLNxxd.js +16 -0
  28. package/dist/components/button/styled.js +1 -1
  29. package/dist/components/charts/_common/format.js +126 -82
  30. package/dist/components/charts/_common/tooltip.js +44 -35
  31. package/dist/components/charts/chart-wrapper/index.js +44 -43
  32. package/dist/components/charts/donut-chart/logic.js +53 -40
  33. package/dist/components/charts/drill-down-voronoi-treemap/logic.js +1 -1
  34. package/dist/components/charts/xy-chart/logic.js +135 -134
  35. package/dist/components/collapsible-card/index.js +30 -21
  36. package/dist/components/collapsible-card/styled.js +14 -16
  37. package/dist/components/color-picker/index.js +3358 -2228
  38. package/dist/components/color-picker/styled.js +7 -87
  39. package/dist/components/confirm/dialog.js +7 -89
  40. package/dist/components/confirm/index.js +1 -1
  41. package/dist/components/data-map/index.js +1 -1
  42. package/dist/components/data-map/logic.js +20 -20
  43. package/dist/components/data-security-selectors/dissemination-list/index.js +3117 -32
  44. package/dist/components/date-range-picker/index.js +454 -466
  45. package/dist/components/document-viewer/components/viewer/index.js +1 -1
  46. package/dist/components/duration-select/index.js +10 -10
  47. package/dist/components/duration-select/styled.js +1 -1
  48. package/dist/components/geometry-picker/coordinate/index.js +14 -14
  49. package/dist/components/geometry-picker/edit/index.js +1 -1
  50. package/dist/components/geometry-picker/geometry/index.js +1 -1
  51. package/dist/components/geometry-picker/kml/index.js +11 -11
  52. package/dist/components/geometry-picker/map/logic.js +3656 -145
  53. package/dist/components/geometry-picker/map/style.js +17 -18
  54. package/dist/components/geometry-picker/parser/coordinate-input/logic.js +1255 -43
  55. package/dist/components/heat-map/index.js +1 -1
  56. package/dist/components/heat-map/logic.js +1924 -77
  57. package/dist/components/instance-form/components/composite-matrix/components/json-editor/index.js +8737 -8722
  58. package/dist/components/instance-hierarchy-table/styled.js +16 -18
  59. package/dist/components/map/helpers/mapbox.js +15 -17
  60. package/dist/components/map/helpers/ol.js +27 -386
  61. package/dist/components/map/index.js +10 -11
  62. package/dist/components/map/logic.js +22 -22
  63. package/dist/components/map/styled.js +27 -31
  64. package/dist/components/phone-input/index.js +9 -10
  65. package/dist/components/property-mapping/index.js +1 -1
  66. package/dist/components/prr-map/index.js +1 -1
  67. package/dist/components/prr-map/logic.js +26 -27
  68. package/dist/components/raster-grid-map/index.js +1 -1
  69. package/dist/components/raster-grid-map/logic.js +57 -60
  70. package/dist/components/sortable-list/index.js +1264 -1091
  71. package/dist/components/template-form/components/property-list/index.js +32 -36
  72. package/dist/components/template-form/components/property-list/property-list-columns.js +17 -19
  73. package/dist/components/template-form/components/property-list/property-list-form.js +600 -137
  74. package/dist/components/template-form/components/recognition-property-list/index.js +36 -40
  75. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-columns.js +9 -11
  76. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-form.js +64 -57
  77. package/dist/components/tree-select/index.js +16 -16
  78. package/dist/createChainedFunction-C0nujS3O.js +9 -0
  79. package/dist/createSvgIcon-BghzB2Y9.js +93 -0
  80. package/dist/createSvgIcon-D7U1nd99.js +185 -0
  81. package/dist/debounce-46wSf_lW.js +15 -0
  82. package/dist/dialog-BtJhjyF5.js +664 -0
  83. package/dist/extends-C3382pL0.js +22 -0
  84. package/dist/formControlState-vgaj2ksH.js +10 -0
  85. package/dist/generateUtilityClasses-Cc-owZ4J.js +2971 -0
  86. package/dist/{index-C__OZmYy.js → index-CblbdqjE.js} +1 -1
  87. package/dist/index-DH6qsPBn.js +153 -0
  88. package/dist/index.esm-DAf19hyR.js +318 -0
  89. package/dist/main.d.ts +9 -1
  90. package/dist/math-Bvt2Ubuz.js +704 -0
  91. package/dist/ol-yOE-NV0X.js +7465 -0
  92. package/dist/ownerWindow-wg6foiOE.js +10 -0
  93. package/dist/setPrototypeOf-NPgp4cYc.js +8 -0
  94. package/dist/styled-DD4BkuVf.js +350 -0
  95. package/dist/useControlled-BYdyS7Pn.js +31 -0
  96. package/dist/useFormControl-CatNKXAi.js +10 -0
  97. package/dist/useId-BW-oWmul.js +19 -0
  98. package/dist/useSlot-u4t0X96G.js +42 -0
  99. package/package.json +1 -1
  100. package/dist/index.esm-UfGMjYOL.js +0 -197
@@ -0,0 +1,1735 @@
1
+ import { B as Q, A as S, f as b, O as Z, b as X, E as P, g, i as Y, V as H, a as T, l as U, h as j, u as G, e as ee, T as te } from "./math-Bvt2Ubuz.js";
2
+ import { b as E, S as O, F as ie, a as ne, T as se, I as re, R as ae, C as he, t as oe, c as ue } from "./Text-ChJRuaD8.js";
3
+ import { L as ce, R as J, T as le, S as de, U as fe, V as me } from "./Source-BSZST_GH.js";
4
+ const R = {
5
+ /**
6
+ * Triggered when an item is added to the collection.
7
+ * @event module:ol/Collection.CollectionEvent#add
8
+ * @api
9
+ */
10
+ ADD: "add",
11
+ /**
12
+ * Triggered when an item is removed from the collection.
13
+ * @event module:ol/Collection.CollectionEvent#remove
14
+ * @api
15
+ */
16
+ REMOVE: "remove"
17
+ }, k = {
18
+ LENGTH: "length"
19
+ };
20
+ class C extends b {
21
+ /**
22
+ * @param {import("./CollectionEventType.js").default} type Type.
23
+ * @param {T} element Element.
24
+ * @param {number} index The index of the added or removed element.
25
+ */
26
+ constructor(e, t, i) {
27
+ super(e), this.element = t, this.index = i;
28
+ }
29
+ }
30
+ class ge extends Q {
31
+ /**
32
+ * @param {Array<T>} [array] Array.
33
+ * @param {Options} [options] Collection options.
34
+ */
35
+ constructor(e, t) {
36
+ if (super(), this.on, this.once, this.un, t = t || {}, this.unique_ = !!t.unique, this.array_ = e || [], this.unique_)
37
+ for (let i = 0, s = this.array_.length; i < s; ++i)
38
+ this.assertUnique_(this.array_[i], i);
39
+ this.updateLength_();
40
+ }
41
+ /**
42
+ * Remove all elements from the collection.
43
+ * @api
44
+ */
45
+ clear() {
46
+ for (; this.getLength() > 0; )
47
+ this.pop();
48
+ }
49
+ /**
50
+ * Add elements to the collection. This pushes each item in the provided array
51
+ * to the end of the collection.
52
+ * @param {!Array<T>} arr Array.
53
+ * @return {Collection<T>} This collection.
54
+ * @api
55
+ */
56
+ extend(e) {
57
+ for (let t = 0, i = e.length; t < i; ++t)
58
+ this.push(e[t]);
59
+ return this;
60
+ }
61
+ /**
62
+ * Iterate over each element, calling the provided callback.
63
+ * @param {function(T, number, Array<T>): *} f The function to call
64
+ * for every element. This function takes 3 arguments (the element, the
65
+ * index and the array). The return value is ignored.
66
+ * @api
67
+ */
68
+ forEach(e) {
69
+ const t = this.array_;
70
+ for (let i = 0, s = t.length; i < s; ++i)
71
+ e(t[i], i, t);
72
+ }
73
+ /**
74
+ * Get a reference to the underlying Array object. Warning: if the array
75
+ * is mutated, no events will be dispatched by the collection, and the
76
+ * collection's "length" property won't be in sync with the actual length
77
+ * of the array.
78
+ * @return {!Array<T>} Array.
79
+ * @api
80
+ */
81
+ getArray() {
82
+ return this.array_;
83
+ }
84
+ /**
85
+ * Get the element at the provided index.
86
+ * @param {number} index Index.
87
+ * @return {T} Element.
88
+ * @api
89
+ */
90
+ item(e) {
91
+ return this.array_[e];
92
+ }
93
+ /**
94
+ * Get the length of this collection.
95
+ * @return {number} The length of the array.
96
+ * @observable
97
+ * @api
98
+ */
99
+ getLength() {
100
+ return this.get(k.LENGTH);
101
+ }
102
+ /**
103
+ * Insert an element at the provided index.
104
+ * @param {number} index Index.
105
+ * @param {T} elem Element.
106
+ * @api
107
+ */
108
+ insertAt(e, t) {
109
+ if (e < 0 || e > this.getLength())
110
+ throw new Error("Index out of bounds: " + e);
111
+ this.unique_ && this.assertUnique_(t), this.array_.splice(e, 0, t), this.updateLength_(), this.dispatchEvent(
112
+ new C(R.ADD, t, e)
113
+ );
114
+ }
115
+ /**
116
+ * Remove the last element of the collection and return it.
117
+ * Return `undefined` if the collection is empty.
118
+ * @return {T|undefined} Element.
119
+ * @api
120
+ */
121
+ pop() {
122
+ return this.removeAt(this.getLength() - 1);
123
+ }
124
+ /**
125
+ * Insert the provided element at the end of the collection.
126
+ * @param {T} elem Element.
127
+ * @return {number} New length of the collection.
128
+ * @api
129
+ */
130
+ push(e) {
131
+ this.unique_ && this.assertUnique_(e);
132
+ const t = this.getLength();
133
+ return this.insertAt(t, e), this.getLength();
134
+ }
135
+ /**
136
+ * Remove the first occurrence of an element from the collection.
137
+ * @param {T} elem Element.
138
+ * @return {T|undefined} The removed element or undefined if none found.
139
+ * @api
140
+ */
141
+ remove(e) {
142
+ const t = this.array_;
143
+ for (let i = 0, s = t.length; i < s; ++i)
144
+ if (t[i] === e)
145
+ return this.removeAt(i);
146
+ }
147
+ /**
148
+ * Remove the element at the provided index and return it.
149
+ * Return `undefined` if the collection does not contain this index.
150
+ * @param {number} index Index.
151
+ * @return {T|undefined} Value.
152
+ * @api
153
+ */
154
+ removeAt(e) {
155
+ if (e < 0 || e >= this.getLength())
156
+ return;
157
+ const t = this.array_[e];
158
+ return this.array_.splice(e, 1), this.updateLength_(), this.dispatchEvent(
159
+ /** @type {CollectionEvent<T>} */
160
+ new C(R.REMOVE, t, e)
161
+ ), t;
162
+ }
163
+ /**
164
+ * Set the element at the provided index.
165
+ * @param {number} index Index.
166
+ * @param {T} elem Element.
167
+ * @api
168
+ */
169
+ setAt(e, t) {
170
+ const i = this.getLength();
171
+ if (e >= i) {
172
+ this.insertAt(e, t);
173
+ return;
174
+ }
175
+ if (e < 0)
176
+ throw new Error("Index out of bounds: " + e);
177
+ this.unique_ && this.assertUnique_(t, e);
178
+ const s = this.array_[e];
179
+ this.array_[e] = t, this.dispatchEvent(
180
+ /** @type {CollectionEvent<T>} */
181
+ new C(R.REMOVE, s, e)
182
+ ), this.dispatchEvent(
183
+ /** @type {CollectionEvent<T>} */
184
+ new C(R.ADD, t, e)
185
+ );
186
+ }
187
+ /**
188
+ * @private
189
+ */
190
+ updateLength_() {
191
+ this.set(k.LENGTH, this.array_.length);
192
+ }
193
+ /**
194
+ * @private
195
+ * @param {T} elem Element.
196
+ * @param {number} [except] Optional index to ignore.
197
+ */
198
+ assertUnique_(e, t) {
199
+ for (let i = 0, s = this.array_.length; i < s; ++i)
200
+ if (this.array_[i] === e && i !== t)
201
+ throw new S(58);
202
+ }
203
+ }
204
+ function Te(n, e, t, i) {
205
+ let s = n[e], r = n[e + 1], a = 0;
206
+ for (let h = e + i; h < t; h += i) {
207
+ const o = n[h], u = n[h + 1];
208
+ a += Math.sqrt((o - s) * (o - s) + (u - r) * (u - r)), s = o, r = u;
209
+ }
210
+ return a;
211
+ }
212
+ class De extends Z {
213
+ /**
214
+ * @param {LayerType} layer Layer.
215
+ */
216
+ constructor(e) {
217
+ super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.declutterExecutorGroup = null;
218
+ }
219
+ /**
220
+ * Asynchronous layer level hit detection.
221
+ * @param {import("../pixel.js").Pixel} pixel Pixel.
222
+ * @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with
223
+ * an array of features.
224
+ */
225
+ getFeatures(e) {
226
+ return X();
227
+ }
228
+ /**
229
+ * @param {import("../pixel.js").Pixel} pixel Pixel.
230
+ * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
231
+ */
232
+ getData(e) {
233
+ return null;
234
+ }
235
+ /**
236
+ * Determine whether render should be called.
237
+ * @abstract
238
+ * @param {import("../Map.js").FrameState} frameState Frame state.
239
+ * @return {boolean} Layer is ready to be rendered.
240
+ */
241
+ prepareFrame(e) {
242
+ return X();
243
+ }
244
+ /**
245
+ * Render the layer.
246
+ * @abstract
247
+ * @param {import("../Map.js").FrameState} frameState Frame state.
248
+ * @param {HTMLElement|null} target Target that may be used to render content to.
249
+ * @return {HTMLElement|null} The rendered element.
250
+ */
251
+ renderFrame(e, t) {
252
+ return X();
253
+ }
254
+ /**
255
+ * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
256
+ * @param {number} zoom Zoom level.
257
+ * @param {import("../Tile.js").default} tile Tile.
258
+ * @return {boolean|void} If `false`, the tile will not be considered loaded.
259
+ */
260
+ loadedTileCallback(e, t, i) {
261
+ e[t] || (e[t] = {}), e[t][i.tileCoord.toString()] = i;
262
+ }
263
+ /**
264
+ * Create a function that adds loaded tiles to the tile lookup.
265
+ * @param {import("../source/Tile.js").default} source Tile source.
266
+ * @param {import("../proj/Projection.js").default} projection Projection of the tiles.
267
+ * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
268
+ * @return {function(number, import("../TileRange.js").default):boolean} A function that can be
269
+ * called with a zoom level and a tile range to add loaded tiles to the lookup.
270
+ * @protected
271
+ */
272
+ createLoadedTileFinder(e, t, i) {
273
+ return (
274
+ /**
275
+ * @param {number} zoom Zoom level.
276
+ * @param {import("../TileRange.js").default} tileRange Tile range.
277
+ * @return {boolean} The tile range is fully loaded.
278
+ */
279
+ (s, r) => {
280
+ const a = this.loadedTileCallback.bind(this, i, s);
281
+ return e.forEachLoadedTile(t, s, r, a);
282
+ }
283
+ );
284
+ }
285
+ /**
286
+ * @abstract
287
+ * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
288
+ * @param {import("../Map.js").FrameState} frameState Frame state.
289
+ * @param {number} hitTolerance Hit tolerance in pixels.
290
+ * @param {import("./vector.js").FeatureCallback<T>} callback Feature callback.
291
+ * @param {Array<import("./Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
292
+ * @return {T|undefined} Callback result.
293
+ * @template T
294
+ */
295
+ forEachFeatureAtCoordinate(e, t, i, s, r) {
296
+ }
297
+ /**
298
+ * @return {LayerType} Layer.
299
+ */
300
+ getLayer() {
301
+ return this.layer_;
302
+ }
303
+ /**
304
+ * Perform action necessary to get the layer rendered after new fonts have loaded
305
+ * @abstract
306
+ */
307
+ handleFontsChanged() {
308
+ }
309
+ /**
310
+ * Handle changes in image state.
311
+ * @param {import("../events/Event.js").default} event Image change event.
312
+ * @private
313
+ */
314
+ handleImageChange_(e) {
315
+ const t = (
316
+ /** @type {import("../Image.js").default} */
317
+ e.target
318
+ );
319
+ (t.getState() === E.LOADED || t.getState() === E.ERROR) && this.renderIfReadyAndVisible();
320
+ }
321
+ /**
322
+ * Load the image if not already loaded, and register the image change
323
+ * listener if needed.
324
+ * @param {import("../ImageBase.js").default} image Image.
325
+ * @return {boolean} `true` if the image is already loaded, `false` otherwise.
326
+ * @protected
327
+ */
328
+ loadImage(e) {
329
+ let t = e.getState();
330
+ return t != E.LOADED && t != E.ERROR && e.addEventListener(P.CHANGE, this.boundHandleImageChange_), t == E.IDLE && (e.load(), t = e.getState()), t == E.LOADED;
331
+ }
332
+ /**
333
+ * @protected
334
+ */
335
+ renderIfReadyAndVisible() {
336
+ const e = this.getLayer();
337
+ e && e.getVisible() && e.getSourceState() === "ready" && e.changed();
338
+ }
339
+ /**
340
+ * Clean up.
341
+ */
342
+ disposeInternal() {
343
+ delete this.layer_, super.disposeInternal();
344
+ }
345
+ }
346
+ class Le extends b {
347
+ /**
348
+ * @param {import("./EventType.js").default} type Type.
349
+ * @param {import("../transform.js").Transform} [inversePixelTransform] Transform for
350
+ * CSS pixels to rendered pixels.
351
+ * @param {import("../Map.js").FrameState} [frameState] Frame state.
352
+ * @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [context] Context.
353
+ */
354
+ constructor(e, t, i, s) {
355
+ super(e), this.inversePixelTransform = t, this.frameState = i, this.context = s;
356
+ }
357
+ }
358
+ function _e(n, e, t, i, s) {
359
+ $(n, e, t || 0, i || n.length - 1, s || xe);
360
+ }
361
+ function $(n, e, t, i, s) {
362
+ for (; i > t; ) {
363
+ if (i - t > 600) {
364
+ var r = i - t + 1, a = e - t + 1, h = Math.log(r), o = 0.5 * Math.exp(2 * h / 3), u = 0.5 * Math.sqrt(h * o * (r - o) / r) * (a - r / 2 < 0 ? -1 : 1), c = Math.max(t, Math.floor(e - a * o / r + u)), l = Math.min(i, Math.floor(e + (r - a) * o / r + u));
365
+ $(n, e, c, l, s);
366
+ }
367
+ var d = n[e], x = t, f = i;
368
+ for (F(n, t, e), s(n[i], d) > 0 && F(n, t, i); x < f; ) {
369
+ for (F(n, x, f), x++, f--; s(n[x], d) < 0; ) x++;
370
+ for (; s(n[f], d) > 0; ) f--;
371
+ }
372
+ s(n[t], d) === 0 ? F(n, t, f) : (f++, F(n, f, i)), f <= e && (t = f + 1), e <= f && (i = f - 1);
373
+ }
374
+ }
375
+ function F(n, e, t) {
376
+ var i = n[e];
377
+ n[e] = n[t], n[t] = i;
378
+ }
379
+ function xe(n, e) {
380
+ return n < e ? -1 : n > e ? 1 : 0;
381
+ }
382
+ let z = class {
383
+ constructor(e = 9) {
384
+ this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
385
+ }
386
+ all() {
387
+ return this._all(this.data, []);
388
+ }
389
+ search(e) {
390
+ let t = this.data;
391
+ const i = [];
392
+ if (!M(e, t)) return i;
393
+ const s = this.toBBox, r = [];
394
+ for (; t; ) {
395
+ for (let a = 0; a < t.children.length; a++) {
396
+ const h = t.children[a], o = t.leaf ? s(h) : h;
397
+ M(e, o) && (t.leaf ? i.push(h) : L(e, o) ? this._all(h, i) : r.push(h));
398
+ }
399
+ t = r.pop();
400
+ }
401
+ return i;
402
+ }
403
+ collides(e) {
404
+ let t = this.data;
405
+ if (!M(e, t)) return !1;
406
+ const i = [];
407
+ for (; t; ) {
408
+ for (let s = 0; s < t.children.length; s++) {
409
+ const r = t.children[s], a = t.leaf ? this.toBBox(r) : r;
410
+ if (M(e, a)) {
411
+ if (t.leaf || L(e, a)) return !0;
412
+ i.push(r);
413
+ }
414
+ }
415
+ t = i.pop();
416
+ }
417
+ return !1;
418
+ }
419
+ load(e) {
420
+ if (!(e && e.length)) return this;
421
+ if (e.length < this._minEntries) {
422
+ for (let i = 0; i < e.length; i++)
423
+ this.insert(e[i]);
424
+ return this;
425
+ }
426
+ let t = this._build(e.slice(), 0, e.length - 1, 0);
427
+ if (!this.data.children.length)
428
+ this.data = t;
429
+ else if (this.data.height === t.height)
430
+ this._splitRoot(this.data, t);
431
+ else {
432
+ if (this.data.height < t.height) {
433
+ const i = this.data;
434
+ this.data = t, t = i;
435
+ }
436
+ this._insert(t, this.data.height - t.height - 1, !0);
437
+ }
438
+ return this;
439
+ }
440
+ insert(e) {
441
+ return e && this._insert(e, this.data.height - 1), this;
442
+ }
443
+ clear() {
444
+ return this.data = I([]), this;
445
+ }
446
+ remove(e, t) {
447
+ if (!e) return this;
448
+ let i = this.data;
449
+ const s = this.toBBox(e), r = [], a = [];
450
+ let h, o, u;
451
+ for (; i || r.length; ) {
452
+ if (i || (i = r.pop(), o = r[r.length - 1], h = a.pop(), u = !0), i.leaf) {
453
+ const c = Ee(e, i.children, t);
454
+ if (c !== -1)
455
+ return i.children.splice(c, 1), r.push(i), this._condense(r), this;
456
+ }
457
+ !u && !i.leaf && L(i, s) ? (r.push(i), a.push(h), h = 0, o = i, i = i.children[0]) : o ? (h++, i = o.children[h], u = !1) : i = null;
458
+ }
459
+ return this;
460
+ }
461
+ toBBox(e) {
462
+ return e;
463
+ }
464
+ compareMinX(e, t) {
465
+ return e.minX - t.minX;
466
+ }
467
+ compareMinY(e, t) {
468
+ return e.minY - t.minY;
469
+ }
470
+ toJSON() {
471
+ return this.data;
472
+ }
473
+ fromJSON(e) {
474
+ return this.data = e, this;
475
+ }
476
+ _all(e, t) {
477
+ const i = [];
478
+ for (; e; )
479
+ e.leaf ? t.push(...e.children) : i.push(...e.children), e = i.pop();
480
+ return t;
481
+ }
482
+ _build(e, t, i, s) {
483
+ const r = i - t + 1;
484
+ let a = this._maxEntries, h;
485
+ if (r <= a)
486
+ return h = I(e.slice(t, i + 1)), p(h, this.toBBox), h;
487
+ s || (s = Math.ceil(Math.log(r) / Math.log(a)), a = Math.ceil(r / Math.pow(a, s - 1))), h = I([]), h.leaf = !1, h.height = s;
488
+ const o = Math.ceil(r / a), u = o * Math.ceil(Math.sqrt(a));
489
+ N(e, t, i, u, this.compareMinX);
490
+ for (let c = t; c <= i; c += u) {
491
+ const l = Math.min(c + u - 1, i);
492
+ N(e, c, l, o, this.compareMinY);
493
+ for (let d = c; d <= l; d += o) {
494
+ const x = Math.min(d + o - 1, l);
495
+ h.children.push(this._build(e, d, x, s - 1));
496
+ }
497
+ }
498
+ return p(h, this.toBBox), h;
499
+ }
500
+ _chooseSubtree(e, t, i, s) {
501
+ for (; s.push(t), !(t.leaf || s.length - 1 === i); ) {
502
+ let r = 1 / 0, a = 1 / 0, h;
503
+ for (let o = 0; o < t.children.length; o++) {
504
+ const u = t.children[o], c = D(u), l = Re(e, u) - c;
505
+ l < a ? (a = l, r = c < r ? c : r, h = u) : l === a && c < r && (r = c, h = u);
506
+ }
507
+ t = h || t.children[0];
508
+ }
509
+ return t;
510
+ }
511
+ _insert(e, t, i) {
512
+ const s = i ? e : this.toBBox(e), r = [], a = this._chooseSubtree(s, this.data, t, r);
513
+ for (a.children.push(e), A(a, s); t >= 0 && r[t].children.length > this._maxEntries; )
514
+ this._split(r, t), t--;
515
+ this._adjustParentBBoxes(s, r, t);
516
+ }
517
+ // split overflowed node into two
518
+ _split(e, t) {
519
+ const i = e[t], s = i.children.length, r = this._minEntries;
520
+ this._chooseSplitAxis(i, r, s);
521
+ const a = this._chooseSplitIndex(i, r, s), h = I(i.children.splice(a, i.children.length - a));
522
+ h.height = i.height, h.leaf = i.leaf, p(i, this.toBBox), p(h, this.toBBox), t ? e[t - 1].children.push(h) : this._splitRoot(i, h);
523
+ }
524
+ _splitRoot(e, t) {
525
+ this.data = I([e, t]), this.data.height = e.height + 1, this.data.leaf = !1, p(this.data, this.toBBox);
526
+ }
527
+ _chooseSplitIndex(e, t, i) {
528
+ let s, r = 1 / 0, a = 1 / 0;
529
+ for (let h = t; h <= i - t; h++) {
530
+ const o = y(e, 0, h, this.toBBox), u = y(e, h, i, this.toBBox), c = Fe(o, u), l = D(o) + D(u);
531
+ c < r ? (r = c, s = h, a = l < a ? l : a) : c === r && l < a && (a = l, s = h);
532
+ }
533
+ return s || i - t;
534
+ }
535
+ // sorts node children by the best axis for split
536
+ _chooseSplitAxis(e, t, i) {
537
+ const s = e.leaf ? this.compareMinX : pe, r = e.leaf ? this.compareMinY : Ie, a = this._allDistMargin(e, t, i, s), h = this._allDistMargin(e, t, i, r);
538
+ a < h && e.children.sort(s);
539
+ }
540
+ // total margin of all possible split distributions where each node is at least m full
541
+ _allDistMargin(e, t, i, s) {
542
+ e.children.sort(s);
543
+ const r = this.toBBox, a = y(e, 0, t, r), h = y(e, i - t, i, r);
544
+ let o = B(a) + B(h);
545
+ for (let u = t; u < i - t; u++) {
546
+ const c = e.children[u];
547
+ A(a, e.leaf ? r(c) : c), o += B(a);
548
+ }
549
+ for (let u = i - t - 1; u >= t; u--) {
550
+ const c = e.children[u];
551
+ A(h, e.leaf ? r(c) : c), o += B(h);
552
+ }
553
+ return o;
554
+ }
555
+ _adjustParentBBoxes(e, t, i) {
556
+ for (let s = i; s >= 0; s--)
557
+ A(t[s], e);
558
+ }
559
+ _condense(e) {
560
+ for (let t = e.length - 1, i; t >= 0; t--)
561
+ e[t].children.length === 0 ? t > 0 ? (i = e[t - 1].children, i.splice(i.indexOf(e[t]), 1)) : this.clear() : p(e[t], this.toBBox);
562
+ }
563
+ };
564
+ function Ee(n, e, t) {
565
+ if (!t) return e.indexOf(n);
566
+ for (let i = 0; i < e.length; i++)
567
+ if (t(n, e[i])) return i;
568
+ return -1;
569
+ }
570
+ function p(n, e) {
571
+ y(n, 0, n.children.length, e, n);
572
+ }
573
+ function y(n, e, t, i, s) {
574
+ s || (s = I(null)), s.minX = 1 / 0, s.minY = 1 / 0, s.maxX = -1 / 0, s.maxY = -1 / 0;
575
+ for (let r = e; r < t; r++) {
576
+ const a = n.children[r];
577
+ A(s, n.leaf ? i(a) : a);
578
+ }
579
+ return s;
580
+ }
581
+ function A(n, e) {
582
+ return n.minX = Math.min(n.minX, e.minX), n.minY = Math.min(n.minY, e.minY), n.maxX = Math.max(n.maxX, e.maxX), n.maxY = Math.max(n.maxY, e.maxY), n;
583
+ }
584
+ function pe(n, e) {
585
+ return n.minX - e.minX;
586
+ }
587
+ function Ie(n, e) {
588
+ return n.minY - e.minY;
589
+ }
590
+ function D(n) {
591
+ return (n.maxX - n.minX) * (n.maxY - n.minY);
592
+ }
593
+ function B(n) {
594
+ return n.maxX - n.minX + (n.maxY - n.minY);
595
+ }
596
+ function Re(n, e) {
597
+ return (Math.max(e.maxX, n.maxX) - Math.min(e.minX, n.minX)) * (Math.max(e.maxY, n.maxY) - Math.min(e.minY, n.minY));
598
+ }
599
+ function Fe(n, e) {
600
+ const t = Math.max(n.minX, e.minX), i = Math.max(n.minY, e.minY), s = Math.min(n.maxX, e.maxX), r = Math.min(n.maxY, e.maxY);
601
+ return Math.max(0, s - t) * Math.max(0, r - i);
602
+ }
603
+ function L(n, e) {
604
+ return n.minX <= e.minX && n.minY <= e.minY && e.maxX <= n.maxX && e.maxY <= n.maxY;
605
+ }
606
+ function M(n, e) {
607
+ return e.minX <= n.maxX && e.minY <= n.maxY && e.maxX >= n.minX && e.maxY >= n.minY;
608
+ }
609
+ function I(n) {
610
+ return {
611
+ children: n,
612
+ height: 1,
613
+ leaf: !0,
614
+ minX: 1 / 0,
615
+ minY: 1 / 0,
616
+ maxX: -1 / 0,
617
+ maxY: -1 / 0
618
+ };
619
+ }
620
+ function N(n, e, t, i, s) {
621
+ const r = [e, t];
622
+ for (; r.length; ) {
623
+ if (t = r.pop(), e = r.pop(), t - e <= i) continue;
624
+ const a = e + Math.ceil((t - e) / i / 2) * i;
625
+ _e(n, a, e, t, s), r.push(e, a, a, t);
626
+ }
627
+ }
628
+ function V(n) {
629
+ return new O({
630
+ fill: v(n, ""),
631
+ stroke: w(n, ""),
632
+ text: ye(n),
633
+ image: Ae(n)
634
+ });
635
+ }
636
+ function v(n, e) {
637
+ const t = n[e + "fill-color"];
638
+ if (t)
639
+ return t === "none" ? null : new ie({ color: t });
640
+ }
641
+ function w(n, e) {
642
+ const t = n[e + "stroke-width"], i = n[e + "stroke-color"];
643
+ if (!(!t && !i))
644
+ return new ne({
645
+ width: t,
646
+ color: i,
647
+ lineCap: n[e + "stroke-line-cap"],
648
+ lineJoin: n[e + "stroke-line-join"],
649
+ lineDash: n[e + "stroke-line-dash"],
650
+ lineDashOffset: n[e + "stroke-line-dash-offset"],
651
+ miterLimit: n[e + "stroke-miter-limit"]
652
+ });
653
+ }
654
+ function ye(n) {
655
+ const e = n["text-value"];
656
+ return e ? new se({
657
+ text: e,
658
+ font: n["text-font"],
659
+ maxAngle: n["text-max-angle"],
660
+ offsetX: n["text-offset-x"],
661
+ offsetY: n["text-offset-y"],
662
+ overflow: n["text-overflow"],
663
+ placement: n["text-placement"],
664
+ repeat: n["text-repeat"],
665
+ scale: n["text-scale"],
666
+ rotateWithView: n["text-rotate-with-view"],
667
+ rotation: n["text-rotation"],
668
+ textAlign: n["text-align"],
669
+ justify: n["text-justify"],
670
+ textBaseline: n["text-baseline"],
671
+ padding: n["text-padding"],
672
+ fill: v(n, "text-"),
673
+ backgroundFill: v(n, "text-background-"),
674
+ stroke: w(n, "text-"),
675
+ backgroundStroke: w(n, "text-background-")
676
+ }) : void 0;
677
+ }
678
+ function Ae(n) {
679
+ const e = n["icon-src"], t = n["icon-img"];
680
+ if (e || t)
681
+ return new re({
682
+ src: e,
683
+ img: t,
684
+ imgSize: n["icon-img-size"],
685
+ anchor: n["icon-anchor"],
686
+ anchorOrigin: n["icon-anchor-origin"],
687
+ anchorXUnits: n["icon-anchor-x-units"],
688
+ anchorYUnits: n["icon-anchor-y-units"],
689
+ color: n["icon-color"],
690
+ crossOrigin: n["icon-cross-origin"],
691
+ offset: n["icon-offset"],
692
+ displacement: n["icon-displacement"],
693
+ opacity: n["icon-opacity"],
694
+ scale: n["icon-scale"],
695
+ width: n["icon-width"],
696
+ height: n["icon-height"],
697
+ rotation: n["icon-rotation"],
698
+ rotateWithView: n["icon-rotate-with-view"],
699
+ size: n["icon-size"],
700
+ declutterMode: n["icon-declutter-mode"]
701
+ });
702
+ const i = n["shape-points"];
703
+ if (i) {
704
+ const r = "shape-";
705
+ return new ae({
706
+ points: i,
707
+ fill: v(n, r),
708
+ stroke: w(n, r),
709
+ radius: n["shape-radius"],
710
+ radius1: n["shape-radius1"],
711
+ radius2: n["shape-radius2"],
712
+ angle: n["shape-angle"],
713
+ displacement: n["shape-displacement"],
714
+ rotation: n["shape-rotation"],
715
+ rotateWithView: n["shape-rotate-with-view"],
716
+ scale: n["shape-scale"],
717
+ declutterMode: n["shape-declutter-mode"]
718
+ });
719
+ }
720
+ const s = n["circle-radius"];
721
+ if (s) {
722
+ const r = "circle-";
723
+ return new he({
724
+ radius: s,
725
+ fill: v(n, r),
726
+ stroke: w(n, r),
727
+ displacement: n["circle-displacement"],
728
+ scale: n["circle-scale"],
729
+ rotation: n["circle-rotation"],
730
+ rotateWithView: n["circle-rotate-with-view"],
731
+ declutterMode: n["circle-declutter-mode"]
732
+ });
733
+ }
734
+ }
735
+ const q = {
736
+ RENDER_ORDER: "renderOrder"
737
+ };
738
+ class Oe extends ce {
739
+ /**
740
+ * @param {Options<VectorSourceType>} [options] Options.
741
+ */
742
+ constructor(e) {
743
+ e = e || {};
744
+ const t = Object.assign({}, e);
745
+ delete t.style, delete t.renderBuffer, delete t.updateWhileAnimating, delete t.updateWhileInteracting, super(t), this.declutter_ = e.declutter !== void 0 ? e.declutter : !1, this.renderBuffer_ = e.renderBuffer !== void 0 ? e.renderBuffer : 100, this.style_ = null, this.styleFunction_ = void 0, this.setStyle(e.style), this.updateWhileAnimating_ = e.updateWhileAnimating !== void 0 ? e.updateWhileAnimating : !1, this.updateWhileInteracting_ = e.updateWhileInteracting !== void 0 ? e.updateWhileInteracting : !1;
746
+ }
747
+ /**
748
+ * @return {boolean} Declutter.
749
+ */
750
+ getDeclutter() {
751
+ return this.declutter_;
752
+ }
753
+ /**
754
+ * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise
755
+ * that resolves with an array of features. The array will either contain the topmost feature
756
+ * when a hit was detected, or it will be empty.
757
+ *
758
+ * The hit detection algorithm used for this method is optimized for performance, but is less
759
+ * accurate than the one used in [map.getFeaturesAtPixel()]{@link import("../Map.js").default#getFeaturesAtPixel}.
760
+ * Text is not considered, and icons are only represented by their bounding box instead of the exact
761
+ * image.
762
+ *
763
+ * @param {import("../pixel.js").Pixel} pixel Pixel.
764
+ * @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with an array of features.
765
+ * @api
766
+ */
767
+ getFeatures(e) {
768
+ return super.getFeatures(e);
769
+ }
770
+ /**
771
+ * @return {number|undefined} Render buffer.
772
+ */
773
+ getRenderBuffer() {
774
+ return this.renderBuffer_;
775
+ }
776
+ /**
777
+ * @return {function(import("../Feature.js").default, import("../Feature.js").default): number|null|undefined} Render
778
+ * order.
779
+ */
780
+ getRenderOrder() {
781
+ return (
782
+ /** @type {import("../render.js").OrderFunction|null|undefined} */
783
+ this.get(q.RENDER_ORDER)
784
+ );
785
+ }
786
+ /**
787
+ * Get the style for features. This returns whatever was passed to the `style`
788
+ * option at construction or to the `setStyle` method.
789
+ * @return {import("../style/Style.js").StyleLike|null|undefined} Layer style.
790
+ * @api
791
+ */
792
+ getStyle() {
793
+ return this.style_;
794
+ }
795
+ /**
796
+ * Get the style function.
797
+ * @return {import("../style/Style.js").StyleFunction|undefined} Layer style function.
798
+ * @api
799
+ */
800
+ getStyleFunction() {
801
+ return this.styleFunction_;
802
+ }
803
+ /**
804
+ * @return {boolean} Whether the rendered layer should be updated while
805
+ * animating.
806
+ */
807
+ getUpdateWhileAnimating() {
808
+ return this.updateWhileAnimating_;
809
+ }
810
+ /**
811
+ * @return {boolean} Whether the rendered layer should be updated while
812
+ * interacting.
813
+ */
814
+ getUpdateWhileInteracting() {
815
+ return this.updateWhileInteracting_;
816
+ }
817
+ /**
818
+ * Render declutter items for this layer
819
+ * @param {import("../Map.js").FrameState} frameState Frame state.
820
+ */
821
+ renderDeclutter(e) {
822
+ e.declutterTree || (e.declutterTree = new z(9)), this.getRenderer().renderDeclutter(e);
823
+ }
824
+ /**
825
+ * @param {import("../render.js").OrderFunction|null|undefined} renderOrder
826
+ * Render order.
827
+ */
828
+ setRenderOrder(e) {
829
+ this.set(q.RENDER_ORDER, e);
830
+ }
831
+ /**
832
+ * Set the style for features. This can be a single style object, an array
833
+ * of styles, or a function that takes a feature and resolution and returns
834
+ * an array of styles. If set to `null`, the layer has no style (a `null` style),
835
+ * so only features that have their own styles will be rendered in the layer. Call
836
+ * `setStyle()` without arguments to reset to the default style. See
837
+ * [the ol/style/Style module]{@link module:ol/style/Style~Style} for information on the default style.
838
+ *
839
+ * If your layer has a static style, you can use [flat style]{@link module:ol/style/flat~FlatStyle} object
840
+ * literals instead of using the `Style` and symbolizer constructors (`Fill`, `Stroke`, etc.):
841
+ * ```js
842
+ * vectorLayer.setStyle({
843
+ * "fill-color": "yellow",
844
+ * "stroke-color": "black",
845
+ * "stroke-width": 4
846
+ * })
847
+ * ```
848
+ *
849
+ * @param {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike|null} [style] Layer style.
850
+ * @api
851
+ */
852
+ setStyle(e) {
853
+ let t;
854
+ if (e === void 0)
855
+ t = ue;
856
+ else if (e === null)
857
+ t = null;
858
+ else if (typeof e == "function")
859
+ t = e;
860
+ else if (e instanceof O)
861
+ t = e;
862
+ else if (Array.isArray(e)) {
863
+ const i = e.length, s = new Array(i);
864
+ for (let r = 0; r < i; ++r) {
865
+ const a = e[r];
866
+ a instanceof O ? s[r] = a : s[r] = V(a);
867
+ }
868
+ t = s;
869
+ } else
870
+ t = V(e);
871
+ this.style_ = t, this.styleFunction_ = e === null ? void 0 : oe(this.style_), this.changed();
872
+ }
873
+ }
874
+ class W {
875
+ /**
876
+ * @param {number} [maxEntries] Max entries.
877
+ */
878
+ constructor(e) {
879
+ this.rbush_ = new z(e), this.items_ = {};
880
+ }
881
+ /**
882
+ * Insert a value into the RBush.
883
+ * @param {import("../extent.js").Extent} extent Extent.
884
+ * @param {T} value Value.
885
+ */
886
+ insert(e, t) {
887
+ const i = {
888
+ minX: e[0],
889
+ minY: e[1],
890
+ maxX: e[2],
891
+ maxY: e[3],
892
+ value: t
893
+ };
894
+ this.rbush_.insert(i), this.items_[g(t)] = i;
895
+ }
896
+ /**
897
+ * Bulk-insert values into the RBush.
898
+ * @param {Array<import("../extent.js").Extent>} extents Extents.
899
+ * @param {Array<T>} values Values.
900
+ */
901
+ load(e, t) {
902
+ const i = new Array(t.length);
903
+ for (let s = 0, r = t.length; s < r; s++) {
904
+ const a = e[s], h = t[s], o = {
905
+ minX: a[0],
906
+ minY: a[1],
907
+ maxX: a[2],
908
+ maxY: a[3],
909
+ value: h
910
+ };
911
+ i[s] = o, this.items_[g(h)] = o;
912
+ }
913
+ this.rbush_.load(i);
914
+ }
915
+ /**
916
+ * Remove a value from the RBush.
917
+ * @param {T} value Value.
918
+ * @return {boolean} Removed.
919
+ */
920
+ remove(e) {
921
+ const t = g(e), i = this.items_[t];
922
+ return delete this.items_[t], this.rbush_.remove(i) !== null;
923
+ }
924
+ /**
925
+ * Update the extent of a value in the RBush.
926
+ * @param {import("../extent.js").Extent} extent Extent.
927
+ * @param {T} value Value.
928
+ */
929
+ update(e, t) {
930
+ const i = this.items_[g(t)], s = [i.minX, i.minY, i.maxX, i.maxY];
931
+ J(s, e) || (this.remove(t), this.insert(e, t));
932
+ }
933
+ /**
934
+ * Return all values in the RBush.
935
+ * @return {Array<T>} All.
936
+ */
937
+ getAll() {
938
+ return this.rbush_.all().map(function(t) {
939
+ return t.value;
940
+ });
941
+ }
942
+ /**
943
+ * Return all values in the given extent.
944
+ * @param {import("../extent.js").Extent} extent Extent.
945
+ * @return {Array<T>} All in extent.
946
+ */
947
+ getInExtent(e) {
948
+ const t = {
949
+ minX: e[0],
950
+ minY: e[1],
951
+ maxX: e[2],
952
+ maxY: e[3]
953
+ };
954
+ return this.rbush_.search(t).map(function(s) {
955
+ return s.value;
956
+ });
957
+ }
958
+ /**
959
+ * Calls a callback function with each value in the tree.
960
+ * If the callback returns a truthy value, this value is returned without
961
+ * checking the rest of the tree.
962
+ * @param {function(T): *} callback Callback.
963
+ * @return {*} Callback return value.
964
+ */
965
+ forEach(e) {
966
+ return this.forEach_(this.getAll(), e);
967
+ }
968
+ /**
969
+ * Calls a callback function with each value in the provided extent.
970
+ * @param {import("../extent.js").Extent} extent Extent.
971
+ * @param {function(T): *} callback Callback.
972
+ * @return {*} Callback return value.
973
+ */
974
+ forEachInExtent(e, t) {
975
+ return this.forEach_(this.getInExtent(e), t);
976
+ }
977
+ /**
978
+ * @param {Array<T>} values Values.
979
+ * @param {function(T): *} callback Callback.
980
+ * @private
981
+ * @return {*} Callback return value.
982
+ */
983
+ forEach_(e, t) {
984
+ let i;
985
+ for (let s = 0, r = e.length; s < r; s++)
986
+ if (i = t(e[s]), i)
987
+ return i;
988
+ return i;
989
+ }
990
+ /**
991
+ * @return {boolean} Is empty.
992
+ */
993
+ isEmpty() {
994
+ return Y(this.items_);
995
+ }
996
+ /**
997
+ * Remove all values from the RBush.
998
+ */
999
+ clear() {
1000
+ this.rbush_.clear(), this.items_ = {};
1001
+ }
1002
+ /**
1003
+ * @param {import("../extent.js").Extent} [extent] Extent.
1004
+ * @return {import("../extent.js").Extent} Extent.
1005
+ */
1006
+ getExtent(e) {
1007
+ const t = this.rbush_.toJSON();
1008
+ return le(t.minX, t.minY, t.maxX, t.maxY, e);
1009
+ }
1010
+ /**
1011
+ * @param {RBush} rbush R-Tree.
1012
+ */
1013
+ concat(e) {
1014
+ this.rbush_.load(e.rbush_.all());
1015
+ for (const t in e.items_)
1016
+ this.items_[t] = e.items_[t];
1017
+ }
1018
+ }
1019
+ const m = {
1020
+ /**
1021
+ * Triggered when a feature is added to the source.
1022
+ * @event module:ol/source/Vector.VectorSourceEvent#addfeature
1023
+ * @api
1024
+ */
1025
+ ADDFEATURE: "addfeature",
1026
+ /**
1027
+ * Triggered when a feature is updated.
1028
+ * @event module:ol/source/Vector.VectorSourceEvent#changefeature
1029
+ * @api
1030
+ */
1031
+ CHANGEFEATURE: "changefeature",
1032
+ /**
1033
+ * Triggered when the clear method is called on the source.
1034
+ * @event module:ol/source/Vector.VectorSourceEvent#clear
1035
+ * @api
1036
+ */
1037
+ CLEAR: "clear",
1038
+ /**
1039
+ * Triggered when a feature is removed from the source.
1040
+ * See {@link module:ol/source/Vector~VectorSource#clear source.clear()} for exceptions.
1041
+ * @event module:ol/source/Vector.VectorSourceEvent#removefeature
1042
+ * @api
1043
+ */
1044
+ REMOVEFEATURE: "removefeature",
1045
+ /**
1046
+ * Triggered when features starts loading.
1047
+ * @event module:ol/source/Vector.VectorSourceEvent#featuresloadstart
1048
+ * @api
1049
+ */
1050
+ FEATURESLOADSTART: "featuresloadstart",
1051
+ /**
1052
+ * Triggered when features finishes loading.
1053
+ * @event module:ol/source/Vector.VectorSourceEvent#featuresloadend
1054
+ * @api
1055
+ */
1056
+ FEATURESLOADEND: "featuresloadend",
1057
+ /**
1058
+ * Triggered if feature loading results in an error.
1059
+ * @event module:ol/source/Vector.VectorSourceEvent#featuresloaderror
1060
+ * @api
1061
+ */
1062
+ FEATURESLOADERROR: "featuresloaderror"
1063
+ };
1064
+ function ve(n, e) {
1065
+ return [[-1 / 0, -1 / 0, 1 / 0, 1 / 0]];
1066
+ }
1067
+ let we = !1;
1068
+ function Ce(n, e, t, i, s, r, a) {
1069
+ const h = new XMLHttpRequest();
1070
+ h.open(
1071
+ "GET",
1072
+ typeof n == "function" ? n(t, i, s) : n,
1073
+ !0
1074
+ ), e.getType() == "arraybuffer" && (h.responseType = "arraybuffer"), h.withCredentials = we, h.onload = function(o) {
1075
+ if (!h.status || h.status >= 200 && h.status < 300) {
1076
+ const u = e.getType();
1077
+ let c;
1078
+ u == "json" || u == "text" ? c = h.responseText : u == "xml" ? (c = h.responseXML, c || (c = new DOMParser().parseFromString(
1079
+ h.responseText,
1080
+ "application/xml"
1081
+ ))) : u == "arraybuffer" && (c = /** @type {ArrayBuffer} */
1082
+ h.response), c ? r(
1083
+ /** @type {Array<import("./Feature.js").default>} */
1084
+ e.readFeatures(c, {
1085
+ extent: t,
1086
+ featureProjection: s
1087
+ }),
1088
+ e.readProjection(c)
1089
+ ) : a();
1090
+ } else
1091
+ a();
1092
+ }, h.onerror = a, h.send();
1093
+ }
1094
+ function K(n, e) {
1095
+ return function(t, i, s, r, a) {
1096
+ const h = (
1097
+ /** @type {import("./source/Vector").default} */
1098
+ this
1099
+ );
1100
+ Ce(
1101
+ n,
1102
+ e,
1103
+ t,
1104
+ i,
1105
+ s,
1106
+ /**
1107
+ * @param {Array<import("./Feature.js").default>} features The loaded features.
1108
+ * @param {import("./proj/Projection.js").default} dataProjection Data
1109
+ * projection.
1110
+ */
1111
+ function(o, u) {
1112
+ h.addFeatures(o), r !== void 0 && r(o);
1113
+ },
1114
+ /* FIXME handle error */
1115
+ a || H
1116
+ );
1117
+ };
1118
+ }
1119
+ class _ extends b {
1120
+ /**
1121
+ * @param {string} type Type.
1122
+ * @param {import("../Feature.js").default<Geometry>} [feature] Feature.
1123
+ * @param {Array<import("../Feature.js").default<Geometry>>} [features] Features.
1124
+ */
1125
+ constructor(e, t, i) {
1126
+ super(e), this.feature = t, this.features = i;
1127
+ }
1128
+ }
1129
+ class be extends de {
1130
+ /**
1131
+ * @param {Options<Geometry>} [options] Vector source options.
1132
+ */
1133
+ constructor(e) {
1134
+ e = e || {}, super({
1135
+ attributions: e.attributions,
1136
+ interpolate: !0,
1137
+ projection: void 0,
1138
+ state: "ready",
1139
+ wrapX: e.wrapX !== void 0 ? e.wrapX : !0
1140
+ }), this.on, this.once, this.un, this.loader_ = H, this.format_ = e.format, this.overlaps_ = e.overlaps === void 0 ? !0 : e.overlaps, this.url_ = e.url, e.loader !== void 0 ? this.loader_ = e.loader : this.url_ !== void 0 && (T(this.format_, 7), this.loader_ = K(
1141
+ this.url_,
1142
+ /** @type {import("../format/Feature.js").default} */
1143
+ this.format_
1144
+ )), this.strategy_ = e.strategy !== void 0 ? e.strategy : ve;
1145
+ const t = e.useSpatialIndex !== void 0 ? e.useSpatialIndex : !0;
1146
+ this.featuresRtree_ = t ? new W() : null, this.loadedExtentsRtree_ = new W(), this.loadingExtentsCount_ = 0, this.nullGeometryFeatures_ = {}, this.idIndex_ = {}, this.uidIndex_ = {}, this.featureChangeKeys_ = {}, this.featuresCollection_ = null;
1147
+ let i, s;
1148
+ Array.isArray(e.features) ? s = e.features : e.features && (i = e.features, s = i.getArray()), !t && i === void 0 && (i = new ge(s)), s !== void 0 && this.addFeaturesInternal(s), i !== void 0 && this.bindFeaturesCollection_(i);
1149
+ }
1150
+ /**
1151
+ * Add a single feature to the source. If you want to add a batch of features
1152
+ * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()}
1153
+ * instead. A feature will not be added to the source if feature with
1154
+ * the same id is already there. The reason for this behavior is to avoid
1155
+ * feature duplication when using bbox or tile loading strategies.
1156
+ * Note: this also applies if an {@link module:ol/Collection~Collection} is used for features,
1157
+ * meaning that if a feature with a duplicate id is added in the collection, it will
1158
+ * be removed from it right away.
1159
+ * @param {import("../Feature.js").default<Geometry>} feature Feature to add.
1160
+ * @api
1161
+ */
1162
+ addFeature(e) {
1163
+ this.addFeatureInternal(e), this.changed();
1164
+ }
1165
+ /**
1166
+ * Add a feature without firing a `change` event.
1167
+ * @param {import("../Feature.js").default<Geometry>} feature Feature.
1168
+ * @protected
1169
+ */
1170
+ addFeatureInternal(e) {
1171
+ const t = g(e);
1172
+ if (!this.addToIndex_(t, e)) {
1173
+ this.featuresCollection_ && this.featuresCollection_.remove(e);
1174
+ return;
1175
+ }
1176
+ this.setupChangeEvents_(t, e);
1177
+ const i = e.getGeometry();
1178
+ if (i) {
1179
+ const s = i.getExtent();
1180
+ this.featuresRtree_ && this.featuresRtree_.insert(s, e);
1181
+ } else
1182
+ this.nullGeometryFeatures_[t] = e;
1183
+ this.dispatchEvent(
1184
+ new _(m.ADDFEATURE, e)
1185
+ );
1186
+ }
1187
+ /**
1188
+ * @param {string} featureKey Unique identifier for the feature.
1189
+ * @param {import("../Feature.js").default<Geometry>} feature The feature.
1190
+ * @private
1191
+ */
1192
+ setupChangeEvents_(e, t) {
1193
+ this.featureChangeKeys_[e] = [
1194
+ U(t, P.CHANGE, this.handleFeatureChange_, this),
1195
+ U(
1196
+ t,
1197
+ j.PROPERTYCHANGE,
1198
+ this.handleFeatureChange_,
1199
+ this
1200
+ )
1201
+ ];
1202
+ }
1203
+ /**
1204
+ * @param {string} featureKey Unique identifier for the feature.
1205
+ * @param {import("../Feature.js").default<Geometry>} feature The feature.
1206
+ * @return {boolean} The feature is "valid", in the sense that it is also a
1207
+ * candidate for insertion into the Rtree.
1208
+ * @private
1209
+ */
1210
+ addToIndex_(e, t) {
1211
+ let i = !0;
1212
+ const s = t.getId();
1213
+ return s !== void 0 && (s.toString() in this.idIndex_ ? i = !1 : this.idIndex_[s.toString()] = t), i && (T(!(e in this.uidIndex_), 30), this.uidIndex_[e] = t), i;
1214
+ }
1215
+ /**
1216
+ * Add a batch of features to the source.
1217
+ * @param {Array<import("../Feature.js").default<Geometry>>} features Features to add.
1218
+ * @api
1219
+ */
1220
+ addFeatures(e) {
1221
+ this.addFeaturesInternal(e), this.changed();
1222
+ }
1223
+ /**
1224
+ * Add features without firing a `change` event.
1225
+ * @param {Array<import("../Feature.js").default<Geometry>>} features Features.
1226
+ * @protected
1227
+ */
1228
+ addFeaturesInternal(e) {
1229
+ const t = [], i = [], s = [];
1230
+ for (let r = 0, a = e.length; r < a; r++) {
1231
+ const h = e[r], o = g(h);
1232
+ this.addToIndex_(o, h) && i.push(h);
1233
+ }
1234
+ for (let r = 0, a = i.length; r < a; r++) {
1235
+ const h = i[r], o = g(h);
1236
+ this.setupChangeEvents_(o, h);
1237
+ const u = h.getGeometry();
1238
+ if (u) {
1239
+ const c = u.getExtent();
1240
+ t.push(c), s.push(h);
1241
+ } else
1242
+ this.nullGeometryFeatures_[o] = h;
1243
+ }
1244
+ if (this.featuresRtree_ && this.featuresRtree_.load(t, s), this.hasListener(m.ADDFEATURE))
1245
+ for (let r = 0, a = i.length; r < a; r++)
1246
+ this.dispatchEvent(
1247
+ new _(m.ADDFEATURE, i[r])
1248
+ );
1249
+ }
1250
+ /**
1251
+ * @param {!Collection<import("../Feature.js").default<Geometry>>} collection Collection.
1252
+ * @private
1253
+ */
1254
+ bindFeaturesCollection_(e) {
1255
+ let t = !1;
1256
+ this.addEventListener(
1257
+ m.ADDFEATURE,
1258
+ /**
1259
+ * @param {VectorSourceEvent<Geometry>} evt The vector source event
1260
+ */
1261
+ function(i) {
1262
+ t || (t = !0, e.push(i.feature), t = !1);
1263
+ }
1264
+ ), this.addEventListener(
1265
+ m.REMOVEFEATURE,
1266
+ /**
1267
+ * @param {VectorSourceEvent<Geometry>} evt The vector source event
1268
+ */
1269
+ function(i) {
1270
+ t || (t = !0, e.remove(i.feature), t = !1);
1271
+ }
1272
+ ), e.addEventListener(
1273
+ R.ADD,
1274
+ /**
1275
+ * @param {import("../Collection.js").CollectionEvent<import("../Feature.js").default<Geometry>>} evt The collection event
1276
+ */
1277
+ (i) => {
1278
+ t || (t = !0, this.addFeature(i.element), t = !1);
1279
+ }
1280
+ ), e.addEventListener(
1281
+ R.REMOVE,
1282
+ /**
1283
+ * @param {import("../Collection.js").CollectionEvent<import("../Feature.js").default<Geometry>>} evt The collection event
1284
+ */
1285
+ (i) => {
1286
+ t || (t = !0, this.removeFeature(i.element), t = !1);
1287
+ }
1288
+ ), this.featuresCollection_ = e;
1289
+ }
1290
+ /**
1291
+ * Remove all features from the source.
1292
+ * @param {boolean} [fast] Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#event:removefeature} events.
1293
+ * @api
1294
+ */
1295
+ clear(e) {
1296
+ if (e) {
1297
+ for (const i in this.featureChangeKeys_)
1298
+ this.featureChangeKeys_[i].forEach(G);
1299
+ this.featuresCollection_ || (this.featureChangeKeys_ = {}, this.idIndex_ = {}, this.uidIndex_ = {});
1300
+ } else if (this.featuresRtree_) {
1301
+ const i = (s) => {
1302
+ this.removeFeatureInternal(s);
1303
+ };
1304
+ this.featuresRtree_.forEach(i);
1305
+ for (const s in this.nullGeometryFeatures_)
1306
+ this.removeFeatureInternal(this.nullGeometryFeatures_[s]);
1307
+ }
1308
+ this.featuresCollection_ && this.featuresCollection_.clear(), this.featuresRtree_ && this.featuresRtree_.clear(), this.nullGeometryFeatures_ = {};
1309
+ const t = new _(m.CLEAR);
1310
+ this.dispatchEvent(t), this.changed();
1311
+ }
1312
+ /**
1313
+ * Iterate through all features on the source, calling the provided callback
1314
+ * with each one. If the callback returns any "truthy" value, iteration will
1315
+ * stop and the function will return the same value.
1316
+ * Note: this function only iterate through the feature that have a defined geometry.
1317
+ *
1318
+ * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
1319
+ * on the source. Return a truthy value to stop iteration.
1320
+ * @return {T|undefined} The return value from the last call to the callback.
1321
+ * @template T
1322
+ * @api
1323
+ */
1324
+ forEachFeature(e) {
1325
+ if (this.featuresRtree_)
1326
+ return this.featuresRtree_.forEach(e);
1327
+ this.featuresCollection_ && this.featuresCollection_.forEach(e);
1328
+ }
1329
+ /**
1330
+ * Iterate through all features whose geometries contain the provided
1331
+ * coordinate, calling the callback with each feature. If the callback returns
1332
+ * a "truthy" value, iteration will stop and the function will return the same
1333
+ * value.
1334
+ *
1335
+ * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
1336
+ * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
1337
+ * whose goemetry contains the provided coordinate.
1338
+ * @return {T|undefined} The return value from the last call to the callback.
1339
+ * @template T
1340
+ */
1341
+ forEachFeatureAtCoordinateDirect(e, t) {
1342
+ const i = [e[0], e[1], e[0], e[1]];
1343
+ return this.forEachFeatureInExtent(i, function(s) {
1344
+ if (s.getGeometry().intersectsCoordinate(e))
1345
+ return t(s);
1346
+ });
1347
+ }
1348
+ /**
1349
+ * Iterate through all features whose bounding box intersects the provided
1350
+ * extent (note that the feature's geometry may not intersect the extent),
1351
+ * calling the callback with each feature. If the callback returns a "truthy"
1352
+ * value, iteration will stop and the function will return the same value.
1353
+ *
1354
+ * If you are interested in features whose geometry intersects an extent, call
1355
+ * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.
1356
+ *
1357
+ * When `useSpatialIndex` is set to false, this method will loop through all
1358
+ * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.
1359
+ *
1360
+ * @param {import("../extent.js").Extent} extent Extent.
1361
+ * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
1362
+ * whose bounding box intersects the provided extent.
1363
+ * @return {T|undefined} The return value from the last call to the callback.
1364
+ * @template T
1365
+ * @api
1366
+ */
1367
+ forEachFeatureInExtent(e, t) {
1368
+ if (this.featuresRtree_)
1369
+ return this.featuresRtree_.forEachInExtent(e, t);
1370
+ this.featuresCollection_ && this.featuresCollection_.forEach(t);
1371
+ }
1372
+ /**
1373
+ * Iterate through all features whose geometry intersects the provided extent,
1374
+ * calling the callback with each feature. If the callback returns a "truthy"
1375
+ * value, iteration will stop and the function will return the same value.
1376
+ *
1377
+ * If you only want to test for bounding box intersection, call the
1378
+ * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.
1379
+ *
1380
+ * @param {import("../extent.js").Extent} extent Extent.
1381
+ * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
1382
+ * whose geometry intersects the provided extent.
1383
+ * @return {T|undefined} The return value from the last call to the callback.
1384
+ * @template T
1385
+ * @api
1386
+ */
1387
+ forEachFeatureIntersectingExtent(e, t) {
1388
+ return this.forEachFeatureInExtent(
1389
+ e,
1390
+ /**
1391
+ * @param {import("../Feature.js").default<Geometry>} feature Feature.
1392
+ * @return {T|undefined} The return value from the last call to the callback.
1393
+ */
1394
+ function(i) {
1395
+ if (i.getGeometry().intersectsExtent(e)) {
1396
+ const r = t(i);
1397
+ if (r)
1398
+ return r;
1399
+ }
1400
+ }
1401
+ );
1402
+ }
1403
+ /**
1404
+ * Get the features collection associated with this source. Will be `null`
1405
+ * unless the source was configured with `useSpatialIndex` set to `false`, or
1406
+ * with an {@link module:ol/Collection~Collection} as `features`.
1407
+ * @return {Collection<import("../Feature.js").default<Geometry>>|null} The collection of features.
1408
+ * @api
1409
+ */
1410
+ getFeaturesCollection() {
1411
+ return this.featuresCollection_;
1412
+ }
1413
+ /**
1414
+ * Get a snapshot of the features currently on the source in random order. The returned array
1415
+ * is a copy, the features are references to the features in the source.
1416
+ * @return {Array<import("../Feature.js").default<Geometry>>} Features.
1417
+ * @api
1418
+ */
1419
+ getFeatures() {
1420
+ let e;
1421
+ return this.featuresCollection_ ? e = this.featuresCollection_.getArray().slice(0) : this.featuresRtree_ && (e = this.featuresRtree_.getAll(), Y(this.nullGeometryFeatures_) || ee(e, Object.values(this.nullGeometryFeatures_))), /** @type {Array<import("../Feature.js").default<Geometry>>} */
1422
+ e;
1423
+ }
1424
+ /**
1425
+ * Get all features whose geometry intersects the provided coordinate.
1426
+ * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
1427
+ * @return {Array<import("../Feature.js").default<Geometry>>} Features.
1428
+ * @api
1429
+ */
1430
+ getFeaturesAtCoordinate(e) {
1431
+ const t = [];
1432
+ return this.forEachFeatureAtCoordinateDirect(e, function(i) {
1433
+ t.push(i);
1434
+ }), t;
1435
+ }
1436
+ /**
1437
+ * Get all features whose bounding box intersects the provided extent. Note that this returns an array of
1438
+ * all features intersecting the given extent in random order (so it may include
1439
+ * features whose geometries do not intersect the extent).
1440
+ *
1441
+ * When `useSpatialIndex` is set to false, this method will return all
1442
+ * features.
1443
+ *
1444
+ * @param {import("../extent.js").Extent} extent Extent.
1445
+ * @param {import("../proj/Projection.js").default} [projection] Include features
1446
+ * where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.
1447
+ * @return {Array<import("../Feature.js").default<Geometry>>} Features.
1448
+ * @api
1449
+ */
1450
+ getFeaturesInExtent(e, t) {
1451
+ if (this.featuresRtree_) {
1452
+ if (!(t && t.canWrapX() && this.getWrapX()))
1453
+ return this.featuresRtree_.getInExtent(e);
1454
+ const s = fe(e, t);
1455
+ return [].concat(
1456
+ ...s.map((r) => this.featuresRtree_.getInExtent(r))
1457
+ );
1458
+ }
1459
+ return this.featuresCollection_ ? this.featuresCollection_.getArray().slice(0) : [];
1460
+ }
1461
+ /**
1462
+ * Get the closest feature to the provided coordinate.
1463
+ *
1464
+ * This method is not available when the source is configured with
1465
+ * `useSpatialIndex` set to `false`.
1466
+ * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
1467
+ * @param {function(import("../Feature.js").default<Geometry>):boolean} [filter] Feature filter function.
1468
+ * The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}
1469
+ * and it should return a boolean value. By default, no filtering is made.
1470
+ * @return {import("../Feature.js").default<Geometry>} Closest feature.
1471
+ * @api
1472
+ */
1473
+ getClosestFeatureToCoordinate(e, t) {
1474
+ const i = e[0], s = e[1];
1475
+ let r = null;
1476
+ const a = [NaN, NaN];
1477
+ let h = 1 / 0;
1478
+ const o = [-1 / 0, -1 / 0, 1 / 0, 1 / 0];
1479
+ return t = t || te, this.featuresRtree_.forEachInExtent(
1480
+ o,
1481
+ /**
1482
+ * @param {import("../Feature.js").default<Geometry>} feature Feature.
1483
+ */
1484
+ function(u) {
1485
+ if (t(u)) {
1486
+ const c = u.getGeometry(), l = h;
1487
+ if (h = c.closestPointXY(
1488
+ i,
1489
+ s,
1490
+ a,
1491
+ h
1492
+ ), h < l) {
1493
+ r = u;
1494
+ const d = Math.sqrt(h);
1495
+ o[0] = i - d, o[1] = s - d, o[2] = i + d, o[3] = s + d;
1496
+ }
1497
+ }
1498
+ }
1499
+ ), r;
1500
+ }
1501
+ /**
1502
+ * Get the extent of the features currently in the source.
1503
+ *
1504
+ * This method is not available when the source is configured with
1505
+ * `useSpatialIndex` set to `false`.
1506
+ * @param {import("../extent.js").Extent} [extent] Destination extent. If provided, no new extent
1507
+ * will be created. Instead, that extent's coordinates will be overwritten.
1508
+ * @return {import("../extent.js").Extent} Extent.
1509
+ * @api
1510
+ */
1511
+ getExtent(e) {
1512
+ return this.featuresRtree_.getExtent(e);
1513
+ }
1514
+ /**
1515
+ * Get a feature by its identifier (the value returned by feature.getId()).
1516
+ * Note that the index treats string and numeric identifiers as the same. So
1517
+ * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
1518
+ *
1519
+ * @param {string|number} id Feature identifier.
1520
+ * @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
1521
+ * @api
1522
+ */
1523
+ getFeatureById(e) {
1524
+ const t = this.idIndex_[e.toString()];
1525
+ return t !== void 0 ? t : null;
1526
+ }
1527
+ /**
1528
+ * Get a feature by its internal unique identifier (using `getUid`).
1529
+ *
1530
+ * @param {string} uid Feature identifier.
1531
+ * @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
1532
+ */
1533
+ getFeatureByUid(e) {
1534
+ const t = this.uidIndex_[e];
1535
+ return t !== void 0 ? t : null;
1536
+ }
1537
+ /**
1538
+ * Get the format associated with this source.
1539
+ *
1540
+ * @return {import("../format/Feature.js").default|undefined} The feature format.
1541
+ * @api
1542
+ */
1543
+ getFormat() {
1544
+ return this.format_;
1545
+ }
1546
+ /**
1547
+ * @return {boolean} The source can have overlapping geometries.
1548
+ */
1549
+ getOverlaps() {
1550
+ return this.overlaps_;
1551
+ }
1552
+ /**
1553
+ * Get the url associated with this source.
1554
+ *
1555
+ * @return {string|import("../featureloader.js").FeatureUrlFunction|undefined} The url.
1556
+ * @api
1557
+ */
1558
+ getUrl() {
1559
+ return this.url_;
1560
+ }
1561
+ /**
1562
+ * @param {Event} event Event.
1563
+ * @private
1564
+ */
1565
+ handleFeatureChange_(e) {
1566
+ const t = (
1567
+ /** @type {import("../Feature.js").default<Geometry>} */
1568
+ e.target
1569
+ ), i = g(t), s = t.getGeometry();
1570
+ if (!s)
1571
+ i in this.nullGeometryFeatures_ || (this.featuresRtree_ && this.featuresRtree_.remove(t), this.nullGeometryFeatures_[i] = t);
1572
+ else {
1573
+ const a = s.getExtent();
1574
+ i in this.nullGeometryFeatures_ ? (delete this.nullGeometryFeatures_[i], this.featuresRtree_ && this.featuresRtree_.insert(a, t)) : this.featuresRtree_ && this.featuresRtree_.update(a, t);
1575
+ }
1576
+ const r = t.getId();
1577
+ if (r !== void 0) {
1578
+ const a = r.toString();
1579
+ this.idIndex_[a] !== t && (this.removeFromIdIndex_(t), this.idIndex_[a] = t);
1580
+ } else
1581
+ this.removeFromIdIndex_(t), this.uidIndex_[i] = t;
1582
+ this.changed(), this.dispatchEvent(
1583
+ new _(m.CHANGEFEATURE, t)
1584
+ );
1585
+ }
1586
+ /**
1587
+ * Returns true if the feature is contained within the source.
1588
+ * @param {import("../Feature.js").default<Geometry>} feature Feature.
1589
+ * @return {boolean} Has feature.
1590
+ * @api
1591
+ */
1592
+ hasFeature(e) {
1593
+ const t = e.getId();
1594
+ return t !== void 0 ? t in this.idIndex_ : g(e) in this.uidIndex_;
1595
+ }
1596
+ /**
1597
+ * @return {boolean} Is empty.
1598
+ */
1599
+ isEmpty() {
1600
+ return this.featuresRtree_ ? this.featuresRtree_.isEmpty() && Y(this.nullGeometryFeatures_) : this.featuresCollection_ ? this.featuresCollection_.getLength() === 0 : !0;
1601
+ }
1602
+ /**
1603
+ * @param {import("../extent.js").Extent} extent Extent.
1604
+ * @param {number} resolution Resolution.
1605
+ * @param {import("../proj/Projection.js").default} projection Projection.
1606
+ */
1607
+ loadFeatures(e, t, i) {
1608
+ const s = this.loadedExtentsRtree_, r = this.strategy_(e, t, i);
1609
+ for (let a = 0, h = r.length; a < h; ++a) {
1610
+ const o = r[a];
1611
+ s.forEachInExtent(
1612
+ o,
1613
+ /**
1614
+ * @param {{extent: import("../extent.js").Extent}} object Object.
1615
+ * @return {boolean} Contains.
1616
+ */
1617
+ function(c) {
1618
+ return me(c.extent, o);
1619
+ }
1620
+ ) || (++this.loadingExtentsCount_, this.dispatchEvent(
1621
+ new _(m.FEATURESLOADSTART)
1622
+ ), this.loader_.call(
1623
+ this,
1624
+ o,
1625
+ t,
1626
+ i,
1627
+ (c) => {
1628
+ --this.loadingExtentsCount_, this.dispatchEvent(
1629
+ new _(
1630
+ m.FEATURESLOADEND,
1631
+ void 0,
1632
+ c
1633
+ )
1634
+ );
1635
+ },
1636
+ () => {
1637
+ --this.loadingExtentsCount_, this.dispatchEvent(
1638
+ new _(m.FEATURESLOADERROR)
1639
+ );
1640
+ }
1641
+ ), s.insert(o, { extent: o.slice() }));
1642
+ }
1643
+ this.loading = this.loader_.length < 4 ? !1 : this.loadingExtentsCount_ > 0;
1644
+ }
1645
+ refresh() {
1646
+ this.clear(!0), this.loadedExtentsRtree_.clear(), super.refresh();
1647
+ }
1648
+ /**
1649
+ * Remove an extent from the list of loaded extents.
1650
+ * @param {import("../extent.js").Extent} extent Extent.
1651
+ * @api
1652
+ */
1653
+ removeLoadedExtent(e) {
1654
+ const t = this.loadedExtentsRtree_;
1655
+ let i;
1656
+ t.forEachInExtent(e, function(s) {
1657
+ if (J(s.extent, e))
1658
+ return i = s, !0;
1659
+ }), i && t.remove(i);
1660
+ }
1661
+ /**
1662
+ * Remove a single feature from the source. If you want to remove all features
1663
+ * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method
1664
+ * instead.
1665
+ * @param {import("../Feature.js").default<Geometry>} feature Feature to remove.
1666
+ * @api
1667
+ */
1668
+ removeFeature(e) {
1669
+ if (!e)
1670
+ return;
1671
+ const t = g(e);
1672
+ t in this.nullGeometryFeatures_ ? delete this.nullGeometryFeatures_[t] : this.featuresRtree_ && this.featuresRtree_.remove(e), this.removeFeatureInternal(e) && this.changed();
1673
+ }
1674
+ /**
1675
+ * Remove feature without firing a `change` event.
1676
+ * @param {import("../Feature.js").default<Geometry>} feature Feature.
1677
+ * @return {import("../Feature.js").default<Geometry>|undefined} The removed feature
1678
+ * (or undefined if the feature was not found).
1679
+ * @protected
1680
+ */
1681
+ removeFeatureInternal(e) {
1682
+ const t = g(e), i = this.featureChangeKeys_[t];
1683
+ if (!i)
1684
+ return;
1685
+ i.forEach(G), delete this.featureChangeKeys_[t];
1686
+ const s = e.getId();
1687
+ return s !== void 0 && delete this.idIndex_[s.toString()], delete this.uidIndex_[t], this.dispatchEvent(
1688
+ new _(m.REMOVEFEATURE, e)
1689
+ ), e;
1690
+ }
1691
+ /**
1692
+ * Remove a feature from the id index. Called internally when the feature id
1693
+ * may have changed.
1694
+ * @param {import("../Feature.js").default<Geometry>} feature The feature.
1695
+ * @return {boolean} Removed the feature from the index.
1696
+ * @private
1697
+ */
1698
+ removeFromIdIndex_(e) {
1699
+ let t = !1;
1700
+ for (const i in this.idIndex_)
1701
+ if (this.idIndex_[i] === e) {
1702
+ delete this.idIndex_[i], t = !0;
1703
+ break;
1704
+ }
1705
+ return t;
1706
+ }
1707
+ /**
1708
+ * Set the new loader of the source. The next render cycle will use the
1709
+ * new loader.
1710
+ * @param {import("../featureloader.js").FeatureLoader} loader The loader to set.
1711
+ * @api
1712
+ */
1713
+ setLoader(e) {
1714
+ this.loader_ = e;
1715
+ }
1716
+ /**
1717
+ * Points the source to a new url. The next render cycle will use the new url.
1718
+ * @param {string|import("../featureloader.js").FeatureUrlFunction} url Url.
1719
+ * @api
1720
+ */
1721
+ setUrl(e) {
1722
+ T(this.format_, 7), this.url_ = e, this.setLoader(K(e, this.format_));
1723
+ }
1724
+ }
1725
+ export {
1726
+ Oe as B,
1727
+ ge as C,
1728
+ De as L,
1729
+ Le as R,
1730
+ be as V,
1731
+ m as a,
1732
+ R as b,
1733
+ W as c,
1734
+ Te as l
1735
+ };