@maptiler/geocoding-control 2.1.7 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +46 -0
- package/CONTRIBUTING.md +72 -0
- package/README.md +115 -43
- package/SECURITY.md +16 -0
- package/dist/index.js +860 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +263 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/leaflet.public.js +1251 -0
- package/dist/leaflet.public.js.map +1 -0
- package/dist/leaflet.public.umd.js +276 -0
- package/dist/leaflet.public.umd.js.map +1 -0
- package/dist/maplibregl.js +1275 -0
- package/dist/maplibregl.js.map +1 -0
- package/dist/maplibregl.umd.js +276 -0
- package/dist/maplibregl.umd.js.map +1 -0
- package/dist/maptilersdk.js +1283 -0
- package/dist/maptilersdk.js.map +1 -0
- package/dist/maptilersdk.umd.js +276 -0
- package/dist/maptilersdk.umd.js.map +1 -0
- package/dist/src/components/clear-icon.d.ts +10 -0
- package/dist/src/components/fail-icon.d.ts +10 -0
- package/dist/src/components/loading-icon.d.ts +10 -0
- package/dist/src/components/marker.d.ts +10 -0
- package/dist/src/components/reverse-geocoding-icon.d.ts +10 -0
- package/dist/src/components/search-icon.d.ts +10 -0
- package/dist/src/controls/base-control.d.ts +44 -0
- package/dist/src/controls/leaflet-control.d.ts +27 -0
- package/dist/src/controls/leaflet-events.d.ts +42 -0
- package/dist/src/controls/leaflet-options.d.ts +84 -0
- package/dist/src/controls/maplibregl-control.d.ts +34 -0
- package/dist/src/controls/maplibregl-events.d.ts +44 -0
- package/dist/src/controls/maplibregl-options.d.ts +104 -0
- package/dist/src/controls/maptilersdk-control.d.ts +7 -0
- package/dist/src/controls/maptilersdk-events.d.ts +2 -0
- package/dist/src/controls/maptilersdk-options.d.ts +10 -0
- package/dist/src/controls/openlayers-control.d.ts +35 -0
- package/dist/src/controls/openlayers-events.d.ts +43 -0
- package/dist/src/controls/openlayers-options.d.ts +83 -0
- package/dist/src/geocoder/geocoder-events.d.ts +46 -0
- package/dist/src/geocoder/geocoder-feature-item.d.ts +22 -0
- package/{svelte/types.d.ts → dist/src/geocoder/geocoder-options.d.ts} +23 -143
- package/dist/src/geocoder/geocoder.d.ts +113 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/leaflet.public.d.ts +7 -0
- package/dist/src/maplibregl.d.ts +7 -0
- package/dist/src/maptilersdk.d.ts +7 -0
- package/dist/src/openlayers.public.d.ts +7 -0
- package/dist/src/types.d.ts +46 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/mask.d.ts +2 -0
- package/dist/src/utils/proximity.d.ts +2 -0
- package/package.json +84 -112
- package/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/geo-coordinates-parser.t.d.ts +0 -8
- package/geoUtils.d.ts +0 -3
- package/leaflet-controller.d.ts +0 -12
- package/leaflet-controller.js +0 -2475
- package/leaflet-controller.js.map +0 -1
- package/leaflet-controller.umd.js +0 -2
- package/leaflet-controller.umd.js.map +0 -1
- package/leaflet.d.ts +0 -131
- package/leaflet.js +0 -5082
- package/leaflet.js.map +0 -1
- package/leaflet.umd.js +0 -14
- package/leaflet.umd.js.map +0 -1
- package/maplibregl-controller.d.ts +0 -19
- package/maplibregl-controller.js +0 -2418
- package/maplibregl-controller.js.map +0 -1
- package/maplibregl-controller.umd.js +0 -2
- package/maplibregl-controller.umd.js.map +0 -1
- package/maplibregl.d.ts +0 -2509
- package/maplibregl.js +0 -5142
- package/maplibregl.js.map +0 -1
- package/maplibregl.umd.js +0 -14
- package/maplibregl.umd.js.map +0 -1
- package/maptilersdk.d.ts +0 -2504
- package/maptilersdk.js +0 -5152
- package/maptilersdk.js.map +0 -1
- package/maptilersdk.umd.js +0 -14
- package/maptilersdk.umd.js.map +0 -1
- package/mask.d.ts +0 -2
- package/openlayers-controller.d.ts +0 -15
- package/openlayers-controller.js +0 -2174
- package/openlayers-controller.js.map +0 -1
- package/openlayers-controller.umd.js +0 -2
- package/openlayers-controller.umd.js.map +0 -1
- package/openlayers.d.ts +0 -109
- package/openlayers.js +0 -5045
- package/openlayers.js.map +0 -1
- package/openlayers.umd.js +0 -14
- package/openlayers.umd.js.map +0 -1
- package/proximity.d.ts +0 -2
- package/react.d.ts +0 -45
- package/react.js +0 -2795
- package/react.js.map +0 -1
- package/react.umd.js +0 -14
- package/react.umd.js.map +0 -1
- package/style.css +0 -1
- package/svelte/ClearIcon.svelte +0 -12
- package/svelte/ClearIcon.svelte.d.ts +0 -25
- package/svelte/FailIcon.svelte +0 -12
- package/svelte/FailIcon.svelte.d.ts +0 -25
- package/svelte/FeatureItem.svelte +0 -246
- package/svelte/FeatureItem.svelte.d.ts +0 -26
- package/svelte/GeocodingControl.svelte +0 -921
- package/svelte/GeocodingControl.svelte.d.ts +0 -105
- package/svelte/LoadingIcon.svelte +0 -40
- package/svelte/LoadingIcon.svelte.d.ts +0 -25
- package/svelte/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/svelte/MapLibreBasedGeocodingControl.js +0 -210
- package/svelte/MarkerIcon.svelte +0 -71
- package/svelte/MarkerIcon.svelte.d.ts +0 -18
- package/svelte/ReverseGeocodingIcon.svelte +0 -12
- package/svelte/ReverseGeocodingIcon.svelte.d.ts +0 -25
- package/svelte/SearchIcon.svelte +0 -26
- package/svelte/SearchIcon.svelte.d.ts +0 -25
- package/svelte/geo-coordinates-parser.t.d.ts +0 -8
- package/svelte/geo-coordinates-parser.t.js +0 -1
- package/svelte/geoUtils.d.ts +0 -3
- package/svelte/geoUtils.js +0 -18
- package/svelte/info.json +0 -1
- package/svelte/leaflet-controller.d.ts +0 -12
- package/svelte/leaflet-controller.js +0 -274
- package/svelte/leaflet.d.ts +0 -131
- package/svelte/leaflet.js +0 -116
- package/svelte/maplibregl-controller.d.ts +0 -19
- package/svelte/maplibregl-controller.js +0 -279
- package/svelte/maplibregl.d.ts +0 -2509
- package/svelte/maplibregl.js +0 -17
- package/svelte/maptilersdk.d.ts +0 -2504
- package/svelte/maptilersdk.js +0 -32
- package/svelte/mask.d.ts +0 -2
- package/svelte/mask.js +0 -54
- package/svelte/openlayers-controller.d.ts +0 -15
- package/svelte/openlayers-controller.js +0 -283
- package/svelte/openlayers.d.ts +0 -109
- package/svelte/openlayers.js +0 -178
- package/svelte/proximity.d.ts +0 -2
- package/svelte/proximity.js +0 -60
- package/svelte/react.d.ts +0 -45
- package/svelte/react.js +0 -106
- package/svelte/types.js +0 -1
- package/svelte/vanilla.d.ts +0 -61
- package/svelte/vanilla.js +0 -101
- package/svelte/vite-env.d.ts +0 -2
- package/types.d.ts +0 -391
- package/vanilla.d.ts +0 -61
- package/vanilla.js +0 -2799
- package/vanilla.js.map +0 -1
- package/vanilla.umd.js +0 -14
- package/vanilla.umd.js.map +0 -1
- /package/{icons → dist/icons}/10pin.svg +0 -0
- /package/{icons → dist/icons}/9pin.svg +0 -0
- /package/{icons → dist/icons}/advertising_column.svg +0 -0
- /package/{icons → dist/icons}/aerodrome.svg +0 -0
- /package/{icons → dist/icons}/alcohol.svg +0 -0
- /package/{icons → dist/icons}/alpine_hut.svg +0 -0
- /package/{icons → dist/icons}/amusement_arcade.svg +0 -0
- /package/{icons → dist/icons}/amusement_park.svg +0 -0
- /package/{icons → dist/icons}/apartment.svg +0 -0
- /package/{icons → dist/icons}/archaeological_site.svg +0 -0
- /package/{icons → dist/icons}/area.svg +0 -0
- /package/{icons → dist/icons}/art.svg +0 -0
- /package/{icons → dist/icons}/arts_centre.svg +0 -0
- /package/{icons → dist/icons}/artwork.svg +0 -0
- /package/{icons → dist/icons}/audioguide.svg +0 -0
- /package/{icons → dist/icons}/bag.svg +0 -0
- /package/{icons → dist/icons}/beauty.svg +0 -0
- /package/{icons → dist/icons}/bed.svg +0 -0
- /package/{icons → dist/icons}/bell_tower.svg +0 -0
- /package/{icons → dist/icons}/beverages.svg +0 -0
- /package/{icons → dist/icons}/bicycle_repair_station.svg +0 -0
- /package/{icons → dist/icons}/biergarten.svg +0 -0
- /package/{icons → dist/icons}/bird_hide.svg +0 -0
- /package/{icons → dist/icons}/boat_rental.svg +0 -0
- /package/{icons → dist/icons}/bookmaker.svg +0 -0
- /package/{icons → dist/icons}/books.svg +0 -0
- /package/{icons → dist/icons}/bowl.svg +0 -0
- /package/{icons → dist/icons}/bowling_alley.svg +0 -0
- /package/{icons → dist/icons}/bunker.svg +0 -0
- /package/{icons → dist/icons}/bureau_de_change.svg +0 -0
- /package/{icons → dist/icons}/bus_station.svg +0 -0
- /package/{icons → dist/icons}/bust.svg +0 -0
- /package/{icons → dist/icons}/camping.svg +0 -0
- /package/{icons → dist/icons}/car_parts.svg +0 -0
- /package/{icons → dist/icons}/car_wash.svg +0 -0
- /package/{icons → dist/icons}/caravan_park.svg +0 -0
- /package/{icons → dist/icons}/carpet.svg +0 -0
- /package/{icons → dist/icons}/cattle_grid.svg +0 -0
- /package/{icons → dist/icons}/cave_entrance.svg +0 -0
- /package/{icons → dist/icons}/chalet.svg +0 -0
- /package/{icons → dist/icons}/charity.svg +0 -0
- /package/{icons → dist/icons}/chemist.svg +0 -0
- /package/{icons → dist/icons}/chimney.svg +0 -0
- /package/{icons → dist/icons}/church.svg +0 -0
- /package/{icons → dist/icons}/city_gate.svg +0 -0
- /package/{icons → dist/icons}/clinic.svg +0 -0
- /package/{icons → dist/icons}/clothes.svg +0 -0
- /package/{icons → dist/icons}/coffee.svg +0 -0
- /package/{icons → dist/icons}/community_centre.svg +0 -0
- /package/{icons → dist/icons}/computer.svg +0 -0
- /package/{icons → dist/icons}/consulate.svg +0 -0
- /package/{icons → dist/icons}/copyshop.svg +0 -0
- /package/{icons → dist/icons}/cosmetics.svg +0 -0
- /package/{icons → dist/icons}/courthouse.svg +0 -0
- /package/{icons → dist/icons}/crane.svg +0 -0
- /package/{icons → dist/icons}/dairy.svg +0 -0
- /package/{icons → dist/icons}/deli.svg +0 -0
- /package/{icons → dist/icons}/department_store.svg +0 -0
- /package/{icons → dist/icons}/diy.svg +0 -0
- /package/{icons → dist/icons}/electronics.svg +0 -0
- /package/{icons → dist/icons}/embankment.svg +0 -0
- /package/{icons → dist/icons}/embassy.svg +0 -0
- /package/{icons → dist/icons}/excrement_bags.svg +0 -0
- /package/{icons → dist/icons}/fabric.svg +0 -0
- /package/{icons → dist/icons}/farmyard.svg +0 -0
- /package/{icons → dist/icons}/ferry.svg +0 -0
- /package/{icons → dist/icons}/firepit.svg +0 -0
- /package/{icons → dist/icons}/firestation.svg +0 -0
- /package/{icons → dist/icons}/fishing.svg +0 -0
- /package/{icons → dist/icons}/fitness.svg +0 -0
- /package/{icons → dist/icons}/ford.svg +0 -0
- /package/{icons → dist/icons}/fort.svg +0 -0
- /package/{icons → dist/icons}/fortress.svg +0 -0
- /package/{icons → dist/icons}/full-height_turnstile.svg +0 -0
- /package/{icons → dist/icons}/generator_wind.svg +0 -0
- /package/{icons → dist/icons}/golf_pin.svg +0 -0
- /package/{icons → dist/icons}/greengrocer.svg +0 -0
- /package/{icons → dist/icons}/guest_house.svg +0 -0
- /package/{icons → dist/icons}/helipad.svg +0 -0
- /package/{icons → dist/icons}/hifi.svg +0 -0
- /package/{icons → dist/icons}/hostel.svg +0 -0
- /package/{icons → dist/icons}/hotel.svg +0 -0
- /package/{icons → dist/icons}/housenumber.svg +0 -0
- /package/{icons → dist/icons}/houseware.svg +0 -0
- /package/{icons → dist/icons}/hunting_stand.svg +0 -0
- /package/{icons → dist/icons}/interior_decoration.svg +0 -0
- /package/{icons → dist/icons}/internet_cafe.svg +0 -0
- /package/{icons → dist/icons}/kindergarten.svg +0 -0
- /package/{icons → dist/icons}/kissing_gate.svg +0 -0
- /package/{icons → dist/icons}/manor.svg +0 -0
- /package/{icons → dist/icons}/map.svg +0 -0
- /package/{icons → dist/icons}/marker_reverse.svg +0 -0
- /package/{icons → dist/icons}/marker_selected.svg +0 -0
- /package/{icons → dist/icons}/marker_unselected.svg +0 -0
- /package/{icons → dist/icons}/marketplace.svg +0 -0
- /package/{icons → dist/icons}/massage.svg +0 -0
- /package/{icons → dist/icons}/mast.svg +0 -0
- /package/{icons → dist/icons}/mast_communications.svg +0 -0
- /package/{icons → dist/icons}/mast_lighting.svg +0 -0
- /package/{icons → dist/icons}/medical_supply.svg +0 -0
- /package/{icons → dist/icons}/memorial.svg +0 -0
- /package/{icons → dist/icons}/miniature_golf.svg +0 -0
- /package/{icons → dist/icons}/motel.svg +0 -0
- /package/{icons → dist/icons}/mountain_range.svg +0 -0
- /package/{icons → dist/icons}/multifaith.svg +0 -0
- /package/{icons → dist/icons}/musical_instrument.svg +0 -0
- /package/{icons → dist/icons}/newsagent.svg +0 -0
- /package/{icons → dist/icons}/nightclub.svg +0 -0
- /package/{icons → dist/icons}/ocean.svg +0 -0
- /package/{icons → dist/icons}/office.svg +0 -0
- /package/{icons → dist/icons}/outdoor_seating.svg +0 -0
- /package/{icons → dist/icons}/palace.svg +0 -0
- /package/{icons → dist/icons}/parcel_locker.svg +0 -0
- /package/{icons → dist/icons}/parking_space.svg +0 -0
- /package/{icons → dist/icons}/parking_tickets.svg +0 -0
- /package/{icons → dist/icons}/pet.svg +0 -0
- /package/{icons → dist/icons}/photo.svg +0 -0
- /package/{icons → dist/icons}/picnic.svg +0 -0
- /package/{icons → dist/icons}/plaque.svg +0 -0
- /package/{icons → dist/icons}/poi.svg +0 -0
- /package/{icons → dist/icons}/post_box.svg +0 -0
- /package/{icons → dist/icons}/post_office.svg +0 -0
- /package/{icons → dist/icons}/postal_code.svg +0 -0
- /package/{icons → dist/icons}/pub.svg +0 -0
- /package/{icons → dist/icons}/public_bath.svg +0 -0
- /package/{icons → dist/icons}/public_bookcase.svg +0 -0
- /package/{icons → dist/icons}/public_building.svg +0 -0
- /package/{icons → dist/icons}/public_transport_tickets.svg +0 -0
- /package/{icons → dist/icons}/reverse.svg +0 -0
- /package/{icons → dist/icons}/river.svg +0 -0
- /package/{icons → dist/icons}/road.svg +0 -0
- /package/{icons → dist/icons}/saddle.svg +0 -0
- /package/{icons → dist/icons}/sauna.svg +0 -0
- /package/{icons → dist/icons}/sea.svg +0 -0
- /package/{icons → dist/icons}/second_hand.svg +0 -0
- /package/{icons → dist/icons}/shintoist.svg +0 -0
- /package/{icons → dist/icons}/shoe.svg +0 -0
- /package/{icons → dist/icons}/shower.svg +0 -0
- /package/{icons → dist/icons}/shrine.svg +0 -0
- /package/{icons → dist/icons}/sikhist.svg +0 -0
- /package/{icons → dist/icons}/slipway.svg +0 -0
- /package/{icons → dist/icons}/snowmobile.svg +0 -0
- /package/{icons → dist/icons}/social_facility.svg +0 -0
- /package/{icons → dist/icons}/sports.svg +0 -0
- /package/{icons → dist/icons}/sprite.json +0 -0
- /package/{icons → dist/icons}/sprite.png +0 -0
- /package/{icons → dist/icons}/sprite@2x.json +0 -0
- /package/{icons → dist/icons}/sprite@2x.png +0 -0
- /package/{icons → dist/icons}/stationery.svg +0 -0
- /package/{icons → dist/icons}/stile.svg +0 -0
- /package/{icons → dist/icons}/stone.svg +0 -0
- /package/{icons → dist/icons}/storage_tank.svg +0 -0
- /package/{icons → dist/icons}/stream.svg +0 -0
- /package/{icons → dist/icons}/street.svg +0 -0
- /package/{icons → dist/icons}/supermarket.svg +0 -0
- /package/{icons → dist/icons}/tea.svg +0 -0
- /package/{icons → dist/icons}/telescope_dish.svg +0 -0
- /package/{icons → dist/icons}/telescope_dome.svg +0 -0
- /package/{icons → dist/icons}/ticket.svg +0 -0
- /package/{icons → dist/icons}/tobacco.svg +0 -0
- /package/{icons → dist/icons}/tower_cantilever_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_cooling.svg +0 -0
- /package/{icons → dist/icons}/tower_dish.svg +0 -0
- /package/{icons → dist/icons}/tower_dome.svg +0 -0
- /package/{icons → dist/icons}/tower_generic.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_lighting.svg +0 -0
- /package/{icons → dist/icons}/tower_lighting.svg +0 -0
- /package/{icons → dist/icons}/townhall.svg +0 -0
- /package/{icons → dist/icons}/toys.svg +0 -0
- /package/{icons → dist/icons}/trade.svg +0 -0
- /package/{icons → dist/icons}/traffic_light.svg +0 -0
- /package/{icons → dist/icons}/train_station.svg +0 -0
- /package/{icons → dist/icons}/travel_agency.svg +0 -0
- /package/{icons → dist/icons}/tyres.svg +0 -0
- /package/{icons → dist/icons}/university.svg +0 -0
- /package/{icons → dist/icons}/variety_store.svg +0 -0
- /package/{icons → dist/icons}/vehicle_inspection.svg +0 -0
- /package/{icons → dist/icons}/vending_machine.svg +0 -0
- /package/{icons → dist/icons}/video.svg +0 -0
- /package/{icons → dist/icons}/video_games.svg +0 -0
- /package/{icons → dist/icons}/waste_disposal.svg +0 -0
- /package/{icons → dist/icons}/water_well.svg +0 -0
- /package/{icons → dist/icons}/waterfall.svg +0 -0
- /package/{icons → dist/icons}/wilderness_hut.svg +0 -0
package/leaflet-controller.js
DELETED
|
@@ -1,2475 +0,0 @@
|
|
|
1
|
-
var Pt = Object.defineProperty;
|
|
2
|
-
var Ot = (t, e, n) => e in t ? Pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var C = (t, e, n) => Ot(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import * as ce from "leaflet";
|
|
5
|
-
function Ee(t, e, n = {}) {
|
|
6
|
-
const i = { type: "Feature" };
|
|
7
|
-
return (n.id === 0 || n.id) && (i.id = n.id), n.bbox && (i.bbox = n.bbox), i.properties = e || {}, i.geometry = t, i;
|
|
8
|
-
}
|
|
9
|
-
function Ze(t, e, n = {}) {
|
|
10
|
-
for (const r of t) {
|
|
11
|
-
if (r.length < 4)
|
|
12
|
-
throw new Error(
|
|
13
|
-
"Each LinearRing of a Polygon must have 4 or more Positions."
|
|
14
|
-
);
|
|
15
|
-
if (r[r.length - 1].length !== r[0].length)
|
|
16
|
-
throw new Error("First and last Position are not equivalent.");
|
|
17
|
-
for (let u = 0; u < r[r.length - 1].length; u++)
|
|
18
|
-
if (r[r.length - 1][u] !== r[0][u])
|
|
19
|
-
throw new Error("First and last Position are not equivalent.");
|
|
20
|
-
}
|
|
21
|
-
return Ee({
|
|
22
|
-
type: "Polygon",
|
|
23
|
-
coordinates: t
|
|
24
|
-
}, e, n);
|
|
25
|
-
}
|
|
26
|
-
function ve(t, e = {}) {
|
|
27
|
-
const n = { type: "FeatureCollection" };
|
|
28
|
-
return e.id && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.features = t, n;
|
|
29
|
-
}
|
|
30
|
-
function gt(t, e, n = {}) {
|
|
31
|
-
return Ee({
|
|
32
|
-
type: "MultiPolygon",
|
|
33
|
-
coordinates: t
|
|
34
|
-
}, e, n);
|
|
35
|
-
}
|
|
36
|
-
function yt(t, e, n) {
|
|
37
|
-
if (t !== null)
|
|
38
|
-
for (var i, r, u, a, h, E, p, _ = 0, b = 0, M, T = t.type, L = T === "FeatureCollection", B = T === "Feature", q = L ? t.features.length : 1, I = 0; I < q; I++) {
|
|
39
|
-
p = L ? t.features[I].geometry : B ? t.geometry : t, M = p ? p.type === "GeometryCollection" : !1, h = M ? p.geometries.length : 1;
|
|
40
|
-
for (var v = 0; v < h; v++) {
|
|
41
|
-
var N = 0, $ = 0;
|
|
42
|
-
if (a = M ? p.geometries[v] : p, a !== null) {
|
|
43
|
-
E = a.coordinates;
|
|
44
|
-
var K = a.type;
|
|
45
|
-
switch (_ = 0, K) {
|
|
46
|
-
case null:
|
|
47
|
-
break;
|
|
48
|
-
case "Point":
|
|
49
|
-
if (e(
|
|
50
|
-
E,
|
|
51
|
-
b,
|
|
52
|
-
I,
|
|
53
|
-
N,
|
|
54
|
-
$
|
|
55
|
-
) === !1)
|
|
56
|
-
return !1;
|
|
57
|
-
b++, N++;
|
|
58
|
-
break;
|
|
59
|
-
case "LineString":
|
|
60
|
-
case "MultiPoint":
|
|
61
|
-
for (i = 0; i < E.length; i++) {
|
|
62
|
-
if (e(
|
|
63
|
-
E[i],
|
|
64
|
-
b,
|
|
65
|
-
I,
|
|
66
|
-
N,
|
|
67
|
-
$
|
|
68
|
-
) === !1)
|
|
69
|
-
return !1;
|
|
70
|
-
b++, K === "MultiPoint" && N++;
|
|
71
|
-
}
|
|
72
|
-
K === "LineString" && N++;
|
|
73
|
-
break;
|
|
74
|
-
case "Polygon":
|
|
75
|
-
case "MultiLineString":
|
|
76
|
-
for (i = 0; i < E.length; i++) {
|
|
77
|
-
for (r = 0; r < E[i].length - _; r++) {
|
|
78
|
-
if (e(
|
|
79
|
-
E[i][r],
|
|
80
|
-
b,
|
|
81
|
-
I,
|
|
82
|
-
N,
|
|
83
|
-
$
|
|
84
|
-
) === !1)
|
|
85
|
-
return !1;
|
|
86
|
-
b++;
|
|
87
|
-
}
|
|
88
|
-
K === "MultiLineString" && N++, K === "Polygon" && $++;
|
|
89
|
-
}
|
|
90
|
-
K === "Polygon" && N++;
|
|
91
|
-
break;
|
|
92
|
-
case "MultiPolygon":
|
|
93
|
-
for (i = 0; i < E.length; i++) {
|
|
94
|
-
for ($ = 0, r = 0; r < E[i].length; r++) {
|
|
95
|
-
for (u = 0; u < E[i][r].length - _; u++) {
|
|
96
|
-
if (e(
|
|
97
|
-
E[i][r][u],
|
|
98
|
-
b,
|
|
99
|
-
I,
|
|
100
|
-
N,
|
|
101
|
-
$
|
|
102
|
-
) === !1)
|
|
103
|
-
return !1;
|
|
104
|
-
b++;
|
|
105
|
-
}
|
|
106
|
-
$++;
|
|
107
|
-
}
|
|
108
|
-
N++;
|
|
109
|
-
}
|
|
110
|
-
break;
|
|
111
|
-
case "GeometryCollection":
|
|
112
|
-
for (i = 0; i < a.geometries.length; i++)
|
|
113
|
-
if (yt(a.geometries[i], e) === !1)
|
|
114
|
-
return !1;
|
|
115
|
-
break;
|
|
116
|
-
default:
|
|
117
|
-
throw new Error("Unknown Geometry Type");
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function Ye(t, e) {
|
|
124
|
-
var n, i, r, u, a, h, E, p, _, b, M = 0, T = t.type === "FeatureCollection", L = t.type === "Feature", B = T ? t.features.length : 1;
|
|
125
|
-
for (n = 0; n < B; n++) {
|
|
126
|
-
for (h = T ? t.features[n].geometry : L ? t.geometry : t, p = T ? t.features[n].properties : L ? t.properties : {}, _ = T ? t.features[n].bbox : L ? t.bbox : void 0, b = T ? t.features[n].id : L ? t.id : void 0, E = h ? h.type === "GeometryCollection" : !1, a = E ? h.geometries.length : 1, r = 0; r < a; r++) {
|
|
127
|
-
if (u = E ? h.geometries[r] : h, u === null) {
|
|
128
|
-
if (e(
|
|
129
|
-
null,
|
|
130
|
-
M,
|
|
131
|
-
p,
|
|
132
|
-
_,
|
|
133
|
-
b
|
|
134
|
-
) === !1)
|
|
135
|
-
return !1;
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
switch (u.type) {
|
|
139
|
-
case "Point":
|
|
140
|
-
case "LineString":
|
|
141
|
-
case "MultiPoint":
|
|
142
|
-
case "Polygon":
|
|
143
|
-
case "MultiLineString":
|
|
144
|
-
case "MultiPolygon": {
|
|
145
|
-
if (e(
|
|
146
|
-
u,
|
|
147
|
-
M,
|
|
148
|
-
p,
|
|
149
|
-
_,
|
|
150
|
-
b
|
|
151
|
-
) === !1)
|
|
152
|
-
return !1;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
case "GeometryCollection": {
|
|
156
|
-
for (i = 0; i < u.geometries.length; i++)
|
|
157
|
-
if (e(
|
|
158
|
-
u.geometries[i],
|
|
159
|
-
M,
|
|
160
|
-
p,
|
|
161
|
-
_,
|
|
162
|
-
b
|
|
163
|
-
) === !1)
|
|
164
|
-
return !1;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
default:
|
|
168
|
-
throw new Error("Unknown Geometry Type");
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
M++;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function Rt(t, e) {
|
|
175
|
-
Ye(t, function(n, i, r, u, a) {
|
|
176
|
-
var h = n === null ? null : n.type;
|
|
177
|
-
switch (h) {
|
|
178
|
-
case null:
|
|
179
|
-
case "Point":
|
|
180
|
-
case "LineString":
|
|
181
|
-
case "Polygon":
|
|
182
|
-
return e(
|
|
183
|
-
Ee(n, r, { bbox: u, id: a }),
|
|
184
|
-
i,
|
|
185
|
-
0
|
|
186
|
-
) === !1 ? !1 : void 0;
|
|
187
|
-
}
|
|
188
|
-
var E;
|
|
189
|
-
switch (h) {
|
|
190
|
-
case "MultiPoint":
|
|
191
|
-
E = "Point";
|
|
192
|
-
break;
|
|
193
|
-
case "MultiLineString":
|
|
194
|
-
E = "LineString";
|
|
195
|
-
break;
|
|
196
|
-
case "MultiPolygon":
|
|
197
|
-
E = "Polygon";
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
for (var p = 0; p < n.coordinates.length; p++) {
|
|
201
|
-
var _ = n.coordinates[p], b = {
|
|
202
|
-
type: E,
|
|
203
|
-
coordinates: _
|
|
204
|
-
};
|
|
205
|
-
if (e(Ee(b, r), i, p) === !1)
|
|
206
|
-
return !1;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
function Nt(t, e = {}) {
|
|
211
|
-
if (t.bbox != null && e.recompute !== !0)
|
|
212
|
-
return t.bbox;
|
|
213
|
-
const n = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
|
|
214
|
-
return yt(t, (i) => {
|
|
215
|
-
n[0] > i[0] && (n[0] = i[0]), n[1] > i[1] && (n[1] = i[1]), n[2] < i[0] && (n[2] = i[0]), n[3] < i[1] && (n[3] = i[1]);
|
|
216
|
-
}), n;
|
|
217
|
-
}
|
|
218
|
-
var qe = Nt;
|
|
219
|
-
function At(t) {
|
|
220
|
-
if (!t)
|
|
221
|
-
throw new Error("geojson is required");
|
|
222
|
-
switch (t.type) {
|
|
223
|
-
case "Feature":
|
|
224
|
-
return dt(t);
|
|
225
|
-
case "FeatureCollection":
|
|
226
|
-
return It(t);
|
|
227
|
-
case "Point":
|
|
228
|
-
case "LineString":
|
|
229
|
-
case "Polygon":
|
|
230
|
-
case "MultiPoint":
|
|
231
|
-
case "MultiLineString":
|
|
232
|
-
case "MultiPolygon":
|
|
233
|
-
case "GeometryCollection":
|
|
234
|
-
return We(t);
|
|
235
|
-
default:
|
|
236
|
-
throw new Error("unknown GeoJSON type");
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function dt(t) {
|
|
240
|
-
const e = { type: "Feature" };
|
|
241
|
-
return Object.keys(t).forEach((n) => {
|
|
242
|
-
switch (n) {
|
|
243
|
-
case "type":
|
|
244
|
-
case "properties":
|
|
245
|
-
case "geometry":
|
|
246
|
-
return;
|
|
247
|
-
default:
|
|
248
|
-
e[n] = t[n];
|
|
249
|
-
}
|
|
250
|
-
}), e.properties = mt(t.properties), t.geometry == null ? e.geometry = null : e.geometry = We(t.geometry), e;
|
|
251
|
-
}
|
|
252
|
-
function mt(t) {
|
|
253
|
-
const e = {};
|
|
254
|
-
return t && Object.keys(t).forEach((n) => {
|
|
255
|
-
const i = t[n];
|
|
256
|
-
typeof i == "object" ? i === null ? e[n] = null : Array.isArray(i) ? e[n] = i.map((r) => r) : e[n] = mt(i) : e[n] = i;
|
|
257
|
-
}), e;
|
|
258
|
-
}
|
|
259
|
-
function It(t) {
|
|
260
|
-
const e = { type: "FeatureCollection" };
|
|
261
|
-
return Object.keys(t).forEach((n) => {
|
|
262
|
-
switch (n) {
|
|
263
|
-
case "type":
|
|
264
|
-
case "features":
|
|
265
|
-
return;
|
|
266
|
-
default:
|
|
267
|
-
e[n] = t[n];
|
|
268
|
-
}
|
|
269
|
-
}), e.features = t.features.map((n) => dt(n)), e;
|
|
270
|
-
}
|
|
271
|
-
function We(t) {
|
|
272
|
-
const e = { type: t.type };
|
|
273
|
-
return t.bbox && (e.bbox = t.bbox), t.type === "GeometryCollection" ? (e.geometries = t.geometries.map((n) => We(n)), e) : (e.coordinates = xt(t.coordinates), e);
|
|
274
|
-
}
|
|
275
|
-
function xt(t) {
|
|
276
|
-
const e = t;
|
|
277
|
-
return typeof e[0] != "object" ? e.slice() : e.map((n) => xt(n));
|
|
278
|
-
}
|
|
279
|
-
var kt = At, Bt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Be = Math.ceil, j = Math.floor, Z = "[BigNumber Error] ", He = Z + "Number primitive has more than 15 significant digits: ", ee = 1e14, R = 14, je = 9007199254740991, Ge = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], le = 1e7, Y = 1e9;
|
|
280
|
-
function wt(t) {
|
|
281
|
-
var e, n, i, r = v.prototype = { constructor: v, toString: null, valueOf: null }, u = new v(1), a = 20, h = 4, E = -7, p = 21, _ = -1e7, b = 1e7, M = !1, T = 1, L = 0, B = {
|
|
282
|
-
prefix: "",
|
|
283
|
-
groupSize: 3,
|
|
284
|
-
secondaryGroupSize: 0,
|
|
285
|
-
groupSeparator: ",",
|
|
286
|
-
decimalSeparator: ".",
|
|
287
|
-
fractionGroupSize: 0,
|
|
288
|
-
fractionGroupSeparator: " ",
|
|
289
|
-
// non-breaking space
|
|
290
|
-
suffix: ""
|
|
291
|
-
}, q = "0123456789abcdefghijklmnopqrstuvwxyz", I = !0;
|
|
292
|
-
function v(s, o) {
|
|
293
|
-
var l, m, c, y, w, f, g, x, d = this;
|
|
294
|
-
if (!(d instanceof v)) return new v(s, o);
|
|
295
|
-
if (o == null) {
|
|
296
|
-
if (s && s._isBigNumber === !0) {
|
|
297
|
-
d.s = s.s, !s.c || s.e > b ? d.c = d.e = null : s.e < _ ? d.c = [d.e = 0] : (d.e = s.e, d.c = s.c.slice());
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
if ((f = typeof s == "number") && s * 0 == 0) {
|
|
301
|
-
if (d.s = 1 / s < 0 ? (s = -s, -1) : 1, s === ~~s) {
|
|
302
|
-
for (y = 0, w = s; w >= 10; w /= 10, y++) ;
|
|
303
|
-
y > b ? d.c = d.e = null : (d.e = y, d.c = [s]);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
x = String(s);
|
|
307
|
-
} else {
|
|
308
|
-
if (!Bt.test(x = String(s))) return i(d, x, f);
|
|
309
|
-
d.s = x.charCodeAt(0) == 45 ? (x = x.slice(1), -1) : 1;
|
|
310
|
-
}
|
|
311
|
-
(y = x.indexOf(".")) > -1 && (x = x.replace(".", "")), (w = x.search(/e/i)) > 0 ? (y < 0 && (y = w), y += +x.slice(w + 1), x = x.substring(0, w)) : y < 0 && (y = x.length);
|
|
312
|
-
} else {
|
|
313
|
-
if (F(o, 2, q.length, "Base"), o == 10 && I)
|
|
314
|
-
return d = new v(s), W(d, a + d.e + 1, h);
|
|
315
|
-
if (x = String(s), f = typeof s == "number") {
|
|
316
|
-
if (s * 0 != 0) return i(d, x, f, o);
|
|
317
|
-
if (d.s = 1 / s < 0 ? (x = x.slice(1), -1) : 1, v.DEBUG && x.replace(/^0\.0*|\./, "").length > 15)
|
|
318
|
-
throw Error(He + s);
|
|
319
|
-
} else
|
|
320
|
-
d.s = x.charCodeAt(0) === 45 ? (x = x.slice(1), -1) : 1;
|
|
321
|
-
for (l = q.slice(0, o), y = w = 0, g = x.length; w < g; w++)
|
|
322
|
-
if (l.indexOf(m = x.charAt(w)) < 0) {
|
|
323
|
-
if (m == ".") {
|
|
324
|
-
if (w > y) {
|
|
325
|
-
y = g;
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
} else if (!c && (x == x.toUpperCase() && (x = x.toLowerCase()) || x == x.toLowerCase() && (x = x.toUpperCase()))) {
|
|
329
|
-
c = !0, w = -1, y = 0;
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
return i(d, String(s), f, o);
|
|
333
|
-
}
|
|
334
|
-
f = !1, x = n(x, o, 10, d.s), (y = x.indexOf(".")) > -1 ? x = x.replace(".", "") : y = x.length;
|
|
335
|
-
}
|
|
336
|
-
for (w = 0; x.charCodeAt(w) === 48; w++) ;
|
|
337
|
-
for (g = x.length; x.charCodeAt(--g) === 48; ) ;
|
|
338
|
-
if (x = x.slice(w, ++g)) {
|
|
339
|
-
if (g -= w, f && v.DEBUG && g > 15 && (s > je || s !== j(s)))
|
|
340
|
-
throw Error(He + d.s * s);
|
|
341
|
-
if ((y = y - w - 1) > b)
|
|
342
|
-
d.c = d.e = null;
|
|
343
|
-
else if (y < _)
|
|
344
|
-
d.c = [d.e = 0];
|
|
345
|
-
else {
|
|
346
|
-
if (d.e = y, d.c = [], w = (y + 1) % R, y < 0 && (w += R), w < g) {
|
|
347
|
-
for (w && d.c.push(+x.slice(0, w)), g -= R; w < g; )
|
|
348
|
-
d.c.push(+x.slice(w, w += R));
|
|
349
|
-
w = R - (x = x.slice(w)).length;
|
|
350
|
-
} else
|
|
351
|
-
w -= g;
|
|
352
|
-
for (; w--; x += "0") ;
|
|
353
|
-
d.c.push(+x);
|
|
354
|
-
}
|
|
355
|
-
} else
|
|
356
|
-
d.c = [d.e = 0];
|
|
357
|
-
}
|
|
358
|
-
v.clone = wt, v.ROUND_UP = 0, v.ROUND_DOWN = 1, v.ROUND_CEIL = 2, v.ROUND_FLOOR = 3, v.ROUND_HALF_UP = 4, v.ROUND_HALF_DOWN = 5, v.ROUND_HALF_EVEN = 6, v.ROUND_HALF_CEIL = 7, v.ROUND_HALF_FLOOR = 8, v.EUCLID = 9, v.config = v.set = function(s) {
|
|
359
|
-
var o, l;
|
|
360
|
-
if (s != null)
|
|
361
|
-
if (typeof s == "object") {
|
|
362
|
-
if (s.hasOwnProperty(o = "DECIMAL_PLACES") && (l = s[o], F(l, 0, Y, o), a = l), s.hasOwnProperty(o = "ROUNDING_MODE") && (l = s[o], F(l, 0, 8, o), h = l), s.hasOwnProperty(o = "EXPONENTIAL_AT") && (l = s[o], l && l.pop ? (F(l[0], -1e9, 0, o), F(l[1], 0, Y, o), E = l[0], p = l[1]) : (F(l, -1e9, Y, o), E = -(p = l < 0 ? -l : l))), s.hasOwnProperty(o = "RANGE"))
|
|
363
|
-
if (l = s[o], l && l.pop)
|
|
364
|
-
F(l[0], -1e9, -1, o), F(l[1], 1, Y, o), _ = l[0], b = l[1];
|
|
365
|
-
else if (F(l, -1e9, Y, o), l)
|
|
366
|
-
_ = -(b = l < 0 ? -l : l);
|
|
367
|
-
else
|
|
368
|
-
throw Error(Z + o + " cannot be zero: " + l);
|
|
369
|
-
if (s.hasOwnProperty(o = "CRYPTO"))
|
|
370
|
-
if (l = s[o], l === !!l)
|
|
371
|
-
if (l)
|
|
372
|
-
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
373
|
-
M = l;
|
|
374
|
-
else
|
|
375
|
-
throw M = !l, Error(Z + "crypto unavailable");
|
|
376
|
-
else
|
|
377
|
-
M = l;
|
|
378
|
-
else
|
|
379
|
-
throw Error(Z + o + " not true or false: " + l);
|
|
380
|
-
if (s.hasOwnProperty(o = "MODULO_MODE") && (l = s[o], F(l, 0, 9, o), T = l), s.hasOwnProperty(o = "POW_PRECISION") && (l = s[o], F(l, 0, Y, o), L = l), s.hasOwnProperty(o = "FORMAT"))
|
|
381
|
-
if (l = s[o], typeof l == "object") B = l;
|
|
382
|
-
else throw Error(Z + o + " not an object: " + l);
|
|
383
|
-
if (s.hasOwnProperty(o = "ALPHABET"))
|
|
384
|
-
if (l = s[o], typeof l == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(l))
|
|
385
|
-
I = l.slice(0, 10) == "0123456789", q = l;
|
|
386
|
-
else
|
|
387
|
-
throw Error(Z + o + " invalid: " + l);
|
|
388
|
-
} else
|
|
389
|
-
throw Error(Z + "Object expected: " + s);
|
|
390
|
-
return {
|
|
391
|
-
DECIMAL_PLACES: a,
|
|
392
|
-
ROUNDING_MODE: h,
|
|
393
|
-
EXPONENTIAL_AT: [E, p],
|
|
394
|
-
RANGE: [_, b],
|
|
395
|
-
CRYPTO: M,
|
|
396
|
-
MODULO_MODE: T,
|
|
397
|
-
POW_PRECISION: L,
|
|
398
|
-
FORMAT: B,
|
|
399
|
-
ALPHABET: q
|
|
400
|
-
};
|
|
401
|
-
}, v.isBigNumber = function(s) {
|
|
402
|
-
if (!s || s._isBigNumber !== !0) return !1;
|
|
403
|
-
if (!v.DEBUG) return !0;
|
|
404
|
-
var o, l, m = s.c, c = s.e, y = s.s;
|
|
405
|
-
e: if ({}.toString.call(m) == "[object Array]") {
|
|
406
|
-
if ((y === 1 || y === -1) && c >= -1e9 && c <= Y && c === j(c)) {
|
|
407
|
-
if (m[0] === 0) {
|
|
408
|
-
if (c === 0 && m.length === 1) return !0;
|
|
409
|
-
break e;
|
|
410
|
-
}
|
|
411
|
-
if (o = (c + 1) % R, o < 1 && (o += R), String(m[0]).length == o) {
|
|
412
|
-
for (o = 0; o < m.length; o++)
|
|
413
|
-
if (l = m[o], l < 0 || l >= ee || l !== j(l)) break e;
|
|
414
|
-
if (l !== 0) return !0;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
} else if (m === null && c === null && (y === null || y === 1 || y === -1))
|
|
418
|
-
return !0;
|
|
419
|
-
throw Error(Z + "Invalid BigNumber: " + s);
|
|
420
|
-
}, v.maximum = v.max = function() {
|
|
421
|
-
return $(arguments, -1);
|
|
422
|
-
}, v.minimum = v.min = function() {
|
|
423
|
-
return $(arguments, 1);
|
|
424
|
-
}, v.random = function() {
|
|
425
|
-
var s = 9007199254740992, o = Math.random() * s & 2097151 ? function() {
|
|
426
|
-
return j(Math.random() * s);
|
|
427
|
-
} : function() {
|
|
428
|
-
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
429
|
-
};
|
|
430
|
-
return function(l) {
|
|
431
|
-
var m, c, y, w, f, g = 0, x = [], d = new v(u);
|
|
432
|
-
if (l == null ? l = a : F(l, 0, Y), w = Be(l / R), M)
|
|
433
|
-
if (crypto.getRandomValues) {
|
|
434
|
-
for (m = crypto.getRandomValues(new Uint32Array(w *= 2)); g < w; )
|
|
435
|
-
f = m[g] * 131072 + (m[g + 1] >>> 11), f >= 9e15 ? (c = crypto.getRandomValues(new Uint32Array(2)), m[g] = c[0], m[g + 1] = c[1]) : (x.push(f % 1e14), g += 2);
|
|
436
|
-
g = w / 2;
|
|
437
|
-
} else if (crypto.randomBytes) {
|
|
438
|
-
for (m = crypto.randomBytes(w *= 7); g < w; )
|
|
439
|
-
f = (m[g] & 31) * 281474976710656 + m[g + 1] * 1099511627776 + m[g + 2] * 4294967296 + m[g + 3] * 16777216 + (m[g + 4] << 16) + (m[g + 5] << 8) + m[g + 6], f >= 9e15 ? crypto.randomBytes(7).copy(m, g) : (x.push(f % 1e14), g += 7);
|
|
440
|
-
g = w / 7;
|
|
441
|
-
} else
|
|
442
|
-
throw M = !1, Error(Z + "crypto unavailable");
|
|
443
|
-
if (!M)
|
|
444
|
-
for (; g < w; )
|
|
445
|
-
f = o(), f < 9e15 && (x[g++] = f % 1e14);
|
|
446
|
-
for (w = x[--g], l %= R, w && l && (f = Ge[R - l], x[g] = j(w / f) * f); x[g] === 0; x.pop(), g--) ;
|
|
447
|
-
if (g < 0)
|
|
448
|
-
x = [y = 0];
|
|
449
|
-
else {
|
|
450
|
-
for (y = -1; x[0] === 0; x.splice(0, 1), y -= R) ;
|
|
451
|
-
for (g = 1, f = x[0]; f >= 10; f /= 10, g++) ;
|
|
452
|
-
g < R && (y -= R - g);
|
|
453
|
-
}
|
|
454
|
-
return d.e = y, d.c = x, d;
|
|
455
|
-
};
|
|
456
|
-
}(), v.sum = function() {
|
|
457
|
-
for (var s = 1, o = arguments, l = new v(o[0]); s < o.length; ) l = l.plus(o[s++]);
|
|
458
|
-
return l;
|
|
459
|
-
}, n = /* @__PURE__ */ function() {
|
|
460
|
-
var s = "0123456789";
|
|
461
|
-
function o(l, m, c, y) {
|
|
462
|
-
for (var w, f = [0], g, x = 0, d = l.length; x < d; ) {
|
|
463
|
-
for (g = f.length; g--; f[g] *= m) ;
|
|
464
|
-
for (f[0] += y.indexOf(l.charAt(x++)), w = 0; w < f.length; w++)
|
|
465
|
-
f[w] > c - 1 && (f[w + 1] == null && (f[w + 1] = 0), f[w + 1] += f[w] / c | 0, f[w] %= c);
|
|
466
|
-
}
|
|
467
|
-
return f.reverse();
|
|
468
|
-
}
|
|
469
|
-
return function(l, m, c, y, w) {
|
|
470
|
-
var f, g, x, d, S, P, O, k, D = l.indexOf("."), U = a, A = h;
|
|
471
|
-
for (D >= 0 && (d = L, L = 0, l = l.replace(".", ""), k = new v(m), P = k.pow(l.length - D), L = d, k.c = o(
|
|
472
|
-
se(H(P.c), P.e, "0"),
|
|
473
|
-
10,
|
|
474
|
-
c,
|
|
475
|
-
s
|
|
476
|
-
), k.e = k.c.length), O = o(l, m, c, w ? (f = q, s) : (f = s, q)), x = d = O.length; O[--d] == 0; O.pop()) ;
|
|
477
|
-
if (!O[0]) return f.charAt(0);
|
|
478
|
-
if (D < 0 ? --x : (P.c = O, P.e = x, P.s = y, P = e(P, k, U, A, c), O = P.c, S = P.r, x = P.e), g = x + U + 1, D = O[g], d = c / 2, S = S || g < 0 || O[g + 1] != null, S = A < 4 ? (D != null || S) && (A == 0 || A == (P.s < 0 ? 3 : 2)) : D > d || D == d && (A == 4 || S || A == 6 && O[g - 1] & 1 || A == (P.s < 0 ? 8 : 7)), g < 1 || !O[0])
|
|
479
|
-
l = S ? se(f.charAt(1), -U, f.charAt(0)) : f.charAt(0);
|
|
480
|
-
else {
|
|
481
|
-
if (O.length = g, S)
|
|
482
|
-
for (--c; ++O[--g] > c; )
|
|
483
|
-
O[g] = 0, g || (++x, O = [1].concat(O));
|
|
484
|
-
for (d = O.length; !O[--d]; ) ;
|
|
485
|
-
for (D = 0, l = ""; D <= d; l += f.charAt(O[D++])) ;
|
|
486
|
-
l = se(l, x, f.charAt(0));
|
|
487
|
-
}
|
|
488
|
-
return l;
|
|
489
|
-
};
|
|
490
|
-
}(), e = /* @__PURE__ */ function() {
|
|
491
|
-
function s(m, c, y) {
|
|
492
|
-
var w, f, g, x, d = 0, S = m.length, P = c % le, O = c / le | 0;
|
|
493
|
-
for (m = m.slice(); S--; )
|
|
494
|
-
g = m[S] % le, x = m[S] / le | 0, w = O * g + x * P, f = P * g + w % le * le + d, d = (f / y | 0) + (w / le | 0) + O * x, m[S] = f % y;
|
|
495
|
-
return d && (m = [d].concat(m)), m;
|
|
496
|
-
}
|
|
497
|
-
function o(m, c, y, w) {
|
|
498
|
-
var f, g;
|
|
499
|
-
if (y != w)
|
|
500
|
-
g = y > w ? 1 : -1;
|
|
501
|
-
else
|
|
502
|
-
for (f = g = 0; f < y; f++)
|
|
503
|
-
if (m[f] != c[f]) {
|
|
504
|
-
g = m[f] > c[f] ? 1 : -1;
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
return g;
|
|
508
|
-
}
|
|
509
|
-
function l(m, c, y, w) {
|
|
510
|
-
for (var f = 0; y--; )
|
|
511
|
-
m[y] -= f, f = m[y] < c[y] ? 1 : 0, m[y] = f * w + m[y] - c[y];
|
|
512
|
-
for (; !m[0] && m.length > 1; m.splice(0, 1)) ;
|
|
513
|
-
}
|
|
514
|
-
return function(m, c, y, w, f) {
|
|
515
|
-
var g, x, d, S, P, O, k, D, U, A, G, V, be, Ie, ke, te, ge, J = m.s == c.s ? 1 : -1, X = m.c, z = c.c;
|
|
516
|
-
if (!X || !X[0] || !z || !z[0])
|
|
517
|
-
return new v(
|
|
518
|
-
// Return NaN if either NaN, or both Infinity or 0.
|
|
519
|
-
!m.s || !c.s || (X ? z && X[0] == z[0] : !z) ? NaN : (
|
|
520
|
-
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
521
|
-
X && X[0] == 0 || !z ? J * 0 : J / 0
|
|
522
|
-
)
|
|
523
|
-
);
|
|
524
|
-
for (D = new v(J), U = D.c = [], x = m.e - c.e, J = y + x + 1, f || (f = ee, x = Q(m.e / R) - Q(c.e / R), J = J / R | 0), d = 0; z[d] == (X[d] || 0); d++) ;
|
|
525
|
-
if (z[d] > (X[d] || 0) && x--, J < 0)
|
|
526
|
-
U.push(1), S = !0;
|
|
527
|
-
else {
|
|
528
|
-
for (Ie = X.length, te = z.length, d = 0, J += 2, P = j(f / (z[0] + 1)), P > 1 && (z = s(z, P, f), X = s(X, P, f), te = z.length, Ie = X.length), be = te, A = X.slice(0, te), G = A.length; G < te; A[G++] = 0) ;
|
|
529
|
-
ge = z.slice(), ge = [0].concat(ge), ke = z[0], z[1] >= f / 2 && ke++;
|
|
530
|
-
do {
|
|
531
|
-
if (P = 0, g = o(z, A, te, G), g < 0) {
|
|
532
|
-
if (V = A[0], te != G && (V = V * f + (A[1] || 0)), P = j(V / ke), P > 1)
|
|
533
|
-
for (P >= f && (P = f - 1), O = s(z, P, f), k = O.length, G = A.length; o(O, A, k, G) == 1; )
|
|
534
|
-
P--, l(O, te < k ? ge : z, k, f), k = O.length, g = 1;
|
|
535
|
-
else
|
|
536
|
-
P == 0 && (g = P = 1), O = z.slice(), k = O.length;
|
|
537
|
-
if (k < G && (O = [0].concat(O)), l(A, O, G, f), G = A.length, g == -1)
|
|
538
|
-
for (; o(z, A, te, G) < 1; )
|
|
539
|
-
P++, l(A, te < G ? ge : z, G, f), G = A.length;
|
|
540
|
-
} else g === 0 && (P++, A = [0]);
|
|
541
|
-
U[d++] = P, A[0] ? A[G++] = X[be] || 0 : (A = [X[be]], G = 1);
|
|
542
|
-
} while ((be++ < Ie || A[0] != null) && J--);
|
|
543
|
-
S = A[0] != null, U[0] || U.splice(0, 1);
|
|
544
|
-
}
|
|
545
|
-
if (f == ee) {
|
|
546
|
-
for (d = 1, J = U[0]; J >= 10; J /= 10, d++) ;
|
|
547
|
-
W(D, y + (D.e = d + x * R - 1) + 1, w, S);
|
|
548
|
-
} else
|
|
549
|
-
D.e = x, D.r = +S;
|
|
550
|
-
return D;
|
|
551
|
-
};
|
|
552
|
-
}();
|
|
553
|
-
function N(s, o, l, m) {
|
|
554
|
-
var c, y, w, f, g;
|
|
555
|
-
if (l == null ? l = h : F(l, 0, 8), !s.c) return s.toString();
|
|
556
|
-
if (c = s.c[0], w = s.e, o == null)
|
|
557
|
-
g = H(s.c), g = m == 1 || m == 2 && (w <= E || w >= p) ? Te(g, w) : se(g, w, "0");
|
|
558
|
-
else if (s = W(new v(s), o, l), y = s.e, g = H(s.c), f = g.length, m == 1 || m == 2 && (o <= y || y <= E)) {
|
|
559
|
-
for (; f < o; g += "0", f++) ;
|
|
560
|
-
g = Te(g, y);
|
|
561
|
-
} else if (o -= w, g = se(g, y, "0"), y + 1 > f) {
|
|
562
|
-
if (--o > 0) for (g += "."; o--; g += "0") ;
|
|
563
|
-
} else if (o += y - f, o > 0)
|
|
564
|
-
for (y + 1 == f && (g += "."); o--; g += "0") ;
|
|
565
|
-
return s.s < 0 && c ? "-" + g : g;
|
|
566
|
-
}
|
|
567
|
-
function $(s, o) {
|
|
568
|
-
for (var l, m, c = 1, y = new v(s[0]); c < s.length; c++)
|
|
569
|
-
m = new v(s[c]), (!m.s || (l = fe(y, m)) === o || l === 0 && y.s === o) && (y = m);
|
|
570
|
-
return y;
|
|
571
|
-
}
|
|
572
|
-
function K(s, o, l) {
|
|
573
|
-
for (var m = 1, c = o.length; !o[--c]; o.pop()) ;
|
|
574
|
-
for (c = o[0]; c >= 10; c /= 10, m++) ;
|
|
575
|
-
return (l = m + l * R - 1) > b ? s.c = s.e = null : l < _ ? s.c = [s.e = 0] : (s.e = l, s.c = o), s;
|
|
576
|
-
}
|
|
577
|
-
i = /* @__PURE__ */ function() {
|
|
578
|
-
var s = /^(-?)0([xbo])(?=\w[\w.]*$)/i, o = /^([^.]+)\.$/, l = /^\.([^.]+)$/, m = /^-?(Infinity|NaN)$/, c = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
|
579
|
-
return function(y, w, f, g) {
|
|
580
|
-
var x, d = f ? w : w.replace(c, "");
|
|
581
|
-
if (m.test(d))
|
|
582
|
-
y.s = isNaN(d) ? null : d < 0 ? -1 : 1;
|
|
583
|
-
else {
|
|
584
|
-
if (!f && (d = d.replace(s, function(S, P, O) {
|
|
585
|
-
return x = (O = O.toLowerCase()) == "x" ? 16 : O == "b" ? 2 : 8, !g || g == x ? P : S;
|
|
586
|
-
}), g && (x = g, d = d.replace(o, "$1").replace(l, "0.$1")), w != d))
|
|
587
|
-
return new v(d, x);
|
|
588
|
-
if (v.DEBUG)
|
|
589
|
-
throw Error(Z + "Not a" + (g ? " base " + g : "") + " number: " + w);
|
|
590
|
-
y.s = null;
|
|
591
|
-
}
|
|
592
|
-
y.c = y.e = null;
|
|
593
|
-
};
|
|
594
|
-
}();
|
|
595
|
-
function W(s, o, l, m) {
|
|
596
|
-
var c, y, w, f, g, x, d, S = s.c, P = Ge;
|
|
597
|
-
if (S) {
|
|
598
|
-
e: {
|
|
599
|
-
for (c = 1, f = S[0]; f >= 10; f /= 10, c++) ;
|
|
600
|
-
if (y = o - c, y < 0)
|
|
601
|
-
y += R, w = o, g = S[x = 0], d = j(g / P[c - w - 1] % 10);
|
|
602
|
-
else if (x = Be((y + 1) / R), x >= S.length)
|
|
603
|
-
if (m) {
|
|
604
|
-
for (; S.length <= x; S.push(0)) ;
|
|
605
|
-
g = d = 0, c = 1, y %= R, w = y - R + 1;
|
|
606
|
-
} else
|
|
607
|
-
break e;
|
|
608
|
-
else {
|
|
609
|
-
for (g = f = S[x], c = 1; f >= 10; f /= 10, c++) ;
|
|
610
|
-
y %= R, w = y - R + c, d = w < 0 ? 0 : j(g / P[c - w - 1] % 10);
|
|
611
|
-
}
|
|
612
|
-
if (m = m || o < 0 || // Are there any non-zero digits after the rounding digit?
|
|
613
|
-
// The expression n % pows10[d - j - 1] returns all digits of n to the right
|
|
614
|
-
// of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
|
|
615
|
-
S[x + 1] != null || (w < 0 ? g : g % P[c - w - 1]), m = l < 4 ? (d || m) && (l == 0 || l == (s.s < 0 ? 3 : 2)) : d > 5 || d == 5 && (l == 4 || m || l == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
616
|
-
(y > 0 ? w > 0 ? g / P[c - w] : 0 : S[x - 1]) % 10 & 1 || l == (s.s < 0 ? 8 : 7)), o < 1 || !S[0])
|
|
617
|
-
return S.length = 0, m ? (o -= s.e + 1, S[0] = P[(R - o % R) % R], s.e = -o || 0) : S[0] = s.e = 0, s;
|
|
618
|
-
if (y == 0 ? (S.length = x, f = 1, x--) : (S.length = x + 1, f = P[R - y], S[x] = w > 0 ? j(g / P[c - w] % P[w]) * f : 0), m)
|
|
619
|
-
for (; ; )
|
|
620
|
-
if (x == 0) {
|
|
621
|
-
for (y = 1, w = S[0]; w >= 10; w /= 10, y++) ;
|
|
622
|
-
for (w = S[0] += f, f = 1; w >= 10; w /= 10, f++) ;
|
|
623
|
-
y != f && (s.e++, S[0] == ee && (S[0] = 1));
|
|
624
|
-
break;
|
|
625
|
-
} else {
|
|
626
|
-
if (S[x] += f, S[x] != ee) break;
|
|
627
|
-
S[x--] = 0, f = 1;
|
|
628
|
-
}
|
|
629
|
-
for (y = S.length; S[--y] === 0; S.pop()) ;
|
|
630
|
-
}
|
|
631
|
-
s.e > b ? s.c = s.e = null : s.e < _ && (s.c = [s.e = 0]);
|
|
632
|
-
}
|
|
633
|
-
return s;
|
|
634
|
-
}
|
|
635
|
-
function re(s) {
|
|
636
|
-
var o, l = s.e;
|
|
637
|
-
return l === null ? s.toString() : (o = H(s.c), o = l <= E || l >= p ? Te(o, l) : se(o, l, "0"), s.s < 0 ? "-" + o : o);
|
|
638
|
-
}
|
|
639
|
-
return r.absoluteValue = r.abs = function() {
|
|
640
|
-
var s = new v(this);
|
|
641
|
-
return s.s < 0 && (s.s = 1), s;
|
|
642
|
-
}, r.comparedTo = function(s, o) {
|
|
643
|
-
return fe(this, new v(s, o));
|
|
644
|
-
}, r.decimalPlaces = r.dp = function(s, o) {
|
|
645
|
-
var l, m, c, y = this;
|
|
646
|
-
if (s != null)
|
|
647
|
-
return F(s, 0, Y), o == null ? o = h : F(o, 0, 8), W(new v(y), s + y.e + 1, o);
|
|
648
|
-
if (!(l = y.c)) return null;
|
|
649
|
-
if (m = ((c = l.length - 1) - Q(this.e / R)) * R, c = l[c]) for (; c % 10 == 0; c /= 10, m--) ;
|
|
650
|
-
return m < 0 && (m = 0), m;
|
|
651
|
-
}, r.dividedBy = r.div = function(s, o) {
|
|
652
|
-
return e(this, new v(s, o), a, h);
|
|
653
|
-
}, r.dividedToIntegerBy = r.idiv = function(s, o) {
|
|
654
|
-
return e(this, new v(s, o), 0, 1);
|
|
655
|
-
}, r.exponentiatedBy = r.pow = function(s, o) {
|
|
656
|
-
var l, m, c, y, w, f, g, x, d, S = this;
|
|
657
|
-
if (s = new v(s), s.c && !s.isInteger())
|
|
658
|
-
throw Error(Z + "Exponent not an integer: " + re(s));
|
|
659
|
-
if (o != null && (o = new v(o)), f = s.e > 14, !S.c || !S.c[0] || S.c[0] == 1 && !S.e && S.c.length == 1 || !s.c || !s.c[0])
|
|
660
|
-
return d = new v(Math.pow(+re(S), f ? s.s * (2 - _e(s)) : +re(s))), o ? d.mod(o) : d;
|
|
661
|
-
if (g = s.s < 0, o) {
|
|
662
|
-
if (o.c ? !o.c[0] : !o.s) return new v(NaN);
|
|
663
|
-
m = !g && S.isInteger() && o.isInteger(), m && (S = S.mod(o));
|
|
664
|
-
} else {
|
|
665
|
-
if (s.e > 9 && (S.e > 0 || S.e < -1 || (S.e == 0 ? S.c[0] > 1 || f && S.c[1] >= 24e7 : S.c[0] < 8e13 || f && S.c[0] <= 9999975e7)))
|
|
666
|
-
return y = S.s < 0 && _e(s) ? -0 : 0, S.e > -1 && (y = 1 / y), new v(g ? 1 / y : y);
|
|
667
|
-
L && (y = Be(L / R + 2));
|
|
668
|
-
}
|
|
669
|
-
for (f ? (l = new v(0.5), g && (s.s = 1), x = _e(s)) : (c = Math.abs(+re(s)), x = c % 2), d = new v(u); ; ) {
|
|
670
|
-
if (x) {
|
|
671
|
-
if (d = d.times(S), !d.c) break;
|
|
672
|
-
y ? d.c.length > y && (d.c.length = y) : m && (d = d.mod(o));
|
|
673
|
-
}
|
|
674
|
-
if (c) {
|
|
675
|
-
if (c = j(c / 2), c === 0) break;
|
|
676
|
-
x = c % 2;
|
|
677
|
-
} else if (s = s.times(l), W(s, s.e + 1, 1), s.e > 14)
|
|
678
|
-
x = _e(s);
|
|
679
|
-
else {
|
|
680
|
-
if (c = +re(s), c === 0) break;
|
|
681
|
-
x = c % 2;
|
|
682
|
-
}
|
|
683
|
-
S = S.times(S), y ? S.c && S.c.length > y && (S.c.length = y) : m && (S = S.mod(o));
|
|
684
|
-
}
|
|
685
|
-
return m ? d : (g && (d = u.div(d)), o ? d.mod(o) : y ? W(d, L, h, w) : d);
|
|
686
|
-
}, r.integerValue = function(s) {
|
|
687
|
-
var o = new v(this);
|
|
688
|
-
return s == null ? s = h : F(s, 0, 8), W(o, o.e + 1, s);
|
|
689
|
-
}, r.isEqualTo = r.eq = function(s, o) {
|
|
690
|
-
return fe(this, new v(s, o)) === 0;
|
|
691
|
-
}, r.isFinite = function() {
|
|
692
|
-
return !!this.c;
|
|
693
|
-
}, r.isGreaterThan = r.gt = function(s, o) {
|
|
694
|
-
return fe(this, new v(s, o)) > 0;
|
|
695
|
-
}, r.isGreaterThanOrEqualTo = r.gte = function(s, o) {
|
|
696
|
-
return (o = fe(this, new v(s, o))) === 1 || o === 0;
|
|
697
|
-
}, r.isInteger = function() {
|
|
698
|
-
return !!this.c && Q(this.e / R) > this.c.length - 2;
|
|
699
|
-
}, r.isLessThan = r.lt = function(s, o) {
|
|
700
|
-
return fe(this, new v(s, o)) < 0;
|
|
701
|
-
}, r.isLessThanOrEqualTo = r.lte = function(s, o) {
|
|
702
|
-
return (o = fe(this, new v(s, o))) === -1 || o === 0;
|
|
703
|
-
}, r.isNaN = function() {
|
|
704
|
-
return !this.s;
|
|
705
|
-
}, r.isNegative = function() {
|
|
706
|
-
return this.s < 0;
|
|
707
|
-
}, r.isPositive = function() {
|
|
708
|
-
return this.s > 0;
|
|
709
|
-
}, r.isZero = function() {
|
|
710
|
-
return !!this.c && this.c[0] == 0;
|
|
711
|
-
}, r.minus = function(s, o) {
|
|
712
|
-
var l, m, c, y, w = this, f = w.s;
|
|
713
|
-
if (s = new v(s, o), o = s.s, !f || !o) return new v(NaN);
|
|
714
|
-
if (f != o)
|
|
715
|
-
return s.s = -o, w.plus(s);
|
|
716
|
-
var g = w.e / R, x = s.e / R, d = w.c, S = s.c;
|
|
717
|
-
if (!g || !x) {
|
|
718
|
-
if (!d || !S) return d ? (s.s = -o, s) : new v(S ? w : NaN);
|
|
719
|
-
if (!d[0] || !S[0])
|
|
720
|
-
return S[0] ? (s.s = -o, s) : new v(d[0] ? w : (
|
|
721
|
-
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
722
|
-
h == 3 ? -0 : 0
|
|
723
|
-
));
|
|
724
|
-
}
|
|
725
|
-
if (g = Q(g), x = Q(x), d = d.slice(), f = g - x) {
|
|
726
|
-
for ((y = f < 0) ? (f = -f, c = d) : (x = g, c = S), c.reverse(), o = f; o--; c.push(0)) ;
|
|
727
|
-
c.reverse();
|
|
728
|
-
} else
|
|
729
|
-
for (m = (y = (f = d.length) < (o = S.length)) ? f : o, f = o = 0; o < m; o++)
|
|
730
|
-
if (d[o] != S[o]) {
|
|
731
|
-
y = d[o] < S[o];
|
|
732
|
-
break;
|
|
733
|
-
}
|
|
734
|
-
if (y && (c = d, d = S, S = c, s.s = -s.s), o = (m = S.length) - (l = d.length), o > 0) for (; o--; d[l++] = 0) ;
|
|
735
|
-
for (o = ee - 1; m > f; ) {
|
|
736
|
-
if (d[--m] < S[m]) {
|
|
737
|
-
for (l = m; l && !d[--l]; d[l] = o) ;
|
|
738
|
-
--d[l], d[m] += ee;
|
|
739
|
-
}
|
|
740
|
-
d[m] -= S[m];
|
|
741
|
-
}
|
|
742
|
-
for (; d[0] == 0; d.splice(0, 1), --x) ;
|
|
743
|
-
return d[0] ? K(s, d, x) : (s.s = h == 3 ? -1 : 1, s.c = [s.e = 0], s);
|
|
744
|
-
}, r.modulo = r.mod = function(s, o) {
|
|
745
|
-
var l, m, c = this;
|
|
746
|
-
return s = new v(s, o), !c.c || !s.s || s.c && !s.c[0] ? new v(NaN) : !s.c || c.c && !c.c[0] ? new v(c) : (T == 9 ? (m = s.s, s.s = 1, l = e(c, s, 0, 3), s.s = m, l.s *= m) : l = e(c, s, 0, T), s = c.minus(l.times(s)), !s.c[0] && T == 1 && (s.s = c.s), s);
|
|
747
|
-
}, r.multipliedBy = r.times = function(s, o) {
|
|
748
|
-
var l, m, c, y, w, f, g, x, d, S, P, O, k, D, U, A = this, G = A.c, V = (s = new v(s, o)).c;
|
|
749
|
-
if (!G || !V || !G[0] || !V[0])
|
|
750
|
-
return !A.s || !s.s || G && !G[0] && !V || V && !V[0] && !G ? s.c = s.e = s.s = null : (s.s *= A.s, !G || !V ? s.c = s.e = null : (s.c = [0], s.e = 0)), s;
|
|
751
|
-
for (m = Q(A.e / R) + Q(s.e / R), s.s *= A.s, g = G.length, S = V.length, g < S && (k = G, G = V, V = k, c = g, g = S, S = c), c = g + S, k = []; c--; k.push(0)) ;
|
|
752
|
-
for (D = ee, U = le, c = S; --c >= 0; ) {
|
|
753
|
-
for (l = 0, P = V[c] % U, O = V[c] / U | 0, w = g, y = c + w; y > c; )
|
|
754
|
-
x = G[--w] % U, d = G[w] / U | 0, f = O * x + d * P, x = P * x + f % U * U + k[y] + l, l = (x / D | 0) + (f / U | 0) + O * d, k[y--] = x % D;
|
|
755
|
-
k[y] = l;
|
|
756
|
-
}
|
|
757
|
-
return l ? ++m : k.splice(0, 1), K(s, k, m);
|
|
758
|
-
}, r.negated = function() {
|
|
759
|
-
var s = new v(this);
|
|
760
|
-
return s.s = -s.s || null, s;
|
|
761
|
-
}, r.plus = function(s, o) {
|
|
762
|
-
var l, m = this, c = m.s;
|
|
763
|
-
if (s = new v(s, o), o = s.s, !c || !o) return new v(NaN);
|
|
764
|
-
if (c != o)
|
|
765
|
-
return s.s = -o, m.minus(s);
|
|
766
|
-
var y = m.e / R, w = s.e / R, f = m.c, g = s.c;
|
|
767
|
-
if (!y || !w) {
|
|
768
|
-
if (!f || !g) return new v(c / 0);
|
|
769
|
-
if (!f[0] || !g[0]) return g[0] ? s : new v(f[0] ? m : c * 0);
|
|
770
|
-
}
|
|
771
|
-
if (y = Q(y), w = Q(w), f = f.slice(), c = y - w) {
|
|
772
|
-
for (c > 0 ? (w = y, l = g) : (c = -c, l = f), l.reverse(); c--; l.push(0)) ;
|
|
773
|
-
l.reverse();
|
|
774
|
-
}
|
|
775
|
-
for (c = f.length, o = g.length, c - o < 0 && (l = g, g = f, f = l, o = c), c = 0; o; )
|
|
776
|
-
c = (f[--o] = f[o] + g[o] + c) / ee | 0, f[o] = ee === f[o] ? 0 : f[o] % ee;
|
|
777
|
-
return c && (f = [c].concat(f), ++w), K(s, f, w);
|
|
778
|
-
}, r.precision = r.sd = function(s, o) {
|
|
779
|
-
var l, m, c, y = this;
|
|
780
|
-
if (s != null && s !== !!s)
|
|
781
|
-
return F(s, 1, Y), o == null ? o = h : F(o, 0, 8), W(new v(y), s, o);
|
|
782
|
-
if (!(l = y.c)) return null;
|
|
783
|
-
if (c = l.length - 1, m = c * R + 1, c = l[c]) {
|
|
784
|
-
for (; c % 10 == 0; c /= 10, m--) ;
|
|
785
|
-
for (c = l[0]; c >= 10; c /= 10, m++) ;
|
|
786
|
-
}
|
|
787
|
-
return s && y.e + 1 > m && (m = y.e + 1), m;
|
|
788
|
-
}, r.shiftedBy = function(s) {
|
|
789
|
-
return F(s, -9007199254740991, je), this.times("1e" + s);
|
|
790
|
-
}, r.squareRoot = r.sqrt = function() {
|
|
791
|
-
var s, o, l, m, c, y = this, w = y.c, f = y.s, g = y.e, x = a + 4, d = new v("0.5");
|
|
792
|
-
if (f !== 1 || !w || !w[0])
|
|
793
|
-
return new v(!f || f < 0 && (!w || w[0]) ? NaN : w ? y : 1 / 0);
|
|
794
|
-
if (f = Math.sqrt(+re(y)), f == 0 || f == 1 / 0 ? (o = H(w), (o.length + g) % 2 == 0 && (o += "0"), f = Math.sqrt(+o), g = Q((g + 1) / 2) - (g < 0 || g % 2), f == 1 / 0 ? o = "5e" + g : (o = f.toExponential(), o = o.slice(0, o.indexOf("e") + 1) + g), l = new v(o)) : l = new v(f + ""), l.c[0]) {
|
|
795
|
-
for (g = l.e, f = g + x, f < 3 && (f = 0); ; )
|
|
796
|
-
if (c = l, l = d.times(c.plus(e(y, c, x, 1))), H(c.c).slice(0, f) === (o = H(l.c)).slice(0, f))
|
|
797
|
-
if (l.e < g && --f, o = o.slice(f - 3, f + 1), o == "9999" || !m && o == "4999") {
|
|
798
|
-
if (!m && (W(c, c.e + a + 2, 0), c.times(c).eq(y))) {
|
|
799
|
-
l = c;
|
|
800
|
-
break;
|
|
801
|
-
}
|
|
802
|
-
x += 4, f += 4, m = 1;
|
|
803
|
-
} else {
|
|
804
|
-
(!+o || !+o.slice(1) && o.charAt(0) == "5") && (W(l, l.e + a + 2, 1), s = !l.times(l).eq(y));
|
|
805
|
-
break;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
return W(l, l.e + a + 1, h, s);
|
|
809
|
-
}, r.toExponential = function(s, o) {
|
|
810
|
-
return s != null && (F(s, 0, Y), s++), N(this, s, o, 1);
|
|
811
|
-
}, r.toFixed = function(s, o) {
|
|
812
|
-
return s != null && (F(s, 0, Y), s = s + this.e + 1), N(this, s, o);
|
|
813
|
-
}, r.toFormat = function(s, o, l) {
|
|
814
|
-
var m, c = this;
|
|
815
|
-
if (l == null)
|
|
816
|
-
s != null && o && typeof o == "object" ? (l = o, o = null) : s && typeof s == "object" ? (l = s, s = o = null) : l = B;
|
|
817
|
-
else if (typeof l != "object")
|
|
818
|
-
throw Error(Z + "Argument not an object: " + l);
|
|
819
|
-
if (m = c.toFixed(s, o), c.c) {
|
|
820
|
-
var y, w = m.split("."), f = +l.groupSize, g = +l.secondaryGroupSize, x = l.groupSeparator || "", d = w[0], S = w[1], P = c.s < 0, O = P ? d.slice(1) : d, k = O.length;
|
|
821
|
-
if (g && (y = f, f = g, g = y, k -= y), f > 0 && k > 0) {
|
|
822
|
-
for (y = k % f || f, d = O.substr(0, y); y < k; y += f) d += x + O.substr(y, f);
|
|
823
|
-
g > 0 && (d += x + O.slice(y)), P && (d = "-" + d);
|
|
824
|
-
}
|
|
825
|
-
m = S ? d + (l.decimalSeparator || "") + ((g = +l.fractionGroupSize) ? S.replace(
|
|
826
|
-
new RegExp("\\d{" + g + "}\\B", "g"),
|
|
827
|
-
"$&" + (l.fractionGroupSeparator || "")
|
|
828
|
-
) : S) : d;
|
|
829
|
-
}
|
|
830
|
-
return (l.prefix || "") + m + (l.suffix || "");
|
|
831
|
-
}, r.toFraction = function(s) {
|
|
832
|
-
var o, l, m, c, y, w, f, g, x, d, S, P, O = this, k = O.c;
|
|
833
|
-
if (s != null && (f = new v(s), !f.isInteger() && (f.c || f.s !== 1) || f.lt(u)))
|
|
834
|
-
throw Error(Z + "Argument " + (f.isInteger() ? "out of range: " : "not an integer: ") + re(f));
|
|
835
|
-
if (!k) return new v(O);
|
|
836
|
-
for (o = new v(u), x = l = new v(u), m = g = new v(u), P = H(k), y = o.e = P.length - O.e - 1, o.c[0] = Ge[(w = y % R) < 0 ? R + w : w], s = !s || f.comparedTo(o) > 0 ? y > 0 ? o : x : f, w = b, b = 1 / 0, f = new v(P), g.c[0] = 0; d = e(f, o, 0, 1), c = l.plus(d.times(m)), c.comparedTo(s) != 1; )
|
|
837
|
-
l = m, m = c, x = g.plus(d.times(c = x)), g = c, o = f.minus(d.times(c = o)), f = c;
|
|
838
|
-
return c = e(s.minus(l), m, 0, 1), g = g.plus(c.times(x)), l = l.plus(c.times(m)), g.s = x.s = O.s, y = y * 2, S = e(x, m, y, h).minus(O).abs().comparedTo(
|
|
839
|
-
e(g, l, y, h).minus(O).abs()
|
|
840
|
-
) < 1 ? [x, m] : [g, l], b = w, S;
|
|
841
|
-
}, r.toNumber = function() {
|
|
842
|
-
return +re(this);
|
|
843
|
-
}, r.toPrecision = function(s, o) {
|
|
844
|
-
return s != null && F(s, 1, Y), N(this, s, o, 2);
|
|
845
|
-
}, r.toString = function(s) {
|
|
846
|
-
var o, l = this, m = l.s, c = l.e;
|
|
847
|
-
return c === null ? m ? (o = "Infinity", m < 0 && (o = "-" + o)) : o = "NaN" : (s == null ? o = c <= E || c >= p ? Te(H(l.c), c) : se(H(l.c), c, "0") : s === 10 && I ? (l = W(new v(l), a + c + 1, h), o = se(H(l.c), l.e, "0")) : (F(s, 2, q.length, "Base"), o = n(se(H(l.c), c, "0"), 10, s, m, !0)), m < 0 && l.c[0] && (o = "-" + o)), o;
|
|
848
|
-
}, r.valueOf = r.toJSON = function() {
|
|
849
|
-
return re(this);
|
|
850
|
-
}, r._isBigNumber = !0, r[Symbol.toStringTag] = "BigNumber", r[Symbol.for("nodejs.util.inspect.custom")] = r.valueOf, t != null && v.set(t), v;
|
|
851
|
-
}
|
|
852
|
-
function Q(t) {
|
|
853
|
-
var e = t | 0;
|
|
854
|
-
return t > 0 || t === e ? e : e - 1;
|
|
855
|
-
}
|
|
856
|
-
function H(t) {
|
|
857
|
-
for (var e, n, i = 1, r = t.length, u = t[0] + ""; i < r; ) {
|
|
858
|
-
for (e = t[i++] + "", n = R - e.length; n--; e = "0" + e) ;
|
|
859
|
-
u += e;
|
|
860
|
-
}
|
|
861
|
-
for (r = u.length; u.charCodeAt(--r) === 48; ) ;
|
|
862
|
-
return u.slice(0, r + 1 || 1);
|
|
863
|
-
}
|
|
864
|
-
function fe(t, e) {
|
|
865
|
-
var n, i, r = t.c, u = e.c, a = t.s, h = e.s, E = t.e, p = e.e;
|
|
866
|
-
if (!a || !h) return null;
|
|
867
|
-
if (n = r && !r[0], i = u && !u[0], n || i) return n ? i ? 0 : -h : a;
|
|
868
|
-
if (a != h) return a;
|
|
869
|
-
if (n = a < 0, i = E == p, !r || !u) return i ? 0 : !r ^ n ? 1 : -1;
|
|
870
|
-
if (!i) return E > p ^ n ? 1 : -1;
|
|
871
|
-
for (h = (E = r.length) < (p = u.length) ? E : p, a = 0; a < h; a++) if (r[a] != u[a]) return r[a] > u[a] ^ n ? 1 : -1;
|
|
872
|
-
return E == p ? 0 : E > p ^ n ? 1 : -1;
|
|
873
|
-
}
|
|
874
|
-
function F(t, e, n, i) {
|
|
875
|
-
if (t < e || t > n || t !== j(t))
|
|
876
|
-
throw Error(Z + (i || "Argument") + (typeof t == "number" ? t < e || t > n ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(t));
|
|
877
|
-
}
|
|
878
|
-
function _e(t) {
|
|
879
|
-
var e = t.c.length - 1;
|
|
880
|
-
return Q(t.e / R) == e && t.c[e] % 2 != 0;
|
|
881
|
-
}
|
|
882
|
-
function Te(t, e) {
|
|
883
|
-
return (t.length > 1 ? t.charAt(0) + "." + t.slice(1) : t) + (e < 0 ? "e" : "e+") + e;
|
|
884
|
-
}
|
|
885
|
-
function se(t, e, n) {
|
|
886
|
-
var i, r;
|
|
887
|
-
if (e < 0) {
|
|
888
|
-
for (r = n + "."; ++e; r += n) ;
|
|
889
|
-
t = r + t;
|
|
890
|
-
} else if (i = t.length, ++e > i) {
|
|
891
|
-
for (r = n, e -= i; --e; r += n) ;
|
|
892
|
-
t += r;
|
|
893
|
-
} else e < i && (t = t.slice(0, e) + "." + t.slice(e));
|
|
894
|
-
return t;
|
|
895
|
-
}
|
|
896
|
-
var ie = wt(), Gt = class {
|
|
897
|
-
constructor(t) {
|
|
898
|
-
C(this, "key");
|
|
899
|
-
C(this, "left", null);
|
|
900
|
-
C(this, "right", null);
|
|
901
|
-
this.key = t;
|
|
902
|
-
}
|
|
903
|
-
}, ye = class extends Gt {
|
|
904
|
-
constructor(t) {
|
|
905
|
-
super(t);
|
|
906
|
-
}
|
|
907
|
-
}, $t = class {
|
|
908
|
-
constructor() {
|
|
909
|
-
C(this, "size", 0);
|
|
910
|
-
C(this, "modificationCount", 0);
|
|
911
|
-
C(this, "splayCount", 0);
|
|
912
|
-
}
|
|
913
|
-
splay(t) {
|
|
914
|
-
const e = this.root;
|
|
915
|
-
if (e == null)
|
|
916
|
-
return this.compare(t, t), -1;
|
|
917
|
-
let n = null, i = null, r = null, u = null, a = e;
|
|
918
|
-
const h = this.compare;
|
|
919
|
-
let E;
|
|
920
|
-
for (; ; )
|
|
921
|
-
if (E = h(a.key, t), E > 0) {
|
|
922
|
-
let p = a.left;
|
|
923
|
-
if (p == null || (E = h(p.key, t), E > 0 && (a.left = p.right, p.right = a, a = p, p = a.left, p == null)))
|
|
924
|
-
break;
|
|
925
|
-
n == null ? i = a : n.left = a, n = a, a = p;
|
|
926
|
-
} else if (E < 0) {
|
|
927
|
-
let p = a.right;
|
|
928
|
-
if (p == null || (E = h(p.key, t), E < 0 && (a.right = p.left, p.left = a, a = p, p = a.right, p == null)))
|
|
929
|
-
break;
|
|
930
|
-
r == null ? u = a : r.right = a, r = a, a = p;
|
|
931
|
-
} else
|
|
932
|
-
break;
|
|
933
|
-
return r != null && (r.right = a.left, a.left = u), n != null && (n.left = a.right, a.right = i), this.root !== a && (this.root = a, this.splayCount++), E;
|
|
934
|
-
}
|
|
935
|
-
splayMin(t) {
|
|
936
|
-
let e = t, n = e.left;
|
|
937
|
-
for (; n != null; ) {
|
|
938
|
-
const i = n;
|
|
939
|
-
e.left = i.right, i.right = e, e = i, n = e.left;
|
|
940
|
-
}
|
|
941
|
-
return e;
|
|
942
|
-
}
|
|
943
|
-
splayMax(t) {
|
|
944
|
-
let e = t, n = e.right;
|
|
945
|
-
for (; n != null; ) {
|
|
946
|
-
const i = n;
|
|
947
|
-
e.right = i.left, i.left = e, e = i, n = e.right;
|
|
948
|
-
}
|
|
949
|
-
return e;
|
|
950
|
-
}
|
|
951
|
-
_delete(t) {
|
|
952
|
-
if (this.root == null || this.splay(t) != 0) return null;
|
|
953
|
-
let n = this.root;
|
|
954
|
-
const i = n, r = n.left;
|
|
955
|
-
if (this.size--, r == null)
|
|
956
|
-
this.root = n.right;
|
|
957
|
-
else {
|
|
958
|
-
const u = n.right;
|
|
959
|
-
n = this.splayMax(r), n.right = u, this.root = n;
|
|
960
|
-
}
|
|
961
|
-
return this.modificationCount++, i;
|
|
962
|
-
}
|
|
963
|
-
addNewRoot(t, e) {
|
|
964
|
-
this.size++, this.modificationCount++;
|
|
965
|
-
const n = this.root;
|
|
966
|
-
if (n == null) {
|
|
967
|
-
this.root = t;
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
e < 0 ? (t.left = n, t.right = n.right, n.right = null) : (t.right = n, t.left = n.left, n.left = null), this.root = t;
|
|
971
|
-
}
|
|
972
|
-
_first() {
|
|
973
|
-
const t = this.root;
|
|
974
|
-
return t == null ? null : (this.root = this.splayMin(t), this.root);
|
|
975
|
-
}
|
|
976
|
-
_last() {
|
|
977
|
-
const t = this.root;
|
|
978
|
-
return t == null ? null : (this.root = this.splayMax(t), this.root);
|
|
979
|
-
}
|
|
980
|
-
clear() {
|
|
981
|
-
this.root = null, this.size = 0, this.modificationCount++;
|
|
982
|
-
}
|
|
983
|
-
has(t) {
|
|
984
|
-
return this.validKey(t) && this.splay(t) == 0;
|
|
985
|
-
}
|
|
986
|
-
defaultCompare() {
|
|
987
|
-
return (t, e) => t < e ? -1 : t > e ? 1 : 0;
|
|
988
|
-
}
|
|
989
|
-
wrap() {
|
|
990
|
-
return {
|
|
991
|
-
getRoot: () => this.root,
|
|
992
|
-
setRoot: (t) => {
|
|
993
|
-
this.root = t;
|
|
994
|
-
},
|
|
995
|
-
getSize: () => this.size,
|
|
996
|
-
getModificationCount: () => this.modificationCount,
|
|
997
|
-
getSplayCount: () => this.splayCount,
|
|
998
|
-
setSplayCount: (t) => {
|
|
999
|
-
this.splayCount = t;
|
|
1000
|
-
},
|
|
1001
|
-
splay: (t) => this.splay(t),
|
|
1002
|
-
has: (t) => this.has(t)
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
}, ht, pt, Pe = class me extends $t {
|
|
1006
|
-
constructor(n, i) {
|
|
1007
|
-
super();
|
|
1008
|
-
C(this, "root", null);
|
|
1009
|
-
C(this, "compare");
|
|
1010
|
-
C(this, "validKey");
|
|
1011
|
-
C(this, ht, "[object Set]");
|
|
1012
|
-
this.compare = n ?? this.defaultCompare(), this.validKey = i ?? ((r) => r != null && r != null);
|
|
1013
|
-
}
|
|
1014
|
-
delete(n) {
|
|
1015
|
-
return this.validKey(n) ? this._delete(n) != null : !1;
|
|
1016
|
-
}
|
|
1017
|
-
deleteAll(n) {
|
|
1018
|
-
for (const i of n)
|
|
1019
|
-
this.delete(i);
|
|
1020
|
-
}
|
|
1021
|
-
forEach(n) {
|
|
1022
|
-
const i = this[Symbol.iterator]();
|
|
1023
|
-
let r;
|
|
1024
|
-
for (; r = i.next(), !r.done; )
|
|
1025
|
-
n(r.value, r.value, this);
|
|
1026
|
-
}
|
|
1027
|
-
add(n) {
|
|
1028
|
-
const i = this.splay(n);
|
|
1029
|
-
return i != 0 && this.addNewRoot(new ye(n), i), this;
|
|
1030
|
-
}
|
|
1031
|
-
addAndReturn(n) {
|
|
1032
|
-
const i = this.splay(n);
|
|
1033
|
-
return i != 0 && this.addNewRoot(new ye(n), i), this.root.key;
|
|
1034
|
-
}
|
|
1035
|
-
addAll(n) {
|
|
1036
|
-
for (const i of n)
|
|
1037
|
-
this.add(i);
|
|
1038
|
-
}
|
|
1039
|
-
isEmpty() {
|
|
1040
|
-
return this.root == null;
|
|
1041
|
-
}
|
|
1042
|
-
isNotEmpty() {
|
|
1043
|
-
return this.root != null;
|
|
1044
|
-
}
|
|
1045
|
-
single() {
|
|
1046
|
-
if (this.size == 0) throw "Bad state: No element";
|
|
1047
|
-
if (this.size > 1) throw "Bad state: Too many element";
|
|
1048
|
-
return this.root.key;
|
|
1049
|
-
}
|
|
1050
|
-
first() {
|
|
1051
|
-
if (this.size == 0) throw "Bad state: No element";
|
|
1052
|
-
return this._first().key;
|
|
1053
|
-
}
|
|
1054
|
-
last() {
|
|
1055
|
-
if (this.size == 0) throw "Bad state: No element";
|
|
1056
|
-
return this._last().key;
|
|
1057
|
-
}
|
|
1058
|
-
lastBefore(n) {
|
|
1059
|
-
if (n == null) throw "Invalid arguments(s)";
|
|
1060
|
-
if (this.root == null) return null;
|
|
1061
|
-
if (this.splay(n) < 0) return this.root.key;
|
|
1062
|
-
let r = this.root.left;
|
|
1063
|
-
if (r == null) return null;
|
|
1064
|
-
let u = r.right;
|
|
1065
|
-
for (; u != null; )
|
|
1066
|
-
r = u, u = r.right;
|
|
1067
|
-
return r.key;
|
|
1068
|
-
}
|
|
1069
|
-
firstAfter(n) {
|
|
1070
|
-
if (n == null) throw "Invalid arguments(s)";
|
|
1071
|
-
if (this.root == null) return null;
|
|
1072
|
-
if (this.splay(n) > 0) return this.root.key;
|
|
1073
|
-
let r = this.root.right;
|
|
1074
|
-
if (r == null) return null;
|
|
1075
|
-
let u = r.left;
|
|
1076
|
-
for (; u != null; )
|
|
1077
|
-
r = u, u = r.left;
|
|
1078
|
-
return r.key;
|
|
1079
|
-
}
|
|
1080
|
-
retainAll(n) {
|
|
1081
|
-
const i = new me(this.compare, this.validKey), r = this.modificationCount;
|
|
1082
|
-
for (const u of n) {
|
|
1083
|
-
if (r != this.modificationCount)
|
|
1084
|
-
throw "Concurrent modification during iteration.";
|
|
1085
|
-
this.validKey(u) && this.splay(u) == 0 && i.add(this.root.key);
|
|
1086
|
-
}
|
|
1087
|
-
i.size != this.size && (this.root = i.root, this.size = i.size, this.modificationCount++);
|
|
1088
|
-
}
|
|
1089
|
-
lookup(n) {
|
|
1090
|
-
return !this.validKey(n) || this.splay(n) != 0 ? null : this.root.key;
|
|
1091
|
-
}
|
|
1092
|
-
intersection(n) {
|
|
1093
|
-
const i = new me(this.compare, this.validKey);
|
|
1094
|
-
for (const r of this)
|
|
1095
|
-
n.has(r) && i.add(r);
|
|
1096
|
-
return i;
|
|
1097
|
-
}
|
|
1098
|
-
difference(n) {
|
|
1099
|
-
const i = new me(this.compare, this.validKey);
|
|
1100
|
-
for (const r of this)
|
|
1101
|
-
n.has(r) || i.add(r);
|
|
1102
|
-
return i;
|
|
1103
|
-
}
|
|
1104
|
-
union(n) {
|
|
1105
|
-
const i = this.clone();
|
|
1106
|
-
return i.addAll(n), i;
|
|
1107
|
-
}
|
|
1108
|
-
clone() {
|
|
1109
|
-
const n = new me(this.compare, this.validKey);
|
|
1110
|
-
return n.size = this.size, n.root = this.copyNode(this.root), n;
|
|
1111
|
-
}
|
|
1112
|
-
copyNode(n) {
|
|
1113
|
-
if (n == null) return null;
|
|
1114
|
-
function i(u, a) {
|
|
1115
|
-
let h, E;
|
|
1116
|
-
do {
|
|
1117
|
-
if (h = u.left, E = u.right, h != null) {
|
|
1118
|
-
const p = new ye(h.key);
|
|
1119
|
-
a.left = p, i(h, p);
|
|
1120
|
-
}
|
|
1121
|
-
if (E != null) {
|
|
1122
|
-
const p = new ye(E.key);
|
|
1123
|
-
a.right = p, u = E, a = p;
|
|
1124
|
-
}
|
|
1125
|
-
} while (E != null);
|
|
1126
|
-
}
|
|
1127
|
-
const r = new ye(n.key);
|
|
1128
|
-
return i(n, r), r;
|
|
1129
|
-
}
|
|
1130
|
-
toSet() {
|
|
1131
|
-
return this.clone();
|
|
1132
|
-
}
|
|
1133
|
-
entries() {
|
|
1134
|
-
return new Ft(this.wrap());
|
|
1135
|
-
}
|
|
1136
|
-
keys() {
|
|
1137
|
-
return this[Symbol.iterator]();
|
|
1138
|
-
}
|
|
1139
|
-
values() {
|
|
1140
|
-
return this[Symbol.iterator]();
|
|
1141
|
-
}
|
|
1142
|
-
[(pt = Symbol.iterator, ht = Symbol.toStringTag, pt)]() {
|
|
1143
|
-
return new qt(this.wrap());
|
|
1144
|
-
}
|
|
1145
|
-
}, Et = class {
|
|
1146
|
-
constructor(t) {
|
|
1147
|
-
C(this, "tree");
|
|
1148
|
-
C(this, "path", new Array());
|
|
1149
|
-
C(this, "modificationCount", null);
|
|
1150
|
-
C(this, "splayCount");
|
|
1151
|
-
this.tree = t, this.splayCount = t.getSplayCount();
|
|
1152
|
-
}
|
|
1153
|
-
[Symbol.iterator]() {
|
|
1154
|
-
return this;
|
|
1155
|
-
}
|
|
1156
|
-
next() {
|
|
1157
|
-
return this.moveNext() ? { done: !1, value: this.current() } : { done: !0, value: null };
|
|
1158
|
-
}
|
|
1159
|
-
current() {
|
|
1160
|
-
if (!this.path.length) return null;
|
|
1161
|
-
const t = this.path[this.path.length - 1];
|
|
1162
|
-
return this.getValue(t);
|
|
1163
|
-
}
|
|
1164
|
-
rebuildPath(t) {
|
|
1165
|
-
this.path.splice(0, this.path.length), this.tree.splay(t), this.path.push(this.tree.getRoot()), this.splayCount = this.tree.getSplayCount();
|
|
1166
|
-
}
|
|
1167
|
-
findLeftMostDescendent(t) {
|
|
1168
|
-
for (; t != null; )
|
|
1169
|
-
this.path.push(t), t = t.left;
|
|
1170
|
-
}
|
|
1171
|
-
moveNext() {
|
|
1172
|
-
if (this.modificationCount != this.tree.getModificationCount()) {
|
|
1173
|
-
if (this.modificationCount == null) {
|
|
1174
|
-
this.modificationCount = this.tree.getModificationCount();
|
|
1175
|
-
let n = this.tree.getRoot();
|
|
1176
|
-
for (; n != null; )
|
|
1177
|
-
this.path.push(n), n = n.left;
|
|
1178
|
-
return this.path.length > 0;
|
|
1179
|
-
}
|
|
1180
|
-
throw "Concurrent modification during iteration.";
|
|
1181
|
-
}
|
|
1182
|
-
if (!this.path.length) return !1;
|
|
1183
|
-
this.splayCount != this.tree.getSplayCount() && this.rebuildPath(this.path[this.path.length - 1].key);
|
|
1184
|
-
let t = this.path[this.path.length - 1], e = t.right;
|
|
1185
|
-
if (e != null) {
|
|
1186
|
-
for (; e != null; )
|
|
1187
|
-
this.path.push(e), e = e.left;
|
|
1188
|
-
return !0;
|
|
1189
|
-
}
|
|
1190
|
-
for (this.path.pop(); this.path.length && this.path[this.path.length - 1].right === t; )
|
|
1191
|
-
t = this.path.pop();
|
|
1192
|
-
return this.path.length > 0;
|
|
1193
|
-
}
|
|
1194
|
-
}, qt = class extends Et {
|
|
1195
|
-
getValue(t) {
|
|
1196
|
-
return t.key;
|
|
1197
|
-
}
|
|
1198
|
-
}, Ft = class extends Et {
|
|
1199
|
-
getValue(t) {
|
|
1200
|
-
return [t.key, t.key];
|
|
1201
|
-
}
|
|
1202
|
-
}, vt = (t) => () => t, Fe = (t) => {
|
|
1203
|
-
const e = t ? (n, i) => i.minus(n).abs().isLessThanOrEqualTo(t) : vt(!1);
|
|
1204
|
-
return (n, i) => e(n, i) ? 0 : n.comparedTo(i);
|
|
1205
|
-
};
|
|
1206
|
-
function Dt(t) {
|
|
1207
|
-
const e = t ? (n, i, r, u, a) => n.exponentiatedBy(2).isLessThanOrEqualTo(
|
|
1208
|
-
u.minus(i).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(t)
|
|
1209
|
-
) : vt(!1);
|
|
1210
|
-
return (n, i, r) => {
|
|
1211
|
-
const u = n.x, a = n.y, h = r.x, E = r.y, p = a.minus(E).times(i.x.minus(h)).minus(u.minus(h).times(i.y.minus(E)));
|
|
1212
|
-
return e(p, u, a, h, E) ? 0 : p.comparedTo(0);
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
var zt = (t) => t, Ut = (t) => {
|
|
1216
|
-
if (t) {
|
|
1217
|
-
const e = new Pe(Fe(t)), n = new Pe(Fe(t)), i = (u, a) => a.addAndReturn(u), r = (u) => ({
|
|
1218
|
-
x: i(u.x, e),
|
|
1219
|
-
y: i(u.y, n)
|
|
1220
|
-
});
|
|
1221
|
-
return r({ x: new ie(0), y: new ie(0) }), r;
|
|
1222
|
-
}
|
|
1223
|
-
return zt;
|
|
1224
|
-
}, De = (t) => ({
|
|
1225
|
-
set: (e) => {
|
|
1226
|
-
oe = De(e);
|
|
1227
|
-
},
|
|
1228
|
-
reset: () => De(t),
|
|
1229
|
-
compare: Fe(t),
|
|
1230
|
-
snap: Ut(t),
|
|
1231
|
-
orient: Dt(t)
|
|
1232
|
-
}), oe = De(), de = (t, e) => t.ll.x.isLessThanOrEqualTo(e.x) && e.x.isLessThanOrEqualTo(t.ur.x) && t.ll.y.isLessThanOrEqualTo(e.y) && e.y.isLessThanOrEqualTo(t.ur.y), ze = (t, e) => {
|
|
1233
|
-
if (e.ur.x.isLessThan(t.ll.x) || t.ur.x.isLessThan(e.ll.x) || e.ur.y.isLessThan(t.ll.y) || t.ur.y.isLessThan(e.ll.y))
|
|
1234
|
-
return null;
|
|
1235
|
-
const n = t.ll.x.isLessThan(e.ll.x) ? e.ll.x : t.ll.x, i = t.ur.x.isLessThan(e.ur.x) ? t.ur.x : e.ur.x, r = t.ll.y.isLessThan(e.ll.y) ? e.ll.y : t.ll.y, u = t.ur.y.isLessThan(e.ur.y) ? t.ur.y : e.ur.y;
|
|
1236
|
-
return { ll: { x: n, y: r }, ur: { x: i, y: u } };
|
|
1237
|
-
}, Me = (t, e) => t.x.times(e.y).minus(t.y.times(e.x)), St = (t, e) => t.x.times(e.x).plus(t.y.times(e.y)), Oe = (t) => St(t, t).sqrt(), Vt = (t, e, n) => {
|
|
1238
|
-
const i = { x: e.x.minus(t.x), y: e.y.minus(t.y) }, r = { x: n.x.minus(t.x), y: n.y.minus(t.y) };
|
|
1239
|
-
return Me(r, i).div(Oe(r)).div(Oe(i));
|
|
1240
|
-
}, Kt = (t, e, n) => {
|
|
1241
|
-
const i = { x: e.x.minus(t.x), y: e.y.minus(t.y) }, r = { x: n.x.minus(t.x), y: n.y.minus(t.y) };
|
|
1242
|
-
return St(r, i).div(Oe(r)).div(Oe(i));
|
|
1243
|
-
}, Qe = (t, e, n) => e.y.isZero() ? null : { x: t.x.plus(e.x.div(e.y).times(n.minus(t.y))), y: n }, et = (t, e, n) => e.x.isZero() ? null : { x: n, y: t.y.plus(e.y.div(e.x).times(n.minus(t.x))) }, Xt = (t, e, n, i) => {
|
|
1244
|
-
if (e.x.isZero()) return et(n, i, t.x);
|
|
1245
|
-
if (i.x.isZero()) return et(t, e, n.x);
|
|
1246
|
-
if (e.y.isZero()) return Qe(n, i, t.y);
|
|
1247
|
-
if (i.y.isZero()) return Qe(t, e, n.y);
|
|
1248
|
-
const r = Me(e, i);
|
|
1249
|
-
if (r.isZero()) return null;
|
|
1250
|
-
const u = { x: n.x.minus(t.x), y: n.y.minus(t.y) }, a = Me(u, e).div(r), h = Me(u, i).div(r), E = t.x.plus(h.times(e.x)), p = n.x.plus(a.times(i.x)), _ = t.y.plus(h.times(e.y)), b = n.y.plus(a.times(i.y)), M = E.plus(p).div(2), T = _.plus(b).div(2);
|
|
1251
|
-
return { x: M, y: T };
|
|
1252
|
-
}, ne = class bt {
|
|
1253
|
-
// Warning: 'point' input will be modified and re-used (for performance)
|
|
1254
|
-
constructor(e, n) {
|
|
1255
|
-
C(this, "point");
|
|
1256
|
-
C(this, "isLeft");
|
|
1257
|
-
C(this, "segment");
|
|
1258
|
-
C(this, "otherSE");
|
|
1259
|
-
C(this, "consumedBy");
|
|
1260
|
-
e.events === void 0 ? e.events = [this] : e.events.push(this), this.point = e, this.isLeft = n;
|
|
1261
|
-
}
|
|
1262
|
-
// for ordering sweep events in the sweep event queue
|
|
1263
|
-
static compare(e, n) {
|
|
1264
|
-
const i = bt.comparePoints(e.point, n.point);
|
|
1265
|
-
return i !== 0 ? i : (e.point !== n.point && e.link(n), e.isLeft !== n.isLeft ? e.isLeft ? 1 : -1 : Ne.compare(e.segment, n.segment));
|
|
1266
|
-
}
|
|
1267
|
-
// for ordering points in sweep line order
|
|
1268
|
-
static comparePoints(e, n) {
|
|
1269
|
-
return e.x.isLessThan(n.x) ? -1 : e.x.isGreaterThan(n.x) ? 1 : e.y.isLessThan(n.y) ? -1 : e.y.isGreaterThan(n.y) ? 1 : 0;
|
|
1270
|
-
}
|
|
1271
|
-
link(e) {
|
|
1272
|
-
if (e.point === this.point)
|
|
1273
|
-
throw new Error("Tried to link already linked events");
|
|
1274
|
-
const n = e.point.events;
|
|
1275
|
-
for (let i = 0, r = n.length; i < r; i++) {
|
|
1276
|
-
const u = n[i];
|
|
1277
|
-
this.point.events.push(u), u.point = this.point;
|
|
1278
|
-
}
|
|
1279
|
-
this.checkForConsuming();
|
|
1280
|
-
}
|
|
1281
|
-
/* Do a pass over our linked events and check to see if any pair
|
|
1282
|
-
* of segments match, and should be consumed. */
|
|
1283
|
-
checkForConsuming() {
|
|
1284
|
-
const e = this.point.events.length;
|
|
1285
|
-
for (let n = 0; n < e; n++) {
|
|
1286
|
-
const i = this.point.events[n];
|
|
1287
|
-
if (i.segment.consumedBy === void 0)
|
|
1288
|
-
for (let r = n + 1; r < e; r++) {
|
|
1289
|
-
const u = this.point.events[r];
|
|
1290
|
-
u.consumedBy === void 0 && i.otherSE.point.events === u.otherSE.point.events && i.segment.consume(u.segment);
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
getAvailableLinkedEvents() {
|
|
1295
|
-
const e = [];
|
|
1296
|
-
for (let n = 0, i = this.point.events.length; n < i; n++) {
|
|
1297
|
-
const r = this.point.events[n];
|
|
1298
|
-
r !== this && !r.segment.ringOut && r.segment.isInResult() && e.push(r);
|
|
1299
|
-
}
|
|
1300
|
-
return e;
|
|
1301
|
-
}
|
|
1302
|
-
/**
|
|
1303
|
-
* Returns a comparator function for sorting linked events that will
|
|
1304
|
-
* favor the event that will give us the smallest left-side angle.
|
|
1305
|
-
* All ring construction starts as low as possible heading to the right,
|
|
1306
|
-
* so by always turning left as sharp as possible we'll get polygons
|
|
1307
|
-
* without uncessary loops & holes.
|
|
1308
|
-
*
|
|
1309
|
-
* The comparator function has a compute cache such that it avoids
|
|
1310
|
-
* re-computing already-computed values.
|
|
1311
|
-
*/
|
|
1312
|
-
getLeftmostComparator(e) {
|
|
1313
|
-
const n = /* @__PURE__ */ new Map(), i = (r) => {
|
|
1314
|
-
const u = r.otherSE;
|
|
1315
|
-
n.set(r, {
|
|
1316
|
-
sine: Vt(this.point, e.point, u.point),
|
|
1317
|
-
cosine: Kt(this.point, e.point, u.point)
|
|
1318
|
-
});
|
|
1319
|
-
};
|
|
1320
|
-
return (r, u) => {
|
|
1321
|
-
n.has(r) || i(r), n.has(u) || i(u);
|
|
1322
|
-
const { sine: a, cosine: h } = n.get(r), { sine: E, cosine: p } = n.get(u);
|
|
1323
|
-
return a.isGreaterThanOrEqualTo(0) && E.isGreaterThanOrEqualTo(0) ? h.isLessThan(p) ? 1 : h.isGreaterThan(p) ? -1 : 0 : a.isLessThan(0) && E.isLessThan(0) ? h.isLessThan(p) ? -1 : h.isGreaterThan(p) ? 1 : 0 : E.isLessThan(a) ? -1 : E.isGreaterThan(a) ? 1 : 0;
|
|
1324
|
-
};
|
|
1325
|
-
}
|
|
1326
|
-
}, Zt = class Ue {
|
|
1327
|
-
constructor(e) {
|
|
1328
|
-
C(this, "events");
|
|
1329
|
-
C(this, "poly");
|
|
1330
|
-
C(this, "_isExteriorRing");
|
|
1331
|
-
C(this, "_enclosingRing");
|
|
1332
|
-
this.events = e;
|
|
1333
|
-
for (let n = 0, i = e.length; n < i; n++)
|
|
1334
|
-
e[n].segment.ringOut = this;
|
|
1335
|
-
this.poly = null;
|
|
1336
|
-
}
|
|
1337
|
-
/* Given the segments from the sweep line pass, compute & return a series
|
|
1338
|
-
* of closed rings from all the segments marked to be part of the result */
|
|
1339
|
-
static factory(e) {
|
|
1340
|
-
const n = [];
|
|
1341
|
-
for (let i = 0, r = e.length; i < r; i++) {
|
|
1342
|
-
const u = e[i];
|
|
1343
|
-
if (!u.isInResult() || u.ringOut) continue;
|
|
1344
|
-
let a = null, h = u.leftSE, E = u.rightSE;
|
|
1345
|
-
const p = [h], _ = h.point, b = [];
|
|
1346
|
-
for (; a = h, h = E, p.push(h), h.point !== _; )
|
|
1347
|
-
for (; ; ) {
|
|
1348
|
-
const M = h.getAvailableLinkedEvents();
|
|
1349
|
-
if (M.length === 0) {
|
|
1350
|
-
const B = p[0].point, q = p[p.length - 1].point;
|
|
1351
|
-
throw new Error(
|
|
1352
|
-
`Unable to complete output ring starting at [${B.x}, ${B.y}]. Last matching segment found ends at [${q.x}, ${q.y}].`
|
|
1353
|
-
);
|
|
1354
|
-
}
|
|
1355
|
-
if (M.length === 1) {
|
|
1356
|
-
E = M[0].otherSE;
|
|
1357
|
-
break;
|
|
1358
|
-
}
|
|
1359
|
-
let T = null;
|
|
1360
|
-
for (let B = 0, q = b.length; B < q; B++)
|
|
1361
|
-
if (b[B].point === h.point) {
|
|
1362
|
-
T = B;
|
|
1363
|
-
break;
|
|
1364
|
-
}
|
|
1365
|
-
if (T !== null) {
|
|
1366
|
-
const B = b.splice(T)[0], q = p.splice(B.index);
|
|
1367
|
-
q.unshift(q[0].otherSE), n.push(new Ue(q.reverse()));
|
|
1368
|
-
continue;
|
|
1369
|
-
}
|
|
1370
|
-
b.push({
|
|
1371
|
-
index: p.length,
|
|
1372
|
-
point: h.point
|
|
1373
|
-
});
|
|
1374
|
-
const L = h.getLeftmostComparator(a);
|
|
1375
|
-
E = M.sort(L)[0].otherSE;
|
|
1376
|
-
break;
|
|
1377
|
-
}
|
|
1378
|
-
n.push(new Ue(p));
|
|
1379
|
-
}
|
|
1380
|
-
return n;
|
|
1381
|
-
}
|
|
1382
|
-
getGeom() {
|
|
1383
|
-
let e = this.events[0].point;
|
|
1384
|
-
const n = [e];
|
|
1385
|
-
for (let p = 1, _ = this.events.length - 1; p < _; p++) {
|
|
1386
|
-
const b = this.events[p].point, M = this.events[p + 1].point;
|
|
1387
|
-
oe.orient(b, e, M) !== 0 && (n.push(b), e = b);
|
|
1388
|
-
}
|
|
1389
|
-
if (n.length === 1) return null;
|
|
1390
|
-
const i = n[0], r = n[1];
|
|
1391
|
-
oe.orient(i, e, r) === 0 && n.shift(), n.push(n[0]);
|
|
1392
|
-
const u = this.isExteriorRing() ? 1 : -1, a = this.isExteriorRing() ? 0 : n.length - 1, h = this.isExteriorRing() ? n.length : -1, E = [];
|
|
1393
|
-
for (let p = a; p != h; p += u)
|
|
1394
|
-
E.push([n[p].x.toNumber(), n[p].y.toNumber()]);
|
|
1395
|
-
return E;
|
|
1396
|
-
}
|
|
1397
|
-
isExteriorRing() {
|
|
1398
|
-
if (this._isExteriorRing === void 0) {
|
|
1399
|
-
const e = this.enclosingRing();
|
|
1400
|
-
this._isExteriorRing = e ? !e.isExteriorRing() : !0;
|
|
1401
|
-
}
|
|
1402
|
-
return this._isExteriorRing;
|
|
1403
|
-
}
|
|
1404
|
-
enclosingRing() {
|
|
1405
|
-
return this._enclosingRing === void 0 && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing;
|
|
1406
|
-
}
|
|
1407
|
-
/* Returns the ring that encloses this one, if any */
|
|
1408
|
-
_calcEnclosingRing() {
|
|
1409
|
-
var r, u;
|
|
1410
|
-
let e = this.events[0];
|
|
1411
|
-
for (let a = 1, h = this.events.length; a < h; a++) {
|
|
1412
|
-
const E = this.events[a];
|
|
1413
|
-
ne.compare(e, E) > 0 && (e = E);
|
|
1414
|
-
}
|
|
1415
|
-
let n = e.segment.prevInResult(), i = n ? n.prevInResult() : null;
|
|
1416
|
-
for (; ; ) {
|
|
1417
|
-
if (!n) return null;
|
|
1418
|
-
if (!i) return n.ringOut;
|
|
1419
|
-
if (i.ringOut !== n.ringOut)
|
|
1420
|
-
return ((r = i.ringOut) == null ? void 0 : r.enclosingRing()) !== n.ringOut ? n.ringOut : (u = n.ringOut) == null ? void 0 : u.enclosingRing();
|
|
1421
|
-
n = i.prevInResult(), i = n ? n.prevInResult() : null;
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
}, tt = class {
|
|
1425
|
-
constructor(t) {
|
|
1426
|
-
C(this, "exteriorRing");
|
|
1427
|
-
C(this, "interiorRings");
|
|
1428
|
-
this.exteriorRing = t, t.poly = this, this.interiorRings = [];
|
|
1429
|
-
}
|
|
1430
|
-
addInterior(t) {
|
|
1431
|
-
this.interiorRings.push(t), t.poly = this;
|
|
1432
|
-
}
|
|
1433
|
-
getGeom() {
|
|
1434
|
-
const t = this.exteriorRing.getGeom();
|
|
1435
|
-
if (t === null) return null;
|
|
1436
|
-
const e = [t];
|
|
1437
|
-
for (let n = 0, i = this.interiorRings.length; n < i; n++) {
|
|
1438
|
-
const r = this.interiorRings[n].getGeom();
|
|
1439
|
-
r !== null && e.push(r);
|
|
1440
|
-
}
|
|
1441
|
-
return e;
|
|
1442
|
-
}
|
|
1443
|
-
}, Yt = class {
|
|
1444
|
-
constructor(t) {
|
|
1445
|
-
C(this, "rings");
|
|
1446
|
-
C(this, "polys");
|
|
1447
|
-
this.rings = t, this.polys = this._composePolys(t);
|
|
1448
|
-
}
|
|
1449
|
-
getGeom() {
|
|
1450
|
-
const t = [];
|
|
1451
|
-
for (let e = 0, n = this.polys.length; e < n; e++) {
|
|
1452
|
-
const i = this.polys[e].getGeom();
|
|
1453
|
-
i !== null && t.push(i);
|
|
1454
|
-
}
|
|
1455
|
-
return t;
|
|
1456
|
-
}
|
|
1457
|
-
_composePolys(t) {
|
|
1458
|
-
var n;
|
|
1459
|
-
const e = [];
|
|
1460
|
-
for (let i = 0, r = t.length; i < r; i++) {
|
|
1461
|
-
const u = t[i];
|
|
1462
|
-
if (!u.poly)
|
|
1463
|
-
if (u.isExteriorRing()) e.push(new tt(u));
|
|
1464
|
-
else {
|
|
1465
|
-
const a = u.enclosingRing();
|
|
1466
|
-
a != null && a.poly || e.push(new tt(a)), (n = a == null ? void 0 : a.poly) == null || n.addInterior(u);
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
return e;
|
|
1470
|
-
}
|
|
1471
|
-
}, Wt = class {
|
|
1472
|
-
constructor(t, e = Ne.compare) {
|
|
1473
|
-
C(this, "queue");
|
|
1474
|
-
C(this, "tree");
|
|
1475
|
-
C(this, "segments");
|
|
1476
|
-
this.queue = t, this.tree = new Pe(e), this.segments = [];
|
|
1477
|
-
}
|
|
1478
|
-
process(t) {
|
|
1479
|
-
const e = t.segment, n = [];
|
|
1480
|
-
if (t.consumedBy)
|
|
1481
|
-
return t.isLeft ? this.queue.delete(t.otherSE) : this.tree.delete(e), n;
|
|
1482
|
-
t.isLeft && this.tree.add(e);
|
|
1483
|
-
let i = e, r = e;
|
|
1484
|
-
do
|
|
1485
|
-
i = this.tree.lastBefore(i);
|
|
1486
|
-
while (i != null && i.consumedBy != null);
|
|
1487
|
-
do
|
|
1488
|
-
r = this.tree.firstAfter(r);
|
|
1489
|
-
while (r != null && r.consumedBy != null);
|
|
1490
|
-
if (t.isLeft) {
|
|
1491
|
-
let u = null;
|
|
1492
|
-
if (i) {
|
|
1493
|
-
const h = i.getIntersection(e);
|
|
1494
|
-
if (h !== null && (e.isAnEndpoint(h) || (u = h), !i.isAnEndpoint(h))) {
|
|
1495
|
-
const E = this._splitSafely(i, h);
|
|
1496
|
-
for (let p = 0, _ = E.length; p < _; p++)
|
|
1497
|
-
n.push(E[p]);
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
let a = null;
|
|
1501
|
-
if (r) {
|
|
1502
|
-
const h = r.getIntersection(e);
|
|
1503
|
-
if (h !== null && (e.isAnEndpoint(h) || (a = h), !r.isAnEndpoint(h))) {
|
|
1504
|
-
const E = this._splitSafely(r, h);
|
|
1505
|
-
for (let p = 0, _ = E.length; p < _; p++)
|
|
1506
|
-
n.push(E[p]);
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
if (u !== null || a !== null) {
|
|
1510
|
-
let h = null;
|
|
1511
|
-
u === null ? h = a : a === null ? h = u : h = ne.comparePoints(
|
|
1512
|
-
u,
|
|
1513
|
-
a
|
|
1514
|
-
) <= 0 ? u : a, this.queue.delete(e.rightSE), n.push(e.rightSE);
|
|
1515
|
-
const E = e.split(h);
|
|
1516
|
-
for (let p = 0, _ = E.length; p < _; p++)
|
|
1517
|
-
n.push(E[p]);
|
|
1518
|
-
}
|
|
1519
|
-
n.length > 0 ? (this.tree.delete(e), n.push(t)) : (this.segments.push(e), e.prev = i);
|
|
1520
|
-
} else {
|
|
1521
|
-
if (i && r) {
|
|
1522
|
-
const u = i.getIntersection(r);
|
|
1523
|
-
if (u !== null) {
|
|
1524
|
-
if (!i.isAnEndpoint(u)) {
|
|
1525
|
-
const a = this._splitSafely(i, u);
|
|
1526
|
-
for (let h = 0, E = a.length; h < E; h++)
|
|
1527
|
-
n.push(a[h]);
|
|
1528
|
-
}
|
|
1529
|
-
if (!r.isAnEndpoint(u)) {
|
|
1530
|
-
const a = this._splitSafely(r, u);
|
|
1531
|
-
for (let h = 0, E = a.length; h < E; h++)
|
|
1532
|
-
n.push(a[h]);
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
this.tree.delete(e);
|
|
1537
|
-
}
|
|
1538
|
-
return n;
|
|
1539
|
-
}
|
|
1540
|
-
/* Safely split a segment that is currently in the datastructures
|
|
1541
|
-
* IE - a segment other than the one that is currently being processed. */
|
|
1542
|
-
_splitSafely(t, e) {
|
|
1543
|
-
this.tree.delete(t);
|
|
1544
|
-
const n = t.rightSE;
|
|
1545
|
-
this.queue.delete(n);
|
|
1546
|
-
const i = t.split(e);
|
|
1547
|
-
return i.push(n), t.consumedBy === void 0 && this.tree.add(t), i;
|
|
1548
|
-
}
|
|
1549
|
-
}, Jt = class {
|
|
1550
|
-
constructor() {
|
|
1551
|
-
C(this, "type");
|
|
1552
|
-
C(this, "numMultiPolys");
|
|
1553
|
-
}
|
|
1554
|
-
run(t, e, n) {
|
|
1555
|
-
xe.type = t;
|
|
1556
|
-
const i = [new it(e, !0)];
|
|
1557
|
-
for (let p = 0, _ = n.length; p < _; p++)
|
|
1558
|
-
i.push(new it(n[p], !1));
|
|
1559
|
-
if (xe.numMultiPolys = i.length, xe.type === "difference") {
|
|
1560
|
-
const p = i[0];
|
|
1561
|
-
let _ = 1;
|
|
1562
|
-
for (; _ < i.length; )
|
|
1563
|
-
ze(i[_].bbox, p.bbox) !== null ? _++ : i.splice(_, 1);
|
|
1564
|
-
}
|
|
1565
|
-
if (xe.type === "intersection")
|
|
1566
|
-
for (let p = 0, _ = i.length; p < _; p++) {
|
|
1567
|
-
const b = i[p];
|
|
1568
|
-
for (let M = p + 1, T = i.length; M < T; M++)
|
|
1569
|
-
if (ze(b.bbox, i[M].bbox) === null) return [];
|
|
1570
|
-
}
|
|
1571
|
-
const r = new Pe(ne.compare);
|
|
1572
|
-
for (let p = 0, _ = i.length; p < _; p++) {
|
|
1573
|
-
const b = i[p].getSweepEvents();
|
|
1574
|
-
for (let M = 0, T = b.length; M < T; M++)
|
|
1575
|
-
r.add(b[M]);
|
|
1576
|
-
}
|
|
1577
|
-
const u = new Wt(r);
|
|
1578
|
-
let a = null;
|
|
1579
|
-
for (r.size != 0 && (a = r.first(), r.delete(a)); a; ) {
|
|
1580
|
-
const p = u.process(a);
|
|
1581
|
-
for (let _ = 0, b = p.length; _ < b; _++) {
|
|
1582
|
-
const M = p[_];
|
|
1583
|
-
M.consumedBy === void 0 && r.add(M);
|
|
1584
|
-
}
|
|
1585
|
-
r.size != 0 ? (a = r.first(), r.delete(a)) : a = null;
|
|
1586
|
-
}
|
|
1587
|
-
oe.reset();
|
|
1588
|
-
const h = Zt.factory(u.segments);
|
|
1589
|
-
return new Yt(h).getGeom();
|
|
1590
|
-
}
|
|
1591
|
-
}, xe = new Jt(), Re = xe, Ht = 0, Ne = class Ce {
|
|
1592
|
-
/* Warning: a reference to ringWindings input will be stored,
|
|
1593
|
-
* and possibly will be later modified */
|
|
1594
|
-
constructor(e, n, i, r) {
|
|
1595
|
-
C(this, "id");
|
|
1596
|
-
C(this, "leftSE");
|
|
1597
|
-
C(this, "rightSE");
|
|
1598
|
-
C(this, "rings");
|
|
1599
|
-
C(this, "windings");
|
|
1600
|
-
C(this, "ringOut");
|
|
1601
|
-
C(this, "consumedBy");
|
|
1602
|
-
C(this, "prev");
|
|
1603
|
-
C(this, "_prevInResult");
|
|
1604
|
-
C(this, "_beforeState");
|
|
1605
|
-
C(this, "_afterState");
|
|
1606
|
-
C(this, "_isInResult");
|
|
1607
|
-
this.id = ++Ht, this.leftSE = e, e.segment = this, e.otherSE = n, this.rightSE = n, n.segment = this, n.otherSE = e, this.rings = i, this.windings = r;
|
|
1608
|
-
}
|
|
1609
|
-
/* This compare() function is for ordering segments in the sweep
|
|
1610
|
-
* line tree, and does so according to the following criteria:
|
|
1611
|
-
*
|
|
1612
|
-
* Consider the vertical line that lies an infinestimal step to the
|
|
1613
|
-
* right of the right-more of the two left endpoints of the input
|
|
1614
|
-
* segments. Imagine slowly moving a point up from negative infinity
|
|
1615
|
-
* in the increasing y direction. Which of the two segments will that
|
|
1616
|
-
* point intersect first? That segment comes 'before' the other one.
|
|
1617
|
-
*
|
|
1618
|
-
* If neither segment would be intersected by such a line, (if one
|
|
1619
|
-
* or more of the segments are vertical) then the line to be considered
|
|
1620
|
-
* is directly on the right-more of the two left inputs.
|
|
1621
|
-
*/
|
|
1622
|
-
static compare(e, n) {
|
|
1623
|
-
const i = e.leftSE.point.x, r = n.leftSE.point.x, u = e.rightSE.point.x, a = n.rightSE.point.x;
|
|
1624
|
-
if (a.isLessThan(i)) return 1;
|
|
1625
|
-
if (u.isLessThan(r)) return -1;
|
|
1626
|
-
const h = e.leftSE.point.y, E = n.leftSE.point.y, p = e.rightSE.point.y, _ = n.rightSE.point.y;
|
|
1627
|
-
if (i.isLessThan(r)) {
|
|
1628
|
-
if (E.isLessThan(h) && E.isLessThan(p)) return 1;
|
|
1629
|
-
if (E.isGreaterThan(h) && E.isGreaterThan(p)) return -1;
|
|
1630
|
-
const b = e.comparePoint(n.leftSE.point);
|
|
1631
|
-
if (b < 0) return 1;
|
|
1632
|
-
if (b > 0) return -1;
|
|
1633
|
-
const M = n.comparePoint(e.rightSE.point);
|
|
1634
|
-
return M !== 0 ? M : -1;
|
|
1635
|
-
}
|
|
1636
|
-
if (i.isGreaterThan(r)) {
|
|
1637
|
-
if (h.isLessThan(E) && h.isLessThan(_)) return -1;
|
|
1638
|
-
if (h.isGreaterThan(E) && h.isGreaterThan(_)) return 1;
|
|
1639
|
-
const b = n.comparePoint(e.leftSE.point);
|
|
1640
|
-
if (b !== 0) return b;
|
|
1641
|
-
const M = e.comparePoint(n.rightSE.point);
|
|
1642
|
-
return M < 0 ? 1 : M > 0 ? -1 : 1;
|
|
1643
|
-
}
|
|
1644
|
-
if (h.isLessThan(E)) return -1;
|
|
1645
|
-
if (h.isGreaterThan(E)) return 1;
|
|
1646
|
-
if (u.isLessThan(a)) {
|
|
1647
|
-
const b = n.comparePoint(e.rightSE.point);
|
|
1648
|
-
if (b !== 0) return b;
|
|
1649
|
-
}
|
|
1650
|
-
if (u.isGreaterThan(a)) {
|
|
1651
|
-
const b = e.comparePoint(n.rightSE.point);
|
|
1652
|
-
if (b < 0) return 1;
|
|
1653
|
-
if (b > 0) return -1;
|
|
1654
|
-
}
|
|
1655
|
-
if (!u.eq(a)) {
|
|
1656
|
-
const b = p.minus(h), M = u.minus(i), T = _.minus(E), L = a.minus(r);
|
|
1657
|
-
if (b.isGreaterThan(M) && T.isLessThan(L)) return 1;
|
|
1658
|
-
if (b.isLessThan(M) && T.isGreaterThan(L)) return -1;
|
|
1659
|
-
}
|
|
1660
|
-
return u.isGreaterThan(a) ? 1 : u.isLessThan(a) || p.isLessThan(_) ? -1 : p.isGreaterThan(_) ? 1 : e.id < n.id ? -1 : e.id > n.id ? 1 : 0;
|
|
1661
|
-
}
|
|
1662
|
-
static fromRing(e, n, i) {
|
|
1663
|
-
let r, u, a;
|
|
1664
|
-
const h = ne.comparePoints(e, n);
|
|
1665
|
-
if (h < 0)
|
|
1666
|
-
r = e, u = n, a = 1;
|
|
1667
|
-
else if (h > 0)
|
|
1668
|
-
r = n, u = e, a = -1;
|
|
1669
|
-
else
|
|
1670
|
-
throw new Error(
|
|
1671
|
-
`Tried to create degenerate segment at [${e.x}, ${e.y}]`
|
|
1672
|
-
);
|
|
1673
|
-
const E = new ne(r, !0), p = new ne(u, !1);
|
|
1674
|
-
return new Ce(E, p, [i], [a]);
|
|
1675
|
-
}
|
|
1676
|
-
/* When a segment is split, the rightSE is replaced with a new sweep event */
|
|
1677
|
-
replaceRightSE(e) {
|
|
1678
|
-
this.rightSE = e, this.rightSE.segment = this, this.rightSE.otherSE = this.leftSE, this.leftSE.otherSE = this.rightSE;
|
|
1679
|
-
}
|
|
1680
|
-
bbox() {
|
|
1681
|
-
const e = this.leftSE.point.y, n = this.rightSE.point.y;
|
|
1682
|
-
return {
|
|
1683
|
-
ll: { x: this.leftSE.point.x, y: e.isLessThan(n) ? e : n },
|
|
1684
|
-
ur: { x: this.rightSE.point.x, y: e.isGreaterThan(n) ? e : n }
|
|
1685
|
-
};
|
|
1686
|
-
}
|
|
1687
|
-
/* A vector from the left point to the right */
|
|
1688
|
-
vector() {
|
|
1689
|
-
return {
|
|
1690
|
-
x: this.rightSE.point.x.minus(this.leftSE.point.x),
|
|
1691
|
-
y: this.rightSE.point.y.minus(this.leftSE.point.y)
|
|
1692
|
-
};
|
|
1693
|
-
}
|
|
1694
|
-
isAnEndpoint(e) {
|
|
1695
|
-
return e.x.eq(this.leftSE.point.x) && e.y.eq(this.leftSE.point.y) || e.x.eq(this.rightSE.point.x) && e.y.eq(this.rightSE.point.y);
|
|
1696
|
-
}
|
|
1697
|
-
/* Compare this segment with a point.
|
|
1698
|
-
*
|
|
1699
|
-
* A point P is considered to be colinear to a segment if there
|
|
1700
|
-
* exists a distance D such that if we travel along the segment
|
|
1701
|
-
* from one * endpoint towards the other a distance D, we find
|
|
1702
|
-
* ourselves at point P.
|
|
1703
|
-
*
|
|
1704
|
-
* Return value indicates:
|
|
1705
|
-
*
|
|
1706
|
-
* 1: point lies above the segment (to the left of vertical)
|
|
1707
|
-
* 0: point is colinear to segment
|
|
1708
|
-
* -1: point lies below the segment (to the right of vertical)
|
|
1709
|
-
*/
|
|
1710
|
-
comparePoint(e) {
|
|
1711
|
-
return oe.orient(this.leftSE.point, e, this.rightSE.point);
|
|
1712
|
-
}
|
|
1713
|
-
/**
|
|
1714
|
-
* Given another segment, returns the first non-trivial intersection
|
|
1715
|
-
* between the two segments (in terms of sweep line ordering), if it exists.
|
|
1716
|
-
*
|
|
1717
|
-
* A 'non-trivial' intersection is one that will cause one or both of the
|
|
1718
|
-
* segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
|
|
1719
|
-
*
|
|
1720
|
-
* * endpoint of segA with endpoint of segB --> trivial
|
|
1721
|
-
* * endpoint of segA with point along segB --> non-trivial
|
|
1722
|
-
* * endpoint of segB with point along segA --> non-trivial
|
|
1723
|
-
* * point along segA with point along segB --> non-trivial
|
|
1724
|
-
*
|
|
1725
|
-
* If no non-trivial intersection exists, return null
|
|
1726
|
-
* Else, return null.
|
|
1727
|
-
*/
|
|
1728
|
-
getIntersection(e) {
|
|
1729
|
-
const n = this.bbox(), i = e.bbox(), r = ze(n, i);
|
|
1730
|
-
if (r === null) return null;
|
|
1731
|
-
const u = this.leftSE.point, a = this.rightSE.point, h = e.leftSE.point, E = e.rightSE.point, p = de(n, h) && this.comparePoint(h) === 0, _ = de(i, u) && e.comparePoint(u) === 0, b = de(n, E) && this.comparePoint(E) === 0, M = de(i, a) && e.comparePoint(a) === 0;
|
|
1732
|
-
if (_ && p)
|
|
1733
|
-
return M && !b ? a : !M && b ? E : null;
|
|
1734
|
-
if (_)
|
|
1735
|
-
return b && u.x.eq(E.x) && u.y.eq(E.y) ? null : u;
|
|
1736
|
-
if (p)
|
|
1737
|
-
return M && a.x.eq(h.x) && a.y.eq(h.y) ? null : h;
|
|
1738
|
-
if (M && b) return null;
|
|
1739
|
-
if (M) return a;
|
|
1740
|
-
if (b) return E;
|
|
1741
|
-
const T = Xt(u, this.vector(), h, e.vector());
|
|
1742
|
-
return T === null || !de(r, T) ? null : oe.snap(T);
|
|
1743
|
-
}
|
|
1744
|
-
/**
|
|
1745
|
-
* Split the given segment into multiple segments on the given points.
|
|
1746
|
-
* * Each existing segment will retain its leftSE and a new rightSE will be
|
|
1747
|
-
* generated for it.
|
|
1748
|
-
* * A new segment will be generated which will adopt the original segment's
|
|
1749
|
-
* rightSE, and a new leftSE will be generated for it.
|
|
1750
|
-
* * If there are more than two points given to split on, new segments
|
|
1751
|
-
* in the middle will be generated with new leftSE and rightSE's.
|
|
1752
|
-
* * An array of the newly generated SweepEvents will be returned.
|
|
1753
|
-
*
|
|
1754
|
-
* Warning: input array of points is modified
|
|
1755
|
-
*/
|
|
1756
|
-
split(e) {
|
|
1757
|
-
const n = [], i = e.events !== void 0, r = new ne(e, !0), u = new ne(e, !1), a = this.rightSE;
|
|
1758
|
-
this.replaceRightSE(u), n.push(u), n.push(r);
|
|
1759
|
-
const h = new Ce(
|
|
1760
|
-
r,
|
|
1761
|
-
a,
|
|
1762
|
-
this.rings.slice(),
|
|
1763
|
-
this.windings.slice()
|
|
1764
|
-
);
|
|
1765
|
-
return ne.comparePoints(h.leftSE.point, h.rightSE.point) > 0 && h.swapEvents(), ne.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), i && (r.checkForConsuming(), u.checkForConsuming()), n;
|
|
1766
|
-
}
|
|
1767
|
-
/* Swap which event is left and right */
|
|
1768
|
-
swapEvents() {
|
|
1769
|
-
const e = this.rightSE;
|
|
1770
|
-
this.rightSE = this.leftSE, this.leftSE = e, this.leftSE.isLeft = !0, this.rightSE.isLeft = !1;
|
|
1771
|
-
for (let n = 0, i = this.windings.length; n < i; n++)
|
|
1772
|
-
this.windings[n] *= -1;
|
|
1773
|
-
}
|
|
1774
|
-
/* Consume another segment. We take their rings under our wing
|
|
1775
|
-
* and mark them as consumed. Use for perfectly overlapping segments */
|
|
1776
|
-
consume(e) {
|
|
1777
|
-
let n = this, i = e;
|
|
1778
|
-
for (; n.consumedBy; ) n = n.consumedBy;
|
|
1779
|
-
for (; i.consumedBy; ) i = i.consumedBy;
|
|
1780
|
-
const r = Ce.compare(n, i);
|
|
1781
|
-
if (r !== 0) {
|
|
1782
|
-
if (r > 0) {
|
|
1783
|
-
const u = n;
|
|
1784
|
-
n = i, i = u;
|
|
1785
|
-
}
|
|
1786
|
-
if (n.prev === i) {
|
|
1787
|
-
const u = n;
|
|
1788
|
-
n = i, i = u;
|
|
1789
|
-
}
|
|
1790
|
-
for (let u = 0, a = i.rings.length; u < a; u++) {
|
|
1791
|
-
const h = i.rings[u], E = i.windings[u], p = n.rings.indexOf(h);
|
|
1792
|
-
p === -1 ? (n.rings.push(h), n.windings.push(E)) : n.windings[p] += E;
|
|
1793
|
-
}
|
|
1794
|
-
i.rings = null, i.windings = null, i.consumedBy = n, i.leftSE.consumedBy = n.leftSE, i.rightSE.consumedBy = n.rightSE;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
/* The first segment previous segment chain that is in the result */
|
|
1798
|
-
prevInResult() {
|
|
1799
|
-
return this._prevInResult !== void 0 ? this._prevInResult : (this.prev ? this.prev.isInResult() ? this._prevInResult = this.prev : this._prevInResult = this.prev.prevInResult() : this._prevInResult = null, this._prevInResult);
|
|
1800
|
-
}
|
|
1801
|
-
beforeState() {
|
|
1802
|
-
if (this._beforeState !== void 0) return this._beforeState;
|
|
1803
|
-
if (!this.prev)
|
|
1804
|
-
this._beforeState = {
|
|
1805
|
-
rings: [],
|
|
1806
|
-
windings: [],
|
|
1807
|
-
multiPolys: []
|
|
1808
|
-
};
|
|
1809
|
-
else {
|
|
1810
|
-
const e = this.prev.consumedBy || this.prev;
|
|
1811
|
-
this._beforeState = e.afterState();
|
|
1812
|
-
}
|
|
1813
|
-
return this._beforeState;
|
|
1814
|
-
}
|
|
1815
|
-
afterState() {
|
|
1816
|
-
if (this._afterState !== void 0) return this._afterState;
|
|
1817
|
-
const e = this.beforeState();
|
|
1818
|
-
this._afterState = {
|
|
1819
|
-
rings: e.rings.slice(0),
|
|
1820
|
-
windings: e.windings.slice(0),
|
|
1821
|
-
multiPolys: []
|
|
1822
|
-
};
|
|
1823
|
-
const n = this._afterState.rings, i = this._afterState.windings, r = this._afterState.multiPolys;
|
|
1824
|
-
for (let h = 0, E = this.rings.length; h < E; h++) {
|
|
1825
|
-
const p = this.rings[h], _ = this.windings[h], b = n.indexOf(p);
|
|
1826
|
-
b === -1 ? (n.push(p), i.push(_)) : i[b] += _;
|
|
1827
|
-
}
|
|
1828
|
-
const u = [], a = [];
|
|
1829
|
-
for (let h = 0, E = n.length; h < E; h++) {
|
|
1830
|
-
if (i[h] === 0) continue;
|
|
1831
|
-
const p = n[h], _ = p.poly;
|
|
1832
|
-
if (a.indexOf(_) === -1)
|
|
1833
|
-
if (p.isExterior) u.push(_);
|
|
1834
|
-
else {
|
|
1835
|
-
a.indexOf(_) === -1 && a.push(_);
|
|
1836
|
-
const b = u.indexOf(p.poly);
|
|
1837
|
-
b !== -1 && u.splice(b, 1);
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
for (let h = 0, E = u.length; h < E; h++) {
|
|
1841
|
-
const p = u[h].multiPoly;
|
|
1842
|
-
r.indexOf(p) === -1 && r.push(p);
|
|
1843
|
-
}
|
|
1844
|
-
return this._afterState;
|
|
1845
|
-
}
|
|
1846
|
-
/* Is this segment part of the final result? */
|
|
1847
|
-
isInResult() {
|
|
1848
|
-
if (this.consumedBy) return !1;
|
|
1849
|
-
if (this._isInResult !== void 0) return this._isInResult;
|
|
1850
|
-
const e = this.beforeState().multiPolys, n = this.afterState().multiPolys;
|
|
1851
|
-
switch (Re.type) {
|
|
1852
|
-
case "union": {
|
|
1853
|
-
const i = e.length === 0, r = n.length === 0;
|
|
1854
|
-
this._isInResult = i !== r;
|
|
1855
|
-
break;
|
|
1856
|
-
}
|
|
1857
|
-
case "intersection": {
|
|
1858
|
-
let i, r;
|
|
1859
|
-
e.length < n.length ? (i = e.length, r = n.length) : (i = n.length, r = e.length), this._isInResult = r === Re.numMultiPolys && i < r;
|
|
1860
|
-
break;
|
|
1861
|
-
}
|
|
1862
|
-
case "xor": {
|
|
1863
|
-
const i = Math.abs(e.length - n.length);
|
|
1864
|
-
this._isInResult = i % 2 === 1;
|
|
1865
|
-
break;
|
|
1866
|
-
}
|
|
1867
|
-
case "difference": {
|
|
1868
|
-
const i = (r) => r.length === 1 && r[0].isSubject;
|
|
1869
|
-
this._isInResult = i(e) !== i(n);
|
|
1870
|
-
break;
|
|
1871
|
-
}
|
|
1872
|
-
}
|
|
1873
|
-
return this._isInResult;
|
|
1874
|
-
}
|
|
1875
|
-
}, nt = class {
|
|
1876
|
-
constructor(t, e, n) {
|
|
1877
|
-
C(this, "poly");
|
|
1878
|
-
C(this, "isExterior");
|
|
1879
|
-
C(this, "segments");
|
|
1880
|
-
C(this, "bbox");
|
|
1881
|
-
if (!Array.isArray(t) || t.length === 0)
|
|
1882
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1883
|
-
if (this.poly = e, this.isExterior = n, this.segments = [], typeof t[0][0] != "number" || typeof t[0][1] != "number")
|
|
1884
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1885
|
-
const i = oe.snap({ x: new ie(t[0][0]), y: new ie(t[0][1]) });
|
|
1886
|
-
this.bbox = {
|
|
1887
|
-
ll: { x: i.x, y: i.y },
|
|
1888
|
-
ur: { x: i.x, y: i.y }
|
|
1889
|
-
};
|
|
1890
|
-
let r = i;
|
|
1891
|
-
for (let u = 1, a = t.length; u < a; u++) {
|
|
1892
|
-
if (typeof t[u][0] != "number" || typeof t[u][1] != "number")
|
|
1893
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1894
|
-
const h = oe.snap({ x: new ie(t[u][0]), y: new ie(t[u][1]) });
|
|
1895
|
-
h.x.eq(r.x) && h.y.eq(r.y) || (this.segments.push(Ne.fromRing(r, h, this)), h.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = h.x), h.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = h.y), h.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = h.x), h.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = h.y), r = h);
|
|
1896
|
-
}
|
|
1897
|
-
(!i.x.eq(r.x) || !i.y.eq(r.y)) && this.segments.push(Ne.fromRing(r, i, this));
|
|
1898
|
-
}
|
|
1899
|
-
getSweepEvents() {
|
|
1900
|
-
const t = [];
|
|
1901
|
-
for (let e = 0, n = this.segments.length; e < n; e++) {
|
|
1902
|
-
const i = this.segments[e];
|
|
1903
|
-
t.push(i.leftSE), t.push(i.rightSE);
|
|
1904
|
-
}
|
|
1905
|
-
return t;
|
|
1906
|
-
}
|
|
1907
|
-
}, jt = class {
|
|
1908
|
-
constructor(t, e) {
|
|
1909
|
-
C(this, "multiPoly");
|
|
1910
|
-
C(this, "exteriorRing");
|
|
1911
|
-
C(this, "interiorRings");
|
|
1912
|
-
C(this, "bbox");
|
|
1913
|
-
if (!Array.isArray(t))
|
|
1914
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1915
|
-
this.exteriorRing = new nt(t[0], this, !0), this.bbox = {
|
|
1916
|
-
ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
|
|
1917
|
-
ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
|
|
1918
|
-
}, this.interiorRings = [];
|
|
1919
|
-
for (let n = 1, i = t.length; n < i; n++) {
|
|
1920
|
-
const r = new nt(t[n], this, !1);
|
|
1921
|
-
r.bbox.ll.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = r.bbox.ll.x), r.bbox.ll.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = r.bbox.ll.y), r.bbox.ur.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = r.bbox.ur.x), r.bbox.ur.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = r.bbox.ur.y), this.interiorRings.push(r);
|
|
1922
|
-
}
|
|
1923
|
-
this.multiPoly = e;
|
|
1924
|
-
}
|
|
1925
|
-
getSweepEvents() {
|
|
1926
|
-
const t = this.exteriorRing.getSweepEvents();
|
|
1927
|
-
for (let e = 0, n = this.interiorRings.length; e < n; e++) {
|
|
1928
|
-
const i = this.interiorRings[e].getSweepEvents();
|
|
1929
|
-
for (let r = 0, u = i.length; r < u; r++)
|
|
1930
|
-
t.push(i[r]);
|
|
1931
|
-
}
|
|
1932
|
-
return t;
|
|
1933
|
-
}
|
|
1934
|
-
}, it = class {
|
|
1935
|
-
constructor(t, e) {
|
|
1936
|
-
C(this, "isSubject");
|
|
1937
|
-
C(this, "polys");
|
|
1938
|
-
C(this, "bbox");
|
|
1939
|
-
if (!Array.isArray(t))
|
|
1940
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1941
|
-
try {
|
|
1942
|
-
typeof t[0][0][0] == "number" && (t = [t]);
|
|
1943
|
-
} catch {
|
|
1944
|
-
}
|
|
1945
|
-
this.polys = [], this.bbox = {
|
|
1946
|
-
ll: { x: new ie(Number.POSITIVE_INFINITY), y: new ie(Number.POSITIVE_INFINITY) },
|
|
1947
|
-
ur: { x: new ie(Number.NEGATIVE_INFINITY), y: new ie(Number.NEGATIVE_INFINITY) }
|
|
1948
|
-
};
|
|
1949
|
-
for (let n = 0, i = t.length; n < i; n++) {
|
|
1950
|
-
const r = new jt(t[n], this);
|
|
1951
|
-
r.bbox.ll.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = r.bbox.ll.x), r.bbox.ll.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = r.bbox.ll.y), r.bbox.ur.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = r.bbox.ur.x), r.bbox.ur.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = r.bbox.ur.y), this.polys.push(r);
|
|
1952
|
-
}
|
|
1953
|
-
this.isSubject = e;
|
|
1954
|
-
}
|
|
1955
|
-
getSweepEvents() {
|
|
1956
|
-
const t = [];
|
|
1957
|
-
for (let e = 0, n = this.polys.length; e < n; e++) {
|
|
1958
|
-
const i = this.polys[e].getSweepEvents();
|
|
1959
|
-
for (let r = 0, u = i.length; r < u; r++)
|
|
1960
|
-
t.push(i[r]);
|
|
1961
|
-
}
|
|
1962
|
-
return t;
|
|
1963
|
-
}
|
|
1964
|
-
}, Qt = (t, ...e) => Re.run("union", t, e), en = (t, ...e) => Re.run("difference", t, e);
|
|
1965
|
-
oe.set;
|
|
1966
|
-
function tn(t, e = {}) {
|
|
1967
|
-
const n = [];
|
|
1968
|
-
if (Ye(t, (r) => {
|
|
1969
|
-
n.push(r.coordinates);
|
|
1970
|
-
}), n.length < 2)
|
|
1971
|
-
throw new Error("Must have at least 2 geometries");
|
|
1972
|
-
const i = Qt(n[0], ...n.slice(1));
|
|
1973
|
-
return i.length === 0 ? null : i.length === 1 ? Ze(i[0], e.properties) : gt(i, e.properties);
|
|
1974
|
-
}
|
|
1975
|
-
var _t = tn;
|
|
1976
|
-
function Ve(t) {
|
|
1977
|
-
const e = [...t];
|
|
1978
|
-
return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
|
|
1979
|
-
}
|
|
1980
|
-
function Se() {
|
|
1981
|
-
}
|
|
1982
|
-
function Tt(t) {
|
|
1983
|
-
return t();
|
|
1984
|
-
}
|
|
1985
|
-
function rt() {
|
|
1986
|
-
return /* @__PURE__ */ Object.create(null);
|
|
1987
|
-
}
|
|
1988
|
-
function Ae(t) {
|
|
1989
|
-
t.forEach(Tt);
|
|
1990
|
-
}
|
|
1991
|
-
function Lt(t) {
|
|
1992
|
-
return typeof t == "function";
|
|
1993
|
-
}
|
|
1994
|
-
function nn(t, e) {
|
|
1995
|
-
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
1996
|
-
}
|
|
1997
|
-
function rn(t) {
|
|
1998
|
-
return Object.keys(t).length === 0;
|
|
1999
|
-
}
|
|
2000
|
-
function sn(t, e) {
|
|
2001
|
-
t.appendChild(e);
|
|
2002
|
-
}
|
|
2003
|
-
function on(t, e, n) {
|
|
2004
|
-
t.insertBefore(e, n || null);
|
|
2005
|
-
}
|
|
2006
|
-
function Mt(t) {
|
|
2007
|
-
t.parentNode && t.parentNode.removeChild(t);
|
|
2008
|
-
}
|
|
2009
|
-
function st(t) {
|
|
2010
|
-
return document.createElementNS("http://www.w3.org/2000/svg", t);
|
|
2011
|
-
}
|
|
2012
|
-
function ue(t, e, n) {
|
|
2013
|
-
n == null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n);
|
|
2014
|
-
}
|
|
2015
|
-
function ln(t) {
|
|
2016
|
-
return Array.from(t.childNodes);
|
|
2017
|
-
}
|
|
2018
|
-
function Le(t, e, n) {
|
|
2019
|
-
t.classList.toggle(e, !!n);
|
|
2020
|
-
}
|
|
2021
|
-
let Je;
|
|
2022
|
-
function we(t) {
|
|
2023
|
-
Je = t;
|
|
2024
|
-
}
|
|
2025
|
-
const he = [], ot = [];
|
|
2026
|
-
let pe = [];
|
|
2027
|
-
const lt = [], un = /* @__PURE__ */ Promise.resolve();
|
|
2028
|
-
let Ke = !1;
|
|
2029
|
-
function fn() {
|
|
2030
|
-
Ke || (Ke = !0, un.then(Ct));
|
|
2031
|
-
}
|
|
2032
|
-
function Xe(t) {
|
|
2033
|
-
pe.push(t);
|
|
2034
|
-
}
|
|
2035
|
-
const $e = /* @__PURE__ */ new Set();
|
|
2036
|
-
let ae = 0;
|
|
2037
|
-
function Ct() {
|
|
2038
|
-
if (ae !== 0)
|
|
2039
|
-
return;
|
|
2040
|
-
const t = Je;
|
|
2041
|
-
do {
|
|
2042
|
-
try {
|
|
2043
|
-
for (; ae < he.length; ) {
|
|
2044
|
-
const e = he[ae];
|
|
2045
|
-
ae++, we(e), cn(e.$$);
|
|
2046
|
-
}
|
|
2047
|
-
} catch (e) {
|
|
2048
|
-
throw he.length = 0, ae = 0, e;
|
|
2049
|
-
}
|
|
2050
|
-
for (we(null), he.length = 0, ae = 0; ot.length; ) ot.pop()();
|
|
2051
|
-
for (let e = 0; e < pe.length; e += 1) {
|
|
2052
|
-
const n = pe[e];
|
|
2053
|
-
$e.has(n) || ($e.add(n), n());
|
|
2054
|
-
}
|
|
2055
|
-
pe.length = 0;
|
|
2056
|
-
} while (he.length);
|
|
2057
|
-
for (; lt.length; )
|
|
2058
|
-
lt.pop()();
|
|
2059
|
-
Ke = !1, $e.clear(), we(t);
|
|
2060
|
-
}
|
|
2061
|
-
function cn(t) {
|
|
2062
|
-
if (t.fragment !== null) {
|
|
2063
|
-
t.update(), Ae(t.before_update);
|
|
2064
|
-
const e = t.dirty;
|
|
2065
|
-
t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Xe);
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
function an(t) {
|
|
2069
|
-
const e = [], n = [];
|
|
2070
|
-
pe.forEach((i) => t.indexOf(i) === -1 ? e.push(i) : n.push(i)), n.forEach((i) => i()), pe = e;
|
|
2071
|
-
}
|
|
2072
|
-
const hn = /* @__PURE__ */ new Set();
|
|
2073
|
-
function pn(t, e) {
|
|
2074
|
-
t && t.i && (hn.delete(t), t.i(e));
|
|
2075
|
-
}
|
|
2076
|
-
function gn(t, e, n) {
|
|
2077
|
-
const { fragment: i, after_update: r } = t.$$;
|
|
2078
|
-
i && i.m(e, n), Xe(() => {
|
|
2079
|
-
const u = t.$$.on_mount.map(Tt).filter(Lt);
|
|
2080
|
-
t.$$.on_destroy ? t.$$.on_destroy.push(...u) : Ae(u), t.$$.on_mount = [];
|
|
2081
|
-
}), r.forEach(Xe);
|
|
2082
|
-
}
|
|
2083
|
-
function yn(t, e) {
|
|
2084
|
-
const n = t.$$;
|
|
2085
|
-
n.fragment !== null && (an(n.after_update), Ae(n.on_destroy), n.fragment && n.fragment.d(e), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
2086
|
-
}
|
|
2087
|
-
function dn(t, e) {
|
|
2088
|
-
t.$$.dirty[0] === -1 && (he.push(t), fn(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
2089
|
-
}
|
|
2090
|
-
function mn(t, e, n, i, r, u, a = null, h = [-1]) {
|
|
2091
|
-
const E = Je;
|
|
2092
|
-
we(t);
|
|
2093
|
-
const p = t.$$ = {
|
|
2094
|
-
fragment: null,
|
|
2095
|
-
ctx: [],
|
|
2096
|
-
// state
|
|
2097
|
-
props: u,
|
|
2098
|
-
update: Se,
|
|
2099
|
-
not_equal: r,
|
|
2100
|
-
bound: rt(),
|
|
2101
|
-
// lifecycle
|
|
2102
|
-
on_mount: [],
|
|
2103
|
-
on_destroy: [],
|
|
2104
|
-
on_disconnect: [],
|
|
2105
|
-
before_update: [],
|
|
2106
|
-
after_update: [],
|
|
2107
|
-
context: new Map(e.context || (E ? E.$$.context : [])),
|
|
2108
|
-
// everything else
|
|
2109
|
-
callbacks: rt(),
|
|
2110
|
-
dirty: h,
|
|
2111
|
-
skip_bound: !1,
|
|
2112
|
-
root: e.target || E.$$.root
|
|
2113
|
-
};
|
|
2114
|
-
a && a(p.root);
|
|
2115
|
-
let _ = !1;
|
|
2116
|
-
if (p.ctx = n(t, e.props || {}, (b, M, ...T) => {
|
|
2117
|
-
const L = T.length ? T[0] : M;
|
|
2118
|
-
return p.ctx && r(p.ctx[b], p.ctx[b] = L) && (!p.skip_bound && p.bound[b] && p.bound[b](L), _ && dn(t, b)), M;
|
|
2119
|
-
}), p.update(), _ = !0, Ae(p.before_update), p.fragment = i(p.ctx), e.target) {
|
|
2120
|
-
if (e.hydrate) {
|
|
2121
|
-
const b = ln(e.target);
|
|
2122
|
-
p.fragment && p.fragment.l(b), b.forEach(Mt);
|
|
2123
|
-
} else
|
|
2124
|
-
p.fragment && p.fragment.c();
|
|
2125
|
-
e.intro && pn(t.$$.fragment), gn(t, e.target, e.anchor), Ct();
|
|
2126
|
-
}
|
|
2127
|
-
we(E);
|
|
2128
|
-
}
|
|
2129
|
-
class xn {
|
|
2130
|
-
constructor() {
|
|
2131
|
-
/**
|
|
2132
|
-
* ### PRIVATE API
|
|
2133
|
-
*
|
|
2134
|
-
* Do not use, may change at any time
|
|
2135
|
-
*
|
|
2136
|
-
* @type {any}
|
|
2137
|
-
*/
|
|
2138
|
-
C(this, "$$");
|
|
2139
|
-
/**
|
|
2140
|
-
* ### PRIVATE API
|
|
2141
|
-
*
|
|
2142
|
-
* Do not use, may change at any time
|
|
2143
|
-
*
|
|
2144
|
-
* @type {any}
|
|
2145
|
-
*/
|
|
2146
|
-
C(this, "$$set");
|
|
2147
|
-
}
|
|
2148
|
-
/** @returns {void} */
|
|
2149
|
-
$destroy() {
|
|
2150
|
-
yn(this, 1), this.$destroy = Se;
|
|
2151
|
-
}
|
|
2152
|
-
/**
|
|
2153
|
-
* @template {Extract<keyof Events, string>} K
|
|
2154
|
-
* @param {K} type
|
|
2155
|
-
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
2156
|
-
* @returns {() => void}
|
|
2157
|
-
*/
|
|
2158
|
-
$on(e, n) {
|
|
2159
|
-
if (!Lt(n))
|
|
2160
|
-
return Se;
|
|
2161
|
-
const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
2162
|
-
return i.push(n), () => {
|
|
2163
|
-
const r = i.indexOf(n);
|
|
2164
|
-
r !== -1 && i.splice(r, 1);
|
|
2165
|
-
};
|
|
2166
|
-
}
|
|
2167
|
-
/**
|
|
2168
|
-
* @param {Partial<Props>} props
|
|
2169
|
-
* @returns {void}
|
|
2170
|
-
*/
|
|
2171
|
-
$set(e) {
|
|
2172
|
-
this.$$set && !rn(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
const wn = "4";
|
|
2176
|
-
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(wn);
|
|
2177
|
-
function En(t) {
|
|
2178
|
-
let e, n, i;
|
|
2179
|
-
return {
|
|
2180
|
-
c() {
|
|
2181
|
-
e = st("svg"), n = st("path"), ue(n, "stroke-width", "4"), ue(n, "d", "M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"), ue(n, "class", "svelte-gzo3ar"), ue(e, "width", i = /*displayIn*/
|
|
2182
|
-
t[0] === "list" ? 20 : void 0), ue(e, "viewBox", "0 0 70 85"), ue(e, "fill", "none"), ue(e, "class", "svelte-gzo3ar"), Le(
|
|
2183
|
-
e,
|
|
2184
|
-
"in-map",
|
|
2185
|
-
/*displayIn*/
|
|
2186
|
-
t[0] !== "list"
|
|
2187
|
-
), Le(
|
|
2188
|
-
e,
|
|
2189
|
-
"list-icon",
|
|
2190
|
-
/*displayIn*/
|
|
2191
|
-
t[0] === "list"
|
|
2192
|
-
);
|
|
2193
|
-
},
|
|
2194
|
-
m(r, u) {
|
|
2195
|
-
on(r, e, u), sn(e, n);
|
|
2196
|
-
},
|
|
2197
|
-
p(r, [u]) {
|
|
2198
|
-
u & /*displayIn*/
|
|
2199
|
-
1 && i !== (i = /*displayIn*/
|
|
2200
|
-
r[0] === "list" ? 20 : void 0) && ue(e, "width", i), u & /*displayIn*/
|
|
2201
|
-
1 && Le(
|
|
2202
|
-
e,
|
|
2203
|
-
"in-map",
|
|
2204
|
-
/*displayIn*/
|
|
2205
|
-
r[0] !== "list"
|
|
2206
|
-
), u & /*displayIn*/
|
|
2207
|
-
1 && Le(
|
|
2208
|
-
e,
|
|
2209
|
-
"list-icon",
|
|
2210
|
-
/*displayIn*/
|
|
2211
|
-
r[0] === "list"
|
|
2212
|
-
);
|
|
2213
|
-
},
|
|
2214
|
-
i: Se,
|
|
2215
|
-
o: Se,
|
|
2216
|
-
d(r) {
|
|
2217
|
-
r && Mt(e);
|
|
2218
|
-
}
|
|
2219
|
-
};
|
|
2220
|
-
}
|
|
2221
|
-
function vn(t, e, n) {
|
|
2222
|
-
let { displayIn: i } = e;
|
|
2223
|
-
return t.$$set = (r) => {
|
|
2224
|
-
"displayIn" in r && n(0, i = r.displayIn);
|
|
2225
|
-
}, [i];
|
|
2226
|
-
}
|
|
2227
|
-
class Sn extends xn {
|
|
2228
|
-
constructor(e) {
|
|
2229
|
-
super(), mn(this, e, vn, En, nn, { displayIn: 0 });
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
function bn(t) {
|
|
2233
|
-
const e = [];
|
|
2234
|
-
if (Ye(t, (r) => {
|
|
2235
|
-
e.push(r.coordinates);
|
|
2236
|
-
}), e.length < 2)
|
|
2237
|
-
throw new Error("Must have at least two features");
|
|
2238
|
-
const n = t.features[0].properties || {}, i = en(e[0], ...e.slice(1));
|
|
2239
|
-
return i.length === 0 ? null : i.length === 1 ? Ze(i[0], n) : gt(i, n);
|
|
2240
|
-
}
|
|
2241
|
-
var _n = bn;
|
|
2242
|
-
function Tn(t) {
|
|
2243
|
-
if (!t) throw new Error("geojson is required");
|
|
2244
|
-
var e = [];
|
|
2245
|
-
return Rt(t, function(n) {
|
|
2246
|
-
e.push(n);
|
|
2247
|
-
}), ve(e);
|
|
2248
|
-
}
|
|
2249
|
-
var Ln = Tn;
|
|
2250
|
-
function ut(t, e) {
|
|
2251
|
-
const n = _n(
|
|
2252
|
-
ve([
|
|
2253
|
-
Ze([
|
|
2254
|
-
[
|
|
2255
|
-
[180, 90],
|
|
2256
|
-
[-180, 90],
|
|
2257
|
-
[-180, -90],
|
|
2258
|
-
[180, -90],
|
|
2259
|
-
[180, 90]
|
|
2260
|
-
]
|
|
2261
|
-
]),
|
|
2262
|
-
t
|
|
2263
|
-
])
|
|
2264
|
-
);
|
|
2265
|
-
if (!n)
|
|
2266
|
-
return;
|
|
2267
|
-
n.properties = { isMask: !0 };
|
|
2268
|
-
const i = Ve(qe(t)), r = (i[2] - i[0]) / 360 / 1e3, u = i[0] < -180, a = i[2] > 180, h = Ln(t);
|
|
2269
|
-
if (h.features.length > 1 && (u || a))
|
|
2270
|
-
for (const E of h.features) {
|
|
2271
|
-
const p = Ve(qe(E));
|
|
2272
|
-
if (a && p[0] < -180 + r)
|
|
2273
|
-
for (const _ of E.geometry.coordinates)
|
|
2274
|
-
for (const b of _)
|
|
2275
|
-
b[0] += 360 - r;
|
|
2276
|
-
if (u && p[2] > 180 - r)
|
|
2277
|
-
for (const _ of E.geometry.coordinates)
|
|
2278
|
-
for (const b of _)
|
|
2279
|
-
b[0] -= 360 - r;
|
|
2280
|
-
}
|
|
2281
|
-
e(
|
|
2282
|
-
ve([
|
|
2283
|
-
h.features.length < 2 ? t : _t(h) ?? t,
|
|
2284
|
-
n
|
|
2285
|
-
])
|
|
2286
|
-
);
|
|
2287
|
-
}
|
|
2288
|
-
const ft = (t) => {
|
|
2289
|
-
var i, r, u;
|
|
2290
|
-
const e = (i = t == null ? void 0 : t.geometry) == null ? void 0 : i.type, n = (r = t == null ? void 0 : t.properties) != null && r.isMask ? 0 : e === "LineString" || e === "MultiLineString" ? 3 : 2;
|
|
2291
|
-
return {
|
|
2292
|
-
color: "#3170fe",
|
|
2293
|
-
fillColor: "#000",
|
|
2294
|
-
fillOpacity: (u = t == null ? void 0 : t.properties) != null && u.isMask ? 0.1 : 0,
|
|
2295
|
-
weight: n,
|
|
2296
|
-
dashArray: [n, n],
|
|
2297
|
-
lineCap: "butt"
|
|
2298
|
-
};
|
|
2299
|
-
};
|
|
2300
|
-
function Cn(t, e = !0, n = !0, i = {}, r = {}, u = ft) {
|
|
2301
|
-
let a;
|
|
2302
|
-
const h = [];
|
|
2303
|
-
let E, p;
|
|
2304
|
-
const _ = ce.geoJSON(void 0, {
|
|
2305
|
-
style: u === !0 ? ft : u === !1 ? void 0 : u ?? void 0,
|
|
2306
|
-
interactive: !1
|
|
2307
|
-
}).addTo(t), b = (T) => {
|
|
2308
|
-
a == null || a({
|
|
2309
|
-
type: "mapClick",
|
|
2310
|
-
coordinates: [T.latlng.lng, T.latlng.lat]
|
|
2311
|
-
});
|
|
2312
|
-
};
|
|
2313
|
-
function M(T, L = !1) {
|
|
2314
|
-
const B = document.createElement("div");
|
|
2315
|
-
return new Sn({ props: { displayIn: "leaflet" }, target: B }), new ce.Marker(T, {
|
|
2316
|
-
interactive: L,
|
|
2317
|
-
icon: new ce.DivIcon({
|
|
2318
|
-
html: B,
|
|
2319
|
-
className: "",
|
|
2320
|
-
iconAnchor: [12, 26],
|
|
2321
|
-
iconSize: [25, 30],
|
|
2322
|
-
tooltipAnchor: [1, -24]
|
|
2323
|
-
})
|
|
2324
|
-
});
|
|
2325
|
-
}
|
|
2326
|
-
return {
|
|
2327
|
-
setEventHandler(T) {
|
|
2328
|
-
T ? (a = T, t.on("click", b)) : (a = void 0, t.off("click", b));
|
|
2329
|
-
},
|
|
2330
|
-
flyTo(T, L) {
|
|
2331
|
-
t.flyTo([T[1], T[0]], L, { duration: 2, ...i });
|
|
2332
|
-
},
|
|
2333
|
-
fitBounds(T, L, B) {
|
|
2334
|
-
t.flyToBounds(
|
|
2335
|
-
[
|
|
2336
|
-
[T[1], T[0]],
|
|
2337
|
-
[T[3], T[2]]
|
|
2338
|
-
],
|
|
2339
|
-
{
|
|
2340
|
-
padding: [L, L],
|
|
2341
|
-
duration: 2,
|
|
2342
|
-
...B ? { maxZoom: B } : {},
|
|
2343
|
-
...r
|
|
2344
|
-
}
|
|
2345
|
-
);
|
|
2346
|
-
},
|
|
2347
|
-
indicateReverse(T) {
|
|
2348
|
-
t.getContainer().style.cursor = T ? "crosshair" : "";
|
|
2349
|
-
},
|
|
2350
|
-
setReverseMarker(T) {
|
|
2351
|
-
var B;
|
|
2352
|
-
if (!e)
|
|
2353
|
-
return;
|
|
2354
|
-
const L = T && [T[1], T[0]];
|
|
2355
|
-
p ? L ? p.setLatLng(L) : (p.remove(), p = void 0) : L && (e instanceof Function ? p = e(t) ?? void 0 : (p = (typeof e == "object" ? new ce.Marker(L, e) : M(L)).addTo(t), (B = p.getElement()) == null || B.classList.add("marker-reverse")));
|
|
2356
|
-
},
|
|
2357
|
-
setFeatures(T, L, B) {
|
|
2358
|
-
function q(I) {
|
|
2359
|
-
_.clearLayers(), I && _.addData(I);
|
|
2360
|
-
}
|
|
2361
|
-
for (const I of h)
|
|
2362
|
-
I.remove();
|
|
2363
|
-
h.length = 0, q();
|
|
2364
|
-
e: if (L) {
|
|
2365
|
-
let I = !1;
|
|
2366
|
-
if (L.geometry.type === "GeometryCollection") {
|
|
2367
|
-
const v = L.geometry.geometries.filter(
|
|
2368
|
-
(N) => N.type === "Polygon" || N.type === "MultiPolygon"
|
|
2369
|
-
);
|
|
2370
|
-
t: if (v.length > 0) {
|
|
2371
|
-
const N = _t(
|
|
2372
|
-
ve(v.map(($) => Ee($)))
|
|
2373
|
-
);
|
|
2374
|
-
if (!N)
|
|
2375
|
-
break t;
|
|
2376
|
-
ut(
|
|
2377
|
-
{
|
|
2378
|
-
...L,
|
|
2379
|
-
geometry: N.geometry
|
|
2380
|
-
},
|
|
2381
|
-
q
|
|
2382
|
-
), I = !0;
|
|
2383
|
-
} else {
|
|
2384
|
-
const N = L.geometry.geometries.filter(
|
|
2385
|
-
($) => $.type === "LineString" || $.type === "MultiLineString"
|
|
2386
|
-
);
|
|
2387
|
-
N.length > 0 && (q({
|
|
2388
|
-
...L,
|
|
2389
|
-
geometry: { type: "GeometryCollection", geometries: N }
|
|
2390
|
-
}), I = !0);
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
if (!I) {
|
|
2394
|
-
if (L.geometry.type === "Polygon" || L.geometry.type === "MultiPolygon")
|
|
2395
|
-
ut(L, (v) => {
|
|
2396
|
-
if (!v)
|
|
2397
|
-
return;
|
|
2398
|
-
const N = [...v.features], $ = Ve(qe(L)), K = $[2] - $[0];
|
|
2399
|
-
$[0] - K / 4 < -180 && N.push(...ct(v, -360).features), $[2] + K / 4 > 180 && N.push(...ct(v, 360).features), q(ve(N));
|
|
2400
|
-
});
|
|
2401
|
-
else if (L.geometry.type === "LineString" || L.geometry.type === "MultiLineString") {
|
|
2402
|
-
q(L);
|
|
2403
|
-
break e;
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
if (!B && !L.geometry.type.endsWith("Point"))
|
|
2407
|
-
break e;
|
|
2408
|
-
if (e instanceof Function) {
|
|
2409
|
-
const v = e(t, L);
|
|
2410
|
-
v && h.push(v.addTo(t));
|
|
2411
|
-
} else if (e) {
|
|
2412
|
-
const v = [L.center[1], L.center[0]];
|
|
2413
|
-
h.push(
|
|
2414
|
-
typeof e == "object" ? new ce.Marker(v, e) : M(v).addTo(t)
|
|
2415
|
-
);
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
if (n)
|
|
2419
|
-
for (const I of T ?? []) {
|
|
2420
|
-
if (I === L)
|
|
2421
|
-
continue;
|
|
2422
|
-
const v = [
|
|
2423
|
-
I.center[1],
|
|
2424
|
-
I.center[0]
|
|
2425
|
-
];
|
|
2426
|
-
let N;
|
|
2427
|
-
if (n instanceof Function) {
|
|
2428
|
-
if (N = n(t, I), !N)
|
|
2429
|
-
continue;
|
|
2430
|
-
} else
|
|
2431
|
-
N = (typeof n == "object" ? new ce.Marker(v, n) : M(v, !0)).addTo(t).bindTooltip(
|
|
2432
|
-
I.place_type[0] === "reverse" ? I.place_name : I.place_name.replace(/,.*/, ""),
|
|
2433
|
-
{
|
|
2434
|
-
direction: "top"
|
|
2435
|
-
}
|
|
2436
|
-
);
|
|
2437
|
-
const $ = N.getElement();
|
|
2438
|
-
$ && ($.addEventListener("click", (K) => {
|
|
2439
|
-
K.stopPropagation(), a == null || a({ type: "markerClick", id: I.id });
|
|
2440
|
-
}), $.addEventListener("mouseenter", () => {
|
|
2441
|
-
a == null || a({ type: "markerMouseEnter", id: I.id });
|
|
2442
|
-
}), $.addEventListener("mouseleave", () => {
|
|
2443
|
-
a == null || a({ type: "markerMouseLeave", id: I.id });
|
|
2444
|
-
}), $.classList.toggle("marker-fuzzy", !!I.matching_text)), h.push(N);
|
|
2445
|
-
}
|
|
2446
|
-
},
|
|
2447
|
-
setSelectedMarker(T) {
|
|
2448
|
-
var L, B;
|
|
2449
|
-
E && ((L = E.getElement()) == null || L.classList.toggle("marker-selected", !1)), E = T > -1 ? h[T] : void 0, (B = E == null ? void 0 : E.getElement()) == null || B.classList.toggle("marker-selected", !0);
|
|
2450
|
-
},
|
|
2451
|
-
getCenterAndZoom() {
|
|
2452
|
-
const T = t.getCenter();
|
|
2453
|
-
return [t.getZoom(), T.lng, T.lat];
|
|
2454
|
-
}
|
|
2455
|
-
};
|
|
2456
|
-
}
|
|
2457
|
-
function ct(t, e) {
|
|
2458
|
-
const n = kt(t);
|
|
2459
|
-
for (const i of n.features)
|
|
2460
|
-
if (i.geometry.type == "MultiPolygon")
|
|
2461
|
-
for (const r of i.geometry.coordinates)
|
|
2462
|
-
at(r, e);
|
|
2463
|
-
else
|
|
2464
|
-
at(i.geometry.coordinates, e);
|
|
2465
|
-
return n;
|
|
2466
|
-
}
|
|
2467
|
-
function at(t, e) {
|
|
2468
|
-
for (const n of t)
|
|
2469
|
-
for (const i of n)
|
|
2470
|
-
i[0] += e;
|
|
2471
|
-
}
|
|
2472
|
-
export {
|
|
2473
|
-
Cn as createLeafletMapController
|
|
2474
|
-
};
|
|
2475
|
-
//# sourceMappingURL=leaflet-controller.js.map
|