leaflet.pm.min.js 136 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164
  1. !function(t) {
  2. var e = {};
  3. function n(r) {
  4. if (e[r]) return e[r].exports;
  5. var i = e[r] = {
  6. i:r,
  7. l:!1,
  8. exports:{}
  9. };
  10. return t[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports;
  11. }
  12. n.m = t, n.c = e, n.d = function(t, e, r) {
  13. n.o(t, e) || Object.defineProperty(t, e, {
  14. configurable:!1,
  15. enumerable:!0,
  16. get:r
  17. });
  18. }, n.n = function(t) {
  19. var e = t && t.__esModule ? function() {
  20. return t["default"];
  21. } :function() {
  22. return t;
  23. };
  24. return n.d(e, "a", e), e;
  25. }, n.o = function(t, e) {
  26. return Object.prototype.hasOwnProperty.call(t, e);
  27. }, n.p = "", n(n.s = 19);
  28. }([ function(t, e, n) {
  29. "use strict";
  30. var r = n(10), i = L.Class.extend({
  31. includes:[ r.a ],
  32. options:{
  33. snappable:!0,
  34. snapDistance:20,
  35. cursorMarker:!0,
  36. finishOnDoubleClick:!1,
  37. finishOn:null,
  38. allowSelfIntersection:!0,
  39. templineStyle:{},
  40. hintlineStyle:{
  41. color:"#3388ff",
  42. dashArray:"5,5"
  43. },
  44. markerStyle:{
  45. draggable:!0
  46. }
  47. },
  48. initialize:function(t) {
  49. var e = this;
  50. this._map = t, this.shapes = [ "Marker", "Line", "Poly", "Rectangle", "Circle", "Cut" ],
  51. this.shapes.forEach(function(t) {
  52. e[t] = new L.PM.Draw[t](e._map);
  53. });
  54. },
  55. setPathOptions:function(t) {
  56. this.options.pathOptions = t;
  57. },
  58. getShapes:function() {
  59. return this.shapes;
  60. },
  61. enable:function(t, e) {
  62. if (!t) throw new Error("Error: Please pass a shape as a parameter. Possible shapes are: ".concat(this.getShapes().join(",")));
  63. this.disable(), this[t].enable(e);
  64. },
  65. disable:function() {
  66. var t = this;
  67. this.shapes.forEach(function(e) {
  68. t[e].disable();
  69. });
  70. },
  71. addControls:function() {
  72. var t = this;
  73. this.shapes.forEach(function(e) {
  74. t[e].addButton();
  75. });
  76. }
  77. });
  78. e.a = i;
  79. }, function(t, e, n) {
  80. "use strict";
  81. var r = n(10), i = n(35), a = L.Class.extend({
  82. includes:[ i.a, r.a ],
  83. options:{
  84. snappable:!0,
  85. snapDistance:20,
  86. allowSelfIntersection:!0,
  87. draggable:!0
  88. },
  89. isPolygon:function() {
  90. return this._layer instanceof L.Polygon;
  91. }
  92. });
  93. e.a = a;
  94. }, function(t, e, n) {
  95. "use strict";
  96. function r(t, e, n) {
  97. void 0 === n && (n = {});
  98. var r = {
  99. type:"Feature"
  100. };
  101. return (0 === n.id || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = e || {},
  102. r.geometry = t, r;
  103. }
  104. function i(t, e, n) {
  105. return void 0 === n && (n = {}), r({
  106. type:"Point",
  107. coordinates:t
  108. }, e, n);
  109. }
  110. function a(t, e, n) {
  111. void 0 === n && (n = {});
  112. for (var i = 0, a = t; i < a.length; i++) {
  113. var o = a[i];
  114. if (o.length < 4) throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
  115. for (var s = 0; s < o[o.length - 1].length; s++) if (o[o.length - 1][s] !== o[0][s]) throw new Error("First and last Position are not equivalent.");
  116. }
  117. return r({
  118. type:"Polygon",
  119. coordinates:t
  120. }, e, n);
  121. }
  122. function o(t, e, n) {
  123. if (void 0 === n && (n = {}), t.length < 2) throw new Error("coordinates must be an array of two or more positions");
  124. return r({
  125. type:"LineString",
  126. coordinates:t
  127. }, e, n);
  128. }
  129. function s(t, e) {
  130. void 0 === e && (e = {});
  131. var n = {
  132. type:"FeatureCollection"
  133. };
  134. return e.id && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.features = t, n;
  135. }
  136. function l(t, e, n) {
  137. return void 0 === n && (n = {}), r({
  138. type:"MultiLineString",
  139. coordinates:t
  140. }, e, n);
  141. }
  142. function h(t, e, n) {
  143. return void 0 === n && (n = {}), r({
  144. type:"MultiPoint",
  145. coordinates:t
  146. }, e, n);
  147. }
  148. function u(t, e, n) {
  149. return void 0 === n && (n = {}), r({
  150. type:"MultiPolygon",
  151. coordinates:t
  152. }, e, n);
  153. }
  154. function c(t, n) {
  155. void 0 === n && (n = "kilometers");
  156. var r = e.factors[n];
  157. if (!r) throw new Error(n + " units is invalid");
  158. return t * r;
  159. }
  160. function p(t, n) {
  161. void 0 === n && (n = "kilometers");
  162. var r = e.factors[n];
  163. if (!r) throw new Error(n + " units is invalid");
  164. return t / r;
  165. }
  166. function f(t) {
  167. return 180 * (t % (2 * Math.PI)) / Math.PI;
  168. }
  169. function d(t) {
  170. return !isNaN(t) && null !== t && !Array.isArray(t) && !/^\s*$/.test(t);
  171. }
  172. Object.defineProperty(e, "__esModule", {
  173. value:!0
  174. }), e.earthRadius = 6371008.8, e.factors = {
  175. centimeters:100 * e.earthRadius,
  176. centimetres:100 * e.earthRadius,
  177. degrees:e.earthRadius / 111325,
  178. feet:3.28084 * e.earthRadius,
  179. inches:39.37 * e.earthRadius,
  180. kilometers:e.earthRadius / 1e3,
  181. kilometres:e.earthRadius / 1e3,
  182. meters:e.earthRadius,
  183. metres:e.earthRadius,
  184. miles:e.earthRadius / 1609.344,
  185. millimeters:1e3 * e.earthRadius,
  186. millimetres:1e3 * e.earthRadius,
  187. nauticalmiles:e.earthRadius / 1852,
  188. radians:1,
  189. yards:e.earthRadius / 1.0936
  190. }, e.unitsFactors = {
  191. centimeters:100,
  192. centimetres:100,
  193. degrees:1 / 111325,
  194. feet:3.28084,
  195. inches:39.37,
  196. kilometers:.001,
  197. kilometres:.001,
  198. meters:1,
  199. metres:1,
  200. miles:1 / 1609.344,
  201. millimeters:1e3,
  202. millimetres:1e3,
  203. nauticalmiles:1 / 1852,
  204. radians:1 / e.earthRadius,
  205. yards:1 / 1.0936
  206. }, e.areaFactors = {
  207. acres:247105e-9,
  208. centimeters:1e4,
  209. centimetres:1e4,
  210. feet:10.763910417,
  211. inches:1550.003100006,
  212. kilometers:1e-6,
  213. kilometres:1e-6,
  214. meters:1,
  215. metres:1,
  216. miles:3.86e-7,
  217. millimeters:1e6,
  218. millimetres:1e6,
  219. yards:1.195990046
  220. }, e.feature = r, e.geometry = function(t, e, n) {
  221. switch (void 0 === n && (n = {}), t) {
  222. case "Point":
  223. return i(e).geometry;
  224. case "LineString":
  225. return o(e).geometry;
  226. case "Polygon":
  227. return a(e).geometry;
  228. case "MultiPoint":
  229. return h(e).geometry;
  230. case "MultiLineString":
  231. return l(e).geometry;
  232. case "MultiPolygon":
  233. return u(e).geometry;
  234. default:
  235. throw new Error(t + " is invalid");
  236. }
  237. }, e.point = i, e.points = function(t, e, n) {
  238. return void 0 === n && (n = {}), s(t.map(function(t) {
  239. return i(t, e);
  240. }), n);
  241. }, e.polygon = a, e.polygons = function(t, e, n) {
  242. return void 0 === n && (n = {}), s(t.map(function(t) {
  243. return a(t, e);
  244. }), n);
  245. }, e.lineString = o, e.lineStrings = function(t, e, n) {
  246. return void 0 === n && (n = {}), s(t.map(function(t) {
  247. return o(t, e);
  248. }), n);
  249. }, e.featureCollection = s, e.multiLineString = l, e.multiPoint = h, e.multiPolygon = u,
  250. e.geometryCollection = function(t, e, n) {
  251. return void 0 === n && (n = {}), r({
  252. type:"GeometryCollection",
  253. geometries:t
  254. }, e, n);
  255. }, e.round = function(t, e) {
  256. if (void 0 === e && (e = 0), e && !(e >= 0)) throw new Error("precision must be a positive number");
  257. var n = Math.pow(10, e || 0);
  258. return Math.round(t * n) / n;
  259. }, e.radiansToLength = c, e.lengthToRadians = p, e.lengthToDegrees = function(t, e) {
  260. return f(p(t, e));
  261. }, e.bearingToAzimuth = function(t) {
  262. var e = t % 360;
  263. return e < 0 && (e += 360), e;
  264. }, e.radiansToDegrees = f, e.degreesToRadians = function(t) {
  265. return t % 360 * Math.PI / 180;
  266. }, e.convertLength = function(t, e, n) {
  267. if (void 0 === e && (e = "kilometers"), void 0 === n && (n = "kilometers"), !(t >= 0)) throw new Error("length must be a positive number");
  268. return c(p(t, e), n);
  269. }, e.convertArea = function(t, n, r) {
  270. if (void 0 === n && (n = "meters"), void 0 === r && (r = "kilometers"), !(t >= 0)) throw new Error("area must be a positive number");
  271. var i = e.areaFactors[n];
  272. if (!i) throw new Error("invalid original units");
  273. var a = e.areaFactors[r];
  274. if (!a) throw new Error("invalid final units");
  275. return t / i * a;
  276. }, e.isNumber = d, e.isObject = function(t) {
  277. return !!t && t.constructor === Object;
  278. }, e.validateBBox = function(t) {
  279. if (!t) throw new Error("bbox is required");
  280. if (!Array.isArray(t)) throw new Error("bbox must be an Array");
  281. if (4 !== t.length && 6 !== t.length) throw new Error("bbox must be an Array of 4 or 6 numbers");
  282. t.forEach(function(t) {
  283. if (!d(t)) throw new Error("bbox must only contain numbers");
  284. });
  285. }, e.validateId = function(t) {
  286. if (!t) throw new Error("id is required");
  287. if (-1 === [ "string", "number" ].indexOf(typeof t)) throw new Error("id must be a number or a string");
  288. }, e.radians2degrees = function() {
  289. throw new Error("method has been renamed to `radiansToDegrees`");
  290. }, e.degrees2radians = function() {
  291. throw new Error("method has been renamed to `degreesToRadians`");
  292. }, e.distanceToDegrees = function() {
  293. throw new Error("method has been renamed to `lengthToDegrees`");
  294. }, e.distanceToRadians = function() {
  295. throw new Error("method has been renamed to `lengthToRadians`");
  296. }, e.radiansToDistance = function() {
  297. throw new Error("method has been renamed to `radiansToLength`");
  298. }, e.bearingToAngle = function() {
  299. throw new Error("method has been renamed to `bearingToAzimuth`");
  300. }, e.convertDistance = function() {
  301. throw new Error("method has been renamed to `convertLength`");
  302. };
  303. }, function(t, e, n) {
  304. var r = n(17)(Object, "create");
  305. t.exports = r;
  306. }, function(t, e, n) {
  307. var r = n(68);
  308. t.exports = function(t, e) {
  309. for (var n = t.length; n--; ) if (r(t[n][0], e)) return n;
  310. return -1;
  311. };
  312. }, function(t, e, n) {
  313. var r = n(74);
  314. t.exports = function(t, e) {
  315. var n = t.__data__;
  316. return r(e) ? n["string" == typeof e ? "string" :"hash"] :n.map;
  317. };
  318. }, function(t, e) {
  319. var n = Array.isArray;
  320. t.exports = n;
  321. }, function(t, e, n) {
  322. var r = n(16), i = n(47), a = "[object Symbol]";
  323. t.exports = function(t) {
  324. return "symbol" == typeof t || i(t) && r(t) == a;
  325. };
  326. }, function(t, e, n) {
  327. var r = n(9).Symbol;
  328. t.exports = r;
  329. }, function(t, e, n) {
  330. var r = n(43), i = "object" == typeof self && self && self.Object === Object && self, a = r || i || Function("return this")();
  331. t.exports = a;
  332. }, function(t, e, n) {
  333. "use strict";
  334. var r = n(11), i = {
  335. _initSnappableMarkers:function() {
  336. this.options.snapDistance = this.options.snapDistance || 30, this._assignEvents(this._markers),
  337. this._layer.off("pm:dragstart", this._unsnap, this), this._layer.on("pm:dragstart", this._unsnap, this);
  338. },
  339. _assignEvents:function(t) {
  340. var e = this;
  341. t.forEach(function(t) {
  342. Array.isArray(t) ? e._assignEvents(t) :(t.off("drag", e._handleSnapping, e), t.on("drag", e._handleSnapping, e),
  343. t.off("dragend", e._cleanupSnapping, e), t.on("dragend", e._cleanupSnapping, e));
  344. });
  345. },
  346. _unsnap:function() {
  347. delete this._snapLatLng;
  348. },
  349. _cleanupSnapping:function() {
  350. delete this._snapList, this._map.off("pm:remove", this._handleSnapLayerRemoval, this),
  351. this.debugIndicatorLines && this.debugIndicatorLines.forEach(function(t) {
  352. t.remove();
  353. });
  354. },
  355. _handleSnapLayerRemoval:function(t) {
  356. var e = t.layer, n = this._snapList.findIndex(function(t) {
  357. return t._leaflet_id === e._leaflet_id;
  358. });
  359. this._snapList.splice(n, 1);
  360. },
  361. _handleSnapping:function(t) {
  362. var e = this;
  363. if (t.originalEvent.altKey) return !1;
  364. if (this._snapList === undefined && this._createSnapList(t), this._snapList.length <= 0) return !1;
  365. var n, r = t.target, i = this._calcClosestLayer(r.getLatLng(), this._snapList), a = i.layer instanceof L.Marker || i.layer instanceof L.CircleMarker;
  366. n = a ? i.latlng :this._checkPrioritiySnapping(i);
  367. var o = this.options.snapDistance, s = {
  368. marker:r,
  369. snapLatLng:n,
  370. segment:i.segment,
  371. layer:this._layer,
  372. layerInteractedWith:i.layer,
  373. distance:i.distance
  374. };
  375. if (s.marker.fire("pm:snapdrag", s), this._layer.fire("pm:snapdrag", s), i.distance < o) {
  376. r.setLatLng(n), r._snapped = !0;
  377. var l = this._snapLatLng || {}, h = n || {};
  378. l.lat === h.lat && l.lng === h.lng || (e._snapLatLng = n, r.fire("pm:snap", s),
  379. e._layer.fire("pm:snap", s));
  380. } else this._snapLatLng && (this._unsnap(s), r._snapped = !1, s.marker.fire("pm:unsnap", s),
  381. this._layer.fire("pm:unsnap", s));
  382. return !0;
  383. },
  384. _checkPrioritiySnapping:function(t) {
  385. var e, n = this._map, i = t.segment[0], a = t.segment[1], o = t.latlng, s = this._getDistance(n, i, o), l = this._getDistance(n, a, o), h = s < l ? i :a, u = s < l ? s :l;
  386. if (this.options.snapMiddle) {
  387. var c = r.a.calcMiddleLatLng(n, i, a), p = this._getDistance(n, c, o);
  388. p < s && p < l && (h = c, u = p);
  389. }
  390. return e = u < this.options.snapDistance ? h :o, Object.assign({}, e);
  391. },
  392. _createSnapList:function() {
  393. var t = this, e = [], n = [], r = this._map;
  394. r.off("pm:remove", this._handleSnapLayerRemoval, this), r.on("pm:remove", this._handleSnapLayerRemoval, this),
  395. r.eachLayer(function(t) {
  396. if (t instanceof L.Polyline || t instanceof L.Marker || t instanceof L.CircleMarker) {
  397. e.push(t);
  398. var r = L.polyline([], {
  399. color:"red",
  400. pmIgnore:!0
  401. });
  402. n.push(r);
  403. }
  404. }), e = (e = (e = e.filter(function(e) {
  405. return t._layer !== e;
  406. })).filter(function(t) {
  407. return t._latlng || t._latlngs && t._latlngs.length > 0;
  408. })).filter(function(t) {
  409. return !t._pmTempLayer;
  410. }), this._otherSnapLayers ? this._snapList = e.concat(this._otherSnapLayers) :this._snapList = e,
  411. this.debugIndicatorLines = n;
  412. },
  413. _calcClosestLayer:function(t, e) {
  414. var n = this, r = {};
  415. return e.forEach(function(e, i) {
  416. var a = n._calcLayerDistances(t, e);
  417. n.debugIndicatorLines[i].setLatLngs([ t, a.latlng ]), (r.distance === undefined || a.distance < r.distance) && ((r = a).layer = e);
  418. }), r;
  419. },
  420. _calcLayerDistances:function(t, e) {
  421. var n, r, i = this, a = this._map, o = e instanceof L.Marker || e instanceof L.CircleMarker, s = e instanceof L.Polygon, l = t, h = o ? e.getLatLng() :e.getLatLngs();
  422. if (o) return {
  423. latlng:Object.assign({}, h),
  424. distance:this._getDistance(a, h, l)
  425. };
  426. !function c(t) {
  427. t.forEach(function(e, o) {
  428. if (Array.isArray(e)) c(e); else {
  429. var h, u = e;
  430. h = s ? o + 1 === t.length ? 0 :o + 1 :o + 1 === t.length ? undefined :o + 1;
  431. var p = t[h];
  432. if (p) {
  433. var f = i._getDistanceToSegment(a, l, u, p);
  434. (r === undefined || f < r) && (r = f, n = [ u, p ]);
  435. }
  436. }
  437. });
  438. }(h);
  439. var u = this._getClosestPointOnSegment(a, t, n[0], n[1]);
  440. return {
  441. latlng:Object.assign({}, u),
  442. segment:n,
  443. distance:r
  444. };
  445. },
  446. _getClosestPointOnSegment:function(t, e, n, r) {
  447. var i = t.getMaxZoom();
  448. i === Infinity && (i = t.getZoom());
  449. var a = t.project(e, i), o = t.project(n, i), s = t.project(r, i), l = L.LineUtil.closestPointOnSegment(a, o, s);
  450. return t.unproject(l, i);
  451. },
  452. _getDistanceToSegment:function(t, e, n, r) {
  453. var i = t.latLngToLayerPoint(e), a = t.latLngToLayerPoint(n), o = t.latLngToLayerPoint(r);
  454. return L.LineUtil.pointToSegmentDistance(i, a, o);
  455. },
  456. _getDistance:function(t, e, n) {
  457. return t.latLngToLayerPoint(e).distanceTo(t.latLngToLayerPoint(n));
  458. }
  459. };
  460. e.a = i;
  461. }, function(t, e, n) {
  462. "use strict";
  463. e.a = {
  464. calcMiddleLatLng:function(t, e, n) {
  465. var r = t.project(e), i = t.project(n);
  466. return t.unproject(r._add(i)._divideBy(2));
  467. }
  468. };
  469. }, function(t, e, n) {
  470. "use strict";
  471. Object.defineProperty(e, "__esModule", {
  472. value:!0
  473. });
  474. var r = n(2);
  475. function i(t, e, n, r, i, a, o, s) {
  476. var l, h, u, c, p = {
  477. x:null,
  478. y:null,
  479. onLine1:!1,
  480. onLine2:!1
  481. };
  482. return 0 === (l = (s - a) * (n - t) - (o - i) * (r - e)) ? null !== p.x && null !== p.y && p :(c = (n - t) * (h = e - a) - (r - e) * (u = t - i),
  483. h = ((o - i) * h - (s - a) * u) / l, u = c / l, p.x = t + h * (n - t), p.y = e + h * (r - e),
  484. h >= 0 && h <= 1 && (p.onLine1 = !0), u >= 0 && u <= 1 && (p.onLine2 = !0), !(!p.onLine1 || !p.onLine2) && [ p.x, p.y ]);
  485. }
  486. e["default"] = function(t) {
  487. var e, n, a = {
  488. type:"FeatureCollection",
  489. features:[]
  490. };
  491. if ("LineString" === (n = "Feature" === t.type ? t.geometry :t).type) e = [ n.coordinates ]; else if ("MultiLineString" === n.type) e = n.coordinates; else if ("MultiPolygon" === n.type) e = [].concat.apply([], n.coordinates); else {
  492. if ("Polygon" !== n.type) throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");
  493. e = n.coordinates;
  494. }
  495. return e.forEach(function(t) {
  496. e.forEach(function(e) {
  497. for (var n = 0; n < t.length - 1; n++) for (var o = n; o < e.length - 1; o++) {
  498. if (t === e) {
  499. if (1 === Math.abs(n - o)) continue;
  500. if (0 === n && o === t.length - 2 && t[n][0] === t[t.length - 1][0] && t[n][1] === t[t.length - 1][1]) continue;
  501. }
  502. var s = i(t[n][0], t[n][1], t[n + 1][0], t[n + 1][1], e[o][0], e[o][1], e[o + 1][0], e[o + 1][1]);
  503. s && a.features.push(r.point([ s[0], s[1] ]));
  504. }
  505. });
  506. }), a;
  507. };
  508. }, function(t, e, n) {
  509. "use strict";
  510. Object.defineProperty(e, "__esModule", {
  511. value:!0
  512. });
  513. var r = n(2);
  514. e.getCoord = function(t) {
  515. if (!t) throw new Error("coord is required");
  516. if (!Array.isArray(t)) {
  517. if ("Feature" === t.type && null !== t.geometry && "Point" === t.geometry.type) return t.geometry.coordinates;
  518. if ("Point" === t.type) return t.coordinates;
  519. }
  520. if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1])) return t;
  521. throw new Error("coord must be GeoJSON Point or an Array of numbers");
  522. }, e.getCoords = function(t) {
  523. if (Array.isArray(t)) return t;
  524. if ("Feature" === t.type) {
  525. if (null !== t.geometry) return t.geometry.coordinates;
  526. } else if (t.coordinates) return t.coordinates;
  527. throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
  528. }, e.containsNumber = function i(t) {
  529. if (t.length > 1 && r.isNumber(t[0]) && r.isNumber(t[1])) return !0;
  530. if (Array.isArray(t[0]) && t[0].length) return i(t[0]);
  531. throw new Error("coordinates must only contain numbers");
  532. }, e.geojsonType = function(t, e, n) {
  533. if (!e || !n) throw new Error("type and name required");
  534. if (!t || t.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + t.type);
  535. }, e.featureOf = function(t, e, n) {
  536. if (!t) throw new Error("No feature passed");
  537. if (!n) throw new Error(".featureOf() requires a name");
  538. if (!t || "Feature" !== t.type || !t.geometry) throw new Error("Invalid input to " + n + ", Feature with geometry required");
  539. if (!t.geometry || t.geometry.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + t.geometry.type);
  540. }, e.collectionOf = function(t, e, n) {
  541. if (!t) throw new Error("No featureCollection passed");
  542. if (!n) throw new Error(".collectionOf() requires a name");
  543. if (!t || "FeatureCollection" !== t.type) throw new Error("Invalid input to " + n + ", FeatureCollection required");
  544. for (var r = 0, i = t.features; r < i.length; r++) {
  545. var a = i[r];
  546. if (!a || "Feature" !== a.type || !a.geometry) throw new Error("Invalid input to " + n + ", Feature with geometry required");
  547. if (!a.geometry || a.geometry.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + a.geometry.type);
  548. }
  549. }, e.getGeom = function(t) {
  550. return "Feature" === t.type ? t.geometry :t;
  551. }, e.getType = function(t, e) {
  552. return "FeatureCollection" === t.type ? "FeatureCollection" :"GeometryCollection" === t.type ? "GeometryCollection" :"Feature" === t.type && null !== t.geometry ? t.geometry.type :t.type;
  553. };
  554. }, function(t, e, n) {
  555. !function(t, n) {
  556. n(e);
  557. }(0, function(t) {
  558. "use strict";
  559. function e(t, e) {
  560. return t > e ? 1 :t < e ? -1 :0;
  561. }
  562. var n = function(t, n) {
  563. void 0 === t && (t = e), void 0 === n && (n = !1), this._compare = t, this._root = null,
  564. this._size = 0, this._noDuplicates = !!n;
  565. }, r = {
  566. size:{
  567. configurable:!0
  568. }
  569. };
  570. n.prototype.rotateLeft = function(t) {
  571. var e = t.right;
  572. e && (t.right = e.left, e.left && (e.left.parent = t), e.parent = t.parent), t.parent ? t === t.parent.left ? t.parent.left = e :t.parent.right = e :this._root = e,
  573. e && (e.left = t), t.parent = e;
  574. }, n.prototype.rotateRight = function(t) {
  575. var e = t.left;
  576. e && (t.left = e.right, e.right && (e.right.parent = t), e.parent = t.parent), t.parent ? t === t.parent.left ? t.parent.left = e :t.parent.right = e :this._root = e,
  577. e && (e.right = t), t.parent = e;
  578. }, n.prototype._splay = function(t) {
  579. for (;t.parent; ) {
  580. var e = t.parent;
  581. e.parent ? e.left === t && e.parent.left === e ? (this.rotateRight(e.parent), this.rotateRight(e)) :e.right === t && e.parent.right === e ? (this.rotateLeft(e.parent),
  582. this.rotateLeft(e)) :e.left === t && e.parent.right === e ? (this.rotateRight(e),
  583. this.rotateLeft(e)) :(this.rotateLeft(e), this.rotateRight(e)) :e.left === t ? this.rotateRight(e) :this.rotateLeft(e);
  584. }
  585. }, n.prototype.splay = function(t) {
  586. for (var e, n, r, i, a; t.parent; ) (n = (e = t.parent).parent) && n.parent ? ((r = n.parent).left === n ? r.left = t :r.right = t,
  587. t.parent = r) :(t.parent = null, this._root = t), i = t.left, a = t.right, t === e.left ? (n && (n.left === e ? (e.right ? (n.left = e.right,
  588. n.left.parent = n) :n.left = null, e.right = n, n.parent = e) :(i ? (n.right = i,
  589. i.parent = n) :n.right = null, t.left = n, n.parent = t)), a ? (e.left = a, a.parent = e) :e.left = null,
  590. t.right = e, e.parent = t) :(n && (n.right === e ? (e.left ? (n.right = e.left,
  591. n.right.parent = n) :n.right = null, e.left = n, n.parent = e) :(a ? (n.left = a,
  592. a.parent = n) :n.left = null, t.right = n, n.parent = t)), i ? (e.right = i, i.parent = e) :e.right = null,
  593. t.left = e, e.parent = t);
  594. }, n.prototype.replace = function(t, e) {
  595. t.parent ? t === t.parent.left ? t.parent.left = e :t.parent.right = e :this._root = e,
  596. e && (e.parent = t.parent);
  597. }, n.prototype.minNode = function(t) {
  598. if (void 0 === t && (t = this._root), t) for (;t.left; ) t = t.left;
  599. return t;
  600. }, n.prototype.maxNode = function(t) {
  601. if (void 0 === t && (t = this._root), t) for (;t.right; ) t = t.right;
  602. return t;
  603. }, n.prototype.insert = function(t, e) {
  604. var n = this._root, r = null, i = this._compare;
  605. if (this._noDuplicates) for (;n; ) {
  606. if (r = n, 0 === i(n.key, t)) return;
  607. n = i(n.key, t) < 0 ? n.right :n.left;
  608. } else for (;n; ) r = n, n = i(n.key, t) < 0 ? n.right :n.left;
  609. return n = {
  610. key:t,
  611. data:e,
  612. left:null,
  613. right:null,
  614. parent:r
  615. }, r ? i(r.key, n.key) < 0 ? r.right = n :r.left = n :this._root = n, this.splay(n),
  616. this._size++, n;
  617. }, n.prototype.find = function(t) {
  618. for (var e = this._root, n = this._compare; e; ) {
  619. var r = n(e.key, t);
  620. if (r < 0) e = e.right; else {
  621. if (!(r > 0)) return e;
  622. e = e.left;
  623. }
  624. }
  625. return null;
  626. }, n.prototype.contains = function(t) {
  627. for (var e = this._root, n = this._compare; e; ) {
  628. var r = n(t, e.key);
  629. if (0 === r) return !0;
  630. e = r < 0 ? e.left :e.right;
  631. }
  632. return !1;
  633. }, n.prototype.remove = function(t) {
  634. var e = this.find(t);
  635. if (!e) return !1;
  636. if (this.splay(e), e.left) if (e.right) {
  637. var n = this.minNode(e.right);
  638. n.parent !== e && (this.replace(n, n.right), n.right = e.right, n.right.parent = n),
  639. this.replace(e, n), n.left = e.left, n.left.parent = n;
  640. } else this.replace(e, e.left); else this.replace(e, e.right);
  641. return this._size--, !0;
  642. }, n.prototype.removeNode = function(t) {
  643. if (!t) return !1;
  644. if (this.splay(t), t.left) if (t.right) {
  645. var e = this.minNode(t.right);
  646. e.parent !== t && (this.replace(e, e.right), e.right = t.right, e.right.parent = e),
  647. this.replace(t, e), e.left = t.left, e.left.parent = e;
  648. } else this.replace(t, t.left); else this.replace(t, t.right);
  649. return this._size--, !0;
  650. }, n.prototype.erase = function(t) {
  651. var e = this.find(t);
  652. if (e) {
  653. this.splay(e);
  654. var n = e.left, r = e.right, i = null;
  655. n && (n.parent = null, i = this.maxNode(n), this.splay(i), this._root = i), r && (n ? i.right = r :this._root = r,
  656. r.parent = i), this._size--;
  657. }
  658. }, n.prototype.pop = function() {
  659. var t = this._root, e = null;
  660. if (t) {
  661. for (;t.left; ) t = t.left;
  662. e = {
  663. key:t.key,
  664. data:t.data
  665. }, this.remove(t.key);
  666. }
  667. return e;
  668. }, n.prototype.next = function(t) {
  669. var e = t;
  670. if (e) if (e.right) for (e = e.right; e && e.left; ) e = e.left; else for (e = t.parent; e && e.right === t; ) t = e,
  671. e = e.parent;
  672. return e;
  673. }, n.prototype.prev = function(t) {
  674. var e = t;
  675. if (e) if (e.left) for (e = e.left; e && e.right; ) e = e.right; else for (e = t.parent; e && e.left === t; ) t = e,
  676. e = e.parent;
  677. return e;
  678. }, n.prototype.forEach = function(t) {
  679. for (var e = this._root, n = [], r = !1, i = 0; !r; ) e ? (n.push(e), e = e.left) :n.length > 0 ? (t(e = n.pop(), i++),
  680. e = e.right) :r = !0;
  681. return this;
  682. }, n.prototype.range = function(t, e, n, r) {
  683. for (var i = [], a = this._compare, o = this._root; 0 !== i.length || o; ) if (o) i.push(o),
  684. o = o.left; else {
  685. if (a((o = i.pop()).key, e) > 0) break;
  686. if (a(o.key, t) >= 0 && n.call(r, o)) return this;
  687. o = o.right;
  688. }
  689. return this;
  690. }, n.prototype.keys = function() {
  691. for (var t = this._root, e = [], n = [], r = !1; !r; ) t ? (e.push(t), t = t.left) :e.length > 0 ? (t = e.pop(),
  692. n.push(t.key), t = t.right) :r = !0;
  693. return n;
  694. }, n.prototype.values = function() {
  695. for (var t = this._root, e = [], n = [], r = !1; !r; ) t ? (e.push(t), t = t.left) :e.length > 0 ? (t = e.pop(),
  696. n.push(t.data), t = t.right) :r = !0;
  697. return n;
  698. }, n.prototype.at = function(t) {
  699. for (var e = this._root, n = [], r = !1, i = 0; !r; ) if (e) n.push(e), e = e.left; else if (n.length > 0) {
  700. if (e = n.pop(), i === t) return e;
  701. i++, e = e.right;
  702. } else r = !0;
  703. return null;
  704. }, n.prototype.load = function(t, e, n) {
  705. if (void 0 === t && (t = []), void 0 === e && (e = []), void 0 === n && (n = !1),
  706. 0 !== this._size) throw new Error("bulk-load: tree is not empty");
  707. var r = t.length;
  708. return n && function i(t, e, n, r, a) {
  709. if (n >= r) return;
  710. var o = t[n + r >> 1];
  711. var s = n - 1;
  712. var l = r + 1;
  713. for (;;) {
  714. do {
  715. s++;
  716. } while (a(t[s], o) < 0);
  717. do {
  718. l--;
  719. } while (a(t[l], o) > 0);
  720. if (s >= l) break;
  721. var h = t[s];
  722. t[s] = t[l], t[l] = h, h = e[s], e[s] = e[l], e[l] = h;
  723. }
  724. i(t, e, n, l, a);
  725. i(t, e, l + 1, r, a);
  726. }(t, e, 0, r - 1, this._compare), this._root = function a(t, e, n, r, i) {
  727. var o = i - r;
  728. if (o > 0) {
  729. var s = r + Math.floor(o / 2), l = e[s], h = n[s], u = {
  730. key:l,
  731. data:h,
  732. parent:t
  733. };
  734. return u.left = a(u, e, n, r, s), u.right = a(u, e, n, s + 1, i), u;
  735. }
  736. return null;
  737. }(null, t, e, 0, r), this._size = r, this;
  738. }, n.prototype.min = function() {
  739. var t = this.minNode(this._root);
  740. return t ? t.key :null;
  741. }, n.prototype.max = function() {
  742. var t = this.maxNode(this._root);
  743. return t ? t.key :null;
  744. }, n.prototype.isEmpty = function() {
  745. return null === this._root;
  746. }, r.size.get = function() {
  747. return this._size;
  748. }, n.createTree = function(t, e, r, i, a) {
  749. return new n(r, a).load(t, e, i);
  750. }, Object.defineProperties(n.prototype, r);
  751. var i = 0, a = 1, o = 2, s = 3, l = 0, h = 1, u = 2, c = 3;
  752. function p(t, e, n) {
  753. null === e ? (t.inOut = !1, t.otherInOut = !0) :(t.isSubject === e.isSubject ? (t.inOut = !e.inOut,
  754. t.otherInOut = e.otherInOut) :(t.inOut = !e.otherInOut, t.otherInOut = e.isVertical() ? !e.inOut :e.inOut),
  755. e && (t.prevInResult = !f(e, n) || e.isVertical() ? e.prevInResult :e)), t.inResult = f(t, n);
  756. }
  757. function f(t, e) {
  758. switch (t.type) {
  759. case i:
  760. switch (e) {
  761. case l:
  762. return !t.otherInOut;
  763. case h:
  764. return t.otherInOut;
  765. case u:
  766. return t.isSubject && t.otherInOut || !t.isSubject && !t.otherInOut;
  767. case c:
  768. return !0;
  769. }
  770. break;
  771. case o:
  772. return e === l || e === h;
  773. case s:
  774. return e === u;
  775. case a:
  776. return !1;
  777. }
  778. return !1;
  779. }
  780. var d = function(t, e, n, r, a) {
  781. this.left = e, this.point = t, this.otherEvent = n, this.isSubject = r, this.type = a || i,
  782. this.inOut = !1, this.otherInOut = !1, this.prevInResult = null, this.inResult = !1,
  783. this.resultInOut = !1, this.isExteriorRing = !0;
  784. };
  785. function g(t, e) {
  786. return t[0] === e[0] && t[1] === e[1];
  787. }
  788. function _(t, e, n) {
  789. return (t[0] - n[0]) * (e[1] - n[1]) - (e[0] - n[0]) * (t[1] - n[1]);
  790. }
  791. function m(t, e) {
  792. var n = t.point, r = e.point;
  793. return n[0] > r[0] ? 1 :n[0] < r[0] ? -1 :n[1] !== r[1] ? n[1] > r[1] ? 1 :-1 :function(t, e, n, r) {
  794. if (t.left !== e.left) return t.left ? 1 :-1;
  795. if (0 !== _(n, t.otherEvent.point, e.otherEvent.point)) return t.isBelow(e.otherEvent.point) ? -1 :1;
  796. return !t.isSubject && e.isSubject ? 1 :-1;
  797. }(t, e, n);
  798. }
  799. function y(t, e, n) {
  800. var r = new d(e, !1, t, t.isSubject), i = new d(e, !0, t.otherEvent, t.isSubject);
  801. return g(t.point, t.otherEvent.point) && console.warn("what is that, a collapsed segment?", t),
  802. r.contourId = i.contourId = t.contourId, m(i, t.otherEvent) > 0 && (t.otherEvent.left = !0,
  803. i.left = !1), t.otherEvent.otherEvent = i, t.otherEvent = r, n.push(i), n.push(r),
  804. n;
  805. }
  806. function v(t, e) {
  807. return t[0] * e[1] - t[1] * e[0];
  808. }
  809. function L(t, e) {
  810. return t[0] * e[0] + t[1] * e[1];
  811. }
  812. function b(t, e, n) {
  813. var r = function(t, e, n, r, i) {
  814. var a = [ e[0] - t[0], e[1] - t[1] ], o = [ r[0] - n[0], r[1] - n[1] ];
  815. function s(t, e, n) {
  816. return [ t[0] + e * n[0], t[1] + e * n[1] ];
  817. }
  818. var l = [ n[0] - t[0], n[1] - t[1] ], h = v(a, o), u = h * h, c = L(a, a);
  819. if (u > 0) {
  820. var p = v(l, o) / h;
  821. if (p < 0 || p > 1) return null;
  822. var f = v(l, a) / h;
  823. return f < 0 || f > 1 ? null :0 === p || 1 === p ? i ? null :[ s(t, p, a) ] :0 === f || 1 === f ? i ? null :[ s(n, f, o) ] :[ s(t, p, a) ];
  824. }
  825. if ((u = (h = v(l, a)) * h) > 0) return null;
  826. var d = L(a, l) / c, g = d + L(a, o) / c, _ = Math.min(d, g), m = Math.max(d, g);
  827. return _ <= 1 && m >= 0 ? 1 === _ ? i ? null :[ s(t, _ > 0 ? _ :0, a) ] :0 === m ? i ? null :[ s(t, m < 1 ? m :1, a) ] :i && 0 === _ && 1 === m ? null :[ s(t, _ > 0 ? _ :0, a), s(t, m < 1 ? m :1, a) ] :null;
  828. }(t.point, t.otherEvent.point, e.point, e.otherEvent.point), i = r ? r.length :0;
  829. if (0 === i) return 0;
  830. if (1 === i && (g(t.point, e.point) || g(t.otherEvent.point, e.otherEvent.point))) return 0;
  831. if (2 === i && t.isSubject === e.isSubject) return 0;
  832. if (1 === i) return g(t.point, r[0]) || g(t.otherEvent.point, r[0]) || y(t, r[0], n),
  833. g(e.point, r[0]) || g(e.otherEvent.point, r[0]) || y(e, r[0], n), 1;
  834. var l = [], h = !1, u = !1;
  835. return g(t.point, e.point) ? h = !0 :1 === m(t, e) ? l.push(e, t) :l.push(t, e),
  836. g(t.otherEvent.point, e.otherEvent.point) ? u = !0 :1 === m(t.otherEvent, e.otherEvent) ? l.push(e.otherEvent, t.otherEvent) :l.push(t.otherEvent, e.otherEvent),
  837. h && u || h ? (e.type = a, t.type = e.inOut === t.inOut ? o :s, h && !u && y(l[1].otherEvent, l[0].point, n),
  838. 2) :u ? (y(l[0], l[1].point, n), 3) :l[0] !== l[3].otherEvent ? (y(l[0], l[1].point, n),
  839. y(l[1], l[2].point, n), 3) :(y(l[0], l[1].point, n), y(l[3].otherEvent, l[2].point, n),
  840. 3);
  841. }
  842. function k(t, e) {
  843. if (t === e) return 0;
  844. if (0 !== _(t.point, t.otherEvent.point, e.point) || 0 !== _(t.point, t.otherEvent.point, e.otherEvent.point)) return g(t.point, e.point) ? t.isBelow(e.otherEvent.point) ? -1 :1 :t.point[0] === e.point[0] ? t.point[1] < e.point[1] ? -1 :1 :1 === m(t, e) ? e.isAbove(t.point) ? -1 :1 :t.isBelow(e.point) ? -1 :1;
  845. if (t.isSubject !== e.isSubject) return t.isSubject ? -1 :1;
  846. var n = t.point, r = e.point;
  847. return n[0] === r[0] && n[1] === r[1] ? (n = t.otherEvent.point, r = e.otherEvent.point,
  848. n[0] === r[0] && n[1] === r[1] ? 0 :t.contourId > e.contourId ? 1 :-1) :1 === m(t, e) ? 1 :-1;
  849. }
  850. function M(t, e, n, r) {
  851. var i = t + 1, a = e.length;
  852. if (i > a - 1) return t - 1;
  853. for (var o = e[t].point, s = e[i].point; i < a && s[0] === o[0] && s[1] === o[1]; ) {
  854. if (!n[i]) return i;
  855. s = e[++i].point;
  856. }
  857. for (i = t - 1; n[i] && i >= r; ) i--;
  858. return i;
  859. }
  860. function w(t, e) {
  861. var n, r, i, a = function(t) {
  862. var e, n, r, i, a = [];
  863. for (n = 0, r = t.length; n < r; n++) ((e = t[n]).left && e.inResult || !e.left && e.otherEvent.inResult) && a.push(e);
  864. for (var o = !1; !o; ) for (o = !0, n = 0, r = a.length; n < r; n++) n + 1 < r && 1 === m(a[n], a[n + 1]) && (i = a[n],
  865. a[n] = a[n + 1], a[n + 1] = i, o = !1);
  866. for (n = 0, r = a.length; n < r; n++) (e = a[n]).pos = n;
  867. for (n = 0, r = a.length; n < r; n++) (e = a[n]).left || (i = e.pos, e.pos = e.otherEvent.pos,
  868. e.otherEvent.pos = i);
  869. return a;
  870. }(t), o = {}, s = [];
  871. for (n = 0, r = a.length; n < r; n++) if (!o[n]) {
  872. var l = [ [] ];
  873. a[n].isExteriorRing ? e === u && !a[n].isSubject && s.length > 1 ? s[s.length - 1].push(l[0]) :s.push(l) :e !== u || a[n].isSubject || 0 !== s.length ? 0 === s.length ? s.push([ [ l ] ]) :s[s.length - 1].push(l[0]) :s.push(l);
  874. var h = s.length - 1, c = n, p = a[n].point;
  875. for (l[0].push(p); c >= n; ) i = a[c], o[c] = !0, i.left ? (i.resultInOut = !1,
  876. i.contourId = h) :(i.otherEvent.resultInOut = !0, i.otherEvent.contourId = h), o[c = i.pos] = !0,
  877. l[0].push(a[c].point), c = M(c, a, o, n);
  878. i = a[c = -1 === c ? n :c], o[c] = o[i.pos] = !0, i.otherEvent.resultInOut = !0,
  879. i.otherEvent.contourId = h;
  880. }
  881. return s;
  882. }
  883. d.prototype.isBelow = function(t) {
  884. var e = this.point, n = this.otherEvent.point;
  885. return this.left ? (e[0] - t[0]) * (n[1] - t[1]) - (n[0] - t[0]) * (e[1] - t[1]) > 0 :(n[0] - t[0]) * (e[1] - t[1]) - (e[0] - t[0]) * (n[1] - t[1]) > 0;
  886. }, d.prototype.isAbove = function(t) {
  887. return !this.isBelow(t);
  888. }, d.prototype.isVertical = function() {
  889. return this.point[0] === this.otherEvent.point[0];
  890. }, d.prototype.clone = function() {
  891. var t = new d(this.point, this.left, this.otherEvent, this.isSubject, this.type);
  892. return t.inResult = this.inResult, t.prevInResult = this.prevInResult, t.isExteriorRing = this.isExteriorRing,
  893. t.inOut = this.inOut, t.otherInOut = this.otherInOut, t;
  894. };
  895. var E = x, S = x;
  896. function x(t, e) {
  897. if (!(this instanceof x)) return new x(t, e);
  898. if (this.data = t || [], this.length = this.data.length, this.compare = e || C,
  899. this.length > 0) for (var n = (this.length >> 1) - 1; n >= 0; n--) this._down(n);
  900. }
  901. function C(t, e) {
  902. return t < e ? -1 :t > e ? 1 :0;
  903. }
  904. x.prototype = {
  905. push:function(t) {
  906. this.data.push(t), this.length++, this._up(this.length - 1);
  907. },
  908. pop:function() {
  909. if (0 === this.length) return undefined;
  910. var t = this.data[0];
  911. return this.length--, this.length > 0 && (this.data[0] = this.data[this.length],
  912. this._down(0)), this.data.pop(), t;
  913. },
  914. peek:function() {
  915. return this.data[0];
  916. },
  917. _up:function(t) {
  918. for (var e = this.data, n = this.compare, r = e[t]; t > 0; ) {
  919. var i = t - 1 >> 1, a = e[i];
  920. if (n(r, a) >= 0) break;
  921. e[t] = a, t = i;
  922. }
  923. e[t] = r;
  924. },
  925. _down:function(t) {
  926. for (var e = this.data, n = this.compare, r = this.length >> 1, i = e[t]; t < r; ) {
  927. var a = 1 + (t << 1), o = a + 1, s = e[a];
  928. if (o < this.length && n(e[o], s) < 0 && (a = o, s = e[o]), n(s, i) >= 0) break;
  929. e[t] = s, t = a;
  930. }
  931. e[t] = i;
  932. }
  933. }, E["default"] = S;
  934. var P = Math.max, O = Math.min, I = 0;
  935. function D(t, e, n, r, i, a) {
  936. var o, s, l, h, u, c;
  937. for (o = 0, s = t.length - 1; o < s; o++) if (l = t[o], h = t[o + 1], u = new d(l, !1, undefined, e),
  938. c = new d(h, !1, u, e), u.otherEvent = c, l[0] !== h[0] || l[1] !== h[1]) {
  939. u.contourId = c.contourId = n, a || (u.isExteriorRing = !1, c.isExteriorRing = !1),
  940. m(u, c) > 0 ? c.left = !0 :u.left = !0;
  941. var p = l[0], f = l[1];
  942. i[0] = O(i[0], p), i[1] = O(i[1], f), i[2] = P(i[2], p), i[3] = P(i[3], f), r.push(u),
  943. r.push(c);
  944. }
  945. }
  946. var T = [];
  947. function j(t, e, r) {
  948. "number" == typeof t[0][0][0] && (t = [ t ]), "number" == typeof e[0][0][0] && (e = [ e ]);
  949. var i = function(t, e, n) {
  950. var r = null;
  951. return t.length * e.length == 0 && (n === l ? r = T :n === u ? r = t :n !== h && n !== c || (r = 0 === t.length ? e :t)),
  952. r;
  953. }(t, e, r);
  954. if (i) return i === T ? null :i;
  955. var a = [ Infinity, Infinity, -Infinity, -Infinity ], o = [ Infinity, Infinity, -Infinity, -Infinity ], s = function(t, e, n, r, i) {
  956. var a, o, s, l, h, c, p = new E(null, m);
  957. for (s = 0, l = t.length; s < l; s++) for (h = 0, c = (a = t[s]).length; h < c; h++) (o = 0 === h) && I++,
  958. D(a[h], !0, I, p, n, o);
  959. for (s = 0, l = e.length; s < l; s++) for (h = 0, c = (a = e[s]).length; h < c; h++) o = 0 === h,
  960. i === u && (o = !1), o && I++, D(a[h], !1, I, p, r, o);
  961. return p;
  962. }(t, e, a, o, r);
  963. return (i = function(t, e, n, r, i) {
  964. var a = null;
  965. return (n[0] > r[2] || r[0] > n[2] || n[1] > r[3] || r[1] > n[3]) && (i === l ? a = T :i === u ? a = t :i !== h && i !== c || (a = t.concat(e))),
  966. a;
  967. }(t, e, a, o, r)) ? i === T ? null :i :w(function(t, e, r, i, a, o) {
  968. for (var s, h, c, f = new n(k), d = [], g = Math.min(i[2], a[2]); 0 !== t.length; ) {
  969. var _ = t.pop();
  970. if (d.push(_), o === l && _.point[0] > g || o === u && _.point[0] > i[2]) break;
  971. if (_.left) {
  972. h = s = f.insert(_), s = s !== (c = f.minNode()) ? f.prev(s) :null, h = f.next(h);
  973. var m = s ? s.key :null;
  974. if (p(_, m, o), h && 2 === b(_, h.key, t) && (p(_, m, o), p(_, h.key, o)), s && 2 === b(s.key, _, t)) {
  975. var y = s;
  976. p(m, (y = y !== c ? f.prev(y) :null) ? y.key :null, o), p(_, m, o);
  977. }
  978. } else _ = _.otherEvent, h = s = f.find(_), s && h && (s = s !== c ? f.prev(s) :null,
  979. h = f.next(h), f.remove(_), h && s && b(s.key, h.key, t));
  980. }
  981. return d;
  982. }(s, 0, 0, a, o, r), r);
  983. }
  984. var R = {
  985. UNION:h,
  986. DIFFERENCE:u,
  987. INTERSECTION:l,
  988. XOR:c
  989. };
  990. t.union = function(t, e) {
  991. return j(t, e, h);
  992. }, t.diff = function(t, e) {
  993. return j(t, e, u);
  994. }, t.xor = function(t, e) {
  995. return j(t, e, c);
  996. }, t.intersection = function(t, e) {
  997. return j(t, e, l);
  998. }, t.operations = R, Object.defineProperty(t, "__esModule", {
  999. value:!0
  1000. });
  1001. });
  1002. }, function(t, e, n) {
  1003. "use strict";
  1004. Object.defineProperty(e, "__esModule", {
  1005. value:!0
  1006. });
  1007. var r = n(2);
  1008. function i(t, e, n) {
  1009. if (null !== t) for (var r, a, o, s, l, h, u, c, p = 0, f = 0, d = t.type, g = "FeatureCollection" === d, _ = "Feature" === d, m = g ? t.features.length :1, y = 0; y < m; y++) {
  1010. l = (c = !!(u = g ? t.features[y].geometry :_ ? t.geometry :t) && "GeometryCollection" === u.type) ? u.geometries.length :1;
  1011. for (var v = 0; v < l; v++) {
  1012. var L = 0, b = 0;
  1013. if (null !== (s = c ? u.geometries[v] :u)) {
  1014. h = s.coordinates;
  1015. var k = s.type;
  1016. switch (p = !n || "Polygon" !== k && "MultiPolygon" !== k ? 0 :1, k) {
  1017. case null:
  1018. break;
  1019. case "Point":
  1020. if (!1 === e(h, f, y, L, b)) return !1;
  1021. f++, L++;
  1022. break;
  1023. case "LineString":
  1024. case "MultiPoint":
  1025. for (r = 0; r < h.length; r++) {
  1026. if (!1 === e(h[r], f, y, L, b)) return !1;
  1027. f++, "MultiPoint" === k && L++;
  1028. }
  1029. "LineString" === k && L++;
  1030. break;
  1031. case "Polygon":
  1032. case "MultiLineString":
  1033. for (r = 0; r < h.length; r++) {
  1034. for (a = 0; a < h[r].length - p; a++) {
  1035. if (!1 === e(h[r][a], f, y, L, b)) return !1;
  1036. f++;
  1037. }
  1038. "MultiLineString" === k && L++, "Polygon" === k && b++;
  1039. }
  1040. "Polygon" === k && L++;
  1041. break;
  1042. case "MultiPolygon":
  1043. for (r = 0; r < h.length; r++) {
  1044. for (b = 0, a = 0; a < h[r].length; a++) {
  1045. for (o = 0; o < h[r][a].length - p; o++) {
  1046. if (!1 === e(h[r][a][o], f, y, L, b)) return !1;
  1047. f++;
  1048. }
  1049. b++;
  1050. }
  1051. L++;
  1052. }
  1053. break;
  1054. case "GeometryCollection":
  1055. for (r = 0; r < s.geometries.length; r++) if (!1 === i(s.geometries[r], e, n)) return !1;
  1056. break;
  1057. default:
  1058. throw new Error("Unknown Geometry Type");
  1059. }
  1060. }
  1061. }
  1062. }
  1063. }
  1064. function a(t, e) {
  1065. var n;
  1066. switch (t.type) {
  1067. case "FeatureCollection":
  1068. for (n = 0; n < t.features.length && !1 !== e(t.features[n].properties, n); n++) ;
  1069. break;
  1070. case "Feature":
  1071. e(t.properties, 0);
  1072. }
  1073. }
  1074. function o(t, e) {
  1075. if ("Feature" === t.type) e(t, 0); else if ("FeatureCollection" === t.type) for (var n = 0; n < t.features.length && !1 !== e(t.features[n], n); n++) ;
  1076. }
  1077. function s(t, e) {
  1078. var n, r, i, a, o, s, l, h, u, c, p = 0, f = "FeatureCollection" === t.type, d = "Feature" === t.type, g = f ? t.features.length :1;
  1079. for (n = 0; n < g; n++) {
  1080. for (s = f ? t.features[n].geometry :d ? t.geometry :t, h = f ? t.features[n].properties :d ? t.properties :{},
  1081. u = f ? t.features[n].bbox :d ? t.bbox :undefined, c = f ? t.features[n].id :d ? t.id :undefined,
  1082. o = (l = !!s && "GeometryCollection" === s.type) ? s.geometries.length :1, i = 0; i < o; i++) if (null !== (a = l ? s.geometries[i] :s)) switch (a.type) {
  1083. case "Point":
  1084. case "LineString":
  1085. case "MultiPoint":
  1086. case "Polygon":
  1087. case "MultiLineString":
  1088. case "MultiPolygon":
  1089. if (!1 === e(a, p, h, u, c)) return !1;
  1090. break;
  1091. case "GeometryCollection":
  1092. for (r = 0; r < a.geometries.length; r++) if (!1 === e(a.geometries[r], p, h, u, c)) return !1;
  1093. break;
  1094. default:
  1095. throw new Error("Unknown Geometry Type");
  1096. } else if (!1 === e(null, p, h, u, c)) return !1;
  1097. p++;
  1098. }
  1099. }
  1100. function l(t, e) {
  1101. s(t, function(t, n, i, a, o) {
  1102. var s, l = null === t ? null :t.type;
  1103. switch (l) {
  1104. case null:
  1105. case "Point":
  1106. case "LineString":
  1107. case "Polygon":
  1108. return !1 !== e(r.feature(t, i, {
  1109. bbox:a,
  1110. id:o
  1111. }), n, 0) && void 0;
  1112. }
  1113. switch (l) {
  1114. case "MultiPoint":
  1115. s = "Point";
  1116. break;
  1117. case "MultiLineString":
  1118. s = "LineString";
  1119. break;
  1120. case "MultiPolygon":
  1121. s = "Polygon";
  1122. }
  1123. for (var h = 0; h < t.coordinates.length; h++) {
  1124. var u = {
  1125. type:s,
  1126. coordinates:t.coordinates[h]
  1127. };
  1128. if (!1 === e(r.feature(u, i), n, h)) return !1;
  1129. }
  1130. });
  1131. }
  1132. function h(t, e) {
  1133. l(t, function(t, n, a) {
  1134. var o = 0;
  1135. if (t.geometry) {
  1136. var s = t.geometry.type;
  1137. if ("Point" !== s && "MultiPoint" !== s) {
  1138. var l, h = 0, u = 0, c = 0;
  1139. return !1 !== i(t, function(i, s, p, f, d) {
  1140. if (l === undefined || n > h || f > u || d > c) return l = i, h = n, u = f, c = d,
  1141. void (o = 0);
  1142. var g = r.lineString([ l, i ], t.properties);
  1143. if (!1 === e(g, n, a, d, o)) return !1;
  1144. o++, l = i;
  1145. }) && void 0;
  1146. }
  1147. }
  1148. });
  1149. }
  1150. function u(t, e) {
  1151. if (!t) throw new Error("geojson is required");
  1152. l(t, function(t, n, i) {
  1153. if (null !== t.geometry) {
  1154. var a = t.geometry.type, o = t.geometry.coordinates;
  1155. switch (a) {
  1156. case "LineString":
  1157. if (!1 === e(t, n, i, 0, 0)) return !1;
  1158. break;
  1159. case "Polygon":
  1160. for (var s = 0; s < o.length; s++) if (!1 === e(r.lineString(o[s], t.properties), n, i, s)) return !1;
  1161. }
  1162. }
  1163. });
  1164. }
  1165. e.coordEach = i, e.coordReduce = function(t, e, n, r) {
  1166. var a = n;
  1167. return i(t, function(t, r, i, o, s) {
  1168. a = 0 === r && n === undefined ? t :e(a, t, r, i, o, s);
  1169. }, r), a;
  1170. }, e.propEach = a, e.propReduce = function(t, e, n) {
  1171. var r = n;
  1172. return a(t, function(t, i) {
  1173. r = 0 === i && n === undefined ? t :e(r, t, i);
  1174. }), r;
  1175. }, e.featureEach = o, e.featureReduce = function(t, e, n) {
  1176. var r = n;
  1177. return o(t, function(t, i) {
  1178. r = 0 === i && n === undefined ? t :e(r, t, i);
  1179. }), r;
  1180. }, e.coordAll = function(t) {
  1181. var e = [];
  1182. return i(t, function(t) {
  1183. e.push(t);
  1184. }), e;
  1185. }, e.geomEach = s, e.geomReduce = function(t, e, n) {
  1186. var r = n;
  1187. return s(t, function(t, i, a, o, s) {
  1188. r = 0 === i && n === undefined ? t :e(r, t, i, a, o, s);
  1189. }), r;
  1190. }, e.flattenEach = l, e.flattenReduce = function(t, e, n) {
  1191. var r = n;
  1192. return l(t, function(t, i, a) {
  1193. r = 0 === i && 0 === a && n === undefined ? t :e(r, t, i, a);
  1194. }), r;
  1195. }, e.segmentEach = h, e.segmentReduce = function(t, e, n) {
  1196. var r = n, i = !1;
  1197. return h(t, function(t, a, o, s, l) {
  1198. r = !1 === i && n === undefined ? t :e(r, t, a, o, s, l), i = !0;
  1199. }), r;
  1200. }, e.lineEach = u, e.lineReduce = function(t, e, n) {
  1201. var r = n;
  1202. return u(t, function(t, i, a, o) {
  1203. r = 0 === i && n === undefined ? t :e(r, t, i, a, o);
  1204. }), r;
  1205. }, e.findSegment = function(t, e) {
  1206. if (e = e || {}, !r.isObject(e)) throw new Error("options is invalid");
  1207. var n, i = e.featureIndex || 0, a = e.multiFeatureIndex || 0, o = e.geometryIndex || 0, s = e.segmentIndex || 0, l = e.properties;
  1208. switch (t.type) {
  1209. case "FeatureCollection":
  1210. i < 0 && (i = t.features.length + i), l = l || t.features[i].properties, n = t.features[i].geometry;
  1211. break;
  1212. case "Feature":
  1213. l = l || t.properties, n = t.geometry;
  1214. break;
  1215. case "Point":
  1216. case "MultiPoint":
  1217. return null;
  1218. case "LineString":
  1219. case "Polygon":
  1220. case "MultiLineString":
  1221. case "MultiPolygon":
  1222. n = t;
  1223. break;
  1224. default:
  1225. throw new Error("geojson is invalid");
  1226. }
  1227. if (null === n) return null;
  1228. var h = n.coordinates;
  1229. switch (n.type) {
  1230. case "Point":
  1231. case "MultiPoint":
  1232. return null;
  1233. case "LineString":
  1234. return s < 0 && (s = h.length + s - 1), r.lineString([ h[s], h[s + 1] ], l, e);
  1235. case "Polygon":
  1236. return o < 0 && (o = h.length + o), s < 0 && (s = h[o].length + s - 1), r.lineString([ h[o][s], h[o][s + 1] ], l, e);
  1237. case "MultiLineString":
  1238. return a < 0 && (a = h.length + a), s < 0 && (s = h[a].length + s - 1), r.lineString([ h[a][s], h[a][s + 1] ], l, e);
  1239. case "MultiPolygon":
  1240. return a < 0 && (a = h.length + a), o < 0 && (o = h[a].length + o), s < 0 && (s = h[a][o].length - s - 1),
  1241. r.lineString([ h[a][o][s], h[a][o][s + 1] ], l, e);
  1242. }
  1243. throw new Error("geojson is invalid");
  1244. }, e.findPoint = function(t, e) {
  1245. if (e = e || {}, !r.isObject(e)) throw new Error("options is invalid");
  1246. var n, i = e.featureIndex || 0, a = e.multiFeatureIndex || 0, o = e.geometryIndex || 0, s = e.coordIndex || 0, l = e.properties;
  1247. switch (t.type) {
  1248. case "FeatureCollection":
  1249. i < 0 && (i = t.features.length + i), l = l || t.features[i].properties, n = t.features[i].geometry;
  1250. break;
  1251. case "Feature":
  1252. l = l || t.properties, n = t.geometry;
  1253. break;
  1254. case "Point":
  1255. case "MultiPoint":
  1256. return null;
  1257. case "LineString":
  1258. case "Polygon":
  1259. case "MultiLineString":
  1260. case "MultiPolygon":
  1261. n = t;
  1262. break;
  1263. default:
  1264. throw new Error("geojson is invalid");
  1265. }
  1266. if (null === n) return null;
  1267. var h = n.coordinates;
  1268. switch (n.type) {
  1269. case "Point":
  1270. return r.point(h, l, e);
  1271. case "MultiPoint":
  1272. return a < 0 && (a = h.length + a), r.point(h[a], l, e);
  1273. case "LineString":
  1274. return s < 0 && (s = h.length + s), r.point(h[s], l, e);
  1275. case "Polygon":
  1276. return o < 0 && (o = h.length + o), s < 0 && (s = h[o].length + s), r.point(h[o][s], l, e);
  1277. case "MultiLineString":
  1278. return a < 0 && (a = h.length + a), s < 0 && (s = h[a].length + s), r.point(h[a][s], l, e);
  1279. case "MultiPolygon":
  1280. return a < 0 && (a = h.length + a), o < 0 && (o = h[a].length + o), s < 0 && (s = h[a][o].length - s),
  1281. r.point(h[a][o][s], l, e);
  1282. }
  1283. throw new Error("geojson is invalid");
  1284. };
  1285. }, function(t, e, n) {
  1286. var r = n(8), i = n(45), a = n(46), o = "[object Null]", s = "[object Undefined]", l = r ? r.toStringTag :undefined;
  1287. t.exports = function(t) {
  1288. return null == t ? t === undefined ? s :o :l && l in Object(t) ? i(t) :a(t);
  1289. };
  1290. }, function(t, e, n) {
  1291. var r = n(55), i = n(60);
  1292. t.exports = function(t, e) {
  1293. var n = i(t, e);
  1294. return r(n) ? n :undefined;
  1295. };
  1296. }, function(t, e) {
  1297. t.exports = function(t) {
  1298. var e = typeof t;
  1299. return null != t && ("object" == e || "function" == e);
  1300. };
  1301. }, function(t, e, n) {
  1302. t.exports = n(20);
  1303. }, function(t, e, n) {
  1304. "use strict";
  1305. Object.defineProperty(e, "__esModule", {
  1306. value:!0
  1307. });
  1308. var r = n(21), i = (n.n(r), n(22)), a = (n.n(i), n(23)), o = n(24), s = n(0), l = (n(26),
  1309. n(27), n(28), n(29), n(30), n(31), n(1)), h = (n(36), n(37), n(38), n(82), n(83),
  1310. n(84), n(85)), u = (n.n(h), n(86));
  1311. n.n(u);
  1312. L.PM = L.PM || {
  1313. Map:a.a,
  1314. Toolbar:o.a,
  1315. Draw:s.a,
  1316. Edit:l.a,
  1317. version:i.version,
  1318. initialize:function() {
  1319. this.addInitHooks();
  1320. },
  1321. addInitHooks:function() {
  1322. L.Map.addInitHook(function() {
  1323. this.options.pmIgnore || (this.pm = new L.PM.Map(this));
  1324. }), L.LayerGroup.addInitHook(function() {
  1325. this.pm = new L.PM.Edit.LayerGroup(this);
  1326. }), L.Marker.addInitHook(function() {
  1327. this.options.pmIgnore || (this.pm = new L.PM.Edit.Marker(this));
  1328. }), L.Polyline.addInitHook(function() {
  1329. this.options.pmIgnore || (this.pm = new L.PM.Edit.Line(this));
  1330. }), L.Polygon.addInitHook(function() {
  1331. this.options.pmIgnore || (this.pm = new L.PM.Edit.Poly(this));
  1332. }), L.Rectangle.addInitHook(function() {
  1333. this.options.pmIgnore || (this.pm = new L.PM.Edit.Rectangle(this));
  1334. }), L.Circle.addInitHook(function() {
  1335. this.options.pmIgnore || (this.pm = new L.PM.Edit.Circle(this));
  1336. });
  1337. }
  1338. }, L.PM.initialize();
  1339. }, function(t, e) {
  1340. Array.prototype.findIndex = Array.prototype.findIndex || function(t) {
  1341. if (null === this) throw new TypeError("Array.prototype.findIndex called on null or undefined");
  1342. if ("function" != typeof t) throw new TypeError("callback must be a function");
  1343. for (var e = Object(this), n = e.length >>> 0, r = arguments[1], i = 0; i < n; i++) if (t.call(r, e[i], i, e)) return i;
  1344. return -1;
  1345. }, Array.prototype.find = Array.prototype.find || function(t) {
  1346. if (null === this) throw new TypeError("Array.prototype.find called on null or undefined");
  1347. if ("function" != typeof t) throw new TypeError("callback must be a function");
  1348. for (var e = Object(this), n = e.length >>> 0, r = arguments[1], i = 0; i < n; i++) {
  1349. var a = e[i];
  1350. if (t.call(r, a, i, e)) return a;
  1351. }
  1352. }, "function" != typeof Object.assign && (Object.assign = function(t) {
  1353. "use strict";
  1354. if (null == t) throw new TypeError("Cannot convert undefined or null to object");
  1355. t = Object(t);
  1356. for (var e = 1; e < arguments.length; e++) {
  1357. var n = arguments[e];
  1358. if (null != n) for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
  1359. }
  1360. return t;
  1361. }), [ Element.prototype, CharacterData.prototype, DocumentType.prototype ].forEach(function(t) {
  1362. t.hasOwnProperty("remove") || Object.defineProperty(t, "remove", {
  1363. configurable:!0,
  1364. enumerable:!0,
  1365. writable:!0,
  1366. value:function() {
  1367. this.parentNode.removeChild(this);
  1368. }
  1369. });
  1370. });
  1371. }, function(t, e) {
  1372. t.exports = {
  1373. name:"leaflet.pm",
  1374. version:"1.1.0",
  1375. description:"A Leaflet Plugin For Editing Geometry Layers in Leaflet 1.0",
  1376. keywords:[ "leaflet", "polygon management", "geometry editing", "map data", "map overlay", "polygon", "geojson", "leaflet-draw", "data-field-geojson", "ui-leaflet-draw" ],
  1377. files:[ "dist" ],
  1378. main:"dist/leaflet.pm.min.js",
  1379. dependencies:{
  1380. "@turf/difference":"^6.0.2",
  1381. "@turf/intersect":"^6.1.3",
  1382. "@turf/kinks":"6.x",
  1383. lodash:"^4.17.11"
  1384. },
  1385. devDependencies:{
  1386. "@babel/core":"^7.1.2",
  1387. "@babel/preset-env":"^7.1.0",
  1388. "babel-loader":"^8.0.4",
  1389. "css-loader":"^0.28.11",
  1390. cypress:"^3.1.0",
  1391. eslint:"^4.18.2",
  1392. "eslint-config-airbnb-base":"^12.1.0",
  1393. "eslint-plugin-cypress":"^2.0.1",
  1394. "eslint-plugin-import":"^2.9.0",
  1395. "extract-text-webpack-plugin":"^3.0.2",
  1396. "file-loader":"^0.11.1",
  1397. leaflet:"^1.3.4",
  1398. "style-loader":"^0.19.0",
  1399. "uglifyjs-webpack-plugin":"^1.3.0",
  1400. "url-loader":"^0.6.2",
  1401. webpack:"^3.12.0"
  1402. },
  1403. peerDependencies:{
  1404. leaflet:"^1.2.0"
  1405. },
  1406. scripts:{
  1407. start:"npm run dev",
  1408. dev:"./node_modules/.bin/webpack --config=webpack.dev.js",
  1409. test:"$(npm bin)/cypress run",
  1410. cypress:"$(npm bin)/cypress open",
  1411. build:"./node_modules/.bin/webpack --config=webpack.build.js",
  1412. prepare:"npm run build"
  1413. },
  1414. repository:{
  1415. type:"git",
  1416. url:"git+https://github.com/codeofsumit/leaflet.pm.git"
  1417. },
  1418. author:{
  1419. name:"Sumit Kumar",
  1420. email:"sk@outlook.com",
  1421. url:"http://twitter.com/TweetsOfSumit"
  1422. },
  1423. license:"MIT",
  1424. bugs:{
  1425. url:"https://github.com/codeofsumit/leaflet.pm/issues"
  1426. },
  1427. homepage:"https://leafletpm.now.sh"
  1428. };
  1429. }, function(t, e, n) {
  1430. "use strict";
  1431. var r = L.Class.extend({
  1432. initialize:function(t) {
  1433. var e = this;
  1434. this.map = t, this.Draw = new L.PM.Draw(t), this.Toolbar = new L.PM.Toolbar(t),
  1435. this.map.on("layerremove", function(t) {
  1436. t.layer.pm && !t.layer._pmTempLayer && e.map.fire("pm:remove", t);
  1437. }), this._globalRemovalMode = !1;
  1438. },
  1439. addControls:function(t) {
  1440. this.Toolbar.addControls(t);
  1441. },
  1442. removeControls:function() {
  1443. this.Toolbar.removeControls();
  1444. },
  1445. toggleControls:function() {
  1446. this.Toolbar.toggleControls();
  1447. },
  1448. controlsVisible:function() {
  1449. return this.Toolbar.isVisible;
  1450. },
  1451. enableDraw:function() {
  1452. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :"Poly", e = arguments.length > 1 ? arguments[1] :undefined;
  1453. this.Draw.enable(t, e);
  1454. },
  1455. disableDraw:function() {
  1456. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :"Poly";
  1457. this.Draw.disable(t);
  1458. },
  1459. setPathOptions:function(t) {
  1460. this.Draw.setPathOptions(t);
  1461. },
  1462. removeLayer:function(t) {
  1463. var e = t.target;
  1464. e._layers || e.pm && e.pm.dragging() || t.target.remove();
  1465. },
  1466. toggleGlobalRemovalMode:function() {
  1467. var t = this;
  1468. this.globalRemovalEnabled() ? (this._globalRemovalMode = !1, this.map.eachLayer(function(e) {
  1469. e.off("click", t.removeLayer);
  1470. })) :(this._globalRemovalMode = !0, this.map.eachLayer(function(e) {
  1471. !e.pm || e.pm.options && e.pm.options.preventMarkerRemoval || e.on("click", t.removeLayer);
  1472. })), this.Toolbar.toggleButton("deleteLayer", this._globalRemovalMode);
  1473. },
  1474. globalRemovalEnabled:function() {
  1475. return this._globalRemovalMode;
  1476. },
  1477. globalEditEnabled:function() {
  1478. return this._globalEditMode;
  1479. },
  1480. enableGlobalEditMode:function(t) {
  1481. var e = [];
  1482. this.map.eachLayer(function(t) {
  1483. (t instanceof L.Polyline || t instanceof L.Marker || t instanceof L.Circle) && e.push(t);
  1484. }), e = (e = e.filter(function(t) {
  1485. return !!t.pm;
  1486. })).filter(function(t) {
  1487. return !t._pmTempLayer;
  1488. }), this._globalEditMode = !0, e.forEach(function(e) {
  1489. e.pm.enable(t);
  1490. }), this.Toolbar.toggleButton("editPolygon", this._globalEditMode), this._fireEditModeEvent(!0);
  1491. },
  1492. disableGlobalEditMode:function() {
  1493. var t = [];
  1494. this.map.eachLayer(function(e) {
  1495. (e instanceof L.Polyline || e instanceof L.Marker || e instanceof L.Circle) && t.push(e);
  1496. }), t = (t = t.filter(function(t) {
  1497. return !!t.pm;
  1498. })).filter(function(t) {
  1499. return !t._pmTempLayer;
  1500. }), this._globalEditMode = !1, t.forEach(function(t) {
  1501. t.pm.disable();
  1502. }), this.Toolbar.toggleButton("editPolygon", this._globalEditMode), this._fireEditModeEvent(!1);
  1503. },
  1504. _fireEditModeEvent:function(t) {
  1505. this.map.fire("pm:globaleditmodetoggled", {
  1506. enabled:t,
  1507. map:this.map
  1508. });
  1509. },
  1510. toggleGlobalEditMode:function(t) {
  1511. this.globalEditEnabled() ? this.disableGlobalEditMode() :this.enableGlobalEditMode(t);
  1512. }
  1513. });
  1514. e.a = r;
  1515. }, function(t, e, n) {
  1516. "use strict";
  1517. var r = n(25);
  1518. L.Control.PMButton = r.a;
  1519. var i = L.Class.extend({
  1520. options:{
  1521. drawMarker:!0,
  1522. drawPolygon:!0,
  1523. drawPolyline:!0,
  1524. drawCircle:!0,
  1525. drawRectangle:!0,
  1526. editMode:!0,
  1527. cutPolygon:!0,
  1528. dragPolygon:!1,
  1529. removalMode:!0,
  1530. position:"topleft"
  1531. },
  1532. initialize:function(t) {
  1533. this.map = t, this.buttons = {}, this.isVisible = !1, this.container = L.DomUtil.create("div", "leaflet-pm-toolbar leaflet-bar leaflet-control"),
  1534. this._defineButtons();
  1535. },
  1536. getButtons:function() {
  1537. return this.buttons;
  1538. },
  1539. addControls:function() {
  1540. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this.options;
  1541. "undefined" != typeof t.editPolygon && (t.editMode = t.editPolygon), "undefined" != typeof t.deleteLayer && (t.removalMode = t.deleteLayer),
  1542. L.Util.setOptions(this, t), this._showHideButtons(), this.isVisible = !0;
  1543. },
  1544. removeControls:function() {
  1545. var t = this.getButtons();
  1546. for (var e in t) t[e].remove();
  1547. this.isVisible = !1;
  1548. },
  1549. toggleControls:function() {
  1550. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this.options;
  1551. this.isVisible ? this.removeControls() :this.addControls(t);
  1552. },
  1553. _addButton:function(t, e) {
  1554. return this.buttons[t] = e, this.options[t] = this.options[t] || !1, this.buttons[t];
  1555. },
  1556. triggerClickOnToggledButtons:function(t) {
  1557. for (var e in this.buttons) this.buttons[e] !== t && this.buttons[e].toggled() && this.buttons[e]._triggerClick();
  1558. },
  1559. toggleButton:function(t, e) {
  1560. return "editPolygon" === t && (t = "editMode"), "deleteLayer" === t && (t = "removalMode"),
  1561. this.triggerClickOnToggledButtons(this.buttons[t]), this.buttons[t].toggle(e);
  1562. },
  1563. _defineButtons:function() {
  1564. var t = this, e = {
  1565. className:" leaflet-pm-icon-delete",
  1566. onClick:function() {},
  1567. afterClick:function() {
  1568. t.map.pm.toggleGlobalRemovalMode();
  1569. },
  1570. doToggle:!0,
  1571. toggleStatus:!1,
  1572. disableOtherButtons:!0,
  1573. position:this.options.position,
  1574. actions:[ "cancel" ]
  1575. }, n = {
  1576. className:"leaflet-pm-icon-polygon",
  1577. jsClass:"Poly",
  1578. onClick:function() {},
  1579. afterClick:function() {
  1580. t.map.pm.Draw.Poly.toggle();
  1581. },
  1582. doToggle:!0,
  1583. toggleStatus:!1,
  1584. disableOtherButtons:!0,
  1585. position:this.options.position,
  1586. actions:[ "finish", "removeLastVertex", "cancel" ]
  1587. }, r = {
  1588. className:"leaflet-pm-icon-cut",
  1589. jsClass:"Cut",
  1590. onClick:function() {},
  1591. afterClick:function() {
  1592. t.map.pm.Draw.Cut.toggle({
  1593. snappable:!0,
  1594. cursorMarker:!0,
  1595. allowSelfIntersection:!1
  1596. });
  1597. },
  1598. doToggle:!0,
  1599. toggleStatus:!1,
  1600. disableOtherButtons:!0,
  1601. position:this.options.position,
  1602. actions:[ "finish", "removeLastVertex", "cancel" ]
  1603. }, i = {
  1604. className:"leaflet-pm-icon-marker",
  1605. jsClass:"Marker",
  1606. onClick:function() {},
  1607. afterClick:function() {
  1608. t.map.pm.Draw.Marker.toggle();
  1609. },
  1610. doToggle:!0,
  1611. toggleStatus:!1,
  1612. disableOtherButtons:!0,
  1613. position:this.options.position,
  1614. actions:[ "cancel" ]
  1615. }, a = {
  1616. className:"leaflet-pm-icon-polyline",
  1617. jsClass:"Line",
  1618. onClick:function() {},
  1619. afterClick:function() {
  1620. t.map.pm.Draw.Line.toggle();
  1621. },
  1622. doToggle:!0,
  1623. toggleStatus:!1,
  1624. disableOtherButtons:!0,
  1625. position:this.options.position,
  1626. actions:[ "finish", "removeLastVertex", "cancel" ]
  1627. }, o = {
  1628. className:"leaflet-pm-icon-circle",
  1629. jsClass:"Circle",
  1630. onClick:function() {},
  1631. afterClick:function() {
  1632. t.map.pm.Draw.Circle.toggle();
  1633. },
  1634. doToggle:!0,
  1635. toggleStatus:!1,
  1636. disableOtherButtons:!0,
  1637. position:this.options.position,
  1638. actions:[ "cancel" ]
  1639. }, s = {
  1640. className:"leaflet-pm-icon-rectangle",
  1641. jsClass:"Rectangle",
  1642. onClick:function() {},
  1643. afterClick:function() {
  1644. t.map.pm.Draw.Rectangle.toggle();
  1645. },
  1646. doToggle:!0,
  1647. toggleStatus:!1,
  1648. disableOtherButtons:!0,
  1649. position:this.options.position,
  1650. actions:[ "cancel" ]
  1651. }, l = {
  1652. className:"leaflet-pm-icon-edit",
  1653. onClick:function() {},
  1654. afterClick:function() {
  1655. t.map.pm.toggleGlobalEditMode();
  1656. },
  1657. doToggle:!0,
  1658. toggleStatus:!1,
  1659. disableOtherButtons:!0,
  1660. position:this.options.position,
  1661. actions:[ "cancel" ]
  1662. }, h = {
  1663. className:"leaflet-pm-icon-drag",
  1664. onClick:function() {},
  1665. afterClick:function() {},
  1666. doToggle:!0,
  1667. toggleStatus:!1,
  1668. disableOtherButtons:!0,
  1669. position:this.options.position
  1670. };
  1671. this._addButton("drawMarker", new L.Control.PMButton(i)), this._addButton("drawPolyline", new L.Control.PMButton(a)),
  1672. this._addButton("drawRectangle", new L.Control.PMButton(s)), this._addButton("drawPolygon", new L.Control.PMButton(n)),
  1673. this._addButton("drawCircle", new L.Control.PMButton(o)), this._addButton("cutPolygon", new L.Control.PMButton(r)),
  1674. this._addButton("editMode", new L.Control.PMButton(l)), this._addButton("dragPolygon", new L.Control.PMButton(h)),
  1675. this._addButton("removalMode", new L.Control.PMButton(e));
  1676. },
  1677. _showHideButtons:function() {
  1678. this.removeControls();
  1679. var t = this.getButtons();
  1680. for (var e in t) this.options[e] && (t[e].setPosition(this.options.position), t[e].addTo(this.map));
  1681. }
  1682. });
  1683. e.a = i;
  1684. }, function(t, e, n) {
  1685. "use strict";
  1686. var r = L.Control.extend({
  1687. options:{
  1688. position:"topleft"
  1689. },
  1690. initialize:function(t) {
  1691. this._button = L.Util.setOptions(this, t);
  1692. },
  1693. onAdd:function(t) {
  1694. return this._map = t, this._container = this._map.pm.Toolbar.container, this.buttonsDomNode = this._makeButton(this._button),
  1695. this._container.appendChild(this.buttonsDomNode), this._container;
  1696. },
  1697. onRemove:function() {
  1698. return this.buttonsDomNode.remove(), this._container;
  1699. },
  1700. getText:function() {
  1701. return this._button.text;
  1702. },
  1703. getIconUrl:function() {
  1704. return this._button.iconUrl;
  1705. },
  1706. destroy:function() {
  1707. this._button = {}, this._update();
  1708. },
  1709. toggle:function(t) {
  1710. return this._button.toggleStatus = "boolean" == typeof t ? t :!this._button.toggleStatus,
  1711. this._applyStyleClasses(), this._button.toggleStatus;
  1712. },
  1713. toggled:function() {
  1714. return this._button.toggleStatus;
  1715. },
  1716. onCreate:function() {
  1717. this.toggle(!1);
  1718. },
  1719. _triggerClick:function(t) {
  1720. this._button.onClick(t), this._clicked(t), this._button.afterClick(t);
  1721. },
  1722. _makeButton:function(t) {
  1723. var e = this, n = L.DomUtil.create("div", "button-container", this._container), r = L.DomUtil.create("a", "leaflet-buttons-control-button", n), i = L.DomUtil.create("div", "leaflet-pm-actions-container", n), a = {
  1724. cancel:{
  1725. text:"Cancel",
  1726. onClick:function() {
  1727. this._triggerClick();
  1728. }
  1729. },
  1730. removeLastVertex:{
  1731. text:"Remove Last Vertex",
  1732. onClick:function() {
  1733. this._map.pm.Draw[t.jsClass]._removeLastVertex();
  1734. }
  1735. },
  1736. finish:{
  1737. text:"Finish",
  1738. onClick:function() {
  1739. this._map.pm.Draw[t.jsClass]._finishShape();
  1740. }
  1741. }
  1742. };
  1743. t.actions.forEach(function(t) {
  1744. var n = a[t], r = L.DomUtil.create("a", "leaflet-pm-action action-".concat(t), i);
  1745. r.innerHTML = n.text, L.DomEvent.addListener(r, "click", n.onClick, e), L.DomEvent.disableClickPropagation(r);
  1746. }), t.toggleStatus && L.DomUtil.addClass(r, "active");
  1747. var o = L.DomUtil.create("div", "control-icon", r);
  1748. return t.iconUrl && o.setAttribute("src", t.iconUrl), t.className && L.DomUtil.addClass(o, t.className),
  1749. L.DomEvent.addListener(r, "click", function() {
  1750. e._button.disableOtherButtons && e._map.pm.Toolbar.triggerClickOnToggledButtons(e);
  1751. }), L.DomEvent.addListener(r, "click", this._triggerClick, this), L.DomEvent.disableClickPropagation(r),
  1752. n;
  1753. },
  1754. _applyStyleClasses:function() {
  1755. this._container && (this._button.toggleStatus ? L.DomUtil.addClass(this.buttonsDomNode, "active") :L.DomUtil.removeClass(this.buttonsDomNode, "active"));
  1756. },
  1757. _clicked:function() {
  1758. this._button.doToggle && this.toggle();
  1759. }
  1760. });
  1761. e.a = r;
  1762. }, function(t, e, n) {
  1763. "use strict";
  1764. var r = n(0);
  1765. r.a.Marker = r.a.extend({
  1766. initialize:function(t) {
  1767. this._map = t, this._shape = "Marker", this.toolbarButtonName = "drawMarker";
  1768. },
  1769. enable:function(t) {
  1770. L.Util.setOptions(this, t), this._enabled = !0, this._map.on("click", this._createMarker, this),
  1771. this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._hintMarker = L.marker([ 0, 0 ], this.options.markerStyle),
  1772. this._hintMarker._pmTempLayer = !0, this._hintMarker.addTo(this._map), this._layer = this._hintMarker,
  1773. this._map.on("mousemove", this._syncHintMarker, this), this._map.fire("pm:drawstart", {
  1774. shape:this._shape,
  1775. workingLayer:this._layer
  1776. }), this._map.eachLayer(function(t) {
  1777. t instanceof L.Marker && t.pm && t.pm.enable();
  1778. });
  1779. },
  1780. disable:function() {
  1781. this._enabled && (this._map.off("click", this._createMarker, this), this._hintMarker.remove(),
  1782. this._map.off("mousemove", this._syncHintMarker, this), this._map.eachLayer(function(t) {
  1783. t instanceof L.Marker && t.pm && !t._pmTempLayer && t.pm.disable();
  1784. }), this._map.fire("pm:drawend", {
  1785. shape:this._shape
  1786. }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this._enabled = !1);
  1787. },
  1788. enabled:function() {
  1789. return this._enabled;
  1790. },
  1791. toggle:function(t) {
  1792. this.enabled() ? this.disable() :this.enable(t);
  1793. },
  1794. _createMarker:function(t) {
  1795. if (t.latlng) {
  1796. this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
  1797. var e = this._hintMarker.getLatLng(), n = new L.Marker(e, this.options.markerStyle);
  1798. n.addTo(this._map), n.pm.enable(), this._map.fire("pm:create", {
  1799. shape:this._shape,
  1800. marker:n,
  1801. layer:n
  1802. }), this._cleanupSnapping();
  1803. }
  1804. },
  1805. _syncHintMarker:function(t) {
  1806. if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
  1807. var e = t;
  1808. e.target = this._hintMarker, this._handleSnapping(e);
  1809. }
  1810. }
  1811. });
  1812. }, function(t, e, n) {
  1813. "use strict";
  1814. var r = n(12), i = n.n(r), a = n(0);
  1815. a.a.Line = a.a.extend({
  1816. initialize:function(t) {
  1817. this._map = t, this._shape = "Line", this.toolbarButtonName = "drawPolyline", this._doesSelfIntersect = !1;
  1818. },
  1819. enable:function(t) {
  1820. L.Util.setOptions(this, t), this.options.finishOnDoubleClick && !this.options.finishOn && (this.options.finishOn = "dblclick"),
  1821. this._enabled = !0, this._layerGroup = new L.LayerGroup(), this._layerGroup._pmTempLayer = !0,
  1822. this._layerGroup.addTo(this._map), this._layer = L.polyline([], this.options.templineStyle),
  1823. this._layer._pmTempLayer = !0, this._layerGroup.addLayer(this._layer), this._hintline = L.polyline([], this.options.hintlineStyle),
  1824. this._hintline._pmTempLayer = !0, this._layerGroup.addLayer(this._hintline), this._hintMarker = L.marker(this._map.getCenter(), {
  1825. icon:L.divIcon({
  1826. className:"marker-icon cursor-marker"
  1827. })
  1828. }), this._hintMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._hintMarker),
  1829. this.options.cursorMarker && L.DomUtil.addClass(this._hintMarker._icon, "visible"),
  1830. this._map._container.style.cursor = "crosshair", this._map.on("click", this._createVertex, this),
  1831. this.options.finishOn && this._map.on(this.options.finishOn, this._finishShape, this),
  1832. "dblclick" === this.options.finishOn && (this.tempMapDoubleClickZoomState = this._map.doubleClickZoom._enabled,
  1833. this.tempMapDoubleClickZoomState && this._map.doubleClickZoom.disable()), this._map.on("mousemove", this._syncHintMarker, this),
  1834. this._hintMarker.on("move", this._syncHintLine, this), this._map.fire("pm:drawstart", {
  1835. shape:this._shape,
  1836. workingLayer:this._layer
  1837. }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._otherSnapLayers = [];
  1838. },
  1839. disable:function() {
  1840. this._enabled && (this._enabled = !1, this._map._container.style.cursor = "", this._map.off("click", this._createVertex, this),
  1841. this._map.off("mousemove", this._syncHintMarker, this), this.options.finishOn && this._map.off(this.options.finishOn, this._finishShape, this),
  1842. this.tempMapDoubleClickZoomState && this._map.doubleClickZoom.enable(), this._map.removeLayer(this._layerGroup),
  1843. this._map.fire("pm:drawend", {
  1844. shape:this._shape
  1845. }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this.options.snappable && this._cleanupSnapping());
  1846. },
  1847. enabled:function() {
  1848. return this._enabled;
  1849. },
  1850. toggle:function(t) {
  1851. this.enabled() ? this.disable() :this.enable(t);
  1852. },
  1853. hasSelfIntersection:function() {
  1854. return i()(this._layer.toGeoJSON(15)).features.length > 0;
  1855. },
  1856. _syncHintLine:function() {
  1857. var t = this._layer.getLatLngs();
  1858. if (t.length > 0) {
  1859. var e = t[t.length - 1];
  1860. this._hintline.setLatLngs([ e, this._hintMarker.getLatLng() ]);
  1861. }
  1862. },
  1863. _syncHintMarker:function(t) {
  1864. if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
  1865. var e = t;
  1866. e.target = this._hintMarker, this._handleSnapping(e);
  1867. }
  1868. this.options.allowSelfIntersection || this._handleSelfIntersection();
  1869. },
  1870. _handleSelfIntersection:function() {
  1871. var t = L.polyline(this._layer.getLatLngs());
  1872. t.addLatLng(this._hintMarker.getLatLng());
  1873. var e = i()(t.toGeoJSON(15));
  1874. this._doesSelfIntersect = e.features.length > 0, this._doesSelfIntersect ? this._hintline.setStyle({
  1875. color:"red"
  1876. }) :this._hintline.setStyle(this.options.hintlineStyle);
  1877. },
  1878. _removeLastVertex:function() {
  1879. var t = this._layer.getLatLngs(), e = t.pop();
  1880. t.length < 1 && this.disable();
  1881. var n = this._layerGroup.getLayers().filter(function(t) {
  1882. return t instanceof L.Marker;
  1883. }).filter(function(t) {
  1884. return !L.DomUtil.hasClass(t._icon, "cursor-marker");
  1885. }).find(function(t) {
  1886. return t.getLatLng() === e;
  1887. });
  1888. this._layerGroup.removeLayer(n), this._layer.setLatLngs(t), this._syncHintLine();
  1889. },
  1890. _createVertex:function(t) {
  1891. if (this.options.allowSelfIntersection || !this._doesSelfIntersect) {
  1892. this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
  1893. var e = this._hintMarker.getLatLng();
  1894. if (e.equals(this._layer.getLatLngs()[0])) this._finishShape(t); else {
  1895. var n = 0 === this._layer.getLatLngs().length;
  1896. this._layer.addLatLng(e);
  1897. var r = this._createMarker(e, n);
  1898. this._hintline.setLatLngs([ e, e ]), this._layer.fire("pm:vertexadded", {
  1899. shape:this._shape,
  1900. workingLayer:this._layer,
  1901. marker:r,
  1902. latlng:e
  1903. });
  1904. }
  1905. }
  1906. },
  1907. _finishShape:function() {
  1908. if (this.options.allowSelfIntersection || !this._doesSelfIntersect) {
  1909. var t = this._layer.getLatLngs();
  1910. if (!(t.length <= 1)) {
  1911. var e = L.polyline(t, this.options.pathOptions).addTo(this._map);
  1912. this.disable(), this._map.fire("pm:create", {
  1913. shape:this._shape,
  1914. layer:e
  1915. }), this.options.snappable && this._cleanupSnapping();
  1916. }
  1917. }
  1918. },
  1919. _createMarker:function(t) {
  1920. var e = new L.Marker(t, {
  1921. draggable:!1,
  1922. icon:L.divIcon({
  1923. className:"marker-icon"
  1924. })
  1925. });
  1926. return e._pmTempLayer = !0, this._layerGroup.addLayer(e), e.on("click", this._finishShape, this),
  1927. e;
  1928. }
  1929. });
  1930. }, function(t, e, n) {
  1931. "use strict";
  1932. var r = n(0);
  1933. r.a.Poly = r.a.Line.extend({
  1934. initialize:function(t) {
  1935. this._map = t, this._shape = "Poly", this.toolbarButtonName = "drawPolygon";
  1936. },
  1937. _finishShape:function(t) {
  1938. if (this.options.allowSelfIntersection || !this._doesSelfIntersect) {
  1939. var e = this._layer.getLatLngs();
  1940. if (!(e.length <= 1)) {
  1941. t && "dblclick" === t.type && e.splice(e.length - 1, 1);
  1942. var n = L.polygon(e, this.options.pathOptions).addTo(this._map);
  1943. this.disable(), this._map.fire("pm:create", {
  1944. shape:this._shape,
  1945. layer:n
  1946. }), this._cleanupSnapping(), this._otherSnapLayers.splice(this._tempSnapLayerIndex, 1),
  1947. delete this._tempSnapLayerIndex;
  1948. }
  1949. }
  1950. },
  1951. _createMarker:function(t, e) {
  1952. var n = new L.Marker(t, {
  1953. draggable:!1,
  1954. icon:L.divIcon({
  1955. className:"marker-icon"
  1956. })
  1957. });
  1958. return n._pmTempLayer = !0, this._layerGroup.addLayer(n), e && (n.on("click", this._finishShape, this),
  1959. this._tempSnapLayerIndex = this._otherSnapLayers.push(n) - 1, this.options.snappable && this._cleanupSnapping()),
  1960. n;
  1961. }
  1962. });
  1963. }, function(t, e, n) {
  1964. "use strict";
  1965. var r = n(0);
  1966. r.a.Rectangle = r.a.extend({
  1967. initialize:function(t) {
  1968. this._map = t, this._shape = "Rectangle", this.toolbarButtonName = "drawRectangle";
  1969. },
  1970. enable:function(t) {
  1971. if (L.Util.setOptions(this, t), this._enabled = !0, this._layerGroup = new L.LayerGroup(),
  1972. this._layerGroup._pmTempLayer = !0, this._layerGroup.addTo(this._map), this._layer = L.rectangle([ [ 0, 0 ], [ 0, 0 ] ], this.options.pathOptions),
  1973. this._layer._pmTempLayer = !0, this._startMarker = L.marker([ 0, 0 ], {
  1974. icon:L.divIcon({
  1975. className:"marker-icon rect-start-marker"
  1976. }),
  1977. draggable:!0,
  1978. zIndexOffset:100,
  1979. opacity:this.options.cursorMarker ? 1 :0
  1980. }), this._startMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._startMarker),
  1981. this._hintMarker = L.marker([ 0, 0 ], {
  1982. icon:L.divIcon({
  1983. className:"marker-icon cursor-marker"
  1984. })
  1985. }), this._hintMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._hintMarker),
  1986. this.options.cursorMarker) {
  1987. L.DomUtil.addClass(this._hintMarker._icon, "visible"), this._styleMarkers = [];
  1988. for (var e = 0; e < 2; e += 1) {
  1989. var n = L.marker([ 0, 0 ], {
  1990. icon:L.divIcon({
  1991. className:"marker-icon rect-style-marker"
  1992. }),
  1993. draggable:!0,
  1994. zIndexOffset:100
  1995. });
  1996. n._pmTempLayer = !0, this._layerGroup.addLayer(n), this._styleMarkers.push(n);
  1997. }
  1998. }
  1999. this._map._container.style.cursor = "crosshair", this._map.on("click", this._placeStartingMarkers, this),
  2000. this._map.on("mousemove", this._syncHintMarker, this), this._map.fire("pm:drawstart", {
  2001. shape:this._shape,
  2002. workingLayer:this._layer
  2003. }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._otherSnapLayers = [];
  2004. },
  2005. disable:function() {
  2006. this._enabled && (this._enabled = !1, this._map._container.style.cursor = "", this._map.off("click", this._finishShape, this),
  2007. this._map.off("click", this._placeStartingMarkers, this), this._map.off("mousemove", this._syncHintMarker, this),
  2008. this._map.removeLayer(this._layerGroup), this._map.fire("pm:drawend", {
  2009. shape:this._shape
  2010. }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this.options.snappable && this._cleanupSnapping());
  2011. },
  2012. enabled:function() {
  2013. return this._enabled;
  2014. },
  2015. toggle:function(t) {
  2016. this.enabled() ? this.disable() :this.enable(t);
  2017. },
  2018. _placeStartingMarkers:function(t) {
  2019. this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
  2020. var e = this._hintMarker.getLatLng();
  2021. L.DomUtil.addClass(this._startMarker._icon, "visible"), this._startMarker.setLatLng(e),
  2022. this.options.cursorMarker && this._styleMarkers && this._styleMarkers.forEach(function(t) {
  2023. L.DomUtil.addClass(t._icon, "visible"), t.setLatLng(e);
  2024. }), this._map.off("click", this._placeStartingMarkers, this), this._map.on("click", this._finishShape, this),
  2025. this._setRectangleOrigin();
  2026. },
  2027. _setRectangleOrigin:function() {
  2028. var t = this._startMarker.getLatLng();
  2029. t && (this._layerGroup.addLayer(this._layer), this._layer.setLatLngs([ t, t ]),
  2030. this._hintMarker.on("move", this._syncRectangleSize, this));
  2031. },
  2032. _syncHintMarker:function(t) {
  2033. if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
  2034. var e = t;
  2035. e.target = this._hintMarker, this._handleSnapping(e);
  2036. }
  2037. },
  2038. _syncRectangleSize:function() {
  2039. var t = this, e = this._startMarker.getLatLng(), n = this._hintMarker.getLatLng();
  2040. if (this._layer.setBounds([ e, n ]), this.options.cursorMarker && this._styleMarkers) {
  2041. var r = [];
  2042. this._findCorners().forEach(function(e) {
  2043. e.equals(t._startMarker.getLatLng()) || e.equals(t._hintMarker.getLatLng()) || r.push(e);
  2044. }), r.forEach(function(e, n) {
  2045. t._styleMarkers[n].setLatLng(e);
  2046. });
  2047. }
  2048. },
  2049. _finishShape:function(t) {
  2050. var e = this._startMarker.getLatLng(), n = t.latlng, r = L.rectangle([ e, n ], this.options.pathOptions).addTo(this._map);
  2051. this.disable(), this._map.fire("pm:create", {
  2052. shape:this._shape,
  2053. layer:r
  2054. });
  2055. },
  2056. _findCorners:function() {
  2057. var t = this._layer.getBounds();
  2058. return [ t.getNorthWest(), t.getNorthEast(), t.getSouthEast(), t.getSouthWest() ];
  2059. }
  2060. });
  2061. }, function(t, e, n) {
  2062. "use strict";
  2063. var r = n(0);
  2064. r.a.Circle = r.a.extend({
  2065. initialize:function(t) {
  2066. this._map = t, this._shape = "Circle", this.toolbarButtonName = "drawCircle";
  2067. },
  2068. enable:function(t) {
  2069. L.Util.setOptions(this, t), this.options.radius = 0, this._enabled = !0, this._layerGroup = new L.LayerGroup(),
  2070. this._layerGroup._pmTempLayer = !0, this._layerGroup.addTo(this._map), this._layer = L.circle([ 0, 0 ], this.options.templineStyle),
  2071. this._layer._pmTempLayer = !0, this._layerGroup.addLayer(this._layer), this._centerMarker = L.marker([ 0, 0 ], {
  2072. icon:L.divIcon({
  2073. className:"marker-icon"
  2074. }),
  2075. draggable:!1,
  2076. zIndexOffset:100
  2077. }), this._centerMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._centerMarker),
  2078. this._hintMarker = L.marker([ 0, 0 ], {
  2079. icon:L.divIcon({
  2080. className:"marker-icon cursor-marker"
  2081. })
  2082. }), this._hintMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._hintMarker),
  2083. this.options.cursorMarker && L.DomUtil.addClass(this._hintMarker._icon, "visible"),
  2084. this._hintline = L.polyline([], this.options.hintlineStyle), this._hintline._pmTempLayer = !0,
  2085. this._layerGroup.addLayer(this._hintline), this._map._container.style.cursor = "crosshair",
  2086. this._map.on("click", this._placeCenterMarker, this), this._map.on("mousemove", this._syncHintMarker, this),
  2087. this._map.fire("pm:drawstart", {
  2088. shape:this._shape,
  2089. workingLayer:this._layer
  2090. }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._otherSnapLayers = [];
  2091. },
  2092. disable:function() {
  2093. this._enabled && (this._enabled = !1, this._map._container.style.cursor = "", this._map.off("click", this._finishShape, this),
  2094. this._map.off("click", this._placeCenterMarker, this), this._map.off("mousemove", this._syncHintMarker, this),
  2095. this._map.removeLayer(this._layerGroup), this._map.fire("pm:drawend", {
  2096. shape:this._shape
  2097. }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this.options.snappable && this._cleanupSnapping());
  2098. },
  2099. enabled:function() {
  2100. return this._enabled;
  2101. },
  2102. toggle:function(t) {
  2103. this.enabled() ? this.disable() :this.enable(t);
  2104. },
  2105. _syncHintLine:function() {
  2106. var t = this._centerMarker.getLatLng();
  2107. this._hintline.setLatLngs([ t, this._hintMarker.getLatLng() ]);
  2108. },
  2109. _syncCircleRadius:function() {
  2110. var t = this._centerMarker.getLatLng(), e = this._hintMarker.getLatLng(), n = t.distanceTo(e);
  2111. this._layer.setRadius(n);
  2112. },
  2113. _syncHintMarker:function(t) {
  2114. if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
  2115. var e = t;
  2116. e.target = this._hintMarker, this._handleSnapping(e);
  2117. }
  2118. },
  2119. _placeCenterMarker:function(t) {
  2120. this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
  2121. var e = this._hintMarker.getLatLng();
  2122. this._centerMarker.setLatLng(e), this._map.off("click", this._placeCenterMarker, this),
  2123. this._map.on("click", this._finishShape, this), this._placeCircleCenter();
  2124. },
  2125. _placeCircleCenter:function() {
  2126. var t = this._centerMarker.getLatLng();
  2127. t && (this._layer.setLatLng(t), this._hintMarker.on("move", this._syncHintLine, this),
  2128. this._hintMarker.on("move", this._syncCircleRadius, this), this._layer.fire("pm:centerplaced", {
  2129. shape:this._shape,
  2130. workingLayer:this._layer,
  2131. latlng:t
  2132. }));
  2133. },
  2134. _finishShape:function(t) {
  2135. var e = this._centerMarker.getLatLng(), n = t.latlng, r = e.distanceTo(n), i = Object.assign({}, this.options.pathOptions, {
  2136. radius:r
  2137. }), a = L.circle(e, i).addTo(this._map);
  2138. this.disable(), this._map.fire("pm:create", {
  2139. shape:this._shape,
  2140. layer:a
  2141. });
  2142. },
  2143. _createMarker:function(t) {
  2144. var e = new L.Marker(t, {
  2145. draggable:!1,
  2146. icon:L.divIcon({
  2147. className:"marker-icon"
  2148. })
  2149. });
  2150. return e._pmTempLayer = !0, this._layerGroup.addLayer(e), e;
  2151. }
  2152. });
  2153. }, function(t, e, n) {
  2154. "use strict";
  2155. var r = n(32), i = n.n(r), a = n(33), o = n(0);
  2156. o.a.Cut = o.a.Poly.extend({
  2157. initialize:function(t) {
  2158. this._map = t, this._shape = "Cut", this.toolbarButtonName = "cutPolygon";
  2159. },
  2160. _cut:function(t) {
  2161. var e = this, n = this._map._layers;
  2162. Object.keys(n).map(function(t) {
  2163. return n[t];
  2164. }).filter(function(t) {
  2165. return t.pm;
  2166. }).filter(function(t) {
  2167. return t instanceof L.Polygon;
  2168. }).filter(function(e) {
  2169. return e !== t;
  2170. }).filter(function(e) {
  2171. try {
  2172. return !!i()(t.toGeoJSON(15), e.toGeoJSON(15));
  2173. } catch (n) {
  2174. return console.error("You cant cut polygons with self-intersections"), !1;
  2175. }
  2176. }).forEach(function(n) {
  2177. var r = Object(a.a)(n.toGeoJSON(15), t.toGeoJSON(15)), i = L.geoJSON(r, n.options).addTo(e._map);
  2178. i.addTo(e._map), i.pm.enable(e.options), i.pm.disable(), n.fire("pm:cut", {
  2179. shape:e._shape,
  2180. layer:i,
  2181. originalLayer:n
  2182. }), e._map.fire("pm:cut", {
  2183. shape:e._shape,
  2184. layer:i,
  2185. originalLayer:n
  2186. }), n._pmTempLayer = !0, t._pmTempLayer = !0, n.remove(), t.remove();
  2187. });
  2188. },
  2189. _finishShape:function() {
  2190. var t = this._layer.getLatLngs(), e = L.polygon(t, this.options.pathOptions);
  2191. this._cut(e), this.disable(), this._cleanupSnapping(), this._otherSnapLayers.splice(this._tempSnapLayerIndex, 1),
  2192. delete this._tempSnapLayerIndex;
  2193. }
  2194. });
  2195. }, function(t, e, n) {
  2196. "use strict";
  2197. var r = this && this.__importStar || function(t) {
  2198. if (t && t.__esModule) return t;
  2199. var e = {};
  2200. if (null != t) for (var n in t) Object.hasOwnProperty.call(t, n) && (e[n] = t[n]);
  2201. return e["default"] = t, e;
  2202. };
  2203. Object.defineProperty(e, "__esModule", {
  2204. value:!0
  2205. });
  2206. var i = n(2), a = n(13), o = r(n(14));
  2207. e["default"] = function s(t, e, n) {
  2208. void 0 === n && (n = {});
  2209. var r = a.getGeom(t), l = a.getGeom(e);
  2210. if ("Polygon" === r.type && "Polygon" === l.type) {
  2211. var h = o.intersection(r.coordinates, l.coordinates);
  2212. if (null === h || 0 === h.length) return null;
  2213. if (1 === h.length) {
  2214. var u = h[0][0][0], c = h[0][0][h[0][0].length - 1];
  2215. return u[0] === c[0] && u[1] === c[1] ? i.polygon(h[0], n.properties) :null;
  2216. }
  2217. return i.multiPolygon(h, n.properties);
  2218. }
  2219. if ("MultiPolygon" === r.type) {
  2220. for (var p = [], f = 0, d = r.coordinates; f < d.length; f++) {
  2221. var g = d[f], _ = s(a.getGeom(i.polygon(g)), l);
  2222. if (_) {
  2223. var m = a.getGeom(_);
  2224. if ("Polygon" === m.type) p.push(m.coordinates); else {
  2225. if ("MultiPolygon" !== m.type) throw new Error("intersection is invalid");
  2226. p = p.concat(m.coordinates);
  2227. }
  2228. }
  2229. }
  2230. return 0 === p.length ? null :1 === p.length ? i.polygon(p[0], n.properties) :i.multiPolygon(p, n.properties);
  2231. }
  2232. if ("MultiPolygon" === l.type) return s(l, r);
  2233. throw new Error("poly1 and poly2 must be either polygons or multiPolygons");
  2234. };
  2235. }, function(t, e, n) {
  2236. "use strict";
  2237. var r = n(14), i = (n.n(r), n(34)), a = n.n(i), o = n(2), s = (n.n(o), n(13)), l = (n.n(s),
  2238. n(15));
  2239. n.n(l);
  2240. function h(t) {
  2241. switch (t.type) {
  2242. case "Polygon":
  2243. return a()(t) > 1 ? t :null;
  2244. case "MultiPolygon":
  2245. var e = [];
  2246. if (Object(l.flattenEach)(t, function(t) {
  2247. a()(t) > 1 && e.push(t.geometry.coordinates);
  2248. }), e.length) return {
  2249. type:"MultiPolygon",
  2250. coordinates:e
  2251. };
  2252. }
  2253. }
  2254. e.a = function(t, e) {
  2255. var n = Object(s.getGeom)(t), i = Object(s.getGeom)(e), a = t.properties || {};
  2256. if (n = h(n), i = h(i), !n) return null;
  2257. if (!i) return Object(o.feature)(n, a);
  2258. var l = r.diff(n.coordinates, i.coordinates);
  2259. return 0 === l.length ? null :1 === l.length ? Object(o.polygon)(l[0], a) :Object(o.multiPolygon)(l, a);
  2260. };
  2261. }, function(t, e, n) {
  2262. "use strict";
  2263. Object.defineProperty(e, "__esModule", {
  2264. value:!0
  2265. });
  2266. var r = n(15), i = 6378137;
  2267. function a(t) {
  2268. var e = 0;
  2269. if (t && t.length > 0) {
  2270. e += Math.abs(o(t[0]));
  2271. for (var n = 1; n < t.length; n++) e -= Math.abs(o(t[n]));
  2272. }
  2273. return e;
  2274. }
  2275. function o(t) {
  2276. var e, n, r, a, o, l, h = 0, u = t.length;
  2277. if (u > 2) {
  2278. for (l = 0; l < u; l++) l === u - 2 ? (r = u - 2, a = u - 1, o = 0) :l === u - 1 ? (r = u - 1,
  2279. a = 0, o = 1) :(r = l, a = l + 1, o = l + 2), e = t[r], n = t[a], h += (s(t[o][0]) - s(e[0])) * Math.sin(s(n[1]));
  2280. h = h * i * i / 2;
  2281. }
  2282. return h;
  2283. }
  2284. function s(t) {
  2285. return t * Math.PI / 180;
  2286. }
  2287. e["default"] = function(t) {
  2288. return r.geomReduce(t, function(t, e) {
  2289. return t + function(t) {
  2290. var e, n = 0;
  2291. switch (t.type) {
  2292. case "Polygon":
  2293. return a(t.coordinates);
  2294. case "MultiPolygon":
  2295. for (e = 0; e < t.coordinates.length; e++) n += a(t.coordinates[e]);
  2296. return n;
  2297. case "Point":
  2298. case "MultiPoint":
  2299. case "LineString":
  2300. case "MultiLineString":
  2301. return 0;
  2302. }
  2303. return 0;
  2304. }(e);
  2305. }, 0);
  2306. };
  2307. }, function(t, e, n) {
  2308. "use strict";
  2309. var r = {
  2310. _initDraggableLayer:function() {
  2311. this._tempDragCoord = null;
  2312. var t = this._layer._path ? this._layer._path :this._layer._renderer._container;
  2313. L.DomUtil.addClass(t, "leaflet-pm-draggable"), this._originalMapDragState = this._layer._map.dragging._enabled,
  2314. this._safeToCacheDragState = !0, this._layer.on("mousedown", this._dragMixinOnMouseDown, this);
  2315. },
  2316. _dragMixinOnMouseUp:function() {
  2317. var t = this, e = this._layer._path ? this._layer._path :this._layer._renderer._container;
  2318. return this._originalMapDragState && this._layer._map.dragging.enable(), this._safeToCacheDragState = !0,
  2319. this._layer._map.off("mousemove", this._dragMixinOnMouseMove, this), this._layer.off("mouseup", this._dragMixinOnMouseUp, this),
  2320. !!this._dragging && (this._initMarkers(), window.setTimeout(function() {
  2321. t._dragging = !1, L.DomUtil.removeClass(e, "leaflet-pm-dragging"), t._layer.fire("pm:dragend"),
  2322. t._fireEdit();
  2323. }, 10), !0);
  2324. },
  2325. _dragMixinOnMouseMove:function(t) {
  2326. var e = this._layer._path ? this._layer._path :this._layer._renderer._container;
  2327. this._dragging || (this._dragging = !0, L.DomUtil.addClass(e, "leaflet-pm-dragging"),
  2328. this._layer.bringToFront(), this._originalMapDragState && this._layer._map.dragging.disable(),
  2329. this._markerGroup.clearLayers(), this._layer.fire("pm:dragstart")), this._onLayerDrag(t);
  2330. },
  2331. _dragMixinOnMouseDown:function(t) {
  2332. t.originalEvent.button > 0 || (this._safeToCacheDragState && (this._originalMapDragState = this._layer._map.dragging._enabled,
  2333. this._safeToCacheDragState = !1), this._tempDragCoord = t.latlng, this._layer.on("mouseup", this._dragMixinOnMouseUp, this),
  2334. this._layer._map.on("mousemove", this._dragMixinOnMouseMove, this));
  2335. },
  2336. dragging:function() {
  2337. return this._dragging;
  2338. },
  2339. _onLayerDrag:function(t) {
  2340. var e = t.latlng, n = e.lat - this._tempDragCoord.lat, r = e.lng - this._tempDragCoord.lng, i = function a(t) {
  2341. return t.map(function(t) {
  2342. return Array.isArray(t) ? a(t) :{
  2343. lat:t.lat + n,
  2344. lng:t.lng + r
  2345. };
  2346. });
  2347. }(this._layer._latlngs);
  2348. this._layer.setLatLngs(i).redraw(), this._tempDragCoord = e, this._layer.fire("pm:drag");
  2349. }
  2350. };
  2351. e.a = r;
  2352. }, function(t, e, n) {
  2353. "use strict";
  2354. n(1).a.LayerGroup = L.Class.extend({
  2355. initialize:function(t) {
  2356. var e = this;
  2357. this._layerGroup = t, this._layers = this.findLayers(), this._layers.forEach(function(t) {
  2358. return e._initLayer(t);
  2359. }), this._layerGroup.on("layeradd", function(t) {
  2360. t.target._pmTempLayer || (e._layers = e.findLayers(), t.layer.pm && e._initLayer(t.layer),
  2361. t.target.pm.enabled() && e.enable(e.getOptions()));
  2362. });
  2363. },
  2364. findLayers:function() {
  2365. var t = this._layerGroup.getLayers();
  2366. return t = (t = (t = t.filter(function(t) {
  2367. return !(t instanceof L.LayerGroup);
  2368. })).filter(function(t) {
  2369. return !!t.pm;
  2370. })).filter(function(t) {
  2371. return !t._pmTempLayer;
  2372. });
  2373. },
  2374. _initLayer:function(t) {
  2375. var e = this;
  2376. [ "pm:edit", "pm:update", "pm:remove", "pm:dragstart", "pm:drag", "pm:dragend", "pm:snap", "pm:unsnap", "pm:cut", "pm:intersect", "pm:raiseMarkers", "pm:markerdragend", "pm:markerdragstart", "pm:vertexadded", "pm:vertexremoved", "pm:centerplaced" ].forEach(function(n) {
  2377. t.on(n, e._fireEvent, e);
  2378. }), t.pm._layerGroup = this._layerGroup;
  2379. },
  2380. _fireEvent:function(t) {
  2381. this._layerGroup.fireEvent(t.type, t);
  2382. },
  2383. toggleEdit:function(t) {
  2384. this._options = t, this._layers.forEach(function(e) {
  2385. e.pm.toggleEdit(t);
  2386. });
  2387. },
  2388. enable:function(t) {
  2389. this._options = t, this._layers.forEach(function(e) {
  2390. e.pm.enable(t);
  2391. });
  2392. },
  2393. disable:function() {
  2394. this._layers.forEach(function(t) {
  2395. t.pm.disable();
  2396. });
  2397. },
  2398. enabled:function() {
  2399. var t = this._layers.find(function(t) {
  2400. return t.pm.enabled();
  2401. });
  2402. return !!t;
  2403. },
  2404. dragging:function() {
  2405. var t = this._layers.find(function(t) {
  2406. return t.pm.dragging();
  2407. });
  2408. return !!t;
  2409. },
  2410. getOptions:function() {
  2411. return this._options;
  2412. }
  2413. });
  2414. }, function(t, e, n) {
  2415. "use strict";
  2416. var r = n(1);
  2417. r.a.Marker = r.a.extend({
  2418. initialize:function(t) {
  2419. this._layer = t, this._enabled = !1, this._layer.on("dragend", this._onDragEnd, this);
  2420. },
  2421. toggleEdit:function(t) {
  2422. this.enabled() ? this.disable() :this.enable(t);
  2423. },
  2424. enable:function() {
  2425. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :{
  2426. draggable:!0,
  2427. snappable:!0
  2428. };
  2429. L.Util.setOptions(this, t), this._map = this._layer._map, this.enabled() || (this._enabled = !0,
  2430. this.options.preventMarkerRemoval || this._layer.on("contextmenu", this._removeMarker, this),
  2431. this.options.draggable && this._layer.dragging.enable(), this.options.snappable && this._initSnappableMarkers());
  2432. },
  2433. enabled:function() {
  2434. return this._enabled;
  2435. },
  2436. disable:function() {
  2437. this._enabled = !1, this._layer.dragging && this._layer.dragging.disable(), this._layer.off("contextmenu", this._removeMarker, this),
  2438. this._layerEdited && this._layer.fire("pm:update", {}), this._layerEdited = !1;
  2439. },
  2440. _removeMarker:function(t) {
  2441. var e = t.target;
  2442. e.remove(), e.fire("pm:remove");
  2443. },
  2444. _onDragEnd:function(t) {
  2445. t.target.fire("pm:edit"), this._layerEdited = !0;
  2446. },
  2447. _initSnappableMarkers:function() {
  2448. var t = this._layer;
  2449. this.options.snapDistance = this.options.snapDistance || 30, t.off("drag", this._handleSnapping, this),
  2450. t.on("drag", this._handleSnapping, this), t.off("dragend", this._cleanupSnapping, this),
  2451. t.on("dragend", this._cleanupSnapping, this), t.off("pm:dragstart", this._unsnap, this),
  2452. t.on("pm:dragstart", this._unsnap, this);
  2453. }
  2454. });
  2455. }, function(t, e, n) {
  2456. "use strict";
  2457. var r = n(12), i = n.n(r), a = n(39), o = n.n(a), s = n(1), l = n(11);
  2458. s.a.Line = s.a.extend({
  2459. initialize:function(t) {
  2460. this._layer = t, this._enabled = !1;
  2461. },
  2462. toggleEdit:function(t) {
  2463. this.enabled() ? this.disable() :this.enable(t);
  2464. },
  2465. enable:function(t) {
  2466. L.Util.setOptions(this, t), this._map = this._layer._map, this._map && (this.enabled() || this.disable(),
  2467. this._enabled = !0, this._initMarkers(), this._layer.on("remove", this._onLayerRemove, this),
  2468. this.options.allowSelfIntersection || this._layer.on("pm:vertexremoved", this._handleSelfIntersectionOnVertexRemoval, this),
  2469. this.options.draggable && this._initDraggableLayer(), this.options.allowSelfIntersection || this._handleLayerStyle());
  2470. },
  2471. _onLayerRemove:function(t) {
  2472. this.disable(t.target);
  2473. },
  2474. enabled:function() {
  2475. return this._enabled;
  2476. },
  2477. disable:function() {
  2478. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this._layer;
  2479. if (!this.enabled()) return !1;
  2480. if (t.pm._dragging) return !1;
  2481. t.pm._enabled = !1, t.pm._markerGroup.clearLayers(), t.off("mousedown"), t.off("mouseup"),
  2482. this._layer.off("remove", this._onLayerRemove), this.options.allowSelfIntersection || this._layer.off("pm:vertexremoved", this._handleSelfIntersectionOnVertexRemoval);
  2483. var e = t._path ? t._path :this._layer._renderer._container;
  2484. return L.DomUtil.removeClass(e, "leaflet-pm-draggable"), this.hasSelfIntersection() && L.DomUtil.removeClass(e, "leaflet-pm-invalid"),
  2485. this._layerEdited && this._layer.fire("pm:update", {}), this._layerEdited = !1,
  2486. !0;
  2487. },
  2488. hasSelfIntersection:function() {
  2489. return i()(this._layer.toGeoJSON(15)).features.length > 0;
  2490. },
  2491. _handleSelfIntersectionOnVertexRemoval:function() {
  2492. this._handleLayerStyle(!0), this.hasSelfIntersection() && (this._layer.setLatLngs(this._coordsBeforeEdit),
  2493. this._coordsBeforeEdit = null, this._initMarkers());
  2494. },
  2495. _handleLayerStyle:function(t) {
  2496. var e = this._layer._path ? this._layer._path :this._layer._renderer._container;
  2497. if (this.hasSelfIntersection()) {
  2498. if (L.DomUtil.hasClass(e, "leaflet-pm-invalid")) return;
  2499. t ? (L.DomUtil.addClass(e, "leaflet-pm-invalid"), window.setTimeout(function() {
  2500. L.DomUtil.removeClass(e, "leaflet-pm-invalid");
  2501. }, 200)) :L.DomUtil.addClass(e, "leaflet-pm-invalid"), this._layer.fire("pm:intersect", {
  2502. intersection:i()(this._layer.toGeoJSON(15))
  2503. });
  2504. } else L.DomUtil.removeClass(e, "leaflet-pm-invalid");
  2505. },
  2506. _initMarkers:function() {
  2507. var t = this, e = this._map, n = this._layer.getLatLngs();
  2508. this._markerGroup && this._markerGroup.clearLayers(), this._markerGroup = new L.LayerGroup(),
  2509. this._markerGroup._pmTempLayer = !0, e.addLayer(this._markerGroup);
  2510. this._markers = function r(e) {
  2511. if (Array.isArray(e[0])) return e.map(r, t);
  2512. var n = e.map(t._createMarker, t);
  2513. return e.map(function(r, i) {
  2514. var a = t.isPolygon() ? (i + 1) % e.length :i + 1;
  2515. return t._createMiddleMarker(n[i], n[a]);
  2516. }), n;
  2517. }(n), this.options.snappable && this._initSnappableMarkers();
  2518. },
  2519. _createMarker:function(t) {
  2520. var e = new L.Marker(t, {
  2521. draggable:!this.options.preventVertexEdit,
  2522. icon:L.divIcon({
  2523. className:"marker-icon"
  2524. })
  2525. });
  2526. return e._pmTempLayer = !0, e.on("dragstart", this._onMarkerDragStart, this), e.on("move", this._onMarkerDrag, this),
  2527. e.on("dragend", this._onMarkerDragEnd, this), this.options.preventMarkerRemoval || e.on("contextmenu", this._removeMarker, this),
  2528. this._markerGroup.addLayer(e), e;
  2529. },
  2530. _createMiddleMarker:function(t, e) {
  2531. var n = this;
  2532. if (!t || !e) return !1;
  2533. var r = l.a.calcMiddleLatLng(this._map, t.getLatLng(), e.getLatLng()), i = this._createMarker(r), a = L.divIcon({
  2534. className:"marker-icon marker-icon-middle"
  2535. });
  2536. return i.setIcon(a), t._middleMarkerNext = i, e._middleMarkerPrev = i, i.on("click", function() {
  2537. var r = L.divIcon({
  2538. className:"marker-icon"
  2539. });
  2540. i.setIcon(r), n._addMarker(i, t, e);
  2541. }), i.on("movestart", function() {
  2542. i.on("moveend", function() {
  2543. var t = L.divIcon({
  2544. className:"marker-icon"
  2545. });
  2546. i.setIcon(t), i.off("moveend");
  2547. }), n._addMarker(i, t, e);
  2548. }), i;
  2549. },
  2550. _addMarker:function(t, e, n) {
  2551. t.off("movestart"), t.off("click");
  2552. var r = t.getLatLng(), i = this._layer._latlngs, a = this.findDeepMarkerIndex(this._markers, e), s = a.indexPath, l = a.index, h = a.parentPath, u = s.length > 1 ? o()(i, h) :i, c = s.length > 1 ? o()(this._markers, h) :this._markers;
  2553. u.splice(l + 1, 0, r), c.splice(l + 1, 0, t), this._layer.setLatLngs(i), this._createMiddleMarker(e, t),
  2554. this._createMiddleMarker(t, n), this._fireEdit(), this._layer.fire("pm:vertexadded", {
  2555. layer:this._layer,
  2556. marker:t,
  2557. indexPath:this.findDeepMarkerIndex(this._markers, t).indexPath,
  2558. latlng:r
  2559. }), this.options.snappable && this._initSnappableMarkers();
  2560. },
  2561. _removeMarker:function(t) {
  2562. if (!this.options.allowSelfIntersection) {
  2563. var e = this._layer.getLatLngs();
  2564. this._coordsBeforeEdit = JSON.parse(JSON.stringify(e));
  2565. }
  2566. var n = t.target, r = this._layer.getLatLngs(), i = this.findDeepMarkerIndex(this._markers, n), a = i.indexPath, s = i.index, l = i.parentPath;
  2567. if (a) {
  2568. var h, u, c = a.length > 1 ? o()(r, l) :r, p = a.length > 1 ? o()(this._markers, l) :this._markers;
  2569. if (c.splice(s, 1), this._layer.setLatLngs(r), c.length <= 1 && (c.splice(0, c.length),
  2570. this._layer.setLatLngs(r), this.disable(), this.enable(this.options)), this.isEmptyDeep(r) && this._layer.remove(),
  2571. n._middleMarkerPrev && this._markerGroup.removeLayer(n._middleMarkerPrev), n._middleMarkerNext && this._markerGroup.removeLayer(n._middleMarkerNext),
  2572. this._markerGroup.removeLayer(n), this.isPolygon() ? (h = (s + 1) % p.length, u = (s + (p.length - 1)) % p.length) :(u = s - 1 < 0 ? undefined :s - 1,
  2573. h = s + 1 >= p.length ? undefined :s + 1), h !== u) {
  2574. var f = p[u], d = p[h];
  2575. this._createMiddleMarker(f, d);
  2576. }
  2577. p.splice(s, 1), this._fireEdit(), this._layer.fire("pm:vertexremoved", {
  2578. layer:this._layer,
  2579. marker:n,
  2580. indexPath:a
  2581. });
  2582. }
  2583. },
  2584. isEmptyDeep:function(t) {
  2585. return !function e(t) {
  2586. return t.filter(function(t) {
  2587. return ![ null, "", undefined ].includes(t);
  2588. }).reduce(function(t, n) {
  2589. return t.concat(Array.isArray(n) ? e(n) :n);
  2590. }, []);
  2591. }(t).length;
  2592. },
  2593. findDeepMarkerIndex:function(t, e) {
  2594. var n;
  2595. t.some(function i(t) {
  2596. return function(r, a) {
  2597. var o = t.concat(a);
  2598. return r._leaflet_id === e._leaflet_id ? (n = o, !0) :Array.isArray(r) && r.some(i(o));
  2599. };
  2600. }([]));
  2601. var r = {};
  2602. return n && (r = {
  2603. indexPath:n,
  2604. index:n[n.length - 1],
  2605. parentPath:n.slice(0, n.length - 1)
  2606. }), r;
  2607. },
  2608. updatePolygonCoordsFromMarkerDrag:function(t) {
  2609. var e = this._layer.getLatLngs(), n = t.getLatLng(), r = this.findDeepMarkerIndex(this._markers, t), i = r.indexPath, a = r.index, s = r.parentPath;
  2610. (i.length > 1 ? o()(e, s) :e).splice(a, 1, n), this._layer.setLatLngs(e).redraw();
  2611. },
  2612. _onMarkerDrag:function(t) {
  2613. var e = t.target, n = this.findDeepMarkerIndex(this._markers, e), r = n.indexPath, i = n.index, a = n.parentPath;
  2614. if (r) {
  2615. this.updatePolygonCoordsFromMarkerDrag(e);
  2616. var s = r.length > 1 ? o()(this._markers, a) :this._markers, h = (i + 1) % s.length, u = (i + (s.length - 1)) % s.length, c = e.getLatLng(), p = s[u].getLatLng(), f = s[h].getLatLng();
  2617. if (e._middleMarkerNext) {
  2618. var d = l.a.calcMiddleLatLng(this._map, c, f);
  2619. e._middleMarkerNext.setLatLng(d);
  2620. }
  2621. if (e._middleMarkerPrev) {
  2622. var g = l.a.calcMiddleLatLng(this._map, c, p);
  2623. e._middleMarkerPrev.setLatLng(g);
  2624. }
  2625. this.options.allowSelfIntersection || this._handleLayerStyle();
  2626. }
  2627. },
  2628. _onMarkerDragEnd:function(t) {
  2629. var e = t.target, n = this.findDeepMarkerIndex(this._markers, e).indexPath;
  2630. if (!this.options.allowSelfIntersection && this.hasSelfIntersection()) return this._layer.setLatLngs(this._coordsBeforeEdit),
  2631. this._coordsBeforeEdit = null, this._initMarkers(), void this._handleLayerStyle();
  2632. this._layer.fire("pm:markerdragend", {
  2633. markerEvent:t,
  2634. indexPath:n
  2635. }), this._fireEdit();
  2636. },
  2637. _onMarkerDragStart:function(t) {
  2638. var e = t.target, n = this.findDeepMarkerIndex(this._markers, e).indexPath;
  2639. this._layer.fire("pm:markerdragstart", {
  2640. markerEvent:t,
  2641. indexPath:n
  2642. }), this.options.allowSelfIntersection || (this._coordsBeforeEdit = this._layer.getLatLngs());
  2643. },
  2644. _fireEdit:function() {
  2645. this._layerEdited = !0, this._layer.fire("pm:edit");
  2646. }
  2647. });
  2648. }, function(t, e, n) {
  2649. var r = n(40);
  2650. t.exports = function(t, e, n) {
  2651. var i = null == t ? undefined :r(t, e);
  2652. return i === undefined ? n :i;
  2653. };
  2654. }, function(t, e, n) {
  2655. var r = n(41), i = n(81);
  2656. t.exports = function(t, e) {
  2657. for (var n = 0, a = (e = r(e, t)).length; null != t && n < a; ) t = t[i(e[n++])];
  2658. return n && n == a ? t :undefined;
  2659. };
  2660. }, function(t, e, n) {
  2661. var r = n(6), i = n(42), a = n(48), o = n(78);
  2662. t.exports = function(t, e) {
  2663. return r(t) ? t :i(t, e) ? [ t ] :a(o(t));
  2664. };
  2665. }, function(t, e, n) {
  2666. var r = n(6), i = n(7), a = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, o = /^\w*$/;
  2667. t.exports = function(t, e) {
  2668. if (r(t)) return !1;
  2669. var n = typeof t;
  2670. return !("number" != n && "symbol" != n && "boolean" != n && null != t && !i(t)) || o.test(t) || !a.test(t) || null != e && t in Object(e);
  2671. };
  2672. }, function(t, e, n) {
  2673. (function(e) {
  2674. var n = "object" == typeof e && e && e.Object === Object && e;
  2675. t.exports = n;
  2676. }).call(e, n(44));
  2677. }, function(t, e) {
  2678. var n;
  2679. n = function() {
  2680. return this;
  2681. }();
  2682. try {
  2683. n = n || Function("return this")() || (0, eval)("this");
  2684. } catch (r) {
  2685. "object" == typeof window && (n = window);
  2686. }
  2687. t.exports = n;
  2688. }, function(t, e, n) {
  2689. var r = n(8), i = Object.prototype, a = i.hasOwnProperty, o = i.toString, s = r ? r.toStringTag :undefined;
  2690. t.exports = function(t) {
  2691. var e = a.call(t, s), n = t[s];
  2692. try {
  2693. t[s] = undefined;
  2694. var r = !0;
  2695. } catch (l) {}
  2696. var i = o.call(t);
  2697. return r && (e ? t[s] = n :delete t[s]), i;
  2698. };
  2699. }, function(t, e) {
  2700. var n = Object.prototype.toString;
  2701. t.exports = function(t) {
  2702. return n.call(t);
  2703. };
  2704. }, function(t, e) {
  2705. t.exports = function(t) {
  2706. return null != t && "object" == typeof t;
  2707. };
  2708. }, function(t, e, n) {
  2709. var r = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, i = /\\(\\)?/g, a = n(49)(function(t) {
  2710. var e = [];
  2711. return 46 === t.charCodeAt(0) && e.push(""), t.replace(r, function(t, n, r, a) {
  2712. e.push(r ? a.replace(i, "$1") :n || t);
  2713. }), e;
  2714. });
  2715. t.exports = a;
  2716. }, function(t, e, n) {
  2717. var r = n(50), i = 500;
  2718. t.exports = function(t) {
  2719. var e = r(t, function(t) {
  2720. return n.size === i && n.clear(), t;
  2721. }), n = e.cache;
  2722. return e;
  2723. };
  2724. }, function(t, e, n) {
  2725. var r = n(51), i = "Expected a function";
  2726. function a(t, e) {
  2727. if ("function" != typeof t || null != e && "function" != typeof e) throw new TypeError(i);
  2728. var n = function() {
  2729. var r = arguments, i = e ? e.apply(this, r) :r[0], a = n.cache;
  2730. if (a.has(i)) return a.get(i);
  2731. var o = t.apply(this, r);
  2732. return n.cache = a.set(i, o) || a, o;
  2733. };
  2734. return n.cache = new (a.Cache || r)(), n;
  2735. }
  2736. a.Cache = r, t.exports = a;
  2737. }, function(t, e, n) {
  2738. var r = n(52), i = n(73), a = n(75), o = n(76), s = n(77);
  2739. function l(t) {
  2740. var e = -1, n = null == t ? 0 :t.length;
  2741. for (this.clear(); ++e < n; ) {
  2742. var r = t[e];
  2743. this.set(r[0], r[1]);
  2744. }
  2745. }
  2746. l.prototype.clear = r, l.prototype["delete"] = i, l.prototype.get = a, l.prototype.has = o,
  2747. l.prototype.set = s, t.exports = l;
  2748. }, function(t, e, n) {
  2749. var r = n(53), i = n(65), a = n(72);
  2750. t.exports = function() {
  2751. this.size = 0, this.__data__ = {
  2752. hash:new r(),
  2753. map:new (a || i)(),
  2754. string:new r()
  2755. };
  2756. };
  2757. }, function(t, e, n) {
  2758. var r = n(54), i = n(61), a = n(62), o = n(63), s = n(64);
  2759. function l(t) {
  2760. var e = -1, n = null == t ? 0 :t.length;
  2761. for (this.clear(); ++e < n; ) {
  2762. var r = t[e];
  2763. this.set(r[0], r[1]);
  2764. }
  2765. }
  2766. l.prototype.clear = r, l.prototype["delete"] = i, l.prototype.get = a, l.prototype.has = o,
  2767. l.prototype.set = s, t.exports = l;
  2768. }, function(t, e, n) {
  2769. var r = n(3);
  2770. t.exports = function() {
  2771. this.__data__ = r ? r(null) :{}, this.size = 0;
  2772. };
  2773. }, function(t, e, n) {
  2774. var r = n(56), i = n(57), a = n(18), o = n(59), s = /^\[object .+?Constructor\]$/, l = Function.prototype, h = Object.prototype, u = l.toString, c = h.hasOwnProperty, p = RegExp("^" + u.call(c).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  2775. t.exports = function(t) {
  2776. return !(!a(t) || i(t)) && (r(t) ? p :s).test(o(t));
  2777. };
  2778. }, function(t, e, n) {
  2779. var r = n(16), i = n(18), a = "[object AsyncFunction]", o = "[object Function]", s = "[object GeneratorFunction]", l = "[object Proxy]";
  2780. t.exports = function(t) {
  2781. if (!i(t)) return !1;
  2782. var e = r(t);
  2783. return e == o || e == s || e == a || e == l;
  2784. };
  2785. }, function(t, e, n) {
  2786. var r = n(58), i = function() {
  2787. var t = /[^.]+$/.exec(r && r.keys && r.keys.IE_PROTO || "");
  2788. return t ? "Symbol(src)_1." + t :"";
  2789. }();
  2790. t.exports = function(t) {
  2791. return !!i && i in t;
  2792. };
  2793. }, function(t, e, n) {
  2794. var r = n(9)["__core-js_shared__"];
  2795. t.exports = r;
  2796. }, function(t, e) {
  2797. var n = Function.prototype.toString;
  2798. t.exports = function(t) {
  2799. if (null != t) {
  2800. try {
  2801. return n.call(t);
  2802. } catch (e) {}
  2803. try {
  2804. return t + "";
  2805. } catch (e) {}
  2806. }
  2807. return "";
  2808. };
  2809. }, function(t, e) {
  2810. t.exports = function(t, e) {
  2811. return null == t ? undefined :t[e];
  2812. };
  2813. }, function(t, e) {
  2814. t.exports = function(t) {
  2815. var e = this.has(t) && delete this.__data__[t];
  2816. return this.size -= e ? 1 :0, e;
  2817. };
  2818. }, function(t, e, n) {
  2819. var r = n(3), i = "__lodash_hash_undefined__", a = Object.prototype.hasOwnProperty;
  2820. t.exports = function(t) {
  2821. var e = this.__data__;
  2822. if (r) {
  2823. var n = e[t];
  2824. return n === i ? undefined :n;
  2825. }
  2826. return a.call(e, t) ? e[t] :undefined;
  2827. };
  2828. }, function(t, e, n) {
  2829. var r = n(3), i = Object.prototype.hasOwnProperty;
  2830. t.exports = function(t) {
  2831. var e = this.__data__;
  2832. return r ? e[t] !== undefined :i.call(e, t);
  2833. };
  2834. }, function(t, e, n) {
  2835. var r = n(3), i = "__lodash_hash_undefined__";
  2836. t.exports = function(t, e) {
  2837. var n = this.__data__;
  2838. return this.size += this.has(t) ? 0 :1, n[t] = r && e === undefined ? i :e, this;
  2839. };
  2840. }, function(t, e, n) {
  2841. var r = n(66), i = n(67), a = n(69), o = n(70), s = n(71);
  2842. function l(t) {
  2843. var e = -1, n = null == t ? 0 :t.length;
  2844. for (this.clear(); ++e < n; ) {
  2845. var r = t[e];
  2846. this.set(r[0], r[1]);
  2847. }
  2848. }
  2849. l.prototype.clear = r, l.prototype["delete"] = i, l.prototype.get = a, l.prototype.has = o,
  2850. l.prototype.set = s, t.exports = l;
  2851. }, function(t, e) {
  2852. t.exports = function() {
  2853. this.__data__ = [], this.size = 0;
  2854. };
  2855. }, function(t, e, n) {
  2856. var r = n(4), i = Array.prototype.splice;
  2857. t.exports = function(t) {
  2858. var e = this.__data__, n = r(e, t);
  2859. return !(n < 0 || (n == e.length - 1 ? e.pop() :i.call(e, n, 1), --this.size, 0));
  2860. };
  2861. }, function(t, e) {
  2862. t.exports = function(t, e) {
  2863. return t === e || t != t && e != e;
  2864. };
  2865. }, function(t, e, n) {
  2866. var r = n(4);
  2867. t.exports = function(t) {
  2868. var e = this.__data__, n = r(e, t);
  2869. return n < 0 ? undefined :e[n][1];
  2870. };
  2871. }, function(t, e, n) {
  2872. var r = n(4);
  2873. t.exports = function(t) {
  2874. return r(this.__data__, t) > -1;
  2875. };
  2876. }, function(t, e, n) {
  2877. var r = n(4);
  2878. t.exports = function(t, e) {
  2879. var n = this.__data__, i = r(n, t);
  2880. return i < 0 ? (++this.size, n.push([ t, e ])) :n[i][1] = e, this;
  2881. };
  2882. }, function(t, e, n) {
  2883. var r = n(17)(n(9), "Map");
  2884. t.exports = r;
  2885. }, function(t, e, n) {
  2886. var r = n(5);
  2887. t.exports = function(t) {
  2888. var e = r(this, t)["delete"](t);
  2889. return this.size -= e ? 1 :0, e;
  2890. };
  2891. }, function(t, e) {
  2892. t.exports = function(t) {
  2893. var e = typeof t;
  2894. return "string" == e || "number" == e || "symbol" == e || "boolean" == e ? "__proto__" !== t :null === t;
  2895. };
  2896. }, function(t, e, n) {
  2897. var r = n(5);
  2898. t.exports = function(t) {
  2899. return r(this, t).get(t);
  2900. };
  2901. }, function(t, e, n) {
  2902. var r = n(5);
  2903. t.exports = function(t) {
  2904. return r(this, t).has(t);
  2905. };
  2906. }, function(t, e, n) {
  2907. var r = n(5);
  2908. t.exports = function(t, e) {
  2909. var n = r(this, t), i = n.size;
  2910. return n.set(t, e), this.size += n.size == i ? 0 :1, this;
  2911. };
  2912. }, function(t, e, n) {
  2913. var r = n(79);
  2914. t.exports = function(t) {
  2915. return null == t ? "" :r(t);
  2916. };
  2917. }, function(t, e, n) {
  2918. var r = n(8), i = n(80), a = n(6), o = n(7), s = 1 / 0, l = r ? r.prototype :undefined, h = l ? l.toString :undefined;
  2919. t.exports = function u(t) {
  2920. if ("string" == typeof t) return t;
  2921. if (a(t)) return i(t, u) + "";
  2922. if (o(t)) return h ? h.call(t) :"";
  2923. var e = t + "";
  2924. return "0" == e && 1 / t == -s ? "-0" :e;
  2925. };
  2926. }, function(t, e) {
  2927. t.exports = function(t, e) {
  2928. for (var n = -1, r = null == t ? 0 :t.length, i = Array(r); ++n < r; ) i[n] = e(t[n], n, t);
  2929. return i;
  2930. };
  2931. }, function(t, e, n) {
  2932. var r = n(7), i = 1 / 0;
  2933. t.exports = function(t) {
  2934. if ("string" == typeof t || r(t)) return t;
  2935. var e = t + "";
  2936. return "0" == e && 1 / t == -i ? "-0" :e;
  2937. };
  2938. }, function(t, e, n) {
  2939. "use strict";
  2940. var r = n(1);
  2941. r.a.Poly = r.a.Line.extend({});
  2942. }, function(t, e, n) {
  2943. "use strict";
  2944. var r = n(1);
  2945. r.a.Rectangle = r.a.Poly.extend({
  2946. _initMarkers:function() {
  2947. var t = this._map, e = this._findCorners();
  2948. this._markerGroup && this._markerGroup.clearLayers(), this._markerGroup = new L.LayerGroup(),
  2949. this._markerGroup._pmTempLayer = !0, t.addLayer(this._markerGroup), this._markers = [],
  2950. this._markers[0] = e.map(this._createMarker, this), this._cornerMarkers = this._markers[0],
  2951. this.options.snappable && this._initSnappableMarkers();
  2952. },
  2953. _createMarker:function(t, e) {
  2954. var n = new L.Marker(t, {
  2955. draggable:!this.options.preventVertexEdit,
  2956. icon:L.divIcon({
  2957. className:"marker-icon"
  2958. })
  2959. });
  2960. return n._origLatLng = t, n._index = e, n._pmTempLayer = !0, n.on("dragstart", this._onMarkerDragStart, this),
  2961. n.on("drag", this._onMarkerDrag, this), n.on("dragend", this._onMarkerDragEnd, this),
  2962. n.on("pm:snap", this._adjustRectangleForMarkerSnap, this), this.options.preventMarkerRemoval || n.on("contextmenu", this._removeMarker, this),
  2963. this._markerGroup.addLayer(n), n;
  2964. },
  2965. _removeMarker:function() {
  2966. return null;
  2967. },
  2968. _onMarkerDragStart:function(t) {
  2969. var e = t.target, n = this._findCorners();
  2970. e._oppositeCornerLatLng = n[(e._index + 2) % 4], e._snapped = !1, this._layer.fire("pm:markerdragstart", {
  2971. markerEvent:t
  2972. });
  2973. },
  2974. _onMarkerDrag:function(t) {
  2975. var e = t.target;
  2976. e._index !== undefined && (e._snapped || this._adjustRectangleForMarkerMove(e));
  2977. },
  2978. _onMarkerDragEnd:function(t) {
  2979. var e = this._findCorners();
  2980. this._adjustAllMarkers(e), this._cornerMarkers.forEach(function(t) {
  2981. delete t._oppositeCornerLatLng;
  2982. }), this._layer.setLatLngs(e), this._layer.redraw(), this._layer.fire("pm:markerdragend", {
  2983. markerEvent:t
  2984. }), this._fireEdit();
  2985. },
  2986. _adjustRectangleForMarkerMove:function(t) {
  2987. L.extend(t._origLatLng, t._latlng);
  2988. var e = t.getLatLng();
  2989. this._layer.setBounds(L.latLngBounds(e, t._oppositeCornerLatLng)), this._adjustAdjacentMarkers(t),
  2990. this._layer.redraw();
  2991. },
  2992. _adjustRectangleForMarkerSnap:function(t) {
  2993. if (this.options.snappable) {
  2994. var e = t.target;
  2995. this._adjustRectangleForMarkerMove(e);
  2996. }
  2997. },
  2998. _adjustAllMarkers:function(t) {
  2999. t.length && 4 == t.length ? this._cornerMarkers.forEach(function(e, n) {
  3000. e.setLatLng(t[n]);
  3001. }) :console.error("_adjustAllMarkers() requires an array of EXACTLY 4 LatLng coordinates");
  3002. },
  3003. _adjustAdjacentMarkers:function(t) {
  3004. if (t && t.getLatLng && t._oppositeCornerLatLng) {
  3005. var e = t.getLatLng(), n = t._oppositeCornerLatLng, r = [];
  3006. this._findCorners().forEach(function(t) {
  3007. t.equals(e) || t.equals(n) || r.push(t);
  3008. });
  3009. var i = 0;
  3010. 2 == r.length && this._cornerMarkers.forEach(function(t) {
  3011. var a = t.getLatLng();
  3012. a.equals(e) || a.equals(n) || (t.setLatLng(r[i]), i += 1);
  3013. });
  3014. } else console.error("_adjustAdjacentMarkers() requires a valid Marker object");
  3015. },
  3016. _findCorners:function() {
  3017. var t = this._layer.getBounds();
  3018. return [ t.getNorthWest(), t.getNorthEast(), t.getSouthEast(), t.getSouthWest() ];
  3019. }
  3020. });
  3021. }, function(t, e, n) {
  3022. "use strict";
  3023. var r = n(1);
  3024. r.a.Circle = r.a.extend({
  3025. initialize:function(t) {
  3026. this._layer = t, this._enabled = !1;
  3027. },
  3028. toggleEdit:function(t) {
  3029. this.enabled() ? this.disable() :this.enable(t);
  3030. },
  3031. enabled:function() {
  3032. return this._enabled;
  3033. },
  3034. enable:function(t) {
  3035. var e = this;
  3036. L.Util.setOptions(this, t), this._map = this._layer._map, this.enabled() || this.disable(),
  3037. this._enabled = !0, this._initMarkers(), this._layer.on("remove", function(t) {
  3038. e.disable(t.target);
  3039. });
  3040. },
  3041. disable:function() {
  3042. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this._layer;
  3043. if (!this.enabled()) return !1;
  3044. if (t.pm._dragging) return !1;
  3045. t.pm._enabled = !1, t.pm._helperLayers.clearLayers(), t.off("mousedown"), t.off("mouseup");
  3046. var e = t._path ? t._path :this._layer._renderer._container;
  3047. return L.DomUtil.removeClass(e, "leaflet-pm-draggable"), this._layerEdited && this._layer.fire("pm:update", {}),
  3048. this._layerEdited = !1, !0;
  3049. },
  3050. _initMarkers:function() {
  3051. var t = this._map;
  3052. this._helperLayers && this._helperLayers.clearLayers(), this._helperLayers = new L.LayerGroup().addTo(t);
  3053. var e = this._layer.getLatLng(), n = this._layer._radius, r = this._getLatLngOnCircle(e, n);
  3054. this._centerMarker = this._createCenterMarker(e), this._outerMarker = this._createOuterMarker(r),
  3055. this._markers = [ this._centerMarker, this._outerMarker ], this._createHintLine(this._centerMarker, this._outerMarker),
  3056. this.options.snappable && this._initSnappableMarkers();
  3057. },
  3058. _getLatLngOnCircle:function(t, e) {
  3059. var n = this._map.project(t), r = L.point(n.x + e, n.y);
  3060. return this._map.unproject(r);
  3061. },
  3062. _resizeCircle:function() {
  3063. this._syncHintLine(), this._syncCircleRadius();
  3064. },
  3065. _moveCircle:function(t) {
  3066. var e = t.latlng;
  3067. this._layer.setLatLng(e);
  3068. var n = this._layer._radius, r = this._getLatLngOnCircle(e, n);
  3069. this._outerMarker.setLatLng(r), this._syncHintLine(), this._layer.fire("pm:centerplaced", {
  3070. layer:this._layer,
  3071. latlng:e
  3072. });
  3073. },
  3074. _onMarkerDragStart:function(t) {
  3075. this._layer.fire("pm:markerdragstart", {
  3076. markerEvent:t
  3077. });
  3078. },
  3079. _onMarkerDragEnd:function(t) {
  3080. this._fireEdit(), this._layer.fire("pm:markerdragend", {
  3081. markerEvent:t
  3082. });
  3083. },
  3084. _syncCircleRadius:function() {
  3085. var t = this._centerMarker.getLatLng(), e = this._outerMarker.getLatLng(), n = t.distanceTo(e);
  3086. this._layer.setRadius(n);
  3087. },
  3088. _syncHintLine:function() {
  3089. var t = this._centerMarker.getLatLng(), e = this._outerMarker.getLatLng();
  3090. this._hintline.setLatLngs([ t, e ]);
  3091. },
  3092. _createHintLine:function(t, e) {
  3093. var n = t.getLatLng(), r = e.getLatLng();
  3094. this._hintline = L.polyline([ n, r ], this.options.hintlineStyle), this._hintline._pmTempLayer = !0,
  3095. this._helperLayers.addLayer(this._hintline);
  3096. },
  3097. _createCenterMarker:function(t) {
  3098. var e = this._createMarker(t);
  3099. return e.on("move", this._moveCircle, this), e;
  3100. },
  3101. _createOuterMarker:function(t) {
  3102. var e = this._createMarker(t);
  3103. return this.options.preventVertexEdit && e.dragging.disable(), e.on("move", this._resizeCircle, this),
  3104. e;
  3105. },
  3106. _createMarker:function(t) {
  3107. var e = new L.Marker(t, {
  3108. draggable:!0,
  3109. icon:L.divIcon({
  3110. className:"marker-icon"
  3111. })
  3112. });
  3113. return e._origLatLng = t, e._pmTempLayer = !0, e.on("dragstart", this._onMarkerDragStart, this),
  3114. e.on("dragend", this._onMarkerDragEnd, this), this._helperLayers.addLayer(e), e;
  3115. },
  3116. _fireEdit:function() {
  3117. this._layer.fire("pm:edit"), this._layerEdited = !0;
  3118. }
  3119. });
  3120. }, function(t, e) {}, function(t, e) {} ]);