1/*! For license information please see CTT.js.LICENSE.txt */ 2(() => { 3 var t = { 4 874(t, e) { 5 !(function (t) { 6 "use strict"; 7 function e(t) { 8 for (var e, i, n = 1, o = arguments.length; n < o; n++) 9 for (e in (i = arguments[n])) t[e] = i[e]; 10 return t; 11 } 12 var i = 13 Object.create || 14 function (t) { 15 return ((n.prototype = t), new n()); 16 }; 17 function n() {} 18 function o(t, e) { 19 var i, 20 n = Array.prototype.slice; 21 return t.bind 22 ? t.bind.apply(t, n.call(arguments, 1)) 23 : ((i = n.call(arguments, 2)), 24 function () { 25 return t.apply( 26 e, 27 i.length ? i.concat(n.call(arguments)) : arguments, 28 ); 29 }); 30 } 31 var s = 0; 32 function r(t) { 33 return ("_leaflet_id" in t || (t._leaflet_id = ++s), t._leaflet_id); 34 } 35 function a(t, e, i) { 36 var n, 37 o, 38 s = function () { 39 ((n = !1), o && (r.apply(i, o), (o = !1))); 40 }, 41 r = function () { 42 n 43 ? (o = arguments) 44 : (t.apply(i, arguments), setTimeout(s, e), (n = !0)); 45 }; 46 return r; 47 } 48 function h(t, e, i) { 49 var n = e[1], 50 o = n - (e = e[0]); 51 return t === n && i ? t : ((((t - e) % o) + o) % o) + e; 52 } 53 function l() { 54 return !1; 55 } 56 function c(t, e) { 57 return !1 === e 58 ? t 59 : ((e = Math.pow(10, void 0 === e ? 6 : e)), 60 Math.round(t * e) / e); 61 } 62 function d(t) { 63 return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, ""); 64 } 65 function u(t) { 66 return d(t).split(/\s+/); 67 } 68 function p(t, e) { 69 for (var n in (Object.prototype.hasOwnProperty.call(t, "options") || 70 (t.options = t.options ? i(t.options) : {}), 71 e)) 72 t.options[n] = e[n]; 73 return t.options; 74 } 75 function _(t, e, i) { 76 var n, 77 o = []; 78 for (n in t) 79 o.push( 80 encodeURIComponent(i ? n.toUpperCase() : n) + 81 "=" + 82 encodeURIComponent(t[n]), 83 ); 84 return (e && -1 !== e.indexOf("?") ? "&" : "?") + o.join("&"); 85 } 86 var m = /\{ *([\w_ -]+) *\}/g; 87 function f(t, e) { 88 return t.replace(m, function (t, i) { 89 if (void 0 === (i = e[i])) 90 throw new Error("No value provided for variable " + t); 91 return "function" == typeof i ? i(e) : i; 92 }); 93 } 94 var g = 95 Array.isArray || 96 function (t) { 97 return "[object Array]" === Object.prototype.toString.call(t); 98 }; 99 function y(t, e) { 100 for (var i = 0; i < t.length; i++) if (t[i] === e) return i; 101 return -1; 102 } 103 var v = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="; 104 function w(t) { 105 return ( 106 window["webkit" + t] || window["moz" + t] || window["ms" + t] 107 ); 108 } 109 var x = 0; 110 function P(t) { 111 var e = +new Date(), 112 i = Math.max(0, 16 - (e - x)); 113 return ((x = e + i), window.setTimeout(t, i)); 114 } 115 var b = 116 window.requestAnimationFrame || w("RequestAnimationFrame") || P, 117 k = 118 window.cancelAnimationFrame || 119 w("CancelAnimationFrame") || 120 w("CancelRequestAnimationFrame") || 121 function (t) { 122 window.clearTimeout(t); 123 }; 124 function C(t, e, i) { 125 if (!i || b !== P) return b.call(window, o(t, e)); 126 t.call(e); 127 } 128 function T(t) { 129 t && k.call(window, t); 130 } 131 var z = { 132 __proto__: null, 133 extend: e, 134 create: i, 135 bind: o, 136 get lastId() { 137 return s; 138 }, 139 stamp: r, 140 throttle: a, 141 wrapNum: h, 142 falseFn: l, 143 formatNum: c, 144 trim: d, 145 splitWords: u, 146 setOptions: p, 147 getParamString: _, 148 template: f, 149 isArray: g, 150 indexOf: y, 151 emptyImageUrl: v, 152 requestFn: b, 153 cancelFn: k, 154 requestAnimFrame: C, 155 cancelAnimFrame: T, 156 }; 157 function S() {} 158 ((S.extend = function (t) { 159 function n() { 160 (p(this), 161 this.initialize && this.initialize.apply(this, arguments), 162 this.callInitHooks()); 163 } 164 var o, 165 s = (n.__super__ = this.prototype), 166 r = i(s); 167 for (o in (((r.constructor = n).prototype = r), this)) 168 Object.prototype.hasOwnProperty.call(this, o) && 169 "prototype" !== o && 170 "__super__" !== o && 171 (n[o] = this[o]); 172 if ((t.statics && e(n, t.statics), t.includes)) { 173 var a = t.includes; 174 if ("undefined" != typeof L && L && L.Mixin) { 175 a = g(a) ? a : [a]; 176 for (var h = 0; h < a.length; h++) 177 a[h] === L.Mixin.Events && 178 console.warn(
179 "Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.", 180 new Error().stack, 181 ); 182 } 183 e.apply(null, [r].concat(t.includes)); 184 } 185 return ( 186 e(r, t), 187 delete r.statics, 188 delete r.includes, 189 r.options && 190 ((r.options = s.options ? i(s.options) : {}), 191 e(r.options, t.options)), 192 (r._initHooks = []), 193 (r.callInitHooks = function () { 194 if (!this._initHooksCalled) { 195 (s.callInitHooks && s.callInitHooks.call(this), 196 (this._initHooksCalled = !0)); 197 for (var t = 0, e = r._initHooks.length; t < e; t++) 198 r._initHooks[t].call(this); 199 } 200 }), 201 n 202 ); 203 }), 204 (S.include = function (t) { 205 var i = this.prototype.options; 206 return ( 207 e(this.prototype, t), 208 t.options && 209 ((this.prototype.options = i), this.mergeOptions(t.options)), 210 this 211 ); 212 }), 213 (S.mergeOptions = function (t) { 214 return (e(this.prototype.options, t), this); 215 }), 216 (S.addInitHook = function (t) { 217 var e = Array.prototype.slice.call(arguments, 1), 218 i = 219 "function" == typeof t 220 ? t 221 : function () { 222 this[t].apply(this, e); 223 }; 224 return ( 225 (this.prototype._initHooks = this.prototype._initHooks || []), 226 this.prototype._initHooks.push(i), 227 this 228 ); 229 })); 230 var M = { 231 on: function (t, e, i) { 232 if ("object" == typeof t) for (var n in t) this._on(n, t[n], e); 233 else 234 for (var o = 0, s = (t = u(t)).length; o < s; o++) 235 this._on(t[o], e, i); 236 return this; 237 }, 238 off: function (t, e, i) { 239 if (arguments.length) 240 if ("object" == typeof t) 241 for (var n in t) this._off(n, t[n], e); 242 else { 243 t = u(t); 244 for ( 245 var o = 1 === arguments.length, s = 0, r = t.length; 246 s < r; 247 s++ 248 ) 249 o ? this._off(t[s]) : this._off(t[s], e, i); 250 } 251 else delete this._events; 252 return this; 253 }, 254 _on: function (t, e, i, n) { 255 "function" != typeof e 256 ? console.warn("wrong listener type: " + typeof e) 257 : !1 === this._listens(t, e, i) && 258 ((e = { fn: e, ctx: (i = i === this ? void 0 : i) }), 259 n && (e.once = !0), 260 (this._events = this._events || {}), 261 (this._events[t] = this._events[t] || []), 262 this._events[t].push(e)); 263 }, 264 _off: function (t, e, i) { 265 var n, o, s; 266 if (this._events && (n = this._events[t])) 267 if (1 === arguments.length) { 268 if (this._firingCount) 269 for (o = 0, s = n.length; o < s; o++) n[o].fn = l; 270 delete this._events[t]; 271 } else 272 "function" != typeof e 273 ? console.warn("wrong listener type: " + typeof e) 274 : !1 !== (e = this._listens(t, e, i)) && 275 ((i = n[e]), 276 this._firingCount && 277 ((i.fn = l), (this._events[t] = n = n.slice())), 278 n.splice(e, 1)); 279 }, 280 fire: function (t, i, n) { 281 if (this.listens(t, n)) { 282 var o = e({}, i, { 283 type: t, 284 target: this, 285 sourceTarget: (i && i.sourceTarget) || this, 286 }); 287 if (this._events) { 288 var s = this._events[t]; 289 if (s) { 290 this._firingCount = this._firingCount + 1 || 1; 291 for (var r = 0, a = s.length; r < a; r++) { 292 var h = s[r], 293 l = h.fn; 294 (h.once && this.off(t, l, h.ctx), 295 l.call(h.ctx || this, o)); 296 } 297 this._firingCount--; 298 } 299 } 300 n && this._propagateEvent(o); 301 } 302 return this; 303 }, 304 listens: function (t, e, i, n) { 305 "string" != typeof t && 306 console.warn('"string" type argument expected'); 307 var o = e, 308 s = 309 ("function" != typeof e && ((n = !!e), (i = o = void 0)), 310 this._events && this._events[t]); 311 if (s && s.length && !1 !== this._listens(t, o, i)) return !0; 312 if (n) 313 for (var r in this._eventParents) 314 if (this._eventParents[r].listens(t, e, i, n)) return !0; 315 return !1; 316 }, 317 _listens: function (t, e, i) { 318 if (this._events) { 319 var n = this._events[t] || []; 320 if (!e) return !!n.length; 321 i === this && (i = void 0); 322 for (var o = 0, s = n.length; o < s; o++) 323 if (n[o].fn === e && n[o].ctx === i) return o; 324 } 325 return !1; 326 }, 327 once: function (t, e, i) { 328 if ("object" == typeof t) 329 for (var n in t) this._on(n, t[n], e, !0); 330 else 331 for (var o = 0, s = (t = u(t)).length; o < s; o++) 332 this._on(t[o], e, i, !0); 333 return this; 334 }, 335 addEventParent: function (t) { 336 return ( 337 (this._eventParents = this._eventParents || {}), 338 (this._eventParents[r(t)] = t), 339 this 340 ); 341 }, 342 removeEventParent: function (t) { 343 return ( 344 this._eventParents && delete this._eventParents[r(t)], 345 this 346 ); 347 }, 348 _propagateEvent: function (t) { 349 for (var i in this._eventParents) 350 this._eventParents[i].fire( 351 t.type,
352 e({ layer: t.target, propagatedFrom: t.target }, t), 353 !0, 354 ); 355 }, 356 }, 357 I = 358 ((M.addEventListener = M.on), 359 (M.removeEventListener = M.clearAllEventListeners = M.off), 360 (M.addOneTimeEventListener = M.once), 361 (M.fireEvent = M.fire), 362 (M.hasEventListeners = M.listens), 363 S.extend(M)); 364 function j(t, e, i) { 365 ((this.x = i ? Math.round(t) : t), 366 (this.y = i ? Math.round(e) : e)); 367 } 368 var E = 369 Math.trunc || 370 function (t) { 371 return 0 < t ? Math.floor(t) : Math.ceil(t); 372 }; 373 function A(t, e, i) { 374 return t instanceof j 375 ? t 376 : g(t) 377 ? new j(t[0], t[1]) 378 : null == t 379 ? t 380 : "object" == typeof t && "x" in t && "y" in t 381 ? new j(t.x, t.
381y) 382 : new j(t, e, i); 383 } 384 function B(t, e) { 385 if (t) 386 for (var i = e ? [t, e] : t, n = 0, o = i.length; n < o; n++) 387 this.extend(i[n]); 388 } 389 function Z(t, e) { 390 return !t || t instanceof B ? t : new B(t, e); 391 } 392 function O(t, e) { 393 if (t) 394 for (var i = e ? [t, e] : t, n = 0, o = i.length; n < o; n++) 395 this.extend(i[n]); 396 } 397 function R(t, e) { 398 return t instanceof O ? t : new O(t, e); 399 } 400 function D(t, e, i) { 401 if (isNaN(t) || isNaN(e)) 402 throw new Error("Invalid LatLng object: (" + t + ", " + e + ")"); 403 ((this.lat = +t), (this.lng = +e), void 0 !== i && (this.alt = +i)); 404 } 405 function N(t, e, i) { 406 return t instanceof D 407 ? t 408 : g(t) && "object" != typeof t[0] 409 ? 3 === t.length 410 ? new D(t[0], t[1], t[2]) 411 : 2 === t.length 412 ? new D(t[0], t[1]) 413 : null 414 : null == t 415 ? t 416 : "object" == typeof t && "lat" in t 417 ? new D(t.lat, "lng" in t ? t.lng : t.lon, t.alt) 418 : void 0 === e 419 ? null 420 : new D(t, e, i); 421 } 422 ((j.prototype = { 423 clone: function () { 424 return new j(this.x, this.y); 425 }, 426 add: function (t) { 427 return this.clone()._add(A(t)); 428 }, 429 _add: function (t) { 430 return ((this.x += t.x), (this.y += t.y), this); 431 }, 432 subtract: function (t) { 433 return this.clone()._subtract(A(t)); 434 }, 435 _subtract: function (t) { 436 return ((this.x -= t.x), (this.y -= t.y), this); 437 }, 438 divideBy: function (t) { 439 return this.clone()._divideBy(t); 440 }, 441 _divideBy: function (t) { 442 return ((this.x /= t), (this.y /= t), this); 443 }, 444 multiplyBy: function (t) { 445 return this.clone()._multiplyBy(t); 446 }, 447 _multiplyBy: function (t) { 448 return ((this.x *= t), (this.y *= t), this); 449 }, 450 scaleBy: function (t) { 451 return new j(this.x * t.x, this.y * t.y); 452 }, 453 unscaleBy: function (t) { 454 return new j(this.x / t.x, this.y / t.y); 455 }, 456 round: function () { 457 return this.clone()._round(); 458 }, 459 _round: function () { 460 return ( 461 (this.x = Math.round(this.x)), 462 (this.y = Math.round(this.y)), 463 this 464 ); 465 }, 466 floor: function () { 467 return this.clone()._floor(); 468 }, 469 _floor: function () { 470 return ( 471 (this.x = Math.floor(this.x)), 472 (this.y = Math.floor(this.y)), 473 this 474 ); 475 }, 476 ceil: function () { 477 return this.clone()._ceil(); 478 }, 479 _ceil: function () { 480 return ( 481 (this.x = Math.ceil(this.x)), 482 (this.y = Math.ceil(this.y)), 483 this 484 ); 485 }, 486 trunc: function () { 487 return this.clone()._trunc(); 488 }, 489 _trunc: function () { 490 return ((this.x = E(this.x)), (this.y = E(this.y)), this); 491 }, 492 distanceTo: function (t) { 493 var e = (t = A(t)).x - this.x; 494 return ((t = t.y - this.y), Math.sqrt(e * e + t * t)); 495 }, 496 equals: function (t) { 497 return (t = A(t)).x === this.x && t.y === this.y; 498 }, 499 contains: function (t) { 500 return ( 501 (t = A(t)), 502 Math.abs(t.x) <= Math.abs(this.x) && 503 Math.abs(t.y) <= Math.abs(this.y) 504 ); 505 }, 506 toString: function () { 507 return "Point(" + c(this.x) + ", " + c(this.y) + ")"; 508 }, 509 }), 510 (B.prototype = { 511 extend: function (t) { 512 var e, i; 513 if (t) { 514 if (t instanceof j || "number" == typeof t[0] || "x" in t) 515 e = i = A(t); 516 else if (((e = (t = Z(t)).min), (i = t.max), !e || !i)) 517 return this; 518 this.min || this.max 519 ? ((this.min.x = Math.min(e.x, this.min.x)), 520 (this.max.x = Math.max(i.x, this.max.x)), 521 (this.min.y = Math.min(e.y, this.min.y)), 522 (this.max.y = Math.max(i.y, this.max.y))) 523 : ((this.min = e.clone()), (this.max = i.clone())); 524 } 525 return this; 526 }, 527 getCenter: function (t) { 528 return A( 529 (this.min.x + this.max.x) / 2, 530 (this.min.y + this.max.y) / 2, 531 t, 532 ); 533 }, 534 getBottomLeft: function () { 535 return A(this.min.x, this.max.y); 536 }, 537 getTopRight: function () { 538 return A(this.max.x, this.min.y); 539 }, 540 getTopLeft: function () { 541 return this.min; 542 }, 543 getBottomRight: function () { 544 return this.max; 545 }, 546 getSize: function () { 547 return this.max.subtract(this.min); 548 }, 549 contains: function (t) { 550 var e, i; 551 return ( 552 (t = ("number" == typeof t[0] || t instanceof j ? A : Z)( 553 t, 554 )) instanceof B 555 ? ((e = t.min), (i = t.max)) 556 : (e = i = t), 557 e.x >= this.min.x && 558 i.x <= this.max.x && 559 e.y >= this.min.y && 560 i.y <= this.max.y 561 ); 562 }, 563 intersects: function (t) { 564 t = Z(t); 565 var e = this.min, 566 i = this.max, 567 n = t.min, 568 o = (t = t.max).x >= e.x && n.x <= i.x; 569 return ((t = t.y >
569= e.y && n.y <= i.y), o && t); 570 }, 571 overlaps: function (t) { 572 t = Z(t); 573 var e = this.min, 574 i = this.max, 575 n = t.min, 576 o = (t = t.max).x > e.x && n.x < i.x; 577 return ((t = t.y > e.y && n.y < i.y), o && t); 578 }, 579 isValid: function () { 580 return !(!this.min || !this.max); 581 }, 582 pad: function (t) { 583 var e = this.min, 584 i = this.max, 585 n = Math.abs(e.x - i.x) * t; 586 return ( 587 (t = Math.abs(e.y - i.y) * t), 588 Z(A(e.x - n, e.y - t), A(i.x + n, i.y + t)) 589 ); 590 }, 591 equals: function (t) { 592 return ( 593 !!t && 594 ((t = Z(t)), 595 this.min.equals(t.getTopLeft()) && 596 this.max.equals(t.getBottomRight())) 597 ); 598 }, 599 }), 600 (O.prototype = { 601 extend: function (t) { 602 var e, 603 i, 604 n = this._southWest, 605 o = this._northEast; 606 if (t instanceof D) i = e = t; 607 else { 608 if (!(t instanceof O)) 609 return t ? this.extend(N(t) || R(t)) : this; 610 if (((e = t._southWest), (i = t._northEast), !e || !i)) 611 return this; 612 } 613 return ( 614 n || o 615 ? ((n.lat = Math.min(e.lat, n.lat)), 616 (n.lng = Math.min(e.lng, n.lng)), 617 (o.lat = Math.max(i.lat, o.lat)), 618 (o.lng = Math.max(i.lng, o.lng))) 619 : ((this._southWest = new D(e.lat, e.lng)), 620 (this._northEast = new D(i.lat, i.lng))), 621 this 622 ); 623 }, 624 pad: function (t) { 625 var e = this._southWest, 626 i = this._northEast, 627 n = Math.abs(e.lat - i.lat) * t; 628 return ( 629 (t = Math.abs(e.lng - i.lng) * t), 630 new O( 631 new D(e.lat - n, e.lng - t), 632 new D(i.lat + n, i.lng + t), 633 ) 634 ); 635 }, 636 getCenter: function () { 637 return new D( 638 (this._southWest.lat + this._northEast.lat) / 2, 639 (this._southWest.lng + this._northEast.lng) / 2, 640 ); 641 }, 642 getSouthWest: function () { 643 return this._southWest; 644 }, 645 getNorthEast: function () { 646 return this._northEast; 647 }, 648 getNorthWest: function () { 649 return new D(this.getNorth(), this.getWest()); 650 }, 651 getSouthEast: function () { 652 return new D(this.getSouth(), this.getEast()); 653 }, 654 getWest: function () { 655 return this._southWest.lng; 656 }, 657 getSouth: function () { 658 return this._southWest.lat; 659 }, 660 getEast: function () { 661 return this._northEast.lng; 662 }, 663 getNorth: function () { 664 return this._northEast.lat; 665 }, 666 contains: function (t) { 667 t = ( 668 "number" == typeof t[0] || t instanceof D || "lat" in t 669 ? N 670 : R 671 )(t); 672 var e, 673 i, 674 n = this._southWest, 675 o = this._northEast; 676 return ( 677 t instanceof O
678 ? ((e = t.getSouthWest()), (i = t.getNorthEast())) 679 : (e = i = t), 680 e.lat >= n.lat && 681 i.lat <= o.lat && 682 e.lng >= n.lng && 683 i.lng <= o.lng 684 ); 685 }, 686 intersects: function (t) { 687 t = R(t); 688 var e = this._southWest, 689 i = this._northEast, 690 n = t.getSouthWest(), 691 o = (t = t.getNorthEast()).lat >= e.lat && n.lat <= i.lat; 692 return ((t = t.lng >= e.lng && n.lng <= i.lng), o && t); 693 }, 694 overlaps: function (t) { 695 t = R(t); 696 var e = this._southWest, 697 i = this._northEast, 698 n = t.getSouthWest(), 699 o = (t = t.getNorthEast()).lat > e.lat && n.lat < i.lat; 700 return ((t = t.lng > e.lng && n.lng < i.lng), o && t); 701 }, 702 toBBoxString: function () { 703 return [ 704 this.getWest(),
705 this.getSouth(), 706 this.getEast(), 707 this.getNorth(), 708 ].join(","); 709 }, 710 equals: function (t, e) { 711 return ( 712 !!t && 713 ((t = R(t)), 714 this._southWest.equals(t.getSouthWest(), e) && 715 this._northEast.equals(t.getNorthEast(), e)) 716 ); 717 }, 718 isValid: function () { 719 return !(!this._southWest || !this._northEast); 720 }, 721 })); 722 var Q = { 723 latLngToPoint: function (t, e) { 724 return ( 725 (t = this.projection.project(t)), 726 (e = this.scale(e)), 727 this.transformation._transform(t, e) 728 ); 729 }, 730 pointToLatLng: function (t, e) { 731 return ( 732 (e = this.scale(e)), 733 (t = this.transformation.untransform(t, e)), 734 this.projection.unproject(t) 735 ); 736 }, 737 project: function (t) { 738 return this.projection.project(t); 739 }, 740 unproject: function (t) { 741 return this.projection.unproject(t); 742 }, 743 scale: function (t) { 744 return 256 * Math.pow(2, t); 745 }, 746 zoom: function (t) { 747 return Math.log(t / 256) / Math.LN2; 748 }, 749 getProjectedBounds: function (t) { 750 var e; 751 return this.infinite 752 ? null 753 : ((e = this.projection.bounds), 754 (t = this.scale(t)), 755 new B( 756 this.transformation.transform(e.min, t), 757 this.transformation.transform(e.max, t), 758 )); 759 }, 760 infinite: !(D.prototype = { 761 equals: function (t, e) { 762 return ( 763 !!t && 764 ((t = N(t)), 765 Math.max( 766 Math.abs(this.lat - t.lat), 767 Math.abs(this.lng - t.lng), 768 ) <= (void 0 === e ? 1e-9 : e)) 769 ); 770 }, 771 toString: function (t) { 772 return ( 773 "LatLng(" + c(this.lat, t) + ", " + c(this.lng, t) + ")" 774 ); 775 }, 776 distanceTo: function (t) { 777 return F.distance(this, N(t)); 778 }, 779 wrap: function () { 780 return F.wrapLatLng(this); 781 }, 782 toBounds: function (t) { 783 var e = 784 (t = (180 * t) / 40075017) / 785 Math.cos((Math.PI / 180) * this.lat); 786 return R( 787 [this.lat - t, this.lng - e], 788 [this.lat + t, this.lng + e], 789 ); 790 }, 791 clone: function () { 792 return new D(this.lat, this.lng, this.alt); 793 }, 794 }), 795 wrapLatLng: function (t) { 796 var e = this.wrapLng ? h(t.lng, this.wrapLng, !0) : t.lng; 797 return new D( 798 this.wrapLat ? h(t.lat, this.wrapLat, !0) : t.lat, 799 e, 800 t.alt, 801 ); 802 }, 803 wrapLatLngBounds: function (t) { 804 var e = t.getCenter(), 805 i = this.wrapLatLng(e), 806 n = e.lat - i.lat; 807 return ( 808 (e = e.lng - i.lng), 809 0 == n && 0 == e 810 ? t
811 : ((i = t.getSouthWest()), 812 (t = t.getNorthEast()), 813 new O( 814 new D(i.lat - n, i.lng - e), 815 new D(t.lat - n, t.lng - e), 816 )) 817 ); 818 }, 819 }, 820 F = e({}, Q, { 821 wrapLng: [-180, 180], 822 R: 6371e3, 823 distance: function (t, e) { 824 var i = Math.PI / 180, 825 n = t.lat * i, 826 o = e.lat * i, 827 s = Math.sin(((e.lat - t.lat) * i) / 2); 828 return ( 829 (e = Math.sin(((e.lng - t.lng) * i) / 2)), 830 (t = s * s + Math.cos(n) * Math.cos(o) * e * e), 831 (i = 2 * Math.atan2(Math.sqrt(t), Math.sqrt(1 - t))), 832 this.R * i 833 ); 834 }, 835 }), 836 W = { 837 R: (W = 6378137), 838 MAX_LATITUDE: 85.0511287798, 839 project: function (t) { 840 var e = Math.PI / 180, 841 i = this.MAX_LATITUDE; 842 return ( 843 (i = Math.max(Math.min(i, t.lat), -i)), 844 (i = Math.sin(i * e)), 845 new j( 846 this.R * t.lng * e, 847 (this.R * Math.log((1 + i) / (1 - i))) / 2, 848 ) 849 ); 850 }, 851 unproject: function (t) { 852 var e = 180 / Math.PI; 853 return new D( 854 (2 * Math.atan(Math.exp(t.y / this.R)) - Math.PI / 2) * e, 855 (t.x * e) / this.R, 856 ); 857 }, 858 bounds: new B([-(W *= Math.PI), -W], [W, W]), 859 }; 860 function q(t, e, i, n) { 861 g(t) 862 ? ((this._a = t[0]), 863 (this._b = t[1]), 864 (this._c = t[2]), 865 (this._d = t[3])) 866 : ((this._a = t), (this._b = e), (this._c = i), (this._d = n)); 867 } 868 function H(t, e, i, n) { 869 return new q(t, e, i, n); 870 } 871 q.prototype = { 872 transform: function (t, e) { 873 return this._transform(t.clone(), e); 874 }, 875 _transform: function (t, e) { 876 return ( 877 (t.x = (e = e || 1) * (this._a * t.x + this._b)), 878 (t.y = e * (this._c * t.y + this._d)), 879 t 880 ); 881 }, 882 untransform: function (t, e) { 883 return new j( 884 (t.x / (e = e || 1) - this._b) / this._a, 885 (t.y / e - this._d) / this._c, 886 ); 887 }, 888 }; 889 var U = e({}, F, { 890 code: "EPSG:3857", 891 projection: W, 892 transformation: H((U = 0.5 / (Math.PI * W.R)), 0.5, -U, 0.5), 893 }), 894 G = e({}, U, { code: "EPSG:900913" }); 895 function V(t) { 896 return document.createElementNS("http://www.w3.org/2000/svg", t); 897 } 898 function $(t, e) { 899 for (var i, n, o, s, r = "", a = 0, h = t.length; a < h; a++) { 900 for (i = 0, n = (o = t[a]).length; i < n; i++) 901 r += (i ? "L" : "M") + (s = o[i]).x + " " + s.y; 902 r += e ? (zt.svg ? "z" : "x") : ""; 903 } 904 return r || "M0 0"; 905 } 906 var K = document.documentElement.style, 907 J = "ActiveXObject" in window, 908 Y = J && !document.addEventListener, 909 X = "msLaunchUri" in navigator && !("documentMode" in document), 910 tt = Tt("webkit"), 911 et = Tt("android"), 912 it = Tt("android 2") || Tt("android 3"), 913 nt = parseInt( 914 /WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 915 10, 916 ), 917 ot = 918 ((nt = 919 et && Tt("Google") && nt < 537 && !("AudioNode" in window)), 920 !!window.opera), 921 st = !X && Tt("chrome"), 922 rt = Tt("gecko") && !tt && !ot && !J, 923 at = !st && Tt("safari"), 924 ht = Tt("phantom"), 925 lt = "OTransition" in K, 926 ct = 0 === navigator.platform.indexOf("Win"), 927 dt = J && "transition" in K, 928 ut = 929 "WebKitCSSMatrix" in window && 930 "m11" in new window.WebKitCSSMatrix() && 931 !it, 932 pt = 933 ((K = "MozPerspective" in K), 934 !window.L_DISABLE_3D && (dt || ut || K) && !lt && !ht), 935 _t = ($i = "undefined" != typeof orientation || Tt("mobile")) && tt, 936 mt = $i && ut, 937 ft = !window.PointerEvent && window.MSPointerEvent, 938 gt = !(!window.PointerEvent && !ft), 939 yt = "ontouchstart" in window || !!window.TouchEvent, 940 vt = !window.L_NO_TOUCH && (yt || gt), 941 wt = $i && ot, 942 xt = $i && rt, 943 Pt = 944 1 < 945 (window.devicePixelRatio || 946 window.screen.deviceXDPI / window.screen.logicalXDPI), 947 bt = (function () { 948 var t = !1; 949 try { 950 var e = Object.defineProperty({}, "passive", { 951 get: function () { 952 t = !0; 953 }, 954 }); 955 (window.addEventListener("testPassiveEventSupport", l, e), 956 window.removeEventListener("testPassiveEventSupport", l, e)); 957 } catch (t) {} 958 return t; 959 })(), 960 kt = !!document.createElement("canvas").getContext, 961 Lt = !(!document.createElementNS || !V("svg").createSVGRect), 962 Ct = 963 !!Lt && 964 (((Ct = document.createElement("div")).innerHTML = "<svg/>"), 965 "http://www.w3.org/2000/svg" === 966 (Ct.firstChild && Ct.firstChild.namespaceURI)); 967 function Tt(t) { 968 return 0 <= navigator.userAgent.toLowerCase().indexOf(t); 969 } 970 var zt = { 971 ie: J, 972 ielt9: Y, 973 edge: X, 974 webkit: tt, 975 android: et, 976 android23: it, 977 androidStock: nt, 978 opera: ot, 979 chrome: st, 980 gecko: rt, 981 safari: at, 982 phantom: ht, 983 opera12: lt, 984 win: ct, 985 ie3d: dt, 986 webkit3d: ut, 987 gecko3d: K, 988 any3d: pt, 989 mobile: $i, 990 mobileWebkit: _t, 991 mobileWebkit3d: mt, 992 msPointer: ft, 993 pointer: gt, 994 touch: vt, 995 touchNative: yt, 996 mobileOpera: wt, 997 mobileGecko: xt, 998 retina: Pt, 999 passiveEvents: bt, 1000 canvas: kt, 1001 svg: Lt, 1002 vml: 1003 !Lt && 1004 (function () { 1005 try { 1006 var t = document.createElement("div"),
1007 e = ((t.innerHTML = '<v:shape adj="1"/>'), t.firstChild); 1008 return ( 1009 (e.style.behavior = "url(#default#VML)"), 1010 e && "object" == typeof e.adj 1011 ); 1012 } catch (t) { 1013 return !1; 1014 } 1015 })(), 1016 inlineSvg: Ct, 1017 mac: 0 === navigator.platform.indexOf("Mac"), 1018 linux: 0 === navigator.platform.indexOf("Linux"), 1019 }, 1020 St = zt.msPointer ? "MSPointerDown" : "pointerdown", 1021 Mt = zt.msPointer ? "MSPointerMove" : "pointermove", 1022 It = zt.msPointer ? "MSPointerUp" : "pointerup", 1023 jt = zt.msPointer ? "MSPointerCancel" : "pointercancel", 1024 Et = { 1025 touchstart: St, 1026 touchmove: Mt, 1027 touchend: It, 1028 touchcancel: jt, 1029 }, 1030 At = { 1031 touchstart: function (t, e) { 1032 (e.MSPOINTER_TYPE_TOUCH && 1033 e.pointerType === e.MSPOINTER_TYPE_TOUCH && 1034 je(e), 1035 Qt(t, e)); 1036 }, 1037 touchmove: Qt, 1038 touchend: Qt, 1039 touchcancel: Qt, 1040 }, 1041 Bt = {}, 1042 Zt = !1; 1043 function Ot(t, e, i) { 1044 return ( 1045 "touchstart" !== e || 1046 Zt || 1047 (document.addEventListener(St, Rt, !0), 1048 document.addEventListener(Mt, Dt, !0), 1049 document.addEventListener(It, Nt, !0), 1050 document.addEventListener(jt, Nt, !0), 1051 (Zt = !0)), 1052 At[e] 1053 ? ((i = At[e].bind(this, i)), 1054 t.addEventListener(Et[e], i, !1), 1055 i) 1056 : (console.warn("wrong event specified:", e), l) 1057 ); 1058 } 1059 function Rt(t) { 1060 Bt[t.pointerId] = t; 1061 } 1062 function Dt(t) { 1063 Bt[t.pointerId] && (Bt[t.pointerId] = t); 1064 } 1065 function Nt(t) { 1066 delete Bt[t.pointerId]; 1067 } 1068 function Qt(t, e) { 1069 if (e.pointerType !== (e.MSPOINTER_TYPE_MOUSE || "mouse")) { 1070 for (var i in ((e.touches = []), Bt)) e.touches.push(Bt[i]); 1071 ((e.changedTouches = [e]), t(e)); 1072 } 1073 } 1074 var Ft = 200; 1075 function Wt(t, e) { 1076 t.addEventListener("dblclick", e); 1077 var i, 1078 n = 0; 1079 function o(t) { 1080 var o; 1081 1 !== t.detail 1082 ? (i = t.detail) 1083 : "mouse" === t.pointerType || 1084 (t.sourceCapabilities && 1085 !t.sourceCapabilities.firesTouchEvents) || 1086 ((o = Ae(t)).some(function (t) { 1087 return t instanceof HTMLLabelElement && t.attributes.for; 1088 }) && 1089 !o.some(function (t) { 1090 return ( 1091 t instanceof HTMLInputElement || 1092 t instanceof HTMLSelectElement 1093 ); 1094 })) || 1095 ((o = Date.now()) - n <= Ft 1096 ? 2 === ++i && 1097 e( 1098 (function (t) { 1099 var e, 1100 i, 1101 n = {}; 1102 for (i in t) 1103 ((e = t[i]), (n[i] = e && e.bind ? e.bind(t) : e)); 1104 return ( 1105 ((t = n).type = "dblclick"), 1106 (n.detail = 2), 1107 (n.isTrusted = !1), 1108 (n._simulated = !0), 1109 n 1110 ); 1111 })(t), 1112 ) 1113 : (i = 1), 1114 (n = o)); 1115 } 1116 return ( 1117 t.addEventListener("click", o), 1118 { dblclick: e, simDblclick: o } 1119 ); 1120 } 1121 var qt, 1122 Ht, 1123 Ut, 1124 Gt, 1125 Vt, 1126 $t, 1127 Kt = ue([ 1128 "transform", 1129 "webkitTransform", 1130 "OTransform", 1131 "MozTransform", 1132 "msTransform", 1133 ]), 1134 Jt = ue([ 1135 "webkitTransition", 1136 "transition", 1137 "OTransition", 1138 "MozTransition", 1139 "msTransition", 1140 ]), 1141 Yt = 1142 "webkitTransition" === Jt || "OTransition" === Jt 1143 ? Jt + "End" 1144 : "transitionend"; 1145 function Xt(t) { 1146 return "string" == typeof t ? document.getElementById(t) : t; 1147 } 1148 function te(t, e) { 1149 var i = t.style[e] || (t.currentStyle && t.currentStyle[e]); 1150 return "auto" === 1151 (i = 1152 (i && "auto" !== i) || !document.defaultView 1153 ? i 1154 : (t = document.defaultView.getComputedStyle(t, null)) 1155 ? t[e] 1156 : null) 1157 ? null 1158 : i; 1159 } 1160 function ee(t, e, i) { 1161 return ( 1162 ((t = document.createElement(t)).className = e || ""), 1163 i && i.appendChild(t), 1164 t 1165 ); 1166 } 1167 function ie(t) { 1168 var e = t.parentNode; 1169 e && e.removeChild(t); 1170 } 1171 function ne(t) { 1172 for (; t.firstChild; ) t.removeChild(t.firstChild); 1173 } 1174 function oe(t) { 1175 var e = t.parentNode; 1176 e && e.lastChild !== t && e.appendChild(t); 1177 } 1178 function se(t) { 1179 var e = t.parentNode; 1180 e && e.firstChild !== t && e.insertBefore(t, e.firstChild); 1181 } 1182 function re(t, e) { 1183 return void 0 !== t.classList 1184 ? t.classList.contains(e) 1185 : 0 < (t = ce(t)).length && 1186 new RegExp("(^|\\s)" + e + "(\\s|$)").test(t); 1187 } 1188 function ae(t, e) { 1189 var i; 1190 if (void 0 !== t.classList) 1191 for (var n = u(e), o = 0, s = n.length; o < s; o++) 1192 t.classList.add(n[o]); 1193 else re(t, e) || le(t, ((i = ce(t)) ? i + " " : "") + e); 1194 } 1195 function he(t, e) { 1196 void 0 !== t.classList 1197 ? t.classList.remove(e) 1198 : le(t, d((" " + ce(t) + " ").replace(" " + e + " ", " "))); 1199 } 1200 function le(t, e) { 1201 void 0 === t.className.baseVal 1202 ? (t.className = e) 1203 : (t.className.baseVal = e); 1204 } 1205 function ce(t) { 1206 return void 0 === 1207 (t = t.correspondingElement ? t.correspondingElement : t) 1208 .className.baseVal 1209 ? t.className 1210 : t.className.baseVal; 1211 } 1212 function de(t, e) { 1213 if ("opacity" in t.style) t.style.opacity = e; 1214 else if ("filter" in t.style) { 1215 var i = !1, 1216 n = "DXImageTransform.Microsoft.Alpha"; 1217 try { 1218 i = t.filters.item(n); 1219 } catch (t) { 1220 if (1 === e) return; 1221 } 1222 ((e = Math.round(100 * e)), 1223 i 1224 ? ((i.Enabled = 100 !== e), (i.Opacity = e)) 1225 : (t.style.filter += " progid:" + n + "(opacity=" + e + ")")); 1226 } 1227 } 1228 function ue(t) { 1229 for ( 1230 var e = document.documentElement.style, i = 0; 1231 i < t.length; 1232 i++ 1233 ) 1234 if (t[i] in e) return t[i]; 1235 return !1; 1236 } 1237 function pe(t, e, i) { 1238 ((e = e || new j(0, 0)), 1239 (t.style[Kt] = 1240 (zt.ie3d 1241 ? "translate(" + e.x + "px," + e.y + "px)" 1242 : "translate3d(" + e.x + "px," + e.y + "px,0)") + 1243 (i ? " scale(" + i + ")" : ""))); 1244 } 1245 function _e(t, e) { 1246 ((t._leaflet_pos = e), 1247 zt.any3d 1248 ? pe(t, e) 1249 : ((t.style.left = e.x + "px"), (t.style.top = e.y + "px"))); 1250 } 1251 function me(t) { 1252 return t._leaflet_pos || new j(0, 0); 1253 } 1254 function fe() { 1255 Pe(window, "dragstart", je); 1256 } 1257 function ge() { 1258 ke(window, "dragstart", je); 1259 } 1260 function ye(t) { 1261 for (; -1 === t.tabIndex; ) t = t.parentNode; 1262 t.style && 1263 (ve(), 1264 ($t = (Vt = t).style.outlineStyle), 1265 (t.style.outlineStyle = "none"), 1266 Pe(window, "keydown", ve)); 1267 } 1268 function ve() { 1269 Vt && 1270 ((Vt.style.outlineStyle = $t), 1271 ($t = Vt = void 0), 1272 ke(window, "keydown", ve)); 1273 } 1274 function we(t) { 1275 for ( 1276 ; 1277 !( 1278 ((t = t.parentNode).offsetWidth && t.offsetHeight) || 1279 t === document.body 1280 ); 1281 ); 1282 return t; 1283 } 1284 function xe(t) { 1285 var e = t.getBoundingClientRect(); 1286 return { 1287 x: e.width / t.offsetWidth || 1, 1288 y: e.height / t.offsetHeight || 1, 1289 boundingClientRect: e, 1290 }; 1291 } 1292 function Pe(t, e, i, n) { 1293 if (e && "object" == typeof e) for (var o in e) Te(t, o, e[o
1293], i); 1294 else 1295 for (var s = 0, r = (e = u(e)).length; s < r; s++) 1296 Te(t, e[s], i, n); 1297 return this; 1298 } 1299 ((Gt = 1300 "onselectstart" in document 1301 ? ((Ut = function () { 1302 Pe(window, "selectstart", je); 1303 }), 1304 function () { 1305 ke(window, "selectstart", je); 1306 }) 1307 : ((Ht = ue([ 1308 "userSelect", 1309 "WebkitUserSelect", 1310 "OUserSelect", 1311 "MozUserSelect", 1312 "msUserSelect", 1313 ])), 1314 (Ut = function () { 1315 var t; 1316 Ht && 1317 ((t = document.documentElement.style), 1318 (qt = t[Ht]), 1319 (t[Ht] = "none")); 1320 }), 1321 function () { 1322 Ht && 1323 ((document.documentElement.style[Ht] = qt), (qt = void 0)); 1324 })), 1325 (J = { 1326 __proto__: null, 1327 TRANSFORM: Kt, 1328 TRANSITION: Jt, 1329 TRANSITION_END: Yt, 1330 get: Xt, 1331 getStyle: te, 1332 create: ee, 1333 remove: ie, 1334 empty: ne, 1335 toFront: oe, 1336 toBack: se, 1337 hasClass: re, 1338 addClass: ae, 1339 removeClass: he, 1340 setClass: le, 1341 getClass: ce, 1342 setOpacity: de, 1343 testProp: ue, 1344 setTransform: pe, 1345 setPosition: _e, 1346 getPosition: me, 1347 get disableTextSelection() { 1348 return Ut; 1349 }, 1350 get enableTextSelection() { 1351 return Gt; 1352 }, 1353 disableImageDrag: fe, 1354 enableImageDrag: ge, 1355 preventOutline: ye, 1356 restoreOutline: ve, 1357 getSizedParentNode: we, 1358 getScale: xe, 1359 })); 1360 var be = "_leaflet_events"; 1361 function ke(t, e, i, n) { 1362 if (1 === arguments.length) (Le(t), delete t[be]); 1363 else if (e && "object" == typeof e) 1364 for (var o in e) ze(t, o, e[o], i); 1365 else if (((e = u(e)), 2 === arguments.length)) 1366 Le(t, function (t) { 1367 return -1 !== y(e, t); 1368 }); 1369 else for (var s = 0, r = e.length; s < r; s++) ze(t, e[s], i, n); 1370 return this; 1371 } 1372 function Le(t, e) { 1373 for (var i in t[be]) { 1374 var n = i.split(/\d/)[0]; 1375 (e && !e(n)) || ze(t, n, null, null, i); 1376 } 1377 } 1378 var Ce = { 1379 mouseenter: "mouseover", 1380 mouseleave: "mouseout", 1381 wheel: !("onwheel" in window) && "mousewheel", 1382 }; 1383 function Te(t, e, i, n) { 1384 var o, 1385 s, 1386 a = e + r(i) + (n ? "_" + r(n) : ""); 1387 (t[be] && t[be][a]) || 1388 ((s = o = 1389 function (e) { 1390 return i.call(n || t, e || window.event); 1391 }), 1392 !zt.touchNative && zt.pointer && 0 === e.indexOf("touch") 1393 ? (o = Ot(t, e, o)) 1394 : zt.touch && "dblclick" === e 1395 ? (o = Wt(t, o)) 1396 : "addEventListener" in t 1397 ? "touchstart" === e || 1398 "touchmove" === e || 1399 "wheel" === e || 1400 "mousewheel" === e 1401 ? t.addEventListener( 1402 Ce[e] || e, 1403 o, 1404 !!zt.passiveEvents && { passive: !1 }, 1405 ) 1406 : "mouseenter" === e || "mouseleave" === e 1407 ? t.addEventListener( 1408 Ce[e], 1409 (o = function (e) { 1410 ((e = e || window.event), Re(t, e) && s(e)); 1411 }), 1412 !1, 1413 ) 1414 : t.addEventListener(e, s, !1) 1415 : t.attachEvent("on" + e, o), 1416 (t[be] = t[be] || {}), 1417 (t[be][a] = o)); 1418 } 1419 function ze(t, e, i, n, o) { 1420 var s, a; 1421 ((o = o || e + r(i) + (n ? "_" + r(n) : "")), 1422 (i = t[be] && t[be][o]) && 1423 (!zt.touchNative && zt.pointer && 0 === e.indexOf("touch") 1424 ? ((n = t), 1425 (a = i), 1426 Et[(s = e)] 1427 ? n.removeEventListener(Et[s], a, !1) 1428 : console.warn("wrong event specified:", s)) 1429 : zt.touch && "dblclick" === e 1430 ? ((n = i), 1431 (a = t).removeEventListener("dblclick", n.dblclick), 1432 a.removeEventListener("click", n.simDblclick)) 1433 : "removeEventListener" in t 1434 ? t.removeEventListener(Ce[e] || e, i, !1) 1435 : t.detachEvent("on" + e, i), 1436 (t[be][o] = null))); 1437 } 1438 function Se(t) { 1439 return ( 1440 t.stopPropagation 1441 ? t.stopPropagation() 1442 : t.originalEvent 1443 ? (t.originalEvent._stopped = !0) 1444 : (t.cancelBubble = !0), 1445 this 1446 ); 1447 } 1448 function Me(t) { 1449 return (Te(t, "wheel", Se), this); 1450 } 1451 function Ie(t) { 1452 return ( 1453 Pe(t, "mousedown touchstart dblclick contextmenu", Se), 1454 (t._leaflet_disable_click = !0), 1455 this 1456 ); 1457 } 1458 function je(t) { 1459 return ( 1460 t.preventDefault ? t.preventDefault() : (t.returnValue = !1), 1461 this 1462 ); 1463 } 1464 function Ee(t) { 1465 return (je(t), Se(t), this); 1466 } 1467 function Ae(t) { 1468 if (t.composedPath) return t.composedPath(); 1469 for (var e = [], i = t.target; i; ) (e.push(i), (i = i.parentNode)); 1470 return e; 1471 } 1472 function Be(t, e) { 1473 var i, n; 1474 return e 1475 ? ((n = (i = xe(e)).boundingClientRect), 1476 new j( 1477 (t.clientX - n.left) / i.x - e.clientLeft, 1478 (t.clientY - n.top) / i.y - e.clientTop, 1479 )) 1480 : new j(t.clientX, t.clientY); 1481 } 1482 var Ze = 1483 zt.linux && zt.chrome 1484 ? window.devicePixelRatio 1485 : zt.mac 1486 ? 3 * window.devicePixelRatio 1487 : 0 < window.devicePixelRatio 1488 ? 2 * window.devicePixelRatio 1489 : 1; 1490 function Oe(t) { 1491 return zt.edge 1492 ? t.wheelDeltaY / 2 1493 : t.deltaY && 0 === t.deltaMode 1494 ? -t.deltaY / Ze 1495 : t.deltaY && 1 === t.deltaMode 1496 ? 20 * -t.deltaY 1497 : t.deltaY && 2 === t.deltaMode 1498 ? 60 * -t.deltaY 1499 : t.deltaX || t.deltaZ 1500 ? 0 1501 : t.wheelDelta 1502 ? (t.wheelDeltaY || t.wheelDelta) / 2 1503 : t.detail && Math.abs(t.detail) < 32765 1504 ? 20 * -t.detail 1505 : t.detail 1506 ? (t.detail / -32765) * 60 1507 : 0; 1508 } 1509 function Re(t, e) { 1510 var i = e.relatedTarget; 1511 if (!i) return !0; 1512 try { 1513 for (; i && i !== t; ) i = i.parentNode; 1514 } catch (t) { 1515 return !1; 1516 } 1517 return i !== t; 1518 } 1519 Y = { 1520 __proto__: null, 1521 on: Pe, 1522 off: ke, 1523 stopPropagation: Se, 1524 disableScrollPropagation: Me, 1525 disableClickPropagation: Ie, 1526 preventDefault: je, 1527 stop: Ee, 1528 getPropagationPath: Ae, 1529 getMousePosition: Be, 1530 getWheelDelta: Oe, 1531 isExternalTarget: Re, 1532 addListener: Pe, 1533 removeListener: ke, 1534 }; 1535 var De = I.extend({ 1536 run: function (t, e, i, n) { 1537 (this.stop(), 1538 (this._el = t), 1539 (this._inProgress = !0), 1540 (this._duration = i || 0.25), 1541 (this._easeOutPower = 1 / Math.max(n || 0.5, 0.2)), 1542 (this._startPos = me(t)), 1543 (this._offset = e.subtract(this._startPos)), 1544 (this._startTime = +new Date()), 1545 this.fire("start"), 1546 this._animate()); 1547 }, 1548 stop: function () { 1549 this._inProgress && (this._step(!0), this._complete()); 1550 }, 1551 _animate: function () { 1552 ((this._animId = C(this._animate, this)), this._step()); 1553 }, 1554 _step: function (t) { 1555 var e = +new Date() - this._startTime, 1556 i = 1e3 * this._duration; 1557 e < i 1558 ? this._runFrame(this._easeOut(e / i), t) 1559 : (this._runFrame(1), this._complete()); 1560 }, 1561 _runFrame: function (t, e) { 1562 ((t = this._startPos.add(this._offset.multiplyBy(t))), 1563 e && t._round(), 1564 _e(this._el, t), 1565 this.fire("step")); 1566 }, 1567 _complete: function () { 1568 (T(this._animId), (this._inProgress = !1), this.fire("end")); 1569 }, 1570 _easeOut: function (t) { 1571 return 1 - Math.pow(1 - t, this._easeOutPower); 1572 }, 1573 }), 1574 Ne = I.extend({ 1575 options: { 1576 crs: U, 1577 center: void 0, 1578 zoom: void 0, 1579 minZoom: void 0, 1580 maxZoom: void 0, 1581 layers: [], 1582 maxBounds: void 0, 1583 renderer: void 0, 1584 zoomAnimation: !0, 1585 zoomAnimationThreshold: 4, 1586 fadeAnimation: !0, 1587 markerZoomAnimation: !0, 1588 transform3DLimit: 8388608, 1589 zoomSnap: 1, 1590 zoomDelta: 1, 1591 trackResize: !0, 1592 }, 1593 initialize: function (t, e) { 1594 ((e = p(this, e)), 1595 (this._handlers = []), 1596 (this._layers = {}), 1597 (this._zoomBoundLayers = {}), 1598 (this._sizeChanged = !0), 1599 this._initContainer(t), 1600 this._initLayout(), 1601 (this._onResize = o(this._onResize, this)), 1602 this._initEvents(), 1603 e.maxBounds && this.setMaxBounds(e.maxBounds), 1604 void 0 !== e.zoom && (this._zoom = this._limitZoom(e.zoom)), 1605 e.center && 1606 void 0 !== e.zoom && 1607 this.setView(N(e.center), e.zoom, { reset: !0 }), 1608 this.callInitHooks(), 1609 (this._zoomAnimated = 1610 Jt && 1611 zt.any3d && 1612 !zt.mobileOpera && 1613 this.options.zoomAnimation), 1614 this._zoomAnimated && 1615 (this._createAnimProxy(), 1616 Pe(this._proxy, Yt, this._catchTransitionEnd, this)), 1617 this._addLayers(this.options.layers)); 1618 },
1619 setView: function (t, i, n) { 1620 return ( 1621 (i = void 0 === i ? this._zoom : this._limitZoom(i)), 1622 (t = this._limitCenter(N(t), i, this.options.maxBounds)), 1623 (n = n || {}), 1624 this._stop(), 1625 this._loaded && 1626 !n.reset && 1627 !0 !== n && 1628 (void 0 !== n.animate && 1629 ((n.zoom = e({ animate: n.animate }, n.zoom)), 1630 (n.pan = e( 1631 { animate: n.animate, duration: n.duration }, 1632 n.pan, 1633 ))), 1634 this._zoom !== i 1635 ? this._tryAnimatedZoom && 1636 this._tryAnimatedZoom(t, i, n.zoom) 1637 : this._tryAnimatedPan(t, n.pan)) 1638 ? (clearTimeout(this._sizeTimer), this) 1639 : (this._resetView(t, i, n.pan && n.pan.noMoveStart), this) 1640 ); 1641 }, 1642 setZoom: function (t, e) { 1643 return this._loaded 1644 ? this.setView(this.getCenter(), t, { zoom: e }) 1645 : ((this._zoom = t), this); 1646 }, 1647 zoomIn: function (t, e) { 1648 return ( 1649 (t = t || (zt.any3d ? this.options.zoomDelta : 1)), 1650 this.setZoom(this._zoom + t, e) 1651 ); 1652 }, 1653 zoomOut: function (t, e) { 1654 return ( 1655 (t = t || (zt.any3d ? this.options.zoomDelta : 1)), 1656 this.setZoom(this._zoom - t, e) 1657 ); 1658 }, 1659 setZoomAround: function (t, e, i) { 1660 var n = this.getZoomScale(e), 1661 o = this.getSize().divideBy(2); 1662 return ( 1663 (t = (t instanceof j ? t : this.latLngToContainerPoint(t)) 1664 .subtract(o) 1665 .multiplyBy(1 - 1 / n)), 1666 (n = this.containerPointToLatLng(o.add(t))), 1667 this.setView(n, e, { zoom: i }) 1668 ); 1669 }, 1670 _getBoundsCenterZoom: function (t, e) { 1671 ((e = e || {}), (t = t.getBounds ? t.getBounds() : R(t))); 1672 var i = A(e.paddingTopLeft || e.padding || [0, 0]), 1673 n = A(e.paddingBottomRight || e.padding || [0, 0]), 1674 o = this.getBoundsZoom(t, !1, i.add(n)); 1675 return (o = 1676 "number" == typeof e.maxZoom ? Math.min(e.maxZoom, o) : o) === 1677 1 / 0 1678 ? { center: t.getCenter(), zoom: o } 1679 : ((e = n.subtract(i).divideBy(2)),
1680 (n = this.project(t.getSouthWest(), o)), 1681 (i = this.project(t.getNorthEast(), o)), 1682 { 1683 center: this.unproject(n.add(i).divideBy(2).add(e), o), 1684 zoom: o, 1685 }); 1686 }, 1687 fitBounds: function (t, e) { 1688 if ((t = R(t)).isValid()) 1689 return ( 1690 (t = this._getBoundsCenterZoom(t, e)), 1691 this.setView(t.center, t.zoom, e) 1692 ); 1693 throw new Error("Bounds are not valid."); 1694 }, 1695 fitWorld: function (t) { 1696 return this.fitBounds( 1697 [ 1698 [-90, -180], 1699 [90, 180], 1700 ], 1701 t, 1702 ); 1703 }, 1704 panTo: function (t, e) { 1705 return this.setView(t, this._zoom, { pan: e }); 1706 }, 1707 panBy: function (t, e) { 1708 var i; 1709 return ( 1710 (e = e || {}), 1711 (t = A(t).round()).x || t.y 1712 ? (!0 === e.animate || this.getSize().contains(t) 1713 ? (this._panAnim || 1714 ((this._panAnim = new De()), 1715 this._panAnim.on( 1716 { 1717 step: this._onPanTransitionStep, 1718 end: this._onPanTransitionEnd, 1719 }, 1720 this, 1721 )), 1722 e.noMoveStart || this.fire("movestart"), 1723 !1 !== e.animate 1724 ? (ae(this._mapPane, "leaflet-pan-anim"), 1725 (i = this._getMapPanePos().subtract(t).round()), 1726 this._panAnim.run( 1727 this._mapPane, 1728 i, 1729 e.duration || 0.25, 1730 e.easeLinearity, 1731 )) 1732 : (this._rawPanBy(t), 1733 this.fire("move").fire("moveend"))) 1734 : this._resetView( 1735 this.unproject( 1736 this.project(this.getCenter()).add(t), 1737 ), 1738 this.getZoom(), 1739 ), 1740 this) 1741 : this.fire("moveend") 1742 ); 1743 }, 1744 flyTo: function (t, e, i) { 1745 if (!1 === (i = i || {}).animate || !zt.any3d) 1746 return this.setView(t, e, i); 1747 this._stop(); 1748 var n = this.project(this.getCenter()), 1749 o = this.project(t), 1750 s = this.getSize(), 1751 r = this._zoom, 1752 a = 1753 ((t = N(t)), 1754 (e = void 0 === e ? r : e), 1755 Math.max(s.x, s.y)), 1756 h = a * this.getZoomScale(r, e), 1757 l = o.distanceTo(n) || 1, 1758 c = 1.42, 1759 d = c * c; 1760 function u(t) { 1761 return ( 1762 (t = 1763 (h * h - a * a + (t ? -1 : 1) * d * d * l * l) / 1764 (2 * (t ? h : a) * d * l)), 1765 (t = Math.sqrt(t * t + 1) - t) < 1e-9 ? -18 : Math.log(t) 1766 ); 1767 } 1768 function p(t) { 1769 return (Math.exp(t) - Math.exp(-t)) / 2; 1770 } 1771 function _(t) { 1772 return (Math.exp(t) + Math.exp(-t)) / 2; 1773 } 1774 var m = u(0); 1775 function f(t) { 1776 return (a * (_(m) * (p((t = m + c * t)) / _(t)) - p(m))) / d; 1777 } 1778 var g = Date.now(), 1779 y = (u(1) - m) / c, 1780 v = i.duration ? 1e3 * i.duration : 1e3 * y * 0.8; 1781 return ( 1782 this._moveStart(!0, i.noMoveStart), 1783 function i() { 1784 var s = (Date.now() - g) / v, 1785 h = (1 - Math.pow(1 - s, 1.5)) * y; 1786 s <= 1 1787 ? ((this._flyToFrame = C(i, this)), 1788 this._move( 1789 this.unproject( 1790 n.add(o.subtract(n).multiplyBy(f(h) / l)), 1791 r, 1792 ),
1793 this.getScaleZoom( 1794 a / ((s = h), a * (_(m) / _(m + c * s))), 1795 r, 1796 ), 1797 { flyTo: !0 }, 1798 )) 1799 : this._move(t, e)._moveEnd(!0); 1800 }.call(this), 1801 this 1802 ); 1803 }, 1804 flyToBounds: function (t, e) { 1805 return ( 1806 (t = this._getBoundsCenterZoom(t, e)), 1807 this.flyTo(t.center, t.zoom, e) 1808 ); 1809 }, 1810 setMaxBounds: function (t) { 1811 return ( 1812 (t = R(t)), 1813 this.listens("moveend", this._panInsideMaxBounds) && 1814 this.off("moveend", this._panInsideMaxBounds), 1815 t.isValid() 1816 ? ((this.options.maxBounds = t), 1817 this._loaded && this._panInsideMaxBounds(), 1818 this.on("moveend", this._panInsideMaxBounds)) 1819 : ((this.options.maxBounds = null), this) 1820 ); 1821 }, 1822 setMinZoom: function (t) { 1823 var e = this.options.minZoom; 1824 return ( 1825 (this.options.minZoom = t), 1826 this._loaded && 1827 e !== t && 1828 (this.fire("zoomlevelschange"), 1829 this.getZoom() < this.options.minZoom) 1830 ? this.setZoom(t) 1831 : this 1832 ); 1833 }, 1834 setMaxZoom: function (t) { 1835 var e = this.options.maxZoom; 1836 return ( 1837 (this.options.maxZoom = t), 1838 this._loaded && 1839 e !== t && 1840 (this.fire("zoomlevelschange"), 1841 this.getZoom() > this.options.maxZoom) 1842 ? this.setZoom(t) 1843 : this 1844 ); 1845 }, 1846 panInsideBounds: function (t, e) { 1847 this._enforcingBounds = !0; 1848 var i = this.getCenter(); 1849 return ( 1850 (t = this._limitCenter(i, this._zoom, R(t))), 1851 i.equals(t) || this.panTo(t, e), 1852 (this._enforcingBounds = !1), 1853 this 1854 ); 1855 }, 1856 panInside: function (t, e) { 1857 var i = A((e = e || {}).paddingTopLeft || e.padding || [0, 0]), 1858 n = A(e.paddingBottomRight || e.padding || [0, 0]), 1859 o = this.project(this.getCenter()), 1860 s = 1861 ((t = this.project(t)), 1862 (i = Z([ 1863 (s = this.getPixelBounds()).min.add(i), 1864 s.max.subtract(n), 1865 ])).getSize()); 1866 return ( 1867 i.contains(t) || 1868 ((this._enforcingBounds = !0), 1869 (n = t.subtract(i.getCenter())), 1870 (i = i.extend(t).getSize().subtract(s)), 1871 (o.x += n.x < 0 ? -i.x : i.x), 1872 (o.y += n.y < 0 ? -i.y : i.y), 1873 this.panTo(this.unproject(o), e), 1874 (this._enforcingBounds = !1)), 1875 this 1876 ); 1877 }, 1878 invalidateSize: function (t) { 1879 if (!this._loaded) return this; 1880 t = e({ animate: !1, pan: !0 }, !0 === t ? { animate: !0 } : t); 1881 var i = this.getSize(), 1882 n = 1883 ((this._sizeChanged = !0), 1884 (this._lastCenter = null),
1885 this.getSize()), 1886 s = i.divideBy(2).round(), 1887 r = n.divideBy(2).round(); 1888 return (s = s.subtract(r)).x || s.y 1889 ? (t.animate && t.pan 1890 ? this.panBy(s) 1891 : (t.pan && this._rawPanBy(s), 1892 this.fire("move"), 1893 t.debounceMoveend 1894 ? (clearTimeout(this._sizeTimer), 1895 (this._sizeTimer = setTimeout( 1896 o(this.fire, this, "moveend"), 1897 200, 1898 ))) 1899 : this.fire("moveend")), 1900 this.fire("resize", { oldSize: i, newSize: n })) 1901 : this; 1902 }, 1903 stop: function () { 1904 return ( 1905 this.setZoom(this._limitZoom(this._zoom)), 1906 this.options.zoomSnap || this.fire("viewreset"), 1907 this._stop() 1908 ); 1909 }, 1910 locate: function (t) { 1911 var i, n; 1912 return ( 1913 (t = this._locateOptions = e({ timeout: 1e4, watch: !1 }, t)), 1914 "geolocation" in navigator 1915 ? ((i = o(this._handleGeolocationResponse, this)), 1916 (n = o(this._handleGeolocationError, this)), 1917 t.watch 1918 ? (this._locationWatchId = 1919 navigator.geolocation.watchPosition(i, n, t)) 1920 : navigator.geolocation.getCurrentPosition(i, n, t)) 1921 : this._handleGeolocationError({ 1922 code: 0, 1923 message: "Geolocation not supported.", 1924 }), 1925 this 1926 ); 1927 }, 1928 stopLocate: function () { 1929 return ( 1930 navigator.geolocation && 1931 navigator.geolocation.clearWatch && 1932 navigator.geolocation.clearWatch(this._locationWatchId), 1933 this._locateOptions && (this._locateOptions.setView = !1), 1934 this 1935 ); 1936 }, 1937 _handleGeolocationError: function (t) { 1938 var e; 1939 this._container._leaflet_id && 1940 ((e = t.code), 1941 (t = 1942 t.message || 1943 (1 === e 1944 ? "permission denied" 1945 : 2 === e 1946 ? "position unavailable" 1947 : "timeout")), 1948 this._locateOptions.setView && 1949 !this._loaded && 1950 this.fitWorld(), 1951 this.fire("locationerror", { 1952 code: e, 1953 message: "Geolocation error: " + t + ".", 1954 })); 1955 }, 1956 _handleGeolocationResponse: function (t) { 1957 if (this._container._leaflet_id) { 1958 var e, 1959 i, 1960 n = new D(t.coords.latitude, t.coords.longitude), 1961 o = n.toBounds(2 * t.coords.accuracy), 1962 s = this._locateOptions, 1963 r = 1964 (s.setView && 1965 ((e = this.getBoundsZoom(o)), 1966 this.setView( 1967 n, 1968 s.maxZoom ? Math.min(e, s.maxZoom) : e, 1969 )), 1970 { latlng: n, bounds: o, timestamp: t.timestamp }); 1971 for (i in t.coords) 1972 "number" == typeof t.coords[i] && (r[i] = t.coords[i]); 1973 this.fire("locationfound", r); 1974 } 1975 }, 1976 addHandler: function (t, e) { 1977 return ( 1978 e && 1979 ((e = this[t] = new e(this)), 1980 this._handlers.push(e), 1981 this.options[t] && e.enable()), 1982 this 1983 ); 1984 }, 1985 remove: function () { 1986 if ( 1987 (this._initEvents(!0), 1988 this.options.maxBounds && 1989 this.off("moveend", this._panInsideMaxBounds), 1990 this._containerId !== this._container._leaflet_id) 1991 ) 1992 throw new Error( 1993 "Map container is being reused by another instance", 1994 ); 1995 try { 1996 (delete this._container._leaflet_id, 1997 delete this._containerId); 1998 } catch (t) { 1999 ((this._container._leaflet_id = void 0), 2000 (this._containerId = void 0)); 2001 } 2002 for (var t in (void 0 !== this._locationWatchId && 2003 this.stopLocate(), 2004 this._stop(), 2005 ie(this._mapPane), 2006 this._clearControlPos && this._clearControlPos(), 2007 this._resizeRequest && 2008 (T(this._resizeRequest), (this._resizeRequest = null)), 2009 this._clearHandlers(), 2010 this._loaded && this.fire("unload"), 2011 this._layers)) 2012 this._layers[t].remove(); 2013 for (t in this._panes) ie(this._panes[t]); 2014 return ( 2015 (this._layers = []), 2016 (this._panes = []), 2017 delete this._mapPane, 2018 delete this._renderer, 2019 this 2020 ); 2021 }, 2022 createPane: function (t, e) { 2023 return ( 2024 (e = ee( 2025 "div", 2026 "leaflet-pane" + 2027 (t ? " leaflet-" + t.replace("Pane", "") + "-pane" : ""), 2028 e || this._mapPane, 2029 )), 2030 t && (this._panes[t] = e), 2031 e 2032 ); 2033 }, 2034 getCenter: function () { 2035 return ( 2036 this._checkIfLoaded(), 2037 this._lastCenter && !this._moved() 2038 ? this._lastCenter.clone() 2039 : this.layerPointToLatLng(this._getCenterLayerPoint()) 2040 ); 2041 }, 2042 getZoom: function () { 2043 return this._zoom; 2044 }, 2045 getBounds: function () { 2046 var t = this.getPixelBounds(); 2047 return new O( 2048 this.unproject(t.getBottomLeft()), 2049 this.unproject(t.getTopRight()), 2050 ); 2051 }, 2052 getMinZoom: function () { 2053 return void 0 === this.options.minZoom 2054 ? this._layersMinZoom || 0 2055 : this.options.minZoom; 2056 }, 2057 getMaxZoom: function () { 2058 return void 0 === this.options.maxZoom
2059 ? void 0 === this._layersMaxZoom 2060 ? 1 / 0 2061 : this._layersMaxZoom 2062 : this.options.maxZoom; 2063 }, 2064 getBoundsZoom: function (t, e, i) { 2065 ((t = R(t)), (i = A(i || [0, 0]))); 2066 var n = this.getZoom() || 0, 2067 o = this.getMinZoom(), 2068 s = this.getMaxZoom(), 2069 r = t.getNorthWest(), 2070 a = 2071 ((t = t.getSouthEast()), 2072 (i = this.getSize().subtract(i)), 2073 (t = Z(this.project(t, n), this.project(r, n)).getSize()), 2074 (r = zt.any3d ? this.options.zoomSnap : 1), 2075 i.x / t.x); 2076 return ( 2077 (i = i.y / t.y), 2078 (t = e ? Math.max(a, i) : Math.min(a, i)), 2079 (n = this.getScaleZoom(t, n)), 2080 r && 2081 ((n = Math.round(n / (r / 100)) * (r / 100)), 2082 (n = e ? Math.ceil(n / r) * r : Math.floor(n / r) * r)), 2083 Math.max(o, Math.min(s, n)) 2084 ); 2085 }, 2086 getSize: function () { 2087 return ( 2088 (this._size && !this._sizeChanged) || 2089 ((this._size = new j( 2090 this._container.clientWidth || 0, 2091 this._container.clientHeight || 0, 2092 )), 2093 (this._sizeChanged = !1)), 2094 this._size.clone() 2095 ); 2096 }, 2097 getPixelBounds: function (t, e) { 2098 return new B( 2099 (t = this._getTopLeftPoint(t, e)), 2100 t.add(this.getSize()), 2101 ); 2102 }, 2103 getPixelOrigin: function () { 2104 return (this._checkIfLoaded(), this._pixelOrigin); 2105 }, 2106 getPixelWorldBounds: function (t) { 2107 return this.options.crs.getProjectedBounds( 2108 void 0 === t ? this.getZoom() : t, 2109 ); 2110 }, 2111 getPane: function (t) { 2112 return "string" == typeof t ? this._panes[t] : t; 2113 }, 2114 getPanes: function () { 2115 return this._panes; 2116 }, 2117 getContainer: function () { 2118 return this._container; 2119 }, 2120 getZoomScale: function (t, e) { 2121 var i = this.options.crs; 2122 return ( 2123 (e = void 0 === e ? this._zoom : e), 2124 i.scale(t) / i.scale(e) 2125 ); 2126 }, 2127 getScaleZoom: function (t, e) { 2128 var i = this.options.crs; 2129 return ( 2130 (e = void 0 === e ? this._zoom : e), 2131 (t = i.zoom(t * i.scale(e))), 2132 isNaN(t) ? 1 / 0 : t 2133 ); 2134 }, 2135 project: function (t, e) { 2136 return ( 2137 (e = void 0 === e ? this._zoom : e), 2138 this.options.crs.latLngToPoint(N(t), e) 2139 ); 2140 }, 2141 unproject: function (t, e) { 2142 return ( 2143 (e = void 0 === e ? this._zoom : e), 2144 this.options.crs.pointToLatLng(A(t), e) 2145 ); 2146 }, 2147 layerPointToLatLng: function (t) { 2148 return ( 2149 (t = A(t).add(this.getPixelOrigin())), 2150 this.unproject(t) 2151 ); 2152 }, 2153 latLngToLayerPoint: function (t) { 2154 return this.project(N(t)) 2155 ._round() 2156 ._subtract(this.getPixelOrigin()); 2157 }, 2158 wrapLatLng: function (t) { 2159 return this.options.crs.wrapLatLng(N(t)); 2160 }, 2161 wrapLatLngBounds: function (t) { 2162 return this.options.crs.wrapLatLngBounds(R(t)); 2163 }, 2164 distance: function (t, e) { 2165 return this.options.crs.distance(N(t), N(e)); 2166 }, 2167 containerPointToLayerPoint: function (t) { 2168 return A(t).subtract(this._getMapPanePos()); 2169 }, 2170 layerPointToContainerPoint: function (t) { 2171 return A(t).add(this._getMapPanePos()); 2172 }, 2173 containerPointToLatLng: function (t) { 2174 return ( 2175 (t = this.containerPointToLayerPoint(A(t))), 2176 this.layerPointToLatLng(t) 2177 ); 2178 }, 2179 latLngToContainerPoint: function (t) { 2180 return this.layerPointToContainerPoint( 2181 this.latLngToLayerPoint(N(t)), 2182 ); 2183 }, 2184 mouseEventToContainerPoint: function (t) { 2185 return Be(t, this._container); 2186 }, 2187 mouseEventToLayerPoint: function (t) { 2188 return this.containerPointToLayerPoint( 2189 this.mouseEventToContainerPoint(t), 2190 ); 2191 }, 2192 mouseEventToLatLng: function (t) { 2193 return this.layerPointToLatLng(this.mouseEventToLayerPoint(t)); 2194 }, 2195 _initContainer: function (t) { 2196 if (!(t = this._container = Xt(t))) 2197 throw new Error("Map container not found."); 2198 if (t._leaflet_id) 2199 throw new Error("Map container is already initialized."); 2200 (Pe(t, "scroll", this._onScroll, this), 2201 (this._containerId = r(t))); 2202 }, 2203 _initLayout: function () { 2204 var t = this._container, 2205 e = 2206 ((this._fadeAnimated = 2207 this.options.fadeAnimation && zt.any3d), 2208 ae( 2209 t, 2210 "leaflet-container" + 2211 (zt.touch ? " leaflet-touch" : "") + 2212 (zt.retina ? " leaflet-retina" : "") + 2213 (zt.ielt9 ? " leaflet-oldie" : "") + 2214 (zt.safari ? " leaflet-safari" : "") + 2215 (this._fadeAnimated ? " leaflet-fade-anim" : ""), 2216 ), 2217 te(t, "position")); 2218 ("absolute" !== e && 2219 "relative" !== e && 2220 "fixed" !== e && 2221 "sticky" !== e && 2222 (t.style.position = "relative"), 2223 this._initPanes(), 2224 this._initControlPos && this._initControlPos()); 2225 }, 2226 _initPanes: function () { 2227 var t = (this._panes = {}); 2228 ((this._paneRenderers = {}), 2229 (this._mapPane = this.createPane("mapPane", this._container)), 2230 _e(this._mapPane, new j(0, 0)), 2231 this.createPane("tilePane"), 2232 this.createPane("overlayPane"), 2233 this.createPane("shadowPane"), 2234 this.createPane("markerPane"), 2235 this.createPane("tooltipPane"), 2236 this.createPane("popupPane"), 2237 this.options.markerZoomAnimation || 2238 (ae(t.markerPane, "leaflet-zoom-hide"), 2239 ae(t.shadowPane, "leaflet-zoom-hide"))); 2240 }, 2241 _resetView: function (t, e, i) { 2242 _e(this._mapPane, new j(0, 0)); 2243 var n = !this._loaded, 2244 o = 2245 ((this._loaded = !0), 2246 (e = this._limitZoom(e)), 2247 this.fire("viewprereset"), 2248 this._zoom !== e); 2249 (this._moveStart(o, i)._move(t, e)._moveEnd(o), 2250 this.fire("viewreset"), 2251 n && this.fire("load")); 2252 }, 2253 _moveStart: function (t, e) { 2254 return ( 2255 t && this.fire("zoomstart"), 2256 e || this.fire("movestart"), 2257 this 2258 ); 2259 }, 2260 _move: function (t, e, i, n) { 2261 void 0 === e && (e = this._zoom); 2262 var o = this._zoom !== e; 2263 return ( 2264 (this._zoom = e), 2265 (this._lastCenter = t), 2266 (this._pixelOrigin = this._getNewPixelOrigin(t)), 2267 n 2268 ? i && i.pinch && this.fire("zoom", i) 2269 : ((o || (i && i.pinch)) && this.fire("zoom", i), 2270 this.fire("move", i)), 2271 this 2272 ); 2273 }, 2274 _moveEnd: function (t) { 2275 return (t && this.fire("zoomend"), this.fire("moveend")); 2276 }, 2277 _stop: function () { 2278 return ( 2279 T(this._flyToFrame), 2280 this._panAnim && this._panAnim.stop(), 2281 this 2282 ); 2283 }, 2284 _rawPanBy: function (t) { 2285 _e(this._mapPane, this._getMapPanePos().subtract(t)); 2286 }, 2287 _getZoomSpan: function () { 2288 return this.getMaxZoom() - this.getMinZoom(); 2289 }, 2290 _panInsideMaxBounds: function () { 2291 this._enforcingBounds || 2292 this.panInsideBounds(this.options.maxBounds); 2293 }, 2294 _checkIfLoaded: function () { 2295 if (!this._loaded) 2296 throw new Error("Set map center and zoom first."); 2297 }, 2298 _initEvents: function (t) { 2299 this._targets = {}; 2300 var e = t ? ke : Pe; 2301 (e( 2302 (this._targets[r(this._container)] = this)._container, 2303 "click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup", 2304 this._handleDOMEvent, 2305 this, 2306 ), 2307 this.options.trackResize && 2308 e(window, "resize", this._onResize, this), 2309 zt.any3d && 2310 this.options.transform3DLimit && 2311 (t ? this.off : this.on).call( 2312 this, 2313 "moveend", 2314 this._onMoveEnd, 2315 )); 2316 }, 2317 _onResize: function () { 2318 (T(this._resizeRequest), 2319 (this._resizeRequest = C(function () { 2320 this.invalidateSize({ debounceMoveend: !0 }); 2321 }, this))); 2322 }, 2323 _onScroll: function () { 2324 ((this._container.scrollTop = 0), 2325 (this._container.scrollLeft = 0)); 2326 }, 2327 _onMoveEnd: function () { 2328 var t = this._getMapPanePos(); 2329 Math.max(Math.abs(t.x), Math.abs(t.y)) >= 2330 this.options.transform3DLimit && 2331 this._resetView(this.getCenter(), this.getZoom()); 2332 }, 2333 _findEventTargets: function (t, e) { 2334 for ( 2335 var i, 2336 n = [], 2337 o = "mouseout" === e || "mouseover" === e, 2338 s = t.target || t.srcElement, 2339 a = !1; 2340 s; 2341 ) { 2342 if ( 2343 (i = this._targets[r(s)]) && 2344 ("click" === e || "preclick" === e) && 2345 this._draggableMoved(i) 2346 ) { 2347 a = !0; 2348 break; 2349 } 2350 if (i && i.listens(e, !0)) { 2351 if (o && !Re(s, t)) break; 2352 if ((n.push(i), o)) break; 2353 } 2354 if (s === this._container) break; 2355 s = s.parentNode; 2356 } 2357 return n.length || a || o || !this.listens(e, !0) ? n : [this]; 2358 }, 2359 _isClickDisabled: function (t) { 2360 for (; t && t !== this._container; ) { 2361 if (t._leaflet_disable_click) return !0; 2362 t = t.parentNode; 2363 } 2364 }, 2365 _handleDOMEvent: function (t) { 2366 var e, 2367 i = t.target || t.srcElement; 2368 !this._loaded || 2369 i._leaflet_disable_events ||
2370 ("click" === t.type && this._isClickDisabled(i)) || 2371 ("mousedown" === (e = t.type) && ye(i), 2372 this._fireDOMEvent(t, e)); 2373 }, 2374 _mouseEvents: [ 2375 "click", 2376 "dblclick", 2377 "mouseover", 2378 "mouseout", 2379 "contextmenu", 2380 ], 2381 _fireDOMEvent: function (t, i, n) { 2382 "click" === t.type && 2383 (((h = e({}, t)).type = "preclick"), 2384 this._fireDOMEvent(h, h.type, n)); 2385 var o = this._findEventTargets(t, i); 2386 if (n) { 2387 for (var s = [], r = 0; r < n.length; r++) 2388 n[r].listens(i, !0) && s.push(n[r]); 2389 o = s.concat(o); 2390 } 2391 if (o.length) { 2392 "contextmenu" === i && je(t); 2393 var a, 2394 h = o[0], 2395 l = { originalEvent: t }; 2396 for ( 2397 "keypress" !== t.type && 2398 "keydown" !== t.type && 2399 "keyup" !== t.type && 2400 ((a = h.getLatLng && (!h._radius || h._radius <= 10)), 2401 (l.containerPoint = a 2402 ? this.latLngToContainerPoint(h.getLatLng()) 2403 : this.mouseEventToContainerPoint(t)), 2404 (l.layerPoint = this.containerPointToLayerPoint( 2405 l.containerPoint, 2406 )), 2407 (l.latlng = a 2408 ? h.getLatLng() 2409 : this.layerPointToLatLng(l.layerPoint))), 2410 r = 0; 2411 r < o.length; 2412 r++ 2413 ) 2414 if ( 2415 (o[r].fire(i, l, !0), 2416 l.originalEvent._stopped || 2417 (!1 === o[r].options.bubblingMouseEvents && 2418 -1 !== y(this._mouseEvents, i))) 2419 ) 2420 return; 2421 } 2422 }, 2423 _draggableMoved: function (t) { 2424 return ( 2425 ((t = t.dragging && t.dragging.enabled() ? t : this) 2426 .dragging && 2427 t.dragging.moved()) || 2428 (this.boxZoom && this.boxZoom.moved()) 2429 ); 2430 }, 2431 _clearHandlers: function () { 2432 for (var t = 0, e = this._handlers.length; t < e; t++) 2433 this._handlers[t].disable(); 2434 }, 2435 whenReady: function (t, e) { 2436 return ( 2437 this._loaded 2438 ? t.call(e || this, { target: this }) 2439 : this.on("load", t, e), 2440 this 2441 ); 2442 }, 2443 _getMapPanePos: function () { 2444 return me(this._mapPane) || new j(0, 0); 2445 }, 2446 _moved: function () { 2447 var t = this._getMapPanePos(); 2448 return t && !t.equals([0, 0]); 2449 }, 2450 _getTopLeftPoint: function (t, e) { 2451 return ( 2452 t && void 0 !== e 2453 ? this._getNewPixelOrigin(t, e) 2454 : this.getPixelOrigin() 2455 ).subtract(this._getMapPanePos()); 2456 }, 2457 _getNewPixelOrigin: function (t, e) { 2458 var i = this.getSize()._divideBy(2); 2459 return this.project(t, e) 2460 ._subtract(i) 2461 ._add(this._getMapPanePos()) 2462 ._round(); 2463 }, 2464 _latLngToNewLayerPoint: function (t, e, i) { 2465 return ( 2466 (i = this._getNewPixelOrigin(i, e)), 2467 this.project(t, e)._subtract(i) 2468 ); 2469 }, 2470 _latLngBoundsToNewLayerBounds: function (t, e, i) { 2471 return ( 2472 (i = this._getNewPixelOrigin(i, e)), 2473 Z([
2474 this.project(t.getSouthWest(), e)._subtract(i), 2475 this.project(t.getNorthWest(), e)._subtract(i), 2476 this.project(t.getSouthEast(), e)._subtract(i), 2477 this.project(t.getNorthEast(), e)._subtract(i), 2478 ]) 2479 ); 2480 }, 2481 _getCenterLayerPoint: function () { 2482 return this.containerPointToLayerPoint( 2483 this.getSize()._divideBy(2), 2484 ); 2485 }, 2486 _getCenterOffset: function (t) { 2487 return this.latLngToLayerPoint(t).subtract( 2488 this._getCenterLayerPoint(), 2489 ); 2490 }, 2491 _limitCenter: function (t, e, i) { 2492 var n, o; 2493 return !i || 2494 ((n = this.project(t, e)), 2495 (o = this.getSize().divideBy(2)), 2496 (o = new B(n.subtract(o), n.add(o))), 2497 (o = this._getBoundsOffset(o, i, e)), 2498 Math.abs(o.x) <= 1 && Math.abs(o.y) <= 1) 2499 ? t 2500 : this.unproject(n.add(o), e); 2501 }, 2502 _limitOffset: function (t, e) { 2503 var i; 2504 return e 2505 ? ((i = new B( 2506 (i = this.getPixelBounds()).min.add(t), 2507 i.max.add(t), 2508 )), 2509 t.add(this._getBoundsOffset(i, e))) 2510 : t; 2511 }, 2512 _getBoundsOffset: function (t, e, i) { 2513 return ( 2514 (i = (e = Z( 2515 this.project(e.getNorthEast(), i),
2516 this.project(e.getSouthWest(), i), 2517 )).min.subtract(t.min)), 2518 (e = e.max.subtract(t.max)), 2519 new j(this._rebound(i.x, -e.x), this._rebound(i.y, -e.y)) 2520 ); 2521 }, 2522 _rebound: function (t, e) { 2523 return 0 < t + e 2524 ? Math.round(t - e) / 2 2525 : Math.max(0, Math.ceil(t)) - Math.max(0, Math.floor(e)); 2526 }, 2527 _limitZoom: function (t) { 2528 var e = this.getMinZoom(), 2529 i = this.getMaxZoom(), 2530 n = zt.any3d ? this.options.zoomSnap : 1; 2531 return ( 2532 n && (t = Math.round(t / n) * n), 2533 Math.max(e, Math.min(i, t)) 2534 ); 2535 }, 2536 _onPanTransitionStep: function () { 2537 this.fire("move"); 2538 }, 2539 _onPanTransitionEnd: function () { 2540 (he(this._mapPane, "leaflet-pan-anim"), this.fire("moveend")); 2541 }, 2542 _tryAnimatedPan: function (t, e) { 2543 return ( 2544 (t = this._getCenterOffset(t)._trunc()), 2545 !( 2546 (!0 !== (e && e.animate) && !this.getSize().contains(t)) || 2547 (this.panBy(t, e), 0) 2548 ) 2549 ); 2550 }, 2551 _createAnimProxy: function () { 2552 var t = (this._proxy = ee( 2553 "div", 2554 "leaflet-proxy leaflet-zoom-animated", 2555 )); 2556 (this._panes.mapPane.appendChild(t), 2557 this.on( 2558 "zoomanim", 2559 function (t) { 2560 var e = Kt, 2561 i = this._proxy.style[e]; 2562 (pe( 2563 this._proxy, 2564 this.project(t.center, t.zoom), 2565 this.getZoomScale(t.zoom, 1), 2566 ), 2567 i === this._proxy.style[e] && 2568 this._animatingZoom && 2569 this._onZoomTransitionEnd()); 2570 }, 2571 this, 2572 ), 2573 this.on("load moveend", this._animMoveEnd, this), 2574 this._on("unload", this._destroyAnimProxy, this)); 2575 }, 2576 _destroyAnimProxy: function () { 2577 (ie(this._proxy), 2578 this.off("load moveend", this._animMoveEnd, this), 2579 delete this._proxy); 2580 }, 2581 _animMoveEnd: function () { 2582 var t = this.getCenter(), 2583 e = this.getZoom(); 2584 pe(this._proxy, this.project(t, e), this.getZoomScale(e, 1)); 2585 }, 2586 _catchTransitionEnd: function (t) { 2587 this._animatingZoom && 2588 0 <= t.propertyName.indexOf("transform") && 2589 this._onZoomTransitionEnd(); 2590 }, 2591 _nothingToAnimate: function () { 2592 return !this._container.getElementsByClassName( 2593 "leaflet-zoom-animated", 2594 ).length; 2595 }, 2596 _tryAnimatedZoom: function (t, e, i) { 2597 if (!this._animatingZoom) { 2598 if ( 2599 ((i = i || {}), 2600 !this._zoomAnimated || 2601 !1 === i.animate || 2602 this._nothingToAnimate() || 2603 Math.abs(e - this._zoom) > 2604 this.options.zoomAnimationThreshold) 2605 ) 2606 return !1; 2607 var n = this.getZoomScale(e); 2608 if ( 2609 ((n = this._getCenterOffset(t)._divideBy(1 - 1 / n)), 2610 !0 !== i.animate && !this.getSize().contains(n)) 2611 ) 2612 return !1; 2613 C(function () { 2614 this._moveStart(!0, i.noMoveStart || !1)._animateZoom( 2615 t, 2616 e, 2617 !0, 2618 ); 2619 }, this); 2620 } 2621 return !0; 2622 }, 2623 _animateZoom: function (t, e, i, n) { 2624 this._mapPane && 2625 (i && 2626 ((this._animatingZoom = !0), 2627 (this._animateToCenter = t), 2628 (this._animateToZoom = e), 2629 ae(this._mapPane, "leaflet-zoom-anim")), 2630 this.fire("zoomanim", { center: t, zoom: e, noUpdate: n }), 2631 this._tempFireZoomEvent || 2632 (this._tempFireZoomEvent = 2633 this._zoom !== this._animateToZoom), 2634 this._move( 2635 this._animateToCenter, 2636 this._animateToZoom, 2637 void 0, 2638 !0, 2639 ), 2640 setTimeout(o(this._onZoomTransitionEnd, this), 250)); 2641 }, 2642 _onZoomTransitionEnd: function () { 2643 this._animatingZoom && 2644 (this._mapPane && he(this._mapPane, "leaflet-zoom-anim"), 2645 (this._animatingZoom = !1), 2646 this._move( 2647 this._animateToCenter, 2648 this._animateToZoom, 2649 void 0, 2650 !0, 2651 ), 2652 this._tempFireZoomEvent && this.fire("zoom"), 2653 delete this._tempFireZoomEvent, 2654 this.fire("move"), 2655 this._moveEnd(!0)); 2656 }, 2657 }); 2658 function Qe(t) { 2659 return new We(t); 2660 } 2661 var Fe, 2662 We = S.extend({ 2663 options: { position: "topright" }, 2664 initialize: function (t) { 2665 p(this, t); 2666 }, 2667 getPosition: function () { 2668 return this.options.position; 2669 }, 2670 setPosition: function (t) { 2671 var e = this._map; 2672 return ( 2673 e && e.removeControl(this), 2674 (this.options.position = t), 2675 e && e.addControl(this), 2676 this 2677 ); 2678 }, 2679 getContainer: function () { 2680 return this._container; 2681 }, 2682 addTo: function (t) { 2683 (this.remove(), (this._map = t)); 2684 var e = (this._container = this.onAdd(t)), 2685 i = this.getPosition(); 2686 return ( 2687 (t = t._controlCorners[i]), 2688 ae(e, "leaflet-control"), 2689 -1 !== i.indexOf("bottom") 2690 ? t.insertBefore(e, t.firstChild) 2691 : t.appendChild(e), 2692 this._map.on("unload", this.remove, this), 2693 this 2694 ); 2695 }, 2696 remove: function () { 2697 return ( 2698 this._map && 2699 (ie(this._container), 2700 this.onRemove && this.onRemove(this._map), 2701 this._map.off("unload", this.remove, this), 2702 (this._map = null)), 2703 this 2704 ); 2705 }, 2706 _refocusOnMap: function (t) { 2707 this._map && 2708 t && 2709 0 < t.screenX && 2710 0 < t.screenY && 2711 this._map.getContainer().focus(); 2712 }, 2713 }), 2714 qe = 2715 (Ne.include({ 2716 addControl: function (t) { 2717 return (t.addTo(this), this); 2718 }, 2719 removeControl: function (t) { 2720 return (t.remove(), this); 2721 }, 2722 _initControlPos: function () { 2723 var t = (this._controlCorners = {}), 2724 e = "leaflet-", 2725 i = (this._controlContainer = ee( 2726 "div", 2727 e + "control-container", 2728 this._container, 2729 )); 2730 function n(n, o) { 2731 t[n + o] = ee("div", e + n + " " + e + o, i); 2732 } 2733 (n("top", "left"), 2734 n("top", "right"), 2735 n("bottom", "left"), 2736 n("bottom", "right")); 2737 }, 2738 _clearControlPos: function () { 2739 for (var t in this._controlCorners) 2740 ie(this._controlCorners[t]); 2741 (ie(this._controlContainer), 2742 delete this._controlCorners, 2743 delete this._controlContainer); 2744 }, 2745 }), 2746 We.extend({ 2747 options: { 2748 collapsed: !0, 2749 position: "topright", 2750 autoZIndex: !0, 2751 hideSingleBase: !1,
2752 sortLayers: !1, 2753 sortFunction: function (t, e, i, n) { 2754 return i < n ? -1 : n < i ? 1 : 0; 2755 }, 2756 }, 2757 initialize: function (t, e, i) { 2758 for (var n in (p(this, i), 2759 (this._layerControlInputs = []), 2760 (this._layers = []), 2761 (this._lastZIndex = 0), 2762 (this._handlingClick = !1), 2763 (this._preventClick = !1), 2764 t)) 2765 this._addLayer(t[n], n); 2766 for (n in e) this._addLayer(e[n], n, !0); 2767 }, 2768 onAdd: function (t) { 2769 (this._initLayout(), 2770 this._update(), 2771 (this._map = t).on( 2772 "zoomend", 2773 this._checkDisabledLayers, 2774 this, 2775 )); 2776 for (var e = 0; e < this._layers.length; e++) 2777 this._layers[e].layer.on( 2778 "add remove", 2779 this._onLayerChange, 2780 this, 2781 ); 2782 return this._container; 2783 }, 2784 addTo: function (t) { 2785 return ( 2786 We.prototype.addTo.call(this, t), 2787 this._expandIfNotCollapsed() 2788 ); 2789 }, 2790 onRemove: function () { 2791 this._map.off("zoomend", this._checkDisabledLayers, this); 2792 for (var t = 0; t < this._layers.length; t++) 2793 this._layers[t].layer.off( 2794 "add remove", 2795 this._onLayerChange, 2796 this, 2797 ); 2798 }, 2799 addBaseLayer: function (t, e) { 2800 return ( 2801 this._addLayer(t, e), 2802 this._map ? this._update() : this 2803 ); 2804 }, 2805 addOverlay: function (t, e) { 2806 return ( 2807 this._addLayer(t, e, !0), 2808 this._map ? this._update() : this 2809 ); 2810 }, 2811 removeLayer: function (t) { 2812 return ( 2813 t.off("add remove", this._onLayerChange, this), 2814 (t = this._getLayer(r(t))) && 2815 this._layers.splice(this._layers.indexOf(t), 1), 2816 this._map ? this._update() : this 2817 ); 2818 }, 2819 expand: function () { 2820 (ae(this._container, "leaflet-control-layers-expanded"), 2821 (this._section.style.height = null)); 2822 var t = 2823 this._map.getSize().y - (this._container.offsetTop + 50); 2824 return ( 2825 t < this._section.clientHeight 2826 ? (ae(this._section, "leaflet-control-layers-scrollbar"), 2827 (this._section.style.height = t + "px")) 2828 : he(this._section, "leaflet-control-layers-scrollbar"), 2829 this._checkDisabledLayers(), 2830 this 2831 ); 2832 }, 2833 collapse: function () { 2834 return ( 2835 he(this._container, "leaflet-control-layers-expanded"), 2836 this 2837 ); 2838 }, 2839 _initLayout: function () { 2840 var t = "leaflet-control-layers", 2841 e = (this._container = ee("div", t)), 2842 i = this.options.collapsed, 2843 n = 2844 (e.setAttribute("aria-haspopup", !0), 2845 Ie(e), 2846 Me(e), 2847 (this._section = ee("section", t + "-list"))), 2848 o = 2849 (i && 2850 (this._map.on("click", this.collapse, this), 2851 Pe( 2852 e, 2853 { 2854 mouseenter: this._expandSafely, 2855 mouseleave: this.collapse, 2856 }, 2857 this, 2858 )), 2859 (this._layersLink = ee("a", t + "-toggle", e))); 2860 ((o.href = "#"), 2861 (o.title = "Layers"), 2862 o.setAttribute("role", "button"), 2863 Pe( 2864 o, 2865 { 2866 keydown: function (t) { 2867 13 === t.keyCode && this._expandSafely(); 2868 }, 2869 click: function (t) { 2870 (je(t), this._expandSafely()); 2871 }, 2872 }, 2873 this, 2874 ), 2875 i || this.expand(), 2876 (this._baseLayersList = ee("div", t + "-base", n)), 2877 (this._separator = ee("div", t + "-separator", n)), 2878 (this._overlaysList = ee("div", t + "-overlays", n)), 2879 e.appendChild(n)); 2880 }, 2881 _getLayer: function (t) { 2882 for (var e = 0; e < this._layers.length; e++) 2883 if (this._layers[e] && r(this._layers[e].layer) === t) 2884 return this._layers[e]; 2885 }, 2886 _addLayer: function (t, e, i) { 2887 (this._map && t.on("add remove", this._onLayerChange, this), 2888 this._layers.push({ layer: t, name: e, overlay: i }), 2889 this.options.sortLayers && 2890 this._layers.sort( 2891 o(function (t, e) { 2892 return this.options.sortFunction( 2893 t.layer, 2894 e.layer, 2895 t.name, 2896 e.name, 2897 ); 2898 }, this), 2899 ),
2900 this.options.autoZIndex && 2901 t.setZIndex && 2902 (this._lastZIndex++, t.setZIndex(this._lastZIndex)), 2903 this._expandIfNotCollapsed()); 2904 }, 2905 _update: function () { 2906 if (this._container) { 2907 (ne(this._baseLayersList), 2908 ne(this._overlaysList), 2909 (this._layerControlInputs = [])); 2910 for ( 2911 var t, e, i, n = 0, o = 0; 2912 o < this._layers.length; 2913 o++ 2914 ) 2915 ((i = this._layers[o]), 2916 this._addItem(i), 2917 (e = e || i.overlay), 2918 (t = t || !i.overlay), 2919 (n += i.overlay ? 0 : 1)); 2920 (this.options.hideSingleBase && 2921 (this._baseLayersList.style.display = (t = t && 1 < n) 2922 ? "" 2923 : "none"), 2924 (this._separator.style.display = e && t ? "" : "none")); 2925 } 2926 return this; 2927 }, 2928 _onLayerChange: function (t) { 2929 this._handlingClick || this._update(); 2930 var e = this._getLayer(r(t.target)); 2931 (t = e.overlay 2932 ? "add" === t.type 2933 ? "overlayadd" 2934 : "overlayremove" 2935 : "add" === t.type 2936 ? "baselayerchange" 2937 : null) && this._map.fire(t, e); 2938 }, 2939 _createRadioElement: function (t, e) { 2940 return ( 2941 (t = 2942 '<input type="radio" class="leaflet-control-layers-selector" name="' + 2943 t + 2944 '"' + 2945 (e ? ' checked="checked"' : "") + 2946 "/>"), 2947 ((e = document.createElement("div")).innerHTML = t), 2948 e.firstChild 2949 ); 2950 }, 2951 _addItem: function (t) { 2952 var e, 2953 i = document.createElement("label"), 2954 n = this._map.hasLayer(t.layer), 2955 o = 2956 (((t.overlay 2957 ? (((e = document.createElement("input")).type = 2958 "checkbox"), 2959 (e.className = "leaflet-control-layers-selector"), 2960 (e.defaultChecked = n)) 2961 : (e = this._createRadioElement( 2962 "leaflet-base-layers_" + r(this), 2963 n, 2964 )), 2965 this._layerControlInputs.push(e), 2966 (e.layerId = r(t.layer)), 2967 Pe(e, "click", this._onInputClick, this), 2968 (n = document.createElement("span"))).innerHTML = 2969 " " + t.name), 2970 document.createElement("span")); 2971 return ( 2972 i.appendChild(o), 2973 o.appendChild(e), 2974 o.appendChild(n), 2975 (t.overlay 2976 ? this._overlaysList 2977 : this._baseLayersList 2978 ).appendChild(i), 2979 this._checkDisabledLayers(), 2980 i 2981 ); 2982 }, 2983 _onInputClick: function () { 2984 if (!this._preventClick) { 2985 var t, 2986 e, 2987 i = this._layerControlInputs, 2988 n = [], 2989 o = []; 2990 this._handlingClick = !0; 2991 for (var s = i.length - 1; 0 <= s; s--) 2992 ((t = i[s]), 2993 (e = this._getLayer(t.layerId).layer), 2994 t.checked ? n.push(e) : t.checked || o.push(e)); 2995 for (s = 0; s < o.length; s++) 2996 this._map.hasLayer(o[s]) && this._map.removeLayer(o[s]); 2997 for (s = 0; s < n.length; s++) 2998 this._map.hasLayer(n[s]) || this._map.addLayer(n[s]); 2999 ((this._handlingClick = !1), this._refocusOnMap()); 3000 } 3001 }, 3002 _checkDisabledLayers: function () { 3003 for ( 3004 var t, 3005 e, 3006 i = this._layerControlInputs, 3007 n = this._map.getZoom(), 3008 o = i.length - 1; 3009 0 <= o; 3010 o-- 3011 ) 3012 ((t = i[o]), 3013 (e = this._getLayer(t.layerId).layer), 3014 (t.disabled = 3015 (void 0 !== e.options.minZoom && 3016 n < e.options.minZoom) || 3017 (void 0 !== e.options.maxZoom && 3018 n > e.options.maxZoom))); 3019 }, 3020 _expandIfNotCollapsed: function () { 3021 return ( 3022 this._map && !this.options.collapsed && this.expand(), 3023 this 3024 ); 3025 }, 3026 _expandSafely: function () { 3027 var t = this._section, 3028 e = 3029 ((this._preventClick = !0), 3030 Pe(t, "click", je), 3031 this.expand(), 3032 this); 3033 setTimeout(function () { 3034 (ke(t, "click", je), (e._preventClick = !1)); 3035 }); 3036 }, 3037 })), 3038 He = We.extend({ 3039 options: { 3040 position: "topleft", 3041 zoomInText: '<span aria-hidden="true">+</span>', 3042 zoomInTitle: "Zoom in", 3043 zoomOutText: '<span aria-hidden="true">−</span>', 3044 zoomOutTitle: "Zoom out", 3045 }, 3046 onAdd: function (t) { 3047 var e = "leaflet-control-zoom", 3048 i = ee("div", e + " leaflet-bar"), 3049 n = this.options; 3050 return ( 3051 (this._zoomInButton = this._createButton( 3052 n.zoomInText, 3053 n.zoomInTitle, 3054 e + "-in", 3055 i, 3056 this._zoomIn, 3057 )), 3058 (this._zoomOutButton = this._createButton( 3059 n.zoomOutText, 3060 n.zoomOutTitle, 3061 e + "-out", 3062 i, 3063 this._zoomOut, 3064 )), 3065 this._updateDisabled(), 3066 t.on("zoomend zoomlevelschange", this._updateDisabled, this), 3067 i 3068 ); 3069 }, 3070 onRemove: function (t) { 3071 t.off("zoomend zoomlevelschange", this._updateDisabled, this); 3072 }, 3073 disable: function () { 3074 return ((this._disabled = !0), this._updateDisabled(), this); 3075 }, 3076 enable: function () { 3077 return ((this._disabled = !1), this._updateDisabled(), this); 3078 }, 3079 _zoomIn: function (t) { 3080 !this._disabled && 3081 this._map._zoom < this._map.getMaxZoom() && 3082 this._map.zoomIn( 3083 this._map.options.zoomDelta * (t.shiftKey ? 3 : 1), 3084 ); 3085 }, 3086 _zoomOut: function (t) { 3087 !this._disabled && 3088 this._map._zoom > this._map.getMinZoom() && 3089 this._map.zoomOut( 3090 this._map.options.zoomDelta * (t.shiftKey ? 3 : 1), 3091 ); 3092 }, 3093 _createButton: function (t, e, i, n, o) { 3094 return ( 3095 ((i = ee("a", i, n)).innerHTML = t), 3096 (i.href = "#"), 3097 (i.title = e), 3098 i.setAttribute("role", "button"), 3099 i.setAttribute("aria-label", e), 3100 Ie(i), 3101 Pe(i, "click", Ee), 3102 Pe(i, "click", o, this), 3103 Pe(i, "click", this._refocusOnMap, this), 3104 i 3105 ); 3106 }, 3107 _updateDisabled: function () { 3108 var t = this._map, 3109 e = "leaflet-disabled"; 3110 (he(this._zoomInButton, e), 3111 he(this._zoomOutButton, e), 3112 this._zoomInButton.setAttribute("aria-disabled", "false"), 3113 this._zoomOutButton.setAttribute("aria-disabled", "false"),
3114 (!this._disabled && t._zoom !== t.getMinZoom()) || 3115 (ae(this._zoomOutButton, e), 3116 this._zoomOutButton.setAttribute("aria-disabled", "true")), 3117 (!this._disabled && t._zoom !== t.getMaxZoom()) || 3118 (ae(this._zoomInButton, e), 3119 this._zoomInButton.setAttribute("aria-disabled", "true"))); 3120 }, 3121 }), 3122 Ue = 3123 (Ne.mergeOptions({ zoomControl: !0 }), 3124 Ne.addInitHook(function () { 3125 this.options.zoomControl && 3126 ((this.zoomControl = new He()), 3127 this.addControl(this.zoomControl)); 3128 }), 3129 We.extend({ 3130 options: { 3131 position: "bottomleft", 3132 maxWidth: 100, 3133 metric: !0, 3134 imperial: !0, 3135 }, 3136 onAdd: function (t) { 3137 var e = "leaflet-control-scale", 3138 i = ee("div", e), 3139 n = this.options; 3140 return ( 3141 this._addScales(n, e + "-line", i), 3142 t.on( 3143 n.updateWhenIdle ? "moveend" : "move", 3144 this._update, 3145 this, 3146 ), 3147 t.whenReady(this._update, this), 3148 i 3149 ); 3150 }, 3151 onRemove: function (t) { 3152 t.off( 3153 this.options.updateWhenIdle ? "moveend" : "move", 3154 this._update, 3155 this, 3156 ); 3157 }, 3158 _addScales: function (t, e, i) { 3159 (t.metric && (this._mScale = ee("div", e, i)), 3160 t.imperial && (this._iScale = ee("div", e, i))); 3161 }, 3162 _update: function () { 3163 var t = (e = this._map).getSize().y / 2, 3164 e = e.distance( 3165 e.containerPointToLatLng([0, t]), 3166 e.containerPointToLatLng([this.options.maxWidth, t]), 3167 ); 3168 this._updateScales(e); 3169 }, 3170 _updateScales: function (t) { 3171 (this.options.metric && t && this._updateMetric(t), 3172 this.options.imperial && t && this._updateImperial(t)); 3173 }, 3174 _updateMetric: function (t) { 3175 var e = this._getRoundNum(t); 3176 this._updateScale( 3177 this._mScale, 3178 e < 1e3 ? e + " m" : e / 1e3 + " km", 3179 e / t, 3180 ); 3181 }, 3182 _updateImperial: function (t) { 3183 var e, i; 3184 5280 < (t *= 3.2808399) 3185 ? ((i = this._getRoundNum((e = t / 5280))), 3186 this._updateScale(this._iScale, i + " mi", i / e)) 3187 : ((i = this._getRoundNum(t)), 3188 this._updateScale(this._iScale, i + " ft", i / t)); 3189 }, 3190 _updateScale: function (t, e, i) { 3191 ((t.style.width = 3192 Math.round(this.options.maxWidth * i) + "px"), 3193 (t.innerHTML = e)); 3194 }, 3195 _getRoundNum: function (t) { 3196 var e = Math.pow(10, (Math.floor(t) + "").length - 1); 3197 return ( 3198 e * 3199 (10 <= (t /= e) 3200 ? 10 3201 : 5 <= t 3202 ? 5 3203 : 3 <= t 3204 ? 3 3205 : 2 <= t 3206 ? 2 3207 : 1) 3208 ); 3209 }, 3210 })), 3211 Ge = We.extend({ 3212 options: { 3213 position: "bottomright", 3214 prefix: 3215 '<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">' + 3216 (zt.inlineSvg 3217 ? '<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg> ' 3218 : "") + 3219 "Leaflet</a>", 3220 }, 3221 initialize: function (t) { 3222 (p(this, t), (this._attributions = {})); 3223 }, 3224 onAdd: function (t) { 3225 for (var e in (((t.attributionControl = this)._container = ee( 3226 "div", 3227 "leaflet-control-attribution", 3228 )), 3229 Ie(this._container), 3230 t._layers)) 3231 t._layers[e].getAttribution && 3232 this.addAttribution(t._layers[e].getAttribution()); 3233 return ( 3234 this._update(), 3235 t.on("layeradd", this._addAttribution, this), 3236 this._container 3237 ); 3238 }, 3239 onRemove: function (t) { 3240 t.off("layeradd", this._addAttribution, this); 3241 }, 3242 _addAttribution: function (t) { 3243 t.layer.getAttribution && 3244 (this.addAttribution(t.layer.getAttribution()), 3245 t.layer.once( 3246 "remove", 3247 function () { 3248 this.removeAttribution(t.layer.getAttribution()); 3249 }, 3250 this, 3251 )); 3252 }, 3253 setPrefix: function (t) { 3254 return ((this.options.prefix = t), this._update(), this); 3255 }, 3256 addAttribution: function (t) { 3257 return ( 3258 t && 3259 (this._attributions[t] || (this._attributions[t] = 0), 3260 this._attributions[t]++, 3261 this._update()), 3262 this 3263 ); 3264 }, 3265 removeAttribution: function (t) { 3266 return ( 3267 t && 3268 this._attributions[t] && 3269 (this._attributions[t]--, this._update()), 3270 this 3271 ); 3272 }, 3273 _update: function () { 3274 if (this._map) { 3275 var t, 3276 e = []; 3277 for (t in this._attributions) 3278 this._attributions[t] && e.push(t); 3279 var i = []; 3280 (this.options.prefix && i.push(this.options.prefix), 3281 e.length && i.push(e.join(", ")), 3282 (this._container.innerHTML = i.join( 3283 ' <span aria-hidden="true">|</span> ', 3284 ))); 3285 } 3286 }, 3287 }), 3288 Ve = 3289 (Ne.mergeOptions({ attributionControl: !0 }), 3290 Ne.addInitHook(function () { 3291 this.options.attributionControl && new Ge().addTo(this); 3292 }), 3293 (We.Layers = qe), 3294 (We.Zoom = He), 3295 (We.Scale = Ue), 3296 (We.Attribution = Ge), 3297 (Qe.layers = function (t, e, i) { 3298 return new qe(t, e, i); 3299 }), 3300 (Qe.zoom = function (t) { 3301 return new He(t); 3302 }), 3303 (Qe.scale = function (t) { 3304 return new Ue(t); 3305 }), 3306 (Qe.attribution = function (t) { 3307 return new Ge(t); 3308 }), 3309 (X = S.extend({ 3310 initialize: function (t) { 3311 this._map = t; 3312 }, 3313 enable: function () { 3314 return ( 3315 this._enabled || ((this._enabled = !0), this.addHooks()), 3316 this 3317 ); 3318 }, 3319 disable: function () { 3320 return ( 3321 this._enabled && ((this._enabled = !1), this.removeHooks()), 3322 this 3323 ); 3324 }, 3325 enabled: function () { 3326 return !!this._enabled; 3327 }, 3328 })), 3329 (X.addTo = function (t, e) { 3330 return (t.addHandler(e, this), this); 3331 }), 3332 (tt = { Events: M }), 3333 zt.touch ? "touchstart mousedown" : "mousedown"), 3334 $e = I.extend({ 3335 options: { clickTolerance: 3 }, 3336 initialize: function (t, e, i, n) { 3337 (p(this, n), 3338 (this._element = t), 3339 (this._dragStartTarget = e || t), 3340 (this._preventOutline = i)); 3341 }, 3342 enable: function () { 3343 this._enabled || 3344 (Pe(this._dragStartTarget, Ve, this._onDown, this), 3345 (this._enabled = !0)); 3346 }, 3347 disable: function () { 3348 this._enabled && 3349 ($e._dragging === this && this.finishDrag(!0), 3350 ke(this._dragStartTarget, Ve, this._onDown, this), 3351 (this._enabled = !1), 3352 (this._moved = !1)); 3353 }, 3354 _onDown: function (t) { 3355 var e, i; 3356 this._enabled && 3357 ((this._moved = !1), 3358 re(this._element, "leaflet-zoom-anim") || 3359 (t.touches && 1 !== t.touches.length 3360 ? $e._dragging === this && this.finishDrag() 3361 : $e._dragging || 3362 t.shiftKey || 3363 (1 !== t.which && 1 !== t.button && !t.touches) || 3364 (($e._dragging = this)._preventOutline && 3365 ye(this._element), 3366 fe(), 3367 Ut(), 3368 this._moving || 3369 (this.fire("down"), 3370 (i = t.touches ? t.touches[0] : t), 3371 (e = we(this._element)), 3372 (this._startPoint = new j(i.clientX, i.clientY)), 3373 (this._startPos = me(this._element)), 3374 (this._parentScale = xe(e)), 3375 (i = "mousedown" === t.type), 3376 Pe( 3377 document, 3378 i ? "mousemove" : "touchmove", 3379 this._onMove, 3380 this, 3381 ), 3382 Pe( 3383 document, 3384 i ? "mouseup" : "touchend touchcancel", 3385 this._onUp, 3386 this, 3387 ))))); 3388 }, 3389 _onMove: function (t) { 3390 var e; 3391 this._enabled && 3392 (t.touches && 1 < t.touches.length 3393 ? (this._moved = !0) 3394 : (!(e = new j( 3395 (e = 3396 t.touches && 1 === t.touches.length 3397 ? t.touches[0] 3398 : t).clientX, 3399 e.clientY, 3400 )._subtract(this._startPoint)).x && 3401 !e.y) || 3402 Math.abs(e.x) + Math.abs(e.y) < 3403 this.options.clickTolerance || 3404 ((e.x /= this._parentScale.x), 3405 (e.y /= this._parentScale.y), 3406 je(t), 3407 this._moved || 3408 (this.fire("dragstart"), 3409 (this._moved = !0), 3410 ae(document.body, "leaflet-dragging"), 3411 (this._lastTarget = t.target || t.srcElement), 3412 window.SVGElementInstance && 3413 this._lastTarget instanceof 3414 window.SVGElementInstance && 3415 (this._lastTarget = 3416 this._lastTarget.correspondingUseElement), 3417 ae(this._lastTarget, "leaflet-drag-target")), 3418 (this._newPos = this._startPos.add(e)), 3419 (this._moving = !0), 3420 (this._lastEvent = t), 3421 this._updatePosition())); 3422 }, 3423 _updatePosition: function () { 3424 var t = { originalEvent: this._lastEvent }; 3425 (this.fire("predrag", t), 3426 _e(this._element, this._newPos), 3427 this.fire("drag", t)); 3428 }, 3429 _onUp: function () { 3430 this._enabled && this.finishDrag(); 3431 }, 3432 finishDrag: function (t) { 3433 (he(document.body, "leaflet-dragging"), 3434 this._lastTarget && 3435 (he(this._lastTarget, "leaflet-drag-target"), 3436 (this._lastTarget = null)), 3437 ke(document, "mousemove touchmove", this._onMove, this), 3438 ke( 3439 document, 3440 "mouseup touchend touchcancel", 3441 this._onUp, 3442 this, 3443 ), 3444 ge(), 3445 Gt()); 3446 var e = this._moved && this._moving; 3447 ((this._moving = !1), 3448 ($e._dragging = !1), 3449 e && 3450 this.fire("dragend", { 3451 noInertia: t, 3452 distance: this._newPos.distanceTo(this._startPos), 3453 })); 3454 }, 3455 }); 3456 function Ke(t, e, i) { 3457 for ( 3458 var n, o, s, r, a, h, l, c = [1, 4, 2, 8], d = 0, u = t.length; 3459 d < u; 3460 d++ 3461 ) 3462 t[d]._code = ni(t[d], e); 3463 for (s = 0; s < 4; s++) { 3464 for ( 3465 h = c[s], n = [], d = 0, o = (u = t.length) - 1; 3466 d < u; 3467 o = d++ 3468 ) 3469 ((r = t[d]), 3470 (a = t[o]), 3471 r._code & h 3472 ? a._code & h || 3473 (((l = ii(a, r, h, e, i))._code = ni(l, e)), n.push(l)) 3474 : (a._code & h && 3475 (((l = ii(a, r, h, e, i))._code = ni(l, e)), n.push(l)), 3476 n.push(r))); 3477 t = n; 3478 } 3479 return t; 3480 } 3481 function Je(t, e) { 3482 var i, n, o, s, r, a, h; 3483 if (!t || 0 === t.length) throw new Error("latlngs not passed"); 3484 si(t) || 3485 (console.warn( 3486 "latlngs are not flat! Only the first ring will be used", 3487 ), 3488 (t = t[0])); 3489 for ( 3490 var l = N([0, 0]), 3491 c = R(t), 3492 d =
3493 (c.getNorthWest().distanceTo(c.getSouthWest()) * 3494 c.getNorthEast().distanceTo(c.getNorthWest()) < 3495 1700 && (l = Ye(t)), 3496 t.length), 3497 u = [], 3498 p = 0; 3499 p < d; 3500 p++ 3501 ) { 3502 var _ = N(t[p]); 3503 u.push(e.project(N([_.lat - l.lat, _.lng - l.lng]))); 3504 } 3505 for (p = r = a = h = 0, i = d - 1; p < d; i = p++) 3506 ((n = u[p]), 3507 (o = u[i]), 3508 (s = n.y * o.x - o.y * n.x), 3509 (a += (n.x + o.x) * s), 3510 (h += (n.y + o.y) * s), 3511 (r += 3 * s)); 3512 return ( 3513 (c = 0 === r ? u[0] : [a / r, h / r]), 3514 N([(c = e.unproject(A(c))).lat + l.lat, c.lng + l.lng]) 3515 ); 3516 } 3517 function Ye(t) { 3518 for (var e = 0, i = 0, n = 0, o = 0; o < t.length; o++) { 3519 var s = N(t[o]); 3520 ((e += s.lat), (i += s.lng), n++); 3521 } 3522 return N([e / n, i / n]); 3523 } 3524 function Xe(t, e) { 3525 if (e && t.length) { 3526 var i = (t = (function (t, e) { 3527 for (var i = [t[0]], n = 1, o = 0, s = t.length; n < s; n++) 3528 (function (t, e) { 3529 var i = e.x - t.x; 3530 return i * i + (e = e.y - t.y) * e; 3531 })(t[n], t[o]) > e && (i.push(t[n]), (o = n)); 3532 return (o < s - 1 && i.push(t[s - 1]), i); 3533 })(t, (e *= e))), 3534 n = i.length, 3535 o = new (typeof Uint8Array != void 0 + "" ? Uint8Array : Array)( 3536 n, 3537 ); 3538 ((o[0] = o[n - 1] = 1), 3539 (function t(e, i, n, o, s) { 3540 var r, 3541 a, 3542 h, 3543 l = 0; 3544 for (a = o + 1; a <= s - 1; a++) 3545 l < (h = oi(e[a], e[o], e[s], !0)) && ((r = a), (l = h)); 3546 n < l && ((i[r] = 1), t(e, i, n, o, r), t(e, i, n, r, s)); 3547 })(i, o, e, 0, n - 1)); 3548 var s, 3549 r = []; 3550 for (s = 0; s < n; s++) o[s] && r.push(i[s]); 3551 return r; 3552 } 3553 return t.slice(); 3554 } 3555 function ti(t, e, i) { 3556 return Math.sqrt(oi(t, e, i, !0)); 3557 } 3558 function ei(t, e, i, n, o) { 3559 var s, 3560 r, 3561 a, 3562 h = n ? Fe : ni(t, i), 3563 l = ni(e, i); 3564 for (Fe = l; ; ) { 3565 if (!(h | l)) return [t, e]; 3566 if (h & l) return !1; 3567 ((a = ni((r = ii(t, e, (s = h || l), i, o)), i)), 3568 s === h ? ((t = r), (h = a)) : ((e = r), (l = a))); 3569 } 3570 } 3571 function ii(t, e, i, n, o) { 3572 var s, 3573 r, 3574 a = e.x - t.x, 3575 h = ((e = e.y - t.y), n.min); 3576 return ( 3577 (n = n.max), 3578 8 & i 3579 ? ((s = t.x + (a * (n.y - t.y)) / e), (r = n.y)) 3580 : 4 & i 3581 ? ((s = t.x + (a * (h.y - t.y)) / e), (r = h.y)) 3582 : 2 & i 3583 ? ((s = n.x), (r = t.y + (e * (n.x - t.x)) / a)) 3584 : 1 & i && ((s = h.x), (r = t.y + (e * (h.x - t.x)) / a)), 3585 new j(s, r, o) 3586 ); 3587 } 3588 function ni(t, e) { 3589 var i = 0; 3590 return ( 3591 t.x < e.min.x ? (i |= 1) : t.x > e.max.x && (i |= 2), 3592 t.y < e.min.y ? (i |= 4) : t.y > e.max.y && (i |= 8), 3593 i 3594 ); 3595 } 3596 function oi(t, e, i, n) { 3597 var o = e.x, 3598 s = ((e = e.y), i.x - o), 3599 r = i.y - e, 3600 a = s * s + r * r; 3601 return ( 3602 0 < a && 3603 (1 < (a = ((t.x - o) * s + (t.y - e) * r) / a) 3604 ? ((o = i.x), (e = i.y)) 3605 : 0 < a && ((o += s * a), (e += r * a))), 3606 (s = t.x - o), 3607 (r = t.y - e), 3608 n ? s * s + r * r : new j(o, e) 3609 ); 3610 } 3611 function si(t) { 3612 return ( 3613 !g(t[0]) || ("object" != typeof t[0][0] && void 0 !== t[0][0]) 3614 ); 3615 } 3616 function ri(t) { 3617 return ( 3618 console.warn( 3619 "Deprecated use of _flat, please use L.LineUtil.isFlat instead.", 3620 ), 3621 si(t) 3622 ); 3623 } 3624 function ai(t, e) { 3625 var i, n, o, s, r, a; 3626 if (!t || 0 === t.length) throw new Error("latlngs not passed"); 3627 si(t) || 3628 (console.warn( 3629 "latlngs are not flat! Only the first ring will be used", 3630 ), 3631 (t = t[0])); 3632 for ( 3633 var h = N([0, 0]), 3634 l = R(t), 3635 c =
3636 (l.getNorthWest().distanceTo(l.getSouthWest()) * 3637 l.getNorthEast().distanceTo(l.getNorthWest()) < 3638 1700 && (h = Ye(t)), 3639 t.length), 3640 d = [], 3641 u = 0; 3642 u < c; 3643 u++ 3644 ) { 3645 var p = N(t[u]); 3646 d.push(e.project(N([p.lat - h.lat, p.lng - h.lng]))); 3647 } 3648 for (i = u = 0; u < c - 1; u++) i += d[u].distanceTo(d[u + 1]) / 2; 3649 if (0 === i) a = d[0]; 3650 else 3651 for (n = u = 0; u < c - 1; u++) 3652 if ( 3653 ((o = d[u]), (s = d[u + 1]), i < (n += r = o.distanceTo(s))) 3654 ) { 3655 a = [ 3656 s.x - (r = (n - i) / r) * (s.x - o.x), 3657 s.y - r * (s.y - o.y), 3658 ]; 3659 break; 3660 } 3661 return N([(l = e.unproject(A(a))).lat + h.lat, l.lng + h.lng]); 3662 } 3663 ((et = { 3664 __proto__: null, 3665 clipPolygon: Ke, 3666 polygonCenter: Je, 3667 centroid: Ye, 3668 }), 3669 (it = { 3670 __proto__: null, 3671 simplify: Xe, 3672 pointToSegmentDistance: ti, 3673 closestPointOnSegment: function (t, e, i) { 3674 return oi(t, e, i); 3675 }, 3676 clipSegment: ei, 3677 _getEdgeIntersection: ii, 3678 _getBitCode: ni, 3679 _sqClosestPointOnSegment: oi, 3680 isFlat: si, 3681 _flat: ri, 3682 polylineCenter: ai, 3683 }), 3684 (nt = { 3685 project: function (t) { 3686 return new j(t.lng, t.lat); 3687 }, 3688 unproject: function (t) { 3689 return new D(t.y, t.x); 3690 }, 3691 bounds: new B([-180, -90], [180, 90]), 3692 }), 3693 (ot = { 3694 R: 6378137, 3695 R_MINOR: 6356752.314245179, 3696 bounds: new B( 3697 [-20037508.34279, -15496570.73972], 3698 [20037508.34279, 18764656.23138], 3699 ), 3700 project: function (t) { 3701 var e = Math.PI / 180, 3702 i = this.R, 3703 n = t.lat * e, 3704 o = this.R_MINOR / i, 3705 s = (o = Math.sqrt(1 - o * o)) * Math.sin(n); 3706 return ( 3707 (s = 3708 Math.tan(Math.PI / 4 - n / 2) / 3709 Math.pow((1 - s) / (1 + s), o / 2)), 3710 (n = -i * Math.log(Math.max(s, 1e-10))), 3711 new j(t.lng * e * i, n) 3712 ); 3713 }, 3714 unproject: function (t) { 3715 for ( 3716 var e, 3717 i = 180 / Math.PI, 3718 n = this.R, 3719 o = this.R_MINOR / n, 3720 s = Math.sqrt(1 - o * o), 3721 r = Math.exp(-t.y / n), 3722 a = Math.PI / 2 - 2 * Math.atan(r), 3723 h = 0, 3724 l = 0.1; 3725 h < 15 && 1e-7 < Math.abs(l); 3726 h++ 3727 ) 3728 ((e = s * Math.sin(a)), 3729 (e = Math.pow((1 - e) / (1 + e), s / 2)), 3730 (a += l = Math.PI / 2 - 2 * Math.atan(r * e) - a)); 3731 return new D(a * i, (t.x * i) / n); 3732 }, 3733 }), 3734 (st = { 3735 __proto__: null, 3736 LonLat: nt, 3737 Mercator: ot, 3738 SphericalMercator: W, 3739 }), 3740 (at = e({}, F, { 3741 code: "EPSG:3395", 3742 projection: ot, 3743 transformation: H((rt = 0.5 / (Math.PI * ot.R)), 0.5, -rt, 0.5), 3744 }))); 3745 var hi = e({}, F, { 3746 code: "EPSG:4326", 3747 projection: nt, 3748 transformation: H(1 / 180, 1, -1 / 180, 0.5), 3749 }), 3750 li = 3751 ((ht = e({}, Q, { 3752 projection: nt, 3753 transformation: H(1, 0, -1, 0), 3754 scale: function (t) { 3755 return Math.pow(2, t); 3756 }, 3757 zoom: function (t) { 3758 return Math.log(t) / Math.LN2; 3759 }, 3760 distance: function (t, e) { 3761 var i = e.lng - t.lng; 3762 return ((e = e.lat - t.lat), Math.sqrt(i * i + e * e)); 3763 }, 3764 infinite: !0, 3765 })), 3766 (Q.Earth = F), 3767 (Q.EPSG3395 = at), 3768 (Q.EPSG3857 = U), 3769 (Q.EPSG900913 = G), 3770 (Q.EPSG4326 = hi), 3771 (Q.Simple = ht), 3772 (lt = I.extend({ 3773 options: { 3774 pane: "overlayPane", 3775 attribution: null, 3776 bubblingMouseEvents: !0, 3777 }, 3778 addTo: function (t) { 3779 return (t.addLayer(this), this); 3780 }, 3781 remove: function () { 3782 return this.removeFrom(this._map || this._mapToAdd); 3783 }, 3784 removeFrom: function (t) { 3785 return (t && t.removeLayer(this), this); 3786 }, 3787 getPane: function (t) { 3788 return this._map.getPane( 3789 t ? this.options[t] || t : this.options.pane, 3790 ); 3791 }, 3792 addInteractiveTarget: function (t) { 3793 return (this._map._targets[r(t)] = this); 3794 }, 3795 removeInteractiveTarget: function (t) { 3796 return (delete this._map._targets[r(t)], this); 3797 }, 3798 getAttribution: function () { 3799 return this.options.attribution; 3800 }, 3801 _layerAdd: function (t) { 3802 var e, 3803 i = t.target; 3804 i.hasLayer(this) && 3805 ((this._map = i), 3806 (this._zoomAnimated = i._zoomAnimated), 3807 this.getEvents && 3808 ((e = this.getEvents()), 3809 i.on(e, this), 3810 this.once( 3811 "remove", 3812 function () { 3813 i.off(e, this); 3814 }, 3815 this, 3816 )), 3817 this.onAdd(i), 3818 this.fire("add"), 3819 i.fire("layeradd", { layer: this })); 3820 }, 3821 })), 3822 Ne.include({ 3823 addLayer: function (t) { 3824 var e; 3825 if (t._layerAdd) 3826 return ( 3827 (e = r(t)), 3828 this._layers[e] || 3829 (((this._layers[e] = t)._mapToAdd = this), 3830 t.beforeAdd && t.beforeAdd(this), 3831 this.whenReady(t._layerAdd, t)), 3832 this 3833 ); 3834 throw new Error("The provided object is not a Layer."); 3835 }, 3836 removeLayer: function (t) { 3837 var e = r(t); 3838 return ( 3839 this._layers[e] && 3840 (this._loaded && t.onRemove(this), 3841 delete this._layers[e], 3842 this._loaded && 3843 (this.fire("layerremove", { layer: t }), 3844 t.fire("remove")), 3845 (t._map = t._mapToAdd = null)), 3846 this 3847 ); 3848 }, 3849 hasLayer: function (t) { 3850 return r(t) in this._layers; 3851 }, 3852 eachLayer: function (t, e) { 3853 for (var i in this._layers) t.call(e, this._layers[i]); 3854 return this; 3855 }, 3856 _addLayers: function (t) { 3857 for ( 3858 var e = 0, i = (t = t ? (g(t) ? t : [t]) : []).length; 3859 e < i; 3860 e++ 3861 ) 3862 this.addLayer(t[e]); 3863 },
3864 _addZoomLimit: function (t) { 3865 (isNaN(t.options.maxZoom) && isNaN(t.options.minZoom)) || 3866 ((this._zoomBoundLayers[r(t)] = t), 3867 this._updateZoomLevels()); 3868 }, 3869 _removeZoomLimit: function (t) { 3870 ((t = r(t)), 3871 this._zoomBoundLayers[t] && 3872 (delete this._zoomBoundLayers[t], 3873 this._updateZoomLevels())); 3874 }, 3875 _updateZoomLevels: function () { 3876 var t, 3877 e = 1 / 0, 3878 i = -1 / 0, 3879 n = this._getZoomSpan(); 3880 for (t in this._zoomBoundLayers) { 3881 var o = this._zoomBoundLayers[t].options; 3882 ((e = void 0 === o.minZoom ? e : Math.min(e, o.minZoom)), 3883 (i = void 0 === o.maxZoom ? i : Math.max(i, o.maxZoom))); 3884 } 3885 ((this._layersMaxZoom = i === -1 / 0 ? void 0 : i), 3886 (this._layersMinZoom = e === 1 / 0 ? void 0 : e), 3887 n !== this._getZoomSpan() && this.fire("zoomlevelschange"), 3888 void 0 === this.options.maxZoom && 3889 this._layersMaxZoom && 3890 this.getZoom() > this._layersMaxZoom && 3891 this.setZoom(this._layersMaxZoom), 3892 void 0 === this.options.minZoom && 3893 this._layersMinZoom && 3894 this.getZoom() < this._layersMinZoom && 3895 this.setZoom(this._layersMinZoom)); 3896 }, 3897 }), 3898 lt.extend({ 3899 initialize: function (t, e) { 3900 var i, n; 3901 if ((p(this, e), (this._layers = {}), t)) 3902 for (i = 0, n = t.length; i < n; i++) this.addLayer(t[i]); 3903 }, 3904 addLayer: function (t) { 3905 var e = this.getLayerId(t); 3906 return ( 3907 (this._layers[e] = t), 3908 this._map && this._map.addLayer(t), 3909 this 3910 ); 3911 }, 3912 removeLayer: function (t) { 3913 return ( 3914 (t = t in this._layers ? t : this.getLayerId(t)), 3915 this._map && 3916 this._layers[t] && 3917 this._map.removeLayer(this._layers[t]), 3918 delete this._layers[t], 3919 this 3920 ); 3921 }, 3922 hasLayer: function (t) { 3923 return ( 3924 ("number" == typeof t ? t : this.getLayerId(t)) in 3925 this._layers 3926 ); 3927 }, 3928 clearLayers: function () { 3929 return this.eachLayer(this.removeLayer, this); 3930 }, 3931 invoke: function (t) { 3932 var e, 3933 i, 3934 n = Array.prototype.slice.call(arguments, 1); 3935 for (e in this._layers) 3936 (i = this._layers[e])[t] && i[t].apply(i, n); 3937 return this; 3938 }, 3939 onAdd: function (t) { 3940 this.eachLayer(t.addLayer, t); 3941 }, 3942 onRemove: function (t) { 3943 this.eachLayer(t.removeLayer, t); 3944 }, 3945 eachLayer: function (t, e) { 3946 for (var i in this._layers) t.call(e, this._layers[i]); 3947 return this; 3948 }, 3949 getLayer: function (t) { 3950 return this._layers[t]; 3951 }, 3952 getLayers: function () { 3953 var t = []; 3954 return (this.eachLayer(t.push, t), t); 3955 }, 3956 setZIndex: function (t) { 3957 return this.invoke("setZIndex", t); 3958 }, 3959 getLayerId: r, 3960 })), 3961 ci = li.extend({ 3962 addLayer: function (t) { 3963 return this.hasLayer(t) 3964 ? this 3965 : (t.addEventParent(this), 3966 li.prototype.addLayer.call(this, t), 3967 this.fire("layeradd", { layer: t })); 3968 }, 3969 removeLayer: function (t) { 3970 return this.hasLayer(t) 3971 ? ((t = 3972 t in this._layers 3973 ? this._layers[t] 3974 : t).removeEventParent(this), 3975 li.prototype.removeLayer.call(this, t), 3976 this.fire("layerremove", { layer: t })) 3977 : this; 3978 }, 3979 setStyle: function (t) { 3980 return this.invoke("setStyle", t); 3981 }, 3982 bringToFront: function () { 3983 return this.invoke("bringToFront"); 3984 }, 3985 bringToBack: function () { 3986 return this.invoke("bringToBack"); 3987 }, 3988 getBounds: function () { 3989 var t, 3990 e = new O(); 3991 for (t in this._layers) { 3992 var i = this._layers[t]; 3993 e.extend(i.getBounds ? i.getBounds() : i.getLatLng()); 3994 } 3995 return e; 3996 }, 3997 }), 3998 di = S.extend({ 3999 options: { 4000 popupAnchor: [0, 0], 4001 tooltipAnchor: [0, 0], 4002 crossOrigin: !1, 4003 }, 4004 initialize: function (t) { 4005 p(this, t); 4006 }, 4007 createIcon: function (t) { 4008 return this._createIcon("icon", t); 4009 }, 4010 createShadow: function (t) { 4011 return this._createIcon("shadow", t); 4012 }, 4013 _createIcon: function (t, e) { 4014 var i = this._getIconUrl(t); 4015 if (i) 4016 return ( 4017 (i = this._createImg( 4018 i, 4019 e && "IMG" === e.tagName ? e : null, 4020 )), 4021 this._setIconStyles(i, t), 4022 (!this.options.crossOrigin && 4023 "" !== this.options.crossOrigin) || 4024 (i.crossOrigin = 4025 !0 === this.options.crossOrigin 4026 ? "" 4027 : this.options.crossOrigin), 4028 i 4029 ); 4030 if ("icon" === t) 4031 throw new Error( 4032 "iconUrl not set in Icon options (see the docs).", 4033 ); 4034 return null; 4035 }, 4036 _setIconStyles: function (t, e) { 4037 var i = this.options, 4038 n = A( 4039 (n = "number" == typeof (n = i[e + "Size"]) ? [n, n] : n), 4040 ), 4041 o = A( 4042 ("shadow" === e && i.shadowAnchor) || 4043 i.iconAnchor || 4044 (n && n.divideBy(2, !0)), 4045 ); 4046 ((t.className = 4047 "leaflet-marker-" + e + " " + (i.className || "")), 4048 o && 4049 ((t.style.marginLeft = -o.x + "px"), 4050 (t.style.marginTop = -o.y + "px")), 4051 n && 4052 ((t.style.width = n.x + "px"), 4053 (t.style.height = n.y + "px"))); 4054 }, 4055 _createImg: function (t, e) { 4056 return (((e = e || document.createElement("img")).src = t), e); 4057 }, 4058 _getIconUrl: function (t) { 4059 return ( 4060 (zt.retina && this.options[t + "RetinaUrl"]) || 4061 this.options[t + "Url"] 4062 ); 4063 }, 4064 }), 4065 ui = di.extend({ 4066 options: { 4067 iconUrl: "marker-icon.png", 4068 iconRetinaUrl: "marker-icon-2x.png", 4069 shadowUrl: "marker-shadow.png", 4070 iconSize: [25, 41], 4071 iconAnchor: [12, 41], 4072 popupAnchor: [1, -34], 4073 tooltipAnchor: [16, -28], 4074 shadowSize: [41, 41], 4075 }, 4076 _getIconUrl: function (t) { 4077 return ( 4078 "string" != typeof ui.imagePath && 4079 (ui.imagePath = this._detectIconPath()), 4080 (this.options.imagePath || ui.imagePath) + 4081 di.prototype._getIconUrl.call(this, t) 4082 ); 4083 }, 4084 _stripUrl: function (t) { 4085 function e(t, e, i) { 4086 return (e = e.exec(t)) && e[i]; 4087 } 4088 return ( 4089 (t = e(t, /^url\((['"])?(.+)\1\)$/, 2)) && 4090 e(t, /^(.*)marker-icon\.png$/, 1) 4091 ); 4092 }, 4093 _detectIconPath: function () { 4094 var t = ee("div", "leaflet-default-icon-path", document.body), 4095 e = te(t, "background-image") || te(t, "backgroundImage"); 4096 return ( 4097 document.body.removeChild(t), 4098 (e = this._stripUrl(e)) 4099 ? e 4100 : (t = document.querySelector('link[href$="leaflet.css"]')) 4101 ? t.href.substring(0, t.href.length - 11 - 1) 4102 : "" 4103 ); 4104 }, 4105 }), 4106 pi = X.extend({ 4107 initialize: function (t) { 4108 this._marker = t; 4109 }, 4110 addHooks: function () { 4111 var t = this._marker._icon; 4112 (this._draggable || (this._draggable = new $e(t, t, !0)), 4113 this._draggable 4114 .on( 4115 { 4116 dragstart: this._onDragStart, 4117 predrag: this._onPreDrag, 4118 drag: this._onDrag, 4119 dragend: this._onDragEnd, 4120 }, 4121 this, 4122 ) 4123 .enable(), 4124 ae(t, "leaflet-marker-draggable")); 4125 }, 4126 removeHooks: function () { 4127 (this._draggable 4128 .off( 4129 { 4130 dragstart: this._onDragStart, 4131 predrag: this._onPreDrag, 4132 drag: this._onDrag, 4133 dragend: this._onDragEnd, 4134 }, 4135 this, 4136 ) 4137 .disable(), 4138 this._marker._icon && 4139 he(this._marker._icon, "leaflet-marker-draggable")); 4140 }, 4141 moved: function () { 4142 return this._draggable && this._draggable._moved; 4143 }, 4144 _adjustPan: function (t) { 4145 var e = this._marker, 4146 i = e._map, 4147 n = this._marker.options.autoPanSpeed, 4148 o = this._marker.options.autoPanPadding, 4149 s = me(e._icon), 4150 r = i.getPixelBounds(), 4151 a = i.getPixelOrigin(); 4152 (a = Z( 4153 r.min._subtract(a).add(o), 4154 r.max._subtract(a).subtract(o), 4155 )).contains(s) || 4156 ((o = A( 4157 (Math.max(a.max.x, s.x) - a.max.x) / (r.max.x - a.max.x) - 4158 (Math.min(a.min.x, s.x) - a.min.x) / (r.min.x - a.min.x), 4159 (Math.max(a.max.y, s.y) - a.max.y) / (r.max.y - a.max.y) - 4160 (Math.min(a.min.y, s.y) - a.min.y) / (r.min.y - a.min.y), 4161 ).multiplyBy(n)), 4162 i.panBy(o, { animate: !1 }), 4163 this._draggable._newPos._add(o), 4164 this._draggable._startPos._add(o), 4165 _e(e._icon, this._draggable._newPos), 4166 this._onDrag(t), 4167 (this._panRequest = C(this._adjustPan.bind(this, t)))
4167); 4168 }, 4169 _onDragStart: function () { 4170 ((this._oldLatLng = this._marker.getLatLng()), 4171 this._marker.closePopup && this._marker.closePopup(), 4172 this._marker.fire("movestart").fire("dragstart")); 4173 }, 4174 _onPreDrag: function (t) { 4175 this._marker.options.autoPan && 4176 (T(this._panRequest), 4177 (this._panRequest = C(this._adjustPan.bind(this, t)))); 4178 }, 4179 _onDrag: function (t) { 4180 var e = this._marker, 4181 i = e._shadow, 4182 n = me(e._icon), 4183 o = e._map.layerPointToLatLng(n); 4184 (i && _e(i, n), 4185 (e._latlng = o), 4186 (t.latlng = o), 4187 (t.oldLatLng = this._oldLatLng), 4188 e.fire("move", t).fire("drag", t)); 4189 }, 4190 _onDragEnd: function (t) { 4191 (T(this._panRequest), 4192 delete this._oldLatLng, 4193 this._marker.fire("moveend").fire("dragend", t)); 4194 }, 4195 }), 4196 _i = lt.extend({ 4197 options: { 4198 icon: new ui(), 4199 interactive: !0, 4200 keyboard: !0, 4201 title: "", 4202 alt: "Marker", 4203 zIndexOffset: 0, 4204 opacity: 1, 4205 riseOnHover: !1, 4206 riseOffset: 250, 4207 pane: "markerPane", 4208 shadowPane: "shadowPane", 4209 bubblingMouseEvents: !1, 4210 autoPanOnFocus: !0, 4211 draggable: !1, 4212 autoPan: !1, 4213 autoPanPadding: [50, 50], 4214 autoPanSpeed: 10, 4215 }, 4216 initialize: function (t, e) { 4217 (p(this, e), (this._latlng = N(t))); 4218 }, 4219 onAdd: function (t) { 4220 ((this._zoomAnimated = 4221 this._zoomAnimated && t.options.markerZoomAnimation), 4222 this._zoomAnimated && 4223 t.on("zoomanim", this._animateZoom, this), 4224 this._initIcon(), 4225 this.update()); 4226 }, 4227 onRemove: function (t) { 4228 (this.dragging && 4229 this.dragging.enabled() && 4230 ((this.options.draggable = !0), this.dragging.removeHooks()), 4231 delete this.dragging, 4232 this._zoomAnimated && 4233 t.off("zoomanim", this._animateZoom, this), 4234 this._removeIcon(), 4235 this._removeShadow()); 4236 }, 4237 getEvents: function () { 4238 return { zoom: this.update, viewreset: this.update }; 4239 }, 4240 getLatLng: function () { 4241 return this._latlng; 4242 }, 4243 setLatLng: function (t) { 4244 var e = this._latlng; 4245 return ( 4246 (this._latlng = N(t)), 4247 this.update(), 4248 this.fire("move", { oldLatLng: e, latlng: this._latlng }) 4249 ); 4250 }, 4251 setZIndexOffset: function (t) { 4252 return ((this.options.zIndexOffset = t), this.update()); 4253 }, 4254 getIcon: function () { 4255 return this.options.icon; 4256 }, 4257 setIcon: function (t) { 4258 return ( 4259 (this.options.icon = t), 4260 this._map && (this._initIcon(), this.update()), 4261 this._popup && 4262 this.bindPopup(this._popup, this._popup.options), 4263 this 4264 ); 4265 }, 4266 getElement: function () { 4267 return this._icon; 4268 }, 4269 update: function () { 4270 var t; 4271 return ( 4272 this._icon && 4273 this._map && 4274 ((t = this._map.latLngToLayerPoint(this._latlng).round()), 4275 this._setPos(t)), 4276 this 4277 ); 4278 }, 4279 _initIcon: function () { 4280 var t, 4281 e = this.options, 4282 i = 4283 "leaflet-zoom-" + 4284 (this._zoomAnimated ? "animated" : "hide"), 4285 n = !1, 4286 o = !1; 4287 ((t = e.icon.createIcon(this._icon)) !== this._icon && 4288 (this._icon && this._removeIcon(), 4289 (n = !0), 4290 e.title && (t.title = e.title), 4291 "IMG" === t.tagName && (t.alt = e.alt || "")), 4292 ae(t, i), 4293 e.keyboard && 4294 ((t.tabIndex = "0"), t.setAttribute("role", "button")), 4295 (this._icon = t), 4296 e.riseOnHover && 4297 this.on({ 4298 mouseover: this._bringToFront, 4299 mouseout: this._resetZIndex, 4300 }), 4301 this.options.autoPanOnFocus && 4302 Pe(t, "focus", this._panOnFocus, this), 4303 (t = e.icon.createShadow(this._shadow)) !== this._shadow && 4304 (this._removeShadow(), (o = !0)), 4305 t && (ae(t, i), (t.alt = "")), 4306 (this._shadow = t), 4307 e.opacity < 1 && this._updateOpacity(), 4308 n && this.getPane().appendChild(this._icon), 4309 this._initInteraction(), 4310 t && 4311 o && 4312 this.getPane(e.shadowPane).appendChild(this._shadow)); 4313 }, 4314 _removeIcon: function () { 4315 (this.options.riseOnHover && 4316 this.off({ 4317 mouseover: this._bringToFront, 4318 mouseout: this._resetZIndex, 4319 }), 4320 this.options.autoPanOnFocus && 4321 ke(this._icon, "focus", this._panOnFocus, this), 4322 ie(this._icon), 4323 this.removeInteractiveTarget(this._icon), 4324 (this._icon = null)); 4325 }, 4326 _removeShadow: function () { 4327 (this._shadow && ie(this._shadow), (this._shadow = null)); 4328 }, 4329 _setPos: function (t) { 4330 (this._icon && _e(this._icon, t), 4331 this._shadow && _e(this._shadow, t),
4332 (this._zIndex = t.y + this.options.zIndexOffset), 4333 this._resetZIndex()); 4334 }, 4335 _updateZIndex: function (t) { 4336 this._icon && (this._icon.style.zIndex = this._zIndex + t); 4337 }, 4338 _animateZoom: function (t) { 4339 ((t = this._map 4340 ._latLngToNewLayerPoint(this._latlng, t.zoom, t.center) 4341 .round()), 4342 this._setPos(t)); 4343 }, 4344 _initInteraction: function () { 4345 var t; 4346 this.options.interactive && 4347 (ae(this._icon, "leaflet-interactive"), 4348 this.addInteractiveTarget(this._icon), 4349 pi && 4350 ((t = this.options.draggable), 4351 this.dragging && 4352 ((t = this.dragging.enabled()), this.dragging.disable()), 4353 (this.dragging = new pi(this)), 4354 t && this.dragging.enable())); 4355 }, 4356 setOpacity: function (t) { 4357 return ( 4358 (this.options.opacity = t), 4359 this._map && this._updateOpacity(), 4360 this 4361 ); 4362 }, 4363 _updateOpacity: function () { 4364 var t = this.options.opacity; 4365 (this._icon && de(this._icon, t), 4366 this._shadow && de(this._shadow, t)); 4367 }, 4368 _bringToFront: function () { 4369 this._updateZIndex(this.options.riseOffset); 4370 }, 4371 _resetZIndex: function () { 4372 this._updateZIndex(0); 4373 }, 4374 _panOnFocus: function () { 4375 var t, 4376 e, 4377 i = this._map; 4378 i && 4379 ((t = (e = this.options.icon.options).iconSize 4380 ? A(e.iconSize) 4381 : A(0, 0)), 4382 (e = e.iconAnchor ? A(e.iconAnchor) : A(0, 0)), 4383 i.panInside(this._latlng, { 4384 paddingTopLeft: e, 4385 paddingBottomRight: t.subtract(e), 4386 })); 4387 }, 4388 _getPopupAnchor: function () { 4389 return this.options.icon.options.popupAnchor; 4390 }, 4391 _getTooltipAnchor: function () { 4392 return this.options.icon.options.tooltipAnchor; 4393 }, 4394 }), 4395 mi = lt.extend({ 4396 options: { 4397 stroke: !0, 4398 color: "#3388ff", 4399 weight: 3, 4400 opacity: 1, 4401 lineCap: "round", 4402 lineJoin: "round", 4403 dashArray: null, 4404 dashOffset: null, 4405 fill: !1, 4406 fillColor: null, 4407 fillOpacity: 0.2, 4408 fillRule: "evenodd", 4409 interactive: !0, 4410 bubblingMouseEvents: !0, 4411 }, 4412 beforeAdd: function (t) { 4413 this._renderer = t.getRenderer(this); 4414 }, 4415 onAdd: function () { 4416 (this._renderer._initPath(this), 4417 this._reset(), 4418 this._renderer._addPath(this)); 4419 }, 4420 onRemove: function () { 4421 this._renderer._removePath(this); 4422 }, 4423 redraw: function () { 4424 return (this._map && this._renderer._updatePath(this), this); 4425 }, 4426 setStyle: function (t) { 4427 return ( 4428 p(this, t), 4429 this._renderer && 4430 (this._renderer._updateStyle(this), 4431 this.options.stroke && 4432 t && 4433 Object.prototype.hasOwnProperty.call(t, "weight") && 4434 this._updateBounds()), 4435 this 4436 ); 4437 }, 4438 bringToFront: function () { 4439 return ( 4440 this._renderer && this._renderer._bringToFront(this), 4441 this 4442 ); 4443 }, 4444 bringToBack: function () { 4445 return ( 4446 this._renderer && this._renderer._bringToBack(this), 4447 this 4448 ); 4449 }, 4450 getElement: function () { 4451 return this._path; 4452 }, 4453 _reset: function () { 4454 (this._project(), this._update()); 4455 }, 4456 _clickTolerance: function () { 4457 return ( 4458 (this.options.stroke ? this.options.weight / 2 : 0) + 4459 (this._renderer.options.tolerance || 0) 4460 ); 4461 }, 4462 }), 4463 fi = mi.extend({ 4464 options: { fill: !0, radius: 10 }, 4465 initialize: function (t, e) { 4466 (p(this, e), 4467 (this._latlng = N(t)), 4468 (this._radius = this.options.radius)); 4469 }, 4470 setLatLng: function (t) { 4471 var e = this._latlng; 4472 return ( 4473 (this._latlng = N(t)), 4474 this.redraw(), 4475 this.fire("move", { oldLatLng: e, latlng: this._latlng }) 4476 ); 4477 }, 4478 getLatLng: function () { 4479 return this._latlng; 4480 }, 4481 setRadius: function (t) { 4482 return ( 4483 (this.options.radius = this._radius = t), 4484 this.redraw() 4485 ); 4486 }, 4487 getRadius: function () { 4488 return this._radius; 4489 }, 4490 setStyle: function (t) {
4491 var e = (t && t.radius) || this._radius; 4492 return ( 4493 mi.prototype.setStyle.call(this, t), 4494 this.setRadius(e), 4495 this 4496 ); 4497 }, 4498 _project: function () { 4499 ((this._point = this._map.latLngToLayerPoint(this._latlng)), 4500 this._updateBounds()); 4501 }, 4502 _updateBounds: function () { 4503 var t = this._radius, 4504 e = this._radiusY || t, 4505 i = this._clickTolerance(); 4506 ((t = [t + i, e + i]), 4507 (this._pxBounds = new B( 4508 this._point.subtract(t), 4509 this._point.add(t), 4510 ))); 4511 }, 4512 _update: function () { 4513 this._map && this._updatePath(); 4514 }, 4515 _updatePath: function () { 4516 this._renderer._updateCircle(this); 4517 }, 4518 _empty: function () { 4519 return ( 4520 this._radius && 4521 !this._renderer._bounds.intersects(this._pxBounds) 4522 ); 4523 }, 4524 _containsPoint: function (t) { 4525 return ( 4526 t.distanceTo(this._point) <= 4527 this._radius + this._clickTolerance() 4528 ); 4529 }, 4530 }), 4531 gi = fi.extend({ 4532 initialize: function (t, i, n) { 4533 if ( 4534 (p( 4535 this, 4536 (i = "number" == typeof i ? e({}, n, { radius: i }) : i), 4537 ), 4538 (this._latlng = N(t)), 4539 isNaN(this.options.radius)) 4540 ) 4541 throw new Error("Circle radius cannot be NaN"); 4542 this._mRadius = this.options.radius; 4543 }, 4544 setRadius: function (t) { 4545 return ((this._mRadius = t), this.redraw()); 4546 }, 4547 getRadius: function () { 4548 return this._mRadius; 4549 }, 4550 getBounds: function () { 4551 var t = [this._radius, this._radiusY || this._radius]; 4552 return new O( 4553 this._map.layerPointToLatLng(this._point.subtract(t)), 4554 this._map.layerPointToLatLng(this._point.add(t)), 4555 ); 4556 }, 4557 setStyle: mi.prototype.setStyle, 4558 _project: function () { 4559 var t, 4560 e, 4561 i, 4562 n, 4563 o, 4564 s = this._latlng.lng, 4565 r = this._latlng.lat, 4566 a = this._map, 4567 h = a.options.crs; 4568 (h.distance === F.distance 4569 ? ((n = Math.PI / 180), 4570 (o = this._mRadius / F.R / n), 4571 (t = a.project([r + o, s])), 4572 (e = a.project([r - o, s])), 4573 (e = t.add(e).divideBy(2)), 4574 (i = a.unproject(e).lat), 4575 (n = 4576 Math.acos( 4577 (Math.cos(o * n) - Math.sin(r * n) * Math.sin(i * n)) / 4578 (Math.cos(r * n) * Math.cos(i * n)), 4579 ) / n), 4580 (!isNaN(n) && 0 !== n) || 4581 (n = o / Math.cos((Math.PI / 180) * r)), 4582 (this._point = e.subtract(a.getPixelOrigin())), 4583 (this._radius = isNaN(n) 4584 ? 0 4585 : e.x - a.project([i, s - n]).x), 4586 (this._radiusY = e.y - t.y)) 4587 : ((o = h.unproject( 4588 h.project(this._latlng).subtract([this._mRadius, 0]), 4589 )), 4590 (this._point = a.latLngToLayerPoint(this._latlng)), 4591 (this._radius = this._point.x - a.latLngToLayerPoint(o).x)), 4592 this._updateBounds()); 4593 }, 4594 }), 4595 yi = mi.extend({ 4596 options: { smoothFactor: 1, noClip: !1 }, 4597 initialize: function (t, e) { 4598 (p(this, e), this._setLatLngs(t)); 4599 }, 4600 getLatLngs: function () { 4601 return this._latlngs; 4602 }, 4603 setLatLngs: function (t) { 4604 return (this._setLatLngs(t), this.redraw()); 4605 }, 4606 isEmpty: function () { 4607 return !this._latlngs.length; 4608 }, 4609 closestLayerPoint: function (t) { 4610 for ( 4611 var e = 1 / 0, 4612 i = null, 4613 n = oi, 4614 o = 0, 4615 s = this._parts.length; 4616 o < s; 4617 o++ 4618 ) 4619 for ( 4620 var r = this._parts[o], a = 1, h = r.length; 4621 a < h; 4622 a++ 4623 ) { 4624 var l, 4625 c, 4626 d = n(t, (l = r[a - 1]), (c = r[a]), !0); 4627 d < e && ((e = d), (i = n(t, l, c))); 4628 } 4629 return (i && (i.distance = Math.sqrt(e)), i); 4630 }, 4631 getCenter: function () { 4632 if (this._map) 4633 return ai(this._defaultShape(), this._map.options.crs); 4634 throw new Error( 4635 "Must add layer to map before using getCenter()", 4636 ); 4637 }, 4638 getBounds: function () { 4639 return this._bounds; 4640 }, 4641 addLatLng: function (t, e) { 4642 return ( 4643 (e = e || this._defaultShape()), 4644 (t = N(t)), 4645 e.push(t), 4646 this._bounds.extend(t), 4647 this.redraw() 4648 ); 4649 }, 4650 _setLatLngs: function (t) { 4651 ((this._bounds = new O()), 4652 (this._latlngs = this._convertLatLngs(t))); 4653 }, 4654 _defaultShape: function () { 4655 return si(this._latlngs) ? this._latlngs : this._latlngs[0]; 4656 }, 4657 _convertLatLngs: function (t) { 4658 for (var e = [], i = si(t), n = 0, o = t.length; n < o; n++) 4659 i 4660 ? ((e[n] = N(t[n])), this._bounds.extend(e[n])) 4661 : (e[n] = this._convertLatLngs(t[n])); 4662 return e; 4663 }, 4664 _project: function () { 4665 var t = new B(); 4666 ((this._rings = []), 4667 this._projectLatlngs(this._latlngs, this._rings, t), 4668 this._bounds.isValid() && 4669 t.isValid() && 4670 ((this._rawPxBounds = t), this._updateBounds())); 4671 }, 4672 _updateBounds: function () { 4673 var t = new j((t = this._clickTolerance()), t); 4674 this._rawPxBounds && 4675 (this._pxBounds = new B([ 4676 this._rawPxBounds.min.subtract(t), 4677 this._rawPxBounds.max.add(t), 4678 ])); 4679 }, 4680 _projectLatlngs: function (t, e, i) { 4681 var n, 4682 o, 4683 s = t[0] instanceof D, 4684 r = t.length; 4685 if (s) { 4686 for (o = [], n = 0; n < r; n++) 4687 ((o[n] = this._map.latLngToLayerPoint(t[n])), 4688 i.extend(o[n])); 4689 e.push(o); 4690 } else for (n = 0; n < r; n++) this._projectLatlngs(t[n], e, i); 4691 }, 4692 _clipPoints: function () { 4693 var t = this._renderer._bounds; 4694 if ( 4695 ((this._parts = []), 4696 this._pxBounds && this._pxBounds.intersects(t)) 4697 ) 4698 if (this.options.noClip) this._parts = this._rings; 4699 else 4700 for ( 4701 var e, 4702 i, 4703 n, 4704 o, 4705 s = this._parts, 4706 r = 0, 4707 a = 0, 4708 h = this._rings.length; 4709 r < h; 4710 r++ 4711 ) 4712 for ( 4713 e = 0, i = (o = this._rings[r]).length; 4714 e < i - 1; 4715 e++ 4716 ) 4717 (n = ei(o[e], o[e + 1], t, e, !0)) && 4718 ((s[a] = s[a] || []), 4719 s[a].push(n[0]), 4720 (n[1] === o[e + 1] && e !== i - 2) || 4721 (s[a].push(n[1]), a++)); 4722 }, 4723 _simplifyPoints: function () { 4724 for ( 4725 var t = this._parts, 4726 e = this.options.smoothFactor, 4727 i = 0, 4728 n = t.length; 4729 i < n; 4730 i++ 4731 ) 4732 t[i] = Xe(t[i], e); 4733 }, 4734 _update: function () { 4735 this._map && 4736 (this._clipPoints(), 4737 this._simplifyPoints(), 4738 this._updatePath()); 4739 }, 4740 _updatePath: function () { 4741 this._renderer._updatePoly(this); 4742 }, 4743 _containsPoint: function (t, e) { 4744 var i, 4745 n, 4746 o, 4747 s, 4748 r, 4749 a, 4750 h = this._clickTolerance(); 4751 if (this._pxBounds && this._pxBounds.contains(t)) 4752 for (i = 0, s = this._parts.length; i < s; i++) 4753 for ( 4754 n = 0, o = (r = (a = this._parts[i]).length) - 1; 4755 n < r; 4756 o = n++ 4757 ) 4758 if ((e || 0 !== n) && ti(t, a[o], a[n]) <= h) return !0; 4759 return !1; 4760 }, 4761 }); 4762 yi._flat = ri; 4763 var vi = yi.extend({ 4764 options: { fill: !0 },
4765 isEmpty: function () { 4766 return !this._latlngs.length || !this._latlngs[0].length; 4767 }, 4768 getCenter: function () { 4769 if (this._map) 4770 return Je(this._defaultShape(), this._map.options.crs); 4771 throw new Error( 4772 "Must add layer to map before using getCenter()", 4773 ); 4774 }, 4775 _convertLatLngs: function (t) { 4776 var e = (t = yi.prototype._convertLatLngs.call(this, t)).length; 4777 return ( 4778 2 <= e && 4779 t[0] instanceof D && 4780 t[0].equals(t[e - 1]) && 4781 t.pop(), 4782 t 4783 ); 4784 }, 4785 _setLatLngs: function (t) { 4786 (yi.prototype._setLatLngs.call(this, t), 4787 si(this._latlngs) && (this._latlngs = [this._latlngs])); 4788 }, 4789 _defaultShape: function () { 4790 return ( 4791 si(this._latlngs[0]) ? this._latlngs : this._latlngs[0] 4792 )[0]; 4793 }, 4794 _clipPoints: function () { 4795 var t = this._renderer._bounds, 4796 e = new j((e = this.options.weight), e); 4797 if ( 4798 ((t = new B(t.min.subtract(e), t.max.add(e))), 4799 (this._parts = []), 4800 this._pxBounds && this._pxBounds.intersects(t)) 4801 ) 4802 if (this.options.noClip) this._parts = this._rings; 4803 else 4804 for (var i, n = 0, o = this._rings.length; n < o; n++) 4805 (i = Ke(this._rings[n], t, !0)).length && 4806 this._parts.push(i); 4807 }, 4808 _updatePath: function () { 4809 this._renderer._updatePoly(this, !0); 4810 }, 4811 _containsPoint: function (t) { 4812 var e, 4813 i, 4814 n, 4815 o, 4816 s, 4817 r, 4818 a, 4819 h, 4820 l = !1; 4821 if (!this._pxBounds || !this._pxBounds.contains(t)) return !1; 4822 for (o = 0, a = this._parts.length; o < a; o++) 4823 for ( 4824 s = 0, r = (h = (e = this._parts[o]).length) - 1; 4825 s < h; 4826 r = s++ 4827 ) 4828 ((i = e[s]), 4829 (n = e[r]), 4830 i.y > t.y != n.y > t.y && 4831 t.x < ((n.x - i.x) * (t.y - i.y)) / (n.y - i.y) + i.x && 4832 (l = !l)); 4833 return l || yi.prototype._containsPoint.call(this, t, !0); 4834 }, 4835 }), 4836 wi = ci.extend({ 4837 initialize: function (t, e) { 4838 (p(this, e), (this._layers = {}), t && this.addData(t)); 4839 }, 4840 addData: function (t) { 4841 var e, 4842 i, 4843 n, 4844 o = g(t) ? t : t.features; 4845 if (o) { 4846 for (e = 0, i = o.length; e < i; e++) 4847 ((n = o[e]).geometries || 4848 n.geometry || 4849 n.features || 4850 n.coordinates) && 4851 this.addData(n); 4852 return this; 4853 } 4854 var s, 4855 r = this.options; 4856 return (r.filter && !r.filter(t)) || !(s = xi(t, r)) 4857 ? this 4858 : ((s.feature = zi(t)), 4859 (s.defaultOptions = s.options), 4860 this.resetStyle(s), 4861 r.onEachFeature && r.onEachFeature(t, s), 4862 this.addLayer(s)); 4863 }, 4864 resetStyle: function (t) { 4865 return void 0 === t 4866 ? this.eachLayer(this.resetStyle, this) 4867 : ((t.options = e({}, t.defaultOptions)), 4868 this._setLayerStyle(t, this.options.style), 4869 this); 4870 }, 4871 setStyle: function (t) { 4872 return this.eachLayer(function (e) { 4873 this._setLayerStyle(e, t); 4874 }, this); 4875 }, 4876 _setLayerStyle: function (t, e) { 4877 t.setStyle && 4878 ("function" == typeof e && (e = e(t.feature)), t.setStyle(e)); 4879 }, 4880 }); 4881 function xi(t, e) { 4882 var i, 4883 n, 4884 o, 4885 s, 4886 r = "Feature" === t.type ? t.geometry : t, 4887 a = r ? r.coordinates : null, 4888 h = [], 4889 l = e && e.pointToLayer, 4890 c = (e && e.coordsToLatLng) || bi; 4891 if (!a && !r) return null; 4892 switch (r.type) { 4893 case "Point": 4894 return Pi(l, t, (i = c(a)), e); 4895 case "MultiPoint": 4896 for (o = 0, s = a.length; o < s; o++) 4897 ((i = c(a[o])), h.push(Pi(l, t, i, e))); 4898 return new ci(h); 4899 case "LineString": 4900 case "MultiLineString": 4901 return ( 4902 (n = ki(a, "LineString" === r.type ? 0 : 1, c)), 4903 new yi(n, e) 4904 ); 4905 case "Polygon": 4906 case "MultiPolygon": 4907 return ( 4908 (n = ki(a, "Polygon" === r.type ? 1 : 2, c)), 4909 new vi(n, e) 4910 ); 4911 case "GeometryCollection": 4912 for (o = 0, s = r.geometries.length; o < s; o++) { 4913 var d = xi( 4914 { 4915 geometry: r.geometries[o], 4916 type: "Feature", 4917 properties: t.properties, 4918 }, 4919 e, 4920 ); 4921 d && h.push(d); 4922 } 4923 return new ci(h); 4924 case "FeatureCollection": 4925 for (o = 0, s = r.features.length; o < s; o++) { 4926 var u = xi(r.features[o], e); 4927 u && h.push(u); 4928 } 4929 return new ci(h); 4930 default: 4931 throw new Error("Invalid GeoJSON object."); 4932 } 4933 } 4934 function Pi(t, e, i, n) { 4935 return t ? t(e, i) : new _i(i, n && n.markersInheritOptions && n); 4936 } 4937 function bi(t) { 4938 return new D(t[1], t[0], t[2]); 4939 } 4940 function ki(t, e, i) { 4941 for (var n, o = [], s = 0, r = t.length; s < r; s++) 4942 ((n = e ? ki(t[s], e - 1, i) : (i || bi)(t[s])), o.push(n)); 4943 return o; 4944 } 4945 function Li(t, e) { 4946 return void 0 !== (t = N(t)).alt 4947 ? [c(t.lng, e), c(t.lat, e), c(t.alt, e)] 4948 : [c(t.lng, e), c(t.lat, e)]; 4949 } 4950 function Ci(t, e, i, n) { 4951 for (var o = [], s = 0, r = t.length; s < r; s++) 4952 o.push(e ? Ci(t[s], si(t[s]) ? 0 : e - 1, i, n) : Li(t[s], n)); 4953 return (!e && i && 0 < o.length && o.push(o[0].slice()), o); 4954 } 4955 function Ti(t, i) { 4956 return t.feature ? e({}, t.feature, { geometry: i }) : zi(i); 4957 } 4958 function zi(t) { 4959 return "Feature" === t.type || "FeatureCollection" === t.type 4960 ? t 4961 : { type: "Feature", properties: {}, geometry: t }; 4962 } 4963 function Si(t, e) { 4964 return new wi(t, e); 4965 } 4966 ((ct = { 4967 toGeoJSON: function (t) { 4968 return Ti(this, { 4969 type: "Point", 4970 coordinates: Li(this.getLatLng(), t), 4971 }); 4972 }, 4973 }), 4974 _i.include(ct), 4975 gi.include(ct), 4976 fi.include(ct), 4977 yi.include({ 4978 toGeoJSON: function (t) { 4979 var e = !si(this._latlngs); 4980 return Ti(this, { 4981 type: (e ? "Multi" : "") + "LineString", 4982 coordinates: Ci(this._latlngs, e ? 1 : 0, !1, t), 4983 }); 4984 }, 4985 }), 4986 vi.include({ 4987 toGeoJSON: function (t) { 4988 var e = !si(this._latlngs), 4989 i = e && !si(this._latlngs[0]); 4990 return ( 4991 (t = Ci(this._latlngs, i ? 2 : e ? 1 : 0, !0, t)), 4992 Ti(this, { 4993 type: (i ? "Multi" : "") + "Polygon", 4994 coordinates: (t = e ? t : [t]), 4995 }) 4996 ); 4997 }, 4998 }), 4999 li.include({ 5000 toMultiPoint: function (t) { 5001 var e = []; 5002 return ( 5003 this.eachLayer(function (i) { 5004 e.push(i.toGeoJSON(t).geometry.coordinates); 5005 }), 5006 Ti(this, { type: "MultiPoint", coordinates: e }) 5007 ); 5008 }, 5009 toGeoJSON: function (t) { 5010 var e, 5011 i, 5012 n = 5013 this.feature && 5014 this.feature.geometry && 5015 this.feature.geometry.type; 5016 return "MultiPoint" === n 5017 ? this.toMultiPoint(t) 5018 : ((e = "GeometryCollection" === n), 5019 (i = []), 5020 this.eachLayer(function (n) { 5021 n.toGeoJSON && 5022 ((n = n.toGeoJSON(t)), 5023 e 5024 ? i.push(n.geometry) 5025 : "FeatureCollection" === (n = zi(n)).type 5026 ? i.push.apply(i, n.features) 5027 : i.push(n)); 5028 }), 5029 e 5030 ? Ti(this, { geometries: i, type: "GeometryCollection" })
5031 : { type: "FeatureCollection", features: i }); 5032 }, 5033 }), 5034 (dt = Si)); 5035 var Mi = lt.extend({ 5036 options: { 5037 opacity: 1, 5038 alt: "", 5039 interactive: !1, 5040 crossOrigin: !1, 5041 errorOverlayUrl: "", 5042 zIndex: 1, 5043 className: "", 5044 }, 5045 initialize: function (t, e, i) { 5046 ((this._url = t), (this._bounds = R(e)), p(this, i)); 5047 }, 5048 onAdd: function () { 5049 (this._image || 5050 (this._initImage(), 5051 this.options.opacity < 1 && this._updateOpacity()), 5052 this.options.interactive && 5053 (ae(this._image, "leaflet-interactive"), 5054 this.addInteractiveTarget(this._image)), 5055 this.getPane().appendChild(this._image), 5056 this._reset()); 5057 }, 5058 onRemove: function () { 5059 (ie(this._image), 5060 this.options.interactive && 5061 this.removeInteractiveTarget(this._image)); 5062 }, 5063 setOpacity: function (t) { 5064 return ( 5065 (this.options.opacity = t), 5066 this._image && this._updateOpacity(), 5067 this 5068 ); 5069 }, 5070 setStyle: function (t) { 5071 return (t.opacity && this.setOpacity(t.opacity), this); 5072 }, 5073 bringToFront: function () { 5074 return (this._map && oe(this._image), this); 5075 }, 5076 bringToBack: function () { 5077 return (this._map && se(this._image), this); 5078 }, 5079 setUrl: function (t) { 5080 return ( 5081 (this._url = t), 5082 this._image && (this._image.src = t), 5083 this 5084 ); 5085 }, 5086 setBounds: function (t) { 5087 return ( 5088 (this._bounds = R(t)), 5089 this._map && this._reset(), 5090 this 5091 ); 5092 }, 5093 getEvents: function () { 5094 var t = { zoom: this._reset, viewreset: this._reset }; 5095 return ( 5096 this._zoomAnimated && (t.zoomanim = this._animateZoom), 5097 t 5098 ); 5099 }, 5100 setZIndex: function (t) { 5101 return ((this.options.zIndex = t), this._updateZIndex(), this); 5102 }, 5103 getBounds: function () { 5104 return this._bounds; 5105 }, 5106 getElement: function () { 5107 return this._image; 5108 }, 5109 _initImage: function () { 5110 var t = "IMG" === this._url.tagName, 5111 e = (this._image = t ? this._url : ee("img")); 5112 (ae(e, "leaflet-image-layer"), 5113 this._zoomAnimated && ae(e, "leaflet-zoom-animated"), 5114 this.options.className && ae(e, this.options.className), 5115 (e.onselectstart = l), 5116 (e.onmousemove = l), 5117 (e.onload = o(this.fire, this, "load")), 5118 (e.onerror = o(this._overlayOnError, this, "error")), 5119 (!this.options.crossOrigin && 5120 "" !== this.options.crossOrigin) || 5121 (e.crossOrigin = 5122 !0 === this.options.crossOrigin 5123 ? "" 5124 : this.options.crossOrigin), 5125 this.options.zIndex && this._updateZIndex(), 5126 t 5127 ? (this._url = e.src) 5128 : ((e.src = this._url), (e.alt = this.options.alt))); 5129 }, 5130 _animateZoom: function (t) { 5131 var e = this._map.getZoomScale(t.zoom); 5132 ((t = this._map._latLngBoundsToNewLayerBounds( 5133 this._bounds, 5134 t.zoom, 5135 t.center, 5136 ).min), 5137 pe(this._image, t, e)); 5138 }, 5139 _reset: function () { 5140 var t = this._image, 5141 e = new B( 5142 this._map.latLngToLayerPoint(this._bounds.getNorthWest()), 5143 this._map.latLngToLayerPoint(this._bounds.getSouthEast()), 5144 ), 5145 i = e.getSize(); 5146 (_e(t, e.min), 5147 (t.style.width = i.x + "px"), 5148 (t.style.height = i.y + "px")); 5149 }, 5150 _updateOpacity: function () { 5151 de(this._image, this.options.opacity); 5152 }, 5153 _updateZIndex: function () { 5154 this._image && 5155 void 0 !== this.options.zIndex && 5156 null !== this.options.zIndex && 5157 (this._image.style.zIndex = this.options.zIndex); 5158 }, 5159 _overlayOnError: function () { 5160 this.fire("error"); 5161 var t = this.options.errorOverlayUrl; 5162 t && 5163 this._url !== t && 5164 ((this._url = t), (this._image.src = t)); 5165 }, 5166 getCenter: function () { 5167 return this._bounds.getCenter(); 5168 }, 5169 }), 5170 Ii = Mi.extend({ 5171 options: { 5172 autoplay: !0, 5173 loop: !0, 5174 keepAspectRatio: !0, 5175 muted: !1,
5176 playsInline: !0, 5177 }, 5178 _initImage: function () { 5179 var t = "VIDEO" === this._url.tagName, 5180 e = (this._image = t ? this._url : ee("video")); 5181 if ( 5182 (ae(e, "leaflet-image-layer"), 5183 this._zoomAnimated && ae(e, "leaflet-zoom-animated"), 5184 this.options.className && ae(e, this.options.className), 5185 (e.onselectstart = l), 5186 (e.onmousemove = l), 5187 (e.onloadeddata = o(this.fire, this, "load")), 5188 t) 5189 ) { 5190 for ( 5191 var i = e.getElementsByTagName("source"), n = [], s = 0; 5192 s < i.length; 5193 s++ 5194 ) 5195 n.push(i[s].src); 5196 this._url = 0 < i.length ? n : [e.src]; 5197 } else { 5198 (g(this._url) || (this._url = [this._url]), 5199 !this.options.keepAspectRatio && 5200 Object.prototype.hasOwnProperty.call( 5201 e.style, 5202 "objectFit", 5203 ) && 5204 (e.style.objectFit = "fill"), 5205 (e.autoplay = !!this.options.autoplay), 5206 (e.loop = !!this.options.loop), 5207 (e.muted = !!this.options.muted), 5208 (e.playsInline = !!this.options.playsInline)); 5209 for (var r = 0; r < this._url.length; r++) { 5210 var a = ee("source"); 5211 ((a.src = this._url[r]), e.appendChild(a)); 5212 } 5213 } 5214 }, 5215 }), 5216 ji = Mi.extend({ 5217 _initImage: function () { 5218 var t = (this._image = this._url); 5219 (ae(t, "leaflet-image-layer"), 5220 this._zoomAnimated && ae(t, "leaflet-zoom-animated"), 5221 this.options.className && ae(t, this.options.className), 5222 (t.onselectstart = l), 5223 (t.onmousemove = l)); 5224 }, 5225 }), 5226 Ei = lt.extend({ 5227 options: { 5228 interactive: !1, 5229 offset: [0, 0], 5230 className: "", 5231 pane: void 0, 5232 content: "", 5233 }, 5234 initialize: function (t, e) { 5235 (t && (t instanceof D || g(t)) 5236 ? ((this._latlng = N(t)), p(this, e)) 5237 : (p(this, t), (this._source = e)), 5238 this.options.content && 5239 (this._content = this.options.content)); 5240 }, 5241 openOn: function (t) { 5242 return ( 5243 (t = arguments.length ? t : this._source._map).hasLayer( 5244 this, 5245 ) || t.addLayer(this), 5246 this 5247 ); 5248 }, 5249 close: function () { 5250 return (this._map && this._map.removeLayer(this), this); 5251 }, 5252 toggle: function (t) { 5253 return ( 5254 this._map 5255 ? this.close() 5256 : (arguments.length 5257 ? (this._source = t) 5258 : (t = this._source), 5259 this._prepareOpen(), 5260 this.openOn(t._map)), 5261 this 5262 ); 5263 }, 5264 onAdd: function (t) { 5265 ((this._zoomAnimated = t._zoomAnimated), 5266 this._container || this._initLayout(), 5267 t._fadeAnimated && de(this._container, 0), 5268 clearTimeout(this._removeTimeout), 5269 this.getPane().appendChild(this._container), 5270 this.update(), 5271 t._fadeAnimated && de(this._container, 1), 5272 this.bringToFront(), 5273 this.options.interactive && 5274 (ae(this._container, "leaflet-interactive"), 5275 this.addInteractiveTarget(this._container))); 5276 }, 5277 onRemove: function (t) { 5278 (t._fadeAnimated 5279 ? (de(this._container, 0), 5280 (this._removeTimeout = setTimeout( 5281 o(ie, void 0, this._container), 5282 200, 5283 ))) 5284 : ie(this._container), 5285 this.options.interactive && 5286 (he(this._container, "leaflet-interactive"), 5287 this.removeInteractiveTarget(this._container))); 5288 }, 5289 getLatLng: function () { 5290 return this._latlng; 5291 }, 5292 setLatLng: function (t) { 5293 return ( 5294 (this._latlng = N(t)), 5295 this._map && (this._updatePosition(), this._adjustPan()), 5296 this 5297 ); 5298 }, 5299 getContent: function () { 5300 return this._content; 5301 }, 5302 setContent: function (t) { 5303 return ((this._content = t), this.update(), this); 5304 }, 5305 getElement: function () { 5306 return this._container; 5307 }, 5308 update: function () { 5309 this._map && 5310 ((this._container.style.visibility = "hidden"), 5311 this._updateContent(), 5312 this._updateLayout(), 5313 this._updatePosition(), 5314 (this._container.style.visibility = ""), 5315 this._adjustPan()); 5316 }, 5317 getEvents: function () { 5318 var t = { 5319 zoom: this._updatePosition, 5320 viewreset: this._updatePosition, 5321 }; 5322 return ( 5323 this._zoomAnimated && (t.zoomanim = this._animateZoom), 5324 t 5325 ); 5326 }, 5327 isOpen: function () { 5328 return !!this._map && this._map.hasLayer(this); 5329 }, 5330 bringToFront: function () { 5331 return (this._map && oe(this._container), this); 5332 }, 5333 bringToBack: function () { 5334 return (this._map && se(this._container), this); 5335 }, 5336 _prepareOpen: function (t) { 5337 if (!(i = this._source)._map) return !1; 5338 if (i instanceof ci) { 5339 var e, 5340 i = null, 5341 n = this._source._layers; 5342 for (e in n) 5343 if (n[e]._map) { 5344 i = n[e]; 5345 break; 5346 } 5347 if (!i) return !1; 5348 this._source = i; 5349 } 5350 if (!t) 5351 if (i.getCenter) t = i.getCenter(); 5352 else if (i.getLatLng) t = i.getLatLng(); 5353 else { 5354 if (!i.getBounds) 5355 throw new Error("Unable to get source layer LatLng."); 5356 t = i.getBounds().getCenter(); 5357 } 5358 return (this.setLatLng(t), this._map && this.update(), !0); 5359 }, 5360 _updateContent: function () { 5361 if (this._content) { 5362 var t = this._contentNode, 5363 e = 5364 "function" == typeof this._content 5365 ? this._content(this._source || this) 5366 : this._content; 5367 if ("string" == typeof e) t.innerHTML = e; 5368 else { 5369 for (; t.hasChildNodes(); ) t.removeChild(t.firstChild); 5370 t.appendChild(e); 5371 } 5372 this.fire("contentupdate"); 5373 } 5374 }, 5375 _updatePosition: function () { 5376 var t, e, i; 5377 this._map && 5378 ((e = this._map.latLngToLayerPoint(this._latlng)), 5379 (t = A(this.options.offset)), 5380 (i = this._getAnchor()), 5381 this._zoomAnimated 5382 ? _e(this._container, e.add(i)) 5383 : (t = t.add(e).add(i)), 5384 (e = this._containerBottom = -t.y), 5385 (i = this._containerLeft = 5386 -Math.round(this._containerWidth / 2) + t.x), 5387 (this._container.style.bottom = e + "px"), 5388 (this._container.style.left = i + "px")); 5389 }, 5390 _getAnchor: function () { 5391 return [0, 0]; 5392 }, 5393 }), 5394 Ai = 5395 (Ne.include({ 5396 _initOverlay: function (t, e, i, n) { 5397 var o = e; 5398 return ( 5399 o instanceof t || (o = new t(n).setContent(e)), 5400 i && o.setLatLng(i), 5401 o 5402 ); 5403 }, 5404 }), 5405 lt.include({ 5406 _initOverlay: function (t, e, i, n) { 5407 var o = i; 5408 return ( 5409 o instanceof t 5410 ? (p(o, n), (o._source = this)) 5411 : (o = e && !n ? e : new t(n, this)).setContent(i), 5412 o 5413 ); 5414 }, 5415 }), 5416 Ei.extend({ 5417 options: { 5418 pane: "popupPane", 5419 offset: [0, 7], 5420 maxWidth: 300, 5421 minWidth: 50, 5422 maxHeight: null, 5423 autoPan: !0, 5424 autoPanPaddingTopLeft: null, 5425 autoPanPaddingBottomRight: null, 5426 autoPanPadding: [5, 5], 5427 keepInView: !1, 5428 closeButton: !0, 5429 autoClose: !0, 5430 closeOnEscapeKey: !0, 5431 className: "", 5432 }, 5433 openOn: function (t) { 5434 return ( 5435 !(t = arguments.length ? t : this._source._map).hasLayer( 5436 this, 5437 ) && 5438 t._popup && 5439 t._popup.options.autoClose && 5440 t.removeLayer(t._popup), 5441 (t._popup = this), 5442 Ei.prototype.openOn.call(this, t) 5443 ); 5444 }, 5445 onAdd: function (t) { 5446 (Ei.prototype.onAdd.call(this, t), 5447 t.fire("popupopen", { popup: this }), 5448 this._source && 5449 (this._source.fire("popupopen", { popup: this }, !0), 5450 this._source instanceof mi || 5451 this._source.on("preclick", Se))); 5452 }, 5453 onRemove: function (t) { 5454 (Ei.prototype.onRemove.call(this, t), 5455 t.fire("popupclose", { popup: this }), 5456 this._source && 5457 (this._source.fire("popupclose", { popup: this }, !0), 5458 this._source instanceof mi || 5459 this._source.off("preclick", Se))); 5460 }, 5461 getEvents: function () { 5462 var t = Ei.prototype.getEvents.call(this); 5463 return ( 5464 (void 0 !== this.options.closeOnClick 5465 ? this.options.closeOnClick 5466 : this._map.options.closePopupOnClick) && 5467 (t.preclick = this.close), 5468 this.options.keepInView && (t.moveend = this._adjustPan), 5469 t 5470 ); 5471 }, 5472 _initLayout: function () { 5473 var t = "leaflet-popup", 5474 e = (this._container = ee( 5475 "div", 5476 t + 5477 " " + 5478 (this.options.className || "") + 5479 " leaflet-zoom-animated", 5480 )), 5481 i = (this._wrapper = ee("div", t + "-content-wrapper", e)); 5482 ((this._contentNode = ee("div", t + "-content", i)), 5483 Ie(e), 5484 Me(this._contentNode), 5485 Pe(e, "contextmenu", Se), 5486 (this._tipContainer = ee("div", t + "-tip-container", e)), 5487 (this._tip = ee("div", t + "-tip", this._tipContainer)), 5488 this.options.closeButton && 5489 ((i = this._closeButton = 5490 ee("a", t + "-close-button", e)).setAttribute( 5491 "role", 5492 "button", 5493 ), 5494 i.setAttribute("aria-label", "Close popup"), 5495 (i.href = "#close"), 5496 (i.innerHTML = '<span aria-hidden="true">×</span>'), 5497 Pe( 5498 i, 5499 "click", 5500 function (t) { 5501 (je(t), this.close()); 5502 }, 5503 this, 5504 ))); 5505 }, 5506 _updateLayout: function () { 5507 var t = this._contentNode, 5508 e = t.style, 5509 i = 5510 ((e.width = ""), 5511 (e.whiteSpace = "nowrap"), 5512 t.offsetWidth), 5513 n = 5514 ((i = Math.min(i, this.options.maxWidth)), 5515 (i = Math.max(i, this.options.minWidth)), 5516 (e.width = i + 1 + "px"), 5517 (e.whiteSpace = ""), 5518 (e.height = ""), 5519 (i = t.offsetHeight), 5520 this.options.maxHeight),
5521 o = "leaflet-popup-scrolled"; 5522 ((n && n < i ? ((e.height = n + "px"), ae) : he)(t, o), 5523 (this._containerWidth = this._container.offsetWidth)); 5524 }, 5525 _animateZoom: function (t) { 5526 t = this._map._latLngToNewLayerPoint( 5527 this._latlng, 5528 t.zoom, 5529 t.center, 5530 ); 5531 var e = this._getAnchor(); 5532 _e(this._container, t.add(e)); 5533 }, 5534 _adjustPan: function () { 5535 var t, e, i, n, o, s, r, a; 5536 this.options.autoPan && 5537 (this._map._panAnim && this._map._panAnim.stop(), 5538 this._autopanning 5539 ? (this._autopanning = !1) 5540 : ((t = this._map), 5541 (e = 5542 parseInt(te(this._container, "marginBottom"), 10) || 5543 0), 5544 (e = this._container.offsetHeight + e), 5545 (a = this._containerWidth), 5546 (i = new j( 5547 this._containerLeft, 5548 -e - this._containerBottom, 5549 ))._add(me(this._container)), 5550 (i = t.layerPointToContainerPoint(i)), 5551 (o = A(this.options.autoPanPadding)), 5552 (n = A(this.options.autoPanPaddingTopLeft || o)), 5553 (o = A(this.options.autoPanPaddingBottomRight || o)), 5554 (s = t.getSize()), 5555 (r = 0), 5556 i.x + a + o.x > s.x && (r = i.x + a - s.x + o.x), 5557 i.x - r - n.x < (a = 0) && (r = i.x - n.x), 5558 i.y + e + o.y > s.y && (a = i.y + e - s.y + o.y), 5559 i.y - a - n.y < 0 && (a = i.y - n.y), 5560 (r || a) && 5561 (this.options.keepInView && (this._autopanning = !0), 5562 t.fire("autopanstart").panBy([r, a])))); 5563 }, 5564 _getAnchor: function () { 5565 return A( 5566 this._source && this._source._getPopupAnchor 5567 ? this._source._getPopupAnchor() 5568 : [0, 0], 5569 ); 5570 }, 5571 })), 5572 Bi = 5573 (Ne.mergeOptions({ closePopupOnClick: !0 }), 5574 Ne.include({ 5575 openPopup: function (t, e, i) { 5576 return (this._initOverlay(Ai, t, e, i).openOn(this), this); 5577 }, 5578 closePopup: function (t) { 5579 return ( 5580 (t = arguments.length ? t : this._popup) && t.close(), 5581 this 5582 ); 5583 }, 5584 }), 5585 lt.include({ 5586 bindPopup: function (t, e) { 5587 return ( 5588 (this._popup = this._initOverlay(Ai, this._popup, t, e)), 5589 this._popupHandlersAdded || 5590 (this.on({ 5591 click: this._openPopup, 5592 keypress: this._onKeyPress, 5593 remove: this.closePopup,
5594 move: this._movePopup, 5595 }), 5596 (this._popupHandlersAdded = !0)), 5597 this 5598 ); 5599 }, 5600 unbindPopup: function () { 5601 return ( 5602 this._popup && 5603 (this.off({ 5604 click: this._openPopup, 5605 keypress: this._onKeyPress, 5606 remove: this.closePopup, 5607 move: this._movePopup, 5608 }), 5609 (this._popupHandlersAdded = !1), 5610 (this._popup = null)), 5611 this 5612 ); 5613 }, 5614 openPopup: function (t) { 5615 return ( 5616 this._popup && 5617 (this instanceof ci || (this._popup._source = this), 5618 this._popup._prepareOpen(t || this._latlng) && 5619 this._popup.openOn(this._map)), 5620 this 5621 ); 5622 }, 5623 closePopup: function () { 5624 return (this._popup && this._popup.close(), this); 5625 }, 5626 togglePopup: function () { 5627 return (this._popup && this._popup.toggle(this), this); 5628 }, 5629 isPopupOpen: function () { 5630 return !!this._popup && this._popup.isOpen(); 5631 }, 5632 setPopupContent: function (t) { 5633 return (this._popup && this._popup.setContent(t), this); 5634 }, 5635 getPopup: function () { 5636 return this._popup; 5637 }, 5638 _openPopup: function (t) { 5639 var e; 5640 this._popup && 5641 this._map && 5642 (Ee(t), 5643 (e = t.layer || t.target), 5644 this._popup._source !== e || e instanceof mi 5645 ? ((this._popup._source = e), this.openPopup(t.latlng)) 5646 : this._map.hasLayer(this._popup) 5647 ? this.closePopup() 5648 : this.openPopup(t.latlng)); 5649 }, 5650 _movePopup: function (t) { 5651 this._popup.setLatLng(t.latlng); 5652 }, 5653 _onKeyPress: function (t) { 5654 13 === t.originalEvent.keyCode && this._openPopup(t); 5655 }, 5656 }), 5657 Ei.extend({ 5658 options: { 5659 pane: "tooltipPane", 5660 offset: [0, 0], 5661 direction: "auto", 5662 permanent: !1, 5663 sticky: !1, 5664 opacity: 0.9, 5665 }, 5666 onAdd: function (t) { 5667 (Ei.prototype.onAdd.call(this, t), 5668 this.setOpacity(this.options.opacity), 5669 t.fire("tooltipopen", { tooltip: this }), 5670 this._source && 5671 (this.addEventParent(this._source), 5672 this._source.fire("tooltipopen", { tooltip: this }, !0))); 5673 }, 5674 onRemove: function (t) { 5675 (Ei.prototype.onRemove.call(this, t), 5676 t.fire("tooltipclose", { tooltip: this }), 5677 this._source && 5678 (this.removeEventParent(this._source), 5679 this._source.fire( 5680 "tooltipclose", 5681 { tooltip: this }, 5682 !0, 5683 ))); 5684 }, 5685 getEvents: function () { 5686 var t = Ei.prototype.getEvents.call(this); 5687 return ( 5688 this.options.permanent || (t.preclick = this.close), 5689 t 5690 ); 5691 }, 5692 _initLayout: function () { 5693 var t = 5694 "leaflet-tooltip " + 5695 (this.options.className || "") + 5696 " leaflet-zoom-" + 5697 (this._zoomAnimated ? "animated" : "hide"); 5698 ((this._contentNode = this._container = ee("div", t)), 5699 this._container.setAttribute("role", "tooltip"), 5700 this._container.setAttribute( 5701 "id", 5702 "leaflet-tooltip-" + r(this), 5703 )); 5704 }, 5705 _updateLayout: function () {}, 5706 _adjustPan: function () {}, 5707 _setPosition: function (t) { 5708 var e, 5709 i = this._map, 5710 n = this._container, 5711 o = i.latLngToContainerPoint(i.getCenter()), 5712 s = 5713 ((i = i.layerPointToContainerPoint(t)), 5714 this.options.direction), 5715 r = n.offsetWidth, 5716 a = n.offsetHeight, 5717 h = A(this.options.offset), 5718 l = this._getAnchor(); 5719 ((i = 5720 "top" === s 5721 ? ((e = r / 2), a) 5722 : "bottom" === s 5723 ? ((e = r / 2), 0) 5724 : ((e = 5725 "center" === s 5726 ? r / 2 5727 : "right" === s 5728 ? 0 5729 : "left" === s 5730 ? r 5731 : i.x < o.x 5732 ? ((s = "right"), 0) 5733 : ((s = "left"), r + 2 * (h.x + l.x))), 5734 a / 2)), 5735 (t = t 5736 .subtract(A(e, i, !0)) 5737 .add(h) 5738 .add(l)), 5739 he(n, "leaflet-tooltip-right"), 5740 he(n, "leaflet-tooltip-left"), 5741 he(n, "leaflet-tooltip-top"), 5742 he(n, "leaflet-tooltip-bottom"), 5743 ae(n, "leaflet-tooltip-" + s), 5744 _e(n, t)); 5745 }, 5746 _updatePosition: function () { 5747 var t = this._map.latLngToLayerPoint(this._latlng); 5748 this._setPosition(t); 5749 }, 5750 setOpacity: function (t) { 5751 ((this.options.opacity = t), 5752 this._container && de(this._container, t)); 5753 }, 5754 _animateZoom: function (t) { 5755 ((t = this._map._latLngToNewLayerPoint( 5756 this._latlng, 5757 t.zoom, 5758 t.center, 5759 )), 5760 this._setPosition(t)); 5761 }, 5762 _getAnchor: function () { 5763 return A( 5764 this._source && 5765 this._source._getTooltipAnchor && 5766 !this.options.sticky 5767 ? this._source._getTooltipAnchor() 5768 : [0, 0], 5769 ); 5770 }, 5771 })), 5772 Zi = 5773 (Ne.include({ 5774 openTooltip: function (t, e, i) { 5775 return (this._initOverlay(Bi, t, e, i).openOn(this), this); 5776 }, 5777 closeTooltip: function (t) { 5778 return (t.close(), this); 5779 }, 5780 }), 5781 lt.include({ 5782 bindTooltip: function (t, e) { 5783 return ( 5784 this._tooltip && 5785 this.isTooltipOpen() && 5786 this.unbindTooltip(), 5787 (this._tooltip = this._initOverlay( 5788 Bi, 5789 this._tooltip, 5790 t, 5791 e, 5792 )), 5793 this._initTooltipInteractions(), 5794 this._tooltip.options.permanent && 5795 this._map && 5796 this._map.hasLayer(this) && 5797 this.openTooltip(), 5798 this 5799 ); 5800 }, 5801 unbindTooltip: function () { 5802 return ( 5803 this._tooltip && 5804 (this._initTooltipInteractions(!0), 5805 this.closeTooltip(), 5806 (this._tooltip = null)), 5807 this 5808 ); 5809 }, 5810 _initTooltipInteractions: function (t) { 5811 var e, i; 5812 (!t && this._tooltipHandlersAdded) || 5813 ((e = t ? "off" : "on"), 5814 (i = { 5815 remove: this.closeTooltip, 5816 move: this._moveTooltip, 5817 }), 5818 this._tooltip.options.permanent 5819 ? (i.add = this._openTooltip) 5820 : ((i.mouseover = this._openTooltip), 5821 (i.mouseout = this.closeTooltip), 5822 (i.click = this._openTooltip), 5823 this._map 5824 ? this._addFocusListeners() 5825 : (i.add = this._addFocusListeners)), 5826 this._tooltip.options.sticky && 5827 (i.mousemove = this._moveTooltip), 5828 this[e](i), 5829 (this._tooltipHandlersAdded = !t)); 5830 }, 5831 openTooltip: function (t) { 5832 return ( 5833 this._tooltip && 5834 (this instanceof ci || (this._tooltip._source = this), 5835 this._tooltip._prepareOpen(t) && 5836 (this._tooltip.openOn(this._map), 5837 this.getElement 5838 ? this._setAriaDescribedByOnLayer(this) 5839 : this.eachLayer && 5840 this.eachLayer( 5841 this._setAriaDescribedByOnLayer, 5842 this, 5843 ))), 5844 this 5845 ); 5846 }, 5847 closeTooltip: function () { 5848 if (this._tooltip) return this._tooltip.close(); 5849 }, 5850 toggleTooltip: function () { 5851 return (this._tooltip && this._tooltip.toggle(this), this); 5852 }, 5853 isTooltipOpen: function () { 5854 return this._tooltip.isOpen(); 5855 }, 5856 setTooltipContent: function (t) { 5857 return (this._tooltip && this._tooltip.setContent(t), this); 5858 }, 5859 getTooltip: function () { 5860 return this._tooltip; 5861 }, 5862 _addFocusListeners: function () { 5863 this.getElement 5864 ? this._addFocusListenersOnLayer(this) 5865 : this.eachLayer && 5866 this.eachLayer(this._addFocusListenersOnLayer, this); 5867 }, 5868 _addFocusListenersOnLayer: function (t) { 5869 var e = "function" == typeof t.getElement && t.getElement(); 5870 e && 5871 (Pe( 5872 e, 5873 "focus", 5874 function () { 5875 ((this._tooltip._source = t), this.openTooltip()); 5876 }, 5877 this, 5878 ), 5879 Pe(e, "blur", this.closeTooltip, this)); 5880 }, 5881 _setAriaDescribedByOnLayer: function (t) { 5882 (t = "function" == typeof t.getElement && t.getElement()) && 5883 t.setAttribute( 5884 "aria-describedby", 5885 this._tooltip._container.id, 5886 ); 5887 }, 5888 _openTooltip: function (t) { 5889 var e; 5890 this._tooltip && 5891 this._map && 5892 (this._map.dragging && 5893 this._map.dragging.moving() && 5894 !this._openOnceFlag 5895 ? ((this._openOnceFlag = !0), 5896 (e = this)._map.once("moveend", function () { 5897 ((e._openOnceFlag = !1), e._openTooltip(t)); 5898 })) 5899 : ((this._tooltip._source = t.layer || t.target), 5900 this.openTooltip( 5901 this._tooltip.options.sticky ? t.latlng : void 0, 5902 ))); 5903 }, 5904 _moveTooltip: function (t) { 5905 var e = t.latlng; 5906 (this._tooltip.options.sticky && 5907 t.originalEvent && 5908 ((t = this._map.mouseEventToContainerPoint( 5909 t.originalEvent, 5910 )), 5911 (t = this._map.containerPointToLayerPoint(t)), 5912 (e = this._map.layerPointToLatLng(t))), 5913 this._tooltip.setLatLng(e)); 5914 }, 5915 }), 5916 di.extend({ 5917 options: { 5918 iconSize: [12, 12], 5919 html: !1, 5920 bgPos: null, 5921 className: "leaflet-div-icon", 5922 }, 5923 createIcon: function (t) { 5924 t = 5925 t && "DIV" === t.tagName 5926 ? t 5927 : document.createElement("div"); 5928 var e = this.options; 5929 return ( 5930 e.html instanceof Element 5931 ? (ne(t), t.appendChild(e.html)) 5932 : (t.innerHTML = !1 !== e.html ? e.html : ""), 5933 e.bgPos && 5934 ((e = A(e.bgPos)), 5935 (t.style.backgroundPosition = 5936 -e.x + "px " + -e.y + "px")), 5937 this._setIconStyles(t, "icon"), 5938 t 5939 ); 5940 }, 5941 createShadow: function () { 5942 return null; 5943 }, 5944 })); 5945 di.Default = ui; 5946 var Oi = lt.extend({ 5947 options: { 5948 tileSize: 256, 5949 opacity: 1, 5950 updateWhenIdle: zt.mobile, 5951 updateWhenZooming: !0, 5952 updateInterval: 200, 5953 zIndex: 1, 5954 bounds: null, 5955 minZoom: 0, 5956 maxZoom: void 0, 5957 maxNativeZoom: void 0, 5958 minNativeZoom: void 0, 5959 noWrap: !1, 5960 pane: "tilePane", 5961 className: "", 5962 keepBuffer: 2, 5963 }, 5964 initialize: function (t) { 5965 p(this, t); 5966 }, 5967 onAdd: function () { 5968 (this._initContainer(), 5969 (this._levels = {}), 5970 (this._tiles = {}), 5971 this._resetView()); 5972 }, 5973 beforeAdd: function (t) { 5974 t._addZoomLimit(this); 5975 }, 5976 onRemove: function (t) { 5977 (this._removeAllTiles(), 5978 ie(this._container), 5979 t._removeZoomLimit(this), 5980 (this._container = null),
5981 (this._tileZoom = void 0)); 5982 }, 5983 bringToFront: function () { 5984 return ( 5985 this._map && 5986 (oe(this._container), this._setAutoZIndex(Math.max)), 5987 this 5988 ); 5989 }, 5990 bringToBack: function () { 5991 return ( 5992 this._map && 5993 (se(this._container), this._setAutoZIndex(Math.min)), 5994 this 5995 ); 5996 }, 5997 getContainer: function () { 5998 return this._container; 5999 }, 6000 setOpacity: function (t) { 6001 return ( 6002 (this.options.opacity = t), 6003 this._updateOpacity(), 6004 this 6005 ); 6006 }, 6007 setZIndex: function (t) { 6008 return ((this.options.zIndex = t), this._updateZIndex(), this); 6009 }, 6010 isLoading: function () { 6011 return this._loading; 6012 }, 6013 redraw: function () { 6014 var t; 6015 return ( 6016 this._map && 6017 (this._removeAllTiles(), 6018 (t = this._clampZoom(this._map.getZoom())) !== 6019 this._tileZoom && 6020 ((this._tileZoom = t), this._updateLevels()), 6021 this._update()), 6022 this 6023 ); 6024 }, 6025 getEvents: function () { 6026 var t = { 6027 viewprereset: this._invalidateAll, 6028 viewreset: this._resetView, 6029 zoom: this._resetView, 6030 moveend: this._onMoveEnd, 6031 }; 6032 return ( 6033 this.options.updateWhenIdle || 6034 (this._onMove || 6035 (this._onMove = a( 6036 this._onMoveEnd, 6037 this.options.updateInterval, 6038 this, 6039 )), 6040 (t.move = this._onMove)), 6041 this._zoomAnimated && (t.zoomanim = this._animateZoom), 6042 t 6043 ); 6044 }, 6045 createTile: function () { 6046 return document.createElement("div"); 6047 }, 6048 getTileSize: function () { 6049 var t = this.options.tileSize; 6050 return t instanceof j ? t : new j(t, t); 6051 }, 6052 _updateZIndex: function () { 6053 this._container && 6054 void 0 !== this.options.zIndex && 6055 null !== this.options.zIndex && 6056 (this._container.style.zIndex = this.options.zIndex); 6057 }, 6058 _setAutoZIndex: function (t) { 6059 for ( 6060 var e, 6061 i = this.getPane().children, 6062 n = -t(-1 / 0, 1 / 0), 6063 o = 0, 6064 s = i.length; 6065 o < s; 6066 o++ 6067 ) 6068 ((e = i[o].style.zIndex), 6069 i[o] !== this._container && e && (n = t(n, +e))); 6070 isFinite(n) && 6071 ((this.options.zIndex = n + t(-1, 1)), this._updateZIndex()); 6072 }, 6073 _updateOpacity: function () { 6074 if (this._map && !zt.ielt9) { 6075 de(this._container, this.options.opacity); 6076 var t, 6077 e = +new Date(), 6078 i = !1, 6079 n = !1; 6080 for (t in this._tiles) { 6081 var o, 6082 s = this._tiles[t]; 6083 s.current && 6084 s.loaded && 6085 ((o = Math.min(1, (e - s.loaded) / 200)), 6086 de(s.el, o), 6087 o < 1 6088 ? (i = !0) 6089 : (s.active ? (n = !0) : this._onOpaqueTile(s), 6090 (s.active = !0))); 6091 } 6092 (n && !this._noPrune && this._pruneTiles(), 6093 i && 6094 (T(this._fadeFrame), 6095 (this._fadeFrame = C(this._updateOpacity, this)))); 6096 } 6097 }, 6098 _onOpaqueTile: l, 6099 _initContainer: function () { 6100 this._container || 6101 ((this._container = ee( 6102 "div", 6103 "leaflet-layer " + (this.options.className || ""), 6104 )), 6105 this._updateZIndex(), 6106 this.options.opacity < 1 && this._updateOpacity(), 6107 this.getPane().appendChild(this._container)); 6108 }, 6109 _updateLevels: function () { 6110 var t = this._tileZoom, 6111 e = this.options.maxZoom; 6112 if (void 0 !== t) { 6113 for (var i in this._levels) 6114 ((i = Number(i)), 6115 this._levels[i].el.children.length || i === t 6116 ? ((this._levels[i].el.style.zIndex = 6117 e - Math.abs(t - i)), 6118 this._onUpdateLevel(i)) 6119 : (ie(this._levels[i].el), 6120 this._removeTilesAtZoom(i), 6121 this._onRemoveLevel(i), 6122 delete this._levels[i])); 6123 var n = this._levels[t], 6124 o = this._map; 6125 return ( 6126 n || 6127 (((n = this._levels[t] = {}).el = ee( 6128 "div", 6129 "leaflet-tile-container leaflet-zoom-animated", 6130 this._container, 6131 )), 6132 (n.el.style.zIndex = e), 6133 (n.origin = o 6134 .project(o.unproject(o.getPixelOrigin()), t) 6135 .round()), 6136 (n.zoom = t), 6137 this._setZoomTransform(n, o.getCenter(), o.getZoom()), 6138 l(n.el.offsetWidth), 6139 this._onCreateLevel(n)), 6140 (this._level = n) 6141 ); 6142 } 6143 }, 6144 _onUpdateLevel: l, 6145 _onRemoveLevel: l, 6146 _onCreateLevel: l, 6147 _pruneTiles: function () { 6148 if (this._map) { 6149 var t, 6150 e, 6151 i, 6152 n = this._map.getZoom(); 6153 if (n > this.options.maxZoom || n < this.options.minZoom) 6154 this._removeAllTiles(); 6155 else { 6156 for (t in this._tiles) 6157 (i = this._tiles[t]).retain = i.current; 6158 for (t in this._tiles) 6159 (i = this._tiles[t]).current && 6160 !i.active && 6161 ((e = i.coords), 6162 this._retainParent(e.x, e.y, e.z, e.z - 5) || 6163 this._retainChildren(e.x, e.y, e.z, e.z + 2)); 6164 for (t in this._tiles) 6165 this._tiles[t].retain || this._removeTile(t); 6166 } 6167 } 6168 }, 6169 _removeTilesAtZoom: function (t) { 6170 for (var e in this._tiles) 6171 this._tiles[e].coords.z === t && this._removeTile(e); 6172 }, 6173 _removeAllTiles: function () { 6174 for (var t in this._tiles) this._removeTile(t); 6175 }, 6176 _invalidateAll: function () { 6177 for (var t in this._levels) 6178 (ie(this._levels[t].el), 6179 this._onRemoveLevel(Number(t)), 6180 delete this._levels[t]); 6181 (this._removeAllTiles(), (this._tileZoom = void 0)); 6182 }, 6183 _retainParent: function (t, e, i, n) { 6184 i -= 1; 6185 var o = 6186 (((o = new j( 6187 +(t = Math.floor(t / 2)), 6188 +(e = Math.floor(e / 2)), 6189 )).z = i), 6190 this._tileCoordsToKey(o)); 6191 return (o = this._tiles[o]) && o.active 6192 ? (o.retain = !0) 6193 : (o && o.loaded && (o.retain = !0), 6194 n < i && this._retainParent(t, e, i, n)); 6195 }, 6196 _retainChildren: function (t, e, i, n) { 6197 for (var o = 2 * t; o < 2 * t + 2; o++) 6198 for (var s = 2 * e; s < 2 * e + 2; s++) { 6199 var r = 6200 (((r = new j(o, s)).z = i + 1), this._tileCoordsToKey(r)); 6201 (r = this._tiles[r]) && r.active 6202 ? (r.retain = !0) 6203 : (r && r.loaded && (r.retain = !0), 6204 i + 1 < n && this._retainChildren(o, s, i + 1, n)); 6205 } 6206 }, 6207 _resetView: function (t) { 6208 ((t = t && (t.pinch || t.flyTo)),
6209 this._setView( 6210 this._map.getCenter(), 6211 this._map.getZoom(), 6212 t, 6213 t, 6214 )); 6215 }, 6216 _animateZoom: function (t) { 6217 this._setView(t.center, t.zoom, !0, t.noUpdate); 6218 }, 6219 _clampZoom: function (t) { 6220 var e = this.options; 6221 return void 0 !== e.minNativeZoom && t < e.minNativeZoom 6222 ? e.minNativeZoom 6223 : void 0 !== e.maxNativeZoom && e.maxNativeZoom < t 6224 ? e.maxNativeZoom 6225 : t; 6226 }, 6227 _setView: function (t, e, i, n) { 6228 var o = Math.round(e), 6229 s = 6230 ((o = 6231 (void 0 !== this.options.maxZoom && 6232 o > this.options.maxZoom) || 6233 (void 0 !== this.options.minZoom && 6234 o < this.options.minZoom) 6235 ? void 0 6236 : this._clampZoom(o)), 6237 this.options.updateWhenZooming && o !== this._tileZoom); 6238 ((n && !s) || 6239 ((this._tileZoom = o), 6240 this._abortLoading && this._abortLoading(), 6241 this._updateLevels(), 6242 this._resetGrid(), 6243 void 0 !== o && this._update(t), 6244 i || this._pruneTiles(), 6245 (this._noPrune = !!i)), 6246 this._setZoomTransforms(t, e)); 6247 }, 6248 _setZoomTransforms: function (t, e) { 6249 for (var i in this._levels) 6250 this._setZoomTransform(this._levels[i], t, e); 6251 }, 6252 _setZoomTransform: function (t, e, i) { 6253 var n = this._map.getZoomScale(i, t.zoom); 6254 ((e = t.origin 6255 .multiplyBy(n) 6256 .subtract(this._map._getNewPixelOrigin(e, i)) 6257 .round()), 6258 zt.any3d ? pe(t.el, e, n) : _e(t.el, e)); 6259 }, 6260 _resetGrid: function () { 6261 var t = this._map, 6262 e = t.options.crs, 6263 i = (this._tileSize = this.getTileSize()), 6264 n = this._tileZoom, 6265 o = this._map.getPixelWorldBounds(this._tileZoom); 6266 (o && (this._globalTileRange = this._pxBoundsToTileRange(o)), 6267 (this._wrapX = e.wrapLng && 6268 !this.options.noWrap && [ 6269 Math.floor(t.project([0, e.wrapLng[0]], n).x / i.x), 6270 Math.ceil(t.project([0, e.wrapLng[1]], n).x / i.y), 6271 ]), 6272 (this._wrapY = e.wrapLat && 6273 !this.options.noWrap && [ 6274 Math.floor(t.project([e.wrapLat[0], 0], n).y / i.x), 6275 Math.ceil(t.project([e.wrapLat[1], 0], n).y / i.y), 6276 ])); 6277 }, 6278 _onMoveEnd: function () { 6279 this._map && !this._map._animatingZoom && this._update(); 6280 }, 6281 _getTiledPixelBounds: function (t) { 6282 var e = (i = this._map)._animatingZoom 6283 ? Math.max(i._animateToZoom, i.getZoom()) 6284 : i.getZoom(), 6285 i = 6286 ((e = i.getZoomScale(e, this._tileZoom)), 6287 (t = i.project(t, this._tileZoom).floor()), 6288 i.getSize().divideBy(2 * e)); 6289 return new B(t.subtract(i), t.add(i)); 6290 }, 6291 _update: function (t) { 6292 if ((n = this._map)) { 6293 var e = this._clampZoom(n.getZoom()); 6294 if ( 6295 (void 0 === t && (t = n.getCenter()), 6296 void 0 !== this._tileZoom) 6297 ) { 6298 var i, 6299 n = this._getTiledPixelBounds(t), 6300 o = this._pxBoundsToTileRange(n), 6301 s = o.getCenter(), 6302 r = [], 6303 a = 6304 ((n = this.options.keepBuffer), 6305 new B( 6306 o.getBottomLeft().subtract([n, -n]), 6307 o.getTopRight().add([n, -n]), 6308 )); 6309 if ( 6310 !( 6311 isFinite(o.min.x) && 6312 isFinite(o.min.y) && 6313 isFinite(o.max.x) && 6314 isFinite(o.max.y) 6315 ) 6316 ) 6317 throw new Error( 6318 "Attempted to load an infinite number of tiles", 6319 ); 6320 for (i in this._tiles) { 6321 var h = this._tiles[i].coords; 6322 (h.z === this._tileZoom && a.contains(new j(h.x, h.y))) || 6323 (this._tiles[i].current = !1); 6324 } 6325 if (1 < Math.abs(e - this._tileZoom)) this._setVie
6325w(t, e); 6326 else { 6327 for (var l = o.min.y; l <= o.max.y; l++) 6328 for (var c = o.min.x; c <= o.max.x; c++) { 6329 var d, 6330 u = new j(c, l); 6331 ((u.z = this._tileZoom), 6332 this._isValidTile(u) && 6333 ((d = this._tiles[this._tileCoordsToKey(u)]) 6334 ? (d.current = !0) 6335 : r.push(u))); 6336 } 6337 if ( 6338 (r.sort(function (t, e) { 6339 return t.distanceTo(s) - e.distanceTo(s); 6340 }), 6341 0 !== r.length) 6342 ) { 6343 this._loading || 6344 ((this._loading = !0), this.fire("loading")); 6345 var p = document.createDocumentFragment(); 6346 for (c = 0; c < r.length; c++) this._addTile(r[c], p); 6347 this._level.el.appendChild(p); 6348 } 6349 } 6350 } 6351 } 6352 }, 6353 _isValidTile: function (t) { 6354 var e = this._map.options.crs; 6355 if (!e.infinite) { 6356 var i = this._globalTileRange; 6357 if ( 6358 (!e.wrapLng && (t.x < i.min.x || t.x > i.max.x)) || 6359 (!e.wrapLat && (t.y < i.min.y || t.y > i.max.y)) 6360 ) 6361 return !1; 6362 } 6363 return ( 6364 !this.options.bounds || 6365 ((e = this._tileCoordsToBounds(t)), 6366 R(this.options.bounds).overlaps(e)) 6367 ); 6368 }, 6369 _keyToBounds: function (t) { 6370 return this._tileCoordsToBounds(this._keyToTileCoords(t)); 6371 }, 6372 _tileCoordsToNwSe: function (t) { 6373 var e = this._map, 6374 i = this.getTileSize(), 6375 n = t.scaleBy(i); 6376 return ( 6377 (i = n.add(i)), 6378 [e.unproject(n, t.z), e.unproject(i, t.z)] 6379 ); 6380 }, 6381 _tileCoordsToBounds: function (t) { 6382 return ( 6383 (t = new O((t = this._tileCoordsToNwSe(t))[0], t[1])), 6384 this.options.noWrap ? t : this._map.wrapLatLngBounds(t) 6385 ); 6386 }, 6387 _tileCoordsToKey: function (t) { 6388 return t.x + ":" + t.y + ":" + t.z; 6389 }, 6390 _keyToTileCoords: function (t) { 6391 var e = new j(+(t = t.split(":"))[0], +t[1]); 6392 return ((e.z = +t[2]), e); 6393 }, 6394 _removeTile: function (t) { 6395 var e = this._tiles[t]; 6396 e && 6397 (ie(e.el), 6398 delete this._tiles[t], 6399 this.fire("tileunload", { 6400 tile: e.el, 6401 coords: this._keyToTileCoords(t), 6402 })); 6403 }, 6404 _initTile: function (t) { 6405 ae(t, "leaflet-tile"); 6406 var e = this.getTileSize(); 6407 ((t.style.width = e.x + "px"), 6408 (t.style.height = e.y + "px"), 6409 (t.onselectstart = l), 6410 (t.onmousemove = l), 6411 zt.ielt9 && 6412 this.options.opacity < 1 && 6413 de(t, this.options.opacity)); 6414 }, 6415 _addTile: function (t, e) { 6416 var i = this._getTilePos(t), 6417 n = this._tileCoordsToKey(t), 6418 s = this.createTile( 6419 this._wrapCoords(t), 6420 o(this._tileReady, this, t), 6421 ); 6422 (this._initTile(s), 6423 this.createTile.length < 2 && 6424 C(o(this._tileReady, this, t, null, s)), 6425 _e(s, i), 6426 (this._tiles[n] = { el: s, coords: t, current: !0 }), 6427 e.appendChild(s), 6428 this.fire("tileloadstart", { tile: s, coords: t })); 6429 }, 6430 _tileReady: function (t, e, i) { 6431 e && this.fire("tileerror", { error: e, tile: i, coords: t }); 6432 var n = this._tileCoordsToKey(t); 6433 (i = this._tiles[n]) && 6434 ((i.loaded = +new Date()), 6435 this._map._fadeAnimated 6436 ? (de(i.el, 0), 6437 T(this._fadeFrame), 6438 (this._fadeFrame = C(this._updateOpacity, this))) 6439 : ((i.active = !0), this._pruneTiles()), 6440 e || 6441 (ae(i.el, "leaflet-tile-loaded"), 6442 this.fire("tileload", { tile: i.el, coords: t })), 6443 this._noTilesToLoad() && 6444 ((this._loading = !1), 6445 this.fire("load"), 6446 zt.ielt9 || !this._map._fadeAnimated 6447 ? C(this._pruneTiles, this) 6448 : setTimeout(o(this._pruneTiles, this), 250))); 6449 }, 6450 _getTilePos: function (t) { 6451 return t 6452 .scaleBy(this.getTileSize()) 6453 .subtract(this._level.origin); 6454 }, 6455 _wrapCoords: function (t) { 6456 var e = new j( 6457 this._wrapX ? h(t.x, this._wrapX) : t.x,
6458 this._wrapY ? h(t.y, this._wrapY) : t.y, 6459 ); 6460 return ((e.z = t.z), e); 6461 }, 6462 _pxBoundsToTileRange: function (t) { 6463 var e = this.getTileSize(); 6464 return new B( 6465 t.min.unscaleBy(e).floor(), 6466 t.max.unscaleBy(e).ceil().subtract([1, 1]), 6467 ); 6468 }, 6469 _noTilesToLoad: function () { 6470 for (var t in this._tiles) 6471 if (!this._tiles[t].loaded) return !1; 6472 return !0; 6473 }, 6474 }), 6475 Ri = Oi.extend({ 6476 options: { 6477 minZoom: 0, 6478 maxZoom: 18, 6479 subdomains: "abc", 6480 errorTileUrl: "", 6481 zoomOffset: 0, 6482 tms: !1, 6483 zoomReverse: !1, 6484 detectRetina: !1, 6485 crossOrigin: !1, 6486 referrerPolicy: !1, 6487 }, 6488 initialize: function (t, e) { 6489 ((this._url = t), 6490 (e = p(this, e)).detectRetina && zt.retina && 0 < e.maxZoom 6491 ? ((e.tileSize = Math.floor(e.tileSize / 2)), 6492 e.zoomReverse 6493 ? (e.zoomOffset--, 6494 (e.minZoom = Math.min(e.maxZoom, e.minZoom + 1))) 6495 : (e.zoomOffset++, 6496 (e.maxZoom = Math.max(e.minZoom, e.maxZoom - 1))), 6497 (e.minZoom = Math.max(0, e.minZoom))) 6498 : e.zoomReverse 6499 ? (e.minZoom = Math.min(e.maxZoom, e.minZoom)) 6500 : (e.maxZoom = Math.max(e.minZoom, e.maxZoom)), 6501 "string" == typeof e.subdomains && 6502 (e.subdomains = e.subdomains.split("")), 6503 this.on("tileunload", this._onTileRemove)); 6504 }, 6505 setUrl: function (t, e) { 6506 return ( 6507 this._url === t && void 0 === e && (e = !0), 6508 (this._url = t), 6509 e || this.redraw(), 6510 this 6511 ); 6512 }, 6513 createTile: function (t, e) { 6514 var i = document.createElement("img"); 6515 return ( 6516 Pe(i, "load", o(this._tileOnLoad, this, e, i)), 6517 Pe(i, "error", o(this._tileOnError, this, e, i)), 6518 (!this.options.crossOrigin && 6519 "" !== this.options.crossOrigin) || 6520 (i.crossOrigin = 6521 !0 === this.options.crossOrigin 6522 ? "" 6523 : this.options.crossOrigin), 6524 "string" == typeof this.options.referrerPolicy && 6525 (i.referrerPolicy = this.options.referrerPolicy), 6526 (i.alt = ""), 6527 (i.src = this.getTileUrl(t)), 6528 i 6529 ); 6530 }, 6531 getTileUrl: function (t) { 6532 var i = { 6533 r: zt.retina ? "@2x" : "", 6534 s: this._getSubdomain(t), 6535 x: t.x, 6536 y: t.y, 6537 z: this._getZoomForUrl(), 6538 }; 6539 return ( 6540 this._map && 6541 !this._map.options.crs.infinite && 6542 ((t = this._globalTileRange.max.y - t.y), 6543 this.options.tms && (i.y = t), 6544 (i["-y"] = t)), 6545 f(this._url, e(i, this.options)) 6546 ); 6547 }, 6548 _tileOnLoad: function (t, e) { 6549 zt.ielt9 ? setTimeout(o(t, this, null, e), 0) : t(null, e); 6550 }, 6551 _tileOnError: function (t, e, i) { 6552 var n = this.options.errorTileUrl; 6553 (n && e.getAttribute("src") !== n && (e.src = n), t(i, e)); 6554 }, 6555 _onTileRemove: function (t) { 6556 t.tile.onload = null; 6557 }, 6558 _getZoomForUrl: function () { 6559 var t = this._tileZoom, 6560 e = this.options.maxZoom; 6561 return ( 6562 (t = this.options.zoomReverse ? e - t : t) + 6563 this.options.zoomOffset 6564 ); 6565 }, 6566 _getSubdomain: function (t) { 6567 return ( 6568 (t = Math.abs(t.x + t.y) % this.options.subdomains.length), 6569 this.options.subdomains[t] 6570 ); 6571 }, 6572 _abortLoading: function () { 6573 var t, e, i; 6574 for (t in this._tiles) 6575 this._tiles[t].coords.z !== this._tileZoom && 6576 (((i = this._tiles[t].el).onload = l), 6577 (i.onerror = l), 6578 i.complete || 6579 ((i.src = v), 6580 (e = this._tiles[t].coords), 6581 ie(i), 6582 delete this._tiles[t], 6583 this.fire("tileabort", { tile: i, coords: e }))); 6584 }, 6585 _removeTile: function (t) { 6586 var e = this._tiles[t]; 6587 if (e) 6588 return ( 6589 e.el.setAttribute("src", v), 6590 Oi.prototype._removeTile.call(this, t) 6591 ); 6592 }, 6593 _tileReady: function (t, e, i) { 6594 if (this._map && (!i || i.getAttribute("src") !== v)) 6595 return Oi.prototype._tileReady.call(this, t, e, i); 6596 }, 6597 }); 6598 function Di(t, e) { 6599 return new Ri(t, e); 6600 } 6601 var Ni = Ri.extend({ 6602 defaultWmsParams: { 6603 service: "WMS", 6604 request: "GetMap", 6605 layers: "", 6606 styles: "", 6607 format: "image/jpeg", 6608 transparent: !1, 6609 version: "1.1.1", 6610 }, 6611 options: { crs: null, uppercase: !1 },
6612 initialize: function (t, i) { 6613 this._url = t; 6614 var n, 6615 o = e({}, this.defaultWmsParams); 6616 for (n in i) n in this.options || (o[n] = i[n]); 6617 t = (i = p(this, i)).detectRetina && zt.retina ? 2 : 1; 6618 var s = this.getTileSize(); 6619 ((o.width = s.x * t), (o.height = s.y * t), (this.wmsParams = o)); 6620 }, 6621 onAdd: function (t) { 6622 ((this._crs = this.options.crs || t.options.crs), 6623 (this._wmsVersion = parseFloat(this.wmsParams.version))); 6624 var e = 1.3 <= this._wmsVersion ? "crs" : "srs"; 6625 ((this.wmsParams[e] = this._crs.code), 6626 Ri.prototype.onAdd.call(this, t)); 6627 }, 6628 getTileUrl: function (t) { 6629 var e = this._tileCoordsToNwSe(t), 6630 i = 6631 ((e = (i = Z((i = this._crs).project(e[0]), i.project(e[1]))) 6632 .min), 6633 i.max); 6634 return ( 6635 (e = ( 6636 1.3 <= this._wmsVersion && this._crs === hi 6637 ? [e.y, e.x, i.y, i.x] 6638 : [e.x, e.y, i.x, i.y] 6639 ).join(",")), 6640 (i = Ri.prototype.getTileUrl.call(this, t)) + 6641 _(this.wmsParams, i, this.options.uppercase) + 6642 (this.options.uppercase ? "&BBOX=" : "&bbox=") + 6643 e 6644 ); 6645 }, 6646 setParams: function (t, i) { 6647 return (e(this.wmsParams, t), i || this.redraw(), this); 6648 }, 6649 }); 6650 ((Ri.WMS = Ni), 6651 (Di.wms = function (t, e) { 6652 return new Ni(t, e); 6653 })); 6654 var Qi = lt.extend({ 6655 options: { padding: 0.1 }, 6656 initialize: function (t) { 6657 (p(this, t), r(this), (this._layers = this._layers || {})); 6658 }, 6659 onAdd: function () { 6660 (this._container || 6661 (this._initContainer(), 6662 ae(this._container, "leaflet-zoom-animated")), 6663 this.getPane().appendChild(this._container), 6664 this._update(), 6665 this.on("update", this._updatePaths, this)); 6666 }, 6667 onRemove: function () { 6668 (this.off("update", this._updatePaths, this), 6669 this._destroyContainer()); 6670 }, 6671 getEvents: function () { 6672 var t = { 6673 viewreset: this._reset, 6674 zoom: this._onZoom, 6675 moveend: this._update, 6676 zoomend: this._onZoomEnd, 6677 }; 6678 return ( 6679 this._zoomAnimated && (t.zoomanim = this._onAnimZoom), 6680 t 6681 ); 6682 }, 6683 _onAnimZoom: function (t) { 6684 this._updateTransform(t.center, t.zoom); 6685 }, 6686 _onZoom: function () { 6687 this._updateTransform( 6688 this._map.getCenter(), 6689 this._map.getZoom(), 6690 ); 6691 }, 6692 _updateTransform: function (t, e) { 6693 var i = this._map.getZoomScale(e, this._zoom), 6694 n = this._map 6695 .getSize() 6696 .multiplyBy(0.5 + this.options.padding), 6697 o = this._map.project(this._center, e); 6698 ((n = n 6699 .multiplyBy(-i) 6700 .add(o) 6701 .subtract(this._map._getNewPixelOrigin(t, e))), 6702 zt.any3d 6703 ? pe(this._container, n, i) 6704 : _e(this._container, n)); 6705 }, 6706 _reset: function () { 6707 for (var t in (this._update(), 6708 this._updateTransform(this._center, this._zoom), 6709 this._layers)) 6710 this._layers[t]._reset(); 6711 }, 6712 _onZoomEnd: function () { 6713 for (var t in this._layers) this._layers[t]._project(); 6714 }, 6715 _updatePaths: function () { 6716 for (var t in this._layers) this._layers[t]._update(); 6717 }, 6718 _update: function () { 6719 var t = this.options.padding, 6720 e = this._map.getSize(), 6721 i = this._map 6722 .containerPointToLayerPoint(e.multiplyBy(-t)) 6723 .round(); 6724 ((this._bounds = new B( 6725 i, 6726 i.add(e.multiplyBy(1 + 2 * t)).round(), 6727 )), 6728 (this._center = this._map.getCenter()), 6729 (this._zoom = this._map.getZoom())); 6730 }, 6731 }), 6732 Fi = Qi.extend({ 6733 options: { tolerance: 0 }, 6734 getEvents: function () { 6735 var t = Qi.prototype.getEvents.call(this); 6736 return ((t.viewprereset = this._onViewPreReset), t); 6737 }, 6738 _onViewPreReset: function () { 6739 this._postponeUpdatePaths = !0; 6740 }, 6741 onAdd: function () { 6742 (Qi.prototype.onAdd.call(this), this._draw()); 6743 }, 6744 _initContainer: function () { 6745 var t = (this._container = document.createElement("canvas")); 6746 (Pe(t, "mousemove", this._onMouseMove, this), 6747 Pe( 6748 t, 6749 "click dblclick mousedown mouseup contextmenu", 6750 this._onClick, 6751 this, 6752 ), 6753 Pe(t, "mouseout", this._handleMouseOut, this), 6754 (t._leaflet_disable_events = !0), 6755 (this._ctx = t.getContext("2d"))); 6756 }, 6757 _destroyContainer: function () { 6758 (T(this._redrawRequest), 6759 delete this._ctx, 6760 ie(this._container), 6761 ke(this._container), 6762 delete this._container); 6763 }, 6764 _updatePaths: function () { 6765 if (!this._postponeUpdatePaths) { 6766 for (var t in ((this._redrawBounds = null), this._layers)) 6767 this._layers[t]._update(); 6768 this._redraw(); 6769 } 6770 }, 6771 _update: function () { 6772 var t, e, i, n; 6773 (this._map._animatingZoom && this._bounds) || 6774 (Qi.prototype._update.call(this), 6775 (t = this._bounds), 6776 (e = this._container), 6777 (i = t.getSize()), 6778 (n = zt.retina ? 2 : 1), 6779 _e(e, t.min), 6780 (e.width = n * i.x), 6781 (e.height = n * i.y), 6782 (e.style.width = i.x + "px"), 6783 (e.style.height = i.y + "px"), 6784 zt.retina && this._ctx.scale(2, 2), 6785 this._ctx.translate(-t.min.x, -t.min.y), 6786 this.fire("update")); 6787 }, 6788 _reset: function () { 6789 (Qi.prototype._reset.call(this), 6790 this._postponeUpdatePaths && 6791 ((this._postponeUpdatePaths = !1), this._updatePaths())); 6792 }, 6793 _initPath: function (t) { 6794 (this._updateDashArray(t), 6795 (t = (this._layers[r(t)] = t)._order = 6796 { layer: t, prev: this._drawLast, next: null }), 6797 this._drawLast && (this._drawLast.next = t), 6798 (this._drawLast = t), 6799 (this._drawFirst = this._drawFirst || this._drawLast)); 6800 }, 6801 _addPath: function (t) { 6802 this._requestRedraw(t); 6803 }, 6804 _removePath: function (t) { 6805 var e = (i = t._order).next, 6806 i = i.prev; 6807 (e ? (e.prev = i) : (this._drawLast = i), 6808 i ? (i.next = e) : (this._drawFirst = e), 6809 delete t._order, 6810 delete this._layers[r(t)], 6811 this._requestRedraw(t)); 6812 }, 6813 _updatePath: function (t) { 6814 (this._extendRedrawBounds(t), 6815 t._project(), 6816 t._update(), 6817 this._requestRedraw(t)); 6818 }, 6819 _updateStyle: function (t) { 6820 (this._updateDashArray(t), this._requestRedraw(t)); 6821 }, 6822 _updateDashArray: function (t) { 6823 if ("string" == typeof t.options.dashArray) { 6824 for ( 6825 var e, 6826 i = t.options.dashArray.split(/[, ]+/), 6827 n = [], 6828 o = 0; 6829 o < i.length; 6830 o++ 6831 ) {
6832 if (((e = Number(i[o])), isNaN(e))) return; 6833 n.push(e); 6834 } 6835 t.options._dashArray = n; 6836 } else t.options._dashArray = t.options.dashArray; 6837 }, 6838 _requestRedraw: function (t) { 6839 this._map && 6840 (this._extendRedrawBounds(t), 6841 (this._redrawRequest = 6842 this._redrawRequest || C(this._redraw, this))); 6843 }, 6844 _extendRedrawBounds: function (t) { 6845 var e; 6846 t._pxBounds && 6847 ((e = (t.options.weight || 0) + 1), 6848 (this._redrawBounds = this._redrawBounds || new B()), 6849 this._redrawBounds.extend(t._pxBounds.min.subtract([e, e])), 6850 this._redrawBounds.extend(t._pxBounds.max.add([e, e]))); 6851 }, 6852 _redraw: function () { 6853 ((this._redrawRequest = null), 6854 this._redrawBounds && 6855 (this._redrawBounds.min._floor(), 6856 this._redrawBounds.max._ceil()), 6857 this._clear(), 6858 this._draw(), 6859 (this._redrawBounds = null)); 6860 }, 6861 _clear: function () { 6862 var t, 6863 e = this._redrawBounds; 6864 e 6865 ? ((t = e.getSize()), 6866 this._ctx.clearRect(e.min.x, e.min.y, t.x, t.y)) 6867 : (this._ctx.save(), 6868 this._ctx.setTransform(1, 0, 0, 1, 0, 0), 6869 this._ctx.clearRect( 6870 0, 6871 0, 6872 this._container.width, 6873 this._container.height, 6874 ), 6875 this._ctx.restore()); 6876 }, 6877 _draw: function () { 6878 var t, 6879 e, 6880 i = this._redrawBounds; 6881 (this._ctx.save(), 6882 i && 6883 ((e = i.getSize()), 6884 this._ctx.beginPath(), 6885 this._ctx.rect(i.min.x, i.min.y, e.x, e.y), 6886 this._ctx.clip()), 6887 (this._drawing = !0)); 6888 for (var n = this._drawFirst; n; n = n.next) 6889 ((t = n.layer), 6890 (!i || (t._pxBounds && t._pxBounds.intersects(i))) && 6891 t._updatePath()); 6892 ((this._drawing = !1), this._ctx.restore()); 6893 }, 6894 _updatePoly: function (t, e) { 6895 if (this._drawing) { 6896 var i, 6897 n, 6898 o, 6899 s, 6900 r = t._parts, 6901 a = r.length, 6902 h = this._ctx; 6903 if (a) { 6904 for (h.beginPath(), i = 0; i < a; i++) { 6905 for (n = 0, o = r[i].length; n < o; n++) 6906 ((s = r[i][n]), h[n ? "lineTo" : "moveTo"](s.x, s.y)); 6907 e && h.closePath(); 6908 } 6909 this._fillStroke(h, t); 6910 } 6911 } 6912 }, 6913 _updateCircle: function (t) { 6914 var e, i, n, o; 6915 this._drawing && 6916 !t._empty() && 6917 ((e = t._point), 6918 (i = this._ctx), 6919 (n = Math.max(Math.round(t._radius), 1)), 6920 1 != (o = (Math.max(Math.round(t._radiusY), 1) || n) / n) && 6921 (i.save(), i.scale(1, o)), 6922 i.beginPath(), 6923 i.arc(e.x, e.y / o, n, 0, 2 * Math.PI, !1), 6924 1 != o && i.restore(), 6925 this._fillStroke(i, t)); 6926 }, 6927 _fillStroke: function (t, e) { 6928 var i = e.options; 6929 (i.fill && 6930 ((t.globalAlpha = i.fillOpacity), 6931 (t.fillStyle = i.fillColor || i.color), 6932 t.fill(i.fillRule || "evenodd")), 6933 i.stroke && 6934 0 !== i.weight && 6935 (t.setLineDash && 6936 t.setLineDash((e.options && e.options._dashArray) || []), 6937 (t.globalAlpha = i.opacity), 6938 (t.lineWidth = i.weight),
6939 (t.strokeStyle = i.color), 6940 (t.lineCap = i.lineCap), 6941 (t.lineJoin = i.lineJoin), 6942 t.stroke())); 6943 }, 6944 _onClick: function (t) { 6945 for ( 6946 var e, 6947 i, 6948 n = this._map.mouseEventToLayerPoint(t), 6949 o = this._drawFirst; 6950 o; 6951 o = o.next 6952 ) 6953 (e = o.layer).options.interactive && 6954 e._containsPoint(n) && 6955 ((("click" === t.type || "preclick" === t.type) && 6956 this._map._draggableMoved(e)) || 6957 (i = e)); 6958 this._fireEvent(!!i && [i], t); 6959 }, 6960 _onMouseMove: function (t) { 6961 var e; 6962 !this._map || 6963 this._map.dragging.moving() || 6964 this._map._animatingZoom || 6965 ((e = this._map.mouseEventToLayerPoint(t)), 6966 this._handleMouseHover(t, e)); 6967 }, 6968 _handleMouseOut: function (t) { 6969 var e = this._hoveredLayer; 6970 e && 6971 (he(this._container, "leaflet-interactive"), 6972 this._fireEvent([e], t, "mouseout"), 6973 (this._hoveredLayer = null), 6974 (this._mouseHoverThrottled = !1)); 6975 }, 6976 _handleMouseHover: function (t, e) { 6977 if (!this._mouseHoverThrottled) { 6978 for (var i, n, s = this._drawFirst; s; s = s.next) 6979 (i = s.layer).options.interactive && 6980 i._containsPoint(e) && 6981 (n = i); 6982 (n !== this._hoveredLayer && 6983 (this._handleMouseOut(t), 6984 n && 6985 (ae(this._container, "leaflet-interactive"), 6986 this._fireEvent([n], t, "mouseover"), 6987 (this._hoveredLayer = n))), 6988 this._fireEvent( 6989 !!this._hoveredLayer && [this._hoveredLayer], 6990 t, 6991 ), 6992 (this._mouseHoverThrottled = !0), 6993 setTimeout( 6994 o(function () { 6995 this._mouseHoverThrottled = !1; 6996 }, this), 6997 32, 6998 )); 6999 } 7000 }, 7001 _fireEvent: function (t, e, i) { 7002 this._map._fireDOMEvent(e, i || e.type, t); 7003 }, 7004 _bringToFront: function (t) { 7005 var e, 7006 i, 7007 n = t._order; 7008 n && 7009 ((e = n.next), 7010 (i = n.prev), 7011 e && 7012 ((e.prev = i) ? (i.next = e) : e && (this._drawFirst = e), 7013 (n.prev = this._drawLast), 7014 ((this._drawLast.next = n).next = null), 7015 (this._drawLast = n), 7016 this._requestRedraw(t))); 7017 }, 7018 _bringToBack: function (t) { 7019 var e, 7020 i, 7021 n = t._order; 7022 n && 7023 ((e = n.next), 7024 (i = n.prev) && 7025 ((i.next = e) ? (e.prev = i) : i && (this._drawLast = i), 7026 (n.prev = null), 7027 (n.next = this._drawFirst), 7028 (this._drawFirst.prev = n), 7029 (this._drawFirst = n), 7030 this._requestRedraw(t))); 7031 }, 7032 }); 7033 function Wi(t) { 7034 return zt.canvas ? new Fi(t) : null; 7035 } 7036 var qi = (function () { 7037 try { 7038 return ( 7039 document.namespaces.add( 7040 "lvml", 7041 "urn:schemas-microsoft-com:vml", 7042 ), 7043 function (t) { 7044 return document.createElement( 7045 "<lvml:" + t + ' class="lvml">', 7046 ); 7047 } 7048 ); 7049 } catch (t) {} 7050 return function (t) { 7051 return document.createElement( 7052 "<" + 7053 t + 7054 ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">', 7055 ); 7056 }; 7057 })(), 7058 Hi = 7059 ((ut = { 7060 _initContainer: function () { 7061 this._container = ee("div", "leaflet-vml-container"); 7062 }, 7063 _update: function () { 7064 this._map._animatingZoom || 7065 (Qi.prototype._update.call(this), this.fire("update")); 7066 }, 7067 _initPath: function (t) { 7068 var e = (t._container = qi("shape")); 7069 (ae(e, "leaflet-vml-shape " + (this.options.className || "")), 7070 (e.coordsize = "1 1"), 7071 (t._path = qi("path")), 7072 e.appendChild(t._path), 7073 this._updateStyle(t), 7074 (this._layers[r(t)] = t)); 7075 }, 7076 _addPath: function (t) { 7077 var e = t._container; 7078 (this._container.appendChild(e), 7079 t.options.interactive && t.addInteractiveTarget(e)); 7080 }, 7081 _removePath: function (t) { 7082 var e = t._container; 7083 (ie(e), 7084 t.removeInteractiveTarget(e), 7085 delete this._layers[r(t)]); 7086 }, 7087 _updateStyle: function (t) { 7088 var e = t._stroke, 7089 i = t._fill, 7090 n = t.options, 7091 o = t._container; 7092 ((o.stroked = !!n.stroke), 7093 (o.filled = !!n.fill), 7094 n.stroke 7095 ? ((e = e || (t._stroke = qi("stroke"))), 7096 o.appendChild(e), 7097 (e.weight = n.weight + "px"), 7098 (e.color = n.color), 7099 (e.opacity = n.opacity), 7100 n.dashArray 7101 ? (e.dashStyle = g(n.dashArray) 7102 ? n.dashArray.join(" ") 7103 : n.dashArray.replace(/( *, *)/g, " ")) 7104 : (e.dashStyle = ""), 7105 (e.endcap = n.lineCap.replace("butt", "flat")), 7106 (e.joinstyle = n.lineJoin)) 7107 : e && (o.removeChild(e), (t._stroke = null)), 7108 n.fill 7109 ? ((i = i || (t._fill = qi("fill"))), 7110 o.appendChild(i), 7111 (i.color = n.fillColor || n.color),
7112 (i.opacity = n.fillOpacity)) 7113 : i && (o.removeChild(i), (t._fill = null))); 7114 }, 7115 _updateCircle: function (t) { 7116 var e = t._point.round(), 7117 i = Math.round(t._radius), 7118 n = Math.round(t._radiusY || i); 7119 this._setPath( 7120 t, 7121 t._empty() 7122 ? "M0 0" 7123 : "AL " + 7124 e.x + 7125 "," + 7126 e.y + 7127 " " + 7128 i + 7129 "," + 7130 n + 7131 " 0,23592600", 7132 ); 7133 }, 7134 _setPath: function (t, e) { 7135 t._path.v = e; 7136 }, 7137 _bringToFront: function (t) { 7138 oe(t._container); 7139 }, 7140 _bringToBack: function (t) { 7141 se(t._container); 7142 }, 7143 }), 7144 zt.vml ? qi : V), 7145 Ui = Qi.extend({ 7146 _initContainer: function () { 7147 ((this._container = Hi("svg")), 7148 this._container.setAttribute("pointer-events", "none"), 7149 (this._rootGroup = Hi("g")), 7150 this._container.appendChild(this._rootGroup)); 7151 }, 7152 _destroyContainer: function () { 7153 (ie(this._container), 7154 ke(this._container), 7155 delete this._container, 7156 delete this._rootGroup, 7157 delete this._svgSize); 7158 }, 7159 _update: function () { 7160 var t, e, i; 7161 (this._map._animatingZoom && this._bounds) || 7162 (Qi.prototype._update.call(this), 7163 (e = (t = this._bounds).getSize()), 7164 (i = this._container), 7165 (this._svgSize && this._svgSize.equals(e)) || 7166 ((this._svgSize = e), 7167 i.setAttribute("width", e.x), 7168 i.setAttribute("height", e.y)), 7169 _e(i, t.min), 7170 i.setAttribute( 7171 "viewBox", 7172 [t.min.x, t.min.y, e.x, e.y].join(" "), 7173 ), 7174 this.fire("update")); 7175 }, 7176 _initPath: function (t) { 7177 var e = (t._path = Hi("path")); 7178 (t.options.className && ae(e, t.options.className), 7179 t.options.interactive && ae(e, "leaflet-interactive"), 7180 this._updateStyle(t), 7181 (this._layers[r(t)] = t)); 7182 }, 7183 _addPath: function (t) { 7184 (this._rootGroup || this._initContainer(), 7185 this._rootGroup.appendChild(t._path), 7186 t.addInteractiveTarget(t._path)); 7187 }, 7188 _removePath: function (t) { 7189 (ie(t._path), 7190 t.removeInteractiveTarget(t._path), 7191 delete this._layers[r(t)]); 7192 }, 7193 _updatePath: function (t) { 7194 (t._project(), t._update()); 7195 }, 7196 _updateStyle: function (t) { 7197 var e = t._path; 7198 ((t = t.options), 7199 e && 7200 (t.stroke 7201 ? (e.setAttribute("stroke", t.color), 7202 e.setAttribute("stroke-opacity", t.opacity), 7203 e.setAttribute("stroke-width", t.weight), 7204 e.setAttribute("stroke-linecap", t.lineCap), 7205 e.setAttribute("stroke-linejoin", t.lineJoin), 7206 t.dashArray 7207 ? e.setAttribute("stroke-dasharray", t.dashArray) 7208 : e.removeAttribute("stroke-dasharray"), 7209 t.dashOffset 7210 ? e.setAttribute("stroke-dashoffset", t.dashOffset) 7211 : e.removeAttribute("stroke-dashoffset")) 7212 : e.setAttribute("stroke", "none"), 7213 t.fill 7214 ? (e.setAttribute("fill", t.fillColor || t.color), 7215 e.setAttribute("fill-opacity", t.fillOpacity), 7216 e.setAttribute("fill-rule", t.fillRule || "evenodd")) 7217 : e.setAttribute("fill", "none"))); 7218 }, 7219 _updatePoly: function (t, e) { 7220 this._setPath(t, $(t._parts, e)); 7221 }, 7222 _updateCircle: function (t) { 7223 var e = t._point, 7224 i = Math.max(Math.round(t._radius), 1), 7225 n = 7226 "a" + 7227 i + 7228 "," + 7229 (Math.max(Math.round(t._radiusY), 1) || i) + 7230 " 0 1,0 "; 7231 ((e = t._empty() 7232 ? "M0 0" 7233 : "M" + 7234 (e.x - i) + 7235 "," + 7236 e.y + 7237 n + 7238 2 * i + 7239 ",0 " + 7240 n + 7241 2 * -i + 7242 ",0 "), 7243 this._setPath(t, e)); 7244 }, 7245 _setPath: function (t, e) { 7246 t._path.setAttribute("d", e); 7247 }, 7248 _bringToFront: function (t) { 7249 oe(t._path); 7250 }, 7251 _bringToBack: function (t) { 7252 se(t._path); 7253 }, 7254 }); 7255 function Gi(t) { 7256 return zt.svg || zt.vml ? new Ui(t) : null; 7257 } 7258 (zt.vml && Ui.include(ut), 7259 Ne.include({ 7260 getRenderer: function (t) { 7261 return ( 7262 (t = 7263 (t = 7264 t.options.renderer || 7265 this._getPaneRenderer(t.options.pane) || 7266 this.options.renderer || 7267 this._renderer) || 7268 (this._renderer = this._createRenderer())), 7269 this.hasLayer(t) || this.addLayer(t), 7270 t 7271 ); 7272 }, 7273 _getPaneRenderer: function (t) { 7274 var e; 7275 return ( 7276 "overlayPane" !== t && 7277 void 0 !== t && 7278 (void 0 === (e = this._paneRenderers[t]) && 7279 ((e = this._createRenderer({ pane: t })), 7280 (this._paneRenderers[t] = e)), 7281 e) 7282 ); 7283 }, 7284 _createRenderer: function (t) { 7285 return (this.options.preferCanvas && Wi(t)) || Gi(t); 7286 }, 7287 })); 7288 var Vi = vi.extend({ 7289 initialize: function (t, e) { 7290 vi.prototype.initialize.call(this, this._boundsToLatLngs(t), e); 7291 }, 7292 setBounds: function (t) { 7293 return this.setLatLngs(this._boundsToLatLngs(t)); 7294 }, 7295 _boundsToLatLngs: function (t) { 7296 return [
7297 (t = R(t)).getSouthWest(), 7298 t.getNorthWest(), 7299 t.getNorthEast(), 7300 t.getSouthEast(), 7301 ]; 7302 }, 7303 }); 7304 ((Ui.create = Hi), 7305 (Ui.pointsToPath = $), 7306 (wi.geometryToLayer = xi), 7307 (wi.coordsToLatLng = bi), 7308 (wi.coordsToLatLngs = ki), 7309 (wi.latLngToCoords = Li), 7310 (wi.latLngsToCoords = Ci), 7311 (wi.getFeature = Ti), 7312 (wi.asFeature = zi), 7313 Ne.mergeOptions({ boxZoom: !0 }), 7314 (K = X.extend({ 7315 initialize: function (t) { 7316 ((this._map = t), 7317 (this._container = t._container), 7318 (this._pane = t._panes.overlayPane), 7319 (this._resetStateTimeout = 0), 7320 t.on("unload", this._destroy, this)); 7321 }, 7322 addHooks: function () { 7323 Pe(this._container, "mousedown", this._onMouseDown, this); 7324 }, 7325 removeHooks: function () { 7326 ke(this._container, "mousedown", this._onMouseDown, this); 7327 }, 7328 moved: function () { 7329 return this._moved; 7330 }, 7331 _destroy: function () { 7332 (ie(this._pane), delete this._pane); 7333 }, 7334 _resetState: function () { 7335 ((this._resetStateTimeout = 0), (this._moved = !1)); 7336 }, 7337 _clearDeferredResetState: function () { 7338 0 !== this._resetStateTimeout && 7339 (clearTimeout(this._resetStateTimeout), 7340 (this._resetStateTimeout = 0)); 7341 }, 7342 _onMouseDown: function (t) { 7343 if (!t.shiftKey || (1 !== t.which && 1 !== t.button)) return !1; 7344 (this._clearDeferredResetState(), 7345 this._resetState(), 7346 Ut(), 7347 fe(), 7348 (this._startPoint = this._map.mouseEventToContainerPoint(t)), 7349 Pe( 7350 document, 7351 { 7352 contextmenu: Ee, 7353 mousemove: this._onMouseMove, 7354 mouseup: this._onMouseUp, 7355 keydown: this._onKeyDown, 7356 }, 7357 this, 7358 )); 7359 }, 7360 _onMouseMove: function (t) { 7361 (this._moved || 7362 ((this._moved = !0), 7363 (this._box = ee("div", "leaflet-zoom-box", this._container)), 7364 ae(this._container, "leaflet-crosshair"), 7365 this._map.fire("boxzoomstart")), 7366 (this._point = this._map.mouseEventToContainerPoint(t))); 7367 var e = (t = new B(this._point, this._startPoint)).getSize(); 7368 (_e(this._box, t.min), 7369 (this._box.style.width = e.x + "px"), 7370 (this._box.style.height = e.y + "px")); 7371 }, 7372 _finish: function () { 7373 (this._moved && 7374 (ie(this._box), he(this._container, "leaflet-crosshair")), 7375 Gt(), 7376 ge(), 7377 ke( 7378 document, 7379 { 7380 contextmenu: Ee, 7381 mousemove: this._onMouseMove, 7382 mouseup: this._onMouseUp, 7383 keydown: this._onKeyDown, 7384 }, 7385 this, 7386 )); 7387 }, 7388 _onMouseUp: function (t) { 7389 (1 !== t.which && 1 !== t.button) || 7390 (this._finish(), 7391 this._moved && 7392 (this._clearDeferredResetState(), 7393 (this._resetStateTimeout = setTimeout( 7394 o(this._resetState, this), 7395 0, 7396 )), 7397 (t = new O( 7398 this._map.containerPointToLatLng(this._startPoint), 7399 this._map.containerPointToLatLng(this._point), 7400 )), 7401 this._map 7402 .fitBounds(t) 7403 .fire("boxzoomend", { boxZoomBounds: t }))); 7404 }, 7405 _onKeyDown: function (t) { 7406 27 === t.keyCode && 7407 (this._finish(), 7408 this._clearDeferredResetState(), 7409 this._resetState()); 7410 }, 7411 })), 7412 Ne.addInitHook("addHandler", "boxZoom", K), 7413 Ne.mergeOptions({ doubleClickZoom: !0 }), 7414 (pt = X.extend({ 7415 addHooks: function () { 7416 this._map.on("dblclick", this._onDoubleClick, this); 7417 }, 7418 removeHooks: function () { 7419 this._map.off("dblclick", this._onDoubleClick, this); 7420 }, 7421 _onDoubleClick: function (t) { 7422 var e = this._map, 7423 i = e.getZoom(), 7424 n = e.options.zoomDelta; 7425 ((i = t.originalEvent.shiftKey ? i - n : i + n), 7426 "center" === e.options.doubleClickZoom 7427 ? e.setZoom(i) 7428 : e.setZoomAround(t.containerPoint, i)); 7429 }, 7430 }))); 7431 var $i = 7432 (Ne.addInitHook("addHandler", "doubleClickZoom", pt), 7433 Ne.mergeOptions({ 7434 dragging: !0, 7435 inertia: !0, 7436 inertiaDeceleration: 3400, 7437 inertiaMaxSpeed: 1 / 0, 7438 easeLinearity: 0.2, 7439 worldCopyJump: !1, 7440 maxBoundsViscosity: 0, 7441 }), 7442 X.extend({ 7443 addHooks: function () { 7444 var t; 7445 (this._draggable || 7446 ((t = this._map), 7447 (this._draggable = new $e(t._mapPane, t._container)), 7448 this._draggable.on( 7449 { 7450 dragstart: this._onDragStart, 7451 drag: this._onDrag, 7452 dragend: this._onDragEnd, 7453 }, 7454 this, 7455 ), 7456 this._draggable.on("predrag", this._onPreDragLimit, this), 7457 t.options.worldCopyJump && 7458 (this._draggable.on("predrag", this._onPreDragWrap, this), 7459 t.on("zoomend", this._onZoomEnd, this), 7460 t.whenReady(this._onZoomEnd, this))), 7461 ae(this._map._container, "leaflet-grab leaflet-touch-drag"), 7462 this._draggable.enable(), 7463 (this._positions = []), 7464 (this._times = [])); 7465 }, 7466 removeHooks: function () { 7467 (he(this._map._container, "leaflet-grab"), 7468 he(this._map._container, "leaflet-touch-drag"), 7469 this._draggable.disable()); 7470 }, 7471 moved: function () { 7472 return this._draggable && this._draggable._moved; 7473 }, 7474 moving: function () { 7475 return this._draggable && this._draggable._mov
7475ing; 7476 }, 7477 _onDragStart: function () { 7478 var t, 7479 e = this._map; 7480 (e._stop(), 7481 this._map.options.maxBounds && 7482 this._map.options.maxBoundsViscosity 7483 ? ((t = R(this._map.options.maxBounds)), 7484 (this._offsetLimit = Z( 7485 this._map 7486 .latLngToContainerPoint(t.getNorthWest()) 7487 .multiplyBy(-1), 7488 this._map 7489 .latLngToContainerPoint(t.getSouthEast()) 7490 .multiplyBy(-1) 7491 .add(this._map.getSize()), 7492 )), 7493 (this._viscosity = Math.min( 7494 1, 7495 Math.max(0, this._map.options.maxBoundsViscosity), 7496 ))) 7497 : (this._offsetLimit = null), 7498 e.fire("movestart").fire("dragstart"), 7499 e.options.inertia && 7500 ((this._positions = []), (this._times = []))); 7501 }, 7502 _onDrag: function (t) { 7503 var e, i; 7504 (this._map.options.inertia && 7505 ((e = this._lastTime = +new Date()), 7506 (i = this._lastPos = 7507 this._draggable._absPos || this._draggable._newPos), 7508 this._positions.push(i), 7509 this._times.push(e), 7510 this._prunePositions(e)), 7511 this._map.fire("move", t).fire("drag", t)); 7512 }, 7513 _prunePositions: function (t) { 7514 for ( 7515 ; 7516 1 < this._positions.length && 50 < t - this._times[0]; 7517 ) 7518 (this._positions.shift(), this._times.shift()); 7519 }, 7520 _onZoomEnd: function () { 7521 var t = this._map.getSize().divideBy(2), 7522 e = this._map.latLngToLayerPoint([0, 0]); 7523 ((this._initialWorldOffset = e.subtract(t).x), 7524 (this._worldWidth = this._map 7525 .getPixelWorldBounds() 7526 .getSize().x)); 7527 }, 7528 _viscousLimit: function (t, e) { 7529 return t - (t - e) * this._viscosity; 7530 }, 7531 _onPreDragLimit: function () { 7532 var t, e; 7533 this._viscosity && 7534 this._offsetLimit && 7535 ((t = this._draggable._newPos.subtract( 7536 this._draggable._startPos, 7537 )), 7538 (e = this._offsetLimit), 7539 t.x < e.min.x && (t.x = this._viscousLimit(t.x, e.min.x)), 7540 t.y < e.min.y && (t.y = this._viscousLimit(t.y, e.min.y)), 7541 t.x > e.max.x && (t.x = this._viscousLimit(t.x, e.max.x)), 7542 t.y > e.max.y && (t.y = this._viscousLimit(t.y, e.max.y)), 7543 (this._draggable._newPos = 7544 this._draggable._startPos.add(t))); 7545 }, 7546 _onPreDragWrap: function () { 7547 var t = this._worldWidth, 7548 e = Math.round(t / 2), 7549 i = this._initialWorldOffset, 7550 n = (((o = this._draggable._newPos.x) - e + i) % t) + e - i, 7551 o = ((o + e + i) % t) - e - i; 7552 ((t = Math.abs(n + i) < Math.abs(o + i) ? n : o), 7553 (this._draggable._absPos = this._draggable._newPos.clone()), 7554 (this._draggable._newPos.x = t)); 7555 }, 7556 _onDragEnd: function (t) { 7557 var e, 7558 i, 7559 n, 7560 o, 7561 s = this._map, 7562 r = s.options, 7563 a = !r.inertia || t.noInertia || this._times.length < 2; 7564 (s.fire("dragend", t), 7565 !a && 7566 (this._prunePositions(+new Date()), 7567 (t = this._lastPos.subtract(this._positions[0])), 7568 (a = (this._lastTime - this._times[0]) / 1e3), 7569 (e = r.easeLinearity), 7570 (a = (t = t.multiplyBy(e / a)).distanceTo([0, 0])), 7571 (i = Math.min(r.inertiaMaxSpeed, a)), 7572 (t = t.multiplyBy(i / a)), 7573 (n = i / (r.inertiaDeceleration * e)), 7574 (o = t.multiplyBy(-n / 2).round()).x || o.y) 7575 ? ((o = s._limitOffset(o, s.options.maxBounds)), 7576 C(function () { 7577 s.panBy(o, { 7578 duration: n, 7579 easeLinearity: e, 7580 noMoveStart: !0, 7581 animate: !0, 7582 }); 7583 })) 7584 : s.fire("moveend")); 7585 }, 7586 })), 7587 Ki = 7588 (Ne.addInitHook("addHandler", "dragging", $i), 7589 Ne.mergeOptions({ keyboard: !0, keyboardPanDelta: 80 }), 7590 (_t = X.extend({ 7591 keyCodes: { 7592 left: [37], 7593 right: [39], 7594 down: [40], 7595 up: [38], 7596 zoomIn: [187, 107, 61, 171], 7597 zoomOut: [189, 109, 54, 173], 7598 }, 7599 initialize: function (t) { 7600 ((this._map = t), 7601 this._setPanDelta(t.options.keyboardPanDelta), 7602 this._setZoomDelta(t.options.zoomDelta)); 7603 }, 7604 addHooks: function () { 7605 var t = this._map._container; 7606 (t.tabIndex <= 0 && (t.tabIndex = "0"), 7607 Pe( 7608 t, 7609 { 7610 focus: this._onFocus, 7611 blur: this._onBlur, 7612 mousedown: this._onMouseDown, 7613 }, 7614 this, 7615 ), 7616 this._map.on( 7617 { focus: this._addHooks, blur: this._removeHooks }, 7618 this, 7619 )); 7620 }, 7621 removeHooks: function () { 7622 (this._removeHooks(), 7623 ke( 7624 this._map._container, 7625 { 7626 focus: this._onFocus, 7627 blur: this._onBlur, 7628 mousedown: this._onMouseDown, 7629 }, 7630 this, 7631 ), 7632 this._map.off( 7633 { focus: this._addHooks, blur: this._removeHooks }, 7634 this, 7635 )); 7636 }, 7637 _onMouseDown: function () { 7638 var t, e, i; 7639 this._focused || 7640 ((i = document.body), 7641 (t = document.documentElement), 7642 (e = i.scrollTop || t.scrollTop), 7643 (i = i.scrollLeft || t.scrollLeft), 7644 this._map._container.focus(), 7645 window.scrollTo(i, e)); 7646 }, 7647 _onFocus: function () { 7648 ((this._focused = !0), this._map.fire("focus")); 7649 }, 7650 _onBlur: function () { 7651 ((this._focused = !1), this._map.fire("blur")); 7652 }, 7653 _setPanDelta: function (t) { 7654 for ( 7655 var e = (this._panKeys = {}), 7656 i = this.keyCodes, 7657 n = 0, 7658 o = i.left.length; 7659 n < o; 7660 n++ 7661 ) 7662 e[i.left[n]] = [-1 * t, 0]; 7663 for (n = 0, o = i.right.length; n < o; n++) 7664 e[i.right[n]] = [t, 0]; 7665 for (n = 0, o = i.down.length; n < o; n++) 7666 e[i.down[n]] = [0, t]; 7667 for (n = 0, o = i.up.length; n < o; n++) 7668 e[i.up[n]] = [0, -1 * t]; 7669 }, 7670 _setZoomDelta: function (t) { 7671 for ( 7672 var e = (this._zoomKeys = {}), 7673 i = this.keyCodes, 7674 n = 0, 7675 o = i.zoomIn.length; 7676 n < o; 7677 n++ 7678 ) 7679 e[i.zoomIn[n]] = t; 7680 for (n = 0, o = i.zoomOut.length; n < o; n++) 7681 e[i.zoomOut[n]] = -t; 7682 }, 7683 _addHooks: function () {
7684 Pe(document, "keydown", this._onKeyDown, this); 7685 }, 7686 _removeHooks: function () { 7687 ke(document, "keydown", this._onKeyDown, this); 7688 }, 7689 _onKeyDown: function (t) { 7690 if (!(t.altKey || t.ctrlKey || t.metaKey)) { 7691 var e, 7692 i, 7693 n = t.keyCode, 7694 o = this._map; 7695 if (n in this._panKeys) 7696 (o._panAnim && o._panAnim._inProgress) || 7697 ((i = this._panKeys[n]), 7698 t.shiftKey && (i = A(i).multiplyBy(3)), 7699 o.options.maxBounds && 7700 (i = o._limitOffset(A(i), o.options.maxBounds)), 7701 o.options.worldCopyJump 7702 ? ((e = o.wrapLatLng( 7703 o.unproject(o.project(o.getCenter()).add(i)), 7704 )), 7705 o.panTo(e)) 7706 : o.panBy(i)); 7707 else if (n in this._zoomKeys) 7708 o.setZoom( 7709 o.getZoom() + (t.shiftKey ? 3 : 1) * this._zoomKeys[n], 7710 ); 7711 else { 7712 if ( 7713 27 !== n || 7714 !o._popup || 7715 !o._popup.options.closeOnEscapeKey 7716 ) 7717 return; 7718 o.closePopup(); 7719 } 7720 Ee(t); 7721 } 7722 }, 7723 })), 7724 Ne.addInitHook("addHandler", "keyboard", _t), 7725 Ne.mergeOptions({ 7726 scrollWheelZoom: !0, 7727 wheelDebounceTime: 40, 7728 wheelPxPerZoomLevel: 60, 7729 }), 7730 (mt = X.extend({ 7731 addHooks: function () { 7732 (Pe(this._map._container, "wheel", this._onWheelScroll, this), 7733 (this._delta = 0)); 7734 }, 7735 removeHooks: function () { 7736 ke(this._map._container, "wheel", this._onWheelScroll, this); 7737 }, 7738 _onWheelScroll: function (t) { 7739 var e = Oe(t), 7740 i = this._map.options.wheelDebounceTime; 7741 ((this._delta += e), 7742 (this._lastMousePos = 7743 this._map.mouseEventToContainerPoint(t)), 7744 this._startTime || (this._startTime = +new Date()), 7745 (e = Math.max(i - (+new Date() - this._startTime), 0)), 7746 clearTimeout(this._timer), 7747 (this._timer = setTimeout(o(this._performZoom, this), e)), 7748 Ee(t)); 7749 }, 7750 _performZoom: function () { 7751 var t = this._map, 7752 e = t.getZoom(), 7753 i = this._map.options.zoomSnap || 0, 7754 n = 7755 (t._stop(), 7756 this._delta / 7757 (4 * this._map.options.wheelPxPerZoomLevel)); 7758 ((n = 7759 (4 * Math.log(2 / (1 + Math.exp(-Math.abs(n))))) / 7760 Math.LN2), 7761 (i = i ? Math.ceil(n / i) * i : n), 7762 (n = t._limitZoom(e + (0 < this._delta ? i : -i)) - e), 7763 (this._delta = 0), 7764 (this._startTime = null), 7765 n && 7766 ("center" === t.options.scrollWheelZoom 7767 ? t.setZoom(e + n) 7768 : t.setZoomAround(this._lastMousePos, e + n))); 7769 }, 7770 })), 7771 Ne.addInitHook("addHandler", "scrollWheelZoom", mt), 7772 Ne.mergeOptions({ 7773 tapHold: zt.touchNative && zt.safari && zt.mobile, 7774 tapTolerance: 15, 7775 }), 7776 (ft = X.extend({ 7777 addHooks: function () { 7778 Pe(this._map._container, "touchstart", this._onDown, this); 7779 }, 7780 removeHooks: function () { 7781 ke(this._map._container, "touchstart", this._onDown, this); 7782 }, 7783 _onDown: function (t) { 7784 var e; 7785 (clearTimeout(this._holdTimeout), 7786 1 === t.touches.length && 7787 ((e = t.touches[0]), 7788 (this._startPos = this._newPos = 7789 new j(e.clientX, e.clientY)), 7790 (this._holdTimeout = setTimeout( 7791 o(function () { 7792 (this._cancel(), 7793 this._isTapValid() && 7794 (Pe(document, "touchend", je), 7795 Pe( 7796 document, 7797 "touchend touchcancel", 7798 this._cancelClickPrevent, 7799 ), 7800 this._simulateEvent("contextmenu", e))); 7801 }, this), 7802 600, 7803 )), 7804 Pe( 7805 document, 7806 "touchend touchcancel contextmenu", 7807 this._cancel, 7808 this, 7809 ),
7810 Pe(document, "touchmove", this._onMove, this))); 7811 }, 7812 _cancelClickPrevent: function t() { 7813 (ke(document, "touchend", je), 7814 ke(document, "touchend touchcancel", t)); 7815 }, 7816 _cancel: function () { 7817 (clearTimeout(this._holdTimeout), 7818 ke( 7819 document, 7820 "touchend touchcancel contextmenu", 7821 this._cancel, 7822 this, 7823 ), 7824 ke(document, "touchmove", this._onMove, this)); 7825 }, 7826 _onMove: function (t) { 7827 ((t = t.touches[0]), 7828 (this._newPos = new j(t.clientX, t.clientY))); 7829 }, 7830 _isTapValid: function () { 7831 return ( 7832 this._newPos.distanceTo(this._startPos) <= 7833 this._map.options.tapTolerance 7834 ); 7835 }, 7836 _simulateEvent: function (t, e) { 7837 (((t = new MouseEvent(t, { 7838 bubbles: !0, 7839 cancelable: !0, 7840 view: window, 7841 screenX: e.screenX, 7842 screenY: e.screenY, 7843 clientX: e.clientX, 7844 clientY: e.clientY, 7845 }))._simulated = !0), 7846 e.target.dispatchEvent(t)); 7847 }, 7848 })), 7849 Ne.addInitHook("addHandler", "tapHold", ft), 7850 Ne.mergeOptions({ touchZoom: zt.touch, bounceAtZoomLimits: !0 }), 7851 (gt = X.extend({ 7852 addHooks: function () { 7853 (ae(this._map._container, "leaflet-touch-zoom"), 7854 Pe( 7855 this._map._container, 7856 "touchstart", 7857 this._onTouchStart, 7858 this, 7859 )); 7860 }, 7861 removeHooks: function () { 7862 (he(this._map._container, "leaflet-touch-zoom"), 7863 ke( 7864 this._map._container, 7865 "touchstart", 7866 this._onTouchStart, 7867 this, 7868 )); 7869 }, 7870 _onTouchStart: function (t) { 7871 var e, 7872 i, 7873 n = this._map; 7874 !t.touches || 7875 2 !== t.touches.length || 7876 n._animatingZoom || 7877 this._zooming || 7878 ((e = n.mouseEventToContainerPoint(t.touches[0])), 7879 (i = n.mouseEventToContainerPoint(t.touches[1])), 7880 (this._centerPoint = n.getSize()._divideBy(2)), 7881 (this._startLatLng = n.containerPointToLatLng( 7882 this._centerPoint, 7883 )), 7884 "center" !== n.options.touchZoom && 7885 (this._pinchStartLatLng = n.containerPointToLatLng( 7886 e.add(i)._divideBy(2), 7887 )), 7888 (this._startDist = e.distanceTo(i)), 7889 (this._startZoom = n.getZoom()), 7890 (this._moved = !1), 7891 (this._zooming = !0), 7892 n._stop(),
7893 Pe(document, "touchmove", this._onTouchMove, this), 7894 Pe( 7895 document, 7896 "touchend touchcancel", 7897 this._onTouchEnd, 7898 this, 7899 ), 7900 je(t)); 7901 }, 7902 _onTouchMove: function (t) { 7903 if (t.touches && 2 === t.touches.length && this._zooming) { 7904 var e = this._map, 7905 i = e.mouseEventToContainerPoint(t.touches[0]), 7906 n = e.mouseEventToContainerPoint(t.touches[1]), 7907 s = i.distanceTo(n) / this._startDist; 7908 if ( 7909 ((this._zoom = e.getScaleZoom(s, this._startZoom)), 7910 !e.options.bounceAtZoomLimits && 7911 ((this._zoom < e.getMinZoom() && s < 1) || 7912 (this._zoom > e.getMaxZoom() && 1 < s)) && 7913 (this._zoom = e._limitZoom(this._zoom)), 7914 "center" === e.options.touchZoom) 7915 ) { 7916 if (((this._center = this._startLatLng), 1 == s)) return; 7917 } else { 7918 if ( 7919 ((i = i 7920 ._add(n) 7921 ._divideBy(2) 7922 ._subtract(this._centerPoint)), 7923 1 == s && 0 === i.x && 0 === i.y) 7924 ) 7925 return; 7926 this._center = e.unproject( 7927 e 7928 .project(this._pinchStartLatLng, this._zoom) 7929 .subtract(i), 7930 this._zoom, 7931 ); 7932 } 7933 (this._moved || (e._moveStart(!0, !1), (this._moved = !0)), 7934 T(this._animRequest), 7935 (n = o( 7936 e._move, 7937 e, 7938 this._center, 7939 this._zoom, 7940 { pinch: !0, round: !1 }, 7941 void 0, 7942 )), 7943 (this._animRequest = C(n, this, !0)), 7944 je(t)); 7945 } 7946 }, 7947 _onTouchEnd: function () { 7948 this._moved && this._zooming 7949 ? ((this._zooming = !1), 7950 T(this._animRequest), 7951 ke(document, "touchmove", this._onTouchMove, this), 7952 ke( 7953 document, 7954 "touchend touchcancel", 7955 this._onTouchEnd, 7956 this, 7957 ), 7958 this._map.options.zoomAnimation 7959 ? this._map._animateZoom( 7960 this._center, 7961 this._map._limitZoom(this._zoom), 7962 !0, 7963 this._map.options.zoomSnap, 7964 ) 7965 : this._map._resetView( 7966 this._center, 7967 this._map._limitZoom(this._zoom), 7968 )) 7969 : (this._zooming = !1); 7970 }, 7971 })), 7972 Ne.addInitHook("addHandler", "touchZoom", gt), 7973 (Ne.BoxZoom = K), 7974 (Ne.DoubleClickZoom = pt), 7975 (Ne.Drag = $i), 7976 (Ne.Keyboard = _t), 7977 (Ne.ScrollWheelZoom = mt), 7978 (Ne.TapHold = ft), 7979 (Ne.TouchZoom = gt), 7980 (t.Bounds = B), 7981 (t.Browser = zt), 7982 (t.CRS = Q), 7983 (t.Canvas = Fi), 7984 (t.Circle = gi), 7985 (t.CircleMarker = fi), 7986 (t.Class = S), 7987 (t.Control = We), 7988 (t.DivIcon = Zi), 7989 (t.DivOverlay = Ei), 7990 (t.DomEvent = Y), 7991 (t.DomUtil = J), 7992 (t.Draggable = $e), 7993 (t.Evented = I), 7994 (t.FeatureGroup = ci), 7995 (t.GeoJSON = wi), 7996 (t.GridLayer = Oi), 7997 (t.Handler = X), 7998 (t.Icon = di), 7999 (t.ImageOverlay = Mi), 8000 (t.LatLng = D), 8001 (t.LatLngBounds = O), 8002 (t.Layer = lt), 8003 (t.LayerGroup = li), 8004 (t.LineUtil = it), 8005 (t.Map = Ne), 8006 (t.Marker = _i), 8007 (t.Mixin = tt), 8008 (t.Path = mi), 8009 (t.Point = j), 8010 (t.PolyUtil = et), 8011 (t.Polygon = vi), 8012 (t.Polyline = yi), 8013 (t.Popup = Ai), 8014 (t.PosAnimation = De), 8015 (t.Projection = st), 8016 (t.Rectangle = Vi), 8017 (t.Renderer = Qi), 8018 (t.SVG = Ui), 8019 (t.SVGOverlay = ji), 8020 (t.TileLayer = Ri), 8021 (t.Tooltip = Bi), 8022 (t.Transformation = q), 8023 (t.Util = z), 8024 (t.VideoOverlay = Ii), 8025 (t.bind = o),
8026 (t.bounds = Z), 8027 (t.canvas = Wi), 8028 (t.circle = function (t, e, i) { 8029 return new gi(t, e, i); 8030 }), 8031 (t.circleMarker = function (t, e) { 8032 return new fi(t, e); 8033 }), 8034 (t.control = Qe), 8035 (t.divIcon = function (t) { 8036 return new Zi(t); 8037 }), 8038 (t.extend = e), 8039 (t.featureGroup = function (t, e) { 8040 return new ci(t, e); 8041 }), 8042 (t.geoJSON = Si), 8043 (t.geoJson = dt), 8044 (t.gridLayer = function (t) { 8045 return new Oi(t); 8046 }), 8047 (t.icon = function (t) { 8048 return new di(t); 8049 }), 8050 (t.imageOverlay = function (t, e, i) { 8051 return new Mi(t, e, i); 8052 }), 8053 (t.latLng = N), 8054 (t.latLngBounds = R), 8055 (t.layerGroup = function (t, e) { 8056 return new li(t, e); 8057 }), 8058 (t.map = function (t, e) { 8059 return new Ne(t, e); 8060 }), 8061 (t.marker = function (t, e) { 8062 return new _i(t, e); 8063 }), 8064 (t.point = A), 8065 (t.polygon = function (t, e) { 8066 return new vi(t, e); 8067 }), 8068 (t.polyline = function (t, e) { 8069 return new yi(t, e); 8070 }), 8071 (t.popup = function (t, e) { 8072 return new Ai(t, e); 8073 }), 8074 (t.rectangle = function (t, e) { 8075 return new Vi(t, e); 8076 }), 8077 (t.setOptions = p), 8078 (t.stamp = r), 8079 (t.svg = Gi), 8080 (t.svgOverlay = function (t, e, i) { 8081 return new ji(t, e, i); 8082 }), 8083 (t.tileLayer = Di), 8084 (t.tooltip = function (t, e) { 8085 return new Bi(t, e); 8086 }), 8087 (t.transformation = H), 8088 (t.version = "1.9.4"), 8089 (t.videoOverlay = function (t, e, i) { 8090 return new Ii(t, e, i); 8091 }), 8092 window.L); 8093 ((t.noConflict = function () { 8094 return ((window.L = Ki), this); 8095 }), 8096 (window.L = t)); 8097 })(e); 8098 }, 8099 }, 8100 e = {}; 8101 function i(n) { 8102 var o = e[n]; 8103 if (void 0 !== o) return o.exports; 8104 var s = (e[n] = { exports: {} }); 8105 return (t[n].call(s.exports, s, s.exports, i), s.exports); 8106 } 8107 ((i.n = (t) => { 8108 var e = t && t.__esModule ? () => t.default : () => t; 8109 return (i.d(e, { a: e }), e); 8110 }), 8111 (i.d = (t, e) => { 8112 for (var n in e) 8113 i.o(e, n) && 8114 !i.o(t, n) && 8115 Object.defineProperty(t, n, { enumerable: !0, get: e[n] }); 8116 }), 8117 (i.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e)), 8118 (() => { 8119 "use strict"; 8120 const t = new (class { 8121 constructor() {} 8122 injectScript(t, e = !0) { 8123 const i = document.createElement("script"); 8124 (e ? (i.src = t) : (i.textContent = t), document.body.appendChild(i)); 8125 } 8126 removeNonNumeric(t) { 8127 return t.replace(/\D/g, ""); 8128 } 8129 isUrlValid(t) { 8130 var e = new XMLHttpRequest(); 8131 return (e.open("HEAD", t, !1), e.send(), 200 == e.status); 8132 } 8133 openNewWindow(t, e) { 8134 let i = window.open(t, "_blank", e); 8135 return !(!i || i.closed || void 0 === i.closed); 8136 } 8137 })(); 8138 class e { 8139 constructor(t = "") { 8140 this.ajax_url = t; 8141 } 8142 escapeSelector(t) { 8143 return t.replace(/([!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~])/g, "\\$1"); 8144 } 8145 isCheckout() { 8146 return jQuery("body").hasClass("woocommerce-checkout"); 8147 } 8148 getShippingMethodId() { 8149 if (jQuery(".wc-block-checkout").length > 0) { 8150 let e = jQuery("[data-shipping-method-id]:first"); 8151 if (e.length > 0) { 8152 const i = e.data("shipping-method-id"); 8153 return t.removeNonNumeric(i); 8154 } 8155 if ( 8156 window.wc && 8157 window.wc.blocksStore && 8158 window.wc.blocksStore.getState 8159 ) 8160 try { 8161 const e = window.wc.blocksStore.getState().shippingRates; 8162 if (e && e.length > 0) { 8163 const i = e.find((t) => t.selected); 8164 if (i) return t.removeNonNumeric(i.rate_id || i.id); 8165 } 8166 } catch (t) { 8167 console.warn("â ï¸ Could not read from wc.blocksStore:", t); 8168 } 8169 return ( 8170 console.warn( 8171 "â ï¸ No shipping method found yet in block checkout.", 8172 ), 8173 "" 8174 ); 8175 } 8176 let e = jQuery("input[name='shipping_method[0]']:checked"), 8177 i = jQuery("input[name='shipping_method[0]']"), 8178 n = e.length > 0 ? e.val() : i.val(); 8179 if (!n || "string" != typeof n) 8180 return ( 8181 console.warn(
8182 "â ï¸ No shipping method found yet (classic checkout).", 8183 ), 8184 "" 8185 ); 8186 if (n.indexOf(":") > 0) { 8187 const e = n.split(":"); 8188 return t.removeNonNumeric(e[0]); 8189 } 8190 return n; 8191 } 8192 getShippingData() { 8193 let t, e, i, n, o, s, r, a, h, l, c; 8194 if (jQuery(".wc-block-checkout").length > 0) { 8195 ((l = 8196 jQuery("#shipping-address_1").val() || 8197 jQuery("#billing-address_1").val() || 8198 ""), 8199 (c = 8200 jQuery("#shipping-address_2").val() || 8201 jQuery("#billing-address_2").val() || 8202 ""), 8203 (h = 8204 jQuery("#shipping-city").val() || 8205 jQuery("#billing-city").val() || 8206 ""), 8207 (a = 8208 jQuery("#shipping-postcode").val() || 8209 jQuery("#billing-postcode").val() || 8210 ""), 8211 (r = 8212 jQuery("#shipping-state").val() || 8213 jQuery("#billing-state").val() || 8214 "")); 8215 const e = [ 8216 "#components-form-token-input-0", 8217 'input[aria-label*="Country"]', 8218 "#shipping-country", 8219 "#billing-country", 8220 ]; 8221 for (const i of e) { 8222 const e = jQuery(i); 8223 if (e.length && e.val()) { 8224 t = e.val(); 8225 break; 8226 } 8227 } 8228 if (!t) { 8229 const e = 8230 jQuery("#shipping-country option:selected").text() || 8231 jQuery("#billing-country option:selected").text(); 8232 e && (t = e); 8233 } 8234 } else 8235 ((t = 8236 jQuery("#shipping_country").val() || 8237 jQuery("#billing_country").val() || 8238 jQuery("#shipping-country").val() || 8239 jQuery("#billing-country").val()), 8240 (e = jQuery("#billing_state").val()), 8241 (i = jQuery("input#billing_postcode").val()), 8242 (n = jQuery("#billing_city").val()), 8243 (o = jQuery("input#billing_address_1").val()), 8244 (s = jQuery("input#billing_address_2").val()), 8245 (r = e), 8246 (a = i), 8247 (h = n), 8248 (l = o), 8249 (c = s), 8250 jQuery("#ship-to-different-address") 8251 .find("input") 8252 .is(":checked") && 8253 ((t = jQuery("#shipping_country").val()), 8254 (r = jQuery("#shipping_state").val()), 8255 (a = jQuery("input#shipping_postcode").val()), 8256 (h = jQuery("#shipping_city").val()), 8257 (l = jQuery("input#shipping_address_1").val()), 8258 (c = jQuery("input#shipping_address_2").val()))); 8259 t || (t = ""); 8260 const d = { 8261 Address: { 8262 Lat: "", 8263 Long: "", 8264 Streetname1: l || "", 8265 Streetname2: c || "", 8266 HouseNumber: "", 8267 NumberExtension: "", 8268 PostalCode: a || "", 8269 s_postcode: a || "", 8270 City: h || "", 8271 Country: t || "", 8272 State: r || "", 8273 }, 8274 post_data: jQuery("form.checkout").serialize(), 8275 CarrierId: jQuery("#shipping_carrier_id").val() || 0, 8276 }; 8277 return ((window.CTT_shipping_address = d), d); 8278 } 8279 setCarrier(t) { 8280 ((this.carrier_id = void 0 !== t ? t : this.getShippingMethodId()), 8281 jQuery("#shipping_carrier_id").val(this.carrier_id)); 8282 } 8283 setPickupPoint(t) { 8284 let e = t.Information.Name + " " + t.Information.Address, 8285 i = { 8286 action: "CTT_set_pickup_point", 8287 shipping_pickup_label: e, 8288 CTT_pickup_extended: jQuery( 8289 ".CTT_mapfields" + this.escapeSelector(t.PointId), 8290 ).val(), 8291 "CTT-pickup__description": e, 8292 shipping_pickup_id: t.PointId, 8293 shipping_carrier_id: window.carrier_id, 8294 CTT_nonce: CTT_vars.nonce, 8295 }; 8296 (jQuery 8297 .getJSON(this.ajax_url, i, (t) => { 8298 document.querySelectorAll(".CTT-pick-location").forEach((t) => { 8299 const i = t.parentNode.querySelector(".pickup-label-display"); 8300 i && i.remove(); 8301 const n = document.createElement("div"); 8302 ((n.className = "pickup-label-display"), 8303 (n.style.cssText = 8304 "margin-top: 10px; padding: 8px; background-color: #f0f0f0; border-radius: 4px; font-size: 14px; color: #333;"), 8305 (n.innerHTML = `<strong>Selected Pickup Location:</strong><br>${e}`), 8306 t.parentNode.insertBefore(n, t.nextSibling)); 8307 }); 8308 }) 8309 .fail((t) => { 8310 console.log( 8311 "Fatal error widget requesting points do we have an API bug?", 8312 t.responseText, 8313 ); 8314 }), 8315 jQuery(".CTT_mapfields" + this.escapeSelector(t.PointId)).length > 8316 0 && 8317 jQuery("#shipping_pickup_extended").val( 8318 jQuery(".CTT_mapfields" + this.escapeSelector(t.PointId)).val(), 8319 )); 8320 } 8321 } 8322 var n = i(874), 8323 o = i.n(n); 8324 class s { 8325 constructor(t, e) { 8326 ((this.CTT = e), 8327 (this.options = t), 8328 (this.map = null),
8329 (this.host = t.host || "https://my.CTT.me"), 8330 (this.icon_folder = 8331 "undefined" != typeof CTT_icon_folder ? CTT_icon_folder : ""), 8332 (this.mapWrapper = null), 8333 (this.stylePath = 8334 t.stylePath || 8335 this.host + "/shopsystems/v2/assets/CTTwidget.css"), 8336 (this.markers = []), 8337 (this.pickupPoints = []), 8338 (this.address_cache = {}), 8339 (this.cache_icon_valid = {}), 8340 (this.carrier_icon_config = { 8341 30: { extension: "svg", selectedState: !0, iconSize: [32, 32] }, 8342 56: { extension: "svg", selectedState: !1, iconSize: [32, 40] }, 8343 64: { extension: "svg", selectedState: !1, iconSize: [32, 40] }, 8344 68: { extension: "svg", selectedState: !0, iconSize: [57, 92] }, 8345 71: { extension: "svg", selectedState: !0, iconSize: [57, 92] }, 8346 }), 8347 (this.selectedPointIdx = null), 8348 (this.moveListeners = []), 8349 (this.isMoving = !1), 8350 (this.isUserMoving = !1), 8351 (this.bounds = null)); 8352 } 8353 setCarrierId(t) { 8354 ((this.carrier_id = t), 8355 (this.current_icon = this.getCarrierIconOfType(this.carrier_id))); 8356 } 8357 selectPoint(t) { 8358 (null != this.selectedPointIdx && 8359 this.markers[this.selectedPointIdx].setIcon( 8360 this.getCarrierIconOfType( 8361 this.carrier_id, 8362 this.pickupPoints[this.selectedPointIdx].Type, 8363 0, 8364 ), 8365 ), 8366 (this.selectedPointIdx = t), 8367 this.markers[t].setIcon( 8368 this.getCarrierIconOfType( 8369 this.carrier_id, 8370 this.pickupPoints[t].Type, 8371 1, 8372 ), 8373 )); 8374 } 8375 createIcon(t) { 8376 const e = this.carrier_icon_config[this.carrier_id]?.iconSize, 8377 i = Array.isArray(e) ? e : [e || 50, e || 50], 8378 n = o().icon({ 8379 iconUrl: t, 8380 iconSize: i, 8381 iconAnchor: [i[0] / 2, i[1]], 8382 popupAnchor: [(-1 * i[0]) / 2, (-1 * i[1]) / 2], 8383 }), 8384 s = new Image(); 8385 return ( 8386 (s.onerror = () => { 8387 n.options.iconUrl = this.icon_folder + "default.png"; 8388 }), 8389 (s.src = t), 8390 n 8391 ); 8392 } 8393 setZoom = function (t) { 8394 this.map.setZoom(t); 8395 }; 8396 isMapMoving() { 8397 return this.isMoving || this.isUserMoving; 8398 } 8399 centerMap(t, e) { 8400 if (isNaN(t) || isNaN(e)) 8401 return void console.error( 8402 "Invalid coordinates passed to centerMap:", 8403 { lat: t, lng: e }, 8404 ); 8405 let i = o().latLng(t, e); 8406 this.map.setView(i); 8407 } 8408 grantReady() { 8409 this.isScriptLoaded || this.loadScript(); 8410 } 8411 geocodeBpost(t, e) { 8412 this._geocode(t.address, e); 8413 } 8414 _geocode(t, e) { 8415 jQuery.getJSON( 8416 "https://plugins.bpost.be/shopsystems/v2/shopify/bpostgeocode?searchText=" + 8417 t, 8418 {}, 8419 function (t) { 8420 let i = []; 8421 if (t.response && t.response.topSuggestions) { 8422 let e = t.response.topSuggestions; 8423 for (let t = 0; t < e.length; ++t) 8424 e[t].address.searchBarString && 8425 i.push({ 8426 display_name: e[t].address.searchBarString, 8427 address: { 8428 City: e[t].address.municipalityName, 8429 Country: "be", 8430 PostalCode: e[t].address.postalCode, 8431 Streetname1: e[t].address.searchBarString, 8432 }, 8433 lat: e[t].address.latitude, 8434 lng: e[t].address.longitude, 8435 }); 8436 } 8437 e && e(i); 8438 }, 8439 ); 8440 } 8441 geocode(t, e) { 8442 let i = t.address, 8443 n = ""; 8444 const o = t.country ? t.country.toLowerCase() : null; 8445 if (i.match(/^([0-9\-]+)$/)) { 8446 if ("Portugal" == t.country && "undefined" != typeof missingZipPT) { 8447 let t = i.substring(0, 4); 8448 for (let i = 0; i < missingZipPT.length; ++i) 8449 if (missingZipPT[i].zipcode == t) 8450 return ( 8451 (this.queryResults = { 8452 display_name: missingZipPT[i].display_name, 8453 lat: missingZipPT[i].lat, 8454 lon: missingZipPT[i].lng, 8455 }), 8456 e([this.queryResults]) 8457 ); 8458 } 8459 n = "postalcode=" + i; 8460 } else n = "q=" + i; 8461 (jQuery("#sw-query-results").html( 8462 '<div class="sw-loader"><div></div><div></div><div></div></div>', 8463 ), 8464 jQuery.getJSON( 8465 "https://nominatim.openstreetmap.org/search?format=json&addressdetails=1&" + 8466 n, 8467 (n) => { 8468 if ( 8469 0 == n.length && 8470 i.match(/^([0-9\-]+)$/) && 8471 o && 8472 ("PT" == o.toUpperCase() || "portugal" == o.toLowerCase()) 8473 ) 8474 return ( 8475 jQuery("#sw-query").val(i.substring(0, 4)), 8476 void this.geocode(t, e) 8477 ); 8478 this.queryResults = []; 8479 for (let e = 0; e < n.length; ++e) { 8480 (n[e].address.postcode || 8481 n[e].address.city || 8482 n[e].address.county) && 8483 this.pushDisplayedResults(n[e], t); 8484 } 8485 e && e(this.queryResults); 8486 }, 8487 )); 8488 } 8489 pushDisplayedResults(t, e) { 8490 let i = t; 8491 const n = void 0 !== i.address.road ? i.address.road : i.display_name; 8492 let o = 8493 (n || "") + " " + (i.address.postcode ? i.address.postcode : ""); 8494 (void 0 !== i.address.city && (o += " " + i.address.city),
8495 void 0 !== i.address.region && (o += " " + i.address.region), 8496 i.address.county && (o += " " + i.address.county), 8497 i.address.country && 8498 i.address.country.toLowerCase() && 8499 (o += " " + i.address.country_code), 8500 this.queryResults.push({ 8501 display_name: o, 8502 address: { 8503 City: i.address.city, 8504 Country: i.address.country_code, 8505 PostalCode: i.address.postcode, 8506 Streetname1: n, 8507 State: i.address.region, 8508 }, 8509 lat: i.lat, 8510 lng: i.lon, 8511 })); 8512 } 8513 geocodeAddressParts(t, e, i, n, o) { 8514 if ( 8515 CTT_PLUGIN_URL.includes("bpost") && 8516 ["BE", "be", "Belgium"].includes(i) 8517 ) 8518 return this.geocodeAddressPartsBpost(t, e, i, n, o); 8519 let s = `https://nominatim.openstreetmap.org/search?format=json&addressdetails=1&city=${e}&country_code=${i}`; 8520 if (n) { 8521 s += `&postalcode=${["PT", "Portugal"].includes(i) ? n.substr(0, 4) : n}`; 8522 } 8523 (o && (s += `&street=${encodeURI(o)}`), 8524 jQuery.ajax({ 8525 url: s, 8526 dataType: "json", 8527 timeout: 5e3, 8528 success: (e) => { 8529 const i = { iso2: "", lat: "", lng: "" }; 8530 if (e.length > 0) { 8531 const t = e[0]; 8532 ((i.iso2 = t.address.country_code), 8533 (i.lat = t.lat), 8534 (i.lng = t.lon)); 8535 } else console.warn("â ï¸ Geocoding returned no results"); 8536 t(i); 8537 }, 8538 error: (e, n, o) => { 8539 (console.error("â Geocoding failed:", n, o), 8540 t({ iso2: i, lat: "", lng: "" })); 8541 }, 8542 })); 8543 } 8544 geocodeAddressPartsBpost(t, e, i, n, o) { 8545 let s = ""; 8546 (o && (s += encodeURI(o)), 8547 n && (s += `,${n}`), 8548 this._geocode(s, (e) => { 8549 const i = 8550 e.length > 0 8551 ? { lat: e[0].latitude, lng: e[0].longitude } 8552 : { lat: 0, lng: 0 }; 8553 t?.(i); 8554 })); 8555 } 8556 loadScript() { 8557 (t.injectScript(CTT_PLUGIN_URL + "views/js/leaflet-1.9.4.js"), 8558 (this.isScriptLoaded = !0)); 8559 } 8560 initMap() { 8561 ((this.mapWrapper = jQuery("body")), 8562 this.mapWrapper.hasClass("leaflet-container") || 8563 ((this.icon_selected = this.createIcon( 8564 this.icon_folder + "selected.png", 8565 )), 8566 (this.icon_default = this.createIcon( 8567 this.icon_folder + "default.png", 8568 )), 8569 this.current_icon || (this.current_icon = this.icon_default), 8570 (this.map = new (o().map)("sw-map", { 8571 zoom: 16, 8572 center: [51.505, -0.09], 8573 preferCanvas: !0, 8574 zoomAnimation: !0, 8575 fadeAnimation: !0, 8576 markerZoomAnimation: !0, 8577 trackResize: !0, 8578 worldCopyJump: !1, 8579 maxBoundsViscosity: 1, 8580 })), 8581 o() 8582 .tileLayer( 8583 "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", 8584 { 8585 attribution: 8586 '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', 8587 maxZoom: 18, 8588 minZoom: 10, 8589 tileSize: 256, 8590 updateWhenIdle: !1, 8591 updateWhenZooming: !1, 8592 keepBuffer: 2, 8593 crossOrigin: !0, 8594 subdomains: ["a", "b", "c"], 8595 errorTileUrl: "", 8596 detectRetina: !1, 8597 updateInterval: 200, 8598 }, 8599 ) 8600 .addTo(this.map), 8601 setTimeout(() => { 8602 this.preloadVisibleTiles(); 8603 }, 500), 8604 this.options.onmapready && this.options.onmapready(), 8605 this.map.on("click", () => { 8606 jQuery(".sw-map-selected-point").html(""); 8607 }), 8608 this.map.on("moveend", () => { 8609 let t = this.getCenter(); 8610 this.isInBounds(t.lat, t.lng) || this.moveEnd(); 8611 }))); 8612 } 8613 addMarkersWithClustering(t, e) { 8614 if (t.length < 30) return this.addMarkers(t, e); 8615 ((this.isMoving = !0), (this.pickupPoints = t));
8616 this.createSimpleClusters(t); 8617 for (let i = 0; i < t.length; ++i) 8618 ((this.markers[i] = this.getMarker(t[i])), 8619 this.markers[i] && 8620 ((this.pickupPoints[i].marker = this.markers[i]), 8621 this.markers[i].on("click", function () { 8622 "function" == typeof e && e(i); 8623 }))); 8624 this.fitBounds(); 8625 } 8626 createSimpleClusters(t) { 8627 return t; 8628 } 8629 preloadVisibleTiles() { 8630 if (this.map) 8631 try { 8632 this.map.invalidateSize(); 8633 (this.map.getBounds(), this.map.getZoom()); 8634 } catch (t) { 8635 console.warn("â ï¸ Tile preload failed:", t); 8636 } 8637 } 8638 async moveEnd() { 8639 if (this.isMapMoving()) return; 8640 this.isUserMoving = !0; 8641 let t = this.map.getCenter(); 8642 for ( 8643 let e = 0; 8644 this.moveListeners && e < this.moveListeners.length; 8645 ++e 8646 ) 8647 await this.moveListeners[e](t); 8648 this.isUserMoving = !1; 8649 } 8650 addMapMoveListener(t) { 8651 this.moveListeners.push(t); 8652 } 8653 getCenter() { 8654 return this.map.getCenter(); 8655 } 8656 isInBounds(t, e) { 8657 if (!this.bounds) return !1; 8658 let i, 8659 n = t > this.bounds.bottomLeft.lat && t < this.bounds.topRight.lat, 8660 o = e < this.bounds.topRight.lng, 8661 s = e > this.bounds.bottomLeft.lng; 8662 return ( 8663 (i = 8664 this.bounds.topRight.lng < this.bounds.bottomLeft.lng 8665 ? o || s 8666 : o && s), 8667 i && n 8668 ); 8669 } 8670 clearMarkers() { 8671 if ( 8672 ((this.bounds = null), 8673 (this.selectedPointIdx = null), 8674 this.markers.length > 0) 8675 ) 8676 for (let t = 0; t < this.markers.length; ++t) 8677 this.map.removeLayer(this.markers[t]); 8678 ((this.markers = []), this.isMoving || this.map.setMinZoom(0)); 8679 } 8680 addMarkers(t, e) { 8681 ((this.isMoving = !0), (this.pickupPoints = t)); 8682 for (let i = 0; i < t.length; ++i) 8683 ((this.markers[i] = this.getMarker(t[i])), 8684 this.markers[i] && 8685 ((this.pickupPoints[i].marker = this.markers[i]), 8686 this.markers[i].on("click", function () { 8687 "function" == typeof e && e(i); 8688 }))); 8689 this.fitBounds(); 8690 } 8691 resetMarker(t) { 8692 t.setIcon(this.icon_default); 8693 } 8694 selectMarker(t) { 8695 t.setIcon(this.icon_selected); 8696 } 8697 fitBounds = function () { 8698 (jQuery("html,body").scrollTop(0), 8699 this.map.invalidateSize(), 8700 (this.isMoving = !0)); 8701 let t = [ 8702 parseFloat(this.pickupPoints[0].Lat), 8703 parseFloat(this.pickupPoints[0].Long), 8704 ], 8705 e = [ 8706 parseFloat(this.pickupPoints[0].Lat), 8707 parseFloat(this.pickupPoints[0].Long), 8708 ]; 8709 for (let i = 0; i < this.pickupPoints.length; ++i) { 8710 let n = parseFloat(this.pickupPoints[i].Lat), 8711 o = parseFloat(this.pickupPoints[i].Long); 8712 (n < t[0] && (t[0] = n), 8713 n > e[0] && (e[0] = n), 8714 o > e[1] && (e[1] = o), 8715 o < t[1] && (t[1] = o)); 8716 } 8717 let i = t[0] + (e[0] - t[0]) / 2, 8718 n = t[1] + (e[1] - t[1]) / 2; 8719 if ( 8720 ((this.center = [i, n]), 8721 this.centerMap(i, n), 8722 !t.some((t) => isNaN(t)) && !e.some((t) => isNaN(t))) 8723 ) 8724 return ( 8725 this.map.fitBounds([t, e]), 8726 (this.bounds = { 8727 bottomLeft: { lat: t[0], lng: t[1] }, 8728 topRight: { lat: e[0], lng: e[1] }, 8729 }), 8730 setTimeout(() => { 8731 this.isMoving = !1; 8732 let t = 10; 8733 ((t > 16 || t < 10) && (t = 10), this.map.setMinZoom(t)); 8734 }, 300), 8735 !1 8736 ); 8737 }; 8738 getIcon(t) { 8739 return ( 8740 (t.Type > 0 8741 ? this.getCarrierIconOfType(this.carrier_id, t.Type) 8742 : this.current_icon) || this.icon_default 8743 ); 8744 } 8745 getMarker(t) { 8746 const e = parseFloat(t.Lat), 8747 i = parseFloat(t.Long); 8748 if (isNaN(e) || isNaN(i)) return null; 8749 let n = o().marker([e, i], { 8750 icon: this.getIcon(t), 8751 title: t.Information.Name + "\n" + t.Information.Address, 8752 keyboard: !1, 8753 }); 8754 return (n.addTo(this.map), n); 8755 } 8756 getCarrierIconOfType(t, e, i) { 8757 let n, 8758 o = 8759 "." + 8760 (void 0 !== this.carrier_icon_config[t] 8761 ? this.carrier_icon_config[t].extension 8762 : "png"), 8763 s = 8764 void 0 !== this.carrier_icon_config[t] && 8765 this.carrier_icon_config[t].selectedState && 8766 i 8767 ? "_s" 8768 : ""; 8769 return i && !s 8770 ? this.icon_selected 8771 : ((n = 8772 e && [0, 1, 2, 4, 16, 990].includes(e) 8773 ? this.icon_folder + "" + t + "_" + e + s + o 8774 : this.icon_folder + t + s + o), 8775 this.createIcon(n)); 8776 } 8777 setCarrierIcon(e) { 8778 if (void 0 === o()) 8779 return void setTimeout(() => { 8780 this.setCarrierIcon(e); 8781 }, 200); 8782 this.carrier_id = e; 8783 let i = this.icon_folder + "" + e + ".png"; 8784 (void 0 === this.cache_icon_valid[i] && 8785 (this.cache_icon_valid[i] = t.carrierIconExists( 8786 e, 8787 "", 8788 this.icon_folder, 8789 )), 8790 (this.current_icon = this.cache_icon_valid[i] 8791 ? this.createIcon(i) 8792 : this.icon_default)); 8793 } 8794 } 8795 const r = class { 8796 constructor(t) { 8797 ((this.isScriptLoaded = !1), 8798 (this.markers = []), 8799 (this.map = null),
8800 (this.pickupPoints = []), 8801 (this.options = t), 8802 (this.host = t.host), 8803 (this.icon_folder = 8804 "undefined" != typeof CTT_icon_folder ? CTT_icon_folder : ""), 8805 (this.icon_selected = this.icon_folder + "selected.png"), 8806 (this.icon_default = this.icon_folder + "default.png"), 8807 (this.current_icon = this.icon_default), 8808 (this.moveListeners = []), 8809 (this.carrier_id = null), 8810 (this.carrier_icon_config = { 8811 30: { extension: "svg", selectedState: !0, iconSize: 98 }, 8812 }), 8813 (this.CTTWidget = new a(t))); 8814 } 8815 initMap(t, e) { 8816 this.carrier_id = t; 8817 let i = this; 8818 this.loadScript( 8819 "https://maps.googleapis.com/maps/api/js?key=" + 8820 this.options.gmapskey + 8821 "&callback=", 8822 () => { 8823 ((i.isScriptLoaded = !0), e && e(), this.loadMap()); 8824 }, 8825 ); 8826 } 8827 loadScript(t, e) { 8828 var i = document.createElement("script"); 8829 ((i.type = "text/javascript"), 8830 i.readyState 8831 ? (i.onreadystatechange = function () { 8832 ("loaded" != i.readyState && "complete" != i.readyState) || 8833 ((i.onreadystatechange = null), calback && e()); 8834 }) 8835 : (i.onload = function () { 8836 e && e(); 8837 }), 8838 (i.src = t), 8839 document.getElementsByTagName("head")[0].appendChild(i)); 8840 } 8841 addMarkers(t, e) { 8842 this.pickupPoints = t; 8843 for (let i = 0; i < t.length; ++i) 8844 ((this.markers[i] = this.getMarker(t[i])), 8845 (t[i].marker = this.markers[i]), 8846 this.markers[i].addListener("click", () => { 8847 void 0 !== e && e(i); 8848 })); 8849 this.fitBounds(); 8850 } 8851 addMapMoveListener(t) { 8852 this.moveListeners.push(t); 8853 } 8854 centerMap(t, e) { 8855 this.map.setCenter(new google.maps.LatLng(t, e)); 8856 } 8857 clearMarkers() { 8858 if (this.markers.length > 0) { 8859 for (let t = 0; t < this.markers.length; ++t) 8860 this.markers[t].setMap(null); 8861 this.markers = []; 8862 } 8863 } 8864 fitBounds() { 8865 var t = new google.maps.LatLngBounds(); 8866 for (let e = 0; e < this.markers.length; ++e) 8867 t.extend(this.markers[e].getPosition()); 8868 (this.map.fitBounds(t), (this.bounds = this.map.getBounds())); 8869 } 8870 getMarker(t) { 8871 let e = this.getCarrierIconUrl(t.Type, 0), 8872 i = { 8873 position: new google.maps.LatLng(t.Lat, t.Long), 8874 map: this.map, 8875 icon: { url: e }, 8876 }; 8877 return ( 8878 void 0 !== this.carrier_icon_config[this.carrier_id] 8879 ? (i.icon.size = new google.maps.Size( 8880 this.carrier_icon_config[this.carrier_id].iconSize, 8881 this.carrier_icon_config[this.carrier_id].iconSize, 8882 )) 8883 : (i.icon.scaledSize = new google.maps.Size(50, 50)), 8884 new google.maps.Marker(i) 8885 ); 8886 } 8887 isMapMoving() { 8888 return this.isMoving || this.isUserMoving; 8889 } 8890 async moveEnd() { 8891 if (this.isMapMoving()) return; 8892 this.isUserMoving = !0; 8893 let t = this.map.getCenter(); 8894 for ( 8895 let e = 0; 8896 this.moveListeners && e < this.moveListeners.length; 8897 ++e 8898 ) 8899 await this.moveListeners[e]({ lat: t.lat(), lng: t.lng() }); 8900 this.isUserMoving = !1; 8901 } 8902 loadMap() { 8903 ((this.map = new google.maps.Map(document.getElementById("sw-map"), { 8904 center: { lat: -34.397, lng: 150.644 }, 8905 zoom: 16, 8906 mapTypeControl: !1, 8907 })), 8908 this.map.addListener("center_changed", () => { 8909 let t = this.map.getCenter(); 8910 this.bounds && !this.bounds.contains(t) && this.moveEnd(); 8911 })); 8912 } 8913 geocode(t, e) { 8914 if ("undefined" == typeof google) 8915 return void setTimeout(() => { 8916 this.geocode(shippingData, e); 8917 }, 200); 8918 this.clearMarkers(); 8919 new google.maps.Geocoder(); 8920 let i = this, 8921 n = "components=country:" + t.country; 8922 if ( 8923 t.address && 8924 t.address.match(/^([0-9\-]+)$/) && 8925 "PT" == t.country.toUpperCase() && 8926 "undefined" != typeof missingZipPT 8927 ) { 8928 let i = t.address.substring(0, 4); 8929 for (let t = 0; t < missingZipPT.length; ++t) 8930 if (missingZipPT[t].zipcode == i) { 8931 let i = [ 8932 { 8933 display_name: missingZipPT[t].display_name, 8934 lat: missingZipPT[t].lat, 8935 lon: missingZipPT[t].lng, 8936 }, 8937 ]; 8938 return e(i); 8939 } 8940 } 8941 (t.components 8942 ? (n += "|" + t.components) 8943 : t.address.match(/^[0-9]/) 8944 ? (n += "|postal_code:" + t.address) 8945 : (n += "&address=" + t.address), 8946 jQuery.get( 8947 "https://maps.google.com/maps/api/geocode/json?sensor=false&key=" + 8948 this.options.gmapskey + 8949 "&" + 8950 n, 8951 function (t) { 8952 let n = t.results, 8953 o = { iso2: "", lat: "", lng: "" }; 8954 if ("OK" != t.status) return void e(o); 8955 let s = []; 8956 for (let t = 0; t < n.length; ++t) { 8957 o = n[t]; 8958 let e = ""; 8959 for ( 8960 let t = 0; 8961 o.address_components && t < o.address_components.length; 8962 ++t 8963 ) 8964 e += (e ? ", " : "") + o.address_components[t].long_name; 8965 s.push({ 8966 iso2: i.getCountryCodeFromResult(o), 8967 display_name: e, 8968 lat: o.geometry.location.lat, 8969 lng: o.geometry.location.lng, 8970 }); 8971 } 8972 e(s); 8973 }, 8974 )); 8975 } 8976 getCountryCodeFromResult(t) { 8977 if (void 0 === t.address_components) return ""; 8978 let e = t.address_components; 8979 for (let t = 0; t < e.length; ++t) { 8980 let i = e[t].types; 8981 for (let n = 0; n < i.length; ++n) 8982 if ("country" == i[n]) return e[t].short_name; 8983 } 8984 } 8985 geocodeAddressParts(t, e, i, n, o) { 8986 if ( 8987 CTT_PLUGIN_URL.includes("bpost") && 8988 ["BE", "be", "Belgium"].includes(i) 8989 ) 8990 return this.geocodeAddressPartsBpost(t, e, i, n, o); 8991 let s = `https://nominatim.openstreetmap.org/search?format=json&addressdetails=1&city=${e}&country_code=${i}`; 8992 if (n) { 8993 s += `&postalcode=${["PT", "Portugal"].includes(i) ? n.substr(0, 4) : n}`; 8994 } 8995 (o && (s += `&street=${encodeURI(o)}`), 8996 jQuery.ajax({ 8997 url: s, 8998 dataType: "json", 8999 timeout: 5e3, 9000 success: (e) => { 9001 const i = { iso2: "", lat: "", lng: "" }; 9002 if (e.length > 0) { 9003 const t = e[0]; 9004 ((i.iso2 = t.address.country_code), 9005 (i.lat = t.lat), 9006 (i.lng = t.lon)); 9007 } else console.warn("â ï¸ Geocoding returned no results"); 9008 t(i); 9009 }, 9010 error: (e, n, o) => { 9011 (console.error("â Geocoding failed:", n, o), 9012 t({ iso2: i, lat: "", lng: "" })); 9013 }, 9014 })); 9015 } 9016 setCarrierId(t) { 9017 this.carrier_id = t; 9018 } 9019 selectPoint(t) { 9020 for (let e = 0; e < this.markers.length; ++e) { 9021 let i = this.pickupPoints[e], 9022 n = { url: this.getCarrierIconUrl(i.Type, t == e) }; 9023 (void 0 !== this.carrier_icon_config[this.carrier_id] 9024 ? (n.size = new google.maps.Size( 9025 this.carrier_icon_config[this.carrier_id].iconSize, 9026 this.carrier_icon_config[this.carrier_id].iconSize, 9027 )) 9028 : (n.scaledSize = new google.maps.Size(50, 50)), 9029 this.markers[e].setIcon(n)); 9030 } 9031 } 9032 setCarrierId(t) { 9033 this.carrier_id = t; 9034 } 9035 getCarrierIconUrl(t, e) { 9036 let i, 9037 n = 9038 "." + 9039 (void 0 !== this.carrier_icon_config[this.carrier_id] 9040 ? this.carrier_icon_config[this.carrier_id].extension 9041 : "png"), 9042 o = 9043 void 0 !== this.carrier_icon_config[this.carrier_id] && 9044 this.carrier_icon_config[this.carrier_id].selectedState && 9045 e 9046 ? "_s" 9047 : ""; 9048 return e && !o 9049 ? this.icon_selected 9050 : ((i = 9051 t && 9052 "undefined" != typeof CTT_carrier_imgs && 9053 CTT_carrier_imgs.indexOf(this.carrier_id + "_" + t + n) 9054 ? this.icon_folder + "" + this.carrier_id + "_" + t + o + n 9055 : this.icon_folder + this.carrier_id + o + ".png"), 9056 i); 9057 } 9058 }; 9059 const a = class { 9060 constructor(t) { 9061 ((this.pickupPoints = []), 9062 (this.selectedPoint = null),
9063 (this.options = t), 9064 (this.geocodingInProgress = !1), 9065 (this.lastGeocodingRequest = null), 9066 (this.markers = []), 9067 (this.host = t.host || "https://CTT.me"), 9068 (this.debug = t.debug || 0), 9069 (this.mapParentContainer = t.mapParentContainer || "body"), 9070 (this.buttonParentContainer = t.buttonParentContainer || ""), 9071 (this.buttonClass = this.options.button_class || ""), 9072 (this.labels = this.options.labels || {}), 9073 (this.platform = new e(t.ajax_url)), 9074 (this.timeoutKeyDown = null), 9075 (this.searchRunning = !1), 9076 (this.address = this.options.address || null), 9077 (this.carrier_id = this.options.carrierId || 0), 9078 (this.weekdaynames = [ 9079 CTT_monday, 9080 CTT_tuesday, 9081 CTT_wednesday, 9082 CTT_thursday, 9083 CTT_friday, 9084 CTT_saturday, 9085 CTT_sunday, 9086 ]), 9087 (this.selectedDisplayOption = 0), 9088 (this.cacheResults = {}), 9089 (this.lastMandatoryCarrierId = null), 9090 (this.hasShownToastForCarrier = !1), 9091 (this.checkoutType = this.detectCheckoutType()), 9092 (this.isPickupRequired = !1), 9093 this.initializeCheckout(), 9094 (window.CTTWidget = this), 9095 this.addCustomStyle( 9096 "\n button.CTT-disabled,\n button.CTT-disabled:hover,\n button.CTT-disabled:active {\n pointer-events: none !important;\n cursor: not-allowed !important;\n background-color: grey !important;\n opacity: 0.5 !important;\n }\n", 9097 )); 9098 } 9099 escapeSelector(t) { 9100 return t.replace(/([!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~])/g, "\\$1"); 9101 } 9102 getFormChange() { 9103 let t, 9104 e = "", 9105 i = null; 9106 jQuery(".wc-block-checkout__form").on("change", () => { 9107 (clearTimeout(t), 9108 (t = setTimeout(() => { 9109 this.extractAddressData(!0); 9110 const t = this.getSelectedShippingText(), 9111 n = this.options.address; 9112 if (this.hasAddressActuallyChanged(i, n)) { 9113 if (i && i.Lat && i.Long) { 9114 const t = this.hashLatLng({ lat: i.Lat, lng: i.Long }); 9115 delete this.cacheResults[t]; 9116 } 9117 (this.clearPickupPointData(!0), 9118 this.clearPickupSessionData(), 9119 (this.options.address.Lat = ""), 9120 (this.options.address.Long = ""), 9121 setTimeout(() => { 9122 this.checkShippingRatesForPickup(); 9123 }, 100), 9124 this.isPickupRequired && 9125 this.showToast( 9126 "<strong>Address changed:</strong> Please select a new pickup location for your new address.", 9127 5e3, 9128 ), 9129 (i = JSON.parse(JSON.stringify(n)))); 9130 } 9131 t !== e 9132 ? ((e = t), (window.selectedText = t)) 9133 : jQuery("#shipping-loader").remove(); 9134 }, 500))); 9135 }); 9136 } 9137 hasAddressActuallyChanged(t, e) { 9138 if (!t || !e) return !0; 9139 const i = ["Streetname1", "City", "PostalCode", "Country"]; 9140 for (const n of i) { 9141 if ( 9142 (t[n] || "").toString().trim() !== (e[n] || "").toString().trim() 9143 ) 9144 return !0; 9145 } 9146 return !1; 9147 } 9148 getSelectedShippingText() { 9149 let t = jQuery("fieldset.wc-block-checkout__shipping-option") 9150 .find(".wc-block-components-radio-control__input:checked") 9151 .closest("label") 9152 .find(".wc-block-components-radio-control__label") 9153 .text(); 9154 return ( 9155 t || 9156 jQuery("fieldset.wc-block-checkout__shipping-option") 9157 .find(".wc-block-components-radio-control__option-layout") 9158 .each(function () { 9159 return ( 9160 (t = jQuery(this) 9161 .find(".wc-block-components-radio-control__label") 9162 .text()), 9163 !1 9164 ); 9165 }), 9166 t 9167 ); 9168 } 9169 detectCheckoutType() { 9170 return jQuery(".wc-block-checkout").length > 0 ||
9171 jQuery("[data-block-name='woocommerce/checkout']").length > 0 || 9172 (window.wp && 9173 window.wp.data && 9174 window.wp.data.select("wc/store/cart")) 9175 ? "block" 9176 : jQuery("form.checkout").length > 0 || 9177 jQuery(".woocommerce-checkout").length > 0 || 9178 jQuery("#place_order").length > 0 9179 ? "classic" 9180 : "unknown"; 9181 } 9182 isBlockCheckout() { 9183 return "block" === this.checkoutType; 9184 } 9185 isClassicCheckout() { 9186 return "classic" === this.checkoutType; 9187 } 9188 initializeCheckout() { 9189 (setTimeout(() => { 9190 this.isBlockCheckout() 9191 ? (this.extractAddressData(!0), this.initializeBlockCheckout()) 9192 : this.isClassicCheckout() && 9193 (this.extractClassicAddressData(), 9194 this.initializeClassicCheckout()); 9195 }, 500), 9196 (window.CTTPickupManager = this)); 9197 } 9198 initializeBlockCheckout() { 9199 (this.setupAPIInterceptor(), 9200 jQuery(document).ready(() => { 9201 this.waitForBlockCheckoutElements(); 9202 })); 9203 } 9204 setupAPIInterceptor() { 9205 const t = window.fetch; 9206 window.fetch = async (...e) => { 9207 const [i, n] = e; 9208 if ( 9209 ("string" == typeof i && i.includes("/wp-json/wc/store/"), 9210 "string" == typeof i && 9211 i.includes("/wp-json/wc/store/v1/cart/select-shipping-rate")) 9212 ) 9213 try { 9214 if (n && n.body) 9215 try { 9216 const t = JSON.parse(n.body); 9217 if (t.rate_id) { 9218 const e = this.extractCarrierIdFromMethodId(t.rate_id); 9219 e && 9220 ((this.carrier_id = e), 9221 (window.carrier_id = e), 9222 this.mapinterface && 9223 this.mapinterface.setCarrierId && 9224 this.mapinterface.setCarrierId(this.carrier_id)); 9225 } 9226 } catch (t) {} 9227 const i = await t(...e); 9228 return ( 9229 i.ok && 9230 (this.removeAllPickupButtons(), 9231 setTimeout(() => this.checkShippingRates(), 200)), 9232 i 9233 ); 9234 } catch (i) { 9235 return ( 9236 console.error("Error in shipping rate API call:", i), 9237 t(...e) 9238 ); 9239 } 9240 return t(...e); 9241 }; 9242 const e = XMLHttpRequest.prototype.open, 9243 i = XMLHttpRequest.prototype.send; 9244 if ( 9245 ((XMLHttpRequest.prototype.open = function (t, i, ...n) { 9246 return ((this._url = i), e.call(this, t, i, ...n)); 9247 }), 9248 (XMLHttpRequest.prototype.send = function (...t) { 9249 if ( 9250 (this._url && this._url.includes("/wp-json/wc/store/"), 9251 this._url && 9252 this._url.includes( 9253 "/wp-json/wc/store/v1/cart/select-shipping-rate", 9254 )) 9255 ) { 9256 if (t[0] && window.CTTPickupManager) 9257 try { 9258 const e = JSON.parse(t[0]); 9259 if (e.rate_id) { 9260 const t = 9261 window.CTTPickupManager.extractCarrierIdFromMethodId( 9262 e.rate_id, 9263 ); 9264 t && 9265 ((window.CTTPickupManager.carrier_id = t), 9266 (window.carrier_id = t), 9267 window.CTTPickupManager.mapinterface && 9268 window.CTTPickupManager.mapinterface.setCarrierId && 9269 window.CTTPickupManager.mapinterface.setCarrierId(t)); 9270 } 9271 } catch (t) {} 9272 const e = this.onload; 9273 this.onload = function (t) { 9274 (this.status >= 200 && 9275 this.status < 300 && 9276 window.CTTPickupManager && 9277 (window.CTTPickupManager.removeAllPickupButtons(), 9278 setTimeout( 9279 () => window.CTTPickupManager.checkShippingRates(), 9280 200, 9281 )), 9282 e && e.call(this, t)); 9283 }; 9284 } 9285 return i.call(this, ...t); 9286 }), 9287 window.jQuery) 9288 ) { 9289 const t = jQuery.ajax; 9290 jQuery.ajax = function (e) { 9291 if ( 9292 (e.url && e.url.includes("/wp-json/wc/store/"),
9293 e.url && 9294 e.url.includes( 9295 "/wp-json/wc/store/v1/cart/select-shipping-rate", 9296 )) 9297 ) { 9298 if (e.data && window.CTTPickupManager) 9299 try { 9300 let t = e.data; 9301 if ( 9302 ("string" == typeof t && (t = JSON.parse(t)), t.rate_id) 9303 ) { 9304 const e = 9305 window.CTTPickupManager.extractCarrierIdFromMethodId( 9306 t.rate_id, 9307 ); 9308 e && 9309 ((window.CTTPickupManager.carrier_id = e), 9310 (window.carrier_id = e), 9311 window.CTTPickupManager.mapinterface && 9312 window.CTTPickupManager.mapinterface.setCarrierId && 9313 window.CTTPickupManager.mapinterface.setCarrierId(e)); 9314 } 9315 } catch (t) {} 9316 const t = e.success; 9317 e.success = function (e, i, n) { 9318 (window.CTTPickupManager && 9319 (window.CTTPickupManager.removeAllPickupButtons(), 9320 setTimeout( 9321 () => window.CTTPickupManager.checkShippingRates(), 9322 200, 9323 )), 9324 t && t.call(this, e, i, n)); 9325 }; 9326 const i = e.error; 9327 e.error = function (t, e, n) { 9328 i && i.call(this, t, e, n); 9329 }; 9330 } 9331 return t.call(this, e); 9332 }; 9333 } 9334 } 9335 extractCarrierIdFromMethodId(t) { 9336 const e = t.match(/shipping_CTT_(\d+)/); 9337 if (e && e[1]) { 9338 return parseInt(e[1]); 9339 } 9340 return null; 9341 } 9342 waitForBlockCheckoutElements() { 9343 let t = !1, 9344 e = !1; 9345 const i = setInterval(() => { 9346 jQuery(".wc-block-components-shipping-rates-control__package").is( 9347 ":visible", 9348 ) && 9349 !t && 9350 ((t = !0), clearInterval(i), this.setupBlockShippingHandlers()); 9351 }, 500), 9352 n = setInterval(() => { 9353 jQuery(".wc-block-components-checkout-place-order-button").is( 9354 ":visible", 9355 ) && 9356 !e && 9357 ((e = !0), 9358 clearInterval(n), 9359 this.setupBlockPlaceOrderHandler()); 9360 }, 500); 9361 } 9362 setupBlockShippingHandlers() { 9363 (this.extractAddressData(!0), 9364 (window.selectedText = this.getSelectedShippingText()), 9365 this.extractInitialCarrierId(), 9366 this.getFormChange(), 9367 this.getOnClick()); 9368 } 9369 extractInitialCarrierId() { 9370 if (window.wp && window.wp.data) 9371 try { 9372 const t = window.wp.data.select("wc/store/cart").getCartData(); 9373 if (t && t.shippingRates && t.shippingRates[0]) { 9374 const e = t.shippingRates[0].shipping_rates.find( 9375 (t) => !0 === t.selected, 9376 ); 9377 if (e && e.rate_id) { 9378 const t = this.extractCarrierIdFromMethodId(e.rate_id); 9379 t && 9380 ((this.carrier_id = t), 9381 (window.carrier_id = t), 9382 this.mapinterface && 9383 this.mapinterface.setCarrierId && 9384 this.mapinterface.setCarrierId(this.carrier_id)); 9385 } 9386 } 9387 } catch (t) {} 9388 } 9389 extractAddressData(t = !0) { 9390 let e, 9391 i, 9392 n, 9393 o, 9394 s, 9395 r = ""; 9396 if (t) { 9397 ((e = 9398 jQuery("#shipping-address_1").val() || 9399 jQuery("#billing-address_1").val() || 9400 ""), 9401 (i = 9402 jQuery("#shipping-address_2").val() || 9403 jQuery("#billing-address_2").val() || 9404 ""), 9405 (n = 9406 jQuery("#shipping-city").val() || 9407 jQuery("#billing-city").val() || 9408 ""), 9409 (o = 9410 jQuery("#shipping-postcode").val() || 9411 jQuery("#billing-postcode").val() || 9412 ""), 9413 (s = 9414 jQuery("#shipping-state").val() || 9415 jQuery("#billing-state").val() || 9416 "")); 9417 const t = [ 9418 { selector: "#components-form-token-input-0", useVal: !0 }, 9419 { selector: "#shipping-country", useVal: !0 }, 9420 { selector: "#billing-country", useVal: !0 }, 9421 { selector: 'select[name*="country"]', useVal: !0 }, 9422 ]; 9423 for (const e of t) { 9424 const t = jQuery(e.selector); 9425 if (t.length && t.val() && ((r = t.val()), r && "" !== r.trim())) 9426 break; 9427 } 9428 } else { 9429 const t = jQuery("#ship-to-different-address input").is(":checked") 9430 ? "shipping" 9431 : "billing"; 9432 ((e = jQuery(`#${t}_address_1`).val() || ""), 9433 (i = jQuery(`#${t}_address_2`).val() || ""), 9434 (n = jQuery(`#${t}_city`).val() || ""), 9435 (o = jQuery(`#${t}_postcode`).val() || ""), 9436 (s = jQuery(`#${t}_state`).val() || ""), 9437 (r = jQuery(`#${t}_country`).val() || "")); 9438 } 9439 ((this.options.address = { 9440 Lat: "", 9441 Long: "", 9442 Streetname1: e, 9443 Streetname2: i,
9444 HouseNumber: "", 9445 NumberExtension: "", 9446 PostalCode: o, 9447 s_postcode: o, 9448 City: n, 9449 Country: r, 9450 State: s, 9451 }), 9452 (window.CTT_shipping_address = { 9453 Address: this.options.address, 9454 ...(t 9455 ? {} 9456 : { 9457 post_data: jQuery("form.checkout").serialize(), 9458 CarrierId: this.carrier_id || 0, 9459 }), 9460 })); 9461 } 9462 setupBlockPlaceOrderHandler() { 9463 const t = jQuery( 9464 ".wc-block-components-checkout-place-order-button, #place_order", 9465 ); 9466 (t.each(function () { 9467 this.addEventListener( 9468 "click", 9469 function (t) { 9470 const e = jQuery("#shipping_pickup_id").val(), 9471 i = localStorage.getItem("CTTPointId"), 9472 n = e || i; 9473 if ( 9474 window.CTTWidget && 9475 window.CTTWidget.isPickupRequired && 9476 (!n || "" === n) 9477 ) 9478 return ( 9479 t.preventDefault(), 9480 t.stopPropagation(), 9481 t.stopImmediatePropagation(), 9482 window.CTTWidget.showPickupMandatoryModal(), 9483 !1 9484 ); 9485 }, 9486 !0, 9487 ); 9488 }), 9489 t.on("click", (t) => { 9490 const e = jQuery("#shipping_pickup_id").val(), 9491 i = localStorage.getItem("CTTPointId"), 9492 n = e || i; 9493 if (this.isPickupRequired && (!n || "" === n)) 9494 return ( 9495 t.preventDefault(), 9496 t.stopPropagation(), 9497 t.stopImmediatePropagation(), 9498 this.showPickupMandatoryModal(), 9499 !1 9500 ); 9501 })); 9502 } 9503 disableButton() { 9504 const t = jQuery( 9505 ".wc-block-components-checkout-place-order-button, #place_order", 9506 ); 9507 (t.prop("disabled", !0), 9508 t.attr("disabled", "disabled"), 9509 t.attr("aria-disabled", "true"), 9510 t.css({ 9511 "background-color": "grey", 9512 cursor: "not-allowed", 9513 opacity: "0.5", 9514 "pointer-events": "none", 9515 }), 9516 t.addClass("CTT-disabled")); 9517 } 9518 enableButton() { 9519 const t = jQuery( 9520 ".wc-block-components-checkout-place-order-button, #place_order", 9521 ); 9522 (t.prop("disabled", !1), 9523 t.removeAttr("disabled"), 9524 t.removeAttr("aria-disabled"), 9525 t.css({ 9526 "background-color": "black", 9527 cursor: "pointer", 9528 opacity: "1", 9529 "pointer-events": "auto", 9530 }), 9531 t.removeClass("CTT-disabled")); 9532 } 9533 initializeClassicCheckout() { 9534 jQuery(document).ready(() => { 9535 const t = setInterval(() => { 9536 jQuery("form.checkout, .woocommerce-checkout").length > 0 && 9537 (clearInterval(t), this.setupClassicCheckoutHandlers()); 9538 }, 500); 9539 }); 9540 } 9541 async setupClassicCheckoutHandlers() { 9542 jQuery('form[name="checkout"]').on("change", () => { 9543 this.handleClassicShippingChange(); 9544 }); 9545 } 9546 async handleClassicShippingChange() { 9547 this.extractClassicAddressData(); 9548 } 9549 extractClassicAddressData() { 9550 this.extractAddressData(!1); 9551 } 9552 getClassicSelectedShippingMethod() { 9553 let t = jQuery('#shipping_method input[type="radio"]:checked') 9554 .siblings("label") 9555 .text() 9556 .split(":")[0] 9557 .trim(); 9558 if (!t) { 9559 const e = document.querySelector("#shipping_method"); 9560 if (e) { 9561 e.querySelectorAll("li").forEach((e) => { 9562 const i = e.querySelector("label"); 9563 if (i) { 9564 const e = i.textContent.trim(); 9565 t = e.split(":")[0].trim(); 9566 } 9567 }); 9568 } 9569 } 9570 return t; 9571 } 9572 createModal(t) { 9573 const e = jQuery("<div>", { 9574 id: t.id, 9575 css: { 9576 display: "block", 9577 position: "fixed", 9578 "z-index": "9999", 9579 left: "0", 9580 top: "0", 9581 width: "100%", 9582 height: "100%", 9583 overflow: "auto", 9584 "background-color": "rgba(0,0,0,0.4)", 9585 }, 9586 }), 9587 i = jQuery("<div>", { 9588 css: { 9589 "background-color": "#fefefe", 9590 margin: "15% auto", 9591 padding: "20px", 9592 border: "1px solid #888", 9593 width: "80%", 9594 "max-width": "500px", 9595 "border-radius": "5px", 9596 "text-align": "center", 9597 }, 9598 }),
9599 n = jQuery("<span>", { 9600 text: "Ã", 9601 css: { 9602 color: "#aaa", 9603 float: "right", 9604 "font-size": "28px", 9605 "font-weight": "bold", 9606 cursor: "pointer", 9607 }, 9608 }), 9609 o = jQuery("<p>", { 9610 text: t.message, 9611 css: { "font-size": "16px", margin: "20px 0", color: "#333" }, 9612 }); 9613 (i.append(n), 9614 i.append(o), 9615 t.buttons && 9616 t.buttons.forEach((t) => { 9617 const e = jQuery("<button>", t.props); 9618 (i.append(e), t.handler && e.on("click", t.handler)); 9619 }), 9620 e.append(i), 9621 jQuery("body").append(e)); 9622 const s = () => e.remove(); 9623 return ( 9624 n.on("click", s), 9625 jQuery(window).on("click", (t) => { 9626 jQuery(t.target).is(e) && s(); 9627 }), 9628 { modal: e, closeModal: s } 9629 ); 9630 } 9631 showPickupMandatoryModal() { 9632 const { closeModal: t } = this.createModal({ 9633 id: "pickupMandatoryModal", 9634 message: CTT_mandatory_point, 9635 buttons: [ 9636 { 9637 props: { 9638 text: CTT_choose_pickup_location || "Choose Pickup Location", 9639 class: "button alt CTT-pick-location", 9640 }, 9641 handler: (e) => { 9642 (t(), e.preventDefault(), this.handlePickupButtonClick()); 9643 }, 9644 }, 9645 { 9646 props: { 9647 text: "OK", 9648 css: { 9649 "background-color": "#666", 9650 color: "white", 9651 border: "none", 9652 padding: "6px 10px", 9653 "border-radius": "4px", 9654 cursor: "pointer", 9655 "margin-left": "10px", 9656 }, 9657 }, 9658 handler: t, 9659 }, 9660 ], 9661 }); 9662 } 9663 checkShippingRates() { 9664 if (this.isBlockCheckout()) { 9665 const t = this.getSelectedShippingText(); 9666 t && ((window.selectedText = t), this.extractAddressData(!0)); 9667 } 9668 } 9669 getOnClick() { 9670 (jQuery("#sw-query-btn").on("click", () => { 9671 this.geocodeQuery(!0); 9672 }), 9673 jQuery('form[name="checkout"]').on("change", () => { 9674 this.getFormShippingData(); 9675 })); 9676 } 9677 getFormShippingData() { 9678 this.extractClassicAddressData(); 9679 } 9680 getCTTId(t) { 9681 var e = t.match(/([\d]+)_pickup/); 9682 if (null != e) return e[1]; 9683 for (let e = 0; e < CTT_carriers.length; ++e) 9684 if (CTT_carriers[e].ClassName === t) 9685 return "object" == typeof CTT_carriers[e].Id 9686 ? CTT_carriers[e].Id[0] 9687 : CTT_carriers[e].Id; 9688 return 0; 9689 } 9690 init() { 9691 (this.options.address && this.setAddress(this.options.address), 9692 this.loadScripts(), 9693 !this.options.address && 9694 localStorage.getItem("CTTAddress") && 9695 this.setAddress(JSON.parse(localStorage.getItem("CTTAddress"))), 9696 this.initPickupButtons()); 9697 } 9698 initPickupButtons() { 9699 (this.disableButton(), 9700 this.setupPickupEventListeners(), 9701 this.waitForCartDataThenValidate()); 9702 } 9703 waitForCartDataThenValidate() { 9704 let t = !1, 9705 e = 0; 9706 if (window.wp && window.wp.data) { 9707 const e = window.wp.data.subscribe(() => { 9708 t || 9709 (this.isCartDataReady() && 9710 ((t = !0), this.checkShippingRatesForPickup(), e())); 9711 }); 9712 } 9713 const i = setInterval(() => { 9714 t 9715 ? clearInterval(i) 9716 : (e++, 9717 this.isCartDataReady() 9718 ? ((t = !0), 9719 clearInterval(i), 9720 this.checkShippingRatesForPickup()) 9721 : e >= 10 && 9722 (clearInterval(i), 9723 console.warn("â ï¸ Polling timeout, validating anyway"), 9724 this.checkShippingRatesForPickup())); 9725 }, 500); 9726 } 9727 isCartDataReady() { 9728 if (!window.wp || !window.wp.data) 9729 return "undefined" != typeof wc_checkout_params; 9730 try { 9731 const t = window.wp.data.select("wc/store/cart"); 9732 if (!t || "function" != typeof t.getCartData) 9733 return "undefined" != typeof wc_checkout_params; 9734 const e = t.getCartData(); 9735 if (!e || !e.shippingRates || !e.shippingRates[0]) return !1; 9736 const i = e.shippingRates[0].shipping_rates.find( 9737 (t) => !0 === t.selected, 9738 ); 9739 if (!i) return !1;
9740 const n = i.meta_data?.find((t) => "has_pickup" === t.key), 9741 o = i.meta_data?.find((t) => "pickup_mandatory" === t.key); 9742 return !(!n && !o); 9743 } catch (t) { 9744 return "undefined" != typeof wc_checkout_params; 9745 } 9746 } 9747 setupPickupEventListeners() { 9748 (window.wp && 9749 window.wp.data && 9750 window.wp.data.subscribe(() => { 9751 this.checkShippingRatesForPickup(); 9752 }), 9753 jQuery(document.body).on("updated_checkout", () => { 9754 (this.isBlockCheckout() 9755 ? this.extractAddressData(!0) 9756 : this.extractClassicAddressData(), 9757 setTimeout(() => { 9758 this.checkShippingRatesForPickup(); 9759 }, 600)); 9760 })); 9761 const t = window.fetch, 9762 e = this; 9763 ((window.fetch = async (...i) => { 9764 const [n, o] = i; 9765 if ( 9766 "string" == typeof n && 9767 n.includes("/wp-json/wc/store/v1/cart/select-shipping-rate") 9768 ) 9769 try { 9770 const n = await t(...i); 9771 return ( 9772 n.ok && 9773 (e.removeAllPickupButtons(), 9774 e.clearPickupPointData(), 9775 setTimeout(() => e.checkShippingRatesForPickup(), 200)), 9776 n 9777 ); 9778 } catch (e) { 9779 return t(...i); 9780 } 9781 return t(...i); 9782 }), 9783 document.addEventListener("change", (t) => { 9784 t.target.matches('input[name*="shipping"]') && 9785 (this.removeAllPickupButtons(), 9786 this.clearPickupPointData(!0), 9787 setTimeout(() => this.checkShippingRatesForPickup(), 300)); 9788 }), 9789 document.addEventListener("updated_checkout", () => { 9790 (this.removeAllPickupButtons(), 9791 this.clearPickupPointData(), 9792 setTimeout(() => this.checkShippingRatesForPickup(), 200)); 9793 })); 9794 } 9795 showToast(t, e = 4e3) { 9796 jQuery(".CTT-toast").remove(); 9797 const i = jQuery("<div>", { 9798 html: t, 9799 class: "CTT-toast", 9800 css: { 9801 position: "fixed", 9802 bottom: "40px", 9803 right: "40px", 9804 background: "#111", 9805 color: "#fff", 9806 padding: "14px 20px", 9807 "border-radius": "6px", 9808 "font-size": "15px", 9809 "box-shadow": "0 3px 10px rgba(0,0,0,0.3)", 9810 "z-index": "99999", 9811 opacity: "0", 9812 transition: "opacity 0.3s ease", 9813 }, 9814 }); 9815 (jQuery("body").append(i), 9816 setTimeout(() => i.css("opacity", "1"), 50), 9817 setTimeout(() => i.fadeOut(400, () => i.remove()), e)); 9818 } 9819 checkShippingRatesForPickup() { 9820 if (!window.wp || !window.wp.data) 9821 return void this.checkShippingRatesClassic(); 9822 const t = window.wp.data.select("wc/store/cart"); 9823 if (t && "function" == typeof t.getCartData) 9824 try { 9825 jQuery( 9826 ".wc-block-components-checkout-place-order-button, #place_order", 9827 ); 9828 const e = t.getCartData(); 9829 if (!e || !e.shippingRates || !e.shippingRates[0]) return; 9830 const i = e.shippingRates[0].shipping_rates.find( 9831 (t) => !0 === t.selected, 9832 ); 9833 if (!i) return; 9834 this.currentSelectedRate = i; 9835 const n = this.extractCarrierIdFromMethodId(i.rate_id); 9836 n 9837 ? ((this.carrier_id = n), 9838 (window.carrier_id = n), 9839 this.mapinterface && 9840 this.mapinterface.setCarrierId && 9841 this.mapinterface.setCarrierId(this.carrier_id)) 9842 : console.warn( 9843 "â ï¸ Could not extract carrier ID from:", 9844 i.rate_id, 9845 );
9846 const o = i.meta_data?.find((t) => "pickup_mandatory" === t.key), 9847 s = o ? o.value : "0", 9848 r = jQuery("#shipping_pickup_id").val(), 9849 a = localStorage.getItem("CTTPointId"), 9850 h = r || a; 9851 "1" === s 9852 ? ((this.isPickupRequired = !0), 9853 h && "" !== h 9854 ? ((this.isPickupRequired = !1), 9855 this.enableButton(), 9856 jQuery("#pickup-required-notice").remove(), 9857 (this.hasShownToastForCarrier = !1), 9858 (this.lastMandatoryCarrierId = null)) 9859 : (this.disableButton(), 9860 jQuery("#pickup-required-notice").remove(), 9861 (this.hasShownToastForCarrier && 9862 this.lastMandatoryCarrierId === n) || 9863 (this.showToast( 9864 "<strong>Pickup required:</strong> Please select a pickup location to complete checkout.", 9865 ), 9866 (this.hasShownToastForCarrier = !0), 9867 (this.lastMandatoryCarrierId = n)))) 9868 : ((this.isPickupRequired = !1), 9869 this.removeAllPickupButtons(), 9870 this.clearPickupPointData(!0), 9871 this.clearPickupSessionData(), 9872 this.enableButton(), 9873 jQuery("#pickup-required-notice").remove(), 9874 jQuery(".CTT-toast").remove(), 9875 (this.hasShownToastForCarrier = !1), 9876 (this.lastMandatoryCarrierId = null)); 9877 const l = this.hasPickupCapability(i); 9878 "2" !== s && l 9879 ? this.addPickupButton(i) 9880 : (this.removeAllPickupButtons(), 9881 this.clearPickupPointData(!0), 9882 this.clearPickupSessionData()); 9883 } catch (t) { 9884 console.error("Error checking shipping rates:", t); 9885 } 9886 else this.checkShippingRatesClassic(); 9887 } 9888 checkShippingRatesClassic() { 9889 const t = jQuery('input[name^="shipping_method"]:checked'); 9890 if (!t.length) return; 9891 const e = t.val(); 9892 if (!e) return; 9893 const i = e.match(/CTT_(\d+)|GLSDk_(\d+)/i), 9894 n = i ? parseInt(i[1] || i[2]) : null; 9895 if (!n) 9896 return (this.removeAllPickupButtons(), void this.enableButton()); 9897 ((this.carrier_id = n), 9898 (window.carrier_id = n), 9899 this.mapinterface && 9900 this.mapinterface.setCarrierId && 9901 this.mapinterface.setCarrierId(n), 9902 0 === jQuery("#shipping_carrier_id").length 9903 ? jQuery("form.woocommerce-checkout").append( 9904 `<input type="hidden" id="shipping_carrier_id" name="shipping_carrier_id" value="${n}">`, 9905 ) 9906 : jQuery("#shipping_carrier_id").val(n)); 9907 const o = t.closest("label, li"), 9908 s = 9909 o.find('[data-has-pickup="1"]').length > 0 || 9910 "1" === t.attr("data-has-pickup"), 9911 r = 9912 o.find('[data-pickup-mandatory="1"]').length > 0 || 9913 "1" === t.attr("data-pickup-mandatory"); 9914 if (!s) 9915 return ( 9916 this.removeAllPickupButtons(), 9917 this.clearPickupPointData(!0), 9918 this.clearPickupSessionData(), 9919 void this.enableButton() 9920 ); 9921 const a = jQuery(".GLSDk-shipping-options, .CTT-shipping-options"); 9922 (a.length && 9923 0 === a.find(".CTT-pick-location").length && 9924 (a 9925 .html( 9926 `\n <tr><td>\n <button class='button alt CTT-pick-location' type='button'>\n ${window.CTT_choose_pickup_location || "Choose Pickup Location"}\n </button>\n <input type='hidden' name='shipping_pickup_id' id='shipping_pickup_id'/>\n <input type='hidden' name='shipping_pickup_label' id='shipping_pickup_label'/>\n <input type='hidden' name='CTT_pickup_extended' id='shipping_pickup_extended'/>
9926\n <span class='CTT-pickup__description'></span>\n </td></tr>\n `, 9927 ) 9928 .show(), 9929 a.find(".CTT-pick-location").on("click", (t) => { 9930 (t.preventDefault(), this.handlePickupButtonClick()); 9931 })), 9932 (this.isPickupRequired = r)); 9933 const h = 9934 jQuery("#shipping_pickup_id").val() || 9935 localStorage.getItem("CTTPointId"), 9936 l = 9937 jQuery("#shipping_carrier_id").val() || 9938 localStorage.getItem("CTTPickupCarrierId"), 9939 c = h && l && parseInt(l) === parseInt(n); 9940 r && !c 9941 ? (h && 9942 !c && 9943 (this.clearPickupPointData(!0), this.clearPickupSessionData()), 9944 this.disableButton(), 9945 (this.hasShownToastForCarrier && 9946 this.lastMandatoryCarrierId === n) || 9947 (this.showToast( 9948 "<strong>Pickup required:</strong> Please select a pickup location to complete checkout.", 9949 ), 9950 (this.hasShownToastForCarrier = !0), 9951 (this.lastMandatoryCarrierId = n))) 9952 : (this.enableButton(), jQuery("#pickup-required-notice").remove()); 9953 } 9954 selectPoint(t) { 9955 this.selectedPoint = t; 9956 ([ 9957 { id: "CTTpickup", value: t.PointId }, 9958 { id: "shipping_pickup_id", value: t.PointId }, 9959 { 9960 id: "shipping_pickup_label", 9961 value: `${t.Information.Name} ${t.Information.Address}`, 9962 }, 9963 { 9964 id: "shipping_carrier_id", 9965 value: this.carrier_id || window.carrier_id || t.Carrier.Id, 9966 }, 9967 ].forEach((t) => { 9968 let e = jQuery(`#${t.id}`); 9969 (0 === e.length && 9970 ((e = jQuery( 9971 `<input type="hidden" id="${t.id}" name="${t.id}" />`, 9972 )), 9973 jQuery("form.checkout, .wc-block-checkout").append(e)), 9974 e.val(t.value)); 9975 }), 9976 localStorage.setItem("CTTPointId", t.PointId), 9977 localStorage.setItem("CTTPointLabel", t.Information.Name), 9978 localStorage.setItem( 9979 "CTTPickupCarrierId", 9980 this.carrier_id || window.carrier_id || "", 9981 ), 9982 jQuery("#CTT-pickup__description").length && 9983 jQuery("#CTT-pickup__description").show(), 9984 jQuery(".CTT-pickup__description").length && 9985 jQuery(".CTT-pickup__description") 9986 .show() 9987 .html(t.Information.Name + " " + t.Information.Address)); 9988 let e = jQuery("#sw-map-selected-point"); 9989 if ( 9990 (1 == this.selectedDisplayOption && (e = jQuery("#sw-list-points")), 9991 void 0 !== t.MapFieldsSelect && t.MapFieldsSelect.length > 0) 9992 ) { 9993 let i = !0; 9994 if ( 9995 (e 9996 .find(".CTT_mapfields" + this.escapeSelector(t.PointId)) 9997 .each((e, n) => { 9998 jQuery(n).val() || 9999 (alert( 10000 jQuery( 10001 jQuery( 10002 ".CTT_mapfieldslabel" + 10003 this.escapeSelector(t.PointId), 10004 ).get(e), 10005 ).text() + 10006 ": " + 10007 this.options.labels.mapfieldmandatory, 10008 ), 10009 (i = !1)); 10010 }), 10011 !i) 10012 ) 10013 return !1; 10014 } 10015 const i = { 10016 id_carrier: this.carrier_id, 10017 pickup_id: this.selectedPoint.PointId, 10018 pickup_label: 10019 (this.selectedPoint.Information.Name 10020 ? this.selectedPoint.Information.Name + "<br/>" 10021 : "") + this.selectedPoint.Information.Address, 10022 action: "CTT_save_pickup", 10023 }; 10024 return ( 10025 e 10026 .find( 10027 ".CTT_mapfields" + 10028 this.escapeSelector(this.selectedPoint.PointId), 10029 ) 10030 .each(function (t, e) { 10031 let n = jQuery(e).attr("data-id"), 10032 o = jQuery(e).val(); 10033 (i.OptionFields || (i.OptionFields = []), 10034 i.OptionFields.push({ Id: n, Value: o }), 10035 localStorage.setItem(n + "val", o)); 10036 }), 10037 void 0 === this.options.ajax_url 10038 ? this.options.onPointSelected(t, "")
10039 : this.platform.setPickupPoint(t), 10040 (this.isPickupRequired = !1), 10041 this.enableButton(), 10042 jQuery("#pickup-required-notice").remove(), 10043 this.closeMap(), 10044 jQuery("#myModal").hide(), 10045 jQuery( 10046 "#place_order, .wc-block-components-checkout-place-order-button", 10047 ) 10048 .prop("disabled", !1) 10049 .css({ 10050 "background-color": "black", 10051 cursor: "pointer", 10052 opacity: "1", 10053 }), 10054 setTimeout(() => { 10055 jQuery("#shipping_pickup_id").val() && 10056 (this.enableButton(), 10057 jQuery("#pickup-required-notice").remove()); 10058 }, 100), 10059 (this.hasShownToastForCarrier = !1), 10060 (this.lastMandatoryCarrierId = null), 10061 jQuery(".CTT-toast").remove(), 10062 !0 10063 ); 10064 } 10065 hasPickupCapability(t) { 10066 if (!t.meta_data) return !1; 10067 return !!t.meta_data.find( 10068 (t) => "has_pickup" === t.key && "1" === t.value, 10069 ); 10070 } 10071 isInternationalCarrier(t) { 10072 if (!t || !t.meta_data) return null; 10073 const e = t.meta_data.find((t) => "is_international" === t.key); 10074 return e ? !0 === e.value || "1" === e.value || 1 === e.value : null; 10075 } 10076 getCheckoutAddress(t) { 10077 if (!this.platform.ajax_url) 10078 return (console.error("Ajax URL not available"), void t(null)); 10079 jQuery 10080 .get(this.platform.ajax_url, { 10081 action: "CTT_get_checkout_address", 10082 }) 10083 .done((e) => { 10084 try { 10085 const i = "string" == typeof e ? JSON.parse(e) : e; 10086 t(i); 10087 } catch (e) { 10088 (console.error("Error parsing checkout address response:", e), 10089 t(null)); 10090 } 10091 }) 10092 .fail((e) => { 10093 (console.error("Error fetching checkout address:", e), t(null)); 10094 }); 10095 } 10096 hasAddressChanged(t, e) { 10097 if (!t || !e) return !0; 10098 const i = [ 10099 { current: "Country", backend: "country" }, 10100 { current: "City", backend: "city" }, 10101 { current: "PostalCode", backend: "postcode" }, 10102 { current: "Streetname1", backend: "address_1" }, 10103 { current: "State", backend: "state" }, 10104 ]; 10105 for (const n of i) { 10106 if ( 10107 (t[n.current] || "").toString().trim() !== 10108 (e[n.backend] || "").toString().trim() 10109 ) 10110 return !0; 10111 } 10112 return !1; 10113 } 10114 proceedWithBpostGeocoding(t, e) { 10115 let i = t.Country || "BE"; 10116 if (this.currentSelectedRate) { 10117 const e = this.isInternationalCarrier(this.currentSelectedRate); 10118 i = !1 === e ? "BE" : t.Country || "BE"; 10119 } 10120 this.mapinterface.geocodeAddressPartsBpost( 10121 (n) => { 10122 if (!n.lat) 10123 return this.mapinterface.geocodeAddressPartsBpost( 10124 (t) => { 10125 e(t); 10126 }, 10127 t.City, 10128 i, 10129 ); 10130 e(n); 10131 }, 10132 t.City, 10133 i, 10134 t.PostalCode, 10135 t.Streetname1, 10136 ); 10137 } 10138 isCurrentShippingMethodPickupRequired() { 10139 if (this.isBlockCheckout() && window.wp && window.wp.data) 10140 try { 10141 const t = window.wp.data.select("wc/store/cart").getCartData(); 10142 if (!t || !t.shippingRates || !t.shippingRates[0]) return !1; 10143 const e = t.shippingRates[0].shipping_rates.find( 10144 (t) => !0 === t.selected, 10145 ); 10146 if (e) { 10147 return this.isPickupMandatory(e); 10148 } 10149 } catch (t) { 10150 console.error("Error checking block checkout shipping rates:", t); 10151 } 10152 if (this.isClassicCheckout()) { 10153 if (jQuery('input[name^="shipping_method"]:checked').length) { 10154 return jQuery(".CTT-pick-location").length > 0; 10155 } 10156 } 10157 return !1; 10158 } 10159 isPickupMandatory(t) { 10160 if (!t.meta_data) return !1; 10161 return !!t.meta_data.find( 10162 (t) => "pickup_mandatory" === t.key && "1" === t.value, 10163 ); 10164 } 10165 addPickupButton(t) { 10166 this.removeAllPickupButtons(); 10167 const e = this.findShippingMethodElement(t.rate_id); 10168 if (!e) return; 10169 if (!this.carrier_id) { 10170 const e = this.extractCarrierIdFromMethodId(t.rate_id); 10171 e && 10172 ((this.carrier_id = e), 10173 (window.carrier_id = e), 10174 this.mapinterface && 10175 this.mapinterface.setCarrierId && 10176 this.mapinterface.setCarrierId(this.carrier_id)); 10177 } 10178 const i = this.createPickupButton(t), 10179 n = this.findInsertionPoint(e); 10180 n && n.appendChild(i); 10181 } 10182 findShippingMethodElement(t) { 10183 const e = [ 10184 `input[value="${t}"]`, 10185 `input[id*="${t}"]`, 10186 `[data-rate-id="${t}"]`, 10187 `input[name*="shipping"][value*="${t.split(":")[1]}"]`, 10188 ]; 10189 for (const t of e) { 10190 const e = document.querySelector(t); 10191 if (e) return e; 10192 } 10193 return null; 10194 } 10195 findInsertionPoint(t) { 10196 return ( 10197 [ 10198 t.closest("li"), 10199 t.closest(".wc-block-components-shipping-rates-control__option"), 10200 t.closest("label"), 10201 t.parentElement,
10202 ].filter(Boolean)[0] || t.parentElement 10203 ); 10204 } 10205 createPickupButton(t) { 10206 const e = document.createElement("button"); 10207 return ( 10208 (e.type = "button"), 10209 (e.className = "button alt CTT-pick-location"), 10210 (e.textContent = 10211 window.CTT_choose_pickup_location || "Choose Pickup Location"), 10212 e.addEventListener("click", (e) => { 10213 (e.preventDefault(), this.handlePickupButtonClick(t)); 10214 }), 10215 e 10216 ); 10217 } 10218 handlePickupButtonClick(t) { 10219 if (this.areAddressFieldsFilled()) { 10220 if (window.wp && window.wp.data) 10221 try { 10222 const t = window.wp.data.select("wc/store/cart"); 10223 if (t && "function" == typeof t.getCartData) { 10224 const e = t.getCartData(); 10225 if (e && e.shippingRates && e.shippingRates[0]) { 10226 const t = e.shippingRates[0].shipping_rates.find( 10227 (t) => !0 === t.selected, 10228 ); 10229 if (t) { 10230 const e = this.extractCarrierIdFromMethodId(t.rate_id); 10231 e 10232 ? ((this.carrier_id = e), (window.carrier_id = e)) 10233 : console.error( 10234 "â Could not extract carrier ID from:", 10235 t.rate_id, 10236 ); 10237 } 10238 } 10239 } else; 10240 } catch (t) { 10241 console.error("â Error extracting carrier ID:", t); 10242 } 10243 if ((!this.carrier_id || 0 === this.carrier_id) && t) { 10244 const e = this.extractCarrierIdFromMethodId(t.rate_id); 10245 e && ((this.carrier_id = e), (window.carrier_id = e)); 10246 } 10247 if (!this.carrier_id || 0 === this.carrier_id) 10248 return (
10249 console.error("â Cannot open map: invalid carrier_id"), 10250 void this.showToast( 10251 "<strong>Error:</strong> Could not determine shipping carrier. Please refresh the page.", 10252 5e3, 10253 ) 10254 ); 10255 this.openMap(); 10256 } else this.showAddressRequiredMessage(); 10257 } 10258 removeAllPickupButtons() { 10259 document 10260 .querySelectorAll(".CTT-pick-location") 10261 .forEach((t) => t.remove()); 10262 } 10263 clearPickupPointData(t = !1) { 10264 const e = jQuery("#CTTpickup").val(); 10265 if (!t && e && "" !== e) return; 10266 ([ 10267 "#shipping_pickup_id", 10268 "#shipping_pickup_label", 10269 "#shipping_carrier_id", 10270 "#shipping_pickup_extended", 10271 "#CTTpickup", 10272 ].forEach((t) => { 10273 const e = jQuery(t); 10274 e.length && e.val(""); 10275 }), 10276 jQuery( 10277 ".pickup-label-display, .selected-pickup-point, .pickup-point-display, .selected-pickup-info", 10278 ).remove(), 10279 jQuery(".CTT-pickup__description").html("").hide(), 10280 (this.selectedPoint = null), 10281 localStorage.removeItem("CTTPointId"), 10282 localStorage.removeItem("CTTPointLabel"), 10283 localStorage.removeItem("CTTPickupCarrierId")); 10284 } 10285 clearPickupSessionData() { 10286 this.clearingSession || 10287 ((this.clearingSession = !0), 10288 jQuery.ajax({ 10289 url: this.options.ajax_url, 10290 type: "POST", 10291 data: { 10292 action: "CTT_clear_pickup_session_data", 10293 nonce: CTT_vars.nonce, 10294 }, 10295 success: (t) => { 10296 this.clearingSession = !1; 10297 }, 10298 error: (t, e, i) => { 10299 (console.error("â Error clearing pickup session data:", i), 10300 (this.clearingSession = !1)); 10301 }, 10302 })); 10303 } 10304 areAddressFieldsFilled() { 10305 this.isBlockCheckout() 10306 ? this.extractAddressData(!0) 10307 : this.extractClassicAddressData(); 10308 const t = this.options.address, 10309 e = ["Streetname1", "City", "PostalCode", "Country"]; 10310 for (const i of e) if (!t[i] || "" === t[i].trim()) return !1; 10311 return !0; 10312 } 10313 showAddressRequiredMessage() { 10314 this.createModal({ 10315 id: "addressModal", 10316 message: 10317 "Please fill in all required address fields before selecting a pickup location.", 10318 buttons: [ 10319 { 10320 props: { 10321 text: "OK", 10322 css: { 10323 "background-color": "#666", 10324 color: "white", 10325 border: "none", 10326 padding: "6px 10px", 10327 "border-radius": "4px", 10328 cursor: "pointer", 10329 "margin-left": "10px", 10330 }, 10331 }, 10332 handler: function () { 10333 jQuery("#addressModal").remove(); 10334 }, 10335 }, 10336 ], 10337 }); 10338 } 10339 addPointInfo(t, e, i, n) { 10340 void 0 === i && (i = ""); 10341 let o = 10342 void 0 !== t.WorkingHoursRaw && t.WorkingHoursRaw 10343 ? JSON.parse(t.WorkingHoursRaw) 10344 : [], 10345 s = "", 10346 r = t.Information.Address, 10347 a = [], 10348 h = new RegExp( 10349 /([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)/, 10350 "g", 10351 ), 10352 l = new RegExp( 10353 /([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)\_([a-zA-Z0-9]+)/, 10354 "g", 10355 ), 10356 c = 4, 10357 d = 2; 10358 Object.keys(o).length > 0 && 10359 Object.keys(o).shift().match(h) && 10360 ((l = h), (d = 3), (c = 7)); 10361 for (let t in o) { 10362 let e = o[t]; 10363 if (t.match(l)) { 10364 let i = l.exec(t), 10365 n = i[1], 10366 o = parseInt(i[c]) - 1, 10367 s = this.weekdaynames.indexOf(n); 10368 (void 0 === a[s] && (a[s] = []), 10369 void 0 === a[s][o] && 10370 (a[s][o] = { OpenTime: "", CloseTime: "" }), 10371 (a[s][o]["Closing" == i[d] ? "CloseTime" : "OpenTime"] = e)); 10372 } 10373 } 10374 for (let t = 0; t < a.length; ++t) 10375 if (void 0 !== a[t]) { 10376 a[t].sort( 10377 (t, e) => 10378 parseInt(t.OpenTime.substring(0, 2)) - 10379 parseInt(e.OpenTime.substring(0, 2)), 10380 ); 10381 } 10382 o = void 0 !== t.WorkingHours ? t.WorkingHours : a; 10383 let u = Object.keys(o).length, 10384 p = this.weekdaynames[0], 10385 _ = "", 10386 m = "", 10387 f = 0, 10388 g = ""; 10389 for (let t = 0; t < 7; ++t) { 10390 let e = o[t], 10391 i = ""; 10392 this.weekdaynames[t]; 10393 ((i += '<div class="sw-point-info-day">'), (m = "")); 10394 for (let t = 0; e && t < e.length; ++t) { 10395 let i = e[t];
10396 null == i.OpenTime && "23:59" == i.CloseTime 10397 ? (m += "24h") 10398 : (m += 10399 (m ? " | " : "") + 10400 `<span>${i.OpenTime ? i.OpenTime : ""} - ${i.CloseTime ? i.CloseTime : ""}</span>`); 10401 } 10402 if ((_ && _ != m) || 6 == t) { 10403 let e = t - f > 2, 10404 n = 6 == t; 10405 (_ && 10406 ((g = 10407 n && m == _ 10408 ? this.weekdaynames[t] 10409 : this.weekdaynames[t - 1]), 10410 (i += `<label>${(e && p ? p + " - " : "") + g}:</label><span>${_}</span></div>`), 10411 (s += i)), 10412 n && 10413 m && 10414 m != _ && 10415 (s += `<div class="sw-point-info-day"><label>${this.weekdaynames[t]}:</label><span>${m}</span></div></div>`), 10416 (p = t < u - 1 ? this.weekdaynames[t] : ""), 10417 (f = t), 10418 (_ = m)); 10419 } else _ = m; 10420 } 10421 !s && 10422 _ && 10423 (s = `<label>${p} - ${this.weekdaynames[u - 1]}: </label><span>${_}</span></div>`); 10424 let y = jQuery( 10425 `<div class="sw-point-info ${i}">\n <h4 class='sw-point-info-name'>${t.Information.Name}</h4>\n <div class='sw-point-info-addr'>${r}</div>\n ${null !== t.Distance ? "<div class='sw-point-info-distance'>" + CTT_distance + " " + ` ${t.Distance} ` + CTT_meter + " </div>" : ""}\n <div class='sw-point-info-open'>${this.getWorkingDays(t.WorkingHours)}</div>\n</div>`, 10426 ); 10427 if (void 0 !== t.MapFieldsSelect) { 10428 let e = t.MapFieldsSelect; 10429 for (let i = 0; i < e.length; ++i) 10430 y.append( 10431 `<div class="sw-point-info-additional"><label>${e[i]}</label><input data-id="${e[i]}" class="CTT_mapfields${t.PointId}" type="text" id="${e[i]}${t.PointId}"/></div>`, 10432 ); 10433 } 10434 let v = jQuery( 10435 `<button class="sw-point-info-btn ${e ? "selected" : ""}">${e ? CTT_selected : CTT_select}</button>`, 10436 ); 10437 (v.on("click", () => { 10438 this.selectPoint(t); 10439 }), 10440 y.append(v), 10441 n.append(y)); 10442 } 10443 addCustomStyle(t) { 10444 var e = document.createElement("style"); 10445 ((e.type = "text/css"), 10446 e.styleSheet 10447 ? (e.styleSheet.cssText = t) 10448 : e.appendChild(document.createTextNode(t)), 10449 document.getElementsByTagName("head")[0].appendChild(e)); 10450 } 10451 addMapHtml() { 10452 let t = ""; 10453 this.options.address.Streetname1 && 10454 (t = this.options.address.PostalCode 10455 ? this.options.address.PostalCode 10456 : this.options.address.Streetname1); 10457 let e = `<div id="sw">\n <div id="sw__overlay"></div>\n <div id="sw__container">\n <div id="sw-search">\n <div id="sw-query-wrapper">\n <input type="text" id="sw-query" placeholder="${t}">\n </div>\n <div id="sw-query-results"></div>\n <div id="query-options">\n </div>\n </div>\n <div id="sw-display-options">\n </div> \n <div id="sw-map-wrapper" class="sw-tab selected">\n <div class="sw-query-results-description"></div>\n <div id="sw-map" class="CTT-pickup__map"></div>\n <div id="sw-map-error"></div> \n <div id="sw-map-selected-point"></div>\n </div> \n <div class='sw-tab'>\n <div class="sw-query-results-description"></div>\n <div id="sw-list-points"></div>\n </div>\n <div id="sw-map-message"></div>\n <div id="sw-search-status">\n <div class="sw-loader"><div></div><div></div><div></div></div>\n </div>\n </div>\n </div>`; 10458 (jQuery(this.mapParentContainer).append(e), 10459 jQuery(".sw-loader div").addClass("CTT-background")); 10460 let i = jQuery("#sw-display-options"), 10461 n = jQuery( 10462 "<span class='sw-display-option selected'>" + CTT_map + "</span>", 10463 ), 10464 o = jQuery( 10465 "<span class='sw-display-option'\">" + CTT_list + "</span>", 10466 ); 10467 (n.on("click", () => { 10468 this.selectDisplayOption(0); 10469 }), 10470 o.on("click", () => { 10471 this.selectDisplayOption(1); 10472 }), 10473 i.append(n), 10474 i.append(o)); 10475 let s = jQuery("#sw-query-wrapper"), 10476 r = jQuery( 10477 '<button id="sw-query-btn"">' + CTT_search + "</button>", 10478 ); 10479 (s.append(r), 10480 r.on("click", () => { 10481 this.geocodeQuery(!0); 10482 }), 10483 jQuery("#sw-query").on("keyup", (t) => { 10484 (13 == t.keyCode && this.geocodeQuery(), 10485 this.timeoutKeyDown && clearTimeout(this.timeoutKeyDown), 10486 (this.timeoutKeyDown = setTimeout(() => { 10487 this.geocodeQuery(); 10488 }, 300))); 10489 }), 10490 jQuery("#sw__overlay").click(() => { 10491 this.closeMap(); 10492 })); 10493 } 10494 centerMap(t, e) { 10495 this.mapinterface.centerMap(t, e); 10496 } 10497 closeMap() { 10498 (jQuery("#sw").removeClass("open"), 10499 jQuery("html,body").scrollTop(this.userScroll), 10500 jQuery(".CTT-loader-btn").stop(!0, !0).remove(), 10501 jQuery("body").css("overflow", ""), 10502 jQuery("html").css("overflow", "")); 10503 } 10504 displayMessage(t) { 10505 (jQuery("#sw-map-message").addClass("open"), 10506 99 == t.Id 10507 ? jQuery("#sw-map-message").html(CTT_no_points_found) 10508 : jQuery("#sw-map-message").html(t)); 10509 } 10510 displayPlaces(t) { 10511 (jQuery(".sw-query-results-description").html(""), 10512 (this.queryResults = t)); 10513 let e = jQuery("#sw-query-results"), 10514 i = ""; 10515 for (let e = 0; e < t.length; ++e) 10516 void 0 !== t[e].address.PostalCode && 10517 (i += `<div class="sw-query-result" data-idx="${e}">${t[e].display_name}</div>`); 10518 (i || (i = CTT_no_results), 10519 e.html(i), 10520 jQuery(".sw-query-result").on("click", (t) => { 10521 let e = jQuery(t.target).attr("data-idx"); 10522 if ("isNaN" == parseInt(e) || e > this.queryResults.length) 10523 return; 10524 let i = this.queryResults[e]; 10525 if ( 10526 ((this.options.address.Lat = i.lat), 10527 (this.options.address.Long = i.lng), 10528 jQuery("#sw-query-results").html(""), 10529 jQuery("#sw-query").val(i.display_name), 10530 void 0 !== i.address) 10531 ) 10532 for (let t in i.address) 10533 i.address[t] && 10534 i.address[t].length > 0 && 10535 (this.options.address[t] = i.address[t]); 10536 ((this.options.address.Streetname1 = i.address.Streetname1), 10537 this.fetchPoints(this.options.address)); 10538 })); 10539 } 10540 hashLatLng(t) { 10541 return ( 10542 "r" +
10543 (t.lat + "").replace(".", "-") + 10544 "_" + 10545 (t.lng + "").replace(".", "-") 10546 ); 10547 } 10548 displayResults(t) { 10549 (this.mapinterface.clearMarkers(), 10550 jQuery("#sw__container").removeClass("searching"), 10551 this.pickupPointsLoadStop(), 10552 jQuery(".sw-query-results-description").html( 10553 "<div class='sw-query-results-description'>" + 10554 CTT_the + 10555 t.Count + 10556 CTT_closest + 10557 "</div>", 10558 ), 10559 setTimeout(() => { 10560 ((this.pickupPoints = t.Point), 10561 (this.mapChanged = Date.now()), 10562 this.updateList(this.pickupPoints), 10563 this.mapinterface.addMarkers(this.pickupPoints, (t) => { 10564 let e = jQuery("#sw-map-selected-point"); 10565 (e.html(""), 10566 this.addPointInfo(this.pickupPoints[t], 0, "", e), 10567 this.mapinterface.selectPoint(t)); 10568 }), 10569 setTimeout(() => { 10570 jQuery(".CTT-loader-btn").fadeOut(300, function () { 10571 jQuery(this).remove(); 10572 }); 10573 }, 300)); 10574 }, 100)); 10575 } 10576 fetchPoints(t, e) { 10577 if (!this.carrier_id || 0 === this.carrier_id) 10578 return ( 10579 console.error("â Invalid carrier_id in fetchPoints!"), 10580 this.displayMessage( 10581 "â ï¸ Shipping method not properly selected. Please refresh the page.", 10582 ), 10583 void jQuery(".CTT-loader-btn").remove() 10584 ); 10585 (t.Country && (t.Country = t.Country.toUpperCase()), 10586 this.isBlockCheckout() || 10587 ((this.carrier_id = jQuery("#shipping_carrier_id").val()), 10588 this.setCarrierId(jQuery("#shipping_carrier_id").val())), 10589 (this.selectedPoint = null), 10590 jQuery("#sw-map-selected-point").html(""), 10591 jQuery("#sw-map-message").removeClass("open"), 10592 jQuery(".sw-query-results-description").html(""), 10593 this.mapinterface.isMapMoving() || 10594 jQuery("#sw__container").addClass("searching"), 10595 void 0 !== 10596 this.cacheResults[ 10597 this.hashLatLng({ 10598 lat: this.options.address.Lat, 10599 lng: this.options.address.Long, 10600 }) 10601 ] && 10602 this.displayResults( 10603 this.cacheResults[ 10604 this.hashLatLng({ 10605 lat: this.options.address.Lat, 10606 lng: this.options.address.Long, 10607 }) 10608 ], 10609 )); 10610 let i = { 10611 Address: t, 10612 CarrierId: this.carrier_id, 10613 action: "CTT_pickup_locations", 10614 }; 10615 jQuery 10616 .getJSON(this.options.ajax_url, i, (t) => { 10617 if ( 10618 (this.mapinterface.clearMarkers(), 10619 this.pickupPointsLoadStop(), 10620 jQuery("#sw-map-wrapper").removeClass("loading"), 10621 (this.searchRunning = !1), 10622 jQuery("#sw__container").removeClass("searching"), 10623 (this.searchRunning = !1), 10624 t.Error && 0 != t.Error.Id) 10625 ) { 10626 let e = ""; 10627 return ( 10628 (e = 10629 t.Error.Info && 10630 (t.Error.Info.toLowerCase().includes("invalid") || 10631 t.Error.Info.toLowerCase().includes("not found")) 10632 ? "â ï¸ Please check your address â we couldnât find any pickup points near that location." 10633 : t.Error.Info && 10634 t.Error.Info.toLowerCase().includes("timeout") 10635 ? "â ï¸ The request took too long. Please try again in a moment." 10636 : "â ï¸ Something went wrong while searching for pickup points. Please verify your address or try again."), 10637 this.displayMessage(e), 10638 void console.warn( 10639 "Pickup location error:", 10640 t.Error.Info || t.Error, 10641 ) 10642 ); 10643 } 10644 (t.Point && t.Point.length > 0 10645 ? ((this.cacheResults[ 10646 this.hashLatLng({ 10647 lat: this.options.address.Lat, 10648 lng: this.options.address.Long, 10649 }) 10650 ] = t), 10651 this.displayResults(t)) 10652 : this.displayMessage( 10653 "â ï¸ No pickup points found for the provided address.", 10654 ), 10655 void 0 !== e && 10656 setTimeout(() => { 10657 e(); 10658 }, 300)); 10659 }) 10660 .fail((t) => { 10661 this.displayMessage(CTT_no_points_found); 10662 }); 10663 } 10664 geocodeQuery(t = !1) { 10665 jQuery("#sw-query-results").html(""); 10666 let e = jQuery("#sw-query").val(); 10667 if ( 10668 ((this.options.address.Lat = null),
10669 (this.options.address.Long = null), 10670 !(e.length < 4)) 10671 ) { 10672 if (jQuery("#components-form-token-input-0").length) 10673 this.options.address.Country = jQuery( 10674 "#components-form-token-input-0", 10675 ).val(); 10676 else if (jQuery("#shipping-country").length > 0) 10677 this.options.address.Country = jQuery("#shipping-country").val(); 10678 else if (jQuery("#billing-country").length > 0) 10679 this.options.address.Country = jQuery("#billing-country").val(); 10680 else if (jQuery("#select2-billing_country-container").length > 0) { 10681 const t = jQuery("#billing_country"); 10682 this.options.address.Country = t.length 10683 ? t.val() 10684 : jQuery("#billing-country").val(); 10685 } 10686 if (CTT_PLUGIN_URL.includes("bpost") && t) { 10687 let t = "BE"; 10688 if (this.currentSelectedRate) { 10689 const e = this.isInternationalCarrier(this.currentSelectedRate); 10690 t = 10691 !1 === e 10692 ? "BE" 10693 : (!0 === e && this.options.address.Country) || "BE"; 10694 } 10695 this.mapinterface.geocodeBpost( 10696 { address: e, country: t }, 10697 (t) => { 10698 this.displayPlaces(t); 10699 }, 10700 ); 10701 } else 10702 this.mapinterface.geocode({ address: e }, (t) => { 10703 this.displayPlaces(t); 10704 }); 10705 } 10706 } 10707 geocodeAddress(t, e) { 10708 if ( 10709 (this.geocodingInProgress && 10710 (console.warn("â ï¸ Geocoding already in progress, cancelling..."), 10711 this.lastGeocodingRequest && 10712 this.lastGeocodingRequest.abort && 10713 this.lastGeocodingRequest.abort()), 10714 (this.geocodingInProgress = !0), 10715 "Portugal" == t.country && "undefined" != typeof missingZipPT) 10716 ) { 10717 let i = t.postcode.substring(0, 4); 10718 for (let n = 0; n < missingZipPT.length; ++n) 10719 if (missingZipPT[n].zipcode == i) 10720 return ( 10721 (this.queryResults = [ 10722 { 10723 display_name: missingZipPT[n].display_name, 10724 lat: missingZipPT[n].lat, 10725 lng: missingZipPT[n].lng, 10726 address: { 10727 street: "street", 10728 postcode: t.postcode, 10729 city: missingZipPT[n].display_name, 10730 country_code: t.country, 10731 }, 10732 }, 10733 ]), 10734 void e(this.queryResults) 10735 ); 10736 } 10737 if ( 10738 (CTT_PLUGIN_URL.includes("bpost") && 10739 "BE" == this.options.address.Country) || 10740 "be" == this.options.address.Country || 10741 "Belgium" == this.options.address.Country 10742 ) { 10743 const i = (t) => { 10744 ((this.geocodingInProgress = !1), 10745 (this.lastGeocodingRequest = null), 10746 e(t)); 10747 }; 10748 this.getCheckoutAddress((e) => { 10749 let n = t; 10750 if (e && e.success && e.data && e.data.shipping_address) { 10751 const i = e.data.shipping_address; 10752 this.hasAddressChanged(t, i) && 10753 ((n = { 10754 Country: i.country, 10755 City: i.city, 10756 PostalCode: i.postcode, 10757 Streetname1: i.address_1, 10758 Streetname2: i.address_2, 10759 State: i.state, 10760 }), 10761 (this.options.address = Object.assign( 10762 this.options.address, 10763 n, 10764 ))); 10765 } 10766 this.proceedWithBpostGeocoding(n, i); 10767 }); 10768 } else { 10769 const i = (t) => { 10770 ((this.geocodingInProgress = !1), 10771 (this.lastGeocodingRequest = null),
10772 e(t)); 10773 }; 10774 this.mapinterface.geocodeAddressParts( 10775 (e) => { 10776 if (!e.lat || !e.lng) 10777 return ( 10778 console.warn( 10779 "â ï¸ Full address geocoding failed, trying city-only...", 10780 ), 10781 this.mapinterface.geocodeAddressParts( 10782 (e) => { 10783 e.lat && e.lng 10784 ? i([e]) 10785 : (console.error( 10786 "â City-only geocoding also failed", 10787 ), 10788 this.displayMessage( 10789 "â ï¸ Could not locate address. Please verify your address or try searching manually in the map.", 10790 ), 10791 jQuery(".CTT-loader-btn").remove(), 10792 i([{ iso2: t.Country, lat: "", lng: "" }])); 10793 }, 10794 t.City, 10795 t.Country, 10796 ) 10797 ); 10798 i([e]); 10799 }, 10800 t.City, 10801 t.Country, 10802 t.PostalCode, 10803 t.Streetname1, 10804 ); 10805 } 10806 } 10807 mapMoved(t) { 10808 return ( 10809 jQuery("#sw-point-info").html(""), 10810 new Promise((e, i) => { 10811 ((this.options.address.Lat = t.lat), 10812 (this.options.address.Long = t.lng), 10813 this.fetchPoints(this.options.address, e)); 10814 }) 10815 ); 10816 } 10817 loadScripts() { 10818 if ( 10819 "undefined" == typeof jQuery ||
10820 parseInt(jQuery.fn.jquery.substring(2, 2)) < 7 10821 ) { 10822 var t = this; 10823 this.loadScript( 10824 "https://code.jquery.com/jquery-3.7.0.min.js", 10825 function () { 10826 (t.scriptsLoaded(), t.options.oninit && t.options.oninit()); 10827 }, 10828 ); 10829 } else 10830 (this.scriptsLoaded(), 10831 this.options.oninit && this.options.oninit()); 10832 } 10833 loadScript(t, e) { 10834 var i = document.createElement("script"); 10835 ((i.type = "text/javascript"), 10836 i.readyState 10837 ? (i.onreadystatechange = () => { 10838 ("loaded" != i.readyState && "complete" != i.readyState) || 10839 ((i.onreadystatechange = null), calback && e()); 10840 }) 10841 : (i.onload = () => { 10842 e && e(); 10843 }), 10844 (i.src = t), 10845 document.getElementsByTagName("head")[0].appendChild(i)); 10846 } 10847 static loadStyle(t) { 10848 var e = document.createElement("link"); 10849 ((e.rel = "stylesheet"), 10850 (e.href = t), 10851 document.getElementsByTagName("head")[0].appendChild(e)); 10852 } 10853 openMap() { 10854 const t = this.hashLatLng({ 10855 lat: this.options.address.Lat || 0, 10856 lng: this.options.address.Long || 0, 10857 }); 10858 if (!this.cacheResults[t]) { 10859 const t = 10860 '\n <div class="CTT-loader-btn" style="position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; background-color: rgba(0, 0, 0, 0.7) !important; z-index: 999999 !important; display: flex !important; justify-content: center !important; align-items: center !important;">\n <div class="loader-squares">\n <div class="loader-square"></div>\n <div class="loader-square"></div>\n <div class="loader-square"></div>\n </div>\n </div>'; 10861 jQuery("body").append(t); 10862 } 10863 (this.isBlockCheckout() || 10864 (this.extractClassicAddressData(), 10865 (this.options.address.Country = ( 10866 this.options.address.Country || "" 10867 ).toUpperCase())), 10868 (this.userScroll = jQuery("html,body").scrollTop()), 10869 jQuery("html,body").scrollTop(0), 10870 jQuery("#sw").addClass("open"), 10871 jQuery("#sw-map-wrapper").addClass("loading"), 10872 jQuery("#sw-query").val(this.options.address.Streetname1), 10873 this.selectDisplayOption(0), 10874 this.options.address.Streetname1 10875 ? this.options.address.Lat && this.options.address.Long 10876 ? this.fetchPoints(this.options.address) 10877 : this.geocodeAddress(this.options.address, (t) => { 10878 (t.length && (t = t[0]), 10879 (this.options.address.Lat = t.lat), 10880 (this.options.address.Long = t.lng), 10881 t.iso2 && 10882 !this.options.address.Country && 10883 (this.options.address.Country = t.iso2), 10884 this.fetchPoints(this.options.address)); 10885 }) 10886 : jQuery(".CTT-loader-btn").remove()); 10887 } 10888 getShippingData() { 10889 let t = []; 10890 return ( 10891 this.getBlockShippingData(), 10892 (t.Address = this.options.address), 10893 t 10894 ); 10895 } 10896 getBlockShippingData() { 10897 return ( 10898 this.extractAddressData(!0), 10899 { Address: this.options.address, CarrierId: this.carrier_id || 0 } 10900 ); 10901 } 10902 pickupPointsLoadStop() { 10903 (jQuery("#sw-map-wrapper").removeClass("loading"), 10904 (this.searchRunning = !1)); 10905 } 10906 selectDisplayOption(t) { 10907 let e = jQuery(".sw-display-option, .sw-tab"); 10908 ((this.selectedDisplayOption = t), 10909 e.removeClass("selected"), 10910 jQuery(e.get(t)).addClass("selected"), 10911 jQuery(jQuery(".sw-tab").get(t)).addClass("selected"), 10912 0 == t && 10913 void 0 !== this.mapinterface && 10914 this.mapinterface.pickupPoints.length > 0 && 10915 this.mapinterface.fitBounds()); 10916 } 10917 setCarrierId(t) { 10918 ((this.carrier_id = t), this.mapinterface.setCarrierId(t)); 10919 } 10920 setAddress(t) { 10921 t.Streetname1 && 10922 t.Name && 10923 ((this.options.address = t), 10924 localStorage.setItem("CTTAddress", JSON.stringify(t))); 10925 } 10926 scriptsLoaded() { 10927 ((this.eSearchStatus = jQuery("#search-status")), 10928 this.addMapHtml(), 10929 this.options.gmapskey 10930 ? (this.mapinterface = new r(this.options, this)) 10931 : (this.mapinterface = new s(this.options, this)), 10932 this.mapinterface.initMap(), 10933 this.mapinterface.addMapMoveListener((t) => this.mapMoved(t))); 10934 } 10935 updateList(t) { 10936 jQuery("#sw-list-points").html(""); 10937 let e = jQuery("#sw-list-points"); 10938 for (let i = 0; i < t.length; ++i) this.addPointInfo(t[i], 0, "", e); 10939 } 10940 getWorkingDays(t) { 10941 if (!t) return ""; 10942 const e = []; 10943 let i = ""; 10944 for (let i = 0; i < 7; i++) 10945 if (t[i]) { 10946 const n = this.formatWorkingHours(t[i]), 10947 o = e[e.length - 1]; 10948 o && o.hours === n && o.end + 1 === i 10949 ? (o.end = i) 10950 : e.push({ start: i, end: i, hours: n }); 10951 } 10952 return ( 10953 e.forEach((t) => { 10954 if (null !== t.hours.match(/\d+/)) { 10955 const e = 10956 t.start === t.end 10957 ? this.getDayName(t.start) 10958 : `${this.getDayName(t.start)} - ${this.getDayName(t.end)}`; 10959 i += `<div class="sw-point-info-day" style="margin-bottom: -10px"><label>${e}</label>: ${t.hours}</div>`; 10960 } 10961 }), 10962 i 10963 ); 10964 } 10965 formatWorkingHours(t) { 10966 return t 10967 .map((t) => 10968 t.OpenTime && t.CloseTime ? `${t.OpenTime} - ${t.CloseTime}` : "", 10969 ) 10970 .filter(Boolean) 10971 .join(" | "); 10972 } 10973 getDayName(t) { 10974 return this.weekdaynames[t]; 10975 } 10976 }; 10977 class h { 10978 constructor(t) { 10979 ((this.markers = []), 10980 (this.isMapLoaded = !1), 10981 (this.gmaps_key = 10982 "undefined" == typeof CTT_maps_key ? "" : CTT_maps_key), 10983 (this.openMapMarkerIcons = {}), 10984 (this.ajax_url = t), 10985 (this.scriptsPreloaded = !1), 10986 (this.addressPreGeocoded = !1), 10987 (this.platform = new e(this.ajax_url)), 10988 this.platform.isCheckout(), 10989 this.init()); 10990 } 10991 init() { 10992 ((this.CTTWidget = new a({ 10993 host: "https://CTT.me", 10994 address: this.platform.getShippingData().Address, 10995 labels: {}, 10996 mapParentContainer: "body", 10997 buttonParentContainer: "body", 10998 buttonClass: "", 10999 ajax_url: this.ajax_url, 11000 carrierId: this.platform.getShippingData().CarrierId, 11001 onPointSelected: () => {}, 11002 gmapskey: "undefined" == typeof CTT_maps_key ? "" : CTT_maps_key, 11003 })), 11004 this.CTTWidget.init(), 11005 this.preloadMapResources()); 11006 } 11007 preloadMapResources() { 11008 setTimeout(() => { 11009 this.CTTWidget.mapinterface && 11010 !this.scriptsPreloaded && 11011 ((this.scriptsPreloaded = !0), 11012 0 === jQuery("#sw").length && this.CTTWidget.addMapHtml()); 11013 }, 2e3); 11014 } 11015 preFetchPickupPoints() { 11016 if (!this.CTTWidget.carrier_id || !this.CTTWidget.options.address.Lat) 11017 return; 11018 const t = { 11019 Address: this.CTTWidget.options.address, 11020 CarrierId: this.CTTWidget.carrier_id, 11021 action: "CTT_pickup_locations", 11022 }; 11023 jQuery 11024 .getJSON(this.ajax_url, t, (t) => { 11025 if (t && t.Point && t.Point.length > 0) { 11026 const e = this.CTTWidget.hashLatLng({ 11027 lat: this.CTTWidget.options.address.Lat, 11028 lng: this.CTTWidget.options.address.Long, 11029 }); 11030 this.CTTWidget.cacheResults[e] = t; 11031 } 11032 }) 11033 .fail(() => { 11034 console.log("â ï¸ Pre-fetch failed (not critical)"); 11035 }); 11036 } 11037 getPickupLocations(t) { 11038 const e =
11039 parseInt(jQuery("#shipping_carrier_id").val()) || 11040 (window.CTTPickupManager && window.CTTPickupManager.carrier_id); 11041 (e && 11042 ((this.CTTWidget.carrier_id = e), 11043 this.CTTWidget.setCarrierId && this.CTTWidget.setCarrierId(e)), 11044 jQuery(".CTT-loader-btn").stop(!0, !0).remove(), 11045 this.CTTWidget.openMap()); 11046 } 11047 } 11048 jQuery(function () { 11049 "undefined" != typeof woocommerce_params && 11050 (window.CTT = new h(woocommerce_params.ajax_url)); 11051 }); 11052 })()); 11053})(); 11054//# sourceMappingURL=CTT.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.