BMturf.min.js 1.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652
  1. ! function (t, e) {
  2. "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).BMturf = {})
  3. }(this, (function (t) {
  4. "use strict";
  5. var e = 6371008.8,
  6. n = {
  7. centimeters: 637100880,
  8. centimetres: 637100880,
  9. degrees: 57.22891354143274,
  10. feet: 20902260.511392,
  11. inches: 39.37 * e,
  12. kilometers: 6371.0088,
  13. kilometres: 6371.0088,
  14. meters: e,
  15. metres: e,
  16. miles: 3958.761333810546,
  17. millimeters: 6371008800,
  18. millimetres: 6371008800,
  19. nauticalmiles: e / 1852,
  20. radians: 1,
  21. yards: 6967335.223679999
  22. },
  23. r = {
  24. centimeters: 100,
  25. centimetres: 100,
  26. degrees: 1 / 111325,
  27. feet: 3.28084,
  28. inches: 39.37,
  29. kilometers: .001,
  30. kilometres: .001,
  31. meters: 1,
  32. metres: 1,
  33. miles: 1 / 1609.344,
  34. millimeters: 1e3,
  35. millimetres: 1e3,
  36. nauticalmiles: 1 / 1852,
  37. radians: 1 / e,
  38. yards: 1.0936133
  39. },
  40. i = {
  41. acres: 247105e-9,
  42. centimeters: 1e4,
  43. centimetres: 1e4,
  44. feet: 10.763910417,
  45. hectares: 1e-4,
  46. inches: 1550.003100006,
  47. kilometers: 1e-6,
  48. kilometres: 1e-6,
  49. meters: 1,
  50. metres: 1,
  51. miles: 386e-9,
  52. millimeters: 1e6,
  53. millimetres: 1e6,
  54. yards: 1.195990046
  55. };
  56. function o(t, e, n) {
  57. void 0 === n && (n = {});
  58. var r = {
  59. type: "Feature"
  60. };
  61. return (0 === n.id || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = e || {}, r.geometry = t, r
  62. }
  63. function s(t, e, n) {
  64. switch (t) {
  65. case "Point":
  66. return a(e).geometry;
  67. case "LineString":
  68. return h(e).geometry;
  69. case "Polygon":
  70. return l(e).geometry;
  71. case "MultiPoint":
  72. return d(e).geometry;
  73. case "MultiLineString":
  74. return g(e).geometry;
  75. case "MultiPolygon":
  76. return y(e).geometry;
  77. default:
  78. throw new Error(t + " is invalid")
  79. }
  80. }
  81. function a(t, e, n) {
  82. if (void 0 === n && (n = {}), !t) throw new Error("coordinates is required");
  83. if (!Array.isArray(t)) throw new Error("coordinates must be an Array");
  84. if (t.length < 2) throw new Error("coordinates must be at least 2 numbers long");
  85. if (!C(t[0]) || !C(t[1])) throw new Error("coordinates must contain numbers");
  86. return o({
  87. type: "Point",
  88. coordinates: t
  89. }, e, n)
  90. }
  91. function u(t, e, n) {
  92. return void 0 === n && (n = {}), f(t.map((function (t) {
  93. return a(t, e)
  94. })), n)
  95. }
  96. function l(t, e, n) {
  97. void 0 === n && (n = {});
  98. for (var r = 0, i = t; r < i.length; r++) {
  99. var s = i[r];
  100. if (s.length < 4) throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
  101. for (var a = 0; a < s[s.length - 1].length; a++)
  102. if (s[s.length - 1][a] !== s[0][a]) throw new Error("First and last Position are not equivalent.")
  103. }
  104. return o({
  105. type: "Polygon",
  106. coordinates: t
  107. }, e, n)
  108. }
  109. function c(t, e, n) {
  110. return void 0 === n && (n = {}), f(t.map((function (t) {
  111. return l(t, e)
  112. })), n)
  113. }
  114. function h(t, e, n) {
  115. if (void 0 === n && (n = {}), t.length < 2) throw new Error("coordinates must be an array of two or more positions");
  116. return o({
  117. type: "LineString",
  118. coordinates: t
  119. }, e, n)
  120. }
  121. function p(t, e, n) {
  122. return void 0 === n && (n = {}), f(t.map((function (t) {
  123. return h(t, e)
  124. })), n)
  125. }
  126. function f(t, e) {
  127. void 0 === e && (e = {});
  128. var n = {
  129. type: "FeatureCollection"
  130. };
  131. return e.id && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.features = t, n
  132. }
  133. function g(t, e, n) {
  134. return void 0 === n && (n = {}), o({
  135. type: "MultiLineString",
  136. coordinates: t
  137. }, e, n)
  138. }
  139. function d(t, e, n) {
  140. return void 0 === n && (n = {}), o({
  141. type: "MultiPoint",
  142. coordinates: t
  143. }, e, n)
  144. }
  145. function y(t, e, n) {
  146. return void 0 === n && (n = {}), o({
  147. type: "MultiPolygon",
  148. coordinates: t
  149. }, e, n)
  150. }
  151. function v(t, e, n) {
  152. return void 0 === n && (n = {}), o({
  153. type: "GeometryCollection",
  154. geometries: t
  155. }, e, n)
  156. }
  157. function _(t, e) {
  158. if (void 0 === e && (e = 0), e && !(e >= 0)) throw new Error("precision must be a positive number");
  159. var n = Math.pow(10, e || 0);
  160. return Math.round(t * n) / n
  161. }
  162. function m(t, e) {
  163. void 0 === e && (e = "kilometers");
  164. var r = n[e];
  165. if (!r) throw new Error(e + " units is invalid");
  166. return t * r
  167. }
  168. function x(t, e) {
  169. void 0 === e && (e = "kilometers");
  170. var r = n[e];
  171. if (!r) throw new Error(e + " units is invalid");
  172. return t / r
  173. }
  174. function E(t, e) {
  175. return w(x(t, e))
  176. }
  177. function b(t) {
  178. var e = t % 360;
  179. return e < 0 && (e += 360), e
  180. }
  181. function w(t) {
  182. return 180 * (t % (2 * Math.PI)) / Math.PI
  183. }
  184. function I(t) {
  185. return t % 360 * Math.PI / 180
  186. }
  187. function N(t, e, n) {
  188. if (void 0 === e && (e = "kilometers"), void 0 === n && (n = "kilometers"), !(t >= 0)) throw new Error("length must be a positive number");
  189. return m(x(t, e), n)
  190. }
  191. function S(t, e, n) {
  192. if (void 0 === e && (e = "meters"), void 0 === n && (n = "kilometers"), !(t >= 0)) throw new Error("area must be a positive number");
  193. var r = i[e];
  194. if (!r) throw new Error("invalid original units");
  195. var o = i[n];
  196. if (!o) throw new Error("invalid final units");
  197. return t / r * o
  198. }
  199. function C(t) {
  200. return !isNaN(t) && null !== t && !Array.isArray(t)
  201. }
  202. function P(t) {
  203. return !!t && t.constructor === Object
  204. }
  205. function M(t) {
  206. if (!t) throw new Error("bbox is required");
  207. if (!Array.isArray(t)) throw new Error("bbox must be an Array");
  208. if (4 !== t.length && 6 !== t.length) throw new Error("bbox must be an Array of 4 or 6 numbers");
  209. t.forEach((function (t) {
  210. if (!C(t)) throw new Error("bbox must only contain numbers")
  211. }))
  212. }
  213. function L(t) {
  214. if (!t) throw new Error("id is required");
  215. if (-1 === ["string", "number"].indexOf(typeof t)) throw new Error("id must be a number or a string")
  216. }
  217. var O = Object.freeze({
  218. __proto__: null,
  219. earthRadius: e,
  220. factors: n,
  221. unitsFactors: r,
  222. areaFactors: i,
  223. feature: o,
  224. geometry: s,
  225. point: a,
  226. points: u,
  227. polygon: l,
  228. polygons: c,
  229. lineString: h,
  230. lineStrings: p,
  231. featureCollection: f,
  232. multiLineString: g,
  233. multiPoint: d,
  234. multiPolygon: y,
  235. geometryCollection: v,
  236. round: _,
  237. radiansToLength: m,
  238. lengthToRadians: x,
  239. lengthToDegrees: E,
  240. bearingToAzimuth: b,
  241. radiansToDegrees: w,
  242. degreesToRadians: I,
  243. convertLength: N,
  244. convertArea: S,
  245. isNumber: C,
  246. isObject: P,
  247. validateBBox: M,
  248. validateId: L
  249. });
  250. function R(t, e, n) {
  251. if (null !== t)
  252. for (var r, i, o, s, a, u, l, c, h = 0, p = 0, f = t.type, g = "FeatureCollection" === f, d = "Feature" === f, y = g ? t.features.length : 1, v = 0; v < y; v++) {
  253. a = (c = !!(l = g ? t.features[v].geometry : d ? t.geometry : t) && "GeometryCollection" === l.type) ? l.geometries.length : 1;
  254. for (var _ = 0; _ < a; _++) {
  255. var m = 0,
  256. x = 0;
  257. if (null !== (s = c ? l.geometries[_] : l)) {
  258. u = s.coordinates;
  259. var E = s.type;
  260. switch (h = !n || "Polygon" !== E && "MultiPolygon" !== E ? 0 : 1, E) {
  261. case null:
  262. break;
  263. case "Point":
  264. if (!1 === e(u, p, v, m, x)) return !1;
  265. p++, m++;
  266. break;
  267. case "LineString":
  268. case "MultiPoint":
  269. for (r = 0; r < u.length; r++) {
  270. if (!1 === e(u[r], p, v, m, x)) return !1;
  271. p++, "MultiPoint" === E && m++
  272. }
  273. "LineString" === E && m++;
  274. break;
  275. case "Polygon":
  276. case "MultiLineString":
  277. for (r = 0; r < u.length; r++) {
  278. for (i = 0; i < u[r].length - h; i++) {
  279. if (!1 === e(u[r][i], p, v, m, x)) return !1;
  280. p++
  281. }
  282. "MultiLineString" === E && m++, "Polygon" === E && x++
  283. }
  284. "Polygon" === E && m++;
  285. break;
  286. case "MultiPolygon":
  287. for (r = 0; r < u.length; r++) {
  288. for (x = 0, i = 0; i < u[r].length; i++) {
  289. for (o = 0; o < u[r][i].length - h; o++) {
  290. if (!1 === e(u[r][i][o], p, v, m, x)) return !1;
  291. p++
  292. }
  293. x++
  294. }
  295. m++
  296. }
  297. break;
  298. case "GeometryCollection":
  299. for (r = 0; r < s.geometries.length; r++)
  300. if (!1 === R(s.geometries[r], e, n)) return !1;
  301. break;
  302. default:
  303. throw new Error("Unknown Geometry Type")
  304. }
  305. }
  306. }
  307. }
  308. }
  309. function T(t, e, n, r) {
  310. var i = n;
  311. return R(t, (function (t, r, o, s, a) {
  312. i = 0 === r && void 0 === n ? t : e(i, t, r, o, s, a)
  313. }), r), i
  314. }
  315. function A(t, e) {
  316. var n;
  317. switch (t.type) {
  318. case "FeatureCollection":
  319. for (n = 0; n < t.features.length && !1 !== e(t.features[n].properties, n); n++);
  320. break;
  321. case "Feature":
  322. e(t.properties, 0)
  323. }
  324. }
  325. function D(t, e, n) {
  326. var r = n;
  327. return A(t, (function (t, i) {
  328. r = 0 === i && void 0 === n ? t : e(r, t, i)
  329. })), r
  330. }
  331. function F(t, e) {
  332. if ("Feature" === t.type) e(t, 0);
  333. else if ("FeatureCollection" === t.type)
  334. for (var n = 0; n < t.features.length && !1 !== e(t.features[n], n); n++);
  335. }
  336. function k(t, e, n) {
  337. var r = n;
  338. return F(t, (function (t, i) {
  339. r = 0 === i && void 0 === n ? t : e(r, t, i)
  340. })), r
  341. }
  342. function G(t) {
  343. var e = [];
  344. return R(t, (function (t) {
  345. e.push(t)
  346. })), e
  347. }
  348. function q(t, e) {
  349. var n, r, i, o, s, a, u, l, c, h, p = 0,
  350. f = "FeatureCollection" === t.type,
  351. g = "Feature" === t.type,
  352. d = f ? t.features.length : 1;
  353. for (n = 0; n < d; n++) {
  354. for (a = f ? t.features[n].geometry : g ? t.geometry : t, l = f ? t.features[n].properties : g ? t.properties : {}, c = f ? t.features[n].bbox : g ? t.bbox : void 0, h = f ? t.features[n].id : g ? t.id : void 0, s = (u = !!a && "GeometryCollection" === a.type) ? a.geometries.length : 1, i = 0; i < s; i++)
  355. if (null !== (o = u ? a.geometries[i] : a)) switch (o.type) {
  356. case "Point":
  357. case "LineString":
  358. case "MultiPoint":
  359. case "Polygon":
  360. case "MultiLineString":
  361. case "MultiPolygon":
  362. if (!1 === e(o, p, l, c, h)) return !1;
  363. break;
  364. case "GeometryCollection":
  365. for (r = 0; r < o.geometries.length; r++)
  366. if (!1 === e(o.geometries[r], p, l, c, h)) return !1;
  367. break;
  368. default:
  369. throw new Error("Unknown Geometry Type")
  370. } else if (!1 === e(null, p, l, c, h)) return !1;
  371. p++
  372. }
  373. }
  374. function B(t, e, n) {
  375. var r = n;
  376. return q(t, (function (t, i, o, s, a) {
  377. r = 0 === i && void 0 === n ? t : e(r, t, i, o, s, a)
  378. })), r
  379. }
  380. function z(t, e) {
  381. q(t, (function (t, n, r, i, s) {
  382. var a, u = null === t ? null : t.type;
  383. switch (u) {
  384. case null:
  385. case "Point":
  386. case "LineString":
  387. case "Polygon":
  388. return !1 !== e(o(t, r, {
  389. bbox: i,
  390. id: s
  391. }), n, 0) && void 0
  392. }
  393. switch (u) {
  394. case "MultiPoint":
  395. a = "Point";
  396. break;
  397. case "MultiLineString":
  398. a = "LineString";
  399. break;
  400. case "MultiPolygon":
  401. a = "Polygon"
  402. }
  403. for (var l = 0; l < t.coordinates.length; l++) {
  404. var c = t.coordinates[l];
  405. if (!1 === e(o({
  406. type: a,
  407. coordinates: c
  408. }, r), n, l)) return !1
  409. }
  410. }))
  411. }
  412. function j(t, e, n) {
  413. var r = n;
  414. return z(t, (function (t, i, o) {
  415. r = 0 === i && 0 === o && void 0 === n ? t : e(r, t, i, o)
  416. })), r
  417. }
  418. function U(t, e) {
  419. z(t, (function (t, n, r) {
  420. var i = 0;
  421. if (t.geometry) {
  422. var o = t.geometry.type;
  423. if ("Point" !== o && "MultiPoint" !== o) {
  424. var s, a = 0,
  425. u = 0,
  426. l = 0;
  427. return !1 !== R(t, (function (o, c, p, f, g) {
  428. if (void 0 === s || n > a || f > u || g > l) return s = o, a = n, u = f, l = g, void(i = 0);
  429. var d = h([s, o], t.properties);
  430. if (!1 === e(d, n, r, g, i)) return !1;
  431. i++, s = o
  432. })) && void 0
  433. }
  434. }
  435. }))
  436. }
  437. function V(t, e, n) {
  438. var r = n,
  439. i = !1;
  440. return U(t, (function (t, o, s, a, u) {
  441. r = !1 === i && void 0 === n ? t : e(r, t, o, s, a, u), i = !0
  442. })), r
  443. }
  444. function X(t, e) {
  445. if (!t) throw new Error("geojson is required");
  446. z(t, (function (t, n, r) {
  447. if (null !== t.geometry) {
  448. var i = t.geometry.type,
  449. o = t.geometry.coordinates;
  450. switch (i) {
  451. case "LineString":
  452. if (!1 === e(t, n, r, 0, 0)) return !1;
  453. break;
  454. case "Polygon":
  455. for (var s = 0; s < o.length; s++)
  456. if (!1 === e(h(o[s], t.properties), n, r, s)) return !1
  457. }
  458. }
  459. }))
  460. }
  461. function Y(t, e, n) {
  462. var r = n;
  463. return X(t, (function (t, i, o, s) {
  464. r = 0 === i && void 0 === n ? t : e(r, t, i, o, s)
  465. })), r
  466. }
  467. function H(t, e) {
  468. if (!P(e = e || {})) throw new Error("options is invalid");
  469. var n, r = e.featureIndex || 0,
  470. i = e.multiFeatureIndex || 0,
  471. o = e.geometryIndex || 0,
  472. s = e.segmentIndex || 0,
  473. a = e.properties;
  474. switch (t.type) {
  475. case "FeatureCollection":
  476. r < 0 && (r = t.features.length + r), a = a || t.features[r].properties, n = t.features[r].geometry;
  477. break;
  478. case "Feature":
  479. a = a || t.properties, n = t.geometry;
  480. break;
  481. case "Point":
  482. case "MultiPoint":
  483. return null;
  484. case "LineString":
  485. case "Polygon":
  486. case "MultiLineString":
  487. case "MultiPolygon":
  488. n = t;
  489. break;
  490. default:
  491. throw new Error("geojson is invalid")
  492. }
  493. if (null === n) return null;
  494. var u = n.coordinates;
  495. switch (n.type) {
  496. case "Point":
  497. case "MultiPoint":
  498. return null;
  499. case "LineString":
  500. return s < 0 && (s = u.length + s - 1), h([u[s], u[s + 1]], a, e);
  501. case "Polygon":
  502. return o < 0 && (o = u.length + o), s < 0 && (s = u[o].length + s - 1), h([u[o][s], u[o][s + 1]], a, e);
  503. case "MultiLineString":
  504. return i < 0 && (i = u.length + i), s < 0 && (s = u[i].length + s - 1), h([u[i][s], u[i][s + 1]], a, e);
  505. case "MultiPolygon":
  506. return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), s < 0 && (s = u[i][o].length - s - 1), h([u[i][o][s], u[i][o][s + 1]], a, e)
  507. }
  508. throw new Error("geojson is invalid")
  509. }
  510. function W(t, e) {
  511. if (!P(e = e || {})) throw new Error("options is invalid");
  512. var n, r = e.featureIndex || 0,
  513. i = e.multiFeatureIndex || 0,
  514. o = e.geometryIndex || 0,
  515. s = e.coordIndex || 0,
  516. u = e.properties;
  517. switch (t.type) {
  518. case "FeatureCollection":
  519. r < 0 && (r = t.features.length + r), u = u || t.features[r].properties, n = t.features[r].geometry;
  520. break;
  521. case "Feature":
  522. u = u || t.properties, n = t.geometry;
  523. break;
  524. case "Point":
  525. case "MultiPoint":
  526. return null;
  527. case "LineString":
  528. case "Polygon":
  529. case "MultiLineString":
  530. case "MultiPolygon":
  531. n = t;
  532. break;
  533. default:
  534. throw new Error("geojson is invalid")
  535. }
  536. if (null === n) return null;
  537. var l = n.coordinates;
  538. switch (n.type) {
  539. case "Point":
  540. return a(l, u, e);
  541. case "MultiPoint":
  542. return i < 0 && (i = l.length + i), a(l[i], u, e);
  543. case "LineString":
  544. return s < 0 && (s = l.length + s), a(l[s], u, e);
  545. case "Polygon":
  546. return o < 0 && (o = l.length + o), s < 0 && (s = l[o].length + s), a(l[o][s], u, e);
  547. case "MultiLineString":
  548. return i < 0 && (i = l.length + i), s < 0 && (s = l[i].length + s), a(l[i][s], u, e);
  549. case "MultiPolygon":
  550. return i < 0 && (i = l.length + i), o < 0 && (o = l[i].length + o), s < 0 && (s = l[i][o].length - s), a(l[i][o][s], u, e)
  551. }
  552. throw new Error("geojson is invalid")
  553. }
  554. var J = Object.freeze({
  555. __proto__: null,
  556. coordAll: G,
  557. coordEach: R,
  558. coordReduce: T,
  559. featureEach: F,
  560. featureReduce: k,
  561. findPoint: W,
  562. findSegment: H,
  563. flattenEach: z,
  564. flattenReduce: j,
  565. geomEach: q,
  566. geomReduce: B,
  567. lineEach: X,
  568. lineReduce: Y,
  569. propEach: A,
  570. propReduce: D,
  571. segmentEach: U,
  572. segmentReduce: V
  573. });
  574. function Z(t) {
  575. var e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
  576. return R(t, (function (t) {
  577. e[0] > t[0] && (e[0] = t[0]), e[1] > t[1] && (e[1] = t[1]), e[2] < t[0] && (e[2] = t[0]), e[3] < t[1] && (e[3] = t[1])
  578. })), e
  579. }
  580. function K(t) {
  581. if (!t) throw new Error("coord is required");
  582. if (!Array.isArray(t)) {
  583. if ("Feature" === t.type && null !== t.geometry && "Point" === t.geometry.type) return t.geometry.coordinates;
  584. if ("Point" === t.type) return t.coordinates
  585. }
  586. if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1])) return t;
  587. throw new Error("coord must be GeoJSON Point or an Array of numbers")
  588. }
  589. function Q(t) {
  590. if (Array.isArray(t)) return t;
  591. if ("Feature" === t.type) {
  592. if (null !== t.geometry) return t.geometry.coordinates
  593. } else if (t.coordinates) return t.coordinates;
  594. throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")
  595. }
  596. function $(t) {
  597. if (t.length > 1 && C(t[0]) && C(t[1])) return !0;
  598. if (Array.isArray(t[0]) && t[0].length) return $(t[0]);
  599. throw new Error("coordinates must only contain numbers")
  600. }
  601. function tt(t, e, n) {
  602. if (!e || !n) throw new Error("type and name required");
  603. if (!t || t.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + t.type)
  604. }
  605. function et(t, e, n) {
  606. if (!t) throw new Error("No feature passed");
  607. if (!n) throw new Error(".featureOf() requires a name");
  608. if (!t || "Feature" !== t.type || !t.geometry) throw new Error("Invalid input to " + n + ", Feature with geometry required");
  609. if (!t.geometry || t.geometry.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + t.geometry.type)
  610. }
  611. function nt(t, e, n) {
  612. if (!t) throw new Error("No featureCollection passed");
  613. if (!n) throw new Error(".collectionOf() requires a name");
  614. if (!t || "FeatureCollection" !== t.type) throw new Error("Invalid input to " + n + ", FeatureCollection required");
  615. for (var r = 0, i = t.features; r < i.length; r++) {
  616. var o = i[r];
  617. if (!o || "Feature" !== o.type || !o.geometry) throw new Error("Invalid input to " + n + ", Feature with geometry required");
  618. if (!o.geometry || o.geometry.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + o.geometry.type)
  619. }
  620. }
  621. function rt(t) {
  622. return "Feature" === t.type ? t.geometry : t
  623. }
  624. function it(t, e) {
  625. return "FeatureCollection" === t.type ? "FeatureCollection" : "GeometryCollection" === t.type ? "GeometryCollection" : "Feature" === t.type && null !== t.geometry ? t.geometry.type : t.type
  626. }
  627. Z.default = Z;
  628. var ot = Object.freeze({
  629. __proto__: null,
  630. getCoord: K,
  631. getCoords: Q,
  632. containsNumber: $,
  633. geojsonType: tt,
  634. featureOf: et,
  635. collectionOf: nt,
  636. getGeom: rt,
  637. getType: it
  638. }),
  639. st = Object.getOwnPropertySymbols,
  640. at = Object.prototype.hasOwnProperty,
  641. ut = Object.prototype.propertyIsEnumerable;
  642. /*
  643. object-assign
  644. (c) Sindre Sorhus
  645. @license MIT
  646. */
  647. function lt(t) {
  648. if (null == t) throw new TypeError("Object.assign cannot be called with null or undefined");
  649. return Object(t)
  650. }
  651. var ct = function () {
  652. try {
  653. if (!Object.assign) return !1;
  654. var t = new String("abc");
  655. if (t[5] = "de", "5" === Object.getOwnPropertyNames(t)[0]) return !1;
  656. for (var e = {}, n = 0; n < 10; n++) e["_" + String.fromCharCode(n)] = n;
  657. if ("0123456789" !== Object.getOwnPropertyNames(e).map((function (t) {
  658. return e[t]
  659. })).join("")) return !1;
  660. var r = {};
  661. return "abcdefghijklmnopqrst".split("").forEach((function (t) {
  662. r[t] = t
  663. })), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, r)).join("")
  664. } catch (t) {
  665. return !1
  666. }
  667. }() ? Object.assign : function (t, e) {
  668. for (var n, r, i = lt(t), o = 1; o < arguments.length; o++) {
  669. for (var s in n = Object(arguments[o])) at.call(n, s) && (i[s] = n[s]);
  670. if (st) {
  671. r = st(n);
  672. for (var a = 0; a < r.length; a++) ut.call(n, r[a]) && (i[r[a]] = n[r[a]])
  673. }
  674. }
  675. return i
  676. },
  677. ht = {
  678. successCallback: null,
  679. verbose: !1
  680. },
  681. pt = {};
  682. /**
  683. * @license GNU Affero General Public License.
  684. * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
  685. * v. 1.2.0
  686. * https://github.com/RaumZeit/MarchingSquares.js
  687. *
  688. * MarchingSquaresJS is free software: you can redistribute it and/or modify
  689. * it under the terms of the GNU Affero General Public License as published by
  690. * the Free Software Foundation, either version 3 of the License, or
  691. * (at your option) any later version.
  692. *
  693. * MarchingSquaresJS is distributed in the hope that it will be useful,
  694. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  695. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  696. * GNU Affero General Public License for more details.
  697. *
  698. * As additional permission under GNU Affero General Public License version 3
  699. * section 7, third-party projects (personal or commercial) may distribute,
  700. * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
  701. * requirement that said third-party project for that reason alone becomes
  702. * subject to any requirement of the GNU Affero General Public License version 3.
  703. * Any modifications to MarchingSquaresJS, however, must be shared with the public
  704. * and made available.
  705. *
  706. * In summary this:
  707. * - allows you to use MarchingSquaresJS at no cost
  708. * - allows you to use MarchingSquaresJS for both personal and commercial purposes
  709. * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
  710. * license as long as this license notice is included
  711. * - enables you to keep the source code of your program that uses MarchingSquaresJS
  712. * undisclosed
  713. * - forces you to share any modifications you have made to MarchingSquaresJS,
  714. * e.g. bug-fixes
  715. *
  716. * You should have received a copy of the GNU Affero General Public License
  717. * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
  718. */
  719. function ft(t, e, n) {
  720. n = n || {};
  721. for (var r = Object.keys(ht), i = 0; i < r.length; i++) {
  722. var o = r[i],
  723. s = n[o];
  724. s = null != s ? s : ht[o], pt[o] = s
  725. }
  726. pt.verbose && console.log("MarchingSquaresJS-isoContours: computing isocontour for " + e);
  727. var a = function (t) {
  728. var e = [],
  729. n = 0,
  730. r = 1e-7;
  731. return t.cells.forEach((function (i, o) {
  732. i.forEach((function (i, s) {
  733. if (void 0 !== i && (5 !== (f = i).cval && 10 !== f.cval) && !dt(i)) {
  734. var a = function (t, e, n) {
  735. var r, i, o = t.length,
  736. s = [],
  737. a = [0, 0, 1, 1, 0, 0, 0, 0, -1, 0, 1, 1, -1, 0, -1, 0],
  738. u = [0, -1, 0, 0, 1, 1, 1, 1, 0, -1, 0, 0, 0, -1, 0, 0],
  739. l = ["none", "left", "bottom", "left", "right", "none", "bottom", "left", "top", "top", "none", "top", "right", "right", "bottom", "none"],
  740. c = ["none", "bottom", "right", "right", "top", "top", "top", "top", "left", "bottom", "right", "right", "left", "bottom", "left", "none"],
  741. h = t[e][n],
  742. p = h.cval,
  743. f = l[p],
  744. g = vt(h, f);
  745. s.push([n + g[0], e + g[1]]), f = c[p], g = vt(h, f), s.push([n + g[0], e + g[1]]), yt(h);
  746. var d = n + a[p],
  747. y = e + u[p],
  748. v = p;
  749. for (; d >= 0 && y >= 0 && y < o && (d != n || y != e) && void 0 !== (h = t[y][d]);) {
  750. if (0 === (p = h.cval) || 15 === p) return {
  751. path: s,
  752. info: "mergeable"
  753. };
  754. f = c[p], r = a[p], i = u[p], 5 !== p && 10 !== p || (5 === p ? h.flipped ? -1 === u[v] ? (f = "left", r = -1, i = 0) : (f = "right", r = 1, i = 0) : -1 === a[v] && (f = "bottom", r = 0, i = -1) : 10 === p && (h.flipped ? -1 === a[v] ? (f = "top", r = 0, i = 1) : (f = "bottom", r = 0, i = -1) : 1 === u[v] && (f = "left", r = -1, i = 0))), g = vt(h, f), s.push([d + g[0], y + g[1]]), yt(h), d += r, y += i, v = p
  755. }
  756. return {
  757. path: s,
  758. info: "closed"
  759. }
  760. }(t.cells, o, s),
  761. u = !1;
  762. if ("mergeable" === a.info)
  763. for (var l = a.path[a.path.length - 1][0], c = a.path[a.path.length - 1][1], h = n - 1; h >= 0; h--)
  764. if (Math.abs(e[h][0][0] - l) <= r && Math.abs(e[h][0][1] - c) <= r) {
  765. for (var p = a.path.length - 2; p >= 0; --p) e[h].unshift(a.path[p]);
  766. u = !0;
  767. break
  768. } u || (e[n++] = a.path)
  769. }
  770. var f
  771. }))
  772. })), e
  773. }(function (t, e) {
  774. for (var n = t.length - 1, r = t[0].length - 1, i = {
  775. rows: n,
  776. cols: r,
  777. cells: []
  778. }, o = 0; o < n; ++o) {
  779. i.cells[o] = [];
  780. for (var s = 0; s < r; ++s) {
  781. var a = 0,
  782. u = t[o + 1][s],
  783. l = t[o + 1][s + 1],
  784. c = t[o][s + 1],
  785. h = t[o][s];
  786. if (!(isNaN(u) || isNaN(l) || isNaN(c) || isNaN(h))) {
  787. a |= u >= e ? 8 : 0, a |= l >= e ? 4 : 0, a |= c >= e ? 2 : 0;
  788. var p, f, g, d, y = !1;
  789. if (5 === (a |= h >= e ? 1 : 0) || 10 === a) {
  790. var v = (u + l + c + h) / 4;
  791. 5 === a && v < e ? (a = 10, y = !0) : 10 === a && v < e && (a = 5, y = !0)
  792. }
  793. if (0 !== a && 15 !== a) p = f = g = d = .5, 1 === a ? (g = 1 - gt(e, u, h), f = 1 - gt(e, c, h)) : 2 === a ? (f = gt(e, h, c), d = 1 - gt(e, l, c)) : 3 === a ? (g = 1 - gt(e, u, h), d = 1 - gt(e, l, c)) : 4 === a ? (p = gt(e, u, l), d = gt(e, c, l)) : 5 === a ? (p = gt(e, u, l), d = gt(e, c, l), f = 1 - gt(e, c, h), g = 1 - gt(e, u, h)) : 6 === a ? (f = gt(e, h, c), p = gt(e, u, l)) : 7 === a ? (g = 1 - gt(e, u, h), p = gt(e, u, l)) : 8 === a ? (g = gt(e, h, u), p = 1 - gt(e, l, u)) : 9 === a ? (f = 1 - gt(e, c, h), p = 1 - gt(e, l, u)) : 10 === a ? (p = 1 - gt(e, l, u), d = 1 - gt(e, l, c), f = gt(e, h, c), g = gt(e, h, u)) : 11 === a ? (p = 1 - gt(e, l, u), d = 1 - gt(e, l, c)) : 12 === a ? (g = gt(e, h, u), d = gt(e, c, l)) : 13 === a ? (f = 1 - gt(e, c, h), d = gt(e, c, l)) : 14 === a ? (g = gt(e, h, u), f = gt(e, h, c)) : console.log("MarchingSquaresJS-isoContours: Illegal cval detected: " + a), i.cells[o][s] = {
  794. cval: a,
  795. flipped: y,
  796. top: p,
  797. right: d,
  798. bottom: f,
  799. left: g
  800. }
  801. }
  802. }
  803. }
  804. return i
  805. }(t, e));
  806. return "function" == typeof pt.successCallback && pt.successCallback(a), a
  807. }
  808. function gt(t, e, n) {
  809. return (t - e) / (n - e)
  810. }
  811. function dt(t) {
  812. return 0 === t.cval || 15 === t.cval
  813. }
  814. function yt(t) {
  815. dt(t) || 5 === t.cval || 10 === t.cval || (t.cval = 15)
  816. }
  817. function vt(t, e) {
  818. return "top" === e ? [t.top, 1] : "bottom" === e ? [t.bottom, 0] : "right" === e ? [1, t.right] : "left" === e ? [0, t.left] : void 0
  819. }
  820. function _t(t, e) {
  821. if (!P(e = e || {})) throw new Error("options is invalid");
  822. var n = e.zProperty || "elevation",
  823. r = e.flip,
  824. i = e.flags;
  825. nt(t, "Point", "input must contain Points");
  826. for (var o = function (t, e) {
  827. var n = {};
  828. return F(t, (function (t) {
  829. var e = Q(t)[1];
  830. n[e] || (n[e] = []), n[e].push(t)
  831. })), Object.keys(n).map((function (t) {
  832. return n[t].sort((function (t, e) {
  833. return Q(t)[0] - Q(e)[0]
  834. }))
  835. })).sort((function (t, n) {
  836. return e ? Q(t[0])[1] - Q(n[0])[1] : Q(n[0])[1] - Q(t[0])[1]
  837. }))
  838. }(t, r), s = [], a = 0; a < o.length; a++) {
  839. for (var u = o[a], l = [], c = 0; c < u.length; c++) {
  840. var h = u[c];
  841. h.properties[n] ? l.push(h.properties[n]) : l.push(0), !0 === i && (h.properties.matrixPosition = [a, c])
  842. }
  843. s.push(l)
  844. }
  845. return s
  846. }
  847. var mt = Et,
  848. xt = Et;
  849. function Et(t, e, n, r, i) {
  850. bt(t, e, n || 0, r || t.length - 1, i || It)
  851. }
  852. function bt(t, e, n, r, i) {
  853. for (; r > n;) {
  854. if (r - n > 600) {
  855. var o = r - n + 1,
  856. s = e - n + 1,
  857. a = Math.log(o),
  858. u = .5 * Math.exp(2 * a / 3),
  859. l = .5 * Math.sqrt(a * u * (o - u) / o) * (s - o / 2 < 0 ? -1 : 1);
  860. bt(t, e, Math.max(n, Math.floor(e - s * u / o + l)), Math.min(r, Math.floor(e + (o - s) * u / o + l)), i)
  861. }
  862. var c = t[e],
  863. h = n,
  864. p = r;
  865. for (wt(t, n, e), i(t[r], c) > 0 && wt(t, n, r); h < p;) {
  866. for (wt(t, h, p), h++, p--; i(t[h], c) < 0;) h++;
  867. for (; i(t[p], c) > 0;) p--
  868. }
  869. 0 === i(t[n], c) ? wt(t, n, p) : wt(t, ++p, r), p <= e && (n = p + 1), e <= p && (r = p - 1)
  870. }
  871. }
  872. function wt(t, e, n) {
  873. var r = t[e];
  874. t[e] = t[n], t[n] = r
  875. }
  876. function It(t, e) {
  877. return t < e ? -1 : t > e ? 1 : 0
  878. }
  879. mt.default = xt;
  880. var Nt = Ct,
  881. St = Ct;
  882. function Ct(t, e) {
  883. if (!(this instanceof Ct)) return new Ct(t, e);
  884. this._maxEntries = Math.max(4, t || 9), this._minEntries = Math.max(2, Math.ceil(.4 * this._maxEntries)), e && this._initFormat(e), this.clear()
  885. }
  886. function Pt(t, e, n) {
  887. if (!n) return e.indexOf(t);
  888. for (var r = 0; r < e.length; r++)
  889. if (n(t, e[r])) return r;
  890. return -1
  891. }
  892. function Mt(t, e) {
  893. Lt(t, 0, t.children.length, e, t)
  894. }
  895. function Lt(t, e, n, r, i) {
  896. i || (i = Gt(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
  897. for (var o, s = e; s < n; s++) o = t.children[s], Ot(i, t.leaf ? r(o) : o);
  898. return i
  899. }
  900. function Ot(t, e) {
  901. return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t
  902. }
  903. function Rt(t, e) {
  904. return t.minX - e.minX
  905. }
  906. function Tt(t, e) {
  907. return t.minY - e.minY
  908. }
  909. function At(t) {
  910. return (t.maxX - t.minX) * (t.maxY - t.minY)
  911. }
  912. function Dt(t) {
  913. return t.maxX - t.minX + (t.maxY - t.minY)
  914. }
  915. function Ft(t, e) {
  916. return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY
  917. }
  918. function kt(t, e) {
  919. return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY
  920. }
  921. function Gt(t) {
  922. return {
  923. children: t,
  924. height: 1,
  925. leaf: !0,
  926. minX: 1 / 0,
  927. minY: 1 / 0,
  928. maxX: -1 / 0,
  929. maxY: -1 / 0
  930. }
  931. }
  932. function qt(t, e, n, r, i) {
  933. for (var o, s = [e, n]; s.length;)(n = s.pop()) - (e = s.pop()) <= r || (o = e + Math.ceil((n - e) / r / 2) * r, mt(t, o, e, n, i), s.push(e, o, o, n))
  934. }
  935. function Bt(t) {
  936. var e = {
  937. exports: {}
  938. };
  939. return t(e, e.exports), e.exports
  940. }
  941. Ct.prototype = {
  942. all: function () {
  943. return this._all(this.data, [])
  944. },
  945. search: function (t) {
  946. var e = this.data,
  947. n = [],
  948. r = this.toBBox;
  949. if (!kt(t, e)) return n;
  950. for (var i, o, s, a, u = []; e;) {
  951. for (i = 0, o = e.children.length; i < o; i++) s = e.children[i], kt(t, a = e.leaf ? r(s) : s) && (e.leaf ? n.push(s) : Ft(t, a) ? this._all(s, n) : u.push(s));
  952. e = u.pop()
  953. }
  954. return n
  955. },
  956. collides: function (t) {
  957. var e = this.data,
  958. n = this.toBBox;
  959. if (!kt(t, e)) return !1;
  960. for (var r, i, o, s, a = []; e;) {
  961. for (r = 0, i = e.children.length; r < i; r++)
  962. if (o = e.children[r], kt(t, s = e.leaf ? n(o) : o)) {
  963. if (e.leaf || Ft(t, s)) return !0;
  964. a.push(o)
  965. } e = a.pop()
  966. }
  967. return !1
  968. },
  969. load: function (t) {
  970. if (!t || !t.length) return this;
  971. if (t.length < this._minEntries) {
  972. for (var e = 0, n = t.length; e < n; e++) this.insert(t[e]);
  973. return this
  974. }
  975. var r = this._build(t.slice(), 0, t.length - 1, 0);
  976. if (this.data.children.length)
  977. if (this.data.height === r.height) this._splitRoot(this.data, r);
  978. else {
  979. if (this.data.height < r.height) {
  980. var i = this.data;
  981. this.data = r, r = i
  982. }
  983. this._insert(r, this.data.height - r.height - 1, !0)
  984. }
  985. else this.data = r;
  986. return this
  987. },
  988. insert: function (t) {
  989. return t && this._insert(t, this.data.height - 1), this
  990. },
  991. clear: function () {
  992. return this.data = Gt([]), this
  993. },
  994. remove: function (t, e) {
  995. if (!t) return this;
  996. for (var n, r, i, o, s = this.data, a = this.toBBox(t), u = [], l = []; s || u.length;) {
  997. if (s || (s = u.pop(), r = u[u.length - 1], n = l.pop(), o = !0), s.leaf && -1 !== (i = Pt(t, s.children, e))) return s.children.splice(i, 1), u.push(s), this._condense(u), this;
  998. o || s.leaf || !Ft(s, a) ? r ? (n++, s = r.children[n], o = !1) : s = null : (u.push(s), l.push(n), n = 0, r = s, s = s.children[0])
  999. }
  1000. return this
  1001. },
  1002. toBBox: function (t) {
  1003. return t
  1004. },
  1005. compareMinX: Rt,
  1006. compareMinY: Tt,
  1007. toJSON: function () {
  1008. return this.data
  1009. },
  1010. fromJSON: function (t) {
  1011. return this.data = t, this
  1012. },
  1013. _all: function (t, e) {
  1014. for (var n = []; t;) t.leaf ? e.push.apply(e, t.children) : n.push.apply(n, t.children), t = n.pop();
  1015. return e
  1016. },
  1017. _build: function (t, e, n, r) {
  1018. var i, o = n - e + 1,
  1019. s = this._maxEntries;
  1020. if (o <= s) return Mt(i = Gt(t.slice(e, n + 1)), this.toBBox), i;
  1021. r || (r = Math.ceil(Math.log(o) / Math.log(s)), s = Math.ceil(o / Math.pow(s, r - 1))), (i = Gt([])).leaf = !1, i.height = r;
  1022. var a, u, l, c, h = Math.ceil(o / s),
  1023. p = h * Math.ceil(Math.sqrt(s));
  1024. for (qt(t, e, n, p, this.compareMinX), a = e; a <= n; a += p)
  1025. for (qt(t, a, l = Math.min(a + p - 1, n), h, this.compareMinY), u = a; u <= l; u += h) c = Math.min(u + h - 1, l), i.children.push(this._build(t, u, c, r - 1));
  1026. return Mt(i, this.toBBox), i
  1027. },
  1028. _chooseSubtree: function (t, e, n, r) {
  1029. for (var i, o, s, a, u, l, c, h, p, f; r.push(e), !e.leaf && r.length - 1 !== n;) {
  1030. for (c = h = 1 / 0, i = 0, o = e.children.length; i < o; i++) u = At(s = e.children[i]), p = t, f = s, (l = (Math.max(f.maxX, p.maxX) - Math.min(f.minX, p.minX)) * (Math.max(f.maxY, p.maxY) - Math.min(f.minY, p.minY)) - u) < h ? (h = l, c = u < c ? u : c, a = s) : l === h && u < c && (c = u, a = s);
  1031. e = a || e.children[0]
  1032. }
  1033. return e
  1034. },
  1035. _insert: function (t, e, n) {
  1036. var r = this.toBBox,
  1037. i = n ? t : r(t),
  1038. o = [],
  1039. s = this._chooseSubtree(i, this.data, e, o);
  1040. for (s.children.push(t), Ot(s, i); e >= 0 && o[e].children.length > this._maxEntries;) this._split(o, e), e--;
  1041. this._adjustParentBBoxes(i, o, e)
  1042. },
  1043. _split: function (t, e) {
  1044. var n = t[e],
  1045. r = n.children.length,
  1046. i = this._minEntries;
  1047. this._chooseSplitAxis(n, i, r);
  1048. var o = this._chooseSplitIndex(n, i, r),
  1049. s = Gt(n.children.splice(o, n.children.length - o));
  1050. s.height = n.height, s.leaf = n.leaf, Mt(n, this.toBBox), Mt(s, this.toBBox), e ? t[e - 1].children.push(s) : this._splitRoot(n, s)
  1051. },
  1052. _splitRoot: function (t, e) {
  1053. this.data = Gt([t, e]), this.data.height = t.height + 1, this.data.leaf = !1, Mt(this.data, this.toBBox)
  1054. },
  1055. _chooseSplitIndex: function (t, e, n) {
  1056. var r, i, o, s, a, u, l, c, h, p, f, g, d, y;
  1057. for (u = l = 1 / 0, r = e; r <= n - e; r++) i = Lt(t, 0, r, this.toBBox), o = Lt(t, r, n, this.toBBox), h = i, p = o, f = void 0, g = void 0, d = void 0, y = void 0, f = Math.max(h.minX, p.minX), g = Math.max(h.minY, p.minY), d = Math.min(h.maxX, p.maxX), y = Math.min(h.maxY, p.maxY), s = Math.max(0, d - f) * Math.max(0, y - g), a = At(i) + At(o), s < u ? (u = s, c = r, l = a < l ? a : l) : s === u && a < l && (l = a, c = r);
  1058. return c
  1059. },
  1060. _chooseSplitAxis: function (t, e, n) {
  1061. var r = t.leaf ? this.compareMinX : Rt,
  1062. i = t.leaf ? this.compareMinY : Tt;
  1063. this._allDistMargin(t, e, n, r) < this._allDistMargin(t, e, n, i) && t.children.sort(r)
  1064. },
  1065. _allDistMargin: function (t, e, n, r) {
  1066. t.children.sort(r);
  1067. var i, o, s = this.toBBox,
  1068. a = Lt(t, 0, e, s),
  1069. u = Lt(t, n - e, n, s),
  1070. l = Dt(a) + Dt(u);
  1071. for (i = e; i < n - e; i++) o = t.children[i], Ot(a, t.leaf ? s(o) : o), l += Dt(a);
  1072. for (i = n - e - 1; i >= e; i--) o = t.children[i], Ot(u, t.leaf ? s(o) : o), l += Dt(u);
  1073. return l
  1074. },
  1075. _adjustParentBBoxes: function (t, e, n) {
  1076. for (var r = n; r >= 0; r--) Ot(e[r], t)
  1077. },
  1078. _condense: function (t) {
  1079. for (var e, n = t.length - 1; n >= 0; n--) 0 === t[n].children.length ? n > 0 ? (e = t[n - 1].children).splice(e.indexOf(t[n]), 1) : this.clear() : Mt(t[n], this.toBBox)
  1080. },
  1081. _initFormat: function (t) {
  1082. var e = ["return a", " - b", ";"];
  1083. this.compareMinX = new Function("a", "b", e.join(t[0])), this.compareMinY = new Function("a", "b", e.join(t[1])), this.toBBox = new Function("a", "return {minX: a" + t[0] + ", minY: a" + t[1] + ", maxX: a" + t[2] + ", maxY: a" + t[3] + "};")
  1084. }
  1085. }, Nt.default = St;
  1086. var zt = function (t, e, n) {
  1087. var r = t * e,
  1088. i = jt * t,
  1089. o = i - (i - t),
  1090. s = t - o,
  1091. a = jt * e,
  1092. u = a - (a - e),
  1093. l = e - u,
  1094. c = s * l - (r - o * u - s * u - o * l);
  1095. if (n) return n[0] = c, n[1] = r, n;
  1096. return [c, r]
  1097. },
  1098. jt = +(Math.pow(2, 27) + 1);
  1099. var Ut = function (t, e) {
  1100. var n = 0 | t.length,
  1101. r = 0 | e.length;
  1102. if (1 === n && 1 === r) return function (t, e) {
  1103. var n = t + e,
  1104. r = n - t,
  1105. i = t - (n - r) + (e - r);
  1106. if (i) return [i, n];
  1107. return [n]
  1108. }(t[0], e[0]);
  1109. var i, o, s = new Array(n + r),
  1110. a = 0,
  1111. u = 0,
  1112. l = 0,
  1113. c = Math.abs,
  1114. h = t[u],
  1115. p = c(h),
  1116. f = e[l],
  1117. g = c(f);
  1118. p < g ? (o = h, (u += 1) < n && (h = t[u], p = c(h))) : (o = f, (l += 1) < r && (f = e[l], g = c(f)));
  1119. u < n && p < g || l >= r ? (i = h, (u += 1) < n && (h = t[u], p = c(h))) : (i = f, (l += 1) < r && (f = e[l], g = c(f)));
  1120. var d, y, v = i + o,
  1121. _ = v - i,
  1122. m = o - _,
  1123. x = m,
  1124. E = v;
  1125. for (; u < n && l < r;) p < g ? (i = h, (u += 1) < n && (h = t[u], p = c(h))) : (i = f, (l += 1) < r && (f = e[l], g = c(f))), (m = (o = x) - (_ = (v = i + o) - i)) && (s[a++] = m), x = E - ((d = E + v) - (y = d - E)) + (v - y), E = d;
  1126. for (; u < n;)(m = (o = x) - (_ = (v = (i = h) + o) - i)) && (s[a++] = m), x = E - ((d = E + v) - (y = d - E)) + (v - y), E = d, (u += 1) < n && (h = t[u]);
  1127. for (; l < r;)(m = (o = x) - (_ = (v = (i = f) + o) - i)) && (s[a++] = m), x = E - ((d = E + v) - (y = d - E)) + (v - y), E = d, (l += 1) < r && (f = e[l]);
  1128. x && (s[a++] = x);
  1129. E && (s[a++] = E);
  1130. a || (s[a++] = 0);
  1131. return s.length = a, s
  1132. };
  1133. var Vt = function (t, e, n) {
  1134. var r = t + e,
  1135. i = r - t,
  1136. o = e - i,
  1137. s = t - (r - i);
  1138. if (n) return n[0] = s + o, n[1] = r, n;
  1139. return [s + o, r]
  1140. };
  1141. var Xt = function (t, e) {
  1142. var n = t.length;
  1143. if (1 === n) {
  1144. var r = zt(t[0], e);
  1145. return r[0] ? r : [r[1]]
  1146. }
  1147. var i = new Array(2 * n),
  1148. o = [.1, .1],
  1149. s = [.1, .1],
  1150. a = 0;
  1151. zt(t[0], e, o), o[0] && (i[a++] = o[0]);
  1152. for (var u = 1; u < n; ++u) {
  1153. zt(t[u], e, s);
  1154. var l = o[1];
  1155. Vt(l, s[0], o), o[0] && (i[a++] = o[0]);
  1156. var c = s[1],
  1157. h = o[1],
  1158. p = c + h,
  1159. f = h - (p - c);
  1160. o[1] = p, f && (i[a++] = f)
  1161. }
  1162. o[1] && (i[a++] = o[1]);
  1163. 0 === a && (i[a++] = 0);
  1164. return i.length = a, i
  1165. };
  1166. var Yt = function (t, e) {
  1167. var n = 0 | t.length,
  1168. r = 0 | e.length;
  1169. if (1 === n && 1 === r) return function (t, e) {
  1170. var n = t + e,
  1171. r = n - t,
  1172. i = t - (n - r) + (e - r);
  1173. if (i) return [i, n];
  1174. return [n]
  1175. }(t[0], -e[0]);
  1176. var i, o, s = new Array(n + r),
  1177. a = 0,
  1178. u = 0,
  1179. l = 0,
  1180. c = Math.abs,
  1181. h = t[u],
  1182. p = c(h),
  1183. f = -e[l],
  1184. g = c(f);
  1185. p < g ? (o = h, (u += 1) < n && (h = t[u], p = c(h))) : (o = f, (l += 1) < r && (f = -e[l], g = c(f)));
  1186. u < n && p < g || l >= r ? (i = h, (u += 1) < n && (h = t[u], p = c(h))) : (i = f, (l += 1) < r && (f = -e[l], g = c(f)));
  1187. var d, y, v = i + o,
  1188. _ = v - i,
  1189. m = o - _,
  1190. x = m,
  1191. E = v;
  1192. for (; u < n && l < r;) p < g ? (i = h, (u += 1) < n && (h = t[u], p = c(h))) : (i = f, (l += 1) < r && (f = -e[l], g = c(f))), (m = (o = x) - (_ = (v = i + o) - i)) && (s[a++] = m), x = E - ((d = E + v) - (y = d - E)) + (v - y), E = d;
  1193. for (; u < n;)(m = (o = x) - (_ = (v = (i = h) + o) - i)) && (s[a++] = m), x = E - ((d = E + v) - (y = d - E)) + (v - y), E = d, (u += 1) < n && (h = t[u]);
  1194. for (; l < r;)(m = (o = x) - (_ = (v = (i = f) + o) - i)) && (s[a++] = m), x = E - ((d = E + v) - (y = d - E)) + (v - y), E = d, (l += 1) < r && (f = -e[l]);
  1195. x && (s[a++] = x);
  1196. E && (s[a++] = E);
  1197. a || (s[a++] = 0);
  1198. return s.length = a, s
  1199. };
  1200. var Ht = Bt((function (t) {
  1201. function e(t, e) {
  1202. for (var n = new Array(t.length - 1), r = 1; r < t.length; ++r)
  1203. for (var i = n[r - 1] = new Array(t.length - 1), o = 0, s = 0; o < t.length; ++o) o !== e && (i[s++] = t[r][o]);
  1204. return n
  1205. }
  1206. function n(t) {
  1207. if (1 === t.length) return t[0];
  1208. if (2 === t.length) return ["sum(", t[0], ",", t[1], ")"].join("");
  1209. var e = t.length >> 1;
  1210. return ["sum(", n(t.slice(0, e)), ",", n(t.slice(e)), ")"].join("")
  1211. }
  1212. function r(t) {
  1213. if (2 === t.length) return [
  1214. ["sum(prod(", t[0][0], ",", t[1][1], "),prod(-", t[0][1], ",", t[1][0], "))"].join("")
  1215. ];
  1216. for (var i = [], o = 0; o < t.length; ++o) i.push(["scale(", n(r(e(t, o))), ",", (s = o, 1 & s ? "-" : ""), t[0][o], ")"].join(""));
  1217. return i;
  1218. var s
  1219. }
  1220. function i(t) {
  1221. for (var i = [], o = [], s = function (t) {
  1222. for (var e = new Array(t), n = 0; n < t; ++n) {
  1223. e[n] = new Array(t);
  1224. for (var r = 0; r < t; ++r) e[n][r] = ["m", r, "[", t - n - 1, "]"].join("")
  1225. }
  1226. return e
  1227. }(t), a = [], u = 0; u < t; ++u) 0 == (1 & u) ? i.push.apply(i, r(e(s, u))) : o.push.apply(o, r(e(s, u))), a.push("m" + u);
  1228. var l = n(i),
  1229. c = n(o),
  1230. h = "orientation" + t + "Exact",
  1231. p = ["function ", h, "(", a.join(), "){var p=", l, ",n=", c, ",d=sub(p,n);return d[d.length-1];};return ", h].join("");
  1232. return new Function("sum", "prod", "scale", "sub", p)(Ut, zt, Xt, Yt)
  1233. }
  1234. var o = i(3),
  1235. s = i(4),
  1236. a = [function () {
  1237. return 0
  1238. }, function () {
  1239. return 0
  1240. }, function (t, e) {
  1241. return e[0] - t[0]
  1242. }, function (t, e, n) {
  1243. var r, i = (t[1] - n[1]) * (e[0] - n[0]),
  1244. s = (t[0] - n[0]) * (e[1] - n[1]),
  1245. a = i - s;
  1246. if (i > 0) {
  1247. if (s <= 0) return a;
  1248. r = i + s
  1249. } else {
  1250. if (!(i < 0)) return a;
  1251. if (s >= 0) return a;
  1252. r = -(i + s)
  1253. }
  1254. var u = 33306690738754716e-32 * r;
  1255. return a >= u || a <= -u ? a : o(t, e, n)
  1256. }, function (t, e, n, r) {
  1257. var i = t[0] - r[0],
  1258. o = e[0] - r[0],
  1259. a = n[0] - r[0],
  1260. u = t[1] - r[1],
  1261. l = e[1] - r[1],
  1262. c = n[1] - r[1],
  1263. h = t[2] - r[2],
  1264. p = e[2] - r[2],
  1265. f = n[2] - r[2],
  1266. g = o * c,
  1267. d = a * l,
  1268. y = a * u,
  1269. v = i * c,
  1270. _ = i * l,
  1271. m = o * u,
  1272. x = h * (g - d) + p * (y - v) + f * (_ - m),
  1273. E = 7771561172376103e-31 * ((Math.abs(g) + Math.abs(d)) * Math.abs(h) + (Math.abs(y) + Math.abs(v)) * Math.abs(p) + (Math.abs(_) + Math.abs(m)) * Math.abs(f));
  1274. return x > E || -x > E ? x : s(t, e, n, r)
  1275. }];
  1276. function u(t) {
  1277. var e = a[t.length];
  1278. return e || (e = a[t.length] = i(t.length)), e.apply(void 0, t)
  1279. }! function () {
  1280. for (; a.length <= 5;) a.push(i(a.length));
  1281. for (var e = [], n = ["slow"], r = 0; r <= 5; ++r) e.push("a" + r), n.push("o" + r);
  1282. var o = ["function getOrientation(", e.join(), "){switch(arguments.length){case 0:case 1:return 0;"];
  1283. for (r = 2; r <= 5; ++r) o.push("case ", r, ":return o", r, "(", e.slice(0, r).join(), ");");
  1284. o.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"), n.push(o.join(""));
  1285. var s = Function.apply(void 0, n);
  1286. for (t.exports = s.apply(void 0, [u].concat(a)), r = 0; r <= 5; ++r) t.exports[r] = a[r]
  1287. }()
  1288. })),
  1289. Wt = function (t) {
  1290. var e = t.length;
  1291. if (e < 3) {
  1292. for (var n = new Array(e), r = 0; r < e; ++r) n[r] = r;
  1293. return 2 === e && t[0][0] === t[1][0] && t[0][1] === t[1][1] ? [0] : n
  1294. }
  1295. var i = new Array(e);
  1296. for (r = 0; r < e; ++r) i[r] = r;
  1297. i.sort((function (e, n) {
  1298. var r = t[e][0] - t[n][0];
  1299. return r || t[e][1] - t[n][1]
  1300. }));
  1301. var o = [i[0], i[1]],
  1302. s = [i[0], i[1]];
  1303. for (r = 2; r < e; ++r) {
  1304. for (var a = i[r], u = t[a], l = o.length; l > 1 && Jt(t[o[l - 2]], t[o[l - 1]], u) <= 0;) l -= 1, o.pop();
  1305. for (o.push(a), l = s.length; l > 1 && Jt(t[s[l - 2]], t[s[l - 1]], u) >= 0;) l -= 1, s.pop();
  1306. s.push(a)
  1307. }
  1308. n = new Array(s.length + o.length - 2);
  1309. for (var c = 0, h = (r = 0, o.length); r < h; ++r) n[c++] = o[r];
  1310. for (var p = s.length - 2; p > 0; --p) n[c++] = s[p];
  1311. return n
  1312. },
  1313. Jt = Ht[3];
  1314. var Zt = Qt,
  1315. Kt = Qt;
  1316. function Qt(t, e) {
  1317. if (!(this instanceof Qt)) return new Qt(t, e);
  1318. if (this.data = t || [], this.length = this.data.length, this.compare = e || $t, this.length > 0)
  1319. for (var n = (this.length >> 1) - 1; n >= 0; n--) this._down(n)
  1320. }
  1321. function $t(t, e) {
  1322. return t < e ? -1 : t > e ? 1 : 0
  1323. }
  1324. Qt.prototype = {
  1325. push: function (t) {
  1326. this.data.push(t), this.length++, this._up(this.length - 1)
  1327. },
  1328. pop: function () {
  1329. if (0 !== this.length) {
  1330. var t = this.data[0];
  1331. return this.length--, this.length > 0 && (this.data[0] = this.data[this.length], this._down(0)), this.data.pop(), t
  1332. }
  1333. },
  1334. peek: function () {
  1335. return this.data[0]
  1336. },
  1337. _up: function (t) {
  1338. for (var e = this.data, n = this.compare, r = e[t]; t > 0;) {
  1339. var i = t - 1 >> 1,
  1340. o = e[i];
  1341. if (n(r, o) >= 0) break;
  1342. e[t] = o, t = i
  1343. }
  1344. e[t] = r
  1345. },
  1346. _down: function (t) {
  1347. for (var e = this.data, n = this.compare, r = this.length >> 1, i = e[t]; t < r;) {
  1348. var o = 1 + (t << 1),
  1349. s = o + 1,
  1350. a = e[o];
  1351. if (s < this.length && n(e[s], a) < 0 && (o = s, a = e[s]), n(a, i) >= 0) break;
  1352. e[t] = a, t = o
  1353. }
  1354. e[t] = i
  1355. }
  1356. }, Zt.default = Kt;
  1357. var te = function (t, e) {
  1358. for (var n = t[0], r = t[1], i = !1, o = 0, s = e.length - 1; o < e.length; s = o++) {
  1359. var a = e[o][0],
  1360. u = e[o][1],
  1361. l = e[s][0],
  1362. c = e[s][1];
  1363. u > r != c > r && n < (l - a) * (r - u) / (c - u) + a && (i = !i)
  1364. }
  1365. return i
  1366. },
  1367. ee = Ht[3],
  1368. ne = ie,
  1369. re = ie;
  1370. function ie(t, e, n) {
  1371. e = Math.max(0, void 0 === e ? 2 : e), n = n || 0;
  1372. for (var r, i = function (t) {
  1373. for (var e = t[0], n = t[0], r = t[0], i = t[0], o = 0; o < t.length; o++) {
  1374. var s = t[o];
  1375. s[0] < e[0] && (e = s), s[0] > r[0] && (r = s), s[1] < n[1] && (n = s), s[1] > i[1] && (i = s)
  1376. }
  1377. var a = [e, n, r, i],
  1378. u = a.slice();
  1379. for (o = 0; o < t.length; o++) te(t[o], a) || u.push(t[o]);
  1380. var l = Wt(u),
  1381. c = [];
  1382. for (o = 0; o < l.length; o++) c.push(u[l[o]]);
  1383. return c
  1384. }(t), o = Nt(16, ["[0]", "[1]", "[0]", "[1]"]).load(t), s = [], a = 0; a < i.length; a++) {
  1385. var u = i[a];
  1386. o.remove(u), r = he(u, r), s.push(r)
  1387. }
  1388. var l = Nt(16);
  1389. for (a = 0; a < s.length; a++) l.insert(ce(s[a]));
  1390. for (var c = e * e, h = n * n; s.length;) {
  1391. var p = s.shift(),
  1392. f = p.p,
  1393. g = p.next.p,
  1394. d = pe(f, g);
  1395. if (!(d < h)) {
  1396. var y = d / c;
  1397. (u = oe(o, p.prev.p, f, g, p.next.next.p, y, l)) && Math.min(pe(u, f), pe(u, g)) <= y && (s.push(p), s.push(he(u, p)), o.remove(u), l.remove(p), l.insert(ce(p)), l.insert(ce(p.next)))
  1398. }
  1399. }
  1400. p = r;
  1401. var v = [];
  1402. do {
  1403. v.push(p.p), p = p.next
  1404. } while (p !== r);
  1405. return v.push(p.p), v
  1406. }
  1407. function oe(t, e, n, r, i, o, s) {
  1408. for (var a = new Zt(null, se), u = t.data; u;) {
  1409. for (var l = 0; l < u.children.length; l++) {
  1410. var c = u.children[l],
  1411. h = u.leaf ? fe(c, n, r) : ae(n, r, c);
  1412. h > o || a.push({
  1413. node: c,
  1414. dist: h
  1415. })
  1416. }
  1417. for (; a.length && !a.peek().node.children;) {
  1418. var p = a.pop(),
  1419. f = p.node,
  1420. g = fe(f, e, n),
  1421. d = fe(f, r, i);
  1422. if (p.dist < g && p.dist < d && le(n, f, s) && le(r, f, s)) return f
  1423. }(u = a.pop()) && (u = u.node)
  1424. }
  1425. return null
  1426. }
  1427. function se(t, e) {
  1428. return t.dist - e.dist
  1429. }
  1430. function ae(t, e, n) {
  1431. if (ue(t, n) || ue(e, n)) return 0;
  1432. var r = ge(t[0], t[1], e[0], e[1], n.minX, n.minY, n.maxX, n.minY);
  1433. if (0 === r) return 0;
  1434. var i = ge(t[0], t[1], e[0], e[1], n.minX, n.minY, n.minX, n.maxY);
  1435. if (0 === i) return 0;
  1436. var o = ge(t[0], t[1], e[0], e[1], n.maxX, n.minY, n.maxX, n.maxY);
  1437. if (0 === o) return 0;
  1438. var s = ge(t[0], t[1], e[0], e[1], n.minX, n.maxY, n.maxX, n.maxY);
  1439. return 0 === s ? 0 : Math.min(r, i, o, s)
  1440. }
  1441. function ue(t, e) {
  1442. return t[0] >= e.minX && t[0] <= e.maxX && t[1] >= e.minY && t[1] <= e.maxY
  1443. }
  1444. function le(t, e, n) {
  1445. for (var r, i, o, s, a = Math.min(t[0], e[0]), u = Math.min(t[1], e[1]), l = Math.max(t[0], e[0]), c = Math.max(t[1], e[1]), h = n.search({
  1446. minX: a,
  1447. minY: u,
  1448. maxX: l,
  1449. maxY: c
  1450. }), p = 0; p < h.length; p++)
  1451. if (r = h[p].p, i = h[p].next.p, o = t, r !== (s = e) && i !== o && ee(r, i, o) > 0 != ee(r, i, s) > 0 && ee(o, s, r) > 0 != ee(o, s, i) > 0) return !1;
  1452. return !0
  1453. }
  1454. function ce(t) {
  1455. var e = t.p,
  1456. n = t.next.p;
  1457. return t.minX = Math.min(e[0], n[0]), t.minY = Math.min(e[1], n[1]), t.maxX = Math.max(e[0], n[0]), t.maxY = Math.max(e[1], n[1]), t
  1458. }
  1459. function he(t, e) {
  1460. var n = {
  1461. p: t,
  1462. prev: null,
  1463. next: null,
  1464. minX: 0,
  1465. minY: 0,
  1466. maxX: 0,
  1467. maxY: 0
  1468. };
  1469. return e ? (n.next = e.next, n.prev = e, e.next.prev = n, e.next = n) : (n.prev = n, n.next = n), n
  1470. }
  1471. function pe(t, e) {
  1472. var n = t[0] - e[0],
  1473. r = t[1] - e[1];
  1474. return n * n + r * r
  1475. }
  1476. function fe(t, e, n) {
  1477. var r = e[0],
  1478. i = e[1],
  1479. o = n[0] - r,
  1480. s = n[1] - i;
  1481. if (0 !== o || 0 !== s) {
  1482. var a = ((t[0] - r) * o + (t[1] - i) * s) / (o * o + s * s);
  1483. a > 1 ? (r = n[0], i = n[1]) : a > 0 && (r += o * a, i += s * a)
  1484. }
  1485. return (o = t[0] - r) * o + (s = t[1] - i) * s
  1486. }
  1487. function ge(t, e, n, r, i, o, s, a) {
  1488. var u, l, c, h, p = n - t,
  1489. f = r - e,
  1490. g = s - i,
  1491. d = a - o,
  1492. y = t - i,
  1493. v = e - o,
  1494. _ = p * p + f * f,
  1495. m = p * g + f * d,
  1496. x = g * g + d * d,
  1497. E = p * y + f * v,
  1498. b = g * y + d * v,
  1499. w = _ * x - m * m,
  1500. I = w,
  1501. N = w;
  1502. 0 === w ? (l = 0, I = 1, h = b, N = x) : (h = _ * b - m * E, (l = m * b - x * E) < 0 ? (l = 0, h = b, N = x) : l > I && (l = I, h = b + m, N = x)), h < 0 ? (h = 0, -E < 0 ? l = 0 : -E > _ ? l = I : (l = -E, I = _)) : h > N && (h = N, -E + m < 0 ? l = 0 : -E + m > _ ? l = I : (l = -E + m, I = _));
  1503. var S = (1 - (c = 0 === h ? 0 : h / N)) * i + c * s - ((1 - (u = 0 === l ? 0 : l / I)) * t + u * n),
  1504. C = (1 - c) * o + c * a - ((1 - u) * e + u * r);
  1505. return S * S + C * C
  1506. }
  1507. function de(t, e) {
  1508. void 0 === e && (e = {}), e.concavity = e.concavity || 1 / 0;
  1509. var n = [];
  1510. if (R(t, (function (t) {
  1511. n.push([t[0], t[1]])
  1512. })), !n.length) return null;
  1513. var r = ne(n, e.concavity);
  1514. return r.length > 3 ? l([r]) : null
  1515. }
  1516. function ye(t, e, n) {
  1517. if (void 0 === n && (n = {}), !t) throw new Error("point is required");
  1518. if (!e) throw new Error("polygon is required");
  1519. var r = K(t),
  1520. i = rt(e),
  1521. o = i.type,
  1522. s = e.bbox,
  1523. a = i.coordinates;
  1524. if (s && !1 === function (t, e) {
  1525. return e[0] <= t[0] && e[1] <= t[1] && e[2] >= t[0] && e[3] >= t[1]
  1526. }(r, s)) return !1;
  1527. "Polygon" === o && (a = [a]);
  1528. for (var u = !1, l = 0; l < a.length && !u; l++)
  1529. if (ve(r, a[l][0], n.ignoreBoundary)) {
  1530. for (var c = !1, h = 1; h < a[l].length && !c;) ve(r, a[l][h], !n.ignoreBoundary) && (c = !0), h++;
  1531. c || (u = !0)
  1532. } return u
  1533. }
  1534. function ve(t, e, n) {
  1535. var r = !1;
  1536. e[0][0] === e[e.length - 1][0] && e[0][1] === e[e.length - 1][1] && (e = e.slice(0, e.length - 1));
  1537. for (var i = 0, o = e.length - 1; i < e.length; o = i++) {
  1538. var s = e[i][0],
  1539. a = e[i][1],
  1540. u = e[o][0],
  1541. l = e[o][1];
  1542. if (t[1] * (s - u) + a * (u - t[0]) + l * (t[0] - s) == 0 && (s - t[0]) * (u - t[0]) <= 0 && (a - t[1]) * (l - t[1]) <= 0) return !n;
  1543. a > t[1] != l > t[1] && t[0] < (u - s) * (t[1] - a) / (l - a) + s && (r = !r)
  1544. }
  1545. return r
  1546. }
  1547. function _e(t, e) {
  1548. var n = [];
  1549. return F(t, (function (t) {
  1550. var r = !1;
  1551. if ("Point" === t.geometry.type) q(e, (function (e) {
  1552. ye(t, e) && (r = !0)
  1553. })), r && n.push(t);
  1554. else {
  1555. if ("MultiPoint" !== t.geometry.type) throw new Error("Input geometry must be a Point or MultiPoint");
  1556. var i = [];
  1557. q(e, (function (e) {
  1558. R(t, (function (t) {
  1559. ye(t, e) && (r = !0, i.push(t))
  1560. }))
  1561. })), r && n.push(d(i))
  1562. }
  1563. })), f(n)
  1564. }
  1565. function me(t, e, n) {
  1566. void 0 === n && (n = {});
  1567. var r = K(t),
  1568. i = K(e),
  1569. o = I(i[1] - r[1]),
  1570. s = I(i[0] - r[0]),
  1571. a = I(r[1]),
  1572. u = I(i[1]),
  1573. l = Math.pow(Math.sin(o / 2), 2) + Math.pow(Math.sin(s / 2), 2) * Math.cos(a) * Math.cos(u);
  1574. return m(2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)), n.units)
  1575. }
  1576. function xe(t, e) {
  1577. var n = !1;
  1578. return f(function (t) {
  1579. if (t.length < 3) return [];
  1580. t.sort(be);
  1581. var e, n, r, i, o, s, a = t.length - 1,
  1582. u = t[a].x,
  1583. l = t[0].x,
  1584. c = t[a].y,
  1585. h = c,
  1586. p = 1e-12;
  1587. for (; a--;) t[a].y < c && (c = t[a].y), t[a].y > h && (h = t[a].y);
  1588. var f, g = l - u,
  1589. d = h - c,
  1590. y = g > d ? g : d,
  1591. v = .5 * (l + u),
  1592. _ = .5 * (h + c),
  1593. m = [new Ee({
  1594. __sentinel: !0,
  1595. x: v - 20 * y,
  1596. y: _ - y
  1597. }, {
  1598. __sentinel: !0,
  1599. x: v,
  1600. y: _ + 20 * y
  1601. }, {
  1602. __sentinel: !0,
  1603. x: v + 20 * y,
  1604. y: _ - y
  1605. })],
  1606. x = [],
  1607. E = [];
  1608. a = t.length;
  1609. for (; a--;) {
  1610. for (E.length = 0, f = m.length; f--;)(g = t[a].x - m[f].x) > 0 && g * g > m[f].r ? (x.push(m[f]), m.splice(f, 1)) : g * g + (d = t[a].y - m[f].y) * d > m[f].r || (E.push(m[f].a, m[f].b, m[f].b, m[f].c, m[f].c, m[f].a), m.splice(f, 1));
  1611. for (we(E), f = E.length; f;) n = E[--f], e = E[--f], r = t[a], i = n.x - e.x, o = n.y - e.y, s = 2 * (i * (r.y - n.y) - o * (r.x - n.x)), Math.abs(s) > p && m.push(new Ee(e, n, r))
  1612. }
  1613. Array.prototype.push.apply(x, m), a = x.length;
  1614. for (; a--;)(x[a].a.__sentinel || x[a].b.__sentinel || x[a].c.__sentinel) && x.splice(a, 1);
  1615. return x
  1616. }(t.features.map((function (t) {
  1617. var r = {
  1618. x: t.geometry.coordinates[0],
  1619. y: t.geometry.coordinates[1]
  1620. };
  1621. return e ? r.z = t.properties[e] : 3 === t.geometry.coordinates.length && (n = !0, r.z = t.geometry.coordinates[2]), r
  1622. }))).map((function (t) {
  1623. var e = [t.a.x, t.a.y],
  1624. r = [t.b.x, t.b.y],
  1625. i = [t.c.x, t.c.y],
  1626. o = {};
  1627. return n ? (e.push(t.a.z), r.push(t.b.z), i.push(t.c.z)) : o = {
  1628. a: t.a.z,
  1629. b: t.b.z,
  1630. c: t.c.z
  1631. }, l([
  1632. [e, r, i, e]
  1633. ], o)
  1634. })))
  1635. }
  1636. ne.default = re;
  1637. var Ee = function (t, e, n) {
  1638. this.a = t, this.b = e, this.c = n;
  1639. var r, i, o = e.x - t.x,
  1640. s = e.y - t.y,
  1641. a = n.x - t.x,
  1642. u = n.y - t.y,
  1643. l = o * (t.x + e.x) + s * (t.y + e.y),
  1644. c = a * (t.x + n.x) + u * (t.y + n.y),
  1645. h = 2 * (o * (n.y - e.y) - s * (n.x - e.x));
  1646. this.x = (u * l - s * c) / h, this.y = (o * c - a * l) / h, r = this.x - t.x, i = this.y - t.y, this.r = r * r + i * i
  1647. };
  1648. function be(t, e) {
  1649. return e.x - t.x
  1650. }
  1651. function we(t) {
  1652. var e, n, r, i, o, s = t.length;
  1653. t: for (; s;)
  1654. for (n = t[--s], e = t[--s], r = s; r;)
  1655. if (o = t[--r], e === (i = t[--r]) && n === o || e === o && n === i) {
  1656. t.splice(s, 2), t.splice(r, 2), s -= 2;
  1657. continue t
  1658. }
  1659. }
  1660. function Ie(t) {
  1661. if (!t) throw new Error("geojson is required");
  1662. switch (t.type) {
  1663. case "Feature":
  1664. return Ne(t);
  1665. case "FeatureCollection":
  1666. return function (t) {
  1667. var e = {
  1668. type: "FeatureCollection"
  1669. };
  1670. return Object.keys(t).forEach((function (n) {
  1671. switch (n) {
  1672. case "type":
  1673. case "features":
  1674. return;
  1675. default:
  1676. e[n] = t[n]
  1677. }
  1678. })), e.features = t.features.map((function (t) {
  1679. return Ne(t)
  1680. })), e
  1681. }(t);
  1682. case "Point":
  1683. case "LineString":
  1684. case "Polygon":
  1685. case "MultiPoint":
  1686. case "MultiLineString":
  1687. case "MultiPolygon":
  1688. case "GeometryCollection":
  1689. return Ce(t);
  1690. default:
  1691. throw new Error("unknown GeoJSON type")
  1692. }
  1693. }
  1694. function Ne(t) {
  1695. var e = {
  1696. type: "Feature"
  1697. };
  1698. return Object.keys(t).forEach((function (n) {
  1699. switch (n) {
  1700. case "type":
  1701. case "properties":
  1702. case "geometry":
  1703. return;
  1704. default:
  1705. e[n] = t[n]
  1706. }
  1707. })), e.properties = Se(t.properties), e.geometry = Ce(t.geometry), e
  1708. }
  1709. function Se(t) {
  1710. var e = {};
  1711. return t ? (Object.keys(t).forEach((function (n) {
  1712. var r = t[n];
  1713. "object" == typeof r ? null === r ? e[n] = null : Array.isArray(r) ? e[n] = r.map((function (t) {
  1714. return t
  1715. })) : e[n] = Se(r) : e[n] = r
  1716. })), e) : e
  1717. }
  1718. function Ce(t) {
  1719. var e = {
  1720. type: t.type
  1721. };
  1722. return t.bbox && (e.bbox = t.bbox), "GeometryCollection" === t.type ? (e.geometries = t.geometries.map((function (t) {
  1723. return Ce(t)
  1724. })), e) : (e.coordinates = Pe(t.coordinates), e)
  1725. }
  1726. function Pe(t) {
  1727. var e = t;
  1728. return "object" != typeof e[0] ? e.slice() : e.map((function (t) {
  1729. return Pe(t)
  1730. }))
  1731. }
  1732. function Me(t, e) {
  1733. if (void 0 === e && (e = {}), !P(e = e || {})) throw new Error("options is invalid");
  1734. var n = e.mutate;
  1735. if ("FeatureCollection" !== it(t)) throw new Error("geojson must be a FeatureCollection");
  1736. if (!t.features.length) throw new Error("geojson is empty");
  1737. !1 !== n && void 0 !== n || (t = Ie(t));
  1738. var r = [],
  1739. i = Y(t, (function (t, e) {
  1740. var n = function (t, e) {
  1741. var n, r = t.geometry.coordinates,
  1742. i = e.geometry.coordinates,
  1743. o = Le(r[0]),
  1744. s = Le(r[r.length - 1]),
  1745. a = Le(i[0]),
  1746. u = Le(i[i.length - 1]);
  1747. if (o === u) n = i.concat(r.slice(1));
  1748. else if (a === s) n = r.concat(i.slice(1));
  1749. else if (o === a) n = r.slice(1).reverse().concat(i);
  1750. else {
  1751. if (s !== u) return null;
  1752. n = r.concat(i.reverse().slice(1))
  1753. }
  1754. return h(n)
  1755. }(t, e);
  1756. return n || (r.push(t), e)
  1757. }));
  1758. return i && r.push(i), r.length ? 1 === r.length ? r[0] : g(r.map((function (t) {
  1759. return t.coordinates
  1760. }))) : null
  1761. }
  1762. function Le(t) {
  1763. return t[0].toString() + "," + t[1].toString()
  1764. }
  1765. function Oe(t) {
  1766. return t
  1767. }
  1768. function Re(t, e) {
  1769. var n = function (t) {
  1770. if (null == t) return Oe;
  1771. var e, n, r = t.scale[0],
  1772. i = t.scale[1],
  1773. o = t.translate[0],
  1774. s = t.translate[1];
  1775. return function (t, a) {
  1776. a || (e = n = 0);
  1777. var u = 2,
  1778. l = t.length,
  1779. c = new Array(l);
  1780. for (c[0] = (e += t[0]) * r + o, c[1] = (n += t[1]) * i + s; u < l;) c[u] = t[u], ++u;
  1781. return c
  1782. }
  1783. }(t.transform),
  1784. r = t.arcs;
  1785. function i(t, e) {
  1786. e.length && e.pop();
  1787. for (var i = r[t < 0 ? ~t : t], o = 0, s = i.length; o < s; ++o) e.push(n(i[o], o));
  1788. t < 0 && function (t, e) {
  1789. for (var n, r = t.length, i = r - e; i < --r;) n = t[i], t[i++] = t[r], t[r] = n
  1790. }(e, s)
  1791. }
  1792. function o(t) {
  1793. return n(t)
  1794. }
  1795. function s(t) {
  1796. for (var e = [], n = 0, r = t.length; n < r; ++n) i(t[n], e);
  1797. return e.length < 2 && e.push(e[0]), e
  1798. }
  1799. function a(t) {
  1800. for (var e = s(t); e.length < 4;) e.push(e[0]);
  1801. return e
  1802. }
  1803. function u(t) {
  1804. return t.map(a)
  1805. }
  1806. return function t(e) {
  1807. var n, r = e.type;
  1808. switch (r) {
  1809. case "GeometryCollection":
  1810. return {
  1811. type: r, geometries: e.geometries.map(t)
  1812. };
  1813. case "Point":
  1814. n = o(e.coordinates);
  1815. break;
  1816. case "MultiPoint":
  1817. n = e.coordinates.map(o);
  1818. break;
  1819. case "LineString":
  1820. n = s(e.arcs);
  1821. break;
  1822. case "MultiLineString":
  1823. n = e.arcs.map(s);
  1824. break;
  1825. case "Polygon":
  1826. n = u(e.arcs);
  1827. break;
  1828. case "MultiPolygon":
  1829. n = e.arcs.map(u);
  1830. break;
  1831. default:
  1832. return null
  1833. }
  1834. return {
  1835. type: r,
  1836. coordinates: n
  1837. }
  1838. }(e)
  1839. }
  1840. function Te(t, e) {
  1841. var n = {},
  1842. r = {},
  1843. i = {},
  1844. o = [],
  1845. s = -1;
  1846. function a(t, e) {
  1847. for (var r in t) {
  1848. var i = t[r];
  1849. delete e[i.start], delete i.start, delete i.end, i.forEach((function (t) {
  1850. n[t < 0 ? ~t : t] = 1
  1851. })), o.push(i)
  1852. }
  1853. }
  1854. return e.forEach((function (n, r) {
  1855. var i, o = t.arcs[n < 0 ? ~n : n];
  1856. o.length < 3 && !o[1][0] && !o[1][1] && (i = e[++s], e[s] = n, e[r] = i)
  1857. })), e.forEach((function (e) {
  1858. var n, o, s = function (e) {
  1859. var n, r = t.arcs[e < 0 ? ~e : e],
  1860. i = r[0];
  1861. t.transform ? (n = [0, 0], r.forEach((function (t) {
  1862. n[0] += t[0], n[1] += t[1]
  1863. }))) : n = r[r.length - 1];
  1864. return e < 0 ? [n, i] : [i, n]
  1865. }(e),
  1866. a = s[0],
  1867. u = s[1];
  1868. if (n = i[a])
  1869. if (delete i[n.end], n.push(e), n.end = u, o = r[u]) {
  1870. delete r[o.start];
  1871. var l = o === n ? n : n.concat(o);
  1872. r[l.start = n.start] = i[l.end = o.end] = l
  1873. } else r[n.start] = i[n.end] = n;
  1874. else if (n = r[u])
  1875. if (delete r[n.start], n.unshift(e), n.start = a, o = i[a]) {
  1876. delete i[o.end];
  1877. var c = o === n ? n : o.concat(n);
  1878. r[c.start = o.start] = i[c.end = n.end] = c
  1879. } else r[n.start] = i[n.end] = n;
  1880. else r[(n = [e]).start = a] = i[n.end = u] = n
  1881. })), a(i, r), a(r, i), e.forEach((function (t) {
  1882. n[t < 0 ? ~t : t] || o.push([t])
  1883. })), o
  1884. }
  1885. function Ae(t, e) {
  1886. var n = {},
  1887. r = [],
  1888. i = [];
  1889. function o(t) {
  1890. t.forEach((function (e) {
  1891. e.forEach((function (e) {
  1892. (n[e = e < 0 ? ~e : e] || (n[e] = [])).push(t)
  1893. }))
  1894. })), r.push(t)
  1895. }
  1896. function s(e) {
  1897. return function (t) {
  1898. for (var e, n = -1, r = t.length, i = t[r - 1], o = 0; ++n < r;) e = i, i = t[n], o += e[0] * i[1] - e[1] * i[0];
  1899. return Math.abs(o)
  1900. }(Re(t, {
  1901. type: "Polygon",
  1902. arcs: [e]
  1903. }).coordinates[0])
  1904. }
  1905. return e.forEach((function t(e) {
  1906. switch (e.type) {
  1907. case "GeometryCollection":
  1908. e.geometries.forEach(t);
  1909. break;
  1910. case "Polygon":
  1911. o(e.arcs);
  1912. break;
  1913. case "MultiPolygon":
  1914. e.arcs.forEach(o)
  1915. }
  1916. })), r.forEach((function (t) {
  1917. if (!t._) {
  1918. var e = [],
  1919. r = [t];
  1920. for (t._ = 1, i.push(e); t = r.pop();) e.push(t), t.forEach((function (t) {
  1921. t.forEach((function (t) {
  1922. n[t < 0 ? ~t : t].forEach((function (t) {
  1923. t._ || (t._ = 1, r.push(t))
  1924. }))
  1925. }))
  1926. }))
  1927. }
  1928. })), r.forEach((function (t) {
  1929. delete t._
  1930. })), {
  1931. type: "MultiPolygon",
  1932. arcs: i.map((function (e) {
  1933. var r, i = [];
  1934. if (e.forEach((function (t) {
  1935. t.forEach((function (t) {
  1936. t.forEach((function (t) {
  1937. n[t < 0 ? ~t : t].length < 2 && i.push(t)
  1938. }))
  1939. }))
  1940. })), (r = (i = Te(t, i)).length) > 1)
  1941. for (var o, a, u = 1, l = s(i[0]); u < r; ++u)(o = s(i[u])) > l && (a = i[0], i[0] = i[u], i[u] = a, l = o);
  1942. return i
  1943. })).filter((function (t) {
  1944. return t.length > 0
  1945. }))
  1946. }
  1947. }
  1948. var De = Object.prototype.hasOwnProperty;
  1949. function Fe(t, e, n, r, i, o) {
  1950. 3 === arguments.length && (r = o = Array, i = null);
  1951. for (var s = new r(t = 1 << Math.max(4, Math.ceil(Math.log(t) / Math.LN2))), a = new o(t), u = t - 1, l = 0; l < t; ++l) s[l] = i;
  1952. function c(r, o) {
  1953. for (var l = e(r) & u, c = s[l], h = 0; c != i;) {
  1954. if (n(c, r)) return a[l] = o;
  1955. if (++h >= t) throw new Error("full hashmap");
  1956. c = s[l = l + 1 & u]
  1957. }
  1958. return s[l] = r, a[l] = o, o
  1959. }
  1960. function h(r, o) {
  1961. for (var l = e(r) & u, c = s[l], h = 0; c != i;) {
  1962. if (n(c, r)) return a[l];
  1963. if (++h >= t) throw new Error("full hashmap");
  1964. c = s[l = l + 1 & u]
  1965. }
  1966. return s[l] = r, a[l] = o, o
  1967. }
  1968. function p(r, o) {
  1969. for (var l = e(r) & u, c = s[l], h = 0; c != i;) {
  1970. if (n(c, r)) return a[l];
  1971. if (++h >= t) break;
  1972. c = s[l = l + 1 & u]
  1973. }
  1974. return o
  1975. }
  1976. function f() {
  1977. for (var t = [], e = 0, n = s.length; e < n; ++e) {
  1978. var r = s[e];
  1979. r != i && t.push(r)
  1980. }
  1981. return t
  1982. }
  1983. return {
  1984. set: c,
  1985. maybeSet: h,
  1986. get: p,
  1987. keys: f
  1988. }
  1989. }
  1990. function ke(t, e) {
  1991. return t[0] === e[0] && t[1] === e[1]
  1992. }
  1993. var Ge = new ArrayBuffer(16),
  1994. qe = new Float64Array(Ge),
  1995. Be = new Uint32Array(Ge);
  1996. function ze(t) {
  1997. qe[0] = t[0], qe[1] = t[1];
  1998. var e = Be[0] ^ Be[1];
  1999. return 2147483647 & (e = e << 5 ^ e >> 7 ^ Be[2] ^ Be[3])
  2000. }
  2001. function je(t) {
  2002. var e, n, r, i, o = t.coordinates,
  2003. s = t.lines,
  2004. a = t.rings,
  2005. u = function () {
  2006. for (var t = Fe(1.4 * o.length, E, b, Int32Array, -1, Int32Array), e = new Int32Array(o.length), n = 0, r = o.length; n < r; ++n) e[n] = t.maybeSet(n, n);
  2007. return e
  2008. }(),
  2009. l = new Int32Array(o.length),
  2010. c = new Int32Array(o.length),
  2011. h = new Int32Array(o.length),
  2012. p = new Int8Array(o.length),
  2013. f = 0;
  2014. for (e = 0, n = o.length; e < n; ++e) l[e] = c[e] = h[e] = -1;
  2015. for (e = 0, n = s.length; e < n; ++e) {
  2016. var g = s[e],
  2017. d = g[0],
  2018. y = g[1];
  2019. for (r = u[d], i = u[++d], ++f, p[r] = 1; ++d <= y;) x(e, r, r = i, i = u[d]);
  2020. ++f, p[i] = 1
  2021. }
  2022. for (e = 0, n = o.length; e < n; ++e) l[e] = -1;
  2023. for (e = 0, n = a.length; e < n; ++e) {
  2024. var v = a[e],
  2025. _ = v[0] + 1,
  2026. m = v[1];
  2027. for (x(e, u[m - 1], r = u[_ - 1], i = u[_]); ++_ <= m;) x(e, r, r = i, i = u[_])
  2028. }
  2029. function x(t, e, n, r) {
  2030. if (l[n] !== t) {
  2031. l[n] = t;
  2032. var i = c[n];
  2033. if (i >= 0) {
  2034. var o = h[n];
  2035. i === e && o === r || i === r && o === e || (++f, p[n] = 1)
  2036. } else c[n] = e, h[n] = r
  2037. }
  2038. }
  2039. function E(t) {
  2040. return ze(o[t])
  2041. }
  2042. function b(t, e) {
  2043. return ke(o[t], o[e])
  2044. }
  2045. l = c = h = null;
  2046. var w, I = function (t, e, n, r, i) {
  2047. 3 === arguments.length && (r = Array, i = null);
  2048. for (var o = new r(t = 1 << Math.max(4, Math.ceil(Math.log(t) / Math.LN2))), s = t - 1, a = 0; a < t; ++a) o[a] = i;
  2049. function u(r) {
  2050. for (var a = e(r) & s, u = o[a], l = 0; u != i;) {
  2051. if (n(u, r)) return !0;
  2052. if (++l >= t) throw new Error("full hashset");
  2053. u = o[a = a + 1 & s]
  2054. }
  2055. return o[a] = r, !0
  2056. }
  2057. function l(r) {
  2058. for (var a = e(r) & s, u = o[a], l = 0; u != i;) {
  2059. if (n(u, r)) return !0;
  2060. if (++l >= t) break;
  2061. u = o[a = a + 1 & s]
  2062. }
  2063. return !1
  2064. }
  2065. function c() {
  2066. for (var t = [], e = 0, n = o.length; e < n; ++e) {
  2067. var r = o[e];
  2068. r != i && t.push(r)
  2069. }
  2070. return t
  2071. }
  2072. return {
  2073. add: u,
  2074. has: l,
  2075. values: c
  2076. }
  2077. }(1.4 * f, ze, ke);
  2078. for (e = 0, n = o.length; e < n; ++e) p[w = u[e]] && I.add(o[w]);
  2079. return I
  2080. }
  2081. function Ue(t, e, n, r) {
  2082. Ve(t, e, n), Ve(t, e, e + r), Ve(t, e + r, n)
  2083. }
  2084. function Ve(t, e, n) {
  2085. for (var r, i = e + (n-- - e >> 1); e < i; ++e, --n) r = t[e], t[e] = t[n], t[n] = r
  2086. }
  2087. function Xe(t) {
  2088. var e, n, r = {};
  2089. for (e in t) r[e] = null == (n = t[e]) ? {
  2090. type: null
  2091. } : ("FeatureCollection" === n.type ? Ye : "Feature" === n.type ? He : We)(n);
  2092. return r
  2093. }
  2094. function Ye(t) {
  2095. var e = {
  2096. type: "GeometryCollection",
  2097. geometries: t.features.map(He)
  2098. };
  2099. return null != t.bbox && (e.bbox = t.bbox), e
  2100. }
  2101. function He(t) {
  2102. var e, n = We(t.geometry);
  2103. for (e in null != t.id && (n.id = t.id), null != t.bbox && (n.bbox = t.bbox), t.properties) {
  2104. n.properties = t.properties;
  2105. break
  2106. }
  2107. return n
  2108. }
  2109. function We(t) {
  2110. if (null == t) return {
  2111. type: null
  2112. };
  2113. var e = "GeometryCollection" === t.type ? {
  2114. type: "GeometryCollection",
  2115. geometries: t.geometries.map(We)
  2116. } : "Point" === t.type || "MultiPoint" === t.type ? {
  2117. type: t.type,
  2118. coordinates: t.coordinates
  2119. } : {
  2120. type: t.type,
  2121. arcs: t.coordinates
  2122. };
  2123. return null != t.bbox && (e.bbox = t.bbox), e
  2124. }
  2125. function Je(t, e) {
  2126. var n = function (t) {
  2127. var e = 1 / 0,
  2128. n = 1 / 0,
  2129. r = -1 / 0,
  2130. i = -1 / 0;
  2131. function o(t) {
  2132. null != t && De.call(s, t.type) && s[t.type](t)
  2133. }
  2134. var s = {
  2135. GeometryCollection: function (t) {
  2136. t.geometries.forEach(o)
  2137. },
  2138. Point: function (t) {
  2139. a(t.coordinates)
  2140. },
  2141. MultiPoint: function (t) {
  2142. t.coordinates.forEach(a)
  2143. },
  2144. LineString: function (t) {
  2145. u(t.arcs)
  2146. },
  2147. MultiLineString: function (t) {
  2148. t.arcs.forEach(u)
  2149. },
  2150. Polygon: function (t) {
  2151. t.arcs.forEach(u)
  2152. },
  2153. MultiPolygon: function (t) {
  2154. t.arcs.forEach(l)
  2155. }
  2156. };
  2157. function a(t) {
  2158. var o = t[0],
  2159. s = t[1];
  2160. o < e && (e = o), o > r && (r = o), s < n && (n = s), s > i && (i = s)
  2161. }
  2162. function u(t) {
  2163. t.forEach(a)
  2164. }
  2165. function l(t) {
  2166. t.forEach(u)
  2167. }
  2168. for (var c in t) o(t[c]);
  2169. return r >= e && i >= n ? [e, n, r, i] : void 0
  2170. }(t = Xe(t)),
  2171. r = e > 0 && n && function (t, e, n) {
  2172. var r = e[0],
  2173. i = e[1],
  2174. o = e[2],
  2175. s = e[3],
  2176. a = o - r ? (n - 1) / (o - r) : 1,
  2177. u = s - i ? (n - 1) / (s - i) : 1;
  2178. function l(t) {
  2179. return [Math.round((t[0] - r) * a), Math.round((t[1] - i) * u)]
  2180. }
  2181. function c(t, e) {
  2182. for (var n, o, s, l, c, h = -1, p = 0, f = t.length, g = new Array(f); ++h < f;) n = t[h], l = Math.round((n[0] - r) * a), c = Math.round((n[1] - i) * u), l === o && c === s || (g[p++] = [o = l, s = c]);
  2183. for (g.length = p; p < e;) p = g.push([g[0][0], g[0][1]]);
  2184. return g
  2185. }
  2186. function h(t) {
  2187. return c(t, 2)
  2188. }
  2189. function p(t) {
  2190. return c(t, 4)
  2191. }
  2192. function f(t) {
  2193. return t.map(p)
  2194. }
  2195. function g(t) {
  2196. null != t && De.call(d, t.type) && d[t.type](t)
  2197. }
  2198. var d = {
  2199. GeometryCollection: function (t) {
  2200. t.geometries.forEach(g)
  2201. },
  2202. Point: function (t) {
  2203. t.coordinates = l(t.coordinates)
  2204. },
  2205. MultiPoint: function (t) {
  2206. t.coordinates = t.coordinates.map(l)
  2207. },
  2208. LineString: function (t) {
  2209. t.arcs = h(t.arcs)
  2210. },
  2211. MultiLineString: function (t) {
  2212. t.arcs = t.arcs.map(h)
  2213. },
  2214. Polygon: function (t) {
  2215. t.arcs = f(t.arcs)
  2216. },
  2217. MultiPolygon: function (t) {
  2218. t.arcs = t.arcs.map(f)
  2219. }
  2220. };
  2221. for (var y in t) g(t[y]);
  2222. return {
  2223. scale: [1 / a, 1 / u],
  2224. translate: [r, i]
  2225. }
  2226. }(t, n, e),
  2227. i = function (t) {
  2228. var e, n, r, i, o = t.coordinates,
  2229. s = t.lines,
  2230. a = t.rings,
  2231. u = s.length + a.length;
  2232. for (delete t.lines, delete t.rings, r = 0, i = s.length; r < i; ++r)
  2233. for (e = s[r]; e = e.next;) ++u;
  2234. for (r = 0, i = a.length; r < i; ++r)
  2235. for (n = a[r]; n = n.next;) ++u;
  2236. var l = Fe(2 * u * 1.4, ze, ke),
  2237. c = t.arcs = [];
  2238. for (r = 0, i = s.length; r < i; ++r) {
  2239. e = s[r];
  2240. do {
  2241. h(e)
  2242. } while (e = e.next)
  2243. }
  2244. for (r = 0, i = a.length; r < i; ++r)
  2245. if ((n = a[r]).next)
  2246. do {
  2247. h(n)
  2248. } while (n = n.next);
  2249. else p(n);
  2250. function h(t) {
  2251. var e, n, r, i, s, a, u, h;
  2252. if (r = l.get(e = o[t[0]]))
  2253. for (u = 0, h = r.length; u < h; ++u)
  2254. if (f(i = r[u], t)) return t[0] = i[0], void(t[1] = i[1]);
  2255. if (s = l.get(n = o[t[1]]))
  2256. for (u = 0, h = s.length; u < h; ++u)
  2257. if (g(a = s[u], t)) return t[1] = a[0], void(t[0] = a[1]);
  2258. r ? r.push(t) : l.set(e, [t]), s ? s.push(t) : l.set(n, [t]), c.push(t)
  2259. }
  2260. function p(t) {
  2261. var e, n, r, i, s;
  2262. if (n = l.get(o[t[0]]))
  2263. for (i = 0, s = n.length; i < s; ++i) {
  2264. if (d(r = n[i], t)) return t[0] = r[0], void(t[1] = r[1]);
  2265. if (y(r, t)) return t[0] = r[1], void(t[1] = r[0])
  2266. }
  2267. if (n = l.get(e = o[t[0] + v(t)]))
  2268. for (i = 0, s = n.length; i < s; ++i) {
  2269. if (d(r = n[i], t)) return t[0] = r[0], void(t[1] = r[1]);
  2270. if (y(r, t)) return t[0] = r[1], void(t[1] = r[0])
  2271. }
  2272. n ? n.push(t) : l.set(e, [t]), c.push(t)
  2273. }
  2274. function f(t, e) {
  2275. var n = t[0],
  2276. r = e[0],
  2277. i = t[1];
  2278. if (n - i != r - e[1]) return !1;
  2279. for (; n <= i; ++n, ++r)
  2280. if (!ke(o[n], o[r])) return !1;
  2281. return !0
  2282. }
  2283. function g(t, e) {
  2284. var n = t[0],
  2285. r = e[0],
  2286. i = t[1],
  2287. s = e[1];
  2288. if (n - i != r - s) return !1;
  2289. for (; n <= i; ++n, --s)
  2290. if (!ke(o[n], o[s])) return !1;
  2291. return !0
  2292. }
  2293. function d(t, e) {
  2294. var n = t[0],
  2295. r = e[0],
  2296. i = t[1] - n;
  2297. if (i !== e[1] - r) return !1;
  2298. for (var s = v(t), a = v(e), u = 0; u < i; ++u)
  2299. if (!ke(o[n + (u + s) % i], o[r + (u + a) % i])) return !1;
  2300. return !0
  2301. }
  2302. function y(t, e) {
  2303. var n = t[0],
  2304. r = e[0],
  2305. i = t[1],
  2306. s = e[1],
  2307. a = i - n;
  2308. if (a !== s - r) return !1;
  2309. for (var u = v(t), l = a - v(e), c = 0; c < a; ++c)
  2310. if (!ke(o[n + (c + u) % a], o[s - (c + l) % a])) return !1;
  2311. return !0
  2312. }
  2313. function v(t) {
  2314. for (var e = t[0], n = t[1], r = e, i = r, s = o[r]; ++r < n;) {
  2315. var a = o[r];
  2316. (a[0] < s[0] || a[0] === s[0] && a[1] < s[1]) && (i = r, s = a)
  2317. }
  2318. return i - e
  2319. }
  2320. return t
  2321. }(function (t) {
  2322. var e, n, r, i = je(t),
  2323. o = t.coordinates,
  2324. s = t.lines,
  2325. a = t.rings;
  2326. for (n = 0, r = s.length; n < r; ++n)
  2327. for (var u = s[n], l = u[0], c = u[1]; ++l < c;) i.has(o[l]) && (e = {
  2328. 0: l,
  2329. 1: u[1]
  2330. }, u[1] = l, u = u.next = e);
  2331. for (n = 0, r = a.length; n < r; ++n)
  2332. for (var h = a[n], p = h[0], f = p, g = h[1], d = i.has(o[p]); ++f < g;) i.has(o[f]) && (d ? (e = {
  2333. 0: f,
  2334. 1: h[1]
  2335. }, h[1] = f, h = h.next = e) : (Ue(o, p, g, g - f), o[g] = o[p], d = !0, f = p));
  2336. return t
  2337. }(function (t) {
  2338. var e = -1,
  2339. n = [],
  2340. r = [],
  2341. i = [];
  2342. function o(t) {
  2343. t && De.call(s, t.type) && s[t.type](t)
  2344. }
  2345. var s = {
  2346. GeometryCollection: function (t) {
  2347. t.geometries.forEach(o)
  2348. },
  2349. LineString: function (t) {
  2350. t.arcs = a(t.arcs)
  2351. },
  2352. MultiLineString: function (t) {
  2353. t.arcs = t.arcs.map(a)
  2354. },
  2355. Polygon: function (t) {
  2356. t.arcs = t.arcs.map(u)
  2357. },
  2358. MultiPolygon: function (t) {
  2359. t.arcs = t.arcs.map(l)
  2360. }
  2361. };
  2362. function a(t) {
  2363. for (var r = 0, o = t.length; r < o; ++r) i[++e] = t[r];
  2364. var s = {
  2365. 0: e - o + 1,
  2366. 1: e
  2367. };
  2368. return n.push(s), s
  2369. }
  2370. function u(t) {
  2371. for (var n = 0, o = t.length; n < o; ++n) i[++e] = t[n];
  2372. var s = {
  2373. 0: e - o + 1,
  2374. 1: e
  2375. };
  2376. return r.push(s), s
  2377. }
  2378. function l(t) {
  2379. return t.map(u)
  2380. }
  2381. for (var c in t) o(t[c]);
  2382. return {
  2383. type: "Topology",
  2384. coordinates: i,
  2385. lines: n,
  2386. rings: r,
  2387. objects: t
  2388. }
  2389. }(t))),
  2390. o = i.coordinates,
  2391. s = Fe(1.4 * i.arcs.length, Ze, Ke);
  2392. function a(t) {
  2393. t && De.call(u, t.type) && u[t.type](t)
  2394. }
  2395. t = i.objects, i.bbox = n, i.arcs = i.arcs.map((function (t, e) {
  2396. return s.set(t, e), o.slice(t[0], t[1] + 1)
  2397. })), delete i.coordinates, o = null;
  2398. var u = {
  2399. GeometryCollection: function (t) {
  2400. t.geometries.forEach(a)
  2401. },
  2402. LineString: function (t) {
  2403. t.arcs = l(t.arcs)
  2404. },
  2405. MultiLineString: function (t) {
  2406. t.arcs = t.arcs.map(l)
  2407. },
  2408. Polygon: function (t) {
  2409. t.arcs = t.arcs.map(l)
  2410. },
  2411. MultiPolygon: function (t) {
  2412. t.arcs = t.arcs.map(c)
  2413. }
  2414. };
  2415. function l(t) {
  2416. var e = [];
  2417. do {
  2418. var n = s.get(t);
  2419. e.push(t[0] < t[1] ? n : ~n)
  2420. } while (t = t.next);
  2421. return e
  2422. }
  2423. function c(t) {
  2424. return t.map(l)
  2425. }
  2426. for (var h in t) a(t[h]);
  2427. return r && (i.transform = r, i.arcs = function (t) {
  2428. for (var e = -1, n = t.length; ++e < n;) {
  2429. for (var r, i, o = t[e], s = 0, a = 1, u = o.length, l = o[0], c = l[0], h = l[1]; ++s < u;) r = (l = o[s])[0], i = l[1], r === c && i === h || (o[a++] = [r - c, i - h], c = r, h = i);
  2430. 1 === a && (o[a++] = [0, 0]), o.length = a
  2431. }
  2432. return t
  2433. }(i.arcs)), i
  2434. }
  2435. function Ze(t) {
  2436. var e, n = t[0],
  2437. r = t[1];
  2438. return r < n && (e = n, n = r, r = e), n + 31 * r
  2439. }
  2440. function Ke(t, e) {
  2441. var n, r = t[0],
  2442. i = t[1],
  2443. o = e[0],
  2444. s = e[1];
  2445. return i < r && (n = r, r = i, i = n), s < o && (n = o, o = s, s = n), r === o && i === s
  2446. }
  2447. function Qe(t, e) {
  2448. if (void 0 === e && (e = {}), "FeatureCollection" !== it(t)) throw new Error("geojson must be a FeatureCollection");
  2449. if (!t.features.length) throw new Error("geojson is empty");
  2450. !1 !== e.mutate && void 0 !== e.mutate || (t = Ie(t));
  2451. var n = [];
  2452. z(t, (function (t) {
  2453. n.push(t.geometry)
  2454. }));
  2455. var r = Je({
  2456. geoms: v(n).geometry
  2457. });
  2458. return function (t) {
  2459. return Re(t, Ae.apply(this, arguments))
  2460. }(r, r.objects.geoms.geometries)
  2461. }
  2462. function $e(t, e) {
  2463. if (void 0 === e && (e = {}), !P(e = e || {})) throw new Error("options is invalid");
  2464. var n = e.mutate;
  2465. if ("FeatureCollection" !== it(t)) throw new Error("geojson must be a FeatureCollection");
  2466. if (!t.features.length) throw new Error("geojson is empty");
  2467. !1 !== n && void 0 !== n || (t = Ie(t));
  2468. var r = function (t) {
  2469. var e = {};
  2470. z(t, (function (t) {
  2471. e[t.geometry.type] = !0
  2472. }));
  2473. var n = Object.keys(e);
  2474. if (1 === n.length) return n[0];
  2475. return null
  2476. }(t);
  2477. if (!r) throw new Error("geojson must be homogenous");
  2478. var i = t;
  2479. switch (r) {
  2480. case "LineString":
  2481. return Me(i, e);
  2482. case "Polygon":
  2483. return Qe(i, e);
  2484. default:
  2485. throw new Error(r + " is not supported")
  2486. }
  2487. }
  2488. function tn(t, e) {
  2489. void 0 === e && (e = {});
  2490. var n = "object" == typeof e ? e.mutate : e;
  2491. if (!t) throw new Error("geojson is required");
  2492. var r = it(t),
  2493. i = [];
  2494. switch (r) {
  2495. case "LineString":
  2496. i = en(t);
  2497. break;
  2498. case "MultiLineString":
  2499. case "Polygon":
  2500. Q(t).forEach((function (t) {
  2501. i.push(en(t))
  2502. }));
  2503. break;
  2504. case "MultiPolygon":
  2505. Q(t).forEach((function (t) {
  2506. var e = [];
  2507. t.forEach((function (t) {
  2508. e.push(en(t))
  2509. })), i.push(e)
  2510. }));
  2511. break;
  2512. case "Point":
  2513. return t;
  2514. case "MultiPoint":
  2515. var s = {};
  2516. Q(t).forEach((function (t) {
  2517. var e = t.join("-");
  2518. Object.prototype.hasOwnProperty.call(s, e) || (i.push(t), s[e] = !0)
  2519. }));
  2520. break;
  2521. default:
  2522. throw new Error(r + " geometry not supported")
  2523. }
  2524. return t.coordinates ? !0 === n ? (t.coordinates = i, t) : {
  2525. type: r,
  2526. coordinates: i
  2527. } : !0 === n ? (t.geometry.coordinates = i, t) : o({
  2528. type: r,
  2529. coordinates: i
  2530. }, t.properties, {
  2531. bbox: t.bbox,
  2532. id: t.id
  2533. })
  2534. }
  2535. function en(t) {
  2536. var e = Q(t);
  2537. if (2 === e.length && !nn(e[0], e[1])) return e;
  2538. var n = [],
  2539. r = e.length - 1,
  2540. i = n.length;
  2541. n.push(e[0]);
  2542. for (var o = 1; o < r; o++) {
  2543. var s = n[n.length - 1];
  2544. e[o][0] === s[0] && e[o][1] === s[1] || (n.push(e[o]), (i = n.length) > 2 && rn(n[i - 3], n[i - 1], n[i - 2]) && n.splice(n.length - 2, 1))
  2545. }
  2546. if (n.push(e[e.length - 1]), i = n.length, nn(e[0], e[e.length - 1]) && i < 4) throw new Error("invalid polygon");
  2547. return rn(n[i - 3], n[i - 1], n[i - 2]) && n.splice(n.length - 2, 1), n
  2548. }
  2549. function nn(t, e) {
  2550. return t[0] === e[0] && t[1] === e[1]
  2551. }
  2552. function rn(t, e, n) {
  2553. var r = n[0],
  2554. i = n[1],
  2555. o = t[0],
  2556. s = t[1],
  2557. a = e[0],
  2558. u = e[1],
  2559. l = a - o,
  2560. c = u - s;
  2561. return 0 === (r - o) * c - (i - s) * l && (Math.abs(l) >= Math.abs(c) ? l > 0 ? o <= r && r <= a : a <= r && r <= o : c > 0 ? s <= i && i <= u : u <= i && i <= s)
  2562. }
  2563. function on(t, e, n) {
  2564. var r = e.x,
  2565. i = e.y,
  2566. o = n.x - r,
  2567. s = n.y - i;
  2568. if (0 !== o || 0 !== s) {
  2569. var a = ((t.x - r) * o + (t.y - i) * s) / (o * o + s * s);
  2570. a > 1 ? (r = n.x, i = n.y) : a > 0 && (r += o * a, i += s * a)
  2571. }
  2572. return (o = t.x - r) * o + (s = t.y - i) * s
  2573. }
  2574. function sn(t, e, n, r, i) {
  2575. for (var o, s = r, a = e + 1; a < n; a++) {
  2576. var u = on(t[a], t[e], t[n]);
  2577. u > s && (o = a, s = u)
  2578. }
  2579. s > r && (o - e > 1 && sn(t, e, o, r, i), i.push(t[o]), n - o > 1 && sn(t, o, n, r, i))
  2580. }
  2581. function an(t, e) {
  2582. var n = t.length - 1,
  2583. r = [t[0]];
  2584. return sn(t, 0, n, e, r), r.push(t[n]), r
  2585. }
  2586. function un(t, e, n) {
  2587. if (t.length <= 2) return t;
  2588. var r = void 0 !== e ? e * e : 1;
  2589. return t = an(t = n ? t : function (t, e) {
  2590. for (var n, r, i, o, s, a = t[0], u = [a], l = 1, c = t.length; l < c; l++) n = t[l], i = a, o = void 0, s = void 0, o = (r = n).x - i.x, s = r.y - i.y, o * o + s * s > e && (u.push(n), a = n);
  2591. return a !== n && u.push(n), u
  2592. }(t, r), r)
  2593. }
  2594. function ln(t, e, n) {
  2595. return un(t.map((function (t) {
  2596. return {
  2597. x: t[0],
  2598. y: t[1],
  2599. z: t[2]
  2600. }
  2601. })), e, n).map((function (t) {
  2602. return t.z ? [t.x, t.y, t.z] : [t.x, t.y]
  2603. }))
  2604. }
  2605. function cn(t, e, n) {
  2606. return t.map((function (t) {
  2607. var r = t.map((function (t) {
  2608. return {
  2609. x: t[0],
  2610. y: t[1]
  2611. }
  2612. }));
  2613. if (r.length < 4) throw new Error("invalid polygon");
  2614. for (var i = un(r, e, n).map((function (t) {
  2615. return [t.x, t.y]
  2616. })); !hn(i);) i = un(r, e -= .01 * e, n).map((function (t) {
  2617. return [t.x, t.y]
  2618. }));
  2619. return i[i.length - 1][0] === i[0][0] && i[i.length - 1][1] === i[0][1] || i.push(i[0]), i
  2620. }))
  2621. }
  2622. function hn(t) {
  2623. return !(t.length < 3) && !(3 === t.length && t[2][0] === t[0][0] && t[2][1] === t[0][1])
  2624. }
  2625. var pn = function () {
  2626. function t(t) {
  2627. this.points = t.points || [], this.duration = t.duration || 1e4, this.sharpness = t.sharpness || .85, this.centers = [], this.controls = [], this.stepLength = t.stepLength || 60, this.length = this.points.length, this.delay = 0;
  2628. for (var e = 0; e < this.length; e++) this.points[e].z = this.points[e].z || 0;
  2629. for (e = 0; e < this.length - 1; e++) {
  2630. var n = this.points[e],
  2631. r = this.points[e + 1];
  2632. this.centers.push({
  2633. x: (n.x + r.x) / 2,
  2634. y: (n.y + r.y) / 2,
  2635. z: (n.z + r.z) / 2
  2636. })
  2637. }
  2638. this.controls.push([this.points[0], this.points[0]]);
  2639. for (e = 0; e < this.centers.length - 1; e++) {
  2640. var i = this.points[e + 1].x - (this.centers[e].x + this.centers[e + 1].x) / 2,
  2641. o = this.points[e + 1].y - (this.centers[e].y + this.centers[e + 1].y) / 2,
  2642. s = this.points[e + 1].z - (this.centers[e].y + this.centers[e + 1].z) / 2;
  2643. this.controls.push([{
  2644. x: (1 - this.sharpness) * this.points[e + 1].x + this.sharpness * (this.centers[e].x + i),
  2645. y: (1 - this.sharpness) * this.points[e + 1].y + this.sharpness * (this.centers[e].y + o),
  2646. z: (1 - this.sharpness) * this.points[e + 1].z + this.sharpness * (this.centers[e].z + s)
  2647. }, {
  2648. x: (1 - this.sharpness) * this.points[e + 1].x + this.sharpness * (this.centers[e + 1].x + i),
  2649. y: (1 - this.sharpness) * this.points[e + 1].y + this.sharpness * (this.centers[e + 1].y + o),
  2650. z: (1 - this.sharpness) * this.points[e + 1].z + this.sharpness * (this.centers[e + 1].z + s)
  2651. }])
  2652. }
  2653. return this.controls.push([this.points[this.length - 1], this.points[this.length - 1]]), this.steps = this.cacheSteps(this.stepLength), this
  2654. }
  2655. return t.prototype.cacheSteps = function (t) {
  2656. var e = [],
  2657. n = this.pos(0);
  2658. e.push(0);
  2659. for (var r = 0; r < this.duration; r += 10) {
  2660. var i = this.pos(r);
  2661. Math.sqrt((i.x - n.x) * (i.x - n.x) + (i.y - n.y) * (i.y - n.y) + (i.z - n.z) * (i.z - n.z)) > t && (e.push(r), n = i)
  2662. }
  2663. return e
  2664. }, t.prototype.vector = function (t) {
  2665. var e = this.pos(t + 10),
  2666. n = this.pos(t - 10);
  2667. return {
  2668. angle: 180 * Math.atan2(e.y - n.y, e.x - n.x) / 3.14,
  2669. speed: Math.sqrt((n.x - e.x) * (n.x - e.x) + (n.y - e.y) * (n.y - e.y) + (n.z - e.z) * (n.z - e.z))
  2670. }
  2671. }, t.prototype.pos = function (t) {
  2672. var e = t - this.delay;
  2673. e < 0 && (e = 0), e > this.duration && (e = this.duration - 1);
  2674. var n = e / this.duration;
  2675. if (n >= 1) return this.points[this.length - 1];
  2676. var r = Math.floor((this.points.length - 1) * n);
  2677. return function (t, e, n, r, i) {
  2678. var o = function (t) {
  2679. var e = t * t;
  2680. return [e * t, 3 * e * (1 - t), 3 * t * (1 - t) * (1 - t), (1 - t) * (1 - t) * (1 - t)]
  2681. }(t);
  2682. return {
  2683. x: i.x * o[0] + r.x * o[1] + n.x * o[2] + e.x * o[3],
  2684. y: i.y * o[0] + r.y * o[1] + n.y * o[2] + e.y * o[3],
  2685. z: i.z * o[0] + r.z * o[1] + n.z * o[2] + e.z * o[3]
  2686. }
  2687. }((this.length - 1) * n - r, this.points[r], this.controls[r][1], this.controls[r + 1][0], this.points[r + 1])
  2688. }, t
  2689. }();
  2690. function fn(t, e) {
  2691. void 0 === e && (e = {});
  2692. for (var n = e.resolution || 1e4, r = e.sharpness || .85, i = [], o = rt(t).coordinates.map((function (t) {
  2693. return {
  2694. x: t[0],
  2695. y: t[1]
  2696. }
  2697. })), s = new pn({
  2698. duration: n,
  2699. points: o,
  2700. sharpness: r
  2701. }), a = function (t) {
  2702. var e = s.pos(t);
  2703. Math.floor(t / 100) % 2 == 0 && i.push([e.x, e.y])
  2704. }, u = 0; u < s.duration; u += 10) a(u);
  2705. return a(s.duration), h(i, e.properties)
  2706. }
  2707. function gn(t, e) {
  2708. void 0 === e && (e = {});
  2709. var n = Number(t[0]),
  2710. r = Number(t[1]),
  2711. i = Number(t[2]),
  2712. o = Number(t[3]);
  2713. if (6 === t.length) throw new Error("@BMturf/bbox-polygon does not support BBox with 6 positions");
  2714. var s = [n, r];
  2715. return l([
  2716. [s, [i, r],
  2717. [i, o],
  2718. [n, o], s
  2719. ]
  2720. ], e.properties, {
  2721. bbox: t,
  2722. id: e.id
  2723. })
  2724. }
  2725. function dn(t) {
  2726. return gn(Z(t))
  2727. }
  2728. function yn(t) {
  2729. var e = t[0],
  2730. n = t[1],
  2731. r = t[2],
  2732. i = t[3];
  2733. if (me(t.slice(0, 2), [r, n]) >= me(t.slice(0, 2), [e, i])) {
  2734. var o = (n + i) / 2;
  2735. return [e, o - (r - e) / 2, r, o + (r - e) / 2]
  2736. }
  2737. var s = (e + r) / 2;
  2738. return [s - (i - n) / 2, n, s + (i - n) / 2, i]
  2739. }
  2740. function vn(t, e, n, r) {
  2741. void 0 === r && (r = {});
  2742. var i = K(t),
  2743. o = I(i[0]),
  2744. s = I(i[1]),
  2745. u = I(n),
  2746. l = x(e, r.units),
  2747. c = Math.asin(Math.sin(s) * Math.cos(l) + Math.cos(s) * Math.sin(l) * Math.cos(u));
  2748. return a([w(o + Math.atan2(Math.sin(u) * Math.sin(l) * Math.cos(s), Math.cos(l) - Math.sin(s) * Math.sin(c))), w(c)], r.properties)
  2749. }
  2750. function _n(t, e, n) {
  2751. void 0 === n && (n = {});
  2752. for (var r = n.steps || 64, i = n.properties ? n.properties : !Array.isArray(t) && "Feature" === t.type && t.properties ? t.properties : {}, o = [], s = 0; s < r; s++) o.push(vn(t, e, -360 * s / r, n).geometry.coordinates);
  2753. return o.push(o[0]), l([o], i)
  2754. }
  2755. function mn(t, e, n) {
  2756. if (void 0 === n && (n = {}), !0 === n.final) return function (t, e) {
  2757. var n = mn(e, t);
  2758. return n = (n + 180) % 360
  2759. }(t, e);
  2760. var r = K(t),
  2761. i = K(e),
  2762. o = I(r[0]),
  2763. s = I(i[0]),
  2764. a = I(r[1]),
  2765. u = I(i[1]),
  2766. l = Math.sin(s - o) * Math.cos(u),
  2767. c = Math.cos(a) * Math.sin(u) - Math.sin(a) * Math.cos(u) * Math.cos(s - o);
  2768. return w(Math.atan2(l, c))
  2769. }
  2770. function xn(t, e) {
  2771. void 0 === e && (e = {});
  2772. var n = Z(t);
  2773. return a([(n[0] + n[2]) / 2, (n[1] + n[3]) / 2], e.properties, e)
  2774. }
  2775. function En(t, e) {
  2776. void 0 === e && (e = {});
  2777. var n = 0,
  2778. r = 0,
  2779. i = 0;
  2780. return R(t, (function (t) {
  2781. n += t[0], r += t[1], i++
  2782. }), !0), a([n / i, r / i], e.properties)
  2783. }
  2784. function bn(t) {
  2785. var e = [];
  2786. return "FeatureCollection" === t.type ? F(t, (function (t) {
  2787. R(t, (function (n) {
  2788. e.push(a(n, t.properties))
  2789. }))
  2790. })) : R(t, (function (n) {
  2791. e.push(a(n, t.properties))
  2792. })), f(e)
  2793. }
  2794. var wn = Nn,
  2795. In = Nn;
  2796. function Nn(t, e, n) {
  2797. n = n || 2;
  2798. var r, i, o, s, a, u, l, c = e && e.length,
  2799. h = c ? e[0] * n : t.length,
  2800. p = Sn(t, 0, h, n, !0),
  2801. f = [];
  2802. if (!p) return f;
  2803. if (c && (p = function (t, e, n, r) {
  2804. var i, o, s, a = [];
  2805. for (i = 0, o = e.length; i < o; i++)(s = Sn(t, e[i] * r, i < o - 1 ? e[i + 1] * r : t.length, r, !1)) === s.next && (s.steiner = !0), a.push(Fn(s));
  2806. for (a.sort(Tn), i = 0; i < a.length; i++) An(a[i], n), n = Cn(n, n.next);
  2807. return n
  2808. }(t, e, p, n)), t.length > 80 * n) {
  2809. r = o = t[0], i = s = t[1];
  2810. for (var g = n; g < h; g += n)(a = t[g]) < r && (r = a), (u = t[g + 1]) < i && (i = u), a > o && (o = a), u > s && (s = u);
  2811. l = 0 !== (l = Math.max(o - r, s - i)) ? 1 / l : 0
  2812. }
  2813. return Pn(p, f, n, r, i, l), f
  2814. }
  2815. function Sn(t, e, n, r, i) {
  2816. var o, s;
  2817. if (i === Hn(t, e, n, r) > 0)
  2818. for (o = e; o < n; o += r) s = Vn(o, t[o], t[o + 1], s);
  2819. else
  2820. for (o = n - r; o >= e; o -= r) s = Vn(o, t[o], t[o + 1], s);
  2821. return s && Bn(s, s.next) && (Xn(s), s = s.next), s
  2822. }
  2823. function Cn(t, e) {
  2824. if (!t) return t;
  2825. e || (e = t);
  2826. var n, r = t;
  2827. do {
  2828. if (n = !1, r.steiner || !Bn(r, r.next) && 0 !== qn(r.prev, r, r.next)) r = r.next;
  2829. else {
  2830. if (Xn(r), (r = e = r.prev) === r.next) break;
  2831. n = !0
  2832. }
  2833. } while (n || r !== e);
  2834. return e
  2835. }
  2836. function Pn(t, e, n, r, i, o, s) {
  2837. if (t) {
  2838. !s && o && function (t, e, n, r) {
  2839. var i = t;
  2840. do {
  2841. null === i.z && (i.z = Dn(i.x, i.y, e, n, r)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next
  2842. } while (i !== t);
  2843. i.prevZ.nextZ = null, i.prevZ = null,
  2844. function (t) {
  2845. var e, n, r, i, o, s, a, u, l = 1;
  2846. do {
  2847. for (n = t, t = null, o = null, s = 0; n;) {
  2848. for (s++, r = n, a = 0, e = 0; e < l && (a++, r = r.nextZ); e++);
  2849. for (u = l; a > 0 || u > 0 && r;) 0 !== a && (0 === u || !r || n.z <= r.z) ? (i = n, n = n.nextZ, a--) : (i = r, r = r.nextZ, u--), o ? o.nextZ = i : t = i, i.prevZ = o, o = i;
  2850. n = r
  2851. }
  2852. o.nextZ = null, l *= 2
  2853. } while (s > 1)
  2854. }(i)
  2855. }(t, r, i, o);
  2856. for (var a, u, l = t; t.prev !== t.next;)
  2857. if (a = t.prev, u = t.next, o ? Ln(t, r, i, o) : Mn(t)) e.push(a.i / n), e.push(t.i / n), e.push(u.i / n), Xn(t), t = u.next, l = u.next;
  2858. else if ((t = u) === l) {
  2859. s ? 1 === s ? Pn(t = On(t, e, n), e, n, r, i, o, 2) : 2 === s && Rn(t, e, n, r, i, o) : Pn(Cn(t), e, n, r, i, o, 1);
  2860. break
  2861. }
  2862. }
  2863. }
  2864. function Mn(t) {
  2865. var e = t.prev,
  2866. n = t,
  2867. r = t.next;
  2868. if (qn(e, n, r) >= 0) return !1;
  2869. for (var i = t.next.next; i !== t.prev;) {
  2870. if (kn(e.x, e.y, n.x, n.y, r.x, r.y, i.x, i.y) && qn(i.prev, i, i.next) >= 0) return !1;
  2871. i = i.next
  2872. }
  2873. return !0
  2874. }
  2875. function Ln(t, e, n, r) {
  2876. var i = t.prev,
  2877. o = t,
  2878. s = t.next;
  2879. if (qn(i, o, s) >= 0) return !1;
  2880. for (var a = i.x < o.x ? i.x < s.x ? i.x : s.x : o.x < s.x ? o.x : s.x, u = i.y < o.y ? i.y < s.y ? i.y : s.y : o.y < s.y ? o.y : s.y, l = i.x > o.x ? i.x > s.x ? i.x : s.x : o.x > s.x ? o.x : s.x, c = i.y > o.y ? i.y > s.y ? i.y : s.y : o.y > s.y ? o.y : s.y, h = Dn(a, u, e, n, r), p = Dn(l, c, e, n, r), f = t.prevZ, g = t.nextZ; f && f.z >= h && g && g.z <= p;) {
  2881. if (f !== t.prev && f !== t.next && kn(i.x, i.y, o.x, o.y, s.x, s.y, f.x, f.y) && qn(f.prev, f, f.next) >= 0) return !1;
  2882. if (f = f.prevZ, g !== t.prev && g !== t.next && kn(i.x, i.y, o.x, o.y, s.x, s.y, g.x, g.y) && qn(g.prev, g, g.next) >= 0) return !1;
  2883. g = g.nextZ
  2884. }
  2885. for (; f && f.z >= h;) {
  2886. if (f !== t.prev && f !== t.next && kn(i.x, i.y, o.x, o.y, s.x, s.y, f.x, f.y) && qn(f.prev, f, f.next) >= 0) return !1;
  2887. f = f.prevZ
  2888. }
  2889. for (; g && g.z <= p;) {
  2890. if (g !== t.prev && g !== t.next && kn(i.x, i.y, o.x, o.y, s.x, s.y, g.x, g.y) && qn(g.prev, g, g.next) >= 0) return !1;
  2891. g = g.nextZ
  2892. }
  2893. return !0
  2894. }
  2895. function On(t, e, n) {
  2896. var r = t;
  2897. do {
  2898. var i = r.prev,
  2899. o = r.next.next;
  2900. !Bn(i, o) && zn(i, r, r.next, o) && jn(i, o) && jn(o, i) && (e.push(i.i / n), e.push(r.i / n), e.push(o.i / n), Xn(r), Xn(r.next), r = t = o), r = r.next
  2901. } while (r !== t);
  2902. return r
  2903. }
  2904. function Rn(t, e, n, r, i, o) {
  2905. var s = t;
  2906. do {
  2907. for (var a = s.next.next; a !== s.prev;) {
  2908. if (s.i !== a.i && Gn(s, a)) {
  2909. var u = Un(s, a);
  2910. return s = Cn(s, s.next), u = Cn(u, u.next), Pn(s, e, n, r, i, o), void Pn(u, e, n, r, i, o)
  2911. }
  2912. a = a.next
  2913. }
  2914. s = s.next
  2915. } while (s !== t)
  2916. }
  2917. function Tn(t, e) {
  2918. return t.x - e.x
  2919. }
  2920. function An(t, e) {
  2921. if (e = function (t, e) {
  2922. var n, r = e,
  2923. i = t.x,
  2924. o = t.y,
  2925. s = -1 / 0;
  2926. do {
  2927. if (o <= r.y && o >= r.next.y && r.next.y !== r.y) {
  2928. var a = r.x + (o - r.y) * (r.next.x - r.x) / (r.next.y - r.y);
  2929. if (a <= i && a > s) {
  2930. if (s = a, a === i) {
  2931. if (o === r.y) return r;
  2932. if (o === r.next.y) return r.next
  2933. }
  2934. n = r.x < r.next.x ? r : r.next
  2935. }
  2936. }
  2937. r = r.next
  2938. } while (r !== e);
  2939. if (!n) return null;
  2940. if (i === s) return n.prev;
  2941. var u, l = n,
  2942. c = n.x,
  2943. h = n.y,
  2944. p = 1 / 0;
  2945. r = n.next;
  2946. for (; r !== l;) i >= r.x && r.x >= c && i !== r.x && kn(o < h ? i : s, o, c, h, o < h ? s : i, o, r.x, r.y) && ((u = Math.abs(o - r.y) / (i - r.x)) < p || u === p && r.x > n.x) && jn(r, t) && (n = r, p = u), r = r.next;
  2947. return n
  2948. }(t, e)) {
  2949. var n = Un(e, t);
  2950. Cn(n, n.next)
  2951. }
  2952. }
  2953. function Dn(t, e, n, r, i) {
  2954. return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - n) * i) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - r) * i) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1
  2955. }
  2956. function Fn(t) {
  2957. var e = t,
  2958. n = t;
  2959. do {
  2960. e.x < n.x && (n = e), e = e.next
  2961. } while (e !== t);
  2962. return n
  2963. }
  2964. function kn(t, e, n, r, i, o, s, a) {
  2965. return (i - s) * (e - a) - (t - s) * (o - a) >= 0 && (t - s) * (r - a) - (n - s) * (e - a) >= 0 && (n - s) * (o - a) - (i - s) * (r - a) >= 0
  2966. }
  2967. function Gn(t, e) {
  2968. return t.next.i !== e.i && t.prev.i !== e.i && ! function (t, e) {
  2969. var n = t;
  2970. do {
  2971. if (n.i !== t.i && n.next.i !== t.i && n.i !== e.i && n.next.i !== e.i && zn(n, n.next, t, e)) return !0;
  2972. n = n.next
  2973. } while (n !== t);
  2974. return !1
  2975. }(t, e) && jn(t, e) && jn(e, t) && function (t, e) {
  2976. var n = t,
  2977. r = !1,
  2978. i = (t.x + e.x) / 2,
  2979. o = (t.y + e.y) / 2;
  2980. do {
  2981. n.y > o != n.next.y > o && n.next.y !== n.y && i < (n.next.x - n.x) * (o - n.y) / (n.next.y - n.y) + n.x && (r = !r), n = n.next
  2982. } while (n !== t);
  2983. return r
  2984. }(t, e)
  2985. }
  2986. function qn(t, e, n) {
  2987. return (e.y - t.y) * (n.x - e.x) - (e.x - t.x) * (n.y - e.y)
  2988. }
  2989. function Bn(t, e) {
  2990. return t.x === e.x && t.y === e.y
  2991. }
  2992. function zn(t, e, n, r) {
  2993. return !!(Bn(t, e) && Bn(n, r) || Bn(t, r) && Bn(n, e)) || qn(t, e, n) > 0 != qn(t, e, r) > 0 && qn(n, r, t) > 0 != qn(n, r, e) > 0
  2994. }
  2995. function jn(t, e) {
  2996. return qn(t.prev, t, t.next) < 0 ? qn(t, e, t.next) >= 0 && qn(t, t.prev, e) >= 0 : qn(t, e, t.prev) < 0 || qn(t, t.next, e) < 0
  2997. }
  2998. function Un(t, e) {
  2999. var n = new Yn(t.i, t.x, t.y),
  3000. r = new Yn(e.i, e.x, e.y),
  3001. i = t.next,
  3002. o = e.prev;
  3003. return t.next = e, e.prev = t, n.next = i, i.prev = n, r.next = n, n.prev = r, o.next = r, r.prev = o, r
  3004. }
  3005. function Vn(t, e, n, r) {
  3006. var i = new Yn(t, e, n);
  3007. return r ? (i.next = r.next, i.prev = r, r.next.prev = i, r.next = i) : (i.prev = i, i.next = i), i
  3008. }
  3009. function Xn(t) {
  3010. t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ)
  3011. }
  3012. function Yn(t, e, n) {
  3013. this.i = t, this.x = e, this.y = n, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1
  3014. }
  3015. function Hn(t, e, n, r) {
  3016. for (var i = 0, o = e, s = n - r; o < n; o += r) i += (t[s] - t[o]) * (t[o + 1] + t[s + 1]), s = o;
  3017. return i
  3018. }
  3019. function Wn(t) {
  3020. var e = function (t) {
  3021. for (var e = t[0][0].length, n = {
  3022. vertices: [],
  3023. holes: [],
  3024. dimensions: e
  3025. }, r = 0, i = 0; i < t.length; i++) {
  3026. for (var o = 0; o < t[i].length; o++)
  3027. for (var s = 0; s < e; s++) n.vertices.push(t[i][o][s]);
  3028. i > 0 && (r += t[i - 1].length, n.holes.push(r))
  3029. }
  3030. return n
  3031. }(t),
  3032. n = wn(e.vertices, e.holes, 2),
  3033. r = [],
  3034. i = [];
  3035. n.forEach((function (t, r) {
  3036. var o = n[r];
  3037. i.push([e.vertices[2 * o], e.vertices[2 * o + 1]])
  3038. }));
  3039. for (var o = 0; o < i.length; o += 3) {
  3040. var s = i.slice(o, o + 3);
  3041. s.push(i[o]), r.push(l([s]))
  3042. }
  3043. return r
  3044. }
  3045. function Jn(t, e) {
  3046. if (!t) throw new Error("targetPoint is required");
  3047. if (!e) throw new Error("points is required");
  3048. var n, r = 1 / 0,
  3049. i = 0;
  3050. return F(e, (function (e, n) {
  3051. var o = me(t, e);
  3052. o < r && (i = n, r = o)
  3053. })), (n = Ie(e.features[i])).properties.featureIndex = i, n.properties.distanceToPoint = r, n
  3054. }
  3055. function Zn(t) {
  3056. if (!t) throw new Error("geojson is required");
  3057. var e = [];
  3058. return z(t, (function (t) {
  3059. ! function (t, e) {
  3060. var n = [],
  3061. r = t.geometry;
  3062. if (null !== r) {
  3063. switch (r.type) {
  3064. case "Polygon":
  3065. n = Q(r);
  3066. break;
  3067. case "LineString":
  3068. n = [Q(r)]
  3069. }
  3070. n.forEach((function (n) {
  3071. (function (t, e) {
  3072. var n = [];
  3073. return t.reduce((function (t, r) {
  3074. var i = h([t, r], e);
  3075. return i.bbox = function (t, e) {
  3076. var n = t[0],
  3077. r = t[1],
  3078. i = e[0],
  3079. o = e[1];
  3080. return [n < i ? n : i, r < o ? r : o, n > i ? n : i, r > o ? r : o]
  3081. }(t, r), n.push(i), r
  3082. })), n
  3083. })(n, t.properties).forEach((function (t) {
  3084. t.id = e.length, e.push(t)
  3085. }))
  3086. }))
  3087. }
  3088. }(t, e)
  3089. })), f(e)
  3090. }
  3091. Nn.deviation = function (t, e, n, r) {
  3092. var i = e && e.length,
  3093. o = i ? e[0] * n : t.length,
  3094. s = Math.abs(Hn(t, 0, o, n));
  3095. if (i)
  3096. for (var a = 0, u = e.length; a < u; a++) {
  3097. var l = e[a] * n,
  3098. c = a < u - 1 ? e[a + 1] * n : t.length;
  3099. s -= Math.abs(Hn(t, l, c, n))
  3100. }
  3101. var h = 0;
  3102. for (a = 0; a < r.length; a += 3) {
  3103. var p = r[a] * n,
  3104. f = r[a + 1] * n,
  3105. g = r[a + 2] * n;
  3106. h += Math.abs((t[p] - t[g]) * (t[f + 1] - t[p + 1]) - (t[p] - t[f]) * (t[g + 1] - t[p + 1]))
  3107. }
  3108. return 0 === s && 0 === h ? 0 : Math.abs((h - s) / s)
  3109. }, Nn.flatten = function (t) {
  3110. for (var e = t[0][0].length, n = {
  3111. vertices: [],
  3112. holes: [],
  3113. dimensions: e
  3114. }, r = 0, i = 0; i < t.length; i++) {
  3115. for (var o = 0; o < t[i].length; o++)
  3116. for (var s = 0; s < e; s++) n.vertices.push(t[i][o][s]);
  3117. i > 0 && (r += t[i - 1].length, n.holes.push(r))
  3118. }
  3119. return n
  3120. }, wn.default = In;
  3121. var Kn = Bt((function (t, e) {
  3122. function n(t, e, n) {
  3123. void 0 === n && (n = {});
  3124. var r = {
  3125. type: "Feature"
  3126. };
  3127. return (0 === n.id || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = e || {}, r.geometry = t, r
  3128. }
  3129. function r(t, e, r) {
  3130. if (void 0 === r && (r = {}), !t) throw new Error("coordinates is required");
  3131. if (!Array.isArray(t)) throw new Error("coordinates must be an Array");
  3132. if (t.length < 2) throw new Error("coordinates must be at least 2 numbers long");
  3133. if (!f(t[0]) || !f(t[1])) throw new Error("coordinates must contain numbers");
  3134. return n({
  3135. type: "Point",
  3136. coordinates: t
  3137. }, e, r)
  3138. }
  3139. function i(t, e, r) {
  3140. void 0 === r && (r = {});
  3141. for (var i = 0, o = t; i < o.length; i++) {
  3142. var s = o[i];
  3143. if (s.length < 4) throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
  3144. for (var a = 0; a < s[s.length - 1].length; a++)
  3145. if (s[s.length - 1][a] !== s[0][a]) throw new Error("First and last Position are not equivalent.")
  3146. }
  3147. return n({
  3148. type: "Polygon",
  3149. coordinates: t
  3150. }, e, r)
  3151. }
  3152. function o(t, e, r) {
  3153. if (void 0 === r && (r = {}), t.length < 2) throw new Error("coordinates must be an array of two or more positions");
  3154. return n({
  3155. type: "LineString",
  3156. coordinates: t
  3157. }, e, r)
  3158. }
  3159. function s(t, e) {
  3160. void 0 === e && (e = {});
  3161. var n = {
  3162. type: "FeatureCollection"
  3163. };
  3164. return e.id && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.features = t, n
  3165. }
  3166. function a(t, e, r) {
  3167. return void 0 === r && (r = {}), n({
  3168. type: "MultiLineString",
  3169. coordinates: t
  3170. }, e, r)
  3171. }
  3172. function u(t, e, r) {
  3173. return void 0 === r && (r = {}), n({
  3174. type: "MultiPoint",
  3175. coordinates: t
  3176. }, e, r)
  3177. }
  3178. function l(t, e, r) {
  3179. return void 0 === r && (r = {}), n({
  3180. type: "MultiPolygon",
  3181. coordinates: t
  3182. }, e, r)
  3183. }
  3184. function c(t, n) {
  3185. void 0 === n && (n = "kilometers");
  3186. var r = e.factors[n];
  3187. if (!r) throw new Error(n + " units is invalid");
  3188. return t * r
  3189. }
  3190. function h(t, n) {
  3191. void 0 === n && (n = "kilometers");
  3192. var r = e.factors[n];
  3193. if (!r) throw new Error(n + " units is invalid");
  3194. return t / r
  3195. }
  3196. function p(t) {
  3197. return 180 * (t % (2 * Math.PI)) / Math.PI
  3198. }
  3199. function f(t) {
  3200. return !isNaN(t) && null !== t && !Array.isArray(t)
  3201. }
  3202. Object.defineProperty(e, "__esModule", {
  3203. value: !0
  3204. }), e.earthRadius = 6371008.8, e.factors = {
  3205. centimeters: 100 * e.earthRadius,
  3206. centimetres: 100 * e.earthRadius,
  3207. degrees: e.earthRadius / 111325,
  3208. feet: 3.28084 * e.earthRadius,
  3209. inches: 39.37 * e.earthRadius,
  3210. kilometers: e.earthRadius / 1e3,
  3211. kilometres: e.earthRadius / 1e3,
  3212. meters: e.earthRadius,
  3213. metres: e.earthRadius,
  3214. miles: e.earthRadius / 1609.344,
  3215. millimeters: 1e3 * e.earthRadius,
  3216. millimetres: 1e3 * e.earthRadius,
  3217. nauticalmiles: e.earthRadius / 1852,
  3218. radians: 1,
  3219. yards: 1.0936 * e.earthRadius
  3220. }, e.unitsFactors = {
  3221. centimeters: 100,
  3222. centimetres: 100,
  3223. degrees: 1 / 111325,
  3224. feet: 3.28084,
  3225. inches: 39.37,
  3226. kilometers: .001,
  3227. kilometres: .001,
  3228. meters: 1,
  3229. metres: 1,
  3230. miles: 1 / 1609.344,
  3231. millimeters: 1e3,
  3232. millimetres: 1e3,
  3233. nauticalmiles: 1 / 1852,
  3234. radians: 1 / e.earthRadius,
  3235. yards: 1.0936133
  3236. }, e.areaFactors = {
  3237. acres: 247105e-9,
  3238. centimeters: 1e4,
  3239. centimetres: 1e4,
  3240. feet: 10.763910417,
  3241. hectares: 1e-4,
  3242. inches: 1550.003100006,
  3243. kilometers: 1e-6,
  3244. kilometres: 1e-6,
  3245. meters: 1,
  3246. metres: 1,
  3247. miles: 386e-9,
  3248. millimeters: 1e6,
  3249. millimetres: 1e6,
  3250. yards: 1.195990046
  3251. }, e.feature = n, e.geometry = function (t, e, n) {
  3252. switch (t) {
  3253. case "Point":
  3254. return r(e).geometry;
  3255. case "LineString":
  3256. return o(e).geometry;
  3257. case "Polygon":
  3258. return i(e).geometry;
  3259. case "MultiPoint":
  3260. return u(e).geometry;
  3261. case "MultiLineString":
  3262. return a(e).geometry;
  3263. case "MultiPolygon":
  3264. return l(e).geometry;
  3265. default:
  3266. throw new Error(t + " is invalid")
  3267. }
  3268. }, e.point = r, e.points = function (t, e, n) {
  3269. return void 0 === n && (n = {}), s(t.map((function (t) {
  3270. return r(t, e)
  3271. })), n)
  3272. }, e.polygon = i, e.polygons = function (t, e, n) {
  3273. return void 0 === n && (n = {}), s(t.map((function (t) {
  3274. return i(t, e)
  3275. })), n)
  3276. }, e.lineString = o, e.lineStrings = function (t, e, n) {
  3277. return void 0 === n && (n = {}), s(t.map((function (t) {
  3278. return o(t, e)
  3279. })), n)
  3280. }, e.featureCollection = s, e.multiLineString = a, e.multiPoint = u, e.multiPolygon = l, e.geometryCollection = function (t, e, r) {
  3281. return void 0 === r && (r = {}), n({
  3282. type: "GeometryCollection",
  3283. geometries: t
  3284. }, e, r)
  3285. }, e.round = function (t, e) {
  3286. if (void 0 === e && (e = 0), e && !(e >= 0)) throw new Error("precision must be a positive number");
  3287. var n = Math.pow(10, e || 0);
  3288. return Math.round(t * n) / n
  3289. }, e.radiansToLength = c, e.lengthToRadians = h, e.lengthToDegrees = function (t, e) {
  3290. return p(h(t, e))
  3291. }, e.bearingToAzimuth = function (t) {
  3292. var e = t % 360;
  3293. return e < 0 && (e += 360), e
  3294. }, e.radiansToDegrees = p, e.degreesToRadians = function (t) {
  3295. return t % 360 * Math.PI / 180
  3296. }, e.convertLength = function (t, e, n) {
  3297. if (void 0 === e && (e = "kilometers"), void 0 === n && (n = "kilometers"), !(t >= 0)) throw new Error("length must be a positive number");
  3298. return c(h(t, e), n)
  3299. }, e.convertArea = function (t, n, r) {
  3300. if (void 0 === n && (n = "meters"), void 0 === r && (r = "kilometers"), !(t >= 0)) throw new Error("area must be a positive number");
  3301. var i = e.areaFactors[n];
  3302. if (!i) throw new Error("invalid original units");
  3303. var o = e.areaFactors[r];
  3304. if (!o) throw new Error("invalid final units");
  3305. return t / i * o
  3306. }, e.isNumber = f, e.isObject = function (t) {
  3307. return !!t && t.constructor === Object
  3308. }, e.validateBBox = function (t) {
  3309. if (!t) throw new Error("bbox is required");
  3310. if (!Array.isArray(t)) throw new Error("bbox must be an Array");
  3311. if (4 !== t.length && 6 !== t.length) throw new Error("bbox must be an Array of 4 or 6 numbers");
  3312. t.forEach((function (t) {
  3313. if (!f(t)) throw new Error("bbox must only contain numbers")
  3314. }))
  3315. }, e.validateId = function (t) {
  3316. if (!t) throw new Error("id is required");
  3317. if (-1 === ["string", "number"].indexOf(typeof t)) throw new Error("id must be a number or a string")
  3318. }
  3319. }));
  3320. function Qn(t, e, n) {
  3321. if (null !== t)
  3322. for (var r, i, o, s, a, u, l, c, h = 0, p = 0, f = t.type, g = "FeatureCollection" === f, d = "Feature" === f, y = g ? t.features.length : 1, v = 0; v < y; v++) {
  3323. a = (c = !!(l = g ? t.features[v].geometry : d ? t.geometry : t) && "GeometryCollection" === l.type) ? l.geometries.length : 1;
  3324. for (var _ = 0; _ < a; _++) {
  3325. var m = 0,
  3326. x = 0;
  3327. if (null !== (s = c ? l.geometries[_] : l)) {
  3328. u = s.coordinates;
  3329. var E = s.type;
  3330. switch (h = !n || "Polygon" !== E && "MultiPolygon" !== E ? 0 : 1, E) {
  3331. case null:
  3332. break;
  3333. case "Point":
  3334. if (!1 === e(u, p, v, m, x)) return !1;
  3335. p++, m++;
  3336. break;
  3337. case "LineString":
  3338. case "MultiPoint":
  3339. for (r = 0; r < u.length; r++) {
  3340. if (!1 === e(u[r], p, v, m, x)) return !1;
  3341. p++, "MultiPoint" === E && m++
  3342. }
  3343. "LineString" === E && m++;
  3344. break;
  3345. case "Polygon":
  3346. case "MultiLineString":
  3347. for (r = 0; r < u.length; r++) {
  3348. for (i = 0; i < u[r].length - h; i++) {
  3349. if (!1 === e(u[r][i], p, v, m, x)) return !1;
  3350. p++
  3351. }
  3352. "MultiLineString" === E && m++, "Polygon" === E && x++
  3353. }
  3354. "Polygon" === E && m++;
  3355. break;
  3356. case "MultiPolygon":
  3357. for (r = 0; r < u.length; r++) {
  3358. for (x = 0, i = 0; i < u[r].length; i++) {
  3359. for (o = 0; o < u[r][i].length - h; o++) {
  3360. if (!1 === e(u[r][i][o], p, v, m, x)) return !1;
  3361. p++
  3362. }
  3363. x++
  3364. }
  3365. m++
  3366. }
  3367. break;
  3368. case "GeometryCollection":
  3369. for (r = 0; r < s.geometries.length; r++)
  3370. if (!1 === Qn(s.geometries[r], e, n)) return !1;
  3371. break;
  3372. default:
  3373. throw new Error("Unknown Geometry Type")
  3374. }
  3375. }
  3376. }
  3377. }
  3378. }
  3379. function $n(t, e) {
  3380. var n;
  3381. switch (t.type) {
  3382. case "FeatureCollection":
  3383. for (n = 0; n < t.features.length && !1 !== e(t.features[n].properties, n); n++);
  3384. break;
  3385. case "Feature":
  3386. e(t.properties, 0)
  3387. }
  3388. }
  3389. function tr(t, e) {
  3390. if ("Feature" === t.type) e(t, 0);
  3391. else if ("FeatureCollection" === t.type)
  3392. for (var n = 0; n < t.features.length && !1 !== e(t.features[n], n); n++);
  3393. }
  3394. function er(t, e) {
  3395. var n, r, i, o, s, a, u, l, c, h, p = 0,
  3396. f = "FeatureCollection" === t.type,
  3397. g = "Feature" === t.type,
  3398. d = f ? t.features.length : 1;
  3399. for (n = 0; n < d; n++) {
  3400. for (a = f ? t.features[n].geometry : g ? t.geometry : t, l = f ? t.features[n].properties : g ? t.properties : {}, c = f ? t.features[n].bbox : g ? t.bbox : void 0, h = f ? t.features[n].id : g ? t.id : void 0, s = (u = !!a && "GeometryCollection" === a.type) ? a.geometries.length : 1, i = 0; i < s; i++)
  3401. if (null !== (o = u ? a.geometries[i] : a)) switch (o.type) {
  3402. case "Point":
  3403. case "LineString":
  3404. case "MultiPoint":
  3405. case "Polygon":
  3406. case "MultiLineString":
  3407. case "MultiPolygon":
  3408. if (!1 === e(o, p, l, c, h)) return !1;
  3409. break;
  3410. case "GeometryCollection":
  3411. for (r = 0; r < o.geometries.length; r++)
  3412. if (!1 === e(o.geometries[r], p, l, c, h)) return !1;
  3413. break;
  3414. default:
  3415. throw new Error("Unknown Geometry Type")
  3416. } else if (!1 === e(null, p, l, c, h)) return !1;
  3417. p++
  3418. }
  3419. }
  3420. function nr(t, e) {
  3421. er(t, (function (t, n, r, i, o) {
  3422. var s, a = null === t ? null : t.type;
  3423. switch (a) {
  3424. case null:
  3425. case "Point":
  3426. case "LineString":
  3427. case "Polygon":
  3428. return !1 !== e(Kn.feature(t, r, {
  3429. bbox: i,
  3430. id: o
  3431. }), n, 0) && void 0
  3432. }
  3433. switch (a) {
  3434. case "MultiPoint":
  3435. s = "Point";
  3436. break;
  3437. case "MultiLineString":
  3438. s = "LineString";
  3439. break;
  3440. case "MultiPolygon":
  3441. s = "Polygon"
  3442. }
  3443. for (var u = 0; u < t.coordinates.length; u++) {
  3444. var l = {
  3445. type: s,
  3446. coordinates: t.coordinates[u]
  3447. };
  3448. if (!1 === e(Kn.feature(l, r), n, u)) return !1
  3449. }
  3450. }))
  3451. }
  3452. function rr(t, e) {
  3453. nr(t, (function (t, n, r) {
  3454. var i = 0;
  3455. if (t.geometry) {
  3456. var o = t.geometry.type;
  3457. if ("Point" !== o && "MultiPoint" !== o) {
  3458. var s, a = 0,
  3459. u = 0,
  3460. l = 0;
  3461. return !1 !== Qn(t, (function (o, c, h, p, f) {
  3462. if (void 0 === s || n > a || p > u || f > l) return s = o, a = n, u = p, l = f, void(i = 0);
  3463. var g = Kn.lineString([s, o], t.properties);
  3464. if (!1 === e(g, n, r, f, i)) return !1;
  3465. i++, s = o
  3466. })) && void 0
  3467. }
  3468. }
  3469. }))
  3470. }
  3471. function ir(t, e) {
  3472. if (!t) throw new Error("geojson is required");
  3473. nr(t, (function (t, n, r) {
  3474. if (null !== t.geometry) {
  3475. var i = t.geometry.type,
  3476. o = t.geometry.coordinates;
  3477. switch (i) {
  3478. case "LineString":
  3479. if (!1 === e(t, n, r, 0, 0)) return !1;
  3480. break;
  3481. case "Polygon":
  3482. for (var s = 0; s < o.length; s++)
  3483. if (!1 === e(Kn.lineString(o[s], t.properties), n, r, s)) return !1
  3484. }
  3485. }
  3486. }))
  3487. }
  3488. var or = function (t) {
  3489. var e = [];
  3490. return Qn(t, (function (t) {
  3491. e.push(t)
  3492. })), e
  3493. },
  3494. sr = Qn,
  3495. ar = function (t, e, n, r) {
  3496. var i = n;
  3497. return Qn(t, (function (t, r, o, s, a) {
  3498. i = 0 === r && void 0 === n ? t : e(i, t, r, o, s, a)
  3499. }), r), i
  3500. },
  3501. ur = tr,
  3502. lr = function (t, e, n) {
  3503. var r = n;
  3504. return tr(t, (function (t, i) {
  3505. r = 0 === i && void 0 === n ? t : e(r, t, i)
  3506. })), r
  3507. },
  3508. cr = function (t, e) {
  3509. if (e = e || {}, !Kn.isObject(e)) throw new Error("options is invalid");
  3510. var n, r = e.featureIndex || 0,
  3511. i = e.multiFeatureIndex || 0,
  3512. o = e.geometryIndex || 0,
  3513. s = e.coordIndex || 0,
  3514. a = e.properties;
  3515. switch (t.type) {
  3516. case "FeatureCollection":
  3517. r < 0 && (r = t.features.length + r), a = a || t.features[r].properties, n = t.features[r].geometry;
  3518. break;
  3519. case "Feature":
  3520. a = a || t.properties, n = t.geometry;
  3521. break;
  3522. case "Point":
  3523. case "MultiPoint":
  3524. return null;
  3525. case "LineString":
  3526. case "Polygon":
  3527. case "MultiLineString":
  3528. case "MultiPolygon":
  3529. n = t;
  3530. break;
  3531. default:
  3532. throw new Error("geojson is invalid")
  3533. }
  3534. if (null === n) return null;
  3535. var u = n.coordinates;
  3536. switch (n.type) {
  3537. case "Point":
  3538. return Kn.point(u, a, e);
  3539. case "MultiPoint":
  3540. return i < 0 && (i = u.length + i), Kn.point(u[i], a, e);
  3541. case "LineString":
  3542. return s < 0 && (s = u.length + s), Kn.point(u[s], a, e);
  3543. case "Polygon":
  3544. return o < 0 && (o = u.length + o), s < 0 && (s = u[o].length + s), Kn.point(u[o][s], a, e);
  3545. case "MultiLineString":
  3546. return i < 0 && (i = u.length + i), s < 0 && (s = u[i].length + s), Kn.point(u[i][s], a, e);
  3547. case "MultiPolygon":
  3548. return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), s < 0 && (s = u[i][o].length - s), Kn.point(u[i][o][s], a, e)
  3549. }
  3550. throw new Error("geojson is invalid")
  3551. },
  3552. hr = function (t, e) {
  3553. if (e = e || {}, !Kn.isObject(e)) throw new Error("options is invalid");
  3554. var n, r = e.featureIndex || 0,
  3555. i = e.multiFeatureIndex || 0,
  3556. o = e.geometryIndex || 0,
  3557. s = e.segmentIndex || 0,
  3558. a = e.properties;
  3559. switch (t.type) {
  3560. case "FeatureCollection":
  3561. r < 0 && (r = t.features.length + r), a = a || t.features[r].properties, n = t.features[r].geometry;
  3562. break;
  3563. case "Feature":
  3564. a = a || t.properties, n = t.geometry;
  3565. break;
  3566. case "Point":
  3567. case "MultiPoint":
  3568. return null;
  3569. case "LineString":
  3570. case "Polygon":
  3571. case "MultiLineString":
  3572. case "MultiPolygon":
  3573. n = t;
  3574. break;
  3575. default:
  3576. throw new Error("geojson is invalid")
  3577. }
  3578. if (null === n) return null;
  3579. var u = n.coordinates;
  3580. switch (n.type) {
  3581. case "Point":
  3582. case "MultiPoint":
  3583. return null;
  3584. case "LineString":
  3585. return s < 0 && (s = u.length + s - 1), Kn.lineString([u[s], u[s + 1]], a, e);
  3586. case "Polygon":
  3587. return o < 0 && (o = u.length + o), s < 0 && (s = u[o].length + s - 1), Kn.lineString([u[o][s], u[o][s + 1]], a, e);
  3588. case "MultiLineString":
  3589. return i < 0 && (i = u.length + i), s < 0 && (s = u[i].length + s - 1), Kn.lineString([u[i][s], u[i][s + 1]], a, e);
  3590. case "MultiPolygon":
  3591. return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), s < 0 && (s = u[i][o].length - s - 1), Kn.lineString([u[i][o][s], u[i][o][s + 1]], a, e)
  3592. }
  3593. throw new Error("geojson is invalid")
  3594. },
  3595. pr = nr,
  3596. fr = function (t, e, n) {
  3597. var r = n;
  3598. return nr(t, (function (t, i, o) {
  3599. r = 0 === i && 0 === o && void 0 === n ? t : e(r, t, i, o)
  3600. })), r
  3601. },
  3602. gr = er,
  3603. dr = function (t, e, n) {
  3604. var r = n;
  3605. return er(t, (function (t, i, o, s, a) {
  3606. r = 0 === i && void 0 === n ? t : e(r, t, i, o, s, a)
  3607. })), r
  3608. },
  3609. yr = ir,
  3610. vr = function (t, e, n) {
  3611. var r = n;
  3612. return ir(t, (function (t, i, o, s) {
  3613. r = 0 === i && void 0 === n ? t : e(r, t, i, o, s)
  3614. })), r
  3615. },
  3616. _r = $n,
  3617. mr = function (t, e, n) {
  3618. var r = n;
  3619. return $n(t, (function (t, i) {
  3620. r = 0 === i && void 0 === n ? t : e(r, t, i)
  3621. })), r
  3622. },
  3623. xr = rr,
  3624. Er = function (t, e, n) {
  3625. var r = n,
  3626. i = !1;
  3627. return rr(t, (function (t, o, s, a, u) {
  3628. r = !1 === i && void 0 === n ? t : e(r, t, o, s, a, u), i = !0
  3629. })), r
  3630. },
  3631. br = Object.defineProperty({
  3632. coordAll: or,
  3633. coordEach: sr,
  3634. coordReduce: ar,
  3635. featureEach: ur,
  3636. featureReduce: lr,
  3637. findPoint: cr,
  3638. findSegment: hr,
  3639. flattenEach: pr,
  3640. flattenReduce: fr,
  3641. geomEach: gr,
  3642. geomReduce: dr,
  3643. lineEach: yr,
  3644. lineReduce: vr,
  3645. propEach: _r,
  3646. propReduce: mr,
  3647. segmentEach: xr,
  3648. segmentReduce: Er
  3649. }, "__esModule", {
  3650. value: !0
  3651. });
  3652. function wr(t) {
  3653. var e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
  3654. return br.coordEach(t, (function (t) {
  3655. e[0] > t[0] && (e[0] = t[0]), e[1] > t[1] && (e[1] = t[1]), e[2] < t[0] && (e[2] = t[0]), e[3] < t[1] && (e[3] = t[1])
  3656. })), e
  3657. }
  3658. wr.default = wr;
  3659. var Ir = wr,
  3660. Nr = Object.defineProperty({
  3661. default: Ir
  3662. }, "__esModule", {
  3663. value: !0
  3664. }).default,
  3665. Sr = br.featureEach,
  3666. Cr = (br.coordEach, Kn.polygon, Kn.featureCollection);
  3667. function Pr(t) {
  3668. var e = Nt(t);
  3669. return e.insert = function (t) {
  3670. if ("Feature" !== t.type) throw new Error("invalid feature");
  3671. return t.bbox = t.bbox ? t.bbox : Nr(t), Nt.prototype.insert.call(this, t)
  3672. }, e.load = function (t) {
  3673. var e = [];
  3674. return Array.isArray(t) ? t.forEach((function (t) {
  3675. if ("Feature" !== t.type) throw new Error("invalid features");
  3676. t.bbox = t.bbox ? t.bbox : Nr(t), e.push(t)
  3677. })) : Sr(t, (function (t) {
  3678. if ("Feature" !== t.type) throw new Error("invalid features");
  3679. t.bbox = t.bbox ? t.bbox : Nr(t), e.push(t)
  3680. })), Nt.prototype.load.call(this, e)
  3681. }, e.remove = function (t, e) {
  3682. if ("Feature" !== t.type) throw new Error("invalid feature");
  3683. return t.bbox = t.bbox ? t.bbox : Nr(t), Nt.prototype.remove.call(this, t, e)
  3684. }, e.clear = function () {
  3685. return Nt.prototype.clear.call(this)
  3686. }, e.search = function (t) {
  3687. var e = Nt.prototype.search.call(this, this.toBBox(t));
  3688. return Cr(e)
  3689. }, e.collides = function (t) {
  3690. return Nt.prototype.collides.call(this, this.toBBox(t))
  3691. }, e.all = function () {
  3692. var t = Nt.prototype.all.call(this);
  3693. return Cr(t)
  3694. }, e.toJSON = function () {
  3695. return Nt.prototype.toJSON.call(this)
  3696. }, e.fromJSON = function (t) {
  3697. return Nt.prototype.fromJSON.call(this, t)
  3698. }, e.toBBox = function (t) {
  3699. var e;
  3700. if (t.bbox) e = t.bbox;
  3701. else if (Array.isArray(t) && 4 === t.length) e = t;
  3702. else if (Array.isArray(t) && 6 === t.length) e = [t[0], t[1], t[3], t[4]];
  3703. else if ("Feature" === t.type) e = Nr(t);
  3704. else {
  3705. if ("FeatureCollection" !== t.type) throw new Error("invalid geojson");
  3706. e = Nr(t)
  3707. }
  3708. return {
  3709. minX: e[0],
  3710. minY: e[1],
  3711. maxX: e[2],
  3712. maxY: e[3]
  3713. }
  3714. }, e
  3715. }
  3716. var Mr = Pr,
  3717. Lr = Pr;
  3718. function Or(t, e) {
  3719. var n = {},
  3720. r = [];
  3721. if ("LineString" === t.type && (t = o(t)), "LineString" === e.type && (e = o(e)), "Feature" === t.type && "Feature" === e.type && null !== t.geometry && null !== e.geometry && "LineString" === t.geometry.type && "LineString" === e.geometry.type && 2 === t.geometry.coordinates.length && 2 === e.geometry.coordinates.length) {
  3722. var i = Rr(t, e);
  3723. return i && r.push(i), f(r)
  3724. }
  3725. var s = Mr();
  3726. return s.load(Zn(e)), F(Zn(t), (function (t) {
  3727. F(s.search(t), (function (e) {
  3728. var i = Rr(t, e);
  3729. if (i) {
  3730. var o = Q(i).join(",");
  3731. n[o] || (n[o] = !0, r.push(i))
  3732. }
  3733. }))
  3734. })), f(r)
  3735. }
  3736. function Rr(t, e) {
  3737. var n = Q(t),
  3738. r = Q(e);
  3739. if (2 !== n.length) throw new Error("<intersects> line1 must only contain 2 coordinates");
  3740. if (2 !== r.length) throw new Error("<intersects> line2 must only contain 2 coordinates");
  3741. var i = n[0][0],
  3742. o = n[0][1],
  3743. s = n[1][0],
  3744. u = n[1][1],
  3745. l = r[0][0],
  3746. c = r[0][1],
  3747. h = r[1][0],
  3748. p = r[1][1],
  3749. f = (p - c) * (s - i) - (h - l) * (u - o),
  3750. g = (h - l) * (o - c) - (p - c) * (i - l),
  3751. d = (s - i) * (o - c) - (u - o) * (i - l);
  3752. if (0 === f) return null;
  3753. var y = g / f,
  3754. v = d / f;
  3755. return y >= 0 && y <= 1 && v >= 0 && v <= 1 ? a([i + y * (s - i), o + y * (u - o)]) : null
  3756. }
  3757. function Tr(t, e, n) {
  3758. void 0 === n && (n = {});
  3759. var r = a([1 / 0, 1 / 0], {
  3760. dist: 1 / 0
  3761. }),
  3762. i = 0;
  3763. return z(t, (function (t) {
  3764. for (var o = Q(t), s = 0; s < o.length - 1; s++) {
  3765. var u = a(o[s]);
  3766. u.properties.dist = me(e, u, n);
  3767. var l = a(o[s + 1]);
  3768. l.properties.dist = me(e, l, n);
  3769. var c = me(u, l, n),
  3770. p = Math.max(u.properties.dist, l.properties.dist),
  3771. f = mn(u, l),
  3772. g = vn(e, p, f + 90, n),
  3773. d = vn(e, p, f - 90, n),
  3774. y = Or(h([g.geometry.coordinates, d.geometry.coordinates]), h([u.geometry.coordinates, l.geometry.coordinates])),
  3775. v = null;
  3776. y.features.length > 0 && ((v = y.features[0]).properties.dist = me(e, v, n), v.properties.location = i + me(u, v, n)), u.properties.dist < r.properties.dist && ((r = u).properties.index = s, r.properties.location = i), l.properties.dist < r.properties.dist && ((r = l).properties.index = s + 1, r.properties.location = i + c), v && v.properties.dist < r.properties.dist && ((r = v).properties.index = s), i += c
  3777. }
  3778. })), r
  3779. }
  3780. function Ar(t, n, r) {
  3781. void 0 === r && (r = {});
  3782. var i = K(t),
  3783. o = K(n);
  3784. return o[0] += o[0] - i[0] > 180 ? -360 : i[0] - o[0] > 180 ? 360 : 0, N(function (t, n, r) {
  3785. var i = r = void 0 === r ? e : Number(r),
  3786. o = t[1] * Math.PI / 180,
  3787. s = n[1] * Math.PI / 180,
  3788. a = s - o,
  3789. u = Math.abs(n[0] - t[0]) * Math.PI / 180;
  3790. u > Math.PI && (u -= 2 * Math.PI);
  3791. var l = Math.log(Math.tan(s / 2 + Math.PI / 4) / Math.tan(o / 2 + Math.PI / 4)),
  3792. c = Math.abs(l) > 1e-11 ? a / l : Math.cos(o);
  3793. return Math.sqrt(a * a + c * c * u * u) * i
  3794. }(i, o), "meters", r.units)
  3795. }
  3796. function Dr(t, e, n) {
  3797. if (void 0 === n && (n = {}), n.method || (n.method = "geodesic"), n.units || (n.units = "kilometers"), !t) throw new Error("pt is required");
  3798. if (Array.isArray(t) ? t = a(t) : "Point" === t.type ? t = o(t) : et(t, "Point", "point"), !e) throw new Error("line is required");
  3799. Array.isArray(e) ? e = h(e) : "LineString" === e.type ? e = o(e) : et(e, "LineString", "line");
  3800. var r = 1 / 0,
  3801. i = t.geometry.coordinates;
  3802. return U(e, (function (t) {
  3803. var e = t.geometry.coordinates[0],
  3804. o = t.geometry.coordinates[1],
  3805. s = function (t, e, n, r) {
  3806. var i = [n[0] - e[0], n[1] - e[1]],
  3807. o = Fr([t[0] - e[0], t[1] - e[1]], i);
  3808. if (o <= 0) return kr(t, e, {
  3809. method: r.method,
  3810. units: "degrees"
  3811. });
  3812. var s = Fr(i, i);
  3813. if (s <= o) return kr(t, n, {
  3814. method: r.method,
  3815. units: "degrees"
  3816. });
  3817. var a = o / s,
  3818. u = [e[0] + a * i[0], e[1] + a * i[1]];
  3819. return kr(t, u, {
  3820. method: r.method,
  3821. units: "degrees"
  3822. })
  3823. }(i, e, o, n);
  3824. s < r && (r = s)
  3825. })), N(r, "degrees", n.units)
  3826. }
  3827. function Fr(t, e) {
  3828. return t[0] * e[0] + t[1] * e[1]
  3829. }
  3830. function kr(t, e, n) {
  3831. return "planar" === n.method ? Ar(t, e, n) : me(t, e, n)
  3832. }
  3833. function Gr(t, e, n, r, i, o, s, a) {
  3834. var u, l, c, h, p = {
  3835. x: null,
  3836. y: null,
  3837. onLine1: !1,
  3838. onLine2: !1
  3839. };
  3840. return 0 === (u = (a - o) * (n - t) - (s - i) * (r - e)) ? null !== p.x && null !== p.y && p : (h = (n - t) * (l = e - o) - (r - e) * (c = t - i), l = ((s - i) * l - (a - o) * c) / u, c = h / u, p.x = t + l * (n - t), p.y = e + l * (r - e), l >= 0 && l <= 1 && (p.onLine1 = !0), c >= 0 && c <= 1 && (p.onLine2 = !0), !(!p.onLine1 || !p.onLine2) && [p.x, p.y])
  3841. }
  3842. function qr(t) {
  3843. for (var e = function (t) {
  3844. if ("FeatureCollection" !== t.type) return "Feature" !== t.type ? f([o(t)]) : f([t]);
  3845. return t
  3846. }(t), n = xn(e), r = !1, i = 0; !r && i < e.features.length;) {
  3847. var s, u = e.features[i].geometry,
  3848. l = !1;
  3849. if ("Point" === u.type) n.geometry.coordinates[0] === u.coordinates[0] && n.geometry.coordinates[1] === u.coordinates[1] && (r = !0);
  3850. else if ("MultiPoint" === u.type) {
  3851. var c = !1;
  3852. for (s = 0; !c && s < u.coordinates.length;) n.geometry.coordinates[0] === u.coordinates[s][0] && n.geometry.coordinates[1] === u.coordinates[s][1] && (r = !0, c = !0), s++
  3853. } else if ("LineString" === u.type)
  3854. for (s = 0; !l && s < u.coordinates.length - 1;) Br(n.geometry.coordinates[0], n.geometry.coordinates[1], u.coordinates[s][0], u.coordinates[s][1], u.coordinates[s + 1][0], u.coordinates[s + 1][1]) && (l = !0, r = !0), s++;
  3855. else if ("MultiLineString" === u.type)
  3856. for (var h = 0; h < u.coordinates.length;) {
  3857. l = !1, s = 0;
  3858. for (var p = u.coordinates[h]; !l && s < p.length - 1;) Br(n.geometry.coordinates[0], n.geometry.coordinates[1], p[s][0], p[s][1], p[s + 1][0], p[s + 1][1]) && (l = !0, r = !0), s++;
  3859. h++
  3860. } else "Polygon" !== u.type && "MultiPolygon" !== u.type || ye(n, u) && (r = !0);
  3861. i++
  3862. }
  3863. if (r) return n;
  3864. var g = f([]);
  3865. for (i = 0; i < e.features.length; i++) g.features = g.features.concat(bn(e.features[i]).features);
  3866. return a(Jn(n, g).geometry.coordinates)
  3867. }
  3868. function Br(t, e, n, r, i, o) {
  3869. return Math.sqrt((i - n) * (i - n) + (o - r) * (o - r)) === Math.sqrt((t - n) * (t - n) + (e - r) * (e - r)) + Math.sqrt((i - t) * (i - t) + (o - e) * (o - e))
  3870. }
  3871. Mr.default = Lr;
  3872. var zr = 6378137;
  3873. function jr(t) {
  3874. return B(t, (function (t, e) {
  3875. return t + function (t) {
  3876. var e, n = 0;
  3877. switch (t.type) {
  3878. case "Polygon":
  3879. return Ur(t.coordinates);
  3880. case "MultiPolygon":
  3881. for (e = 0; e < t.coordinates.length; e++) n += Ur(t.coordinates[e]);
  3882. return n;
  3883. case "Point":
  3884. case "MultiPoint":
  3885. case "LineString":
  3886. case "MultiLineString":
  3887. return 0
  3888. }
  3889. return 0
  3890. }(e)
  3891. }), 0)
  3892. }
  3893. function Ur(t) {
  3894. var e = 0;
  3895. if (t && t.length > 0) {
  3896. e += Math.abs(Vr(t[0]));
  3897. for (var n = 1; n < t.length; n++) e -= Math.abs(Vr(t[n]))
  3898. }
  3899. return e
  3900. }
  3901. function Vr(t) {
  3902. var e, n, r, i, o, s, a = 0,
  3903. u = t.length;
  3904. if (u > 2) {
  3905. for (s = 0; s < u; s++) s === u - 2 ? (r = u - 2, i = u - 1, o = 0) : s === u - 1 ? (r = u - 1, i = 0, o = 1) : (r = s, i = s + 1, o = s + 2), e = t[r], n = t[i], a += (Xr(t[o][0]) - Xr(e[0])) * Math.sin(Xr(n[1]));
  3906. a = a * zr * zr / 2
  3907. }
  3908. return a
  3909. }
  3910. function Xr(t) {
  3911. return t * Math.PI / 180
  3912. }
  3913. function Yr(t, e) {
  3914. return void 0 === e && (e = {}), V(t, (function (t, n) {
  3915. var r = n.geometry.coordinates;
  3916. return t + me(r[0], r[1], e)
  3917. }), 0)
  3918. }
  3919. function Hr(t, e, n, r) {
  3920. if (!P(r = r || {})) throw new Error("options is invalid");
  3921. var i, o = [];
  3922. if ("Feature" === t.type) i = t.geometry.coordinates;
  3923. else {
  3924. if ("LineString" !== t.type) throw new Error("input must be a LineString Feature or Geometry");
  3925. i = t.coordinates
  3926. }
  3927. for (var s, a, u, l = i.length, c = 0, p = 0; p < i.length && !(e >= c && p === i.length - 1); p++) {
  3928. if (c > e && 0 === o.length) {
  3929. if (!(s = e - c)) return o.push(i[p]), h(o);
  3930. a = mn(i[p], i[p - 1]) - 180, u = vn(i[p], s, a, r), o.push(u.geometry.coordinates)
  3931. }
  3932. if (c >= n) return (s = n - c) ? (a = mn(i[p], i[p - 1]) - 180, u = vn(i[p], s, a, r), o.push(u.geometry.coordinates), h(o)) : (o.push(i[p]), h(o));
  3933. if (c >= e && o.push(i[p]), p === i.length - 1) return h(o);
  3934. c += me(i[p], i[p + 1], r)
  3935. }
  3936. if (c < e && i.length === l) throw new Error("Start position is beyond line");
  3937. var f = i[i.length - 1];
  3938. return h([f, f])
  3939. }
  3940. function Wr(t, e, n) {
  3941. void 0 === n && (n = {});
  3942. for (var r = K(t), i = Q(e), o = 0; o < i.length - 1; o++) {
  3943. var s = !1;
  3944. if (n.ignoreEndVertices && (0 === o && (s = "start"), o === i.length - 2 && (s = "end"), 0 === o && o + 1 === i.length - 1 && (s = "both")), Jr(i[o], i[o + 1], r, s, void 0 === n.epsilon ? null : n.epsilon)) return !0
  3945. }
  3946. return !1
  3947. }
  3948. function Jr(t, e, n, r, i) {
  3949. var o = n[0],
  3950. s = n[1],
  3951. a = t[0],
  3952. u = t[1],
  3953. l = e[0],
  3954. c = e[1],
  3955. h = l - a,
  3956. p = c - u,
  3957. f = (n[0] - a) * p - (n[1] - u) * h;
  3958. if (null !== i) {
  3959. if (Math.abs(f) > i) return !1
  3960. } else if (0 !== f) return !1;
  3961. return r ? "start" === r ? Math.abs(h) >= Math.abs(p) ? h > 0 ? a < o && o <= l : l <= o && o < a : p > 0 ? u < s && s <= c : c <= s && s < u : "end" === r ? Math.abs(h) >= Math.abs(p) ? h > 0 ? a <= o && o < l : l < o && o <= a : p > 0 ? u <= s && s < c : c < s && s <= u : "both" === r && (Math.abs(h) >= Math.abs(p) ? h > 0 ? a < o && o < l : l < o && o < a : p > 0 ? u < s && s < c : c < s && s < u) : Math.abs(h) >= Math.abs(p) ? h > 0 ? a <= o && o <= l : l <= o && o <= a : p > 0 ? u <= s && s <= c : c <= s && s <= u
  3962. }
  3963. function Zr(t, e) {
  3964. var n = rt(t),
  3965. r = rt(e),
  3966. i = n.type,
  3967. o = r.type;
  3968. switch (i) {
  3969. case "Point":
  3970. switch (o) {
  3971. case "MultiPoint":
  3972. return function (t, e) {
  3973. var n, r = !1;
  3974. for (n = 0; n < e.coordinates.length; n++)
  3975. if (Qr(e.coordinates[n], t.coordinates)) {
  3976. r = !0;
  3977. break
  3978. } return r
  3979. }(n, r);
  3980. case "LineString":
  3981. return Wr(n, r, {
  3982. ignoreEndVertices: !0
  3983. });
  3984. case "Polygon":
  3985. case "MultiPolygon":
  3986. return ye(n, r, {
  3987. ignoreBoundary: !0
  3988. });
  3989. default:
  3990. throw new Error("feature2 " + o + " geometry not supported")
  3991. }
  3992. case "MultiPoint":
  3993. switch (o) {
  3994. case "MultiPoint":
  3995. return function (t, e) {
  3996. for (var n = 0; n < t.coordinates.length; n++) {
  3997. for (var r = !1, i = 0; i < e.coordinates.length; i++) Qr(t.coordinates[n], e.coordinates[i]) && (r = !0);
  3998. if (!r) return !1
  3999. }
  4000. return !0
  4001. }(n, r);
  4002. case "LineString":
  4003. return function (t, e) {
  4004. for (var n = !1, r = 0; r < t.coordinates.length; r++) {
  4005. if (!Wr(t.coordinates[r], e)) return !1;
  4006. n || (n = Wr(t.coordinates[r], e, {
  4007. ignoreEndVertices: !0
  4008. }))
  4009. }
  4010. return n
  4011. }(n, r);
  4012. case "Polygon":
  4013. case "MultiPolygon":
  4014. return function (t, e) {
  4015. for (var n = !0, r = !1, i = 0; i < t.coordinates.length; i++) {
  4016. if (!(r = ye(t.coordinates[1], e))) {
  4017. n = !1;
  4018. break
  4019. }
  4020. r = ye(t.coordinates[1], e, {
  4021. ignoreBoundary: !0
  4022. })
  4023. }
  4024. return n && r
  4025. }(n, r);
  4026. default:
  4027. throw new Error("feature2 " + o + " geometry not supported")
  4028. }
  4029. case "LineString":
  4030. switch (o) {
  4031. case "LineString":
  4032. return function (t, e) {
  4033. for (var n = 0; n < t.coordinates.length; n++)
  4034. if (!Wr(t.coordinates[n], e)) return !1;
  4035. return !0
  4036. }(n, r);
  4037. case "Polygon":
  4038. case "MultiPolygon":
  4039. return function (t, e) {
  4040. var n = Z(e),
  4041. r = Z(t);
  4042. if (!Kr(n, r)) return !1;
  4043. for (var i = !1, o = 0; o < t.coordinates.length - 1; o++) {
  4044. if (!ye(t.coordinates[o], e)) return !1;
  4045. if (i || (i = ye(t.coordinates[o], e, {
  4046. ignoreBoundary: !0
  4047. })), !i) i = ye($r(t.coordinates[o], t.coordinates[o + 1]), e, {
  4048. ignoreBoundary: !0
  4049. })
  4050. }
  4051. return i
  4052. }(n, r);
  4053. default:
  4054. throw new Error("feature2 " + o + " geometry not supported")
  4055. }
  4056. case "Polygon":
  4057. switch (o) {
  4058. case "Polygon":
  4059. case "MultiPolygon":
  4060. return function (t, e) {
  4061. var n = Z(t);
  4062. if (!Kr(Z(e), n)) return !1;
  4063. for (var r = 0; r < t.coordinates[0].length; r++)
  4064. if (!ye(t.coordinates[0][r], e)) return !1;
  4065. return !0
  4066. }(n, r);
  4067. default:
  4068. throw new Error("feature2 " + o + " geometry not supported")
  4069. }
  4070. default:
  4071. throw new Error("feature1 " + i + " geometry not supported")
  4072. }
  4073. }
  4074. function Kr(t, e) {
  4075. return !(t[0] > e[0]) && (!(t[2] < e[2]) && (!(t[1] > e[1]) && !(t[3] < e[3])))
  4076. }
  4077. function Qr(t, e) {
  4078. return t[0] === e[0] && t[1] === e[1]
  4079. }
  4080. function $r(t, e) {
  4081. return [(t[0] + e[0]) / 2, (t[1] + e[1]) / 2]
  4082. }
  4083. function ti(t, e, n) {
  4084. void 0 === n && (n = {}), n.mask && !n.units && (n.units = "kilometers");
  4085. for (var r = [], i = t[0], o = t[1], s = t[2], u = t[3], l = e / me([i, o], [s, o], n) * (s - i), c = e / me([i, o], [i, u], n) * (u - o), h = s - i, p = u - o, g = Math.floor(h / l), d = (p - Math.floor(p / c) * c) / 2, y = i + (h - g * l) / 2; y <= s;) {
  4086. for (var v = o + d; v <= u;) {
  4087. var _ = a([y, v], n.properties);
  4088. n.mask ? Zr(_, n.mask) && r.push(_) : r.push(_), v += c
  4089. }
  4090. y += l
  4091. }
  4092. return f(r)
  4093. }
  4094. function ei(t, e) {
  4095. void 0 === e && (e = {});
  4096. var n = e.precision,
  4097. r = e.coordinates,
  4098. i = e.mutate;
  4099. if (n = null == n || isNaN(n) ? 6 : n, r = null == r || isNaN(r) ? 3 : r, !t) throw new Error("<geojson> is required");
  4100. if ("number" != typeof n) throw new Error("<precision> must be a number");
  4101. if ("number" != typeof r) throw new Error("<coordinates> must be a number");
  4102. !1 !== i && void 0 !== i || (t = JSON.parse(JSON.stringify(t)));
  4103. var o = Math.pow(10, n);
  4104. return R(t, (function (t) {
  4105. ! function (t, e, n) {
  4106. t.length > n && t.splice(n, t.length);
  4107. for (var r = 0; r < t.length; r++) t[r] = Math.round(t[r] * e) / e
  4108. }(t, o, r)
  4109. })), t
  4110. }
  4111. function ni(t) {
  4112. if (!t) throw new Error("geojson is required");
  4113. var e = [];
  4114. return z(t, (function (t) {
  4115. e.push(t)
  4116. })), f(e)
  4117. }
  4118. function ri(t, e, n) {
  4119. if ("Polygon" !== t.geometry.type) throw new Error("The input feature must be a Polygon");
  4120. void 0 === n && (n = 1);
  4121. var r = t.geometry.coordinates,
  4122. i = [],
  4123. o = {};
  4124. if (n) {
  4125. for (var s = [], a = 0; a < r.length; a++)
  4126. for (var u = 0; u < r[a].length - 1; u++) s.push(d(a, u));
  4127. var l = Nt();
  4128. l.load(s)
  4129. }
  4130. for (var c = 0; c < r.length; c++)
  4131. for (var h = 0; h < r[c].length - 1; h++) {
  4132. if (n) l.search(d(c, h)).forEach((function (t) {
  4133. var e = t.ring,
  4134. n = t.edge;
  4135. g(c, h, e, n)
  4136. }));
  4137. else
  4138. for (var p = 0; p < r.length; p++)
  4139. for (var f = 0; f < r[p].length - 1; f++) g(c, h, p, f)
  4140. }
  4141. return e || (i = {
  4142. type: "Feature",
  4143. geometry: {
  4144. type: "MultiPoint",
  4145. coordinates: i
  4146. }
  4147. }), i;
  4148. function g(t, n, s, a) {
  4149. var u, l, c = r[t][n],
  4150. h = r[t][n + 1],
  4151. p = r[s][a],
  4152. f = r[s][a + 1],
  4153. g = function (t, e, n, r) {
  4154. if (ii(t, n) || ii(t, r) || ii(e, n) || ii(r, n)) return null;
  4155. var i = t[0],
  4156. o = t[1],
  4157. s = e[0],
  4158. a = e[1],
  4159. u = n[0],
  4160. l = n[1],
  4161. c = r[0],
  4162. h = r[1],
  4163. p = (i - s) * (l - h) - (o - a) * (u - c);
  4164. return 0 === p ? null : [((i * a - o * s) * (u - c) - (i - s) * (u * h - l * c)) / p, ((i * a - o * s) * (l - h) - (o - a) * (u * h - l * c)) / p]
  4165. }(c, h, p, f);
  4166. if (null !== g && (u = h[0] !== c[0] ? (g[0] - c[0]) / (h[0] - c[0]) : (g[1] - c[1]) / (h[1] - c[1]), l = f[0] !== p[0] ? (g[0] - p[0]) / (f[0] - p[0]) : (g[1] - p[1]) / (f[1] - p[1]), !(u >= 1 || u <= 0 || l >= 1 || l <= 0))) {
  4167. var d = g,
  4168. y = !o[d];
  4169. y && (o[d] = !0), e ? i.push(e(g, t, n, c, h, u, s, a, p, f, l, y)) : i.push(g)
  4170. }
  4171. }
  4172. function d(t, e) {
  4173. var n, i, o, s, a = r[t][e],
  4174. u = r[t][e + 1];
  4175. return a[0] < u[0] ? (n = a[0], i = u[0]) : (n = u[0], i = a[0]), a[1] < u[1] ? (o = a[1], s = u[1]) : (o = u[1], s = a[1]), {
  4176. minX: n,
  4177. minY: o,
  4178. maxX: i,
  4179. maxY: s,
  4180. ring: t,
  4181. edge: e
  4182. }
  4183. }
  4184. }
  4185. function ii(t, e) {
  4186. if (!t || !e) return !1;
  4187. if (t.length !== e.length) return !1;
  4188. for (var n = 0, r = t.length; n < r; n++)
  4189. if (t[n] instanceof Array && e[n] instanceof Array) {
  4190. if (!ii(t[n], e[n])) return !1
  4191. } else if (t[n] !== e[n]) return !1;
  4192. return !0
  4193. }
  4194. function oi(t) {
  4195. if ("Feature" != t.type) throw new Error("The input must a geojson object of type Feature");
  4196. if (void 0 === t.geometry || null == t.geometry) throw new Error("The input must a geojson object with a non-empty geometry");
  4197. if ("Polygon" != t.geometry.type) throw new Error("The input must be a geojson Polygon");
  4198. for (var e = t.geometry.coordinates.length, n = [], r = 0; r < e; r++) {
  4199. var i = t.geometry.coordinates[r];
  4200. ci(i[0], i[i.length - 1]) || i.push(i[0]), n.push.apply(n, i.slice(0, i.length - 1))
  4201. }
  4202. if (! function (t) {
  4203. for (var e = {}, n = 1, r = 0, i = t.length; r < i; ++r) {
  4204. if (Object.prototype.hasOwnProperty.call(e, t[r])) {
  4205. n = 0;
  4206. break
  4207. }
  4208. e[t[r]] = 1
  4209. }
  4210. return n
  4211. }(n)) throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");
  4212. var o = n.length,
  4213. s = ri(t, (function (t, e, n, r, i, o, s, a, u, l, c, h) {
  4214. return [t, e, n, r, i, o, s, a, u, l, c, h]
  4215. })),
  4216. a = s.length;
  4217. if (0 == a) {
  4218. var u = [];
  4219. for (r = 0; r < e; r++) u.push(l([t.geometry.coordinates[r]], {
  4220. parent: -1,
  4221. winding: li(t.geometry.coordinates[r])
  4222. }));
  4223. var c = f(u);
  4224. return G(), q(), c
  4225. }
  4226. var h = [],
  4227. p = [];
  4228. for (r = 0; r < e; r++) {
  4229. h.push([]);
  4230. for (var g = 0; g < t.geometry.coordinates[r].length - 1; g++) h[r].push([new si(t.geometry.coordinates[r][hi(g + 1, t.geometry.coordinates[r].length - 1)], 1, [r, g], [r, hi(g + 1, t.geometry.coordinates[r].length - 1)], void 0)]), p.push(new ai(t.geometry.coordinates[r][g], [r, hi(g - 1, t.geometry.coordinates[r].length - 1)], [r, g], void 0, void 0, !1, !0))
  4231. }
  4232. for (r = 0; r < a; r++) h[s[r][1]][s[r][2]].push(new si(s[r][0], s[r][5], [s[r][1], s[r][2]], [s[r][6], s[r][7]], void 0)), s[r][11] && p.push(new ai(s[r][0], [s[r][1], s[r][2]], [s[r][6], s[r][7]], void 0, void 0, !0, !0));
  4233. var d = p.length;
  4234. for (r = 0; r < h.length; r++)
  4235. for (g = 0; g < h[r].length; g++) h[r][g].sort((function (t, e) {
  4236. return t.param < e.param ? -1 : 1
  4237. }));
  4238. var y = [];
  4239. for (r = 0; r < d; r++) y.push({
  4240. minX: p[r].coord[0],
  4241. minY: p[r].coord[1],
  4242. maxX: p[r].coord[0],
  4243. maxY: p[r].coord[1],
  4244. index: r
  4245. });
  4246. var v = Nt();
  4247. v.load(y);
  4248. for (r = 0; r < h.length; r++)
  4249. for (g = 0; g < h[r].length; g++)
  4250. for (var _ = 0; _ < h[r][g].length; _++) {
  4251. x = _ == h[r][g].length - 1 ? h[r][hi(g + 1, t.geometry.coordinates[r].length - 1)][0].coord : h[r][g][_ + 1].coord;
  4252. var m = v.search({
  4253. minX: x[0],
  4254. minY: x[1],
  4255. maxX: x[0],
  4256. maxY: x[1]
  4257. })[0];
  4258. h[r][g][_].nxtIsectAlongEdgeIn = m.index
  4259. }
  4260. for (r = 0; r < h.length; r++)
  4261. for (g = 0; g < h[r].length; g++)
  4262. for (_ = 0; _ < h[r][g].length; _++) {
  4263. var x = h[r][g][_].coord,
  4264. E = (m = v.search({
  4265. minX: x[0],
  4266. minY: x[1],
  4267. maxX: x[0],
  4268. maxY: x[1]
  4269. })[0]).index;
  4270. E < o ? p[E].nxtIsectAlongRingAndEdge2 = h[r][g][_].nxtIsectAlongEdgeIn : ci(p[E].ringAndEdge1, h[r][g][_].ringAndEdgeIn) ? p[E].nxtIsectAlongRingAndEdge1 = h[r][g][_].nxtIsectAlongEdgeIn : p[E].nxtIsectAlongRingAndEdge2 = h[r][g][_].nxtIsectAlongEdgeIn
  4271. }
  4272. var b = [];
  4273. for (r = 0, g = 0; g < e; g++) {
  4274. var w = r;
  4275. for (_ = 0; _ < t.geometry.coordinates[g].length - 1; _++) p[r].coord[0] < p[w].coord[0] && (w = r), r++;
  4276. var I = p[w].nxtIsectAlongRingAndEdge2;
  4277. for (_ = 0; _ < p.length; _++)
  4278. if (p[_].nxtIsectAlongRingAndEdge1 == w || p[_].nxtIsectAlongRingAndEdge2 == w) {
  4279. var N = _;
  4280. break
  4281. } var S = ui([p[N].coord, p[w].coord, p[I].coord], !0) ? 1 : -1;
  4282. b.push({
  4283. isect: w,
  4284. parent: -1,
  4285. winding: S
  4286. })
  4287. }
  4288. b.sort((function (t, e) {
  4289. return p[t.isect].coord > p[e.isect].coord ? -1 : 1
  4290. }));
  4291. for (u = []; b.length > 0;) {
  4292. var C = b.pop(),
  4293. P = C.isect,
  4294. M = C.parent,
  4295. L = C.winding,
  4296. O = u.length,
  4297. R = [p[P].coord],
  4298. T = P;
  4299. if (p[P].ringAndEdge1Walkable) var A = p[P].ringAndEdge1,
  4300. D = p[P].nxtIsectAlongRingAndEdge1;
  4301. else A = p[P].ringAndEdge2, D = p[P].nxtIsectAlongRingAndEdge2;
  4302. for (; !ci(p[P].coord, p[D].coord);) {
  4303. R.push(p[D].coord);
  4304. var F = void 0;
  4305. for (r = 0; r < b.length; r++)
  4306. if (b[r].isect == D) {
  4307. F = r;
  4308. break
  4309. } if (null != F && b.splice(F, 1), ci(A, p[D].ringAndEdge1)) {
  4310. if (A = p[D].ringAndEdge2, p[D].ringAndEdge2Walkable = !1, p[D].ringAndEdge1Walkable) {
  4311. var k = {
  4312. isect: D
  4313. };
  4314. ui([p[T].coord, p[D].coord, p[p[D].nxtIsectAlongRingAndEdge2].coord], 1 == L) ? (k.parent = M, k.winding = -L) : (k.parent = O, k.winding = L), b.push(k)
  4315. }
  4316. T = D, D = p[D].nxtIsectAlongRingAndEdge2
  4317. } else {
  4318. if (A = p[D].ringAndEdge1, p[D].ringAndEdge1Walkable = !1, p[D].ringAndEdge2Walkable) {
  4319. k = {
  4320. isect: D
  4321. };
  4322. ui([p[T].coord, p[D].coord, p[p[D].nxtIsectAlongRingAndEdge1].coord], 1 == L) ? (k.parent = M, k.winding = -L) : (k.parent = O, k.winding = L), b.push(k)
  4323. }
  4324. T = D, D = p[D].nxtIsectAlongRingAndEdge1
  4325. }
  4326. }
  4327. R.push(p[D].coord), u.push(l([R], {
  4328. index: O,
  4329. parent: M,
  4330. winding: L,
  4331. netWinding: void 0
  4332. }))
  4333. }
  4334. c = f(u);
  4335. function G() {
  4336. for (var t = [], e = 0; e < c.features.length; e++) - 1 == c.features[e].properties.parent && t.push(e);
  4337. if (t.length > 1)
  4338. for (e = 0; e < t.length; e++) {
  4339. for (var n = -1, r = 0; r < c.features.length; r++) t[e] != r && ye(c.features[t[e]].geometry.coordinates[0][0], c.features[r], {
  4340. ignoreBoundary: !0
  4341. }) && jr(c.features[r]) < Infinity && (n = r);
  4342. c.features[t[e]].properties.parent = n
  4343. }
  4344. }
  4345. function q() {
  4346. for (var t = 0; t < c.features.length; t++)
  4347. if (-1 == c.features[t].properties.parent) {
  4348. var e = c.features[t].properties.winding;
  4349. c.features[t].properties.netWinding = e, B(t, e)
  4350. }
  4351. }
  4352. function B(t, e) {
  4353. for (var n = 0; n < c.features.length; n++)
  4354. if (c.features[n].properties.parent == t) {
  4355. var r = e + c.features[n].properties.winding;
  4356. c.features[n].properties.netWinding = r, B(n, r)
  4357. }
  4358. }
  4359. return G(), q(), c
  4360. }
  4361. var si = function (t, e, n, r, i) {
  4362. this.coord = t, this.param = e, this.ringAndEdgeIn = n, this.ringAndEdgeOut = r, this.nxtIsectAlongEdgeIn = i
  4363. },
  4364. ai = function (t, e, n, r, i, o, s) {
  4365. this.coord = t, this.ringAndEdge1 = e, this.ringAndEdge2 = n, this.nxtIsectAlongRingAndEdge1 = r, this.nxtIsectAlongRingAndEdge2 = i, this.ringAndEdge1Walkable = o, this.ringAndEdge2Walkable = s
  4366. };
  4367. function ui(t, e) {
  4368. if (void 0 === e && (e = !0), 3 != t.length) throw new Error("This function requires an array of three points [x,y]");
  4369. return (t[1][0] - t[0][0]) * (t[2][1] - t[0][1]) - (t[1][1] - t[0][1]) * (t[2][0] - t[0][0]) >= 0 == e
  4370. }
  4371. function li(t) {
  4372. for (var e = 0, n = 0; n < t.length - 1; n++) t[n][0] < t[e][0] && (e = n);
  4373. if (ui([t[hi(e - 1, t.length - 1)], t[e], t[hi(e + 1, t.length - 1)]], !0)) var r = 1;
  4374. else r = -1;
  4375. return r
  4376. }
  4377. function ci(t, e) {
  4378. if (!t || !e) return !1;
  4379. if (t.length != e.length) return !1;
  4380. for (var n = 0, r = t.length; n < r; n++)
  4381. if (t[n] instanceof Array && e[n] instanceof Array) {
  4382. if (!ci(t[n], e[n])) return !1
  4383. } else if (t[n] != e[n]) return !1;
  4384. return !0
  4385. }
  4386. function hi(t, e) {
  4387. return (t % e + e) % e
  4388. }
  4389. var pi = Math.PI / 180,
  4390. fi = 180 / Math.PI,
  4391. gi = function (t, e) {
  4392. this.lon = t, this.lat = e, this.x = pi * t, this.y = pi * e
  4393. };
  4394. gi.prototype.view = function () {
  4395. return String(this.lon).slice(0, 4) + "," + String(this.lat).slice(0, 4)
  4396. }, gi.prototype.antipode = function () {
  4397. var t = -1 * this.lat,
  4398. e = this.lon < 0 ? 180 + this.lon : -1 * (180 - this.lon);
  4399. return new gi(e, t)
  4400. };
  4401. var di = function () {
  4402. this.coords = [], this.length = 0
  4403. };
  4404. di.prototype.move_to = function (t) {
  4405. this.length++, this.coords.push(t)
  4406. };
  4407. var yi = function (t) {
  4408. this.properties = t || {}, this.geometries = []
  4409. };
  4410. yi.prototype.json = function () {
  4411. if (this.geometries.length <= 0) return {
  4412. geometry: {
  4413. type: "LineString",
  4414. coordinates: null
  4415. },
  4416. type: "Feature",
  4417. properties: this.properties
  4418. };
  4419. if (1 === this.geometries.length) return {
  4420. geometry: {
  4421. type: "LineString",
  4422. coordinates: this.geometries[0].coords
  4423. },
  4424. type: "Feature",
  4425. properties: this.properties
  4426. };
  4427. for (var t = [], e = 0; e < this.geometries.length; e++) t.push(this.geometries[e].coords);
  4428. return {
  4429. geometry: {
  4430. type: "MultiLineString",
  4431. coordinates: t
  4432. },
  4433. type: "Feature",
  4434. properties: this.properties
  4435. }
  4436. }, yi.prototype.wkt = function () {
  4437. for (var t = "", e = "LINESTRING(", n = function (t) {
  4438. e += t[0] + " " + t[1] + ","
  4439. }, r = 0; r < this.geometries.length; r++) {
  4440. if (0 === this.geometries[r].coords.length) return "LINESTRING(empty)";
  4441. this.geometries[r].coords.forEach(n), t += e.substring(0, e.length - 1) + ")"
  4442. }
  4443. return t
  4444. };
  4445. var vi = function (t, e, n) {
  4446. if (!t || void 0 === t.x || void 0 === t.y) throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");
  4447. if (!e || void 0 === e.x || void 0 === e.y) throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");
  4448. this.start = new gi(t.x, t.y), this.end = new gi(e.x, e.y), this.properties = n || {};
  4449. var r = this.start.x - this.end.x,
  4450. i = this.start.y - this.end.y,
  4451. o = Math.pow(Math.sin(i / 2), 2) + Math.cos(this.start.y) * Math.cos(this.end.y) * Math.pow(Math.sin(r / 2), 2);
  4452. if (this.g = 2 * Math.asin(Math.sqrt(o)), this.g === Math.PI) throw new Error("it appears " + t.view() + " and " + e.view() + " are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");
  4453. if (isNaN(this.g)) throw new Error("could not calculate great circle between " + t + " and " + e)
  4454. };
  4455. function _i(t, e) {
  4456. var n = [],
  4457. r = Mr();
  4458. return z(e, (function (e) {
  4459. if (n.forEach((function (t, e) {
  4460. t.id = e
  4461. })), n.length) {
  4462. var i = r.search(e);
  4463. if (i.features.length) {
  4464. var o = xi(e, i);
  4465. n = n.filter((function (t) {
  4466. return t.id !== o.id
  4467. })), r.remove(o), F(mi(o, e), (function (t) {
  4468. n.push(t), r.insert(t)
  4469. }))
  4470. }
  4471. } else(n = mi(t, e).features).forEach((function (t) {
  4472. t.bbox || (t.bbox = yn(Z(t)))
  4473. })), r.load(f(n))
  4474. })), f(n)
  4475. }
  4476. function mi(t, e) {
  4477. var n = [],
  4478. r = Q(t)[0],
  4479. i = Q(t)[t.geometry.coordinates.length - 1];
  4480. if (Ei(r, K(e)) || Ei(i, K(e))) return f([t]);
  4481. var o = Mr(),
  4482. s = Zn(t);
  4483. o.load(s);
  4484. var a = o.search(e);
  4485. if (!a.features.length) return f([t]);
  4486. var u = xi(e, a),
  4487. l = k(s, (function (t, r, i) {
  4488. var o = Q(r)[1],
  4489. s = K(e);
  4490. return i === u.id ? (t.push(s), n.push(h(t)), Ei(s, o) ? [s] : [s, o]) : (t.push(o), t)
  4491. }), [r]);
  4492. return l.length > 1 && n.push(h(l)), f(n)
  4493. }
  4494. function xi(t, e) {
  4495. if (!e.features.length) throw new Error("lines must contain features");
  4496. if (1 === e.features.length) return e.features[0];
  4497. var n, r = 1 / 0;
  4498. return F(e, (function (e) {
  4499. var i = Tr(e, t).properties.dist;
  4500. i < r && (n = e, r = i)
  4501. })), n
  4502. }
  4503. function Ei(t, e) {
  4504. return t[0] === e[0] && t[1] === e[1]
  4505. }
  4506. function bi(t, e, n, r, i) {
  4507. void 0 === i && (i = {});
  4508. var o = i.steps || 64,
  4509. s = wi(n),
  4510. a = wi(r),
  4511. u = Array.isArray(t) || "Feature" !== t.type ? {} : t.properties;
  4512. if (s === a) return h(_n(t, e, i).geometry.coordinates[0], u);
  4513. for (var l = s, c = s < a ? a : a + 360, p = l, f = [], g = 0; p < c;) f.push(vn(t, e, p, i).geometry.coordinates), p = l + 360 * ++g / o;
  4514. return p > c && f.push(vn(t, e, c, i).geometry.coordinates), h(f, u)
  4515. }
  4516. function wi(t) {
  4517. var e = t % 360;
  4518. return e < 0 && (e += 360), e
  4519. }
  4520. function Ii(t, e) {
  4521. void 0 === e && (e = {});
  4522. var n = rt(t);
  4523. switch (e.properties || "Feature" !== t.type || (e.properties = t.properties), n.type) {
  4524. case "Polygon":
  4525. return Ni(n, e);
  4526. case "MultiPolygon":
  4527. return function (t, e) {
  4528. void 0 === e && (e = {});
  4529. var n = rt(t).coordinates,
  4530. r = e.properties ? e.properties : "Feature" === t.type ? t.properties : {},
  4531. i = [];
  4532. return n.forEach((function (t) {
  4533. i.push(Si(t, r))
  4534. })), f(i)
  4535. }(n, e);
  4536. default:
  4537. throw new Error("invalid poly")
  4538. }
  4539. }
  4540. function Ni(t, e) {
  4541. return void 0 === e && (e = {}), Si(rt(t).coordinates, e.properties ? e.properties : "Feature" === t.type ? t.properties : {})
  4542. }
  4543. function Si(t, e) {
  4544. return t.length > 1 ? g(t, e) : h(t[0], e)
  4545. }
  4546. function Ci(t, e) {
  4547. var n, r, i;
  4548. void 0 === e && (e = {});
  4549. var o = e.properties,
  4550. s = null === (n = e.autoComplete) || void 0 === n || n,
  4551. a = null === (r = e.orderCoords) || void 0 === r || r;
  4552. switch (null !== (i = e.mutate) && void 0 !== i && i || (t = Ie(t)), t.type) {
  4553. case "FeatureCollection":
  4554. var u = [];
  4555. return t.features.forEach((function (t) {
  4556. u.push(Q(Pi(t, {}, s, a)))
  4557. })), y(u, o);
  4558. default:
  4559. return Pi(t, o, s, a)
  4560. }
  4561. }
  4562. function Pi(t, e, n, r) {
  4563. e = e || ("Feature" === t.type ? t.properties : {});
  4564. var i = rt(t),
  4565. o = i.coordinates,
  4566. s = i.type;
  4567. if (!o.length) throw new Error("line must contain coordinates");
  4568. switch (s) {
  4569. case "LineString":
  4570. return n && (o = Mi(o)), l([o], e);
  4571. case "MultiLineString":
  4572. var a = [],
  4573. u = 0;
  4574. return o.forEach((function (t) {
  4575. if (n && (t = Mi(t)), r) {
  4576. var e = function (t) {
  4577. var e = t[0],
  4578. n = t[1],
  4579. r = t[2],
  4580. i = t[3];
  4581. return Math.abs(e - r) * Math.abs(n - i)
  4582. }(Z(h(t)));
  4583. e > u ? (a.unshift(t), u = e) : a.push(t)
  4584. } else a.push(t)
  4585. })), l(a, e);
  4586. default:
  4587. throw new Error("geometry type " + s + " is not supported")
  4588. }
  4589. }
  4590. function Mi(t) {
  4591. var e = t[0],
  4592. n = e[0],
  4593. r = e[1],
  4594. i = t[t.length - 1],
  4595. o = i[0],
  4596. s = i[1];
  4597. return n === o && r === s || t.push(e), t
  4598. }
  4599. function Li(t, e) {
  4600. var n, r, i, o, s, a, u;
  4601. for (r = 1; r <= 8; r *= 2) {
  4602. for (n = [], o = !(Ri(i = t[t.length - 1], e) & r), s = 0; s < t.length; s++)(u = !(Ri(a = t[s], e) & r)) !== o && n.push(Oi(i, a, r, e)), u && n.push(a), i = a, o = u;
  4603. if (!(t = n).length) break
  4604. }
  4605. return n
  4606. }
  4607. function Oi(t, e, n, r) {
  4608. return 8 & n ? [t[0] + (e[0] - t[0]) * (r[3] - t[1]) / (e[1] - t[1]), r[3]] : 4 & n ? [t[0] + (e[0] - t[0]) * (r[1] - t[1]) / (e[1] - t[1]), r[1]] : 2 & n ? [r[2], t[1] + (e[1] - t[1]) * (r[2] - t[0]) / (e[0] - t[0])] : 1 & n ? [r[0], t[1] + (e[1] - t[1]) * (r[0] - t[0]) / (e[0] - t[0])] : null
  4609. }
  4610. function Ri(t, e) {
  4611. var n = 0;
  4612. return t[0] < e[0] ? n |= 1 : t[0] > e[2] && (n |= 2), t[1] < e[1] ? n |= 4 : t[1] > e[3] && (n |= 8), n
  4613. }
  4614. function Ti(t, e) {
  4615. for (var n = [], r = 0, i = t; r < i.length; r++) {
  4616. var o = Li(i[r], e);
  4617. o.length > 0 && (o[0][0] === o[o.length - 1][0] && o[0][1] === o[o.length - 1][1] || o.push(o[0]), o.length >= 4 && n.push(o))
  4618. }
  4619. return n
  4620. }
  4621. vi.prototype.interpolate = function (t) {
  4622. var e = Math.sin((1 - t) * this.g) / Math.sin(this.g),
  4623. n = Math.sin(t * this.g) / Math.sin(this.g),
  4624. r = e * Math.cos(this.start.y) * Math.cos(this.start.x) + n * Math.cos(this.end.y) * Math.cos(this.end.x),
  4625. i = e * Math.cos(this.start.y) * Math.sin(this.start.x) + n * Math.cos(this.end.y) * Math.sin(this.end.x),
  4626. o = e * Math.sin(this.start.y) + n * Math.sin(this.end.y),
  4627. s = fi * Math.atan2(o, Math.sqrt(Math.pow(r, 2) + Math.pow(i, 2)));
  4628. return [fi * Math.atan2(i, r), s]
  4629. }, vi.prototype.Arc = function (t, e) {
  4630. var n = [];
  4631. if (!t || t <= 2) n.push([this.start.lon, this.start.lat]), n.push([this.end.lon, this.end.lat]);
  4632. else
  4633. for (var r = 1 / (t - 1), i = 0; i < t; ++i) {
  4634. var o = r * i,
  4635. s = this.interpolate(o);
  4636. n.push(s)
  4637. }
  4638. for (var a = !1, u = 0, l = e && e.offset ? e.offset : 10, c = 180 - l, h = -180 + l, p = 360 - l, f = 1; f < n.length; ++f) {
  4639. var g = n[f - 1][0],
  4640. d = n[f][0],
  4641. y = Math.abs(d - g);
  4642. y > p && (d > c && g < h || g > c && d < h) ? a = !0 : y > u && (u = y)
  4643. }
  4644. var v = [];
  4645. if (a && u < l) {
  4646. var _ = [];
  4647. v.push(_);
  4648. for (var m = 0; m < n.length; ++m) {
  4649. var x = parseFloat(n[m][0]);
  4650. if (m > 0 && Math.abs(x - n[m - 1][0]) > p) {
  4651. var E = parseFloat(n[m - 1][0]),
  4652. b = parseFloat(n[m - 1][1]),
  4653. w = parseFloat(n[m][0]),
  4654. I = parseFloat(n[m][1]);
  4655. if (E > -180 && E < h && 180 === w && m + 1 < n.length && n[m - 1][0] > -180 && n[m - 1][0] < h) {
  4656. _.push([-180, n[m][1]]), m++, _.push([n[m][0], n[m][1]]);
  4657. continue
  4658. }
  4659. if (E > c && E < 180 && -180 === w && m + 1 < n.length && n[m - 1][0] > c && n[m - 1][0] < 180) {
  4660. _.push([180, n[m][1]]), m++, _.push([n[m][0], n[m][1]]);
  4661. continue
  4662. }
  4663. if (E < h && w > c) {
  4664. var N = E;
  4665. E = w, w = N;
  4666. var S = b;
  4667. b = I, I = S
  4668. }
  4669. if (E > c && w < h && (w += 360), E <= 180 && w >= 180 && E < w) {
  4670. var C = (180 - E) / (w - E),
  4671. P = C * I + (1 - C) * b;
  4672. _.push([n[m - 1][0] > c ? 180 : -180, P]), (_ = []).push([n[m - 1][0] > c ? -180 : 180, P]), v.push(_)
  4673. } else _ = [], v.push(_);
  4674. _.push([x, n[m][1]])
  4675. } else _.push([n[m][0], n[m][1]])
  4676. }
  4677. } else {
  4678. var M = [];
  4679. v.push(M);
  4680. for (var L = 0; L < n.length; ++L) M.push([n[L][0], n[L][1]])
  4681. }
  4682. for (var O = new yi(this.properties), R = 0; R < v.length; ++R) {
  4683. var T = new di;
  4684. O.geometries.push(T);
  4685. for (var A = v[R], D = 0; D < A.length; ++D) T.move_to(A[D])
  4686. }
  4687. return O
  4688. };
  4689. var Ai = Bt((function (t, e) {
  4690. function n(t) {
  4691. var e = [];
  4692. for (var n in t) e.push(n);
  4693. return e
  4694. }(t.exports = "function" == typeof Object.keys ? Object.keys : n).shim = n
  4695. })),
  4696. Di = Bt((function (t, e) {
  4697. var n = "[object Arguments]" == function () {
  4698. return Object.prototype.toString.call(arguments)
  4699. }();
  4700. function r(t) {
  4701. return "[object Arguments]" == Object.prototype.toString.call(t)
  4702. }
  4703. function i(t) {
  4704. return t && "object" == typeof t && "number" == typeof t.length && Object.prototype.hasOwnProperty.call(t, "callee") && !Object.prototype.propertyIsEnumerable.call(t, "callee") || !1
  4705. }(e = t.exports = n ? r : i).supported = r, e.unsupported = i
  4706. })),
  4707. Fi = Bt((function (t) {
  4708. var e = Array.prototype.slice,
  4709. n = t.exports = function (t, o, s) {
  4710. return s || (s = {}), t === o || (t instanceof Date && o instanceof Date ? t.getTime() === o.getTime() : !t || !o || "object" != typeof t && "object" != typeof o ? s.strict ? t === o : t == o : function (t, o, s) {
  4711. var a, u;
  4712. if (r(t) || r(o)) return !1;
  4713. if (t.prototype !== o.prototype) return !1;
  4714. if (Di(t)) return !!Di(o) && (t = e.call(t), o = e.call(o), n(t, o, s));
  4715. if (i(t)) {
  4716. if (!i(o)) return !1;
  4717. if (t.length !== o.length) return !1;
  4718. for (a = 0; a < t.length; a++)
  4719. if (t[a] !== o[a]) return !1;
  4720. return !0
  4721. }
  4722. try {
  4723. var l = Ai(t),
  4724. c = Ai(o)
  4725. } catch (t) {
  4726. return !1
  4727. }
  4728. if (l.length != c.length) return !1;
  4729. for (l.sort(), c.sort(), a = l.length - 1; a >= 0; a--)
  4730. if (l[a] != c[a]) return !1;
  4731. for (a = l.length - 1; a >= 0; a--)
  4732. if (u = l[a], !n(t[u], o[u], s)) return !1;
  4733. return typeof t == typeof o
  4734. }(t, o, s))
  4735. };
  4736. function r(t) {
  4737. return null == t
  4738. }
  4739. function i(t) {
  4740. return !(!t || "object" != typeof t || "number" != typeof t.length) && ("function" == typeof t.copy && "function" == typeof t.slice && !(t.length > 0 && "number" != typeof t[0]))
  4741. }
  4742. }));
  4743. function ki(t, e, n) {
  4744. if (void 0 === n && (n = {}), !P(n = n || {})) throw new Error("options is invalid");
  4745. var r, i = n.tolerance || 0,
  4746. o = [],
  4747. s = Mr(),
  4748. a = Zn(t);
  4749. return s.load(a), U(e, (function (t) {
  4750. var e = !1;
  4751. t && (F(s.search(t), (function (n) {
  4752. if (!1 === e) {
  4753. var o = Q(t).sort(),
  4754. s = Q(n).sort();
  4755. Fi(o, s) || (0 === i ? Wr(o[0], n) && Wr(o[1], n) : Tr(n, o[0]).properties.dist <= i && Tr(n, o[1]).properties.dist <= i) ? (e = !0, r = r ? Gi(r, t) : t) : (0 === i ? Wr(s[0], t) && Wr(s[1], t) : Tr(t, s[0]).properties.dist <= i && Tr(t, s[1]).properties.dist <= i) && (r = r ? Gi(r, n) : n)
  4756. }
  4757. })), !1 === e && r && (o.push(r), r = void 0))
  4758. })), r && o.push(r), f(o)
  4759. }
  4760. function Gi(t, e) {
  4761. var n = Q(e),
  4762. r = Q(t),
  4763. i = r[0],
  4764. o = r[r.length - 1],
  4765. s = t.geometry.coordinates;
  4766. return Fi(n[0], i) ? s.unshift(n[1]) : Fi(n[0], o) ? s.push(n[1]) : Fi(n[1], i) ? s.unshift(n[0]) : Fi(n[1], o) && s.push(n[0]), t
  4767. }
  4768. function qi(t) {
  4769. var e = t % 360;
  4770. return e < 0 && (e += 360), e
  4771. }
  4772. function Bi(t, e, n) {
  4773. var r;
  4774. return void 0 === n && (n = {}), (r = n.final ? zi(K(e), K(t)) : zi(K(t), K(e))) > 180 ? -(360 - r) : r
  4775. }
  4776. function zi(t, e) {
  4777. var n = I(t[1]),
  4778. r = I(e[1]),
  4779. i = I(e[0] - t[0]);
  4780. i > Math.PI && (i -= 2 * Math.PI), i < -Math.PI && (i += 2 * Math.PI);
  4781. var o = Math.log(Math.tan(r / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4));
  4782. return (w(Math.atan2(i, o)) + 360) % 360
  4783. }
  4784. function ji(t, n, r, i) {
  4785. void 0 === i && (i = {});
  4786. var o = n < 0,
  4787. s = N(Math.abs(n), i.units, "meters");
  4788. o && (s = -Math.abs(s));
  4789. var u = K(t),
  4790. l = function (t, n, r, i) {
  4791. i = void 0 === i ? e : Number(i);
  4792. var o = n / i,
  4793. s = t[0] * Math.PI / 180,
  4794. a = I(t[1]),
  4795. u = I(r),
  4796. l = o * Math.cos(u),
  4797. c = a + l;
  4798. Math.abs(c) > Math.PI / 2 && (c = c > 0 ? Math.PI - c : -Math.PI - c);
  4799. var h = Math.log(Math.tan(c / 2 + Math.PI / 4) / Math.tan(a / 2 + Math.PI / 4)),
  4800. p = Math.abs(h) > 1e-11 ? l / h : Math.cos(a),
  4801. f = o * Math.sin(u) / p;
  4802. return [(180 * (s + f) / Math.PI + 540) % 360 - 180, 180 * c / Math.PI]
  4803. }(u, s, r);
  4804. return l[0] += l[0] - u[0] > 180 ? -360 : u[0] - l[0] > 180 ? 360 : 0, a(l, i.properties)
  4805. }
  4806. function Ui(t, e, n, r, i, o) {
  4807. for (var s = 0; s < t.length; s++) {
  4808. var a = t[s],
  4809. u = t[s + 1];
  4810. s === t.length - 1 && (u = t[0]), r = Xi(a, u, e), n <= 0 && r > 0 ? Xi(e, a, i) < 0 || (i = a) : n > 0 && r <= 0 && (Vi(e, a, o) || (o = a)), n = r
  4811. }
  4812. return [i, o]
  4813. }
  4814. function Vi(t, e, n) {
  4815. return Xi(t, e, n) > 0
  4816. }
  4817. function Xi(t, e, n) {
  4818. return (e[0] - t[0]) * (n[1] - t[1]) - (n[0] - t[0]) * (e[1] - t[1])
  4819. }
  4820. function Yi(t) {
  4821. for (var e, n, r = Q(t), i = 0, o = 1; o < r.length;) e = n || r[0], i += ((n = r[o])[0] - e[0]) * (n[1] + e[1]), o++;
  4822. return i > 0
  4823. }
  4824. function Hi(t, e) {
  4825. switch ("Feature" === t.type ? t.geometry.type : t.type) {
  4826. case "GeometryCollection":
  4827. return q(t, (function (t) {
  4828. Hi(t, e)
  4829. })), t;
  4830. case "LineString":
  4831. return Wi(Q(t), e), t;
  4832. case "Polygon":
  4833. return Ji(Q(t), e), t;
  4834. case "MultiLineString":
  4835. return Q(t).forEach((function (t) {
  4836. Wi(t, e)
  4837. })), t;
  4838. case "MultiPolygon":
  4839. return Q(t).forEach((function (t) {
  4840. Ji(t, e)
  4841. })), t;
  4842. case "Point":
  4843. case "MultiPoint":
  4844. return t
  4845. }
  4846. }
  4847. function Wi(t, e) {
  4848. Yi(t) === e && t.reverse()
  4849. }
  4850. function Ji(t, e) {
  4851. Yi(t[0]) !== e && t[0].reverse();
  4852. for (var n = 1; n < t.length; n++) Yi(t[n]) === e && t[n].reverse()
  4853. }
  4854. function Zi(t, e) {
  4855. if (!P(e = e || {})) throw new Error("options is invalid");
  4856. var n = e.zProperty || "elevation",
  4857. r = e.flip,
  4858. i = e.flags;
  4859. nt(t, "Point", "input must contain Points");
  4860. for (var o = function (t, e) {
  4861. var n = {};
  4862. return F(t, (function (t) {
  4863. var e = Q(t)[1];
  4864. n[e] || (n[e] = []), n[e].push(t)
  4865. })), Object.keys(n).map((function (t) {
  4866. return n[t].sort((function (t, e) {
  4867. return Q(t)[0] - Q(e)[0]
  4868. }))
  4869. })).sort((function (t, n) {
  4870. return e ? Q(t[0])[1] - Q(n[0])[1] : Q(n[0])[1] - Q(t[0])[1]
  4871. }))
  4872. }
  4873. /*!
  4874. * @license GNU Affero General Public License.
  4875. * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
  4876. * v. 1.2.0
  4877. * https://github.com/RaumZeit/MarchingSquares.js
  4878. *
  4879. * MarchingSquaresJS is free software: you can redistribute it and/or modify
  4880. * it under the terms of the GNU Affero General Public License as published by
  4881. * the Free Software Foundation, either version 3 of the License, or
  4882. * (at your option) any later version.
  4883. *
  4884. * MarchingSquaresJS is distributed in the hope that it will be useful,
  4885. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4886. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4887. * GNU Affero General Public License for more details.
  4888. *
  4889. * As additional permission under GNU Affero General Public License version 3
  4890. * section 7, third-party projects (personal or commercial) may distribute,
  4891. * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
  4892. * requirement that said third-party project for that reason alone becomes
  4893. * subject to any requirement of the GNU Affero General Public License version 3.
  4894. * Any modifications to MarchingSquaresJS, however, must be shared with the public
  4895. * and made available.
  4896. *
  4897. * In summary this:
  4898. * - allows you to use MarchingSquaresJS at no cost
  4899. * - allows you to use MarchingSquaresJS for both personal and commercial purposes
  4900. * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
  4901. * license as long as this license notice is included
  4902. * - enables you to keep the source code of your program that uses MarchingSquaresJS
  4903. * undisclosed
  4904. * - forces you to share any modifications you have made to MarchingSquaresJS,
  4905. * e.g. bug-fixes
  4906. *
  4907. * You should have received a copy of the GNU Affero General Public License
  4908. * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
  4909. */
  4910. (t, r), s = [], a = 0; a < o.length; a++) {
  4911. for (var u = o[a], l = [], c = 0; c < u.length; c++) {
  4912. var h = u[c];
  4913. h.properties[n] ? l.push(h.properties[n]) : l.push(0), !0 === i && (h.properties.matrixPosition = [a, c])
  4914. }
  4915. s.push(l)
  4916. }
  4917. return s
  4918. }
  4919. var Ki = {
  4920. successCallback: null,
  4921. verbose: !1,
  4922. polygons: !1
  4923. },
  4924. Qi = {};
  4925. function $i(t, e, n, r) {
  4926. r = r || {};
  4927. for (var i = Object.keys(Ki), o = 0; o < i.length; o++) {
  4928. var s = i[o],
  4929. a = r[s];
  4930. a = null != a ? a : Ki[s], Qi[s] = a
  4931. }
  4932. Qi.verbose && console.log("MarchingSquaresJS-isoBands: computing isobands for [" + e + ":" + (e + n) + "]");
  4933. var u, l = function (t, e, n) {
  4934. for (var r = t.length - 1, i = t[0].length - 1, o = {
  4935. rows: r,
  4936. cols: i,
  4937. cells: []
  4938. }, s = e + Math.abs(n), a = 0; a < r; ++a) {
  4939. o.cells[a] = [];
  4940. for (var u = 0; u < i; ++u) {
  4941. var l = 0,
  4942. c = t[a + 1][u],
  4943. h = t[a + 1][u + 1],
  4944. p = t[a][u + 1],
  4945. f = t[a][u];
  4946. if (!(isNaN(c) || isNaN(h) || isNaN(p) || isNaN(f))) {
  4947. l |= c < e ? 0 : c > s ? 128 : 64, l |= h < e ? 0 : h > s ? 32 : 16, l |= p < e ? 0 : p > s ? 8 : 4;
  4948. var g = +(l |= f < e ? 0 : f > s ? 2 : 1),
  4949. d = 0;
  4950. if (17 === l || 18 === l || 33 === l || 34 === l || 38 === l || 68 === l || 72 === l || 98 === l || 102 === l || 132 === l || 136 === l || 137 === l || 152 === l || 153 === l) {
  4951. var y = (c + h + p + f) / 4;
  4952. d = y > s ? 2 : y < e ? 0 : 1, 34 === l ? 1 === d ? l = 35 : 0 === d && (l = 136) : 136 === l ? 1 === d ? (l = 35, d = 4) : 0 === d && (l = 34) : 17 === l ? 1 === d ? (l = 155, d = 4) : 0 === d && (l = 153) : 68 === l ? 1 === d ? (l = 103, d = 4) : 0 === d && (l = 102) : 153 === l ? 1 === d && (l = 155) : 102 === l ? 1 === d && (l = 103) : 152 === l ? d < 2 && (l = 156, d = 1) : 137 === l ? d < 2 && (l = 139, d = 1) : 98 === l ? d < 2 && (l = 99, d = 1) : 38 === l ? d < 2 && (l = 39, d = 1) : 18 === l ? d > 0 ? (l = 156, d = 4) : l = 152 : 33 === l ? d > 0 ? (l = 139, d = 4) : l = 137 : 72 === l ? d > 0 ? (l = 99, d = 4) : l = 98 : 132 === l && (d > 0 ? (l = 39, d = 4) : l = 38)
  4953. }
  4954. if (0 != l && 170 != l) {
  4955. var v, _, m, x, E, b, w, I;
  4956. v = _ = m = x = E = b = w = I = .5;
  4957. var N = [];
  4958. 1 === l ? (m = 1 - Vo(e, p, f), I = 1 - Vo(e, c, f), N.push(Go[l])) : 169 === l ? (m = Vo(s, f, p), I = Vo(s, f, c), N.push(Go[l])) : 4 === l ? (b = 1 - Vo(e, h, p), x = Vo(e, f, p), N.push(Fo[l])) : 166 === l ? (b = Vo(s, p, h), x = 1 - Vo(s, p, f), N.push(Fo[l])) : 16 === l ? (E = Vo(e, p, h), _ = Vo(e, c, h), N.push(Do[l])) : 154 === l ? (E = 1 - Vo(s, h, p), _ = 1 - Vo(s, h, c), N.push(Do[l])) : 64 === l ? (w = Vo(e, f, c), v = 1 - Vo(e, h, c), N.push(Bo[l])) : 106 === l ? (w = 1 - Vo(s, c, f), v = Vo(s, c, h), N.push(Bo[l])) : 168 === l ? (x = Vo(s, f, p), m = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), N.push(ko[l]), N.push(Go[l])) : 2 === l ? (x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), N.push(ko[l]), N.push(Go[l])) : 162 === l ? (E = Vo(s, p, h), b = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), N.push(ko[l]), N.push(Go[l])) : 8 === l ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), N.push(Do[l]), N.push(Fo[l])) : 138 === l ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c), N.push(Do[l]), N.push(Fo[l])) : 32 === l ? (E = Vo(s, p, h), b = Vo(e, p, h), v = Vo(e, c, h), _ = Vo(s, c, h), N.push(Do[l]), N.push(Fo[l])) : 42 === l ? (I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h), N.push(qo[l]), N.push(Bo[l])) : 128 === l && (I = Vo(e, f, c), w = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c), N.push(qo[l]), N.push(Bo[l])), 5 === l ? (b = 1 - Vo(e, h, p), I = 1 - Vo(e, c, f), N.push(Fo[l])) : 165 === l ? (b = Vo(s, p, h), I = Vo(s, f, c), N.push(Fo[l])) : 20 === l ? (x = Vo(e, f, p), _ = Vo(e, c, h), N.push(ko[l])) : 150 === l ? (x = 1 - Vo(s, p, f), _ = 1 - Vo(s, h, c), N.push(ko[l])) : 80 === l ? (E = Vo(e, p, h), w = Vo(e, f, c), N.push(Do[l])) : 90 === l ? (E = 1 - Vo(s, h, p), w = 1 - Vo(s, c, f), N.push(Do[l])) : 65 === l ? (m = 1 - Vo(e, p, f), v = 1 - Vo(e, h, c), N.push(Go[l])) : 105 === l ? (m = Vo(s, f, p), v = Vo(s, c, h), N.push(Go[l])) : 160 === l ? (E = Vo(s, p, h), b = Vo(e, p, h), I = Vo(e, f, c), w = Vo(s, f, c), N.push(Do[l]), N.push(Fo[l])) : 10 === l ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), N.push(Do[l]), N.push(Fo[l])) : 130 === l ? (x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c), N.push(ko[l]), N.push(Go[l])) : 40 === l ? (x = Vo(s, f, p), m = Vo(e, f, p), v = Vo(e, c, h), _ = Vo(s, c, h), N.push(ko[l]), N.push(Go[l])) : 101 === l ? (b = Vo(s, p, h), v = Vo(s, c, h), N.push(Fo[l])) : 69 === l ? (b = 1 - Vo(e, h, p), v = 1 - Vo(e, h, c), N.push(Fo[l])) : 149 === l ? (I = Vo(s, f, c), _ = 1 - Vo(s, h, c), N.push(qo[l])) : 21 === l ? (I = 1 - Vo(e, c, f), _ = Vo(e, c, h), N.push(qo[l])) : 86 === l ? (x = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), N.push(ko[l])) : 84 === l ? (x = Vo(e, f, p), w = Vo(e, f, c), N.push(ko[l])) : 89 === l ? (E = 1 - Vo(s, h, p), m = Vo(s, f, p), N.push(Go[l])) : 81 === l ? (E = Vo(e, p, h), m = 1 - Vo(e, p, f), N.push(Go[l])) : 96 === l ? (E = Vo(s, p, h), b = Vo(e, p, h), w = Vo(e, f, c), v = Vo(s, c, h), N.push(Do[l]), N.push(Fo[l])) : 74 === l ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), w = 1 - Vo(s, c, f), v = 1 - Vo(e, h, c), N.push(Do[l]), N.push(Fo[l])) : 24 === l ? (E = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), _ = Vo(e, c, h), N.push(Do[l]), N.push(Go[l])) : 146 === l ? (E = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), _ = 1 - Vo(s, h, c), N.push(Do[l]), N.push(Go[l])) : 6 === l ? (b = 1 - Vo(e, h, p), x = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), N.push(Fo[l]), N.push(ko[l])) : 164 === l ? (b = Vo(s, p, h), x = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), N.push(Fo[l]), N.push(ko[l])) : 129 === l ? (m = 1 - Vo(e, p, f), I = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c), N.push(Go[l]), N.push(qo[l])) : 41 === l ? (m = Vo(s, f, p), I = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h), N.push(Go[l]), N.push(qo[l])) : 66 === l ? (x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), v = 1 - Vo(e, h, c), N.push(ko[l]), N.push(Go[l])) : 104 === l ? (x = Vo(s, f, p), m = Vo(e, f, p), w = Vo(e, f, c), v = Vo(s, c, h), N.push(Go[l]), N.push(zo[l])) : 144 === l ? (E = Vo(e, p, h), I = Vo(e, f, c), w = Vo(s, f, c), _ = 1 - Vo(s, h, c), N.push(Do[l]), N.push(Bo[l])) : 26 === l ? (E = 1 - Vo(s, h, p), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), _ = Vo(e, c, h), N.push(Do[l]), N.push(Bo[l])) : 36 === l ? (b = Vo(s, p, h), x = Vo(e, f, p), v = Vo(e, c, h), _ = Vo(s, c, h), N.push(Fo[l]), N.push(ko[l])) : 134 === l ? (b = 1 - Vo(e, h, p), x = 1 - Vo(s, p, f), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c), N.push(Fo[l]), N.push(ko[l])) : 9 === l ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), m = Vo(s, f, p), I = 1 - Vo(e, c, f), N.push(Do[l]), N.push(Fo[l])) : 161 === l ? (E = Vo(s, p, h), b = Vo(e, p, h), m = 1 - Vo(e, p, f), I = Vo(s, f, c), N.push(Do[l]), N.push(Fo[l])) : 37 === l ? (b = Vo(s, p, h), I = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h), N.push(Fo[l]), N.push(qo[l])) : 133 === l ? (b = 1 - Vo(e, h, p), I = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c), N.push(Fo[l]), N.push(qo[l])) : 148 === l ? (x = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), _ = 1 - Vo(s, h, c), N.push(ko[l]), N.push(Bo[l])) : 22 === l ? (x = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), _ = Vo(e, c, h), N.push(ko[l]), N.push(Bo[l])) : 82 === l ? (E = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), N.push(Do[l]), N.push(Go[l])) : 88 === l ? (E = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), w = Vo(e, f, c), N.push(Do[l]), N.push(Go[l])) : 73 === l ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), m = Vo(s, f, p), v = 1 - Vo(e, h, c), N.push(Do[l]), N.push(Fo[l])) : 97 === l ? (E = Vo(s, p, h), b = Vo(e, p, h), m = 1 - Vo(e, p, f), v = Vo(s, c, h), N.push(Do[l]), N.push(Fo[l])) : 145 === l ? (E = Vo(e, p, h), m = 1 - Vo(e, p, f), I = Vo(s, f, c), _ = 1 - Vo(s, h, c), N.push(Do[l]), N.push(qo[l])) : 25 === l ? (E = 1 - Vo(s, h, p), m = Vo(s, f, p), I = 1 - Vo(e, c, f), _ = Vo(e, c, h), N.push(Do[l]), N.push(qo[l])) : 70 === l ? (b = 1 - Vo(e, h, p), x = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), v = 1 - Vo(e, h, c), N.push(Fo[l]), N.push(ko[l])) : 100 === l ? (b = Vo(s, p, h), x = Vo(e, f, p), w = Vo(e, f, c), v = Vo(s, c, h), N.push(Fo[l]), N.push(ko[l])) : 34 === l ? (0 === d ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c)) : (E = Vo(s, p, h), b = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h)), N.push(Do[l]), N.push(Fo[l]), N.push(qo[l]), N.push(Bo[l])) : 35 === l ? (4 === d ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c)) : (E = Vo(s, p, h), b = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h)), N.push(Do[l]), N.push(Fo[l]), N.push(Go[l]), N.push(Bo[l])) : 136 === l ? (0 === d ? (E = Vo(s, p, h), b = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h)) : (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c)), N.push(Do[l]), N.push(Fo[l]), N.push(qo[l]), N.push(Bo[l])) : 153 === l ? (0 === d ? (E = Vo(e, p, h), m = 1 - Vo(e, p, f), I = 1 - Vo(e, c, f), _ = Vo(e, c, h)) : (E = 1 - Vo(s, h, p), m = Vo(s, f, p), I = Vo(s, f, c), _ = 1 - Vo(s, h, c)), N.push(Do[l]), N.push(Go[l])) : 102 === l ? (0 === d ? (b = 1 - Vo(e, h, p), x = Vo(e, f, p), w = Vo(e, f, c), v = 1 - Vo(e, h, c)) : (b = Vo(s, p, h), x = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), v = Vo(s, c, h)), N.push(Fo[l]), N.push(Bo[l])) : 155 === l ? (4 === d ? (E = Vo(e, p, h), m = 1 - Vo(e, p, f), I = 1 - Vo(e, c, f), _ = Vo(e, c, h)) : (E = 1 - Vo(s, h, p), m = Vo(s, f, p), I = Vo(s, f, c), _ = 1 - Vo(s, h, c)), N.push(Do[l]), N.push(qo[l])) : 103 === l ? (4 === d ? (b = 1 - Vo(e, h, p), x = Vo(e, f, p), w = Vo(e, f, c), v = 1 - Vo(e, h, c)) : (b = Vo(s, p, h), x = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), v = Vo(s, c, h)), N.push(Fo[l]), N.push(ko[l])) : 152 === l ? (0 === d ? (E = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), _ = Vo(e, c, h)) : (E = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), _ = 1 - Vo(s, h, c)), N.push(Do[l]), N.push(ko[l]), N.push(Go[l])) : 156 === l ? (4 === d ? (E = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), _ = Vo(e, c, h)) : (E = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), _ = 1 - Vo(s, h, c)), N.push(Do[l]), N.push(Go[l]), N.push(Bo[l])) : 137 === l ? (0 === d ? (E = Vo(s, p, h), b = Vo(e, p, h), m = 1 - Vo(e, p, f), I = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h)) : (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), m = Vo(s, f, p), I = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c)), N.push(Do[l]), N.push(Fo[l]), N.push(Go[l])) : 139 === l ? (4 === d ? (E = Vo(s, p, h), b = Vo(e, p, h), m = 1 - Vo(e, p, f), I = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h)) : (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), m = Vo(s, f, p), I = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c)), N.push(Do[l]), N.push(Fo[l]), N.push(qo[l])) : 98 === l ? (0 === d ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), w = Vo(e, f, c), v = 1 - Vo(e, h, c)) : (E = Vo(s, p, h), b = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), v = Vo(s, c, h)), N.push(Do[l]), N.push(Fo[l]), N.push(Bo[l])) : 99 === l ? (4 === d ? (E = 1 - Vo(e, h, p), b = 1 - Vo(s, h, p), x = Vo(s, f, p), m = Vo(e, f, p), w = Vo(e, f, c), v = 1 - Vo(e, h, c)) : (E = Vo(s, p, h), b = Vo(e, p, h), x = 1 - Vo(e, p, f), m = 1 - Vo(s, p, f), w = 1 - Vo(s, c, f), v = Vo(s, c, h)), N.push(Do[l]), N.push(Fo[l]), N.push(Go[l])) : 38 === l ? (0 === d ? (b = 1 - Vo(e, h, p), x = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c)) : (b = Vo(s, p, h), x = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h)), N.push(Fo[l]), N.push(qo[l]), N.push(Bo[l])) : 39 === l ? (4 === d ? (b = 1 - Vo(e, h, p), x = Vo(e, f, p), I = Vo(e, f, c), w = Vo(s, f, c), v = 1 - Vo(s, h, c), _ = 1 - Vo(e, h, c)) : (b = Vo(s, p, h), x = 1 - Vo(s, p, f), I = 1 - Vo(s, c, f), w = 1 - Vo(e, c, f), v = Vo(e, c, h), _ = Vo(s, c, h)), N.push(Fo[l]), N.push(ko[l]), N.push(Bo[l])) : 85 === l && (E = 1, b = 0, x = 1, m = 0, I = 0, w = 1, v = 0, _ = 1), (v < 0 || v > 1 || _ < 0 || _ > 1 || E < 0 || E > 1 || x < 0 || x > 1 || I < 0 || I > 1 || w < 0 || w > 1) && console.log("MarchingSquaresJS-isoBands: " + l + " " + g + " " + c + "," + h + "," + p + "," + f + " " + d + " " + v + " " + _ + " " + E + " " + b + " " + x + " " + m + " " + I + " " + w), o.cells[a][u] = {
  4959. cval: l,
  4960. cval_real: g,
  4961. flipped: d,
  4962. topleft: v,
  4963. topright: _,
  4964. righttop: E,
  4965. rightbottom: b,
  4966. bottomright: x,
  4967. bottomleft: m,
  4968. leftbottom: I,
  4969. lefttop: w,
  4970. edges: N
  4971. }
  4972. }
  4973. }
  4974. }
  4975. }
  4976. return o
  4977. }(t, e, n);
  4978. return Qi.polygons ? (Qi.verbose && console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"), u = function (t) {
  4979. var e = [],
  4980. n = 0;
  4981. return t.cells.forEach((function (t, r) {
  4982. t.forEach((function (t, i) {
  4983. if (void 0 !== t) {
  4984. var o = Uo[t.cval](t);
  4985. "object" == typeof o && Xo(o) ? "object" == typeof o[0] && Xo(o[0]) ? "object" == typeof o[0][0] && Xo(o[0][0]) ? o.forEach((function (t) {
  4986. t.forEach((function (t) {
  4987. t[0] += i, t[1] += r
  4988. })), e[n++] = t
  4989. })) : (o.forEach((function (t) {
  4990. t[0] += i, t[1] += r
  4991. })), e[n++] = o) : console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates") : console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")
  4992. }
  4993. }))
  4994. })), e
  4995. }(l)) : (Qi.verbose && console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"), u = function (t) {
  4996. for (var e = [], n = t.rows, r = t.cols, i = [], o = 0; o < n; o++)
  4997. for (var s = 0; s < r; s++)
  4998. if (void 0 !== t.cells[o][s] && t.cells[o][s].edges.length > 0) {
  4999. var a = Ho(t.cells[o][s]),
  5000. u = null,
  5001. l = s,
  5002. c = o;
  5003. null !== a && i.push([a.p[0] + l, a.p[1] + c]);
  5004. do {
  5005. if (null === (u = Wo(t.cells[c][l], a.x, a.y, a.o))) break;
  5006. if (i.push([u.p[0] + l, u.p[1] + c]), l += u.x, a = u, (c += u.y) < 0 || c >= n || l < 0 || l >= r || void 0 === t.cells[c][l]) {
  5007. var h = Yo(t, l -= u.x, c -= u.y, u.x, u.y, u.o);
  5008. if (null === h) break;
  5009. h.path.forEach((function (t) {
  5010. i.push(t)
  5011. })), l = h.i, c = h.j, a = h
  5012. }
  5013. } while (void 0 !== t.cells[c][l] && t.cells[c][l].edges.length > 0);
  5014. e.push(i), i = [], t.cells[o][s].edges.length > 0 && s--
  5015. } return e
  5016. }(l)), "function" == typeof Qi.successCallback && Qi.successCallback(u), u
  5017. }
  5018. var to = 64,
  5019. eo = 16,
  5020. no = [],
  5021. ro = [],
  5022. io = [],
  5023. oo = [],
  5024. so = [],
  5025. ao = [],
  5026. uo = [],
  5027. lo = [],
  5028. co = [],
  5029. ho = [],
  5030. po = [],
  5031. fo = [],
  5032. go = [],
  5033. yo = [],
  5034. vo = [],
  5035. _o = [],
  5036. mo = [],
  5037. xo = [],
  5038. Eo = [],
  5039. bo = [],
  5040. wo = [],
  5041. Io = [],
  5042. No = [],
  5043. So = [];
  5044. uo[85] = ho[85] = -1, lo[85] = po[85] = 0, co[85] = fo[85] = 1, Eo[85] = Io[85] = 1, bo[85] = No[85] = 0, wo[85] = So[85] = 1, no[85] = oo[85] = 0, ro[85] = so[85] = -1, io[85] = vo[85] = 0, _o[85] = go[85] = 0, mo[85] = yo[85] = 1, ao[85] = xo[85] = 1, Io[1] = Io[169] = 0, No[1] = No[169] = -1, So[1] = So[169] = 0, go[1] = go[169] = -1, yo[1] = yo[169] = 0, vo[1] = vo[169] = 0, ho[4] = ho[166] = 0, po[4] = po[166] = -1, fo[4] = fo[166] = 1, _o[4] = _o[166] = 1, mo[4] = mo[166] = 0, xo[4] = xo[166] = 0, uo[16] = uo[154] = 0, lo[16] = lo[154] = 1, co[16] = co[154] = 1, oo[16] = oo[154] = 1, so[16] = so[154] = 0, ao[16] = ao[154] = 1, Eo[64] = Eo[106] = 0, bo[64] = bo[106] = 1, wo[64] = wo[106] = 0, no[64] = no[106] = -1, ro[64] = ro[106] = 0, io[64] = io[106] = 1, Eo[2] = Eo[168] = 0, bo[2] = bo[168] = -1, wo[2] = wo[168] = 1, Io[2] = Io[168] = 0, No[2] = No[168] = -1, So[2] = So[168] = 0, go[2] = go[168] = -1, yo[2] = yo[168] = 0, vo[2] = vo[168] = 0, _o[2] = _o[168] = -1, mo[2] = mo[168] = 0, xo[2] = xo[168] = 1, uo[8] = uo[162] = 0, lo[8] = lo[162] = -1, co[8] = co[162] = 0, ho[8] = ho[162] = 0, po[8] = po[162] = -1, fo[8] = fo[162] = 1, go[8] = go[162] = 1, yo[8] = yo[162] = 0, vo[8] = vo[162] = 1, _o[8] = _o[162] = 1, mo[8] = mo[162] = 0, xo[8] = xo[162] = 0, uo[32] = uo[138] = 0, lo[32] = lo[138] = 1, co[32] = co[138] = 1, ho[32] = ho[138] = 0, po[32] = po[138] = 1, fo[32] = fo[138] = 0, no[32] = no[138] = 1, ro[32] = ro[138] = 0, io[32] = io[138] = 0, oo[32] = oo[138] = 1, so[32] = so[138] = 0, ao[32] = ao[138] = 1, Io[128] = Io[42] = 0, No[128] = No[42] = 1, So[128] = So[42] = 1, Eo[128] = Eo[42] = 0, bo[128] = bo[42] = 1, wo[128] = wo[42] = 0, no[128] = no[42] = -1, ro[128] = ro[42] = 0, io[128] = io[42] = 1, oo[128] = oo[42] = -1, so[128] = so[42] = 0, ao[128] = ao[42] = 0, ho[5] = ho[165] = -1, po[5] = po[165] = 0, fo[5] = fo[165] = 0, Io[5] = Io[165] = 1, No[5] = No[165] = 0, So[5] = So[165] = 0, _o[20] = _o[150] = 0, mo[20] = mo[150] = 1, xo[20] = xo[150] = 1, oo[20] = oo[150] = 0, so[20] = so[150] = -1, ao[20] = ao[150] = 1, uo[80] = uo[90] = -1, lo[80] = lo[90] = 0, co[80] = co[90] = 1, Eo[80] = Eo[90] = 1, bo[80] = bo[90] = 0, wo[80] = wo[90] = 1, go[65] = go[105] = 0, yo[65] = yo[105] = 1, vo[65] = vo[105] = 0, no[65] = no[105] = 0, ro[65] = ro[105] = -1, io[65] = io[105] = 0, uo[160] = uo[10] = -1, lo[160] = lo[10] = 0, co[160] = co[10] = 1, ho[160] = ho[10] = -1, po[160] = po[10] = 0, fo[160] = fo[10] = 0, Io[160] = Io[10] = 1, No[160] = No[10] = 0, So[160] = So[10] = 0, Eo[160] = Eo[10] = 1, bo[160] = bo[10] = 0, wo[160] = wo[10] = 1, _o[130] = _o[40] = 0, mo[130] = mo[40] = 1, xo[130] = xo[40] = 1, go[130] = go[40] = 0, yo[130] = yo[40] = 1, vo[130] = vo[40] = 0, no[130] = no[40] = 0, ro[130] = ro[40] = -1, io[130] = io[40] = 0, oo[130] = oo[40] = 0, so[130] = so[40] = -1, ao[130] = ao[40] = 1, ho[37] = ho[133] = 0, po[37] = po[133] = 1, fo[37] = fo[133] = 1, Io[37] = Io[133] = 0, No[37] = No[133] = 1, So[37] = So[133] = 0, no[37] = no[133] = -1, ro[37] = ro[133] = 0, io[37] = io[133] = 0, oo[37] = oo[133] = 1, so[37] = so[133] = 0, ao[37] = ao[133] = 0, _o[148] = _o[22] = -1, mo[148] = mo[22] = 0, xo[148] = xo[22] = 0, Io[148] = Io[22] = 0, No[148] = No[22] = -1, So[148] = So[22] = 1, Eo[148] = Eo[22] = 0, bo[148] = bo[22] = 1, wo[148] = wo[22] = 1, oo[148] = oo[22] = -1, so[148] = so[22] = 0, ao[148] = ao[22] = 1, uo[82] = uo[88] = 0, lo[82] = lo[88] = -1, co[82] = co[88] = 1, _o[82] = _o[88] = 1, mo[82] = mo[88] = 0, xo[82] = xo[88] = 1, go[82] = go[88] = -1, yo[82] = yo[88] = 0, vo[82] = vo[88] = 1, Eo[82] = Eo[88] = 0, bo[82] = bo[88] = -1, wo[82] = wo[88] = 0, uo[73] = uo[97] = 0, lo[73] = lo[97] = 1, co[73] = co[97] = 0, ho[73] = ho[97] = 0, po[73] = po[97] = -1, fo[73] = fo[97] = 0, go[73] = go[97] = 1, yo[73] = yo[97] = 0, vo[73] = vo[97] = 0, no[73] = no[97] = 1, ro[73] = ro[97] = 0, io[73] = io[97] = 1, uo[145] = uo[25] = 0, lo[145] = lo[25] = -1, co[145] = co[25] = 0, go[145] = go[25] = 1, yo[145] = yo[25] = 0, vo[145] = vo[25] = 1, Io[145] = Io[25] = 0, No[145] = No[25] = 1, So[145] = So[25] = 1, oo[145] = oo[25] = -1, so[145] = so[25] = 0, ao[145] = ao[25] = 0, ho[70] = ho[100] = 0, po[70] = po[100] = 1, fo[70] = fo[100] = 0, _o[70] = _o[100] = -1, mo[70] = mo[100] = 0, xo[70] = xo[100] = 1, Eo[70] = Eo[100] = 0, bo[70] = bo[100] = -1, wo[70] = wo[100] = 1, no[70] = no[100] = 1, ro[70] = ro[100] = 0, io[70] = io[100] = 0, ho[101] = ho[69] = 0, po[101] = po[69] = 1, fo[101] = fo[69] = 0, no[101] = no[69] = 1, ro[101] = ro[69] = 0, io[101] = io[69] = 0, Io[149] = Io[21] = 0, No[149] = No[21] = 1, So[149] = So[21] = 1, oo[149] = oo[21] = -1, so[149] = so[21] = 0, ao[149] = ao[21] = 0, _o[86] = _o[84] = -1, mo[86] = mo[84] = 0, xo[86] = xo[84] = 1, Eo[86] = Eo[84] = 0, bo[86] = bo[84] = -1, wo[86] = wo[84] = 1, uo[89] = uo[81] = 0, lo[89] = lo[81] = -1, co[89] = co[81] = 0, go[89] = go[81] = 1, yo[89] = yo[81] = 0, vo[89] = vo[81] = 1, uo[96] = uo[74] = 0, lo[96] = lo[74] = 1, co[96] = co[74] = 0, ho[96] = ho[74] = -1, po[96] = po[74] = 0, fo[96] = fo[74] = 1, Eo[96] = Eo[74] = 1, bo[96] = bo[74] = 0, wo[96] = wo[74] = 0, no[96] = no[74] = 1, ro[96] = ro[74] = 0, io[96] = io[74] = 1, uo[24] = uo[146] = 0, lo[24] = lo[146] = -1, co[24] = co[146] = 1, _o[24] = _o[146] = 1, mo[24] = mo[146] = 0, xo[24] = xo[146] = 1, go[24] = go[146] = 0, yo[24] = yo[146] = 1, vo[24] = vo[146] = 1, oo[24] = oo[146] = 0, so[24] = so[146] = -1, ao[24] = ao[146] = 0, ho[6] = ho[164] = -1, po[6] = po[164] = 0, fo[6] = fo[164] = 1, _o[6] = _o[164] = -1, mo[6] = mo[164] = 0, xo[6] = xo[164] = 0, Io[6] = Io[164] = 0, No[6] = No[164] = -1, So[6] = So[164] = 1, Eo[6] = Eo[164] = 1, bo[6] = bo[164] = 0, wo[6] = wo[164] = 0, go[129] = go[41] = 0, yo[129] = yo[41] = 1, vo[129] = vo[41] = 1, Io[129] = Io[41] = 0, No[129] = No[41] = 1, So[129] = So[41] = 0, no[129] = no[41] = -1, ro[129] = ro[41] = 0, io[129] = io[41] = 0, oo[129] = oo[41] = 0, so[129] = so[41] = -1, ao[129] = ao[41] = 0, _o[66] = _o[104] = 0, mo[66] = mo[104] = 1, xo[66] = xo[104] = 0, go[66] = go[104] = -1, yo[66] = yo[104] = 0, vo[66] = vo[104] = 1, Eo[66] = Eo[104] = 0, bo[66] = bo[104] = -1, wo[66] = wo[104] = 0, no[66] = no[104] = 0, ro[66] = ro[104] = -1, io[66] = io[104] = 1, uo[144] = uo[26] = -1, lo[144] = lo[26] = 0, co[144] = co[26] = 0, Io[144] = Io[26] = 1, No[144] = No[26] = 0, So[144] = So[26] = 1, Eo[144] = Eo[26] = 0, bo[144] = bo[26] = 1, wo[144] = wo[26] = 1, oo[144] = oo[26] = -1, so[144] = so[26] = 0, ao[144] = ao[26] = 1, ho[36] = ho[134] = 0, po[36] = po[134] = 1, fo[36] = fo[134] = 1, _o[36] = _o[134] = 0, mo[36] = mo[134] = 1, xo[36] = xo[134] = 0, no[36] = no[134] = 0, ro[36] = ro[134] = -1, io[36] = io[134] = 1, oo[36] = oo[134] = 1, so[36] = so[134] = 0, ao[36] = ao[134] = 0, uo[9] = uo[161] = -1, lo[9] = lo[161] = 0, co[9] = co[161] = 0, ho[9] = ho[161] = 0, po[9] = po[161] = -1, fo[9] = fo[161] = 0, go[9] = go[161] = 1, yo[9] = yo[161] = 0, vo[9] = vo[161] = 0, Io[9] = Io[161] = 1, No[9] = No[161] = 0, So[9] = So[161] = 1, uo[136] = 0, lo[136] = 1, co[136] = 1, ho[136] = 0, po[136] = 1, fo[136] = 0, _o[136] = -1, mo[136] = 0, xo[136] = 1, go[136] = -1, yo[136] = 0, vo[136] = 0, Io[136] = 0, No[136] = -1, So[136] = 0, Eo[136] = 0, bo[136] = -1, wo[136] = 1, no[136] = 1, ro[136] = 0, io[136] = 0, oo[136] = 1, so[136] = 0, ao[136] = 1, uo[34] = 0, lo[34] = -1, co[34] = 0, ho[34] = 0, po[34] = -1, fo[34] = 1, _o[34] = 1, mo[34] = 0, xo[34] = 0, go[34] = 1, yo[34] = 0, vo[34] = 1, Io[34] = 0, No[34] = 1, So[34] = 1, Eo[34] = 0, bo[34] = 1, wo[34] = 0, no[34] = -1, ro[34] = 0, io[34] = 1, oo[34] = -1, so[34] = 0, ao[34] = 0, uo[35] = 0, lo[35] = 1, co[35] = 1, ho[35] = 0, po[35] = -1, fo[35] = 1, _o[35] = 1, mo[35] = 0, xo[35] = 0, go[35] = -1, yo[35] = 0, vo[35] = 0, Io[35] = 0, No[35] = -1, So[35] = 0, Eo[35] = 0, bo[35] = 1, wo[35] = 0, no[35] = -1, ro[35] = 0, io[35] = 1, oo[35] = 1, so[35] = 0, ao[35] = 1, uo[153] = 0, lo[153] = 1, co[153] = 1, go[153] = -1, yo[153] = 0, vo[153] = 0, Io[153] = 0, No[153] = -1, So[153] = 0, oo[153] = 1, so[153] = 0, ao[153] = 1, ho[102] = 0, po[102] = -1, fo[102] = 1, _o[102] = 1, mo[102] = 0, xo[102] = 0, Eo[102] = 0, bo[102] = 1, wo[102] = 0, no[102] = -1, ro[102] = 0, io[102] = 1, uo[155] = 0, lo[155] = -1, co[155] = 0, go[155] = 1, yo[155] = 0, vo[155] = 1, Io[155] = 0, No[155] = 1, So[155] = 1, oo[155] = -1, so[155] = 0, ao[155] = 0, ho[103] = 0, po[103] = 1, fo[103] = 0, _o[103] = -1, mo[103] = 0, xo[103] = 1, Eo[103] = 0, bo[103] = -1, wo[103] = 1, no[103] = 1, ro[103] = 0, io[103] = 0, uo[152] = 0, lo[152] = 1, co[152] = 1, _o[152] = -1, mo[152] = 0, xo[152] = 1, go[152] = -1, yo[152] = 0, vo[152] = 0, Io[152] = 0, No[152] = -1, So[152] = 0, Eo[152] = 0, bo[152] = -1, wo[152] = 1, oo[152] = 1, so[152] = 0, ao[152] = 1, uo[156] = 0, lo[156] = -1, co[156] = 1, _o[156] = 1, mo[156] = 0, xo[156] = 1, go[156] = -1, yo[156] = 0, vo[156] = 0, Io[156] = 0, No[156] = -1, So[156] = 0, Eo[156] = 0, bo[156] = 1, wo[156] = 1, oo[156] = -1, so[156] = 0, ao[156] = 1, uo[137] = 0, lo[137] = 1, co[137] = 1, ho[137] = 0, po[137] = 1, fo[137] = 0, go[137] = -1, yo[137] = 0, vo[137] = 0, Io[137] = 0, No[137] = -1, So[137] = 0, no[137] = 1, ro[137] = 0, io[137] = 0, oo[137] = 1, so[137] = 0, ao[137] = 1, uo[139] = 0, lo[139] = 1, co[139] = 1, ho[139] = 0, po[139] = -1, fo[139] = 0, go[139] = 1, yo[139] = 0, vo[139] = 0, Io[139] = 0, No[139] = 1, So[139] = 0, no[139] = -1, ro[139] = 0, io[139] = 0, oo[139] = 1, so[139] = 0, ao[139] = 1, uo[98] = 0, lo[98] = -1, co[98] = 0, ho[98] = 0, po[98] = -1, fo[98] = 1, _o[98] = 1, mo[98] = 0, xo[98] = 0, go[98] = 1, yo[98] = 0, vo[98] = 1, Eo[98] = 0, bo[98] = 1, wo[98] = 0, no[98] = -1, ro[98] = 0, io[98] = 1, uo[99] = 0, lo[99] = 1, co[99] = 0, ho[99] = 0, po[99] = -1, fo[99] = 1, _o[99] = 1, mo[99] = 0, xo[99] = 0, go[99] = -1, yo[99] = 0, vo[99] = 1, Eo[99] = 0, bo[99] = -1, wo[99] = 0, no[99] = 1, ro[99] = 0, io[99] = 1, ho[38] = 0, po[38] = -1, fo[38] = 1, _o[38] = 1, mo[38] = 0, xo[38] = 0, Io[38] = 0, No[38] = 1, So[38] = 1, Eo[38] = 0, bo[38] = 1, wo[38] = 0, no[38] = -1, ro[38] = 0, io[38] = 1, oo[38] = -1, so[38] = 0, ao[38] = 0, ho[39] = 0, po[39] = 1, fo[39] = 1, _o[39] = -1, mo[39] = 0, xo[39] = 0, Io[39] = 0, No[39] = -1, So[39] = 1, Eo[39] = 0, bo[39] = 1, wo[39] = 0, no[39] = -1, ro[39] = 0, io[39] = 1, oo[39] = 1, so[39] = 0, ao[39] = 0;
  5045. var Co = function (t) {
  5046. return [
  5047. [t.bottomleft, 0],
  5048. [0, 0],
  5049. [0, t.leftbottom]
  5050. ]
  5051. },
  5052. Po = function (t) {
  5053. return [
  5054. [1, t.rightbottom],
  5055. [1, 0],
  5056. [t.bottomright, 0]
  5057. ]
  5058. },
  5059. Mo = function (t) {
  5060. return [
  5061. [t.topright, 1],
  5062. [1, 1],
  5063. [1, t.righttop]
  5064. ]
  5065. },
  5066. Lo = function (t) {
  5067. return [
  5068. [0, t.lefttop],
  5069. [0, 1],
  5070. [t.topleft, 1]
  5071. ]
  5072. },
  5073. Oo = function (t) {
  5074. return [
  5075. [t.bottomright, 0],
  5076. [t.bottomleft, 0],
  5077. [0, t.leftbottom],
  5078. [0, t.lefttop]
  5079. ]
  5080. },
  5081. Ro = function (t) {
  5082. return [
  5083. [t.bottomright, 0],
  5084. [t.bottomleft, 0],
  5085. [1, t.righttop],
  5086. [1, t.rightbottom]
  5087. ]
  5088. },
  5089. To = function (t) {
  5090. return [
  5091. [1, t.righttop],
  5092. [1, t.rightbottom],
  5093. [t.topleft, 1],
  5094. [t.topright, 1]
  5095. ]
  5096. },
  5097. Ao = function (t) {
  5098. return [
  5099. [0, t.leftbottom],
  5100. [0, t.lefttop],
  5101. [t.topleft, 1],
  5102. [t.topright, 1]
  5103. ]
  5104. },
  5105. Do = [],
  5106. Fo = [],
  5107. ko = [],
  5108. Go = [],
  5109. qo = [],
  5110. Bo = [],
  5111. zo = [],
  5112. jo = [];
  5113. Go[1] = qo[1] = 18, Go[169] = qo[169] = 18, ko[4] = Fo[4] = 12, ko[166] = Fo[166] = 12, Do[16] = jo[16] = 4, Do[154] = jo[154] = 4, Bo[64] = zo[64] = 22, Bo[106] = zo[106] = 22, ko[2] = Bo[2] = 17, Go[2] = qo[2] = 18, ko[168] = Bo[168] = 17, Go[168] = qo[168] = 18, Do[8] = Go[8] = 9, Fo[8] = ko[8] = 12, Do[162] = Go[162] = 9, Fo[162] = ko[162] = 12, Do[32] = jo[32] = 4, Fo[32] = zo[32] = 1, Do[138] = jo[138] = 4, Fo[138] = zo[138] = 1, qo[128] = jo[128] = 21, Bo[128] = zo[128] = 22, qo[42] = jo[42] = 21, Bo[42] = zo[42] = 22, Fo[5] = qo[5] = 14, Fo[165] = qo[165] = 14, ko[20] = jo[20] = 6, ko[150] = jo[150] = 6, Do[80] = Bo[80] = 11, Do[90] = Bo[90] = 11, Go[65] = zo[65] = 3, Go[105] = zo[105] = 3, Do[160] = Bo[160] = 11, Fo[160] = qo[160] = 14, Do[10] = Bo[10] = 11, Fo[10] = qo[10] = 14, ko[130] = jo[130] = 6, Go[130] = zo[130] = 3, ko[40] = jo[40] = 6, Go[40] = zo[40] = 3, Fo[101] = zo[101] = 1, Fo[69] = zo[69] = 1, qo[149] = jo[149] = 21, qo[21] = jo[21] = 21, ko[86] = Bo[86] = 17, ko[84] = Bo[84] = 17, Do[89] = Go[89] = 9, Do[81] = Go[81] = 9, Do[96] = zo[96] = 0, Fo[96] = Bo[96] = 15, Do[74] = zo[74] = 0, Fo[74] = Bo[74] = 15, Do[24] = ko[24] = 8, Go[24] = jo[24] = 7, Do[146] = ko[146] = 8, Go[146] = jo[146] = 7, Fo[6] = Bo[6] = 15, ko[6] = qo[6] = 16, Fo[164] = Bo[164] = 15, ko[164] = qo[164] = 16, Go[129] = jo[129] = 7, qo[129] = zo[129] = 20, Go[41] = jo[41] = 7, qo[41] = zo[41] = 20, ko[66] = zo[66] = 2, Go[66] = Bo[66] = 19, ko[104] = zo[104] = 2, Go[104] = Bo[104] = 19, Do[144] = qo[144] = 10, Bo[144] = jo[144] = 23, Do[26] = qo[26] = 10, Bo[26] = jo[26] = 23, Fo[36] = jo[36] = 5, ko[36] = zo[36] = 2, Fo[134] = jo[134] = 5, ko[134] = zo[134] = 2, Do[9] = qo[9] = 10, Fo[9] = Go[9] = 13, Do[161] = qo[161] = 10, Fo[161] = Go[161] = 13, Fo[37] = jo[37] = 5, qo[37] = zo[37] = 20, Fo[133] = jo[133] = 5, qo[133] = zo[133] = 20, ko[148] = qo[148] = 16, Bo[148] = jo[148] = 23, ko[22] = qo[22] = 16, Bo[22] = jo[22] = 23, Do[82] = ko[82] = 8, Go[82] = Bo[82] = 19, Do[88] = ko[88] = 8, Go[88] = Bo[88] = 19, Do[73] = zo[73] = 0, Fo[73] = Go[73] = 13, Do[97] = zo[97] = 0, Fo[97] = Go[97] = 13, Do[145] = Go[145] = 9, qo[145] = jo[145] = 21, Do[25] = Go[25] = 9, qo[25] = jo[25] = 21, Fo[70] = zo[70] = 1, ko[70] = Bo[70] = 17, Fo[100] = zo[100] = 1, ko[100] = Bo[100] = 17, Do[34] = Go[34] = 9, Fo[34] = ko[34] = 12, qo[34] = jo[34] = 21, Bo[34] = zo[34] = 22, Do[136] = jo[136] = 4, Fo[136] = zo[136] = 1, ko[136] = Bo[136] = 17, Go[136] = qo[136] = 18, Do[35] = jo[35] = 4, Fo[35] = ko[35] = 12, Go[35] = qo[35] = 18, Bo[35] = zo[35] = 22, Do[153] = jo[153] = 4, Go[153] = qo[153] = 18, Fo[102] = ko[102] = 12, Bo[102] = zo[102] = 22, Do[155] = Go[155] = 9, qo[155] = jo[155] = 23, Fo[103] = zo[103] = 1, ko[103] = Bo[103] = 17, Do[152] = jo[152] = 4, ko[152] = Bo[152] = 17, Go[152] = qo[152] = 18, Do[156] = ko[156] = 8, Go[156] = qo[156] = 18, Bo[156] = jo[156] = 23, Do[137] = jo[137] = 4, Fo[137] = zo[137] = 1, Go[137] = qo[137] = 18, Do[139] = jo[139] = 4, Fo[139] = Go[139] = 13, qo[139] = zo[139] = 20, Do[98] = Go[98] = 9, Fo[98] = ko[98] = 12, Bo[98] = zo[98] = 22, Do[99] = zo[99] = 0, Fo[99] = ko[99] = 12, Go[99] = Bo[99] = 19, Fo[38] = ko[38] = 12, qo[38] = jo[38] = 21, Bo[38] = zo[38] = 22, Fo[39] = jo[39] = 5, ko[39] = qo[39] = 16, Bo[39] = zo[39] = 22;
  5114. var Uo = [];
  5115. function Vo(t, e, n) {
  5116. return (t - e) / (n - e)
  5117. }
  5118. function Xo(t) {
  5119. return t.constructor.toString().indexOf("Array") > -1
  5120. }
  5121. function Yo(t, e, n, r, i, o) {
  5122. for (var s = t.cells[n][e], a = s.cval_real, u = e + r, l = n + i, c = [], h = !1; !h;) {
  5123. if (void 0 === t.cells[l] || void 0 === t.cells[l][u])
  5124. if (l -= i, u -= r, a = (s = t.cells[l][u]).cval_real, -1 === i)
  5125. if (0 === o)
  5126. if (1 & a) c.push([u, l]), r = -1, i = 0, o = 0;
  5127. else {
  5128. if (!(4 & a)) {
  5129. c.push([u + s.bottomright, l]), r = 0, i = 1, o = 1, h = !0;
  5130. break
  5131. }
  5132. c.push([u + 1, l]), r = 1, i = 0, o = 0
  5133. }
  5134. else {
  5135. if (!(1 & a)) {
  5136. if (4 & a) {
  5137. c.push([u + s.bottomright, l]), r = 0, i = 1, o = 1, h = !0;
  5138. break
  5139. }
  5140. c.push([u + s.bottomleft, l]), r = 0, i = 1, o = 0, h = !0;
  5141. break
  5142. }
  5143. c.push([u, l]), r = -1, i = 0, o = 0
  5144. } else if (1 === i)
  5145. if (0 === o) {
  5146. if (!(a & eo)) {
  5147. if (a & to) {
  5148. c.push([u + s.topleft, l + 1]), r = 0, i = -1, o = 0, h = !0;
  5149. break
  5150. }
  5151. c.push([u + s.topright, l + 1]), r = 0, i = -1, o = 1, h = !0;
  5152. break
  5153. }
  5154. c.push([u + 1, l + 1]), r = 1, i = 0, o = 1
  5155. } else c.push([u + 1, l + 1]), r = 1, i = 0, o = 1;
  5156. else if (-1 === r)
  5157. if (0 === o) {
  5158. if (!(a & to)) {
  5159. if (1 & a) {
  5160. c.push([u, l + s.leftbottom]), r = 1, i = 0, o = 0, h = !0;
  5161. break
  5162. }
  5163. c.push([u, l + s.lefttop]), r = 1, i = 0, o = 1, h = !0;
  5164. break
  5165. }
  5166. c.push([u, l + 1]), r = 0, i = 1, o = 0
  5167. } else {
  5168. if (!(a & to)) {
  5169. console.log("MarchingSquaresJS-isoBands: wtf");
  5170. break
  5171. }
  5172. c.push([u, l + 1]), r = 0, i = 1, o = 0
  5173. }
  5174. else {
  5175. if (1 !== r) {
  5176. console.log("MarchingSquaresJS-isoBands: we came from nowhere!");
  5177. break
  5178. }
  5179. if (0 === o) {
  5180. if (!(4 & a)) {
  5181. c.push([u + 1, l + s.rightbottom]), r = -1, i = 0, o = 0, h = !0;
  5182. break
  5183. }
  5184. c.push([u + 1, l]), r = 0, i = -1, o = 1
  5185. } else {
  5186. if (!(4 & a)) {
  5187. if (a & eo) {
  5188. c.push([u + 1, l + s.righttop]), r = -1, i = 0, o = 1;
  5189. break
  5190. }
  5191. c.push([u + 1, l + s.rightbottom]), r = -1, i = 0, o = 0, h = !0;
  5192. break
  5193. }
  5194. c.push([u + 1, l]), r = 0, i = -1, o = 1
  5195. }
  5196. } else if (a = (s = t.cells[l][u]).cval_real, -1 === r)
  5197. if (0 === o)
  5198. if (void 0 !== t.cells[l - 1] && void 0 !== t.cells[l - 1][u]) r = 0, i = -1, o = 1;
  5199. else {
  5200. if (!(1 & a)) {
  5201. c.push([u + s.bottomright, l]), r = 0, i = 1, o = 1, h = !0;
  5202. break
  5203. }
  5204. c.push([u, l])
  5205. }
  5206. else {
  5207. if (!(a & to)) {
  5208. console.log("MarchingSquaresJS-isoBands: found entry from top at " + u + "," + l);
  5209. break
  5210. }
  5211. console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")
  5212. } else if (1 === r) {
  5213. if (0 === o) {
  5214. console.log("MarchingSquaresJS-isoBands: wtf");
  5215. break
  5216. }
  5217. if (void 0 !== t.cells[l + 1] && void 0 !== t.cells[l + 1][u]) r = 0, i = 1, o = 0;
  5218. else {
  5219. if (!(a & eo)) {
  5220. c.push([u + s.topleft, l + 1]), r = 0, i = -1, o = 0, h = !0;
  5221. break
  5222. }
  5223. c.push([u + 1, l + 1]), r = 1, i = 0, o = 1
  5224. }
  5225. } else if (-1 === i) {
  5226. if (1 !== o) {
  5227. console.log("MarchingSquaresJS-isoBands: wtf");
  5228. break
  5229. }
  5230. if (void 0 !== t.cells[l][u + 1]) r = 1, i = 0, o = 1;
  5231. else {
  5232. if (!(4 & a)) {
  5233. c.push([u + 1, l + s.righttop]), r = -1, i = 0, o = 1, h = !0;
  5234. break
  5235. }
  5236. c.push([u + 1, l]), r = 0, i = -1, o = 1
  5237. }
  5238. } else {
  5239. if (1 !== i) {
  5240. console.log("MarchingSquaresJS-isoBands: where did we came from???");
  5241. break
  5242. }
  5243. if (0 !== o) {
  5244. console.log("MarchingSquaresJS-isoBands: wtf");
  5245. break
  5246. }
  5247. if (void 0 !== t.cells[l][u - 1]) r = -1, i = 0, o = 0;
  5248. else {
  5249. if (!(a & to)) {
  5250. c.push([u, l + s.leftbottom]), r = 1, i = 0, o = 0, h = !0;
  5251. break
  5252. }
  5253. c.push([u, l + 1]), r = 0, i = 1, o = 0
  5254. }
  5255. }
  5256. if (l += i, (u += r) === e && l === n) break
  5257. }
  5258. return {
  5259. path: c,
  5260. i: u,
  5261. j: l,
  5262. x: r,
  5263. y: i,
  5264. o: o
  5265. }
  5266. }
  5267. function Ho(t) {
  5268. if (t.edges.length > 0) {
  5269. var e = t.edges[t.edges.length - 1],
  5270. n = t.cval_real;
  5271. switch (e) {
  5272. case 0:
  5273. return n & eo ? {
  5274. p: [1, t.righttop],
  5275. x: -1,
  5276. y: 0,
  5277. o: 1
  5278. } : {
  5279. p: [t.topleft, 1],
  5280. x: 0,
  5281. y: -1,
  5282. o: 0
  5283. };
  5284. case 1:
  5285. return 4 & n ? {
  5286. p: [t.topleft, 1],
  5287. x: 0,
  5288. y: -1,
  5289. o: 0
  5290. } : {
  5291. p: [1, t.rightbottom],
  5292. x: -1,
  5293. y: 0,
  5294. o: 0
  5295. };
  5296. case 2:
  5297. return 4 & n ? {
  5298. p: [t.bottomright, 0],
  5299. x: 0,
  5300. y: 1,
  5301. o: 1
  5302. } : {
  5303. p: [t.topleft, 1],
  5304. x: 0,
  5305. y: -1,
  5306. o: 0
  5307. };
  5308. case 3:
  5309. return 1 & n ? {
  5310. p: [t.topleft, 1],
  5311. x: 0,
  5312. y: -1,
  5313. o: 0
  5314. } : {
  5315. p: [t.bottomleft, 0],
  5316. x: 0,
  5317. y: 1,
  5318. o: 0
  5319. };
  5320. case 4:
  5321. return n & eo ? {
  5322. p: [1, t.righttop],
  5323. x: -1,
  5324. y: 0,
  5325. o: 1
  5326. } : {
  5327. p: [t.topright, 1],
  5328. x: 0,
  5329. y: -1,
  5330. o: 1
  5331. };
  5332. case 5:
  5333. return 4 & n ? {
  5334. p: [t.topright, 1],
  5335. x: 0,
  5336. y: -1,
  5337. o: 1
  5338. } : {
  5339. p: [1, t.rightbottom],
  5340. x: -1,
  5341. y: 0,
  5342. o: 0
  5343. };
  5344. case 6:
  5345. return 4 & n ? {
  5346. p: [t.bottomright, 0],
  5347. x: 0,
  5348. y: 1,
  5349. o: 1
  5350. } : {
  5351. p: [t.topright, 1],
  5352. x: 0,
  5353. y: -1,
  5354. o: 1
  5355. };
  5356. case 7:
  5357. return 1 & n ? {
  5358. p: [t.topright, 1],
  5359. x: 0,
  5360. y: -1,
  5361. o: 1
  5362. } : {
  5363. p: [t.bottomleft, 0],
  5364. x: 0,
  5365. y: 1,
  5366. o: 0
  5367. };
  5368. case 8:
  5369. return 4 & n ? {
  5370. p: [t.bottomright, 0],
  5371. x: 0,
  5372. y: 1,
  5373. o: 1
  5374. } : {
  5375. p: [1, t.righttop],
  5376. x: -1,
  5377. y: 0,
  5378. o: 1
  5379. };
  5380. case 9:
  5381. return 1 & n ? {
  5382. p: [1, t.righttop],
  5383. x: -1,
  5384. y: 0,
  5385. o: 1
  5386. } : {
  5387. p: [t.bottomleft, 0],
  5388. x: 0,
  5389. y: 1,
  5390. o: 0
  5391. };
  5392. case 10:
  5393. return 1 & n ? {
  5394. p: [0, t.leftbottom],
  5395. x: 1,
  5396. y: 0,
  5397. o: 0
  5398. } : {
  5399. p: [1, t.righttop],
  5400. x: -1,
  5401. y: 0,
  5402. o: 1
  5403. };
  5404. case 11:
  5405. return n & to ? {
  5406. p: [1, t.righttop],
  5407. x: -1,
  5408. y: 0,
  5409. o: 1
  5410. } : {
  5411. p: [0, t.lefttop],
  5412. x: 1,
  5413. y: 0,
  5414. o: 1
  5415. };
  5416. case 12:
  5417. return 4 & n ? {
  5418. p: [t.bottomright, 0],
  5419. x: 0,
  5420. y: 1,
  5421. o: 1
  5422. } : {
  5423. p: [1, t.rightbottom],
  5424. x: -1,
  5425. y: 0,
  5426. o: 0
  5427. };
  5428. case 13:
  5429. return 1 & n ? {
  5430. p: [1, t.rightbottom],
  5431. x: -1,
  5432. y: 0,
  5433. o: 0
  5434. } : {
  5435. p: [t.bottomleft, 0],
  5436. x: 0,
  5437. y: 1,
  5438. o: 0
  5439. };
  5440. case 14:
  5441. return 1 & n ? {
  5442. p: [0, t.leftbottom],
  5443. x: 1,
  5444. y: 0,
  5445. o: 0
  5446. } : {
  5447. p: [1, t.rightbottom],
  5448. x: -1,
  5449. y: 0,
  5450. o: 0
  5451. };
  5452. case 15:
  5453. return n & to ? {
  5454. p: [1, t.rightbottom],
  5455. x: -1,
  5456. y: 0,
  5457. o: 0
  5458. } : {
  5459. p: [0, t.lefttop],
  5460. x: 1,
  5461. y: 0,
  5462. o: 1
  5463. };
  5464. case 16:
  5465. return 4 & n ? {
  5466. p: [t.bottomright, 0],
  5467. x: 0,
  5468. y: 1,
  5469. o: 1
  5470. } : {
  5471. p: [0, t.leftbottom],
  5472. x: 1,
  5473. y: 0,
  5474. o: 0
  5475. };
  5476. case 17:
  5477. return n & to ? {
  5478. p: [t.bottomright, 0],
  5479. x: 0,
  5480. y: 1,
  5481. o: 1
  5482. } : {
  5483. p: [0, t.lefttop],
  5484. x: 1,
  5485. y: 0,
  5486. o: 1
  5487. };
  5488. case 18:
  5489. return 1 & n ? {
  5490. p: [0, t.leftbottom],
  5491. x: 1,
  5492. y: 0,
  5493. o: 0
  5494. } : {
  5495. p: [t.bottomleft, 0],
  5496. x: 0,
  5497. y: 1,
  5498. o: 0
  5499. };
  5500. case 19:
  5501. return n & to ? {
  5502. p: [t.bottomleft, 0],
  5503. x: 0,
  5504. y: 1,
  5505. o: 0
  5506. } : {
  5507. p: [0, t.lefttop],
  5508. x: 1,
  5509. y: 0,
  5510. o: 1
  5511. };
  5512. case 20:
  5513. return n & to ? {
  5514. p: [t.topleft, 1],
  5515. x: 0,
  5516. y: -1,
  5517. o: 0
  5518. } : {
  5519. p: [0, t.leftbottom],
  5520. x: 1,
  5521. y: 0,
  5522. o: 0
  5523. };
  5524. case 21:
  5525. return n & eo ? {
  5526. p: [0, t.leftbottom],
  5527. x: 1,
  5528. y: 0,
  5529. o: 0
  5530. } : {
  5531. p: [t.topright, 1],
  5532. x: 0,
  5533. y: -1,
  5534. o: 1
  5535. };
  5536. case 22:
  5537. return n & to ? {
  5538. p: [t.topleft, 1],
  5539. x: 0,
  5540. y: -1,
  5541. o: 0
  5542. } : {
  5543. p: [0, t.lefttop],
  5544. x: 1,
  5545. y: 0,
  5546. o: 1
  5547. };
  5548. case 23:
  5549. return n & eo ? {
  5550. p: [0, t.lefttop],
  5551. x: 1,
  5552. y: 0,
  5553. o: 1
  5554. } : {
  5555. p: [t.topright, 1],
  5556. x: 0,
  5557. y: -1,
  5558. o: 1
  5559. };
  5560. default:
  5561. console.log("MarchingSquaresJS-isoBands: edge index out of range!"), console.log(t)
  5562. }
  5563. }
  5564. return null
  5565. }
  5566. function Wo(t, e, n, r) {
  5567. var i, o, s, a, u, l = t.cval;
  5568. switch (e) {
  5569. case -1:
  5570. switch (r) {
  5571. case 0:
  5572. i = Fo[l], s = ho[l], a = po[l], u = fo[l];
  5573. break;
  5574. default:
  5575. i = Do[l], s = uo[l], a = lo[l], u = co[l]
  5576. }
  5577. break;
  5578. case 1:
  5579. switch (r) {
  5580. case 0:
  5581. i = qo[l], s = Io[l], a = No[l], u = So[l];
  5582. break;
  5583. default:
  5584. i = Bo[l], s = Eo[l], a = bo[l], u = wo[l]
  5585. }
  5586. break;
  5587. default:
  5588. switch (n) {
  5589. case -1:
  5590. switch (r) {
  5591. case 0:
  5592. i = zo[l], s = no[l], a = ro[l], u = io[l];
  5593. break;
  5594. default:
  5595. i = jo[l], s = oo[l], a = so[l], u = ao[l]
  5596. }
  5597. break;
  5598. case 1:
  5599. switch (r) {
  5600. case 0:
  5601. i = Go[l], s = go[l], a = yo[l], u = vo[l];
  5602. break;
  5603. default:
  5604. i = ko[l], s = _o[l], a = mo[l], u = xo[l]
  5605. }
  5606. }
  5607. }
  5608. if (o = t.edges.indexOf(i), void 0 === t.edges[o]) return null;
  5609. switch (function (t, e) {
  5610. delete t.edges[e];
  5611. for (var n = e + 1; n < t.edges.length; n++) t.edges[n - 1] = t.edges[n];
  5612. t.edges.pop()
  5613. }(t, o), l = t.cval_real, i) {
  5614. case 0:
  5615. l & eo ? (e = t.topleft, n = 1) : (e = 1, n = t.righttop);
  5616. break;
  5617. case 1:
  5618. 4 & l ? (e = 1, n = t.rightbottom) : (e = t.topleft, n = 1);
  5619. break;
  5620. case 2:
  5621. 4 & l ? (e = t.topleft, n = 1) : (e = t.bottomright, n = 0);
  5622. break;
  5623. case 3:
  5624. 1 & l ? (e = t.bottomleft, n = 0) : (e = t.topleft, n = 1);
  5625. break;
  5626. case 4:
  5627. l & eo ? (e = t.topright, n = 1) : (e = 1, n = t.righttop);
  5628. break;
  5629. case 5:
  5630. 4 & l ? (e = 1, n = t.rightbottom) : (e = t.topright, n = 1);
  5631. break;
  5632. case 6:
  5633. 4 & l ? (e = t.topright, n = 1) : (e = t.bottomright, n = 0);
  5634. break;
  5635. case 7:
  5636. 1 & l ? (e = t.bottomleft, n = 0) : (e = t.topright, n = 1);
  5637. break;
  5638. case 8:
  5639. 4 & l ? (e = 1, n = t.righttop) : (e = t.bottomright, n = 0);
  5640. break;
  5641. case 9:
  5642. 1 & l ? (e = t.bottomleft, n = 0) : (e = 1, n = t.righttop);
  5643. break;
  5644. case 10:
  5645. 1 & l ? (e = 1, n = t.righttop) : (e = 0, n = t.leftbottom);
  5646. break;
  5647. case 11:
  5648. l & to ? (e = 0, n = t.lefttop) : (e = 1, n = t.righttop);
  5649. break;
  5650. case 12:
  5651. 4 & l ? (e = 1, n = t.rightbottom) : (e = t.bottomright, n = 0);
  5652. break;
  5653. case 13:
  5654. 1 & l ? (e = t.bottomleft, n = 0) : (e = 1, n = t.rightbottom);
  5655. break;
  5656. case 14:
  5657. 1 & l ? (e = 1, n = t.rightbottom) : (e = 0, n = t.leftbottom);
  5658. break;
  5659. case 15:
  5660. l & to ? (e = 0, n = t.lefttop) : (e = 1, n = t.rightbottom);
  5661. break;
  5662. case 16:
  5663. 4 & l ? (e = 0, n = t.leftbottom) : (e = t.bottomright, n = 0);
  5664. break;
  5665. case 17:
  5666. l & to ? (e = 0, n = t.lefttop) : (e = t.bottomright, n = 0);
  5667. break;
  5668. case 18:
  5669. 1 & l ? (e = t.bottomleft, n = 0) : (e = 0, n = t.leftbottom);
  5670. break;
  5671. case 19:
  5672. l & to ? (e = 0, n = t.lefttop) : (e = t.bottomleft, n = 0);
  5673. break;
  5674. case 20:
  5675. l & to ? (e = 0, n = t.leftbottom) : (e = t.topleft, n = 1);
  5676. break;
  5677. case 21:
  5678. l & eo ? (e = t.topright, n = 1) : (e = 0, n = t.leftbottom);
  5679. break;
  5680. case 22:
  5681. l & to ? (e = 0, n = t.lefttop) : (e = t.topleft, n = 1);
  5682. break;
  5683. case 23:
  5684. l & eo ? (e = t.topright, n = 1) : (e = 0, n = t.lefttop);
  5685. break;
  5686. default:
  5687. return console.log("MarchingSquaresJS-isoBands: edge index out of range!"), console.log(t), null
  5688. }
  5689. return void 0 !== e && void 0 !== n && void 0 !== s && void 0 !== a && void 0 !== u || (console.log("MarchingSquaresJS-isoBands: undefined value!"), console.log(t), console.log(e + " " + n + " " + s + " " + a + " " + u)), {
  5690. p: [e, n],
  5691. x: s,
  5692. y: a,
  5693. o: u
  5694. }
  5695. }
  5696. function Jo(t) {
  5697. var e = [],
  5698. n = [];
  5699. t.forEach((function (t) {
  5700. var r = jr(l([t]));
  5701. n.push(r), e.push({
  5702. ring: t,
  5703. area: r
  5704. })
  5705. })), n.sort((function (t, e) {
  5706. return e - t
  5707. }));
  5708. var r = [];
  5709. return n.forEach((function (t) {
  5710. for (var n = 0; n < e.length; n++)
  5711. if (e[n].area === t) {
  5712. r.push(e[n].ring), e.splice(n, 1);
  5713. break
  5714. }
  5715. })), r
  5716. }
  5717. function Zo(t) {
  5718. for (var e = t.map((function (t) {
  5719. return {
  5720. lrCoordinates: t,
  5721. grouped: !1
  5722. }
  5723. })), n = []; !Qo(e);)
  5724. for (var r = 0; r < e.length; r++)
  5725. if (!e[r].grouped) {
  5726. var i = [];
  5727. i.push(e[r].lrCoordinates), e[r].grouped = !0;
  5728. for (var o = l([e[r].lrCoordinates]), s = r + 1; s < e.length; s++) {
  5729. if (!e[s].grouped) Ko(l([e[s].lrCoordinates]), o) && (i.push(e[s].lrCoordinates), e[s].grouped = !0)
  5730. }
  5731. n.push(i)
  5732. } return n
  5733. }
  5734. function Ko(t, e) {
  5735. for (var n = bn(t), r = 0; r < n.features.length; r++)
  5736. if (!ye(n.features[r], e)) return !1;
  5737. return !0
  5738. }
  5739. function Qo(t) {
  5740. for (var e = 0; e < t.length; e++)
  5741. if (!1 === t[e].grouped) return !1;
  5742. return !0
  5743. }
  5744. function $o(t, e, n) {
  5745. if (!P(n = n || {})) throw new Error("options is invalid");
  5746. var r = n.pivot,
  5747. i = n.mutate;
  5748. if (!t) throw new Error("geojson is required");
  5749. if (null == e || isNaN(e)) throw new Error("angle is required");
  5750. return 0 === e || (r || (r = En(t)), !1 !== i && void 0 !== i || (t = Ie(t)), R(t, (function (t) {
  5751. var n = Bi(r, t) + e,
  5752. i = Ar(r, t),
  5753. o = Q(ji(r, i, n));
  5754. t[0] = o[0], t[1] = o[1]
  5755. }))), t
  5756. }
  5757. function ts(t, e, n) {
  5758. if (!P(n = n || {})) throw new Error("options is invalid");
  5759. var r = n.origin,
  5760. i = n.mutate;
  5761. if (!t) throw new Error("geojson required");
  5762. if ("number" != typeof e || 0 === e) throw new Error("invalid factor");
  5763. var o = Array.isArray(r) || "object" == typeof r;
  5764. return !0 !== i && (t = Ie(t)), "FeatureCollection" !== t.type || o ? es(t, e, r) : (F(t, (function (n, i) {
  5765. t.features[i] = es(n, e, r)
  5766. })), t)
  5767. }
  5768. function es(t, e, n) {
  5769. var r = "Point" === it(t);
  5770. return n = function (t, e) {
  5771. null == e && (e = "centroid");
  5772. if (Array.isArray(e) || "object" == typeof e) return K(e);
  5773. var n = t.bbox ? t.bbox : Z(t),
  5774. r = n[0],
  5775. i = n[1],
  5776. o = n[2],
  5777. s = n[3];
  5778. switch (e) {
  5779. case "sw":
  5780. case "southwest":
  5781. case "westsouth":
  5782. case "bottomleft":
  5783. return a([r, i]);
  5784. case "se":
  5785. case "southeast":
  5786. case "eastsouth":
  5787. case "bottomright":
  5788. return a([o, i]);
  5789. case "nw":
  5790. case "northwest":
  5791. case "westnorth":
  5792. case "topleft":
  5793. return a([r, s]);
  5794. case "ne":
  5795. case "northeast":
  5796. case "eastnorth":
  5797. case "topright":
  5798. return a([o, s]);
  5799. case "center":
  5800. return xn(t);
  5801. case void 0:
  5802. case null:
  5803. case "centroid":
  5804. return En(t);
  5805. default:
  5806. throw new Error("invalid origin")
  5807. }
  5808. }(t, n), 1 === e || r || R(t, (function (t) {
  5809. var r = Ar(n, t),
  5810. i = Bi(n, t),
  5811. o = Q(ji(n, r * e, i));
  5812. t[0] = o[0], t[1] = o[1], 3 === t.length && (t[2] *= e)
  5813. })), t
  5814. }
  5815. function ns(t) {
  5816. var e = t[0],
  5817. n = t[1];
  5818. return [n[0] - e[0], n[1] - e[1]]
  5819. }
  5820. function rs(t, e) {
  5821. return t[0] * e[1] - e[0] * t[1]
  5822. }
  5823. function is(t, e) {
  5824. return ! function (t, e) {
  5825. return 0 === rs(ns(t), ns(e))
  5826. }(t, e) && function (t, e) {
  5827. var n, r, i = t[0],
  5828. o = ns(t),
  5829. s = e[0],
  5830. a = ns(e),
  5831. u = rs(o, a);
  5832. return function (t, e) {
  5833. return [t[0] + e[0], t[1] + e[1]]
  5834. }(i, function (t, e) {
  5835. return [t * e[0], t * e[1]]
  5836. }(rs((r = i, [(n = s)[0] - r[0], n[1] - r[1]]), a) / u, o))
  5837. }(t, e)
  5838. }
  5839. function os(t, e, n) {
  5840. var r = [],
  5841. i = E(e, n),
  5842. o = Q(t),
  5843. s = [];
  5844. return o.forEach((function (t, e) {
  5845. if (e !== o.length - 1) {
  5846. var n = (l = t, c = o[e + 1], h = i, p = Math.sqrt((l[0] - c[0]) * (l[0] - c[0]) + (l[1] - c[1]) * (l[1] - c[1])), f = l[0] + h * (c[1] - l[1]) / p, g = c[0] + h * (c[1] - l[1]) / p, d = l[1] + h * (l[0] - c[0]) / p, y = c[1] + h * (l[0] - c[0]) / p, [
  5847. [f, d],
  5848. [g, y]
  5849. ]);
  5850. if (r.push(n), e > 0) {
  5851. var a = r[e - 1],
  5852. u = is(n, a);
  5853. !1 !== u && (a[1] = u, n[0] = u), s.push(a[0]), e === o.length - 2 && (s.push(n[0]), s.push(n[1]))
  5854. }
  5855. 2 === o.length && (s.push(n[0]), s.push(n[1]))
  5856. }
  5857. var l, c, h, p, f, g, d, y
  5858. })), h(s, t.properties)
  5859. }
  5860. function ss(t, e, n) {
  5861. var r = e[0] - t[0],
  5862. i = e[1] - t[1],
  5863. o = n[0] - e[0];
  5864. return function (t) {
  5865. return (t > 0) - (t < 0) || +t
  5866. }(r * (n[1] - e[1]) - o * i)
  5867. }
  5868. function as(t, e) {
  5869. return e.geometry.coordinates[0].every((function (e) {
  5870. return ye(a(e), t)
  5871. }))
  5872. }
  5873. Uo[1] = Uo[169] = Co, Uo[4] = Uo[166] = Po, Uo[16] = Uo[154] = Mo, Uo[64] = Uo[106] = Lo, Uo[168] = Uo[2] = Oo, Uo[162] = Uo[8] = Ro, Uo[138] = Uo[32] = To, Uo[42] = Uo[128] = Ao, Uo[5] = Uo[165] = function (t) {
  5874. return [
  5875. [0, 0],
  5876. [0, t.leftbottom],
  5877. [1, t.rightbottom],
  5878. [1, 0]
  5879. ]
  5880. }, Uo[20] = Uo[150] = function (t) {
  5881. return [
  5882. [1, 0],
  5883. [t.bottomright, 0],
  5884. [t.topright, 1],
  5885. [1, 1]
  5886. ]
  5887. }, Uo[80] = Uo[90] = function (t) {
  5888. return [
  5889. [1, 1],
  5890. [1, t.righttop],
  5891. [0, t.lefttop],
  5892. [0, 1]
  5893. ]
  5894. }, Uo[65] = Uo[105] = function (t) {
  5895. return [
  5896. [t.bottomleft, 0],
  5897. [0, 0],
  5898. [0, 1],
  5899. [t.topleft, 1]
  5900. ]
  5901. }, Uo[160] = Uo[10] = function (t) {
  5902. return [
  5903. [1, t.righttop],
  5904. [1, t.rightbottom],
  5905. [0, t.leftbottom],
  5906. [0, t.lefttop]
  5907. ]
  5908. }, Uo[130] = Uo[40] = function (t) {
  5909. return [
  5910. [t.topleft, 1],
  5911. [t.topright, 1],
  5912. [t.bottomright, 0],
  5913. [t.bottomleft, 0]
  5914. ]
  5915. }, Uo[85] = function () {
  5916. return [
  5917. [0, 0],
  5918. [0, 1],
  5919. [1, 1],
  5920. [1, 0]
  5921. ]
  5922. }, Uo[101] = Uo[69] = function (t) {
  5923. return [
  5924. [1, t.rightbottom],
  5925. [1, 0],
  5926. [0, 0],
  5927. [0, 1],
  5928. [t.topleft, 1]
  5929. ]
  5930. }, Uo[149] = Uo[21] = function (t) {
  5931. return [
  5932. [t.topright, 1],
  5933. [1, 1],
  5934. [1, 0],
  5935. [0, 0],
  5936. [0, t.leftbottom]
  5937. ]
  5938. }, Uo[86] = Uo[84] = function (t) {
  5939. return [
  5940. [1, 0],
  5941. [t.bottomright, 0],
  5942. [0, t.lefttop],
  5943. [0, 1],
  5944. [1, 1]
  5945. ]
  5946. }, Uo[89] = Uo[81] = function (t) {
  5947. return [
  5948. [1, 1],
  5949. [1, t.righttop],
  5950. [t.bottomleft, 0],
  5951. [0, 0],
  5952. [0, 1]
  5953. ]
  5954. }, Uo[96] = Uo[74] = function (t) {
  5955. return [
  5956. [1, t.righttop],
  5957. [1, t.rightbottom],
  5958. [0, t.lefttop],
  5959. [0, 1],
  5960. [t.topleft, 1]
  5961. ]
  5962. }, Uo[24] = Uo[146] = function (t) {
  5963. return [
  5964. [1, 1],
  5965. [1, t.righttop],
  5966. [t.bottomright, 0],
  5967. [t.bottomleft, 0],
  5968. [t.topright, 1]
  5969. ]
  5970. }, Uo[6] = Uo[164] = function (t) {
  5971. return [
  5972. [1, t.rightbottom],
  5973. [1, 0],
  5974. [t.bottomright, 0],
  5975. [0, t.leftbottom],
  5976. [0, t.lefttop]
  5977. ]
  5978. }, Uo[129] = Uo[41] = function (t) {
  5979. return [
  5980. [t.topright, 1],
  5981. [t.bottomleft, 0],
  5982. [0, 0],
  5983. [0, t.leftbottom],
  5984. [t.topleft, 1]
  5985. ]
  5986. }, Uo[66] = Uo[104] = function (t) {
  5987. return [
  5988. [t.bottomright, 0],
  5989. [t.bottomleft, 0],
  5990. [0, t.lefttop],
  5991. [0, 1],
  5992. [t.topleft, 1]
  5993. ]
  5994. }, Uo[144] = Uo[26] = function (t) {
  5995. return [
  5996. [1, 1],
  5997. [1, t.righttop],
  5998. [0, t.leftbottom],
  5999. [0, t.lefttop],
  6000. [t.topright, 1]
  6001. ]
  6002. }, Uo[36] = Uo[134] = function (t) {
  6003. return [
  6004. [1, t.rightbottom],
  6005. [1, 0],
  6006. [t.bottomright, 0],
  6007. [t.topleft, 1],
  6008. [t.topright, 1]
  6009. ]
  6010. }, Uo[9] = Uo[161] = function (t) {
  6011. return [
  6012. [1, t.righttop],
  6013. [1, t.rightbottom],
  6014. [t.bottomleft, 0],
  6015. [0, 0],
  6016. [0, t.leftbottom]
  6017. ]
  6018. }, Uo[37] = Uo[133] = function (t) {
  6019. return [
  6020. [1, t.rightbottom],
  6021. [1, 0],
  6022. [0, 0],
  6023. [0, t.leftbottom],
  6024. [t.topleft, 1],
  6025. [t.topright, 1]
  6026. ]
  6027. }, Uo[148] = Uo[22] = function (t) {
  6028. return [
  6029. [1, 1],
  6030. [1, 0],
  6031. [t.bottomright, 0],
  6032. [0, t.leftbottom],
  6033. [0, t.lefttop],
  6034. [t.topright, 1]
  6035. ]
  6036. }, Uo[82] = Uo[88] = function (t) {
  6037. return [
  6038. [1, 1],
  6039. [1, t.righttop],
  6040. [t.bottomright, 0],
  6041. [t.bottomleft, 0],
  6042. [0, t.lefttop],
  6043. [0, 1]
  6044. ]
  6045. }, Uo[73] = Uo[97] = function (t) {
  6046. return [
  6047. [1, t.righttop],
  6048. [1, t.rightbottom],
  6049. [t.bottomleft, 0],
  6050. [0, 0],
  6051. [0, 1],
  6052. [t.topleft, 1]
  6053. ]
  6054. }, Uo[145] = Uo[25] = function (t) {
  6055. return [
  6056. [1, 1],
  6057. [1, t.righttop],
  6058. [t.bottomleft, 0],
  6059. [0, 0],
  6060. [0, t.leftbottom],
  6061. [t.topright, 1]
  6062. ]
  6063. }, Uo[70] = Uo[100] = function (t) {
  6064. return [
  6065. [1, t.rightbottom],
  6066. [1, 0],
  6067. [t.bottomright, 0],
  6068. [0, t.lefttop],
  6069. [0, 1],
  6070. [t.topleft, 1]
  6071. ]
  6072. }, Uo[34] = function (t) {
  6073. return [Ao(t), Ro(t)]
  6074. }, Uo[35] = function (t) {
  6075. return [
  6076. [1, t.righttop],
  6077. [1, t.rightbottom],
  6078. [t.bottomright, 0],
  6079. [t.bottomleft, 0],
  6080. [0, t.leftbottom],
  6081. [0, t.lefttop],
  6082. [t.topleft, 1],
  6083. [t.topright, 1]
  6084. ]
  6085. }, Uo[136] = function (t) {
  6086. return [To(t), Oo(t)]
  6087. }, Uo[153] = function (t) {
  6088. return [Mo(t), Co(t)]
  6089. }, Uo[102] = function (t) {
  6090. return [Po(t), Lo(t)]
  6091. }, Uo[155] = function (t) {
  6092. return [
  6093. [1, 1],
  6094. [1, t.righttop],
  6095. [t.bottomleft, 0],
  6096. [0, 0],
  6097. [0, t.leftbottom],
  6098. [t.topright, 1]
  6099. ]
  6100. }, Uo[103] = function (t) {
  6101. return [
  6102. [1, t.rightbottom],
  6103. [1, 0],
  6104. [t.bottomright, 0],
  6105. [0, t.lefttop],
  6106. [0, 1],
  6107. [t.topleft, 1]
  6108. ]
  6109. }, Uo[152] = function (t) {
  6110. return [Mo(t), Oo(t)]
  6111. }, Uo[156] = function (t) {
  6112. return [
  6113. [1, 1],
  6114. [1, t.righttop],
  6115. [t.bottomright, 0],
  6116. [t.bottomleft, 0],
  6117. [0, t.leftbottom],
  6118. [0, t.lefttop],
  6119. [t.topright, 1]
  6120. ]
  6121. }, Uo[137] = function (t) {
  6122. return [To(t), Co(t)]
  6123. }, Uo[139] = function (t) {
  6124. return [
  6125. [1, t.righttop],
  6126. [1, t.rightbottom],
  6127. [t.bottomleft, 0],
  6128. [0, 0],
  6129. [0, t.leftbottom],
  6130. [t.topleft, 1],
  6131. [t.topright, 1]
  6132. ]
  6133. }, Uo[98] = function (t) {
  6134. return [Ro(t), Lo(t)]
  6135. }, Uo[99] = function (t) {
  6136. return [
  6137. [1, t.righttop],
  6138. [1, t.rightbottom],
  6139. [t.bottomright, 0],
  6140. [t.bottomleft, 0],
  6141. [0, t.lefttop],
  6142. [0, 1],
  6143. [t.topleft, 1]
  6144. ]
  6145. }, Uo[38] = function (t) {
  6146. return [Po(t), Ao(t)]
  6147. }, Uo[39] = function (t) {
  6148. return [
  6149. [1, t.rightbottom],
  6150. [1, 0],
  6151. [t.bottomright, 0],
  6152. [0, t.leftbottom],
  6153. [0, t.lefttop],
  6154. [t.topleft, 1],
  6155. [t.topright, 1]
  6156. ]
  6157. };
  6158. var us = function () {
  6159. function t(e) {
  6160. this.id = t.buildId(e), this.coordinates = e, this.innerEdges = [], this.outerEdges = [], this.outerEdgesSorted = !1
  6161. }
  6162. return t.buildId = function (t) {
  6163. return t.join(",")
  6164. }, t.prototype.removeInnerEdge = function (t) {
  6165. this.innerEdges = this.innerEdges.filter((function (e) {
  6166. return e.from.id !== t.from.id
  6167. }))
  6168. }, t.prototype.removeOuterEdge = function (t) {
  6169. this.outerEdges = this.outerEdges.filter((function (e) {
  6170. return e.to.id !== t.to.id
  6171. }))
  6172. }, t.prototype.addOuterEdge = function (t) {
  6173. this.outerEdges.push(t), this.outerEdgesSorted = !1
  6174. }, t.prototype.sortOuterEdges = function () {
  6175. var t = this;
  6176. this.outerEdgesSorted || (this.outerEdges.sort((function (e, n) {
  6177. var r = e.to,
  6178. i = n.to;
  6179. if (r.coordinates[0] - t.coordinates[0] >= 0 && i.coordinates[0] - t.coordinates[0] < 0) return 1;
  6180. if (r.coordinates[0] - t.coordinates[0] < 0 && i.coordinates[0] - t.coordinates[0] >= 0) return -1;
  6181. if (r.coordinates[0] - t.coordinates[0] == 0 && i.coordinates[0] - t.coordinates[0] == 0) return r.coordinates[1] - t.coordinates[1] >= 0 || i.coordinates[1] - t.coordinates[1] >= 0 ? r.coordinates[1] - i.coordinates[1] : i.coordinates[1] - r.coordinates[1];
  6182. var o = ss(t.coordinates, r.coordinates, i.coordinates);
  6183. return o < 0 ? 1 : o > 0 ? -1 : Math.pow(r.coordinates[0] - t.coordinates[0], 2) + Math.pow(r.coordinates[1] - t.coordinates[1], 2) - (Math.pow(i.coordinates[0] - t.coordinates[0], 2) + Math.pow(i.coordinates[1] - t.coordinates[1], 2))
  6184. })), this.outerEdgesSorted = !0)
  6185. }, t.prototype.getOuterEdges = function () {
  6186. return this.sortOuterEdges(), this.outerEdges
  6187. }, t.prototype.getOuterEdge = function (t) {
  6188. return this.sortOuterEdges(), this.outerEdges[t]
  6189. }, t.prototype.addInnerEdge = function (t) {
  6190. this.innerEdges.push(t)
  6191. }, t
  6192. }(),
  6193. ls = function () {
  6194. function t(t, e) {
  6195. this.from = t, this.to = e, this.next = void 0, this.label = void 0, this.symetric = void 0, this.ring = void 0, this.from.addOuterEdge(this), this.to.addInnerEdge(this)
  6196. }
  6197. return t.prototype.getSymetric = function () {
  6198. return this.symetric || (this.symetric = new t(this.to, this.from), this.symetric.symetric = this), this.symetric
  6199. }, t.prototype.deleteEdge = function () {
  6200. this.from.removeOuterEdge(this), this.to.removeInnerEdge(this)
  6201. }, t.prototype.isEqual = function (t) {
  6202. return this.from.id === t.from.id && this.to.id === t.to.id
  6203. }, t.prototype.toString = function () {
  6204. return "Edge { " + this.from.id + " -> " + this.to.id + " }"
  6205. }, t.prototype.toLineString = function () {
  6206. return h([this.from.coordinates, this.to.coordinates])
  6207. }, t.prototype.compareTo = function (t) {
  6208. return ss(t.from.coordinates, t.to.coordinates, this.to.coordinates)
  6209. }, t
  6210. }(),
  6211. cs = function () {
  6212. function t() {
  6213. this.edges = [], this.polygon = void 0, this.envelope = void 0
  6214. }
  6215. return t.prototype.push = function (t) {
  6216. this.edges.push(t), this.polygon = this.envelope = void 0
  6217. }, t.prototype.get = function (t) {
  6218. return this.edges[t]
  6219. }, Object.defineProperty(t.prototype, "length", {
  6220. get: function () {
  6221. return this.edges.length
  6222. },
  6223. enumerable: !0,
  6224. configurable: !0
  6225. }), t.prototype.forEach = function (t) {
  6226. this.edges.forEach(t)
  6227. }, t.prototype.map = function (t) {
  6228. return this.edges.map(t)
  6229. }, t.prototype.some = function (t) {
  6230. return this.edges.some(t)
  6231. }, t.prototype.isValid = function () {
  6232. return !0
  6233. }, t.prototype.isHole = function () {
  6234. var t = this,
  6235. e = this.edges.reduce((function (e, n, r) {
  6236. return n.from.coordinates[1] > t.edges[e].from.coordinates[1] && (e = r), e
  6237. }), 0),
  6238. n = (0 === e ? this.length : e) - 1,
  6239. r = (e + 1) % this.length,
  6240. i = ss(this.edges[n].from.coordinates, this.edges[e].from.coordinates, this.edges[r].from.coordinates);
  6241. return 0 === i ? this.edges[n].from.coordinates[0] > this.edges[r].from.coordinates[0] : i > 0
  6242. }, t.prototype.toMultiPoint = function () {
  6243. return d(this.edges.map((function (t) {
  6244. return t.from.coordinates
  6245. })))
  6246. }, t.prototype.toPolygon = function () {
  6247. if (this.polygon) return this.polygon;
  6248. var t = this.edges.map((function (t) {
  6249. return t.from.coordinates
  6250. }));
  6251. return t.push(this.edges[0].from.coordinates), this.polygon = l([t])
  6252. }, t.prototype.getEnvelope = function () {
  6253. return this.envelope ? this.envelope : this.envelope = dn(this.toPolygon())
  6254. }, t.findEdgeRingContaining = function (t, e) {
  6255. var n, r, i = t.getEnvelope();
  6256. return e.forEach((function (e) {
  6257. var o, s, u, l, c, h, p = e.getEnvelope();
  6258. if ((r && (n = r.getEnvelope()), s = i, u = (o = p).geometry.coordinates[0].map((function (t) {
  6259. return t[0]
  6260. })), l = o.geometry.coordinates[0].map((function (t) {
  6261. return t[1]
  6262. })), c = s.geometry.coordinates[0].map((function (t) {
  6263. return t[0]
  6264. })), h = s.geometry.coordinates[0].map((function (t) {
  6265. return t[1]
  6266. })), Math.max.apply(null, u) !== Math.max.apply(null, c) || Math.max.apply(null, l) !== Math.max.apply(null, h) || Math.min.apply(null, u) !== Math.min.apply(null, c) || Math.min.apply(null, l) !== Math.min.apply(null, h)) && as(p, i)) {
  6267. for (var f = t.map((function (t) {
  6268. return t.from.coordinates
  6269. })), g = void 0, d = function (t) {
  6270. e.some((function (e) {
  6271. return n = t, r = e.from.coordinates, n[0] === r[0] && n[1] === r[1];
  6272. var n, r
  6273. })) || (g = t)
  6274. }, y = 0, v = f; y < v.length; y++) {
  6275. d(v[y])
  6276. }
  6277. g && e.inside(a(g)) && (r && !as(n, p) || (r = e))
  6278. }
  6279. })), r
  6280. }, t.prototype.inside = function (t) {
  6281. return ye(t, this.toPolygon())
  6282. }, t
  6283. }();
  6284. var hs = function () {
  6285. function t() {
  6286. this.edges = [], this.nodes = {}
  6287. }
  6288. return t.fromGeoJson = function (e) {
  6289. ! function (t) {
  6290. if (!t) throw new Error("No geojson passed");
  6291. if ("FeatureCollection" !== t.type && "GeometryCollection" !== t.type && "MultiLineString" !== t.type && "LineString" !== t.type && "Feature" !== t.type) throw new Error("Invalid input type '" + t.type + "'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")
  6292. }(e);
  6293. var n = new t;
  6294. return z(e, (function (t) {
  6295. et(t, "LineString", "Graph::fromGeoJson"), T(t, (function (t, e) {
  6296. if (t) {
  6297. var r = n.getNode(t),
  6298. i = n.getNode(e);
  6299. n.addEdge(r, i)
  6300. }
  6301. return e
  6302. }))
  6303. })), n
  6304. }, t.prototype.getNode = function (t) {
  6305. var e = us.buildId(t),
  6306. n = this.nodes[e];
  6307. return n || (n = this.nodes[e] = new us(t)), n
  6308. }, t.prototype.addEdge = function (t, e) {
  6309. var n = new ls(t, e),
  6310. r = n.getSymetric();
  6311. this.edges.push(n), this.edges.push(r)
  6312. }, t.prototype.deleteDangles = function () {
  6313. var t = this;
  6314. Object.keys(this.nodes).map((function (e) {
  6315. return t.nodes[e]
  6316. })).forEach((function (e) {
  6317. return t._removeIfDangle(e)
  6318. }))
  6319. }, t.prototype._removeIfDangle = function (t) {
  6320. var e = this;
  6321. if (t.innerEdges.length <= 1) {
  6322. var n = t.getOuterEdges().map((function (t) {
  6323. return t.to
  6324. }));
  6325. this.removeNode(t), n.forEach((function (t) {
  6326. return e._removeIfDangle(t)
  6327. }))
  6328. }
  6329. }, t.prototype.deleteCutEdges = function () {
  6330. var t = this;
  6331. this._computeNextCWEdges(), this._findLabeledEdgeRings(), this.edges.forEach((function (e) {
  6332. e.label === e.symetric.label && (t.removeEdge(e.symetric), t.removeEdge(e))
  6333. }))
  6334. }, t.prototype._computeNextCWEdges = function (t) {
  6335. var e = this;
  6336. void 0 === t ? Object.keys(this.nodes).forEach((function (t) {
  6337. return e._computeNextCWEdges(e.nodes[t])
  6338. })) : t.getOuterEdges().forEach((function (e, n) {
  6339. t.getOuterEdge((0 === n ? t.getOuterEdges().length : n) - 1).symetric.next = e
  6340. }))
  6341. }, t.prototype._computeNextCCWEdges = function (t, e) {
  6342. for (var n, r, i = t.getOuterEdges(), o = i.length - 1; o >= 0; --o) {
  6343. var s = i[o],
  6344. a = s.symetric,
  6345. u = void 0,
  6346. l = void 0;
  6347. s.label === e && (u = s), a.label === e && (l = a), u && l && (l && (r = l), u && (r && (r.next = u, r = void 0), n || (n = u)))
  6348. }
  6349. r && (r.next = n)
  6350. }, t.prototype._findLabeledEdgeRings = function () {
  6351. var t = [],
  6352. e = 0;
  6353. return this.edges.forEach((function (n) {
  6354. if (!(n.label >= 0)) {
  6355. t.push(n);
  6356. var r = n;
  6357. do {
  6358. r.label = e, r = r.next
  6359. } while (!n.isEqual(r));
  6360. e++
  6361. }
  6362. })), t
  6363. }, t.prototype.getEdgeRings = function () {
  6364. var t = this;
  6365. this._computeNextCWEdges(), this.edges.forEach((function (t) {
  6366. t.label = void 0
  6367. })), this._findLabeledEdgeRings().forEach((function (e) {
  6368. t._findIntersectionNodes(e).forEach((function (n) {
  6369. t._computeNextCCWEdges(n, e.label)
  6370. }))
  6371. }));
  6372. var e = [];
  6373. return this.edges.forEach((function (n) {
  6374. n.ring || e.push(t._findEdgeRing(n))
  6375. })), e
  6376. }, t.prototype._findIntersectionNodes = function (t) {
  6377. var e = [],
  6378. n = t,
  6379. r = function () {
  6380. var r = 0;
  6381. n.from.getOuterEdges().forEach((function (e) {
  6382. e.label === t.label && ++r
  6383. })), r > 1 && e.push(n.from), n = n.next
  6384. };
  6385. do {
  6386. r()
  6387. } while (!t.isEqual(n));
  6388. return e
  6389. }, t.prototype._findEdgeRing = function (t) {
  6390. var e = t,
  6391. n = new cs;
  6392. do {
  6393. n.push(e), e.ring = n, e = e.next
  6394. } while (!t.isEqual(e));
  6395. return n
  6396. }, t.prototype.removeNode = function (t) {
  6397. var e = this;
  6398. t.getOuterEdges().forEach((function (t) {
  6399. return e.removeEdge(t)
  6400. })), t.innerEdges.forEach((function (t) {
  6401. return e.removeEdge(t)
  6402. })), delete this.nodes[t.id]
  6403. }, t.prototype.removeEdge = function (t) {
  6404. this.edges = this.edges.filter((function (e) {
  6405. return !e.isEqual(t)
  6406. })), t.deleteEdge()
  6407. }, t
  6408. }();
  6409. function ps(t, e) {
  6410. var n = !0;
  6411. return z(t, (function (t) {
  6412. z(e, (function (e) {
  6413. if (!1 === n) return !1;
  6414. n = function (t, e) {
  6415. switch (t.type) {
  6416. case "Point":
  6417. switch (e.type) {
  6418. case "Point":
  6419. return n = t.coordinates, r = e.coordinates, !(n[0] === r[0] && n[1] === r[1]);
  6420. case "LineString":
  6421. return !fs(e, t);
  6422. case "Polygon":
  6423. return !ye(t, e)
  6424. }
  6425. break;
  6426. case "LineString":
  6427. switch (e.type) {
  6428. case "Point":
  6429. return !fs(t, e);
  6430. case "LineString":
  6431. return ! function (t, e) {
  6432. if (Or(t, e).features.length > 0) return !0;
  6433. return !1
  6434. }(t, e);
  6435. case "Polygon":
  6436. return !gs(e, t)
  6437. }
  6438. break;
  6439. case "Polygon":
  6440. switch (e.type) {
  6441. case "Point":
  6442. return !ye(e, t);
  6443. case "LineString":
  6444. return !gs(t, e);
  6445. case "Polygon":
  6446. return ! function (t, e) {
  6447. for (var n = 0, r = t.coordinates[0]; n < r.length; n++) {
  6448. if (ye(r[n], e)) return !0
  6449. }
  6450. for (var i = 0, o = e.coordinates[0]; i < o.length; i++) {
  6451. if (ye(o[i], t)) return !0
  6452. }
  6453. if (Or(Ii(t), Ii(e)).features.length > 0) return !0;
  6454. return !1
  6455. }(e, t)
  6456. }
  6457. }
  6458. var n, r;
  6459. return !1
  6460. }(t.geometry, e.geometry)
  6461. }))
  6462. })), n
  6463. }
  6464. function fs(t, e) {
  6465. for (var n = 0; n < t.coordinates.length - 1; n++)
  6466. if (ds(t.coordinates[n], t.coordinates[n + 1], e.coordinates)) return !0;
  6467. return !1
  6468. }
  6469. function gs(t, e) {
  6470. for (var n = 0, r = e.coordinates; n < r.length; n++) {
  6471. if (ye(r[n], t)) return !0
  6472. }
  6473. return Or(e, Ii(t)).features.length > 0
  6474. }
  6475. function ds(t, e, n) {
  6476. var r = n[0] - t[0],
  6477. i = n[1] - t[1],
  6478. o = e[0] - t[0],
  6479. s = e[1] - t[1];
  6480. return 0 == r * s - i * o && (Math.abs(o) >= Math.abs(s) ? o > 0 ? t[0] <= n[0] && n[0] <= e[0] : e[0] <= n[0] && n[0] <= t[0] : s > 0 ? t[1] <= n[1] && n[1] <= e[1] : e[1] <= n[1] && n[1] <= t[1])
  6481. }
  6482. function ys(t, e) {
  6483. return !(t[0] > e[0]) && (!(t[2] < e[2]) && (!(t[1] > e[1]) && !(t[3] < e[3])))
  6484. }
  6485. function vs(t, e) {
  6486. return t[0] === e[0] && t[1] === e[1]
  6487. }
  6488. function _s(t, e) {
  6489. return [(t[0] + e[0]) / 2, (t[1] + e[1]) / 2]
  6490. }
  6491. function ms(t, e) {
  6492. for (var n = !1, r = !1, i = t.coordinates.length, o = 0; o < i && !n && !r;) {
  6493. for (var s = 0; s < e.coordinates.length - 1; s++) {
  6494. var a = !0;
  6495. 0 !== s && s !== e.coordinates.length - 2 || (a = !1), bs(e.coordinates[s], e.coordinates[s + 1], t.coordinates[o], a) ? n = !0 : r = !0
  6496. }
  6497. o++
  6498. }
  6499. return n && r
  6500. }
  6501. function xs(t, e) {
  6502. return Or(t, Ni(e)).features.length > 0
  6503. }
  6504. function Es(t, e) {
  6505. for (var n = !1, r = !1, i = t.coordinates.length, o = 0; o < i && (!n || !r); o++) ye(a(t.coordinates[o]), e) ? n = !0 : r = !0;
  6506. return r && n
  6507. }
  6508. function bs(t, e, n, r) {
  6509. var i = n[0] - t[0],
  6510. o = n[1] - t[1],
  6511. s = e[0] - t[0],
  6512. a = e[1] - t[1];
  6513. return 0 == i * a - o * s && (r ? Math.abs(s) >= Math.abs(a) ? s > 0 ? t[0] <= n[0] && n[0] <= e[0] : e[0] <= n[0] && n[0] <= t[0] : a > 0 ? t[1] <= n[1] && n[1] <= e[1] : e[1] <= n[1] && n[1] <= t[1] : Math.abs(s) >= Math.abs(a) ? s > 0 ? t[0] < n[0] && n[0] < e[0] : e[0] < n[0] && n[0] < t[0] : a > 0 ? t[1] < n[1] && n[1] < e[1] : e[1] < n[1] && n[1] < t[1])
  6514. }
  6515. var ws = function (t) {
  6516. this.precision = t && t.precision ? t.precision : 17, this.direction = !(!t || !t.direction) && t.direction, this.pseudoNode = !(!t || !t.pseudoNode) && t.pseudoNode, this.objectComparator = t && t.objectComparator ? t.objectComparator : Ss
  6517. };
  6518. function Is(t) {
  6519. return t.coordinates.map((function (e) {
  6520. return {
  6521. type: t.type.replace("Multi", ""),
  6522. coordinates: e
  6523. }
  6524. }))
  6525. }
  6526. function Ns(t, e) {
  6527. return t.hasOwnProperty("coordinates") ? t.coordinates.length === e.coordinates.length : t.length === e.length
  6528. }
  6529. function Ss(t, e) {
  6530. return Fi(t, e, {
  6531. strict: !0
  6532. })
  6533. }
  6534. ws.prototype.compare = function (t, e) {
  6535. if (t.type !== e.type || !Ns(t, e)) return !1;
  6536. switch (t.type) {
  6537. case "Point":
  6538. return this.compareCoord(t.coordinates, e.coordinates);
  6539. case "LineString":
  6540. return this.compareLine(t.coordinates, e.coordinates, 0, !1);
  6541. case "Polygon":
  6542. return this.comparePolygon(t, e);
  6543. case "Feature":
  6544. return this.compareFeature(t, e);
  6545. default:
  6546. if (0 === t.type.indexOf("Multi")) {
  6547. var n = this,
  6548. r = Is(t),
  6549. i = Is(e);
  6550. return r.every((function (t) {
  6551. return this.some((function (e) {
  6552. return n.compare(t, e)
  6553. }))
  6554. }), i)
  6555. }
  6556. }
  6557. return !1
  6558. }, ws.prototype.compareCoord = function (t, e) {
  6559. if (t.length !== e.length) return !1;
  6560. for (var n = 0; n < t.length; n++)
  6561. if (t[n].toFixed(this.precision) !== e[n].toFixed(this.precision)) return !1;
  6562. return !0
  6563. }, ws.prototype.compareLine = function (t, e, n, r) {
  6564. if (!Ns(t, e)) return !1;
  6565. var i = this.pseudoNode ? t : this.removePseudo(t),
  6566. o = this.pseudoNode ? e : this.removePseudo(e);
  6567. if (!r || this.compareCoord(i[0], o[0]) || (o = this.fixStartIndex(o, i))) {
  6568. var s = this.compareCoord(i[n], o[n]);
  6569. return this.direction || s ? this.comparePath(i, o) : !!this.compareCoord(i[n], o[o.length - (1 + n)]) && this.comparePath(i.slice().reverse(), o)
  6570. }
  6571. }, ws.prototype.fixStartIndex = function (t, e) {
  6572. for (var n, r = -1, i = 0; i < t.length; i++)
  6573. if (this.compareCoord(t[i], e[0])) {
  6574. r = i;
  6575. break
  6576. } return r >= 0 && (n = [].concat(t.slice(r, t.length), t.slice(1, r + 1))), n
  6577. }, ws.prototype.comparePath = function (t, e) {
  6578. var n = this;
  6579. return t.every((function (t, e) {
  6580. return n.compareCoord(t, this[e])
  6581. }), e)
  6582. }, ws.prototype.comparePolygon = function (t, e) {
  6583. if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {
  6584. var n = t.coordinates.slice(1, t.coordinates.length),
  6585. r = e.coordinates.slice(1, e.coordinates.length),
  6586. i = this;
  6587. return n.every((function (t) {
  6588. return this.some((function (e) {
  6589. return i.compareLine(t, e, 1, !0)
  6590. }))
  6591. }), r)
  6592. }
  6593. return !1
  6594. }, ws.prototype.compareFeature = function (t, e) {
  6595. return !(t.id !== e.id || !this.objectComparator(t.properties, e.properties) || !this.compareBBox(t, e)) && this.compare(t.geometry, e.geometry)
  6596. }, ws.prototype.compareBBox = function (t, e) {
  6597. return !!(!t.bbox && !e.bbox || t.bbox && e.bbox && this.compareCoord(t.bbox, e.bbox))
  6598. }, ws.prototype.removePseudo = function (t) {
  6599. return t
  6600. };
  6601. var Cs = ws;
  6602. function Ps(t, e) {
  6603. var n = !1;
  6604. return z(t, (function (t) {
  6605. z(e, (function (e) {
  6606. if (!0 === n) return !0;
  6607. n = !ps(t.geometry, e.geometry)
  6608. }))
  6609. })), n
  6610. }
  6611. var Ms = Bt((function (t) {
  6612. function e(t, e, n, r) {
  6613. this.dataset = [], this.epsilon = 1, this.minPts = 2, this.distance = this._euclideanDistance, this.clusters = [], this.noise = [], this._visited = [], this._assigned = [], this._datasetLength = 0, this._init(t, e, n, r)
  6614. }
  6615. e.prototype.run = function (t, e, n, r) {
  6616. this._init(t, e, n, r);
  6617. for (var i = 0; i < this._datasetLength; i++)
  6618. if (1 !== this._visited[i]) {
  6619. this._visited[i] = 1;
  6620. var o = this._regionQuery(i);
  6621. if (o.length < this.minPts) this.noise.push(i);
  6622. else {
  6623. var s = this.clusters.length;
  6624. this.clusters.push([]), this._addToCluster(i, s), this._expandCluster(s, o)
  6625. }
  6626. } return this.clusters
  6627. }, e.prototype._init = function (t, e, n, r) {
  6628. if (t) {
  6629. if (!(t instanceof Array)) throw Error("Dataset must be of type array, " + typeof t + " given");
  6630. this.dataset = t, this.clusters = [], this.noise = [], this._datasetLength = t.length, this._visited = new Array(this._datasetLength), this._assigned = new Array(this._datasetLength)
  6631. }
  6632. e && (this.epsilon = e), n && (this.minPts = n), r && (this.distance = r)
  6633. }, e.prototype._expandCluster = function (t, e) {
  6634. for (var n = 0; n < e.length; n++) {
  6635. var r = e[n];
  6636. if (1 !== this._visited[r]) {
  6637. this._visited[r] = 1;
  6638. var i = this._regionQuery(r);
  6639. i.length >= this.minPts && (e = this._mergeArrays(e, i))
  6640. }
  6641. 1 !== this._assigned[r] && this._addToCluster(r, t)
  6642. }
  6643. }, e.prototype._addToCluster = function (t, e) {
  6644. this.clusters[e].push(t), this._assigned[t] = 1
  6645. }, e.prototype._regionQuery = function (t) {
  6646. for (var e = [], n = 0; n < this._datasetLength; n++) {
  6647. this.distance(this.dataset[t], this.dataset[n]) < this.epsilon && e.push(n)
  6648. }
  6649. return e
  6650. }, e.prototype._mergeArrays = function (t, e) {
  6651. for (var n = e.length, r = 0; r < n; r++) {
  6652. var i = e[r];
  6653. t.indexOf(i) < 0 && t.push(i)
  6654. }
  6655. return t
  6656. }, e.prototype._euclideanDistance = function (t, e) {
  6657. for (var n = 0, r = Math.min(t.length, e.length); r--;) n += (t[r] - e[r]) * (t[r] - e[r]);
  6658. return Math.sqrt(n)
  6659. }, t.exports && (t.exports = e)
  6660. })),
  6661. Ls = Bt((function (t) {
  6662. function e(t, e, n) {
  6663. this.k = 3, this.dataset = [], this.assignments = [], this.centroids = [], this.init(t, e, n)
  6664. }
  6665. e.prototype.init = function (t, e, n) {
  6666. this.assignments = [], this.centroids = [], void 0 !== t && (this.dataset = t), void 0 !== e && (this.k = e), void 0 !== n && (this.distance = n)
  6667. }, e.prototype.run = function (t, e) {
  6668. this.init(t, e);
  6669. for (var n = this.dataset.length, r = 0; r < this.k; r++) this.centroids[r] = this.randomCentroid();
  6670. for (var i = !0; i;) {
  6671. i = this.assign();
  6672. for (var o = 0; o < this.k; o++) {
  6673. for (var s = new Array(c), a = 0, u = 0; u < c; u++) s[u] = 0;
  6674. for (var l = 0; l < n; l++) {
  6675. var c = this.dataset[l].length;
  6676. if (o === this.assignments[l]) {
  6677. for (u = 0; u < c; u++) s[u] += this.dataset[l][u];
  6678. a++
  6679. }
  6680. }
  6681. if (a > 0) {
  6682. for (u = 0; u < c; u++) s[u] /= a;
  6683. this.centroids[o] = s
  6684. } else this.centroids[o] = this.randomCentroid(), i = !0
  6685. }
  6686. }
  6687. return this.getClusters()
  6688. }, e.prototype.randomCentroid = function () {
  6689. var t, e, n = this.dataset.length - 1;
  6690. do {
  6691. e = Math.round(Math.random() * n), t = this.dataset[e]
  6692. } while (this.centroids.indexOf(t) >= 0);
  6693. return t
  6694. }, e.prototype.assign = function () {
  6695. for (var t, e = !1, n = this.dataset.length, r = 0; r < n; r++)(t = this.argmin(this.dataset[r], this.centroids, this.distance)) != this.assignments[r] && (this.assignments[r] = t, e = !0);
  6696. return e
  6697. }, e.prototype.getClusters = function () {
  6698. for (var t, e = new Array(this.k), n = 0; n < this.assignments.length; n++) void 0 === e[t = this.assignments[n]] && (e[t] = []), e[t].push(n);
  6699. return e
  6700. }, e.prototype.argmin = function (t, e, n) {
  6701. for (var r, i = Number.MAX_VALUE, o = 0, s = e.length, a = 0; a < s; a++)(r = n(t, e[a])) < i && (i = r, o = a);
  6702. return o
  6703. }, e.prototype.distance = function (t, e) {
  6704. for (var n = 0, r = Math.min(t.length, e.length); r--;) {
  6705. var i = t[r] - e[r];
  6706. n += i * i
  6707. }
  6708. return Math.sqrt(n)
  6709. }, t.exports && (t.exports = e)
  6710. })),
  6711. Os = Bt((function (t) {
  6712. function e(t, e, n) {
  6713. this._queue = [], this._priorities = [], this._sorting = "desc", this._init(t, e, n)
  6714. }
  6715. e.prototype.insert = function (t, e) {
  6716. for (var n = this._queue.length, r = n; r--;) {
  6717. var i = this._priorities[r];
  6718. "desc" === this._sorting ? e > i && (n = r) : e < i && (n = r)
  6719. }
  6720. this._insertAt(t, e, n)
  6721. }, e.prototype.remove = function (t) {
  6722. for (var e = this._queue.length; e--;) {
  6723. if (t === this._queue[e]) {
  6724. this._queue.splice(e, 1), this._priorities.splice(e, 1);
  6725. break
  6726. }
  6727. }
  6728. }, e.prototype.forEach = function (t) {
  6729. this._queue.forEach(t)
  6730. }, e.prototype.getElements = function () {
  6731. return this._queue
  6732. }, e.prototype.getElementPriority = function (t) {
  6733. return this._priorities[t]
  6734. }, e.prototype.getPriorities = function () {
  6735. return this._priorities
  6736. }, e.prototype.getElementsWithPriorities = function () {
  6737. for (var t = [], e = 0, n = this._queue.length; e < n; e++) t.push([this._queue[e], this._priorities[e]]);
  6738. return t
  6739. }, e.prototype._init = function (t, e, n) {
  6740. if (t && e) {
  6741. if (this._queue = [], this._priorities = [], t.length !== e.length) throw new Error("Arrays must have the same length");
  6742. for (var r = 0; r < t.length; r++) this.insert(t[r], e[r])
  6743. }
  6744. n && (this._sorting = n)
  6745. }, e.prototype._insertAt = function (t, e, n) {
  6746. this._queue.length === n ? (this._queue.push(t), this._priorities.push(e)) : (this._queue.splice(n, 0, t), this._priorities.splice(n, 0, e))
  6747. }, t.exports && (t.exports = e)
  6748. })),
  6749. Rs = Bt((function (t) {
  6750. if (t.exports) var e = Os;
  6751. function n(t, e, n, r) {
  6752. this.epsilon = 1, this.minPts = 1, this.distance = this._euclideanDistance, this._reachability = [], this._processed = [], this._coreDistance = 0, this._orderedList = [], this._init(t, e, n, r)
  6753. }
  6754. n.prototype.run = function (t, n, r, i) {
  6755. this._init(t, n, r, i);
  6756. for (var o = 0, s = this.dataset.length; o < s; o++)
  6757. if (1 !== this._processed[o]) {
  6758. this._processed[o] = 1, this.clusters.push([o]);
  6759. var a = this.clusters.length - 1;
  6760. this._orderedList.push(o);
  6761. var u = new e(null, null, "asc"),
  6762. l = this._regionQuery(o);
  6763. void 0 !== this._distanceToCore(o) && (this._updateQueue(o, l, u), this._expandCluster(a, u))
  6764. } return this.clusters
  6765. }, n.prototype.getReachabilityPlot = function () {
  6766. for (var t = [], e = 0, n = this._orderedList.length; e < n; e++) {
  6767. var r = this._orderedList[e],
  6768. i = this._reachability[r];
  6769. t.push([r, i])
  6770. }
  6771. return t
  6772. }, n.prototype._init = function (t, e, n, r) {
  6773. if (t) {
  6774. if (!(t instanceof Array)) throw Error("Dataset must be of type array, " + typeof t + " given");
  6775. this.dataset = t, this.clusters = [], this._reachability = new Array(this.dataset.length), this._processed = new Array(this.dataset.length), this._coreDistance = 0, this._orderedList = []
  6776. }
  6777. e && (this.epsilon = e), n && (this.minPts = n), r && (this.distance = r)
  6778. }, n.prototype._updateQueue = function (t, e, n) {
  6779. var r = this;
  6780. this._coreDistance = this._distanceToCore(t), e.forEach((function (e) {
  6781. if (void 0 === r._processed[e]) {
  6782. var i = r.distance(r.dataset[t], r.dataset[e]),
  6783. o = Math.max(r._coreDistance, i);
  6784. void 0 === r._reachability[e] ? (r._reachability[e] = o, n.insert(e, o)) : o < r._reachability[e] && (r._reachability[e] = o, n.remove(e), n.insert(e, o))
  6785. }
  6786. }))
  6787. }, n.prototype._expandCluster = function (t, e) {
  6788. for (var n = e.getElements(), r = 0, i = n.length; r < i; r++) {
  6789. var o = n[r];
  6790. if (void 0 === this._processed[o]) {
  6791. var s = this._regionQuery(o);
  6792. this._processed[o] = 1, this.clusters[t].push(o), this._orderedList.push(o), void 0 !== this._distanceToCore(o) && (this._updateQueue(o, s, e), this._expandCluster(t, e))
  6793. }
  6794. }
  6795. }, n.prototype._distanceToCore = function (t) {
  6796. for (var e = this.epsilon, n = 0; n < e; n++) {
  6797. if (this._regionQuery(t, n).length >= this.minPts) return n
  6798. }
  6799. }, n.prototype._regionQuery = function (t, e) {
  6800. e = e || this.epsilon;
  6801. for (var n = [], r = 0, i = this.dataset.length; r < i; r++) this.distance(this.dataset[t], this.dataset[r]) < e && n.push(r);
  6802. return n
  6803. }, n.prototype._euclideanDistance = function (t, e) {
  6804. for (var n = 0, r = Math.min(t.length, e.length); r--;) n += (t[r] - e[r]) * (t[r] - e[r]);
  6805. return Math.sqrt(n)
  6806. }, t.exports && (t.exports = n)
  6807. })),
  6808. Ts = Bt((function (t) {
  6809. t.exports && (t.exports = {
  6810. DBSCAN: Ms,
  6811. KMEANS: Ls,
  6812. OPTICS: Rs,
  6813. PriorityQueue: Os
  6814. })
  6815. }));
  6816. var As = function (t, e, n) {
  6817. for (var r = t.length, i = 0, o = 0; o < r; o++) {
  6818. var s = (t[o] || 0) - (e[o] || 0);
  6819. i += s * s
  6820. }
  6821. return n ? Math.sqrt(i) : i
  6822. },
  6823. Ds = As,
  6824. Fs = function (t, e, n) {
  6825. var r = Math.abs(t - e);
  6826. return n ? r : r * r
  6827. },
  6828. ks = As,
  6829. Gs = function (t, e) {
  6830. for (var n = {}, r = [], i = e << 2, o = t.length, s = t[0].length > 0; r.length < e && i-- > 0;) {
  6831. var a = t[Math.floor(Math.random() * o)],
  6832. u = s ? a.join("_") : "" + a;
  6833. n[u] || (n[u] = !0, r.push(a))
  6834. }
  6835. if (r.length < e) throw new Error("Error initializating clusters");
  6836. return r
  6837. },
  6838. qs = function (t, e) {
  6839. var n = t[0].length ? Ds : Fs,
  6840. r = [],
  6841. i = t.length,
  6842. o = t[0].length > 0,
  6843. s = t[Math.floor(Math.random() * i)];
  6844. o && s.join("_");
  6845. for (r.push(s); r.length < e;) {
  6846. for (var a = [], u = r.length, l = 0, c = [], h = 0; h < i; h++) {
  6847. for (var p = 1 / 0, f = 0; f < u; f++) {
  6848. var g = n(t[h], r[f]);
  6849. g <= p && (p = g)
  6850. }
  6851. a[h] = p
  6852. }
  6853. for (var d = 0; d < i; d++) l += a[d];
  6854. for (var y = 0; y < i; y++) c[y] = {
  6855. i: y,
  6856. v: t[y],
  6857. pr: a[y] / l,
  6858. cs: 0
  6859. };
  6860. c.sort((function (t, e) {
  6861. return t.pr - e.pr
  6862. })), c[0].cs = c[0].pr;
  6863. for (var v = 1; v < i; v++) c[v].cs = c[v - 1].cs + c[v].pr;
  6864. for (var _ = Math.random(), m = 0; m < i - 1 && c[m++].cs < _;);
  6865. r.push(c[m - 1].v)
  6866. }
  6867. return r
  6868. };
  6869. function Bs(t, e, n) {
  6870. n = n || [];
  6871. for (var r = 0; r < t; r++) n[r] = e;
  6872. return n
  6873. }
  6874. var zs = function (t, e, n, r) {
  6875. var i = [],
  6876. o = [],
  6877. s = [],
  6878. a = [],
  6879. u = !1,
  6880. l = r || 1e4,
  6881. c = t.length,
  6882. h = t[0].length,
  6883. p = h > 0,
  6884. f = [];
  6885. if (n) i = "kmrand" == n ? Gs(t, e) : "kmpp" == n ? qs(t, e) : n;
  6886. else
  6887. for (var g = {}; i.length < e;) {
  6888. var d = Math.floor(Math.random() * c);
  6889. g[d] || (g[d] = !0, i.push(t[d]))
  6890. }
  6891. do {
  6892. Bs(e, 0, f);
  6893. for (var y = 0; y < c; y++) {
  6894. for (var v = 1 / 0, _ = 0, m = 0; m < e; m++) {
  6895. (a = p ? ks(t[y], i[m]) : Math.abs(t[y] - i[m])) <= v && (v = a, _ = m)
  6896. }
  6897. s[y] = _, f[_]++
  6898. }
  6899. for (var x = [], E = (o = [], 0); E < e; E++) x[E] = p ? Bs(h, 0, x[E]) : 0, o[E] = i[E];
  6900. if (p) {
  6901. for (var b = 0; b < e; b++) i[b] = [];
  6902. for (var w = 0; w < c; w++)
  6903. for (var I = x[s[w]], N = t[w], S = 0; S < h; S++) I[S] += N[S];
  6904. u = !0;
  6905. for (var C = 0; C < e; C++) {
  6906. for (var P = i[C], M = x[C], L = o[C], O = f[C], R = 0; R < h; R++) P[R] = M[R] / O || 0;
  6907. if (u)
  6908. for (var T = 0; T < h; T++)
  6909. if (L[T] != P[T]) {
  6910. u = !1;
  6911. break
  6912. }
  6913. }
  6914. } else {
  6915. for (var A = 0; A < c; A++) {
  6916. x[s[A]] += t[A]
  6917. }
  6918. for (var D = 0; D < e; D++) i[D] = x[D] / f[D] || 0;
  6919. u = !0;
  6920. for (var F = 0; F < e; F++)
  6921. if (o[F] != i[F]) {
  6922. u = !1;
  6923. break
  6924. }
  6925. }
  6926. u = u || --l <= 0
  6927. } while (!u);
  6928. return {
  6929. it: 1e4 - l,
  6930. k: e,
  6931. idxs: s,
  6932. centroids: i
  6933. }
  6934. };
  6935. function js(t, e) {
  6936. return b(Bi(t[0], t[1])) === b(Bi(e[0], e[1]))
  6937. }
  6938. function Us(t, e) {
  6939. if (t.geometry && t.geometry.type) return t.geometry.type;
  6940. if (t.type) return t.type;
  6941. throw new Error("Invalid GeoJSON object for " + e)
  6942. }
  6943. function Vs(t) {
  6944. for (var e = t, n = []; e.parent;) n.unshift(e), e = e.parent;
  6945. return n
  6946. }
  6947. var Xs = {
  6948. search: function (t, e, n, r) {
  6949. t.cleanDirty();
  6950. var i = (r = r || {}).heuristic || Xs.heuristics.manhattan,
  6951. o = r.closest || !1,
  6952. s = new Ws((function (t) {
  6953. return t.f
  6954. })),
  6955. a = e;
  6956. for (e.h = i(e, n), s.push(e); s.size() > 0;) {
  6957. var u = s.pop();
  6958. if (u === n) return Vs(u);
  6959. u.closed = !0;
  6960. for (var l = t.neighbors(u), c = 0, h = l.length; c < h; ++c) {
  6961. var p = l[c];
  6962. if (!p.closed && !p.isWall()) {
  6963. var f = u.g + p.getCost(u),
  6964. g = p.visited;
  6965. (!g || f < p.g) && (p.visited = !0, p.parent = u, p.h = p.h || i(p, n), p.g = f, p.f = p.g + p.h, t.markDirty(p), o && (p.h < a.h || p.h === a.h && p.g < a.g) && (a = p), g ? s.rescoreElement(p) : s.push(p))
  6966. }
  6967. }
  6968. }
  6969. return o ? Vs(a) : []
  6970. },
  6971. heuristics: {
  6972. manhattan: function (t, e) {
  6973. return Math.abs(e.x - t.x) + Math.abs(e.y - t.y)
  6974. },
  6975. diagonal: function (t, e) {
  6976. var n = Math.sqrt(2),
  6977. r = Math.abs(e.x - t.x),
  6978. i = Math.abs(e.y - t.y);
  6979. return 1 * (r + i) + (n - 2) * Math.min(r, i)
  6980. }
  6981. },
  6982. cleanNode: function (t) {
  6983. t.f = 0, t.g = 0, t.h = 0, t.visited = !1, t.closed = !1, t.parent = null
  6984. }
  6985. };
  6986. function Ys(t, e) {
  6987. e = e || {}, this.nodes = [], this.diagonal = !!e.diagonal, this.grid = [];
  6988. for (var n = 0; n < t.length; n++) {
  6989. this.grid[n] = [];
  6990. for (var r = 0, i = t[n]; r < i.length; r++) {
  6991. var o = new Hs(n, r, i[r]);
  6992. this.grid[n][r] = o, this.nodes.push(o)
  6993. }
  6994. }
  6995. this.init()
  6996. }
  6997. function Hs(t, e, n) {
  6998. this.x = t, this.y = e, this.weight = n
  6999. }
  7000. function Ws(t) {
  7001. this.content = [], this.scoreFunction = t
  7002. }
  7003. function Js(t, e) {
  7004. for (var n = 0; n < e.features.length; n++)
  7005. if (ye(t, e.features[n])) return !0;
  7006. return !1
  7007. }
  7008. function Zs(t) {
  7009. return function () {
  7010. return t
  7011. }
  7012. }
  7013. function Ks(t) {
  7014. return t[0]
  7015. }
  7016. function Qs(t) {
  7017. return t[1]
  7018. }
  7019. function $s() {
  7020. this._ = null
  7021. }
  7022. function ta(t) {
  7023. t.U = t.C = t.L = t.R = t.P = t.N = null
  7024. }
  7025. function ea(t, e) {
  7026. var n = e,
  7027. r = e.R,
  7028. i = n.U;
  7029. i ? i.L === n ? i.L = r : i.R = r : t._ = r, r.U = i, n.U = r, n.R = r.L, n.R && (n.R.U = n), r.L = n
  7030. }
  7031. function na(t, e) {
  7032. var n = e,
  7033. r = e.L,
  7034. i = n.U;
  7035. i ? i.L === n ? i.L = r : i.R = r : t._ = r, r.U = i, n.U = r, n.L = r.R, n.L && (n.L.U = n), r.R = n
  7036. }
  7037. function ra(t) {
  7038. for (; t.L;) t = t.L;
  7039. return t
  7040. }
  7041. function ia(t, e, n, r) {
  7042. var i = [null, null],
  7043. o = Pa.push(i) - 1;
  7044. return i.left = t, i.right = e, n && sa(i, t, e, n), r && sa(i, e, t, r), Sa[t.index].halfedges.push(o), Sa[e.index].halfedges.push(o), i
  7045. }
  7046. function oa(t, e, n) {
  7047. var r = [e, n];
  7048. return r.left = t, r
  7049. }
  7050. function sa(t, e, n, r) {
  7051. t[0] || t[1] ? t.left === n ? t[1] = r : t[0] = r : (t[0] = r, t.left = e, t.right = n)
  7052. }
  7053. function aa(t, e, n, r, i) {
  7054. var o, s = t[0],
  7055. a = t[1],
  7056. u = s[0],
  7057. l = s[1],
  7058. c = 0,
  7059. h = 1,
  7060. p = a[0] - u,
  7061. f = a[1] - l;
  7062. if (o = e - u, p || !(o > 0)) {
  7063. if (o /= p, p < 0) {
  7064. if (o < c) return;
  7065. o < h && (h = o)
  7066. } else if (p > 0) {
  7067. if (o > h) return;
  7068. o > c && (c = o)
  7069. }
  7070. if (o = r - u, p || !(o < 0)) {
  7071. if (o /= p, p < 0) {
  7072. if (o > h) return;
  7073. o > c && (c = o)
  7074. } else if (p > 0) {
  7075. if (o < c) return;
  7076. o < h && (h = o)
  7077. }
  7078. if (o = n - l, f || !(o > 0)) {
  7079. if (o /= f, f < 0) {
  7080. if (o < c) return;
  7081. o < h && (h = o)
  7082. } else if (f > 0) {
  7083. if (o > h) return;
  7084. o > c && (c = o)
  7085. }
  7086. if (o = i - l, f || !(o < 0)) {
  7087. if (o /= f, f < 0) {
  7088. if (o > h) return;
  7089. o > c && (c = o)
  7090. } else if (f > 0) {
  7091. if (o < c) return;
  7092. o < h && (h = o)
  7093. }
  7094. return !(c > 0 || h < 1) || (c > 0 && (t[0] = [u + c * p, l + c * f]), h < 1 && (t[1] = [u + h * p, l + h * f]), !0)
  7095. }
  7096. }
  7097. }
  7098. }
  7099. }
  7100. function ua(t, e, n, r, i) {
  7101. var o = t[1];
  7102. if (o) return !0;
  7103. var s, a, u = t[0],
  7104. l = t.left,
  7105. c = t.right,
  7106. h = l[0],
  7107. p = l[1],
  7108. f = c[0],
  7109. g = c[1],
  7110. d = (h + f) / 2,
  7111. y = (p + g) / 2;
  7112. if (g === p) {
  7113. if (d < e || d >= r) return;
  7114. if (h > f) {
  7115. if (u) {
  7116. if (u[1] >= i) return
  7117. } else u = [d, n];
  7118. o = [d, i]
  7119. } else {
  7120. if (u) {
  7121. if (u[1] < n) return
  7122. } else u = [d, i];
  7123. o = [d, n]
  7124. }
  7125. } else if (a = y - (s = (h - f) / (g - p)) * d, s < -1 || s > 1)
  7126. if (h > f) {
  7127. if (u) {
  7128. if (u[1] >= i) return
  7129. } else u = [(n - a) / s, n];
  7130. o = [(i - a) / s, i]
  7131. } else {
  7132. if (u) {
  7133. if (u[1] < n) return
  7134. } else u = [(i - a) / s, i];
  7135. o = [(n - a) / s, n]
  7136. }
  7137. else if (p < g) {
  7138. if (u) {
  7139. if (u[0] >= r) return
  7140. } else u = [e, s * e + a];
  7141. o = [r, s * r + a]
  7142. } else {
  7143. if (u) {
  7144. if (u[0] < e) return
  7145. } else u = [r, s * r + a];
  7146. o = [e, s * e + a]
  7147. }
  7148. return t[0] = u, t[1] = o, !0
  7149. }
  7150. function la(t, e) {
  7151. var n = t.site,
  7152. r = e.left,
  7153. i = e.right;
  7154. return n === i && (i = r, r = n), i ? Math.atan2(i[1] - r[1], i[0] - r[0]) : (n === r ? (r = e[1], i = e[0]) : (r = e[0], i = e[1]), Math.atan2(r[0] - i[0], i[1] - r[1]))
  7155. }
  7156. function ca(t, e) {
  7157. return e[+(e.left !== t.site)]
  7158. }
  7159. function ha(t, e) {
  7160. return e[+(e.left === t.site)]
  7161. }
  7162. Ys.prototype.init = function () {
  7163. this.dirtyNodes = [];
  7164. for (var t = 0; t < this.nodes.length; t++) Xs.cleanNode(this.nodes[t])
  7165. }, Ys.prototype.cleanDirty = function () {
  7166. for (var t = 0; t < this.dirtyNodes.length; t++) Xs.cleanNode(this.dirtyNodes[t]);
  7167. this.dirtyNodes = []
  7168. }, Ys.prototype.markDirty = function (t) {
  7169. this.dirtyNodes.push(t)
  7170. }, Ys.prototype.neighbors = function (t) {
  7171. var e = [],
  7172. n = t.x,
  7173. r = t.y,
  7174. i = this.grid;
  7175. return i[n - 1] && i[n - 1][r] && e.push(i[n - 1][r]), i[n + 1] && i[n + 1][r] && e.push(i[n + 1][r]), i[n] && i[n][r - 1] && e.push(i[n][r - 1]), i[n] && i[n][r + 1] && e.push(i[n][r + 1]), this.diagonal && (i[n - 1] && i[n - 1][r - 1] && e.push(i[n - 1][r - 1]), i[n + 1] && i[n + 1][r - 1] && e.push(i[n + 1][r - 1]), i[n - 1] && i[n - 1][r + 1] && e.push(i[n - 1][r + 1]), i[n + 1] && i[n + 1][r + 1] && e.push(i[n + 1][r + 1])), e
  7176. }, Ys.prototype.toString = function () {
  7177. for (var t, e, n, r, i = [], o = this.grid, s = 0, a = o.length; s < a; s++) {
  7178. for (t = [], n = 0, r = (e = o[s]).length; n < r; n++) t.push(e[n].weight);
  7179. i.push(t.join(" "))
  7180. }
  7181. return i.join("\n")
  7182. }, Hs.prototype.toString = function () {
  7183. return "[" + this.x + " " + this.y + "]"
  7184. }, Hs.prototype.getCost = function (t) {
  7185. return t && t.x !== this.x && t.y !== this.y ? 1.41421 * this.weight : this.weight
  7186. }, Hs.prototype.isWall = function () {
  7187. return 0 === this.weight
  7188. }, Ws.prototype = {
  7189. push: function (t) {
  7190. this.content.push(t), this.sinkDown(this.content.length - 1)
  7191. },
  7192. pop: function () {
  7193. var t = this.content[0],
  7194. e = this.content.pop();
  7195. return this.content.length > 0 && (this.content[0] = e, this.bubbleUp(0)), t
  7196. },
  7197. remove: function (t) {
  7198. var e = this.content.indexOf(t),
  7199. n = this.content.pop();
  7200. e !== this.content.length - 1 && (this.content[e] = n, this.scoreFunction(n) < this.scoreFunction(t) ? this.sinkDown(e) : this.bubbleUp(e))
  7201. },
  7202. size: function () {
  7203. return this.content.length
  7204. },
  7205. rescoreElement: function (t) {
  7206. this.sinkDown(this.content.indexOf(t))
  7207. },
  7208. sinkDown: function (t) {
  7209. for (var e = this.content[t]; t > 0;) {
  7210. var n = (t + 1 >> 1) - 1,
  7211. r = this.content[n];
  7212. if (!(this.scoreFunction(e) < this.scoreFunction(r))) break;
  7213. this.content[n] = e, this.content[t] = r, t = n
  7214. }
  7215. },
  7216. bubbleUp: function (t) {
  7217. for (var e = this.content.length, n = this.content[t], r = this.scoreFunction(n);;) {
  7218. var i, o = t + 1 << 1,
  7219. s = o - 1,
  7220. a = null;
  7221. if (s < e) {
  7222. var u = this.content[s];
  7223. (i = this.scoreFunction(u)) < r && (a = s)
  7224. }
  7225. if (o < e) {
  7226. var l = this.content[o];
  7227. this.scoreFunction(l) < (null === a ? r : i) && (a = o)
  7228. }
  7229. if (null === a) break;
  7230. this.content[t] = this.content[a], this.content[a] = n, t = a
  7231. }
  7232. }
  7233. }, $s.prototype = {
  7234. constructor: $s,
  7235. insert: function (t, e) {
  7236. var n, r, i;
  7237. if (t) {
  7238. if (e.P = t, e.N = t.N, t.N && (t.N.P = e), t.N = e, t.R) {
  7239. for (t = t.R; t.L;) t = t.L;
  7240. t.L = e
  7241. } else t.R = e;
  7242. n = t
  7243. } else this._ ? (t = ra(this._), e.P = null, e.N = t, t.P = t.L = e, n = t) : (e.P = e.N = null, this._ = e, n = null);
  7244. for (e.L = e.R = null, e.U = n, e.C = !0, t = e; n && n.C;) n === (r = n.U).L ? (i = r.R) && i.C ? (n.C = i.C = !1, r.C = !0, t = r) : (t === n.R && (ea(this, n), n = (t = n).U), n.C = !1, r.C = !0, na(this, r)) : (i = r.L) && i.C ? (n.C = i.C = !1, r.C = !0, t = r) : (t === n.L && (na(this, n), n = (t = n).U), n.C = !1, r.C = !0, ea(this, r)), n = t.U;
  7245. this._.C = !1
  7246. },
  7247. remove: function (t) {
  7248. t.N && (t.N.P = t.P), t.P && (t.P.N = t.N), t.N = t.P = null;
  7249. var e, n, r, i = t.U,
  7250. o = t.L,
  7251. s = t.R;
  7252. if (n = o ? s ? ra(s) : o : s, i ? i.L === t ? i.L = n : i.R = n : this._ = n, o && s ? (r = n.C, n.C = t.C, n.L = o, o.U = n, n !== s ? (i = n.U, n.U = t.U, t = n.R, i.L = t, n.R = s, s.U = n) : (n.U = i, i = n, t = n.R)) : (r = t.C, t = n), t && (t.U = i), !r)
  7253. if (t && t.C) t.C = !1;
  7254. else {
  7255. do {
  7256. if (t === this._) break;
  7257. if (t === i.L) {
  7258. if ((e = i.R).C && (e.C = !1, i.C = !0, ea(this, i), e = i.R), e.L && e.L.C || e.R && e.R.C) {
  7259. e.R && e.R.C || (e.L.C = !1, e.C = !0, na(this, e), e = i.R), e.C = i.C, i.C = e.R.C = !1, ea(this, i), t = this._;
  7260. break
  7261. }
  7262. } else if ((e = i.L).C && (e.C = !1, i.C = !0, na(this, i), e = i.L), e.L && e.L.C || e.R && e.R.C) {
  7263. e.L && e.L.C || (e.R.C = !1, e.C = !0, ea(this, e), e = i.L), e.C = i.C, i.C = e.L.C = !1, na(this, i), t = this._;
  7264. break
  7265. }
  7266. e.C = !0, t = i, i = i.U
  7267. } while (!t.C);
  7268. t && (t.C = !1)
  7269. }
  7270. }
  7271. };
  7272. var pa, fa = [];
  7273. function ga() {
  7274. ta(this), this.x = this.y = this.arc = this.site = this.cy = null
  7275. }
  7276. function da(t) {
  7277. var e = t.P,
  7278. n = t.N;
  7279. if (e && n) {
  7280. var r = e.site,
  7281. i = t.site,
  7282. o = n.site;
  7283. if (r !== o) {
  7284. var s = i[0],
  7285. a = i[1],
  7286. u = r[0] - s,
  7287. l = r[1] - a,
  7288. c = o[0] - s,
  7289. h = o[1] - a,
  7290. p = 2 * (u * h - l * c);
  7291. if (!(p >= -La)) {
  7292. var f = u * u + l * l,
  7293. g = c * c + h * h,
  7294. d = (h * f - l * g) / p,
  7295. y = (u * g - c * f) / p,
  7296. v = fa.pop() || new ga;
  7297. v.arc = t, v.site = i, v.x = d + s, v.y = (v.cy = y + a) + Math.sqrt(d * d + y * y), t.circle = v;
  7298. for (var _ = null, m = Ca._; m;)
  7299. if (v.y < m.y || v.y === m.y && v.x <= m.x) {
  7300. if (!m.L) {
  7301. _ = m.P;
  7302. break
  7303. }
  7304. m = m.L
  7305. } else {
  7306. if (!m.R) {
  7307. _ = m;
  7308. break
  7309. }
  7310. m = m.R
  7311. } Ca.insert(_, v), _ || (pa = v)
  7312. }
  7313. }
  7314. }
  7315. }
  7316. function ya(t) {
  7317. var e = t.circle;
  7318. e && (e.P || (pa = e.N), Ca.remove(e), fa.push(e), ta(e), t.circle = null)
  7319. }
  7320. var va = [];
  7321. function _a() {
  7322. ta(this), this.edge = this.site = this.circle = null
  7323. }
  7324. function ma(t) {
  7325. var e = va.pop() || new _a;
  7326. return e.site = t, e
  7327. }
  7328. function xa(t) {
  7329. ya(t), Na.remove(t), va.push(t), ta(t)
  7330. }
  7331. function Ea(t) {
  7332. var e = t.circle,
  7333. n = e.x,
  7334. r = e.cy,
  7335. i = [n, r],
  7336. o = t.P,
  7337. s = t.N,
  7338. a = [t];
  7339. xa(t);
  7340. for (var u = o; u.circle && Math.abs(n - u.circle.x) < Ma && Math.abs(r - u.circle.cy) < Ma;) o = u.P, a.unshift(u), xa(u), u = o;
  7341. a.unshift(u), ya(u);
  7342. for (var l = s; l.circle && Math.abs(n - l.circle.x) < Ma && Math.abs(r - l.circle.cy) < Ma;) s = l.N, a.push(l), xa(l), l = s;
  7343. a.push(l), ya(l);
  7344. var c, h = a.length;
  7345. for (c = 1; c < h; ++c) l = a[c], u = a[c - 1], sa(l.edge, u.site, l.site, i);
  7346. u = a[0], (l = a[h - 1]).edge = ia(u.site, l.site, null, i), da(u), da(l)
  7347. }
  7348. function ba(t) {
  7349. for (var e, n, r, i, o = t[0], s = t[1], a = Na._; a;)
  7350. if ((r = wa(a, s) - o) > Ma) a = a.L;
  7351. else {
  7352. if (!((i = o - Ia(a, s)) > Ma)) {
  7353. r > -Ma ? (e = a.P, n = a) : i > -Ma ? (e = a, n = a.N) : e = n = a;
  7354. break
  7355. }
  7356. if (!a.R) {
  7357. e = a;
  7358. break
  7359. }
  7360. a = a.R
  7361. }!
  7362. function (t) {
  7363. Sa[t.index] = {
  7364. site: t,
  7365. halfedges: []
  7366. }
  7367. }(t);
  7368. var u = ma(t);
  7369. if (Na.insert(e, u), e || n) {
  7370. if (e === n) return ya(e), n = ma(e.site), Na.insert(u, n), u.edge = n.edge = ia(e.site, u.site), da(e), void da(n);
  7371. if (n) {
  7372. ya(e), ya(n);
  7373. var l = e.site,
  7374. c = l[0],
  7375. h = l[1],
  7376. p = t[0] - c,
  7377. f = t[1] - h,
  7378. g = n.site,
  7379. d = g[0] - c,
  7380. y = g[1] - h,
  7381. v = 2 * (p * y - f * d),
  7382. _ = p * p + f * f,
  7383. m = d * d + y * y,
  7384. x = [(y * _ - f * m) / v + c, (p * m - d * _) / v + h];
  7385. sa(n.edge, l, g, x), u.edge = ia(l, t, null, x), n.edge = ia(t, g, null, x), da(e), da(n)
  7386. } else u.edge = ia(e.site, u.site)
  7387. }
  7388. }
  7389. function wa(t, e) {
  7390. var n = t.site,
  7391. r = n[0],
  7392. i = n[1],
  7393. o = i - e;
  7394. if (!o) return r;
  7395. var s = t.P;
  7396. if (!s) return -1 / 0;
  7397. var a = (n = s.site)[0],
  7398. u = n[1],
  7399. l = u - e;
  7400. if (!l) return a;
  7401. var c = a - r,
  7402. h = 1 / o - 1 / l,
  7403. p = c / l;
  7404. return h ? (-p + Math.sqrt(p * p - 2 * h * (c * c / (-2 * l) - u + l / 2 + i - o / 2))) / h + r : (r + a) / 2
  7405. }
  7406. function Ia(t, e) {
  7407. var n = t.N;
  7408. if (n) return wa(n, e);
  7409. var r = t.site;
  7410. return r[1] === e ? r[0] : 1 / 0
  7411. }
  7412. var Na, Sa, Ca, Pa, Ma = 1e-6,
  7413. La = 1e-12;
  7414. function Oa(t, e) {
  7415. return e[1] - t[1] || e[0] - t[0]
  7416. }
  7417. function Ra(t, e) {
  7418. var n, r, i, o = t.sort(Oa).pop();
  7419. for (Pa = [], Sa = new Array(t.length), Na = new $s, Ca = new $s;;)
  7420. if (i = pa, o && (!i || o[1] < i.y || o[1] === i.y && o[0] < i.x)) o[0] === n && o[1] === r || (ba(o), n = o[0], r = o[1]), o = t.pop();
  7421. else {
  7422. if (!i) break;
  7423. Ea(i.arc)
  7424. } if (function () {
  7425. for (var t, e, n, r, i = 0, o = Sa.length; i < o; ++i)
  7426. if ((t = Sa[i]) && (r = (e = t.halfedges).length)) {
  7427. var s = new Array(r),
  7428. a = new Array(r);
  7429. for (n = 0; n < r; ++n) s[n] = n, a[n] = la(t, Pa[e[n]]);
  7430. for (s.sort((function (t, e) {
  7431. return a[e] - a[t]
  7432. })), n = 0; n < r; ++n) a[n] = e[s[n]];
  7433. for (n = 0; n < r; ++n) e[n] = a[n]
  7434. }
  7435. }(), e) {
  7436. var s = +e[0][0],
  7437. a = +e[0][1],
  7438. u = +e[1][0],
  7439. l = +e[1][1];
  7440. ! function (t, e, n, r) {
  7441. for (var i, o = Pa.length; o--;) ua(i = Pa[o], t, e, n, r) && aa(i, t, e, n, r) && (Math.abs(i[0][0] - i[1][0]) > Ma || Math.abs(i[0][1] - i[1][1]) > Ma) || delete Pa[o]
  7442. }(s, a, u, l),
  7443. function (t, e, n, r) {
  7444. var i, o, s, a, u, l, c, h, p, f, g, d, y = Sa.length,
  7445. v = !0;
  7446. for (i = 0; i < y; ++i)
  7447. if (o = Sa[i]) {
  7448. for (s = o.site, a = (u = o.halfedges).length; a--;) Pa[u[a]] || u.splice(a, 1);
  7449. for (a = 0, l = u.length; a < l;) g = (f = ha(o, Pa[u[a]]))[0], d = f[1], h = (c = ca(o, Pa[u[++a % l]]))[0], p = c[1], (Math.abs(g - h) > Ma || Math.abs(d - p) > Ma) && (u.splice(a, 0, Pa.push(oa(s, f, Math.abs(g - t) < Ma && r - d > Ma ? [t, Math.abs(h - t) < Ma ? p : r] : Math.abs(d - r) < Ma && n - g > Ma ? [Math.abs(p - r) < Ma ? h : n, r] : Math.abs(g - n) < Ma && d - e > Ma ? [n, Math.abs(h - n) < Ma ? p : e] : Math.abs(d - e) < Ma && g - t > Ma ? [Math.abs(p - e) < Ma ? h : t, e] : null)) - 1), ++l);
  7450. l && (v = !1)
  7451. } if (v) {
  7452. var _, m, x, E = 1 / 0;
  7453. for (i = 0, v = null; i < y; ++i)(o = Sa[i]) && (x = (_ = (s = o.site)[0] - t) * _ + (m = s[1] - e) * m) < E && (E = x, v = o);
  7454. if (v) {
  7455. var b = [t, e],
  7456. w = [t, r],
  7457. I = [n, r],
  7458. N = [n, e];
  7459. v.halfedges.push(Pa.push(oa(s = v.site, b, w)) - 1, Pa.push(oa(s, w, I)) - 1, Pa.push(oa(s, I, N)) - 1, Pa.push(oa(s, N, b)) - 1)
  7460. }
  7461. }
  7462. for (i = 0; i < y; ++i)(o = Sa[i]) && (o.halfedges.length || delete Sa[i])
  7463. }(s, a, u, l)
  7464. }
  7465. this.edges = Pa, this.cells = Sa, Na = Ca = Pa = Sa = null
  7466. }
  7467. function Ta(t) {
  7468. return (t = t.slice()).push(t[0]), l([t])
  7469. }
  7470. function Aa(t, e, n, r) {
  7471. var i = (r = r || {}).steps || 64,
  7472. o = r.units || "kilometers",
  7473. s = r.angle || 0,
  7474. a = r.pivot || t,
  7475. u = r.properties || t.properties || {};
  7476. if (!t) throw new Error("center is required");
  7477. if (!e) throw new Error("xSemiAxis is required");
  7478. if (!n) throw new Error("ySemiAxis is required");
  7479. if (!P(r)) throw new Error("options must be an object");
  7480. if (!C(i)) throw new Error("steps must be a number");
  7481. if (!C(s)) throw new Error("angle must be a number");
  7482. var c = K(t);
  7483. if ("degrees" === o) var h = I(s);
  7484. else e = ji(t, e, 90, {
  7485. units: o
  7486. }), n = ji(t, n, 0, {
  7487. units: o
  7488. }), e = K(e)[0] - c[0], n = K(n)[1] - c[1];
  7489. for (var p = [], f = 0; f < i; f += 1) {
  7490. var g = -360 * f / i,
  7491. d = e * n / Math.sqrt(Math.pow(n, 2) + Math.pow(e, 2) * Math.pow(Da(g), 2)),
  7492. y = e * n / Math.sqrt(Math.pow(e, 2) + Math.pow(n, 2) / Math.pow(Da(g), 2));
  7493. if (g < -90 && g >= -270 && (d = -d), g < -180 && g >= -360 && (y = -y), "degrees" === o) {
  7494. var v = d * Math.cos(h) + y * Math.sin(h),
  7495. _ = y * Math.cos(h) - d * Math.sin(h);
  7496. d = v, y = _
  7497. }
  7498. p.push([d + c[0], y + c[1]])
  7499. }
  7500. return p.push(p[0]), "degrees" === o ? l([p], u) : $o(l([p], u), s, {
  7501. pivot: a
  7502. })
  7503. }
  7504. function Da(t) {
  7505. var e = t * Math.PI / 180;
  7506. return Math.tan(e)
  7507. }
  7508. function Fa(t, e) {
  7509. void 0 === e && (e = {});
  7510. var n = 0,
  7511. r = 0,
  7512. i = 0;
  7513. return q(t, (function (t, o, s) {
  7514. var a = e.weight ? null == s ? void 0 : s[e.weight] : void 0;
  7515. if (!C(a = null == a ? 1 : a)) throw new Error("weight value must be a number for feature index " + o);
  7516. (a = Number(a)) > 0 && R(t, (function (t) {
  7517. n += t[0] * a, r += t[1] * a, i += a
  7518. }))
  7519. })), a([n / i, r / i], e.properties, e)
  7520. }
  7521. function ka(t, e, n, r, i) {
  7522. var o = r.tolerance || .001,
  7523. s = 0,
  7524. u = 0,
  7525. l = 0,
  7526. c = 0;
  7527. if (F(n, (function (e) {
  7528. var n, r = null === (n = e.properties) || void 0 === n ? void 0 : n.weight,
  7529. i = null == r ? 1 : r;
  7530. if (!C(i = Number(i))) throw new Error("weight value must be a number");
  7531. if (i > 0) {
  7532. c += 1;
  7533. var o = i * me(e, t);
  7534. 0 === o && (o = 1);
  7535. var a = i / o;
  7536. s += e.geometry.coordinates[0] * a, u += e.geometry.coordinates[1] * a, l += a
  7537. }
  7538. })), c < 1) throw new Error("no features to measure");
  7539. var h = s / l,
  7540. p = u / l;
  7541. return 1 === c || 0 === i || Math.abs(h - e[0]) < o && Math.abs(p - e[1]) < o ? a([h, p], {
  7542. medianCandidates: r.medianCandidates
  7543. }) : (r.medianCandidates.push([h, p]), ka([h, p], t, n, r, i - 1))
  7544. }
  7545. function Ga(t, e) {
  7546. return {
  7547. x: t[0] - e[0],
  7548. y: t[1] - e[1]
  7549. }
  7550. }
  7551. function qa(t, e) {
  7552. var n = 0,
  7553. r = 0;
  7554. R(t, (function (i, o, s, a, u) {
  7555. u > n && (n = u, r = o, e.push([]));
  7556. var l = o - r,
  7557. c = t.coordinates[u][l + 1],
  7558. h = i[0],
  7559. p = i[1],
  7560. f = c[0],
  7561. g = c[1];
  7562. e[u].push([.75 * h + .25 * f, .75 * p + .25 * g]), e[u].push([.25 * h + .75 * f, .25 * p + .75 * g])
  7563. }), !0), e.forEach((function (t) {
  7564. t.push(t[0])
  7565. }))
  7566. }
  7567. function Ba(t, e) {
  7568. var n = 0,
  7569. r = 0,
  7570. i = 0;
  7571. R(t, (function (o, s, a, u, l) {
  7572. u > i && (i = u, r = s, e.push([
  7573. []
  7574. ])), l > n && (n = l, r = s, e[u].push([]));
  7575. var c = s - r,
  7576. h = t.coordinates[u][l][c + 1],
  7577. p = o[0],
  7578. f = o[1],
  7579. g = h[0],
  7580. d = h[1];
  7581. e[u][l].push([.75 * p + .25 * g, .75 * f + .25 * d]), e[u][l].push([.25 * p + .75 * g, .25 * f + .75 * d])
  7582. }), !0), e.forEach((function (t) {
  7583. t.forEach((function (t) {
  7584. t.push(t[0])
  7585. }))
  7586. }))
  7587. }
  7588. function za(t, e, n) {
  7589. void 0 === n && (n = 2);
  7590. var r = K(t),
  7591. i = K(e),
  7592. o = r[0] - i[0],
  7593. s = r[1] - i[1];
  7594. return 1 === n ? Math.abs(o) + Math.abs(s) : Math.pow(Math.pow(o, n) + Math.pow(s, n), 1 / n)
  7595. }
  7596. function ja(t, e) {
  7597. var n = (e = e || {}).threshold || 1e4,
  7598. r = e.p || 2,
  7599. i = e.binary || !1,
  7600. o = e.alpha || -1,
  7601. s = e.standardization || !1,
  7602. a = [];
  7603. F(t, (function (t) {
  7604. a.push(En(t))
  7605. }));
  7606. for (var u = [], l = 0; l < a.length; l++) u[l] = [];
  7607. for (l = 0; l < a.length; l++)
  7608. for (var c = l; c < a.length; c++) {
  7609. l === c && (u[l][c] = 0);
  7610. var h = za(a[l], a[c], r);
  7611. u[l][c] = h, u[c][l] = h
  7612. }
  7613. for (l = 0; l < a.length; l++)
  7614. for (c = 0; c < a.length; c++) {
  7615. 0 !== (h = u[l][c]) && (u[l][c] = i ? h <= n ? 1 : 0 : h <= n ? Math.pow(h, o) : 0)
  7616. }
  7617. if (s)
  7618. for (l = 0; l < a.length; l++) {
  7619. var p = u[l].reduce((function (t, e) {
  7620. return t + e
  7621. }), 0);
  7622. for (c = 0; c < a.length; c++) u[l][c] = u[l][c] / p
  7623. }
  7624. return u
  7625. }
  7626. function Ua(t) {
  7627. for (var e = 0, n = 0, r = t; n < r.length; n++) {
  7628. e += r[n]
  7629. }
  7630. return e / t.length
  7631. }
  7632. function Va(t, e) {
  7633. return void 0 === e && (e = {}), Ya(t, "mercator", e)
  7634. }
  7635. function Xa(t, e) {
  7636. return void 0 === e && (e = {}), Ya(t, "wgs84", e)
  7637. }
  7638. function Ya(t, e, n) {
  7639. void 0 === n && (n = {});
  7640. var r = (n = n || {}).mutate;
  7641. if (!t) throw new Error("geojson is required");
  7642. return Array.isArray(t) && C(t[0]) ? t = "mercator" === e ? Ha(t) : Wa(t) : (!0 !== r && (t = Ie(t)), R(t, (function (t) {
  7643. var n = "mercator" === e ? Ha(t) : Wa(t);
  7644. t[0] = n[0], t[1] = n[1]
  7645. }))), t
  7646. }
  7647. function Ha(t) {
  7648. var e = Math.PI / 180,
  7649. n = 6378137,
  7650. r = 20037508.342789244,
  7651. i = [n * (Math.abs(t[0]) <= 180 ? t[0] : t[0] - 360 * function (t) {
  7652. return t < 0 ? -1 : t > 0 ? 1 : 0
  7653. }(t[0])) * e, n * Math.log(Math.tan(.25 * Math.PI + .5 * t[1] * e))];
  7654. return i[0] > r && (i[0] = r), i[0] < -r && (i[0] = -r), i[1] > r && (i[1] = r), i[1] < -r && (i[1] = -r), i
  7655. }
  7656. function Wa(t) {
  7657. var e = 180 / Math.PI,
  7658. n = 6378137;
  7659. return [t[0] * e / n, (.5 * Math.PI - 2 * Math.atan(Math.exp(-t[1] / n))) * e]
  7660. }
  7661. Ra.prototype = {
  7662. constructor: Ra,
  7663. polygons: function () {
  7664. var t = this.edges;
  7665. return this.cells.map((function (e) {
  7666. var n = e.halfedges.map((function (n) {
  7667. return ca(e, t[n])
  7668. }));
  7669. return n.data = e.site.data, n
  7670. }))
  7671. },
  7672. triangles: function () {
  7673. var t = [],
  7674. e = this.edges;
  7675. return this.cells.forEach((function (n, r) {
  7676. if (o = (i = n.halfedges).length)
  7677. for (var i, o, s, a, u, l, c = n.site, h = -1, p = e[i[o - 1]], f = p.left === c ? p.right : p.left; ++h < o;) s = f, f = (p = e[i[h]]).left === c ? p.right : p.left, s && f && r < s.index && r < f.index && (u = s, l = f, ((a = c)[0] - l[0]) * (u[1] - a[1]) - (a[0] - u[0]) * (l[1] - a[1]) < 0) && t.push([c.data, s.data, f.data])
  7678. })), t
  7679. },
  7680. links: function () {
  7681. return this.edges.filter((function (t) {
  7682. return t.right
  7683. })).map((function (t) {
  7684. return {
  7685. source: t.left.data,
  7686. target: t.right.data
  7687. }
  7688. }))
  7689. },
  7690. find: function (t, e, n) {
  7691. for (var r, i, o = this, s = o._found || 0, a = o.cells.length; !(i = o.cells[s]);)
  7692. if (++s >= a) return null;
  7693. var u = t - i.site[0],
  7694. l = e - i.site[1],
  7695. c = u * u + l * l;
  7696. do {
  7697. i = o.cells[r = s], s = null, i.halfedges.forEach((function (n) {
  7698. var r = o.edges[n],
  7699. a = r.left;
  7700. if (a !== i.site && a || (a = r.right)) {
  7701. var u = t - a[0],
  7702. l = e - a[1],
  7703. h = u * u + l * l;
  7704. h < c && (c = h, s = a.index)
  7705. }
  7706. }))
  7707. } while (null !== s);
  7708. return o._found = r, null == n || c <= n * n ? i.site : null
  7709. }
  7710. };
  7711. var Ja = Object.freeze({
  7712. __proto__: null,
  7713. toMercator: Va,
  7714. toWgs84: Xa
  7715. }),
  7716. Za = function () {
  7717. for (var t = 0, e = 0, n = arguments.length; e < n; e++) t += arguments[e].length;
  7718. var r = Array(t),
  7719. i = 0;
  7720. for (e = 0; e < n; e++)
  7721. for (var o = arguments[e], s = 0, a = o.length; s < a; s++, i++) r[i] = o[s];
  7722. return r
  7723. };
  7724. function Ka(t) {
  7725. return Array.isArray(t) ? nu(t) : t && t.bbox ? nu(t.bbox) : [360 * eu(), 180 * eu()]
  7726. }
  7727. function Qa(t, e) {
  7728. void 0 === e && (e = {}), null == t && (t = 1);
  7729. for (var n = [], r = 0; r < t; r++) n.push(a(Ka(e.bbox)));
  7730. return f(n)
  7731. }
  7732. function $a(t, e) {
  7733. void 0 === e && (e = {}), null == t && (t = 1), C(e.num_vertices) && void 0 !== e.num_vertices || (e.num_vertices = 10), C(e.max_radial_length) && void 0 !== e.max_radial_length || (e.max_radial_length = 10);
  7734. for (var n = [], r = function (t) {
  7735. var r, i = [],
  7736. o = Za(Array(e.num_vertices + 1)).map(Math.random);
  7737. o.forEach((function (t, e, n) {
  7738. n[e] = e > 0 ? t + n[e - 1] : t
  7739. })), o.forEach((function (t) {
  7740. t = 2 * t * Math.PI / o[o.length - 1];
  7741. var n = Math.random();
  7742. i.push([n * (e.max_radial_length || 10) * Math.sin(t), n * (e.max_radial_length || 10) * Math.cos(t)])
  7743. })), i[i.length - 1] = i[0], i = i.map((r = Ka(e.bbox), function (t) {
  7744. return [t[0] + r[0], t[1] + r[1]]
  7745. })), n.push(l([i]))
  7746. }, i = 0; i < t; i++) r();
  7747. return f(n)
  7748. }
  7749. function tu(t, e) {
  7750. if (void 0 === e && (e = {}), !P(e = e || {})) throw new Error("options is invalid");
  7751. var n = e.bbox,
  7752. r = e.num_vertices,
  7753. i = e.max_length,
  7754. o = e.max_rotation;
  7755. null == t && (t = 1), (!C(r) || void 0 === r || r < 2) && (r = 10), C(i) && void 0 !== i || (i = 1e-4), C(o) && void 0 !== o || (o = Math.PI / 8);
  7756. for (var s = [], a = 0; a < t; a++) {
  7757. for (var u = [Ka(n)], l = 0; l < r - 1; l++) {
  7758. var c = (0 === l ? 2 * Math.random() * Math.PI : Math.tan((u[l][1] - u[l - 1][1]) / (u[l][0] - u[l - 1][0]))) + (Math.random() - .5) * o * 2,
  7759. p = Math.random() * i;
  7760. u.push([u[l][0] + p * Math.cos(c), u[l][1] + p * Math.sin(c)])
  7761. }
  7762. s.push(h(u))
  7763. }
  7764. return f(s)
  7765. }
  7766. function eu() {
  7767. return Math.random() - .5
  7768. }
  7769. function nu(t) {
  7770. return [Math.random() * (t[2] - t[0]) + t[0], Math.random() * (t[3] - t[1]) + t[1]]
  7771. }
  7772. var ru = Object.freeze({
  7773. __proto__: null,
  7774. randomPosition: Ka,
  7775. randomPoint: Qa,
  7776. randomPolygon: $a,
  7777. randomLineString: tu
  7778. });
  7779. function iu(t, e) {
  7780. if (!t) throw new Error("geojson is required");
  7781. if ("FeatureCollection" !== t.type) throw new Error("geojson must be a FeatureCollection");
  7782. if (null == e) throw new Error("filter is required");
  7783. var n = [];
  7784. return F(t, (function (t) {
  7785. uu(t.properties, e) && n.push(t)
  7786. })), f(n)
  7787. }
  7788. function ou(t, e, n) {
  7789. if (!t) throw new Error("geojson is required");
  7790. if ("FeatureCollection" !== t.type) throw new Error("geojson must be a FeatureCollection");
  7791. if (null == e) throw new Error("property is required");
  7792. for (var r = au(t, e), i = Object.keys(r), o = 0; o < i.length; o++) {
  7793. for (var s = i[o], a = r[s], u = [], l = 0; l < a.length; l++) u.push(t.features[a[l]]);
  7794. n(f(u), s, o)
  7795. }
  7796. }
  7797. function su(t, e, n, r) {
  7798. var i = r;
  7799. return ou(t, e, (function (t, e, o) {
  7800. i = 0 === o && void 0 === r ? t : n(i, t, e, o)
  7801. })), i
  7802. }
  7803. function au(t, e) {
  7804. var n = {};
  7805. return F(t, (function (t, r) {
  7806. var i = t.properties || {};
  7807. if (Object.prototype.hasOwnProperty.call(i, String(e))) {
  7808. var o = i[e];
  7809. Object.prototype.hasOwnProperty.call(n, o) ? n[o].push(r) : n[o] = [r]
  7810. }
  7811. })), n
  7812. }
  7813. function uu(t, e) {
  7814. if (void 0 === t) return !1;
  7815. var n = typeof e;
  7816. if ("number" === n || "string" === n) return Object.prototype.hasOwnProperty.call(t, e);
  7817. if (Array.isArray(e)) {
  7818. for (var r = 0; r < e.length; r++)
  7819. if (!uu(t, e[r])) return !1;
  7820. return !0
  7821. }
  7822. return lu(t, e)
  7823. }
  7824. function lu(t, e) {
  7825. for (var n = Object.keys(e), r = 0; r < n.length; r++) {
  7826. var i = n[r];
  7827. if (t[i] !== e[i]) return !1
  7828. }
  7829. return !0
  7830. }
  7831. function cu(t, e) {
  7832. if (!e) return {};
  7833. if (!e.length) return {};
  7834. for (var n = {}, r = 0; r < e.length; r++) {
  7835. var i = e[r];
  7836. Object.prototype.hasOwnProperty.call(t, i) && (n[i] = t[i])
  7837. }
  7838. return n
  7839. }
  7840. var hu = Object.freeze({
  7841. __proto__: null,
  7842. getCluster: iu,
  7843. clusterEach: ou,
  7844. clusterReduce: su,
  7845. createBins: au,
  7846. applyFilter: uu,
  7847. propertiesContainsFilter: lu,
  7848. filterProperties: cu
  7849. }),
  7850. pu = function (t, e) {
  7851. this.next = null, this.key = t, this.data = e, this.left = null, this.right = null
  7852. };
  7853. /**
  7854. * splaytree v3.1.0
  7855. * Fast Splay tree for Node and browser
  7856. *
  7857. * @author Alexander Milevski <info@w8r.name>
  7858. * @license MIT
  7859. * @preserve
  7860. */
  7861. function fu(t, e) {
  7862. return t > e ? 1 : t < e ? -1 : 0
  7863. }
  7864. function gu(t, e, n) {
  7865. for (var r = new pu(null, null), i = r, o = r;;) {
  7866. var s = n(t, e.key);
  7867. if (s < 0) {
  7868. if (null === e.left) break;
  7869. if (n(t, e.left.key) < 0) {
  7870. var a = e.left;
  7871. if (e.left = a.right, a.right = e, null === (e = a).left) break
  7872. }
  7873. o.left = e, o = e, e = e.left
  7874. } else {
  7875. if (!(s > 0)) break;
  7876. if (null === e.right) break;
  7877. if (n(t, e.right.key) > 0) {
  7878. a = e.right;
  7879. if (e.right = a.left, a.left = e, null === (e = a).right) break
  7880. }
  7881. i.right = e, i = e, e = e.right
  7882. }
  7883. }
  7884. return i.right = e.left, o.left = e.right, e.left = r.right, e.right = r.left, e
  7885. }
  7886. function du(t, e, n, r) {
  7887. var i = new pu(t, e);
  7888. if (null === n) return i.left = i.right = null, i;
  7889. var o = r(t, (n = gu(t, n, r)).key);
  7890. return o < 0 ? (i.left = n.left, i.right = n, n.left = null) : o >= 0 && (i.right = n.right, i.left = n, n.right = null), i
  7891. }
  7892. function yu(t, e, n) {
  7893. var r = null,
  7894. i = null;
  7895. if (e) {
  7896. var o = n((e = gu(t, e, n)).key, t);
  7897. 0 === o ? (r = e.left, i = e.right) : o < 0 ? (i = e.right, e.right = null, r = e) : (r = e.left, e.left = null, i = e)
  7898. }
  7899. return {
  7900. left: r,
  7901. right: i
  7902. }
  7903. }
  7904. function vu(t, e, n, r, i) {
  7905. if (t) {
  7906. r(e + (n ? "└── " : "├── ") + i(t) + "\n");
  7907. var o = e + (n ? " " : "│ ");
  7908. t.left && vu(t.left, o, !1, r, i), t.right && vu(t.right, o, !0, r, i)
  7909. }
  7910. }
  7911. var _u = function () {
  7912. function t(t) {
  7913. void 0 === t && (t = fu), this._root = null, this._size = 0, this._comparator = t
  7914. }
  7915. return t.prototype.insert = function (t, e) {
  7916. return this._size++, this._root = du(t, e, this._root, this._comparator)
  7917. }, t.prototype.add = function (t, e) {
  7918. var n = new pu(t, e);
  7919. null === this._root && (n.left = n.right = null, this._size++, this._root = n);
  7920. var r = this._comparator,
  7921. i = gu(t, this._root, r),
  7922. o = r(t, i.key);
  7923. return 0 === o ? this._root = i : (o < 0 ? (n.left = i.left, n.right = i, i.left = null) : o > 0 && (n.right = i.right, n.left = i, i.right = null), this._size++, this._root = n), this._root
  7924. }, t.prototype.remove = function (t) {
  7925. this._root = this._remove(t, this._root, this._comparator)
  7926. }, t.prototype._remove = function (t, e, n) {
  7927. var r;
  7928. return null === e ? null : 0 === n(t, (e = gu(t, e, n)).key) ? (null === e.left ? r = e.right : (r = gu(t, e.left, n)).right = e.right, this._size--, r) : e
  7929. }, t.prototype.pop = function () {
  7930. var t = this._root;
  7931. if (t) {
  7932. for (; t.left;) t = t.left;
  7933. return this._root = gu(t.key, this._root, this._comparator), this._root = this._remove(t.key, this._root, this._comparator), {
  7934. key: t.key,
  7935. data: t.data
  7936. }
  7937. }
  7938. return null
  7939. }, t.prototype.findStatic = function (t) {
  7940. for (var e = this._root, n = this._comparator; e;) {
  7941. var r = n(t, e.key);
  7942. if (0 === r) return e;
  7943. e = r < 0 ? e.left : e.right
  7944. }
  7945. return null
  7946. }, t.prototype.find = function (t) {
  7947. return this._root && (this._root = gu(t, this._root, this._comparator), 0 !== this._comparator(t, this._root.key)) ? null : this._root
  7948. }, t.prototype.contains = function (t) {
  7949. for (var e = this._root, n = this._comparator; e;) {
  7950. var r = n(t, e.key);
  7951. if (0 === r) return !0;
  7952. e = r < 0 ? e.left : e.right
  7953. }
  7954. return !1
  7955. }, t.prototype.forEach = function (t, e) {
  7956. for (var n = this._root, r = [], i = !1; !i;) null !== n ? (r.push(n), n = n.left) : 0 !== r.length ? (n = r.pop(), t.call(e, n), n = n.right) : i = !0;
  7957. return this
  7958. }, t.prototype.range = function (t, e, n, r) {
  7959. for (var i = [], o = this._comparator, s = this._root; 0 !== i.length || s;)
  7960. if (s) i.push(s), s = s.left;
  7961. else {
  7962. if (o((s = i.pop()).key, e) > 0) break;
  7963. if (o(s.key, t) >= 0 && n.call(r, s)) return this;
  7964. s = s.right
  7965. } return this
  7966. }, t.prototype.keys = function () {
  7967. var t = [];
  7968. return this.forEach((function (e) {
  7969. var n = e.key;
  7970. return t.push(n)
  7971. })), t
  7972. }, t.prototype.values = function () {
  7973. var t = [];
  7974. return this.forEach((function (e) {
  7975. var n = e.data;
  7976. return t.push(n)
  7977. })), t
  7978. }, t.prototype.min = function () {
  7979. return this._root ? this.minNode(this._root).key : null
  7980. }, t.prototype.max = function () {
  7981. return this._root ? this.maxNode(this._root).key : null
  7982. }, t.prototype.minNode = function (t) {
  7983. if (void 0 === t && (t = this._root), t)
  7984. for (; t.left;) t = t.left;
  7985. return t
  7986. }, t.prototype.maxNode = function (t) {
  7987. if (void 0 === t && (t = this._root), t)
  7988. for (; t.right;) t = t.right;
  7989. return t
  7990. }, t.prototype.at = function (t) {
  7991. for (var e = this._root, n = !1, r = 0, i = []; !n;)
  7992. if (e) i.push(e), e = e.left;
  7993. else if (i.length > 0) {
  7994. if (e = i.pop(), r === t) return e;
  7995. r++, e = e.right
  7996. } else n = !0;
  7997. return null
  7998. }, t.prototype.next = function (t) {
  7999. var e = this._root,
  8000. n = null;
  8001. if (t.right) {
  8002. for (n = t.right; n.left;) n = n.left;
  8003. return n
  8004. }
  8005. for (var r = this._comparator; e;) {
  8006. var i = r(t.key, e.key);
  8007. if (0 === i) break;
  8008. i < 0 ? (n = e, e = e.left) : e = e.right
  8009. }
  8010. return n
  8011. }, t.prototype.prev = function (t) {
  8012. var e = this._root,
  8013. n = null;
  8014. if (null !== t.left) {
  8015. for (n = t.left; n.right;) n = n.right;
  8016. return n
  8017. }
  8018. for (var r = this._comparator; e;) {
  8019. var i = r(t.key, e.key);
  8020. if (0 === i) break;
  8021. i < 0 ? e = e.left : (n = e, e = e.right)
  8022. }
  8023. return n
  8024. }, t.prototype.clear = function () {
  8025. return this._root = null, this._size = 0, this
  8026. }, t.prototype.toList = function () {
  8027. return function (t) {
  8028. var e = t,
  8029. n = [],
  8030. r = !1,
  8031. i = new pu(null, null),
  8032. o = i;
  8033. for (; !r;) e ? (n.push(e), e = e.left) : n.length > 0 ? e = (e = o = o.next = n.pop()).right : r = !0;
  8034. return o.next = null, i.next
  8035. }(this._root)
  8036. }, t.prototype.load = function (t, e, n) {
  8037. void 0 === e && (e = []), void 0 === n && (n = !1);
  8038. var r = t.length,
  8039. i = this._comparator;
  8040. if (n && Eu(t, e, 0, r - 1, i), null === this._root) this._root = mu(t, e, 0, r), this._size = r;
  8041. else {
  8042. var o = function (t, e, n) {
  8043. var r = new pu(null, null),
  8044. i = r,
  8045. o = t,
  8046. s = e;
  8047. for (; null !== o && null !== s;) n(o.key, s.key) < 0 ? (i.next = o, o = o.next) : (i.next = s, s = s.next), i = i.next;
  8048. null !== o ? i.next = o : null !== s && (i.next = s);
  8049. return r.next
  8050. }(this.toList(), function (t, e) {
  8051. for (var n = new pu(null, null), r = n, i = 0; i < t.length; i++) r = r.next = new pu(t[i], e[i]);
  8052. return r.next = null, n.next
  8053. }(t, e), i);
  8054. r = this._size + r, this._root = xu({
  8055. head: o
  8056. }, 0, r)
  8057. }
  8058. return this
  8059. }, t.prototype.isEmpty = function () {
  8060. return null === this._root
  8061. }, Object.defineProperty(t.prototype, "size", {
  8062. get: function () {
  8063. return this._size
  8064. },
  8065. enumerable: !0,
  8066. configurable: !0
  8067. }), Object.defineProperty(t.prototype, "root", {
  8068. get: function () {
  8069. return this._root
  8070. },
  8071. enumerable: !0,
  8072. configurable: !0
  8073. }), t.prototype.toString = function (t) {
  8074. void 0 === t && (t = function (t) {
  8075. return String(t.key)
  8076. });
  8077. var e = [];
  8078. return vu(this._root, "", !0, (function (t) {
  8079. return e.push(t)
  8080. }), t), e.join("")
  8081. }, t.prototype.update = function (t, e, n) {
  8082. var r = this._comparator,
  8083. i = yu(t, this._root, r),
  8084. o = i.left,
  8085. s = i.right;
  8086. r(t, e) < 0 ? s = du(e, n, s, r) : o = du(e, n, o, r), this._root = function (t, e, n) {
  8087. return null === e ? t : (null === t || ((e = gu(t.key, e, n)).left = t), e)
  8088. }(o, s, r)
  8089. }, t.prototype.split = function (t) {
  8090. return yu(t, this._root, this._comparator)
  8091. }, t
  8092. }();
  8093. function mu(t, e, n, r) {
  8094. var i = r - n;
  8095. if (i > 0) {
  8096. var o = n + Math.floor(i / 2),
  8097. s = t[o],
  8098. a = e[o],
  8099. u = new pu(s, a);
  8100. return u.left = mu(t, e, n, o), u.right = mu(t, e, o + 1, r), u
  8101. }
  8102. return null
  8103. }
  8104. function xu(t, e, n) {
  8105. var r = n - e;
  8106. if (r > 0) {
  8107. var i = e + Math.floor(r / 2),
  8108. o = xu(t, e, i),
  8109. s = t.head;
  8110. return s.left = o, t.head = t.head.next, s.right = xu(t, i + 1, n), s
  8111. }
  8112. return null
  8113. }
  8114. function Eu(t, e, n, r, i) {
  8115. if (!(n >= r)) {
  8116. for (var o = t[n + r >> 1], s = n - 1, a = r + 1;;) {
  8117. do {
  8118. s++
  8119. } while (i(t[s], o) < 0);
  8120. do {
  8121. a--
  8122. } while (i(t[a], o) > 0);
  8123. if (s >= a) break;
  8124. var u = t[s];
  8125. t[s] = t[a], t[a] = u, u = e[s], e[s] = e[a], e[a] = u
  8126. }
  8127. Eu(t, e, n, a, i), Eu(t, e, a + 1, r, i)
  8128. }
  8129. }
  8130. function bu(t, e) {
  8131. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  8132. }
  8133. function wu(t, e) {
  8134. for (var n = 0; n < e.length; n++) {
  8135. var r = e[n];
  8136. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r)
  8137. }
  8138. }
  8139. function Iu(t, e, n) {
  8140. return e && wu(t.prototype, e), n && wu(t, n), t
  8141. }
  8142. var Nu = function (t, e) {
  8143. return t.ll.x <= e.x && e.x <= t.ur.x && t.ll.y <= e.y && e.y <= t.ur.y
  8144. },
  8145. Su = function (t, e) {
  8146. if (e.ur.x < t.ll.x || t.ur.x < e.ll.x || e.ur.y < t.ll.y || t.ur.y < e.ll.y) return null;
  8147. var n = t.ll.x < e.ll.x ? e.ll.x : t.ll.x,
  8148. r = t.ur.x < e.ur.x ? t.ur.x : e.ur.x;
  8149. return {
  8150. ll: {
  8151. x: n,
  8152. y: t.ll.y < e.ll.y ? e.ll.y : t.ll.y
  8153. },
  8154. ur: {
  8155. x: r,
  8156. y: t.ur.y < e.ur.y ? t.ur.y : e.ur.y
  8157. }
  8158. }
  8159. },
  8160. Cu = Number.EPSILON;
  8161. void 0 === Cu && (Cu = Math.pow(2, -52));
  8162. var Pu = Cu * Cu,
  8163. Mu = function (t, e) {
  8164. if (-Cu < t && t < Cu && -Cu < e && e < Cu) return 0;
  8165. var n = t - e;
  8166. return n * n < Pu * t * e ? 0 : t < e ? -1 : 1
  8167. },
  8168. Lu = function () {
  8169. function t() {
  8170. bu(this, t), this.reset()
  8171. }
  8172. return Iu(t, [{
  8173. key: "reset",
  8174. value: function () {
  8175. this.xRounder = new Ou, this.yRounder = new Ou
  8176. }
  8177. }, {
  8178. key: "round",
  8179. value: function (t, e) {
  8180. return {
  8181. x: this.xRounder.round(t),
  8182. y: this.yRounder.round(e)
  8183. }
  8184. }
  8185. }]), t
  8186. }(),
  8187. Ou = function () {
  8188. function t() {
  8189. bu(this, t), this.tree = new _u, this.round(0)
  8190. }
  8191. return Iu(t, [{
  8192. key: "round",
  8193. value: function (t) {
  8194. var e = this.tree.add(t),
  8195. n = this.tree.prev(e);
  8196. if (null !== n && 0 === Mu(e.key, n.key)) return this.tree.remove(t), n.key;
  8197. var r = this.tree.next(e);
  8198. return null !== r && 0 === Mu(e.key, r.key) ? (this.tree.remove(t), r.key) : t
  8199. }
  8200. }]), t
  8201. }(),
  8202. Ru = new Lu,
  8203. Tu = function (t, e) {
  8204. return t.x * e.y - t.y * e.x
  8205. },
  8206. Au = function (t, e) {
  8207. return t.x * e.x + t.y * e.y
  8208. },
  8209. Du = function (t, e, n) {
  8210. var r = {
  8211. x: e.x - t.x,
  8212. y: e.y - t.y
  8213. },
  8214. i = {
  8215. x: n.x - t.x,
  8216. y: n.y - t.y
  8217. },
  8218. o = Tu(r, i);
  8219. return Mu(o, 0)
  8220. },
  8221. Fu = function (t) {
  8222. return Math.sqrt(Au(t, t))
  8223. },
  8224. ku = function (t, e, n) {
  8225. var r = {
  8226. x: e.x - t.x,
  8227. y: e.y - t.y
  8228. },
  8229. i = {
  8230. x: n.x - t.x,
  8231. y: n.y - t.y
  8232. };
  8233. return Au(i, r) / Fu(i) / Fu(r)
  8234. },
  8235. Gu = function (t, e, n) {
  8236. return 0 === e.y ? null : {
  8237. x: t.x + e.x / e.y * (n - t.y),
  8238. y: n
  8239. }
  8240. },
  8241. qu = function (t, e, n) {
  8242. return 0 === e.x ? null : {
  8243. x: n,
  8244. y: t.y + e.y / e.x * (n - t.x)
  8245. }
  8246. },
  8247. Bu = function () {
  8248. function t(e, n) {
  8249. bu(this, t), void 0 === e.events ? e.events = [this] : e.events.push(this), this.point = e, this.isLeft = n
  8250. }
  8251. return Iu(t, null, [{
  8252. key: "compare",
  8253. value: function (e, n) {
  8254. var r = t.comparePoints(e.point, n.point);
  8255. return 0 !== r ? r : (e.point !== n.point && e.link(n), e.isLeft !== n.isLeft ? e.isLeft ? 1 : -1 : ju.compare(e.segment, n.segment))
  8256. }
  8257. }, {
  8258. key: "comparePoints",
  8259. value: function (t, e) {
  8260. return t.x < e.x ? -1 : t.x > e.x ? 1 : t.y < e.y ? -1 : t.y > e.y ? 1 : 0
  8261. }
  8262. }]), Iu(t, [{
  8263. key: "link",
  8264. value: function (t) {
  8265. if (t.point === this.point) throw new Error("Tried to link already linked events");
  8266. for (var e = t.point.events, n = 0, r = e.length; n < r; n++) {
  8267. var i = e[n];
  8268. this.point.events.push(i), i.point = this.point
  8269. }
  8270. this.checkForConsuming()
  8271. }
  8272. }, {
  8273. key: "checkForConsuming",
  8274. value: function () {
  8275. for (var t = this.point.events.length, e = 0; e < t; e++) {
  8276. var n = this.point.events[e];
  8277. if (void 0 === n.segment.consumedBy)
  8278. for (var r = e + 1; r < t; r++) {
  8279. var i = this.point.events[r];
  8280. void 0 === i.consumedBy && (n.otherSE.point.events === i.otherSE.point.events && n.segment.consume(i.segment))
  8281. }
  8282. }
  8283. }
  8284. }, {
  8285. key: "getAvailableLinkedEvents",
  8286. value: function () {
  8287. for (var t = [], e = 0, n = this.point.events.length; e < n; e++) {
  8288. var r = this.point.events[e];
  8289. r !== this && !r.segment.ringOut && r.segment.isInResult() && t.push(r)
  8290. }
  8291. return t
  8292. }
  8293. }, {
  8294. key: "getLeftmostComparator",
  8295. value: function (t) {
  8296. var e = this,
  8297. n = new Map,
  8298. r = function (r) {
  8299. var i, o, s, a, u, l = r.otherSE;
  8300. n.set(r, {
  8301. sine: (i = e.point, o = t.point, s = l.point, a = {
  8302. x: o.x - i.x,
  8303. y: o.y - i.y
  8304. }, u = {
  8305. x: s.x - i.x,
  8306. y: s.y - i.y
  8307. }, Tu(u, a) / Fu(u) / Fu(a)),
  8308. cosine: ku(e.point, t.point, l.point)
  8309. })
  8310. };
  8311. return function (t, e) {
  8312. n.has(t) || r(t), n.has(e) || r(e);
  8313. var i = n.get(t),
  8314. o = i.sine,
  8315. s = i.cosine,
  8316. a = n.get(e),
  8317. u = a.sine,
  8318. l = a.cosine;
  8319. return o >= 0 && u >= 0 ? s < l ? 1 : s > l ? -1 : 0 : o < 0 && u < 0 ? s < l ? -1 : s > l ? 1 : 0 : u < o ? -1 : u > o ? 1 : 0
  8320. }
  8321. }
  8322. }]), t
  8323. }(),
  8324. zu = 0,
  8325. ju = function () {
  8326. function t(e, n, r, i) {
  8327. bu(this, t), this.id = ++zu, this.leftSE = e, e.segment = this, e.otherSE = n, this.rightSE = n, n.segment = this, n.otherSE = e, this.rings = r, this.windings = i
  8328. }
  8329. return Iu(t, null, [{
  8330. key: "compare",
  8331. value: function (t, e) {
  8332. var n = t.leftSE.point.x,
  8333. r = e.leftSE.point.x,
  8334. i = t.rightSE.point.x,
  8335. o = e.rightSE.point.x;
  8336. if (o < n) return 1;
  8337. if (i < r) return -1;
  8338. var s = t.leftSE.point.y,
  8339. a = e.leftSE.point.y,
  8340. u = t.rightSE.point.y,
  8341. l = e.rightSE.point.y;
  8342. if (n < r) {
  8343. if (a < s && a < u) return 1;
  8344. if (a > s && a > u) return -1;
  8345. var c = t.comparePoint(e.leftSE.point);
  8346. if (c < 0) return 1;
  8347. if (c > 0) return -1;
  8348. var h = e.comparePoint(t.rightSE.point);
  8349. return 0 !== h ? h : -1
  8350. }
  8351. if (n > r) {
  8352. if (s < a && s < l) return -1;
  8353. if (s > a && s > l) return 1;
  8354. var p = e.comparePoint(t.leftSE.point);
  8355. if (0 !== p) return p;
  8356. var f = t.comparePoint(e.rightSE.point);
  8357. return f < 0 ? 1 : f > 0 ? -1 : 1
  8358. }
  8359. if (s < a) return -1;
  8360. if (s > a) return 1;
  8361. if (i < o) {
  8362. var g = e.comparePoint(t.rightSE.point);
  8363. if (0 !== g) return g
  8364. }
  8365. if (i > o) {
  8366. var d = t.comparePoint(e.rightSE.point);
  8367. if (d < 0) return 1;
  8368. if (d > 0) return -1
  8369. }
  8370. if (i !== o) {
  8371. var y = u - s,
  8372. v = i - n,
  8373. _ = l - a,
  8374. m = o - r;
  8375. if (y > v && _ < m) return 1;
  8376. if (y < v && _ > m) return -1
  8377. }
  8378. return i > o ? 1 : i < o || u < l ? -1 : u > l ? 1 : t.id < e.id ? -1 : t.id > e.id ? 1 : 0
  8379. }
  8380. }]), Iu(t, [{
  8381. key: "replaceRightSE",
  8382. value: function (t) {
  8383. this.rightSE = t, this.rightSE.segment = this, this.rightSE.otherSE = this.leftSE, this.leftSE.otherSE = this.rightSE
  8384. }
  8385. }, {
  8386. key: "bbox",
  8387. value: function () {
  8388. var t = this.leftSE.point.y,
  8389. e = this.rightSE.point.y;
  8390. return {
  8391. ll: {
  8392. x: this.leftSE.point.x,
  8393. y: t < e ? t : e
  8394. },
  8395. ur: {
  8396. x: this.rightSE.point.x,
  8397. y: t > e ? t : e
  8398. }
  8399. }
  8400. }
  8401. }, {
  8402. key: "vector",
  8403. value: function () {
  8404. return {
  8405. x: this.rightSE.point.x - this.leftSE.point.x,
  8406. y: this.rightSE.point.y - this.leftSE.point.y
  8407. }
  8408. }
  8409. }, {
  8410. key: "isAnEndpoint",
  8411. value: function (t) {
  8412. return t.x === this.leftSE.point.x && t.y === this.leftSE.point.y || t.x === this.rightSE.point.x && t.y === this.rightSE.point.y
  8413. }
  8414. }, {
  8415. key: "comparePoint",
  8416. value: function (t) {
  8417. if (this.isAnEndpoint(t)) return 0;
  8418. var e = this.leftSE.point,
  8419. n = this.rightSE.point,
  8420. r = this.vector();
  8421. if (e.x === n.x) return t.x === e.x ? 0 : t.x < e.x ? 1 : -1;
  8422. var i = (t.y - e.y) / r.y,
  8423. o = e.x + i * r.x;
  8424. if (t.x === o) return 0;
  8425. var s = (t.x - e.x) / r.x,
  8426. a = e.y + s * r.y;
  8427. return t.y === a ? 0 : t.y < a ? -1 : 1
  8428. }
  8429. }, {
  8430. key: "getIntersection",
  8431. value: function (t) {
  8432. var e = this.bbox(),
  8433. n = t.bbox(),
  8434. r = Su(e, n);
  8435. if (null === r) return null;
  8436. var i = this.leftSE.point,
  8437. o = this.rightSE.point,
  8438. s = t.leftSE.point,
  8439. a = t.rightSE.point,
  8440. u = Nu(e, s) && 0 === this.comparePoint(s),
  8441. l = Nu(n, i) && 0 === t.comparePoint(i),
  8442. c = Nu(e, a) && 0 === this.comparePoint(a),
  8443. h = Nu(n, o) && 0 === t.comparePoint(o);
  8444. if (l && u) return h && !c ? o : !h && c ? a : null;
  8445. if (l) return c && i.x === a.x && i.y === a.y ? null : i;
  8446. if (u) return h && o.x === s.x && o.y === s.y ? null : s;
  8447. if (h && c) return null;
  8448. if (h) return o;
  8449. if (c) return a;
  8450. var p = function (t, e, n, r) {
  8451. if (0 === e.x) return qu(n, r, t.x);
  8452. if (0 === r.x) return qu(t, e, n.x);
  8453. if (0 === e.y) return Gu(n, r, t.y);
  8454. if (0 === r.y) return Gu(t, e, n.y);
  8455. var i = Tu(e, r);
  8456. if (0 == i) return null;
  8457. var o = {
  8458. x: n.x - t.x,
  8459. y: n.y - t.y
  8460. },
  8461. s = Tu(o, e) / i,
  8462. a = Tu(o, r) / i;
  8463. return {
  8464. x: (t.x + a * e.x + (n.x + s * r.x)) / 2,
  8465. y: (t.y + a * e.y + (n.y + s * r.y)) / 2
  8466. }
  8467. }(i, this.vector(), s, t.vector());
  8468. return null === p ? null : Nu(r, p) ? Ru.round(p.x, p.y) : null
  8469. }
  8470. }, {
  8471. key: "split",
  8472. value: function (e) {
  8473. var n = [],
  8474. r = void 0 !== e.events,
  8475. i = new Bu(e, !0),
  8476. o = new Bu(e, !1),
  8477. s = this.rightSE;
  8478. this.replaceRightSE(o), n.push(o), n.push(i);
  8479. var a = new t(i, s, this.rings.slice(), this.windings.slice());
  8480. return Bu.comparePoints(a.leftSE.point, a.rightSE.point) > 0 && a.swapEvents(), Bu.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), r && (i.checkForConsuming(), o.checkForConsuming()), n
  8481. }
  8482. }, {
  8483. key: "swapEvents",
  8484. value: function () {
  8485. var t = this.rightSE;
  8486. this.rightSE = this.leftSE, this.leftSE = t, this.leftSE.isLeft = !0, this.rightSE.isLeft = !1;
  8487. for (var e = 0, n = this.windings.length; e < n; e++) this.windings[e] *= -1
  8488. }
  8489. }, {
  8490. key: "consume",
  8491. value: function (e) {
  8492. for (var n = this, r = e; n.consumedBy;) n = n.consumedBy;
  8493. for (; r.consumedBy;) r = r.consumedBy;
  8494. var i = t.compare(n, r);
  8495. if (0 !== i) {
  8496. if (i > 0) {
  8497. var o = n;
  8498. n = r, r = o
  8499. }
  8500. if (n.prev === r) {
  8501. var s = n;
  8502. n = r, r = s
  8503. }
  8504. for (var a = 0, u = r.rings.length; a < u; a++) {
  8505. var l = r.rings[a],
  8506. c = r.windings[a],
  8507. h = n.rings.indexOf(l); - 1 === h ? (n.rings.push(l), n.windings.push(c)) : n.windings[h] += c
  8508. }
  8509. r.rings = null, r.windings = null, r.consumedBy = n, r.leftSE.consumedBy = n.leftSE, r.rightSE.consumedBy = n.rightSE
  8510. }
  8511. }
  8512. }, {
  8513. key: "prevInResult",
  8514. value: function () {
  8515. return void 0 !== this._prevInResult || (this.prev ? this.prev.isInResult() ? this._prevInResult = this.prev : this._prevInResult = this.prev.prevInResult() : this._prevInResult = null), this._prevInResult
  8516. }
  8517. }, {
  8518. key: "beforeState",
  8519. value: function () {
  8520. if (void 0 !== this._beforeState) return this._beforeState;
  8521. if (this.prev) {
  8522. var t = this.prev.consumedBy || this.prev;
  8523. this._beforeState = t.afterState()
  8524. } else this._beforeState = {
  8525. rings: [],
  8526. windings: [],
  8527. multiPolys: []
  8528. };
  8529. return this._beforeState
  8530. }
  8531. }, {
  8532. key: "afterState",
  8533. value: function () {
  8534. if (void 0 !== this._afterState) return this._afterState;
  8535. var t = this.beforeState();
  8536. this._afterState = {
  8537. rings: t.rings.slice(0),
  8538. windings: t.windings.slice(0),
  8539. multiPolys: []
  8540. };
  8541. for (var e = this._afterState.rings, n = this._afterState.windings, r = this._afterState.multiPolys, i = 0, o = this.rings.length; i < o; i++) {
  8542. var s = this.rings[i],
  8543. a = this.windings[i],
  8544. u = e.indexOf(s); - 1 === u ? (e.push(s), n.push(a)) : n[u] += a
  8545. }
  8546. for (var l = [], c = [], h = 0, p = e.length; h < p; h++)
  8547. if (0 !== n[h]) {
  8548. var f = e[h],
  8549. g = f.poly;
  8550. if (-1 === c.indexOf(g))
  8551. if (f.isExterior) l.push(g);
  8552. else {
  8553. -1 === c.indexOf(g) && c.push(g);
  8554. var d = l.indexOf(f.poly); - 1 !== d && l.splice(d, 1)
  8555. }
  8556. } for (var y = 0, v = l.length; y < v; y++) {
  8557. var _ = l[y].multiPoly; - 1 === r.indexOf(_) && r.push(_)
  8558. }
  8559. return this._afterState
  8560. }
  8561. }, {
  8562. key: "isInResult",
  8563. value: function () {
  8564. if (this.consumedBy) return !1;
  8565. if (void 0 !== this._isInResult) return this._isInResult;
  8566. var t = this.beforeState().multiPolys,
  8567. e = this.afterState().multiPolys;
  8568. switch (Qu.type) {
  8569. case "union":
  8570. var n = 0 === t.length,
  8571. r = 0 === e.length;
  8572. this._isInResult = n !== r;
  8573. break;
  8574. case "intersection":
  8575. var i, o;
  8576. t.length < e.length ? (i = t.length, o = e.length) : (i = e.length, o = t.length), this._isInResult = o === Qu.numMultiPolys && i < o;
  8577. break;
  8578. case "xor":
  8579. var s = Math.abs(t.length - e.length);
  8580. this._isInResult = s % 2 == 1;
  8581. break;
  8582. case "difference":
  8583. var a = function (t) {
  8584. return 1 === t.length && t[0].isSubject
  8585. };
  8586. this._isInResult = a(t) !== a(e);
  8587. break;
  8588. default:
  8589. throw new Error("Unrecognized operation type found ".concat(Qu.type))
  8590. }
  8591. return this._isInResult
  8592. }
  8593. }], [{
  8594. key: "fromRing",
  8595. value: function (e, n, r) {
  8596. var i, o, s, a = Bu.comparePoints(e, n);
  8597. if (a < 0) i = e, o = n, s = 1;
  8598. else {
  8599. if (!(a > 0)) throw new Error("Tried to create degenerate segment at [".concat(e.x, ", ").concat(e.y, "]"));
  8600. i = n, o = e, s = -1
  8601. }
  8602. return new t(new Bu(i, !0), new Bu(o, !1), [r], [s])
  8603. }
  8604. }]), t
  8605. }(),
  8606. Uu = function () {
  8607. function t(e, n, r) {
  8608. if (bu(this, t), !Array.isArray(e) || 0 === e.length) throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
  8609. if (this.poly = n, this.isExterior = r, this.segments = [], "number" != typeof e[0][0] || "number" != typeof e[0][1]) throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
  8610. var i = Ru.round(e[0][0], e[0][1]);
  8611. this.bbox = {
  8612. ll: {
  8613. x: i.x,
  8614. y: i.y
  8615. },
  8616. ur: {
  8617. x: i.x,
  8618. y: i.y
  8619. }
  8620. };
  8621. for (var o = i, s = 1, a = e.length; s < a; s++) {
  8622. if ("number" != typeof e[s][0] || "number" != typeof e[s][1]) throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
  8623. var u = Ru.round(e[s][0], e[s][1]);
  8624. u.x === o.x && u.y === o.y || (this.segments.push(ju.fromRing(o, u, this)), u.x < this.bbox.ll.x && (this.bbox.ll.x = u.x), u.y < this.bbox.ll.y && (this.bbox.ll.y = u.y), u.x > this.bbox.ur.x && (this.bbox.ur.x = u.x), u.y > this.bbox.ur.y && (this.bbox.ur.y = u.y), o = u)
  8625. }
  8626. i.x === o.x && i.y === o.y || this.segments.push(ju.fromRing(o, i, this))
  8627. }
  8628. return Iu(t, [{
  8629. key: "getSweepEvents",
  8630. value: function () {
  8631. for (var t = [], e = 0, n = this.segments.length; e < n; e++) {
  8632. var r = this.segments[e];
  8633. t.push(r.leftSE), t.push(r.rightSE)
  8634. }
  8635. return t
  8636. }
  8637. }]), t
  8638. }(),
  8639. Vu = function () {
  8640. function t(e, n) {
  8641. if (bu(this, t), !Array.isArray(e)) throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
  8642. this.exteriorRing = new Uu(e[0], this, !0), this.bbox = {
  8643. ll: {
  8644. x: this.exteriorRing.bbox.ll.x,
  8645. y: this.exteriorRing.bbox.ll.y
  8646. },
  8647. ur: {
  8648. x: this.exteriorRing.bbox.ur.x,
  8649. y: this.exteriorRing.bbox.ur.y
  8650. }
  8651. }, this.interiorRings = [];
  8652. for (var r = 1, i = e.length; r < i; r++) {
  8653. var o = new Uu(e[r], this, !1);
  8654. o.bbox.ll.x < this.bbox.ll.x && (this.bbox.ll.x = o.bbox.ll.x), o.bbox.ll.y < this.bbox.ll.y && (this.bbox.ll.y = o.bbox.ll.y), o.bbox.ur.x > this.bbox.ur.x && (this.bbox.ur.x = o.bbox.ur.x), o.bbox.ur.y > this.bbox.ur.y && (this.bbox.ur.y = o.bbox.ur.y), this.interiorRings.push(o)
  8655. }
  8656. this.multiPoly = n
  8657. }
  8658. return Iu(t, [{
  8659. key: "getSweepEvents",
  8660. value: function () {
  8661. for (var t = this.exteriorRing.getSweepEvents(), e = 0, n = this.interiorRings.length; e < n; e++)
  8662. for (var r = this.interiorRings[e].getSweepEvents(), i = 0, o = r.length; i < o; i++) t.push(r[i]);
  8663. return t
  8664. }
  8665. }]), t
  8666. }(),
  8667. Xu = function () {
  8668. function t(e, n) {
  8669. if (bu(this, t), !Array.isArray(e)) throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
  8670. try {
  8671. "number" == typeof e[0][0][0] && (e = [e])
  8672. } catch (t) {}
  8673. this.polys = [], this.bbox = {
  8674. ll: {
  8675. x: Number.POSITIVE_INFINITY,
  8676. y: Number.POSITIVE_INFINITY
  8677. },
  8678. ur: {
  8679. x: Number.NEGATIVE_INFINITY,
  8680. y: Number.NEGATIVE_INFINITY
  8681. }
  8682. };
  8683. for (var r = 0, i = e.length; r < i; r++) {
  8684. var o = new Vu(e[r], this);
  8685. o.bbox.ll.x < this.bbox.ll.x && (this.bbox.ll.x = o.bbox.ll.x), o.bbox.ll.y < this.bbox.ll.y && (this.bbox.ll.y = o.bbox.ll.y), o.bbox.ur.x > this.bbox.ur.x && (this.bbox.ur.x = o.bbox.ur.x), o.bbox.ur.y > this.bbox.ur.y && (this.bbox.ur.y = o.bbox.ur.y), this.polys.push(o)
  8686. }
  8687. this.isSubject = n
  8688. }
  8689. return Iu(t, [{
  8690. key: "getSweepEvents",
  8691. value: function () {
  8692. for (var t = [], e = 0, n = this.polys.length; e < n; e++)
  8693. for (var r = this.polys[e].getSweepEvents(), i = 0, o = r.length; i < o; i++) t.push(r[i]);
  8694. return t
  8695. }
  8696. }]), t
  8697. }(),
  8698. Yu = function () {
  8699. function t(e) {
  8700. bu(this, t), this.events = e;
  8701. for (var n = 0, r = e.length; n < r; n++) e[n].segment.ringOut = this;
  8702. this.poly = null
  8703. }
  8704. return Iu(t, null, [{
  8705. key: "factory",
  8706. value: function (e) {
  8707. for (var n = [], r = 0, i = e.length; r < i; r++) {
  8708. var o = e[r];
  8709. if (o.isInResult() && !o.ringOut) {
  8710. for (var s = null, a = o.leftSE, u = o.rightSE, l = [a], c = a.point, h = []; s = a, a = u, l.push(a), a.point !== c;)
  8711. for (;;) {
  8712. var p = a.getAvailableLinkedEvents();
  8713. if (0 === p.length) {
  8714. var f = l[0].point,
  8715. g = l[l.length - 1].point;
  8716. throw new Error("Unable to complete output ring starting at [".concat(f.x, ",") + " ".concat(f.y, "]. Last matching segment found ends at") + " [".concat(g.x, ", ").concat(g.y, "]."))
  8717. }
  8718. if (1 === p.length) {
  8719. u = p[0].otherSE;
  8720. break
  8721. }
  8722. for (var d = null, y = 0, v = h.length; y < v; y++)
  8723. if (h[y].point === a.point) {
  8724. d = y;
  8725. break
  8726. } if (null === d) {
  8727. h.push({
  8728. index: l.length,
  8729. point: a.point
  8730. });
  8731. var _ = a.getLeftmostComparator(s);
  8732. u = p.sort(_)[0].otherSE;
  8733. break
  8734. }
  8735. var m = h.splice(d)[0],
  8736. x = l.splice(m.index);
  8737. x.unshift(x[0].otherSE), n.push(new t(x.reverse()))
  8738. }
  8739. n.push(new t(l))
  8740. }
  8741. }
  8742. return n
  8743. }
  8744. }]), Iu(t, [{
  8745. key: "getGeom",
  8746. value: function () {
  8747. for (var t = this.events[0].point, e = [t], n = 1, r = this.events.length - 1; n < r; n++) {
  8748. var i = this.events[n].point,
  8749. o = this.events[n + 1].point;
  8750. 0 !== Du(i, t, o) && (e.push(i), t = i)
  8751. }
  8752. if (1 === e.length) return null;
  8753. var s = e[0],
  8754. a = e[1];
  8755. 0 === Du(s, t, a) && e.shift(), e.push(e[0]);
  8756. for (var u = this.isExteriorRing() ? 1 : -1, l = this.isExteriorRing() ? 0 : e.length - 1, c = this.isExteriorRing() ? e.length : -1, h = [], p = l; p != c; p += u) h.push([e[p].x, e[p].y]);
  8757. return h
  8758. }
  8759. }, {
  8760. key: "isExteriorRing",
  8761. value: function () {
  8762. if (void 0 === this._isExteriorRing) {
  8763. var t = this.enclosingRing();
  8764. this._isExteriorRing = !t || !t.isExteriorRing()
  8765. }
  8766. return this._isExteriorRing
  8767. }
  8768. }, {
  8769. key: "enclosingRing",
  8770. value: function () {
  8771. return void 0 === this._enclosingRing && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing
  8772. }
  8773. }, {
  8774. key: "_calcEnclosingRing",
  8775. value: function () {
  8776. for (var t = this.events[0], e = 1, n = this.events.length; e < n; e++) {
  8777. var r = this.events[e];
  8778. Bu.compare(t, r) > 0 && (t = r)
  8779. }
  8780. for (var i = t.segment.prevInResult(), o = i ? i.prevInResult() : null;;) {
  8781. if (!i) return null;
  8782. if (!o) return i.ringOut;
  8783. if (o.ringOut !== i.ringOut) return o.ringOut.enclosingRing() !== i.ringOut ? i.ringOut : i.ringOut.enclosingRing();
  8784. i = o.prevInResult(), o = i ? i.prevInResult() : null
  8785. }
  8786. }
  8787. }]), t
  8788. }(),
  8789. Hu = function () {
  8790. function t(e) {
  8791. bu(this, t), this.exteriorRing = e, e.poly = this, this.interiorRings = []
  8792. }
  8793. return Iu(t, [{
  8794. key: "addInterior",
  8795. value: function (t) {
  8796. this.interiorRings.push(t), t.poly = this
  8797. }
  8798. }, {
  8799. key: "getGeom",
  8800. value: function () {
  8801. var t = [this.exteriorRing.getGeom()];
  8802. if (null === t[0]) return null;
  8803. for (var e = 0, n = this.interiorRings.length; e < n; e++) {
  8804. var r = this.interiorRings[e].getGeom();
  8805. null !== r && t.push(r)
  8806. }
  8807. return t
  8808. }
  8809. }]), t
  8810. }(),
  8811. Wu = function () {
  8812. function t(e) {
  8813. bu(this, t), this.rings = e, this.polys = this._composePolys(e)
  8814. }
  8815. return Iu(t, [{
  8816. key: "getGeom",
  8817. value: function () {
  8818. for (var t = [], e = 0, n = this.polys.length; e < n; e++) {
  8819. var r = this.polys[e].getGeom();
  8820. null !== r && t.push(r)
  8821. }
  8822. return t
  8823. }
  8824. }, {
  8825. key: "_composePolys",
  8826. value: function (t) {
  8827. for (var e = [], n = 0, r = t.length; n < r; n++) {
  8828. var i = t[n];
  8829. if (!i.poly)
  8830. if (i.isExteriorRing()) e.push(new Hu(i));
  8831. else {
  8832. var o = i.enclosingRing();
  8833. o.poly || e.push(new Hu(o)), o.poly.addInterior(i)
  8834. }
  8835. }
  8836. return e
  8837. }
  8838. }]), t
  8839. }(),
  8840. Ju = function () {
  8841. function t(e) {
  8842. var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ju.compare;
  8843. bu(this, t), this.queue = e, this.tree = new _u(n), this.segments = []
  8844. }
  8845. return Iu(t, [{
  8846. key: "process",
  8847. value: function (t) {
  8848. var e = t.segment,
  8849. n = [];
  8850. if (t.consumedBy) return t.isLeft ? this.queue.remove(t.otherSE) : this.tree.remove(e), n;
  8851. var r = t.isLeft ? this.tree.insert(e) : this.tree.find(e);
  8852. if (!r) throw new Error("Unable to find segment #".concat(e.id, " ") + "[".concat(e.leftSE.point.x, ", ").concat(e.leftSE.point.y, "] -> ") + "[".concat(e.rightSE.point.x, ", ").concat(e.rightSE.point.y, "] ") + "in SweepLine tree. Please submit a bug report.");
  8853. for (var i = r, o = r, s = void 0, a = void 0; void 0 === s;) null === (i = this.tree.prev(i)) ? s = null : void 0 === i.key.consumedBy && (s = i.key);
  8854. for (; void 0 === a;) null === (o = this.tree.next(o)) ? a = null : void 0 === o.key.consumedBy && (a = o.key);
  8855. if (t.isLeft) {
  8856. var u = null;
  8857. if (s) {
  8858. var l = s.getIntersection(e);
  8859. if (null !== l && (e.isAnEndpoint(l) || (u = l), !s.isAnEndpoint(l)))
  8860. for (var c = this._splitSafely(s, l), h = 0, p = c.length; h < p; h++) n.push(c[h])
  8861. }
  8862. var f = null;
  8863. if (a) {
  8864. var g = a.getIntersection(e);
  8865. if (null !== g && (e.isAnEndpoint(g) || (f = g), !a.isAnEndpoint(g)))
  8866. for (var d = this._splitSafely(a, g), y = 0, v = d.length; y < v; y++) n.push(d[y])
  8867. }
  8868. if (null !== u || null !== f) {
  8869. var _ = null;
  8870. if (null === u) _ = f;
  8871. else if (null === f) _ = u;
  8872. else {
  8873. _ = Bu.comparePoints(u, f) <= 0 ? u : f
  8874. }
  8875. this.queue.remove(e.rightSE), n.push(e.rightSE);
  8876. for (var m = e.split(_), x = 0, E = m.length; x < E; x++) n.push(m[x])
  8877. }
  8878. n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev = s)
  8879. } else {
  8880. if (s && a) {
  8881. var b = s.getIntersection(a);
  8882. if (null !== b) {
  8883. if (!s.isAnEndpoint(b))
  8884. for (var w = this._splitSafely(s, b), I = 0, N = w.length; I < N; I++) n.push(w[I]);
  8885. if (!a.isAnEndpoint(b))
  8886. for (var S = this._splitSafely(a, b), C = 0, P = S.length; C < P; C++) n.push(S[C])
  8887. }
  8888. }
  8889. this.tree.remove(e)
  8890. }
  8891. return n
  8892. }
  8893. }, {
  8894. key: "_splitSafely",
  8895. value: function (t, e) {
  8896. this.tree.remove(t);
  8897. var n = t.rightSE;
  8898. this.queue.remove(n);
  8899. var r = t.split(e);
  8900. return r.push(n), void 0 === t.consumedBy && this.tree.insert(t), r
  8901. }
  8902. }]), t
  8903. }(),
  8904. Zu = "undefined" != typeof process && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6,
  8905. Ku = "undefined" != typeof process && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6,
  8906. Qu = new(function () {
  8907. function t() {
  8908. bu(this, t)
  8909. }
  8910. return Iu(t, [{
  8911. key: "run",
  8912. value: function (t, e, n) {
  8913. Qu.type = t, Ru.reset();
  8914. for (var r = [new Xu(e, !0)], i = 0, o = n.length; i < o; i++) r.push(new Xu(n[i], !1));
  8915. if (Qu.numMultiPolys = r.length, "difference" === Qu.type)
  8916. for (var s = r[0], a = 1; a < r.length;) null !== Su(r[a].bbox, s.bbox) ? a++ : r.splice(a, 1);
  8917. if ("intersection" === Qu.type)
  8918. for (var u = 0, l = r.length; u < l; u++)
  8919. for (var c = r[u], h = u + 1, p = r.length; h < p; h++)
  8920. if (null === Su(c.bbox, r[h].bbox)) return [];
  8921. for (var f = new _u(Bu.compare), g = 0, d = r.length; g < d; g++)
  8922. for (var y = r[g].getSweepEvents(), v = 0, _ = y.length; v < _; v++)
  8923. if (f.insert(y[v]), f.size > Zu) throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");
  8924. for (var m = new Ju(f), x = f.size, E = f.pop(); E;) {
  8925. var b = E.key;
  8926. if (f.size === x) {
  8927. var w = b.segment;
  8928. throw new Error("Unable to pop() ".concat(b.isLeft ? "left" : "right", " SweepEvent ") + "[".concat(b.point.x, ", ").concat(b.point.y, "] from segment #").concat(w.id, " ") + "[".concat(w.leftSE.point.x, ", ").concat(w.leftSE.point.y, "] -> ") + "[".concat(w.rightSE.point.x, ", ").concat(w.rightSE.point.y, "] from queue. ") + "Please file a bug report.")
  8929. }
  8930. if (f.size > Zu) throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");
  8931. if (m.segments.length > Ku) throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");
  8932. for (var I = m.process(b), N = 0, S = I.length; N < S; N++) {
  8933. var C = I[N];
  8934. void 0 === C.consumedBy && f.insert(C)
  8935. }
  8936. x = f.size, E = f.pop()
  8937. }
  8938. Ru.reset();
  8939. var P = Yu.factory(m.segments);
  8940. return new Wu(P).getGeom()
  8941. }
  8942. }]), t
  8943. }()),
  8944. $u = {
  8945. union: function (t) {
  8946. for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r];
  8947. return Qu.run("union", t, n)
  8948. },
  8949. intersection: function (t) {
  8950. for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r];
  8951. return Qu.run("intersection", t, n)
  8952. },
  8953. xor: function (t) {
  8954. for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r];
  8955. return Qu.run("xor", t, n)
  8956. },
  8957. difference: function (t) {
  8958. for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r];
  8959. return Qu.run("difference", t, n)
  8960. }
  8961. };
  8962. "fill" in Array.prototype || Object.defineProperty(Array.prototype, "fill", {
  8963. configurable: !0,
  8964. value: function (t) {
  8965. if (null == this) throw new TypeError(this + " is not an object");
  8966. var e = Object(this),
  8967. n = Math.max(Math.min(e.length, 9007199254740991), 0) || 0,
  8968. r = 1 in arguments && parseInt(Number(arguments[1]), 10) || 0;
  8969. r = r < 0 ? Math.max(n + r, 0) : Math.min(r, n);
  8970. var i = 2 in arguments && void 0 !== arguments[2] ? parseInt(Number(arguments[2]), 10) || 0 : n;
  8971. for (i = i < 0 ? Math.max(n + arguments[2], 0) : Math.min(i, n); r < i;) e[r] = t, ++r;
  8972. return e
  8973. },
  8974. writable: !0
  8975. }), Number.isFinite = Number.isFinite || function (t) {
  8976. return "number" == typeof t && isFinite(t)
  8977. }, Number.isInteger = Number.isInteger || function (t) {
  8978. return "number" == typeof t && isFinite(t) && Math.floor(t) === t
  8979. }, Number.parseFloat = Number.parseFloat || parseFloat, Number.isNaN = Number.isNaN || function (t) {
  8980. return t != t
  8981. }, Math.trunc = Math.trunc || function (t) {
  8982. return t < 0 ? Math.ceil(t) : Math.floor(t)
  8983. };
  8984. var tl = function () {};
  8985. tl.prototype.interfaces_ = function () {
  8986. return []
  8987. }, tl.prototype.getClass = function () {
  8988. return tl
  8989. }, tl.prototype.equalsWithTolerance = function (t, e, n) {
  8990. return Math.abs(t - e) <= n
  8991. };
  8992. var el = function (t) {
  8993. function e(e) {
  8994. t.call(this, e), this.name = "IllegalArgumentException", this.message = e, this.stack = (new t).stack
  8995. }
  8996. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e
  8997. }(Error),
  8998. nl = function () {},
  8999. rl = {
  9000. MAX_VALUE: {
  9001. configurable: !0
  9002. }
  9003. };
  9004. nl.isNaN = function (t) {
  9005. return Number.isNaN(t)
  9006. }, nl.doubleToLongBits = function (t) {
  9007. return t
  9008. }, nl.longBitsToDouble = function (t) {
  9009. return t
  9010. }, nl.isInfinite = function (t) {
  9011. return !Number.isFinite(t)
  9012. }, rl.MAX_VALUE.get = function () {
  9013. return Number.MAX_VALUE
  9014. }, Object.defineProperties(nl, rl);
  9015. var il = function () {},
  9016. ol = function () {},
  9017. sl = function () {};
  9018. function al() {}
  9019. var ul = function t() {
  9020. if (this.x = null, this.y = null, this.z = null, 0 === arguments.length) this.x = 0, this.y = 0, this.z = t.NULL_ORDINATE;
  9021. else if (1 === arguments.length) {
  9022. var e = arguments[0];
  9023. this.x = e.x, this.y = e.y, this.z = e.z
  9024. } else 2 === arguments.length ? (this.x = arguments[0], this.y = arguments[1], this.z = t.NULL_ORDINATE) : 3 === arguments.length && (this.x = arguments[0], this.y = arguments[1], this.z = arguments[2])
  9025. },
  9026. ll = {
  9027. DimensionalComparator: {
  9028. configurable: !0
  9029. },
  9030. serialVersionUID: {
  9031. configurable: !0
  9032. },
  9033. NULL_ORDINATE: {
  9034. configurable: !0
  9035. },
  9036. X: {
  9037. configurable: !0
  9038. },
  9039. Y: {
  9040. configurable: !0
  9041. },
  9042. Z: {
  9043. configurable: !0
  9044. }
  9045. };
  9046. ul.prototype.setOrdinate = function (t, e) {
  9047. switch (t) {
  9048. case ul.X:
  9049. this.x = e;
  9050. break;
  9051. case ul.Y:
  9052. this.y = e;
  9053. break;
  9054. case ul.Z:
  9055. this.z = e;
  9056. break;
  9057. default:
  9058. throw new el("Invalid ordinate index: " + t)
  9059. }
  9060. }, ul.prototype.equals2D = function () {
  9061. if (1 === arguments.length) {
  9062. var t = arguments[0];
  9063. return this.x === t.x && this.y === t.y
  9064. }
  9065. if (2 === arguments.length) {
  9066. var e = arguments[0],
  9067. n = arguments[1];
  9068. return !!tl.equalsWithTolerance(this.x, e.x, n) && !!tl.equalsWithTolerance(this.y, e.y, n)
  9069. }
  9070. }, ul.prototype.getOrdinate = function (t) {
  9071. switch (t) {
  9072. case ul.X:
  9073. return this.x;
  9074. case ul.Y:
  9075. return this.y;
  9076. case ul.Z:
  9077. return this.z
  9078. }
  9079. throw new el("Invalid ordinate index: " + t)
  9080. }, ul.prototype.equals3D = function (t) {
  9081. return this.x === t.x && this.y === t.y && (this.z === t.z || nl.isNaN(this.z)) && nl.isNaN(t.z)
  9082. }, ul.prototype.equals = function (t) {
  9083. return t instanceof ul && this.equals2D(t)
  9084. }, ul.prototype.equalInZ = function (t, e) {
  9085. return tl.equalsWithTolerance(this.z, t.z, e)
  9086. }, ul.prototype.compareTo = function (t) {
  9087. var e = t;
  9088. return this.x < e.x ? -1 : this.x > e.x ? 1 : this.y < e.y ? -1 : this.y > e.y ? 1 : 0
  9089. }, ul.prototype.clone = function () {}, ul.prototype.copy = function () {
  9090. return new ul(this)
  9091. }, ul.prototype.toString = function () {
  9092. return "(" + this.x + ", " + this.y + ", " + this.z + ")"
  9093. }, ul.prototype.distance3D = function (t) {
  9094. var e = this.x - t.x,
  9095. n = this.y - t.y,
  9096. r = this.z - t.z;
  9097. return Math.sqrt(e * e + n * n + r * r)
  9098. }, ul.prototype.distance = function (t) {
  9099. var e = this.x - t.x,
  9100. n = this.y - t.y;
  9101. return Math.sqrt(e * e + n * n)
  9102. }, ul.prototype.hashCode = function () {
  9103. var t = 17;
  9104. return t = 37 * (t = 37 * t + ul.hashCode(this.x)) + ul.hashCode(this.y)
  9105. }, ul.prototype.setCoordinate = function (t) {
  9106. this.x = t.x, this.y = t.y, this.z = t.z
  9107. }, ul.prototype.interfaces_ = function () {
  9108. return [il, ol, al]
  9109. }, ul.prototype.getClass = function () {
  9110. return ul
  9111. }, ul.hashCode = function () {
  9112. if (1 === arguments.length) {
  9113. var t = arguments[0],
  9114. e = nl.doubleToLongBits(t);
  9115. return Math.trunc((e ^ e) >>> 32)
  9116. }
  9117. }, ll.DimensionalComparator.get = function () {
  9118. return cl
  9119. }, ll.serialVersionUID.get = function () {
  9120. return 0x5cbf2c235c7e5800
  9121. }, ll.NULL_ORDINATE.get = function () {
  9122. return nl.NaN
  9123. }, ll.X.get = function () {
  9124. return 0
  9125. }, ll.Y.get = function () {
  9126. return 1
  9127. }, ll.Z.get = function () {
  9128. return 2
  9129. }, Object.defineProperties(ul, ll);
  9130. var cl = function (t) {
  9131. if (this._dimensionsToTest = 2, 0 === arguments.length);
  9132. else if (1 === arguments.length) {
  9133. var e = arguments[0];
  9134. if (2 !== e && 3 !== e) throw new el("only 2 or 3 dimensions may be specified");
  9135. this._dimensionsToTest = e
  9136. }
  9137. };
  9138. cl.prototype.compare = function (t, e) {
  9139. var n = t,
  9140. r = e,
  9141. i = cl.compare(n.x, r.x);
  9142. if (0 !== i) return i;
  9143. var o = cl.compare(n.y, r.y);
  9144. return 0 !== o ? o : this._dimensionsToTest <= 2 ? 0 : cl.compare(n.z, r.z)
  9145. }, cl.prototype.interfaces_ = function () {
  9146. return [sl]
  9147. }, cl.prototype.getClass = function () {
  9148. return cl
  9149. }, cl.compare = function (t, e) {
  9150. return t < e ? -1 : t > e ? 1 : nl.isNaN(t) ? nl.isNaN(e) ? 0 : -1 : nl.isNaN(e) ? 1 : 0
  9151. };
  9152. var hl = function () {};
  9153. hl.prototype.create = function () {}, hl.prototype.interfaces_ = function () {
  9154. return []
  9155. }, hl.prototype.getClass = function () {
  9156. return hl
  9157. };
  9158. var pl = function () {},
  9159. fl = {
  9160. INTERIOR: {
  9161. configurable: !0
  9162. },
  9163. BOUNDARY: {
  9164. configurable: !0
  9165. },
  9166. EXTERIOR: {
  9167. configurable: !0
  9168. },
  9169. NONE: {
  9170. configurable: !0
  9171. }
  9172. };
  9173. pl.prototype.interfaces_ = function () {
  9174. return []
  9175. }, pl.prototype.getClass = function () {
  9176. return pl
  9177. }, pl.toLocationSymbol = function (t) {
  9178. switch (t) {
  9179. case pl.EXTERIOR:
  9180. return "e";
  9181. case pl.BOUNDARY:
  9182. return "b";
  9183. case pl.INTERIOR:
  9184. return "i";
  9185. case pl.NONE:
  9186. return "-"
  9187. }
  9188. throw new el("Unknown location value: " + t)
  9189. }, fl.INTERIOR.get = function () {
  9190. return 0
  9191. }, fl.BOUNDARY.get = function () {
  9192. return 1
  9193. }, fl.EXTERIOR.get = function () {
  9194. return 2
  9195. }, fl.NONE.get = function () {
  9196. return -1
  9197. }, Object.defineProperties(pl, fl);
  9198. var gl = function (t, e) {
  9199. return t.interfaces_ && t.interfaces_().indexOf(e) > -1
  9200. },
  9201. dl = function () {},
  9202. yl = {
  9203. LOG_10: {
  9204. configurable: !0
  9205. }
  9206. };
  9207. dl.prototype.interfaces_ = function () {
  9208. return []
  9209. }, dl.prototype.getClass = function () {
  9210. return dl
  9211. }, dl.log10 = function (t) {
  9212. var e = Math.log(t);
  9213. return nl.isInfinite(e) || nl.isNaN(e) ? e : e / dl.LOG_10
  9214. }, dl.min = function (t, e, n, r) {
  9215. var i = t;
  9216. return e < i && (i = e), n < i && (i = n), r < i && (i = r), i
  9217. }, dl.clamp = function () {
  9218. if ("number" == typeof arguments[2] && "number" == typeof arguments[0] && "number" == typeof arguments[1]) {
  9219. var t = arguments[0],
  9220. e = arguments[1],
  9221. n = arguments[2];
  9222. return t < e ? e : t > n ? n : t
  9223. }
  9224. if (Number.isInteger(arguments[2]) && Number.isInteger(arguments[0]) && Number.isInteger(arguments[1])) {
  9225. var r = arguments[0],
  9226. i = arguments[1],
  9227. o = arguments[2];
  9228. return r < i ? i : r > o ? o : r
  9229. }
  9230. }, dl.wrap = function (t, e) {
  9231. return t < 0 ? e - -t % e : t % e
  9232. }, dl.max = function () {
  9233. if (3 === arguments.length) {
  9234. var t = arguments[0],
  9235. e = arguments[1],
  9236. n = arguments[2],
  9237. r = t;
  9238. return e > r && (r = e), n > r && (r = n), r
  9239. }
  9240. if (4 === arguments.length) {
  9241. var i = arguments[0],
  9242. o = arguments[1],
  9243. s = arguments[2],
  9244. a = arguments[3],
  9245. u = i;
  9246. return o > u && (u = o), s > u && (u = s), a > u && (u = a), u
  9247. }
  9248. }, dl.average = function (t, e) {
  9249. return (t + e) / 2
  9250. }, yl.LOG_10.get = function () {
  9251. return Math.log(10)
  9252. }, Object.defineProperties(dl, yl);
  9253. var vl = function (t) {
  9254. this.str = t
  9255. };
  9256. vl.prototype.append = function (t) {
  9257. this.str += t
  9258. }, vl.prototype.setCharAt = function (t, e) {
  9259. this.str = this.str.substr(0, t) + e + this.str.substr(t + 1)
  9260. }, vl.prototype.toString = function (t) {
  9261. return this.str
  9262. };
  9263. var _l = function (t) {
  9264. this.value = t
  9265. };
  9266. _l.prototype.intValue = function () {
  9267. return this.value
  9268. }, _l.prototype.compareTo = function (t) {
  9269. return this.value < t ? -1 : this.value > t ? 1 : 0
  9270. }, _l.isNaN = function (t) {
  9271. return Number.isNaN(t)
  9272. };
  9273. var ml = function () {};
  9274. ml.isWhitespace = function (t) {
  9275. return t <= 32 && t >= 0 || 127 === t
  9276. }, ml.toUpperCase = function (t) {
  9277. return t.toUpperCase()
  9278. };
  9279. var xl = function t() {
  9280. if (this._hi = 0, this._lo = 0, 0 === arguments.length) this.init(0);
  9281. else if (1 === arguments.length) {
  9282. if ("number" == typeof arguments[0]) {
  9283. var e = arguments[0];
  9284. this.init(e)
  9285. } else if (arguments[0] instanceof t) {
  9286. var n = arguments[0];
  9287. this.init(n)
  9288. } else if ("string" == typeof arguments[0]) {
  9289. var r = arguments[0];
  9290. t.call(this, t.parse(r))
  9291. }
  9292. } else if (2 === arguments.length) {
  9293. var i = arguments[0],
  9294. o = arguments[1];
  9295. this.init(i, o)
  9296. }
  9297. },
  9298. El = {
  9299. PI: {
  9300. configurable: !0
  9301. },
  9302. TWO_PI: {
  9303. configurable: !0
  9304. },
  9305. PI_2: {
  9306. configurable: !0
  9307. },
  9308. E: {
  9309. configurable: !0
  9310. },
  9311. NaN: {
  9312. configurable: !0
  9313. },
  9314. EPS: {
  9315. configurable: !0
  9316. },
  9317. SPLIT: {
  9318. configurable: !0
  9319. },
  9320. MAX_PRINT_DIGITS: {
  9321. configurable: !0
  9322. },
  9323. TEN: {
  9324. configurable: !0
  9325. },
  9326. ONE: {
  9327. configurable: !0
  9328. },
  9329. SCI_NOT_EXPONENT_CHAR: {
  9330. configurable: !0
  9331. },
  9332. SCI_NOT_ZERO: {
  9333. configurable: !0
  9334. }
  9335. };
  9336. xl.prototype.le = function (t) {
  9337. return (this._hi < t._hi || this._hi === t._hi) && this._lo <= t._lo
  9338. }, xl.prototype.extractSignificantDigits = function (t, e) {
  9339. var n = this.abs(),
  9340. r = xl.magnitude(n._hi),
  9341. i = xl.TEN.pow(r);
  9342. (n = n.divide(i)).gt(xl.TEN) ? (n = n.divide(xl.TEN), r += 1) : n.lt(xl.ONE) && (n = n.multiply(xl.TEN), r -= 1);
  9343. for (var o = r + 1, s = new vl, a = xl.MAX_PRINT_DIGITS - 1, u = 0; u <= a; u++) {
  9344. t && u === o && s.append(".");
  9345. var l = Math.trunc(n._hi);
  9346. if (l < 0) break;
  9347. var c = !1,
  9348. h = 0;
  9349. l > 9 ? (c = !0, h = "9") : h = "0" + l, s.append(h), n = n.subtract(xl.valueOf(l)).multiply(xl.TEN), c && n.selfAdd(xl.TEN);
  9350. var p = !0,
  9351. f = xl.magnitude(n._hi);
  9352. if (f < 0 && Math.abs(f) >= a - u && (p = !1), !p) break
  9353. }
  9354. return e[0] = r, s.toString()
  9355. }, xl.prototype.sqr = function () {
  9356. return this.multiply(this)
  9357. }, xl.prototype.doubleValue = function () {
  9358. return this._hi + this._lo
  9359. }, xl.prototype.subtract = function () {
  9360. if (arguments[0] instanceof xl) {
  9361. var t = arguments[0];
  9362. return this.add(t.negate())
  9363. }
  9364. if ("number" == typeof arguments[0]) {
  9365. var e = arguments[0];
  9366. return this.add(-e)
  9367. }
  9368. }, xl.prototype.equals = function () {
  9369. if (1 === arguments.length) {
  9370. var t = arguments[0];
  9371. return this._hi === t._hi && this._lo === t._lo
  9372. }
  9373. }, xl.prototype.isZero = function () {
  9374. return 0 === this._hi && 0 === this._lo
  9375. }, xl.prototype.selfSubtract = function () {
  9376. if (arguments[0] instanceof xl) {
  9377. var t = arguments[0];
  9378. return this.isNaN() ? this : this.selfAdd(-t._hi, -t._lo)
  9379. }
  9380. if ("number" == typeof arguments[0]) {
  9381. var e = arguments[0];
  9382. return this.isNaN() ? this : this.selfAdd(-e, 0)
  9383. }
  9384. }, xl.prototype.getSpecialNumberString = function () {
  9385. return this.isZero() ? "0.0" : this.isNaN() ? "NaN " : null
  9386. }, xl.prototype.min = function (t) {
  9387. return this.le(t) ? this : t
  9388. }, xl.prototype.selfDivide = function () {
  9389. if (1 === arguments.length) {
  9390. if (arguments[0] instanceof xl) {
  9391. var t = arguments[0];
  9392. return this.selfDivide(t._hi, t._lo)
  9393. }
  9394. if ("number" == typeof arguments[0]) {
  9395. var e = arguments[0];
  9396. return this.selfDivide(e, 0)
  9397. }
  9398. } else if (2 === arguments.length) {
  9399. var n = arguments[0],
  9400. r = arguments[1],
  9401. i = null,
  9402. o = null,
  9403. s = null,
  9404. a = null,
  9405. u = null,
  9406. l = null,
  9407. c = null,
  9408. h = null;
  9409. return u = this._hi / n, h = (i = (l = xl.SPLIT * u) - (i = l - u)) * (s = (h = xl.SPLIT * n) - (s = h - n)) - (c = u * n) + i * (a = n - s) + (o = u - i) * s + o * a, h = u + (l = (this._hi - c - h + this._lo - u * r) / n), this._hi = h, this._lo = u - h + l, this
  9410. }
  9411. }, xl.prototype.dump = function () {
  9412. return "DD<" + this._hi + ", " + this._lo + ">"
  9413. }, xl.prototype.divide = function () {
  9414. if (arguments[0] instanceof xl) {
  9415. var t = arguments[0],
  9416. e = null,
  9417. n = null,
  9418. r = null,
  9419. i = null,
  9420. o = null,
  9421. s = null,
  9422. a = null,
  9423. u = null;
  9424. n = (o = this._hi / t._hi) - (e = (s = xl.SPLIT * o) - (e = s - o)), u = e * (r = (u = xl.SPLIT * t._hi) - (r = u - t._hi)) - (a = o * t._hi) + e * (i = t._hi - r) + n * r + n * i;
  9425. var l = u = o + (s = (this._hi - a - u + this._lo - o * t._lo) / t._hi),
  9426. c = o - u + s;
  9427. return new xl(l, c)
  9428. }
  9429. if ("number" == typeof arguments[0]) {
  9430. var h = arguments[0];
  9431. return nl.isNaN(h) ? xl.createNaN() : xl.copy(this).selfDivide(h, 0)
  9432. }
  9433. }, xl.prototype.ge = function (t) {
  9434. return (this._hi > t._hi || this._hi === t._hi) && this._lo >= t._lo
  9435. }, xl.prototype.pow = function (t) {
  9436. if (0 === t) return xl.valueOf(1);
  9437. var e = new xl(this),
  9438. n = xl.valueOf(1),
  9439. r = Math.abs(t);
  9440. if (r > 1)
  9441. for (; r > 0;) r % 2 == 1 && n.selfMultiply(e), (r /= 2) > 0 && (e = e.sqr());
  9442. else n = e;
  9443. return t < 0 ? n.reciprocal() : n
  9444. }, xl.prototype.ceil = function () {
  9445. if (this.isNaN()) return xl.NaN;
  9446. var t = Math.ceil(this._hi),
  9447. e = 0;
  9448. return t === this._hi && (e = Math.ceil(this._lo)), new xl(t, e)
  9449. }, xl.prototype.compareTo = function (t) {
  9450. var e = t;
  9451. return this._hi < e._hi ? -1 : this._hi > e._hi ? 1 : this._lo < e._lo ? -1 : this._lo > e._lo ? 1 : 0
  9452. }, xl.prototype.rint = function () {
  9453. return this.isNaN() ? this : this.add(.5).floor()
  9454. }, xl.prototype.setValue = function () {
  9455. if (arguments[0] instanceof xl) {
  9456. var t = arguments[0];
  9457. return this.init(t), this
  9458. }
  9459. if ("number" == typeof arguments[0]) {
  9460. var e = arguments[0];
  9461. return this.init(e), this
  9462. }
  9463. }, xl.prototype.max = function (t) {
  9464. return this.ge(t) ? this : t
  9465. }, xl.prototype.sqrt = function () {
  9466. if (this.isZero()) return xl.valueOf(0);
  9467. if (this.isNegative()) return xl.NaN;
  9468. var t = 1 / Math.sqrt(this._hi),
  9469. e = this._hi * t,
  9470. n = xl.valueOf(e),
  9471. r = this.subtract(n.sqr())._hi * (.5 * t);
  9472. return n.add(r)
  9473. }, xl.prototype.selfAdd = function () {
  9474. if (1 === arguments.length) {
  9475. if (arguments[0] instanceof xl) {
  9476. var t = arguments[0];
  9477. return this.selfAdd(t._hi, t._lo)
  9478. }
  9479. if ("number" == typeof arguments[0]) {
  9480. var e = arguments[0],
  9481. n = null,
  9482. r = null,
  9483. i = null,
  9484. o = null,
  9485. s = null,
  9486. a = null;
  9487. return o = (i = this._hi + e) - (s = i - this._hi), r = (a = (o = e - s + (this._hi - o)) + this._lo) + (i - (n = i + a)), this._hi = n + r, this._lo = r + (n - this._hi), this
  9488. }
  9489. } else if (2 === arguments.length) {
  9490. var u = arguments[0],
  9491. l = arguments[1],
  9492. c = null,
  9493. h = null,
  9494. p = null,
  9495. f = null,
  9496. g = null,
  9497. d = null,
  9498. y = null;
  9499. f = this._hi + u, h = this._lo + l, g = f - (d = f - this._hi), p = h - (y = h - this._lo);
  9500. var v = (c = f + (d = (g = u - d + (this._hi - g)) + h)) + (d = (p = l - y + (this._lo - p)) + (d + (f - c))),
  9501. _ = d + (c - v);
  9502. return this._hi = v, this._lo = _, this
  9503. }
  9504. }, xl.prototype.selfMultiply = function () {
  9505. if (1 === arguments.length) {
  9506. if (arguments[0] instanceof xl) {
  9507. var t = arguments[0];
  9508. return this.selfMultiply(t._hi, t._lo)
  9509. }
  9510. if ("number" == typeof arguments[0]) {
  9511. var e = arguments[0];
  9512. return this.selfMultiply(e, 0)
  9513. }
  9514. } else if (2 === arguments.length) {
  9515. var n = arguments[0],
  9516. r = arguments[1],
  9517. i = null,
  9518. o = null,
  9519. s = null,
  9520. a = null,
  9521. u = null,
  9522. l = null;
  9523. i = (u = xl.SPLIT * this._hi) - this._hi, l = xl.SPLIT * n, i = u - i, o = this._hi - i, s = l - n;
  9524. var c = (u = this._hi * n) + (l = i * (s = l - s) - u + i * (a = n - s) + o * s + o * a + (this._hi * r + this._lo * n)),
  9525. h = l + (i = u - c);
  9526. return this._hi = c, this._lo = h, this
  9527. }
  9528. }, xl.prototype.selfSqr = function () {
  9529. return this.selfMultiply(this)
  9530. }, xl.prototype.floor = function () {
  9531. if (this.isNaN()) return xl.NaN;
  9532. var t = Math.floor(this._hi),
  9533. e = 0;
  9534. return t === this._hi && (e = Math.floor(this._lo)), new xl(t, e)
  9535. }, xl.prototype.negate = function () {
  9536. return this.isNaN() ? this : new xl(-this._hi, -this._lo)
  9537. }, xl.prototype.clone = function () {}, xl.prototype.multiply = function () {
  9538. if (arguments[0] instanceof xl) {
  9539. var t = arguments[0];
  9540. return t.isNaN() ? xl.createNaN() : xl.copy(this).selfMultiply(t)
  9541. }
  9542. if ("number" == typeof arguments[0]) {
  9543. var e = arguments[0];
  9544. return nl.isNaN(e) ? xl.createNaN() : xl.copy(this).selfMultiply(e, 0)
  9545. }
  9546. }, xl.prototype.isNaN = function () {
  9547. return nl.isNaN(this._hi)
  9548. }, xl.prototype.intValue = function () {
  9549. return Math.trunc(this._hi)
  9550. }, xl.prototype.toString = function () {
  9551. var t = xl.magnitude(this._hi);
  9552. return t >= -3 && t <= 20 ? this.toStandardNotation() : this.toSciNotation()
  9553. }, xl.prototype.toStandardNotation = function () {
  9554. var t = this.getSpecialNumberString();
  9555. if (null !== t) return t;
  9556. var e = new Array(1).fill(null),
  9557. n = this.extractSignificantDigits(!0, e),
  9558. r = e[0] + 1,
  9559. i = n;
  9560. if ("." === n.charAt(0)) i = "0" + n;
  9561. else if (r < 0) i = "0." + xl.stringOfChar("0", -r) + n;
  9562. else if (-1 === n.indexOf(".")) {
  9563. var o = r - n.length;
  9564. i = n + xl.stringOfChar("0", o) + ".0"
  9565. }
  9566. return this.isNegative() ? "-" + i : i
  9567. }, xl.prototype.reciprocal = function () {
  9568. var t, e, n, r, i = null,
  9569. o = null,
  9570. s = null,
  9571. a = null;
  9572. t = (n = 1 / this._hi) - (i = (s = xl.SPLIT * n) - (i = s - n)), o = (a = xl.SPLIT * this._hi) - this._hi;
  9573. var u = n + (s = (1 - (r = n * this._hi) - (a = i * (o = a - o) - r + i * (e = this._hi - o) + t * o + t * e) - n * this._lo) / this._hi);
  9574. return new xl(u, n - u + s)
  9575. }, xl.prototype.toSciNotation = function () {
  9576. if (this.isZero()) return xl.SCI_NOT_ZERO;
  9577. var t = this.getSpecialNumberString();
  9578. if (null !== t) return t;
  9579. var e = new Array(1).fill(null),
  9580. n = this.extractSignificantDigits(!1, e),
  9581. r = xl.SCI_NOT_EXPONENT_CHAR + e[0];
  9582. if ("0" === n.charAt(0)) throw new Error("Found leading zero: " + n);
  9583. var i = "";
  9584. n.length > 1 && (i = n.substring(1));
  9585. var o = n.charAt(0) + "." + i;
  9586. return this.isNegative() ? "-" + o + r : o + r
  9587. }, xl.prototype.abs = function () {
  9588. return this.isNaN() ? xl.NaN : this.isNegative() ? this.negate() : new xl(this)
  9589. }, xl.prototype.isPositive = function () {
  9590. return (this._hi > 0 || 0 === this._hi) && this._lo > 0
  9591. }, xl.prototype.lt = function (t) {
  9592. return (this._hi < t._hi || this._hi === t._hi) && this._lo < t._lo
  9593. }, xl.prototype.add = function () {
  9594. if (arguments[0] instanceof xl) {
  9595. var t = arguments[0];
  9596. return xl.copy(this).selfAdd(t)
  9597. }
  9598. if ("number" == typeof arguments[0]) {
  9599. var e = arguments[0];
  9600. return xl.copy(this).selfAdd(e)
  9601. }
  9602. }, xl.prototype.init = function () {
  9603. if (1 === arguments.length) {
  9604. if ("number" == typeof arguments[0]) {
  9605. var t = arguments[0];
  9606. this._hi = t, this._lo = 0
  9607. } else if (arguments[0] instanceof xl) {
  9608. var e = arguments[0];
  9609. this._hi = e._hi, this._lo = e._lo
  9610. }
  9611. } else if (2 === arguments.length) {
  9612. var n = arguments[0],
  9613. r = arguments[1];
  9614. this._hi = n, this._lo = r
  9615. }
  9616. }, xl.prototype.gt = function (t) {
  9617. return (this._hi > t._hi || this._hi === t._hi) && this._lo > t._lo
  9618. }, xl.prototype.isNegative = function () {
  9619. return (this._hi < 0 || 0 === this._hi) && this._lo < 0
  9620. }, xl.prototype.trunc = function () {
  9621. return this.isNaN() ? xl.NaN : this.isPositive() ? this.floor() : this.ceil()
  9622. }, xl.prototype.signum = function () {
  9623. return this._hi > 0 ? 1 : this._hi < 0 ? -1 : this._lo > 0 ? 1 : this._lo < 0 ? -1 : 0
  9624. }, xl.prototype.interfaces_ = function () {
  9625. return [al, il, ol]
  9626. }, xl.prototype.getClass = function () {
  9627. return xl
  9628. }, xl.sqr = function (t) {
  9629. return xl.valueOf(t).selfMultiply(t)
  9630. }, xl.valueOf = function () {
  9631. if ("string" == typeof arguments[0]) {
  9632. var t = arguments[0];
  9633. return xl.parse(t)
  9634. }
  9635. if ("number" == typeof arguments[0]) {
  9636. var e = arguments[0];
  9637. return new xl(e)
  9638. }
  9639. }, xl.sqrt = function (t) {
  9640. return xl.valueOf(t).sqrt()
  9641. }, xl.parse = function (t) {
  9642. for (var e = 0, n = t.length; ml.isWhitespace(t.charAt(e));) e++;
  9643. var r = !1;
  9644. if (e < n) {
  9645. var i = t.charAt(e);
  9646. "-" !== i && "+" !== i || (e++, "-" === i && (r = !0))
  9647. }
  9648. for (var o = new xl, s = 0, a = 0, u = 0; !(e >= n);) {
  9649. var l = t.charAt(e);
  9650. if (e++, ml.isDigit(l)) {
  9651. var c = l - "0";
  9652. o.selfMultiply(xl.TEN), o.selfAdd(c), s++
  9653. } else {
  9654. if ("." !== l) {
  9655. if ("e" === l || "E" === l) {
  9656. var h = t.substring(e);
  9657. try {
  9658. u = _l.parseInt(h)
  9659. } catch (e) {
  9660. throw e instanceof Error ? new Error("Invalid exponent " + h + " in string " + t) : e
  9661. }
  9662. break
  9663. }
  9664. throw new Error("Unexpected character '" + l + "' at position " + e + " in string " + t)
  9665. }
  9666. a = s
  9667. }
  9668. }
  9669. var p = o,
  9670. f = s - a - u;
  9671. if (0 === f) p = o;
  9672. else if (f > 0) {
  9673. var g = xl.TEN.pow(f);
  9674. p = o.divide(g)
  9675. } else if (f < 0) {
  9676. var d = xl.TEN.pow(-f);
  9677. p = o.multiply(d)
  9678. }
  9679. return r ? p.negate() : p
  9680. }, xl.createNaN = function () {
  9681. return new xl(nl.NaN, nl.NaN)
  9682. }, xl.copy = function (t) {
  9683. return new xl(t)
  9684. }, xl.magnitude = function (t) {
  9685. var e = Math.abs(t),
  9686. n = Math.log(e) / Math.log(10),
  9687. r = Math.trunc(Math.floor(n));
  9688. return 10 * Math.pow(10, r) <= e && (r += 1), r
  9689. }, xl.stringOfChar = function (t, e) {
  9690. for (var n = new vl, r = 0; r < e; r++) n.append(t);
  9691. return n.toString()
  9692. }, El.PI.get = function () {
  9693. return new xl(3.141592653589793, 12246467991473532e-32)
  9694. }, El.TWO_PI.get = function () {
  9695. return new xl(6.283185307179586, 24492935982947064e-32)
  9696. }, El.PI_2.get = function () {
  9697. return new xl(1.5707963267948966, 6123233995736766e-32)
  9698. }, El.E.get = function () {
  9699. return new xl(2.718281828459045, 14456468917292502e-32)
  9700. }, El.NaN.get = function () {
  9701. return new xl(nl.NaN, nl.NaN)
  9702. }, El.EPS.get = function () {
  9703. return 123259516440783e-46
  9704. }, El.SPLIT.get = function () {
  9705. return 134217729
  9706. }, El.MAX_PRINT_DIGITS.get = function () {
  9707. return 32
  9708. }, El.TEN.get = function () {
  9709. return xl.valueOf(10)
  9710. }, El.ONE.get = function () {
  9711. return xl.valueOf(1)
  9712. }, El.SCI_NOT_EXPONENT_CHAR.get = function () {
  9713. return "E"
  9714. }, El.SCI_NOT_ZERO.get = function () {
  9715. return "0.0E0"
  9716. }, Object.defineProperties(xl, El);
  9717. var bl = function () {},
  9718. wl = {
  9719. DP_SAFE_EPSILON: {
  9720. configurable: !0
  9721. }
  9722. };
  9723. bl.prototype.interfaces_ = function () {
  9724. return []
  9725. }, bl.prototype.getClass = function () {
  9726. return bl
  9727. }, bl.orientationIndex = function (t, e, n) {
  9728. var r = bl.orientationIndexFilter(t, e, n);
  9729. if (r <= 1) return r;
  9730. var i = xl.valueOf(e.x).selfAdd(-t.x),
  9731. o = xl.valueOf(e.y).selfAdd(-t.y),
  9732. s = xl.valueOf(n.x).selfAdd(-e.x),
  9733. a = xl.valueOf(n.y).selfAdd(-e.y);
  9734. return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()
  9735. }, bl.signOfDet2x2 = function (t, e, n, r) {
  9736. return t.multiply(r).selfSubtract(e.multiply(n)).signum()
  9737. }, bl.intersection = function (t, e, n, r) {
  9738. var i = xl.valueOf(r.y).selfSubtract(n.y).selfMultiply(xl.valueOf(e.x).selfSubtract(t.x)),
  9739. o = xl.valueOf(r.x).selfSubtract(n.x).selfMultiply(xl.valueOf(e.y).selfSubtract(t.y)),
  9740. s = i.subtract(o),
  9741. a = xl.valueOf(r.x).selfSubtract(n.x).selfMultiply(xl.valueOf(t.y).selfSubtract(n.y)),
  9742. u = xl.valueOf(r.y).selfSubtract(n.y).selfMultiply(xl.valueOf(t.x).selfSubtract(n.x)),
  9743. l = a.subtract(u).selfDivide(s).doubleValue(),
  9744. c = xl.valueOf(t.x).selfAdd(xl.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),
  9745. h = xl.valueOf(e.x).selfSubtract(t.x).selfMultiply(xl.valueOf(t.y).selfSubtract(n.y)),
  9746. p = xl.valueOf(e.y).selfSubtract(t.y).selfMultiply(xl.valueOf(t.x).selfSubtract(n.x)),
  9747. f = h.subtract(p).selfDivide(s).doubleValue(),
  9748. g = xl.valueOf(n.y).selfAdd(xl.valueOf(r.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();
  9749. return new ul(c, g)
  9750. }, bl.orientationIndexFilter = function (t, e, n) {
  9751. var r = null,
  9752. i = (t.x - n.x) * (e.y - n.y),
  9753. o = (t.y - n.y) * (e.x - n.x),
  9754. s = i - o;
  9755. if (i > 0) {
  9756. if (o <= 0) return bl.signum(s);
  9757. r = i + o
  9758. } else {
  9759. if (!(i < 0)) return bl.signum(s);
  9760. if (o >= 0) return bl.signum(s);
  9761. r = -i - o
  9762. }
  9763. var a = bl.DP_SAFE_EPSILON * r;
  9764. return s >= a || -s >= a ? bl.signum(s) : 2
  9765. }, bl.signum = function (t) {
  9766. return t > 0 ? 1 : t < 0 ? -1 : 0
  9767. }, wl.DP_SAFE_EPSILON.get = function () {
  9768. return 1e-15
  9769. }, Object.defineProperties(bl, wl);
  9770. var Il = function () {},
  9771. Nl = {
  9772. X: {
  9773. configurable: !0
  9774. },
  9775. Y: {
  9776. configurable: !0
  9777. },
  9778. Z: {
  9779. configurable: !0
  9780. },
  9781. M: {
  9782. configurable: !0
  9783. }
  9784. };
  9785. Nl.X.get = function () {
  9786. return 0
  9787. }, Nl.Y.get = function () {
  9788. return 1
  9789. }, Nl.Z.get = function () {
  9790. return 2
  9791. }, Nl.M.get = function () {
  9792. return 3
  9793. }, Il.prototype.setOrdinate = function (t, e, n) {}, Il.prototype.size = function () {}, Il.prototype.getOrdinate = function (t, e) {}, Il.prototype.getCoordinate = function () {}, Il.prototype.getCoordinateCopy = function (t) {}, Il.prototype.getDimension = function () {}, Il.prototype.getX = function (t) {}, Il.prototype.clone = function () {}, Il.prototype.expandEnvelope = function (t) {}, Il.prototype.copy = function () {}, Il.prototype.getY = function (t) {}, Il.prototype.toCoordinateArray = function () {}, Il.prototype.interfaces_ = function () {
  9794. return [ol]
  9795. }, Il.prototype.getClass = function () {
  9796. return Il
  9797. }, Object.defineProperties(Il, Nl);
  9798. var Sl = function () {},
  9799. Cl = function (t) {
  9800. function e() {
  9801. t.call(this, "Projective point not representable on the Cartesian plane.")
  9802. }
  9803. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.interfaces_ = function () {
  9804. return []
  9805. }, e.prototype.getClass = function () {
  9806. return e
  9807. }, e
  9808. }(Sl),
  9809. Pl = function () {};
  9810. Pl.arraycopy = function (t, e, n, r, i) {
  9811. for (var o = 0, s = e; s < e + i; s++) n[r + o] = t[s], o++
  9812. }, Pl.getProperty = function (t) {
  9813. return {
  9814. "line.separator": "\n"
  9815. } [t]
  9816. };
  9817. var Ml = function t() {
  9818. if (this.x = null, this.y = null, this.w = null, 0 === arguments.length) this.x = 0, this.y = 0, this.w = 1;
  9819. else if (1 === arguments.length) {
  9820. var e = arguments[0];
  9821. this.x = e.x, this.y = e.y, this.w = 1
  9822. } else if (2 === arguments.length) {
  9823. if ("number" == typeof arguments[0] && "number" == typeof arguments[1]) {
  9824. var n = arguments[0],
  9825. r = arguments[1];
  9826. this.x = n, this.y = r, this.w = 1
  9827. } else if (arguments[0] instanceof t && arguments[1] instanceof t) {
  9828. var i = arguments[0],
  9829. o = arguments[1];
  9830. this.x = i.y * o.w - o.y * i.w, this.y = o.x * i.w - i.x * o.w, this.w = i.x * o.y - o.x * i.y
  9831. } else if (arguments[0] instanceof ul && arguments[1] instanceof ul) {
  9832. var s = arguments[0],
  9833. a = arguments[1];
  9834. this.x = s.y - a.y, this.y = a.x - s.x, this.w = s.x * a.y - a.x * s.y
  9835. }
  9836. } else if (3 === arguments.length) {
  9837. var u = arguments[0],
  9838. l = arguments[1],
  9839. c = arguments[2];
  9840. this.x = u, this.y = l, this.w = c
  9841. } else if (4 === arguments.length) {
  9842. var h = arguments[0],
  9843. p = arguments[1],
  9844. f = arguments[2],
  9845. g = arguments[3],
  9846. d = h.y - p.y,
  9847. y = p.x - h.x,
  9848. v = h.x * p.y - p.x * h.y,
  9849. _ = f.y - g.y,
  9850. m = g.x - f.x,
  9851. x = f.x * g.y - g.x * f.y;
  9852. this.x = y * x - m * v, this.y = _ * v - d * x, this.w = d * m - _ * y
  9853. }
  9854. };
  9855. Ml.prototype.getY = function () {
  9856. var t = this.y / this.w;
  9857. if (nl.isNaN(t) || nl.isInfinite(t)) throw new Cl;
  9858. return t
  9859. }, Ml.prototype.getX = function () {
  9860. var t = this.x / this.w;
  9861. if (nl.isNaN(t) || nl.isInfinite(t)) throw new Cl;
  9862. return t
  9863. }, Ml.prototype.getCoordinate = function () {
  9864. var t = new ul;
  9865. return t.x = this.getX(), t.y = this.getY(), t
  9866. }, Ml.prototype.interfaces_ = function () {
  9867. return []
  9868. }, Ml.prototype.getClass = function () {
  9869. return Ml
  9870. }, Ml.intersection = function (t, e, n, r) {
  9871. var i = t.y - e.y,
  9872. o = e.x - t.x,
  9873. s = t.x * e.y - e.x * t.y,
  9874. a = n.y - r.y,
  9875. u = r.x - n.x,
  9876. l = n.x * r.y - r.x * n.y,
  9877. c = i * u - a * o,
  9878. h = (o * l - u * s) / c,
  9879. p = (a * s - i * l) / c;
  9880. if (nl.isNaN(h) || nl.isInfinite(h) || nl.isNaN(p) || nl.isInfinite(p)) throw new Cl;
  9881. return new ul(h, p)
  9882. };
  9883. var Ll = function t() {
  9884. if (this._minx = null, this._maxx = null, this._miny = null, this._maxy = null, 0 === arguments.length) this.init();
  9885. else if (1 === arguments.length) {
  9886. if (arguments[0] instanceof ul) {
  9887. var e = arguments[0];
  9888. this.init(e.x, e.x, e.y, e.y)
  9889. } else if (arguments[0] instanceof t) {
  9890. var n = arguments[0];
  9891. this.init(n)
  9892. }
  9893. } else if (2 === arguments.length) {
  9894. var r = arguments[0],
  9895. i = arguments[1];
  9896. this.init(r.x, i.x, r.y, i.y)
  9897. } else if (4 === arguments.length) {
  9898. var o = arguments[0],
  9899. s = arguments[1],
  9900. a = arguments[2],
  9901. u = arguments[3];
  9902. this.init(o, s, a, u)
  9903. }
  9904. },
  9905. Ol = {
  9906. serialVersionUID: {
  9907. configurable: !0
  9908. }
  9909. };
  9910. Ll.prototype.getArea = function () {
  9911. return this.getWidth() * this.getHeight()
  9912. }, Ll.prototype.equals = function (t) {
  9913. if (!(t instanceof Ll)) return !1;
  9914. var e = t;
  9915. return this.isNull() ? e.isNull() : this._maxx === e.getMaxX() && this._maxy === e.getMaxY() && this._minx === e.getMinX() && this._miny === e.getMinY()
  9916. }, Ll.prototype.intersection = function (t) {
  9917. if (this.isNull() || t.isNull() || !this.intersects(t)) return new Ll;
  9918. var e = this._minx > t._minx ? this._minx : t._minx,
  9919. n = this._miny > t._miny ? this._miny : t._miny,
  9920. r = this._maxx < t._maxx ? this._maxx : t._maxx,
  9921. i = this._maxy < t._maxy ? this._maxy : t._maxy;
  9922. return new Ll(e, r, n, i)
  9923. }, Ll.prototype.isNull = function () {
  9924. return this._maxx < this._minx
  9925. }, Ll.prototype.getMaxX = function () {
  9926. return this._maxx
  9927. }, Ll.prototype.covers = function () {
  9928. if (1 === arguments.length) {
  9929. if (arguments[0] instanceof ul) {
  9930. var t = arguments[0];
  9931. return this.covers(t.x, t.y)
  9932. }
  9933. if (arguments[0] instanceof Ll) {
  9934. var e = arguments[0];
  9935. return !this.isNull() && !e.isNull() && (e.getMinX() >= this._minx && e.getMaxX() <= this._maxx && e.getMinY() >= this._miny && e.getMaxY() <= this._maxy)
  9936. }
  9937. } else if (2 === arguments.length) {
  9938. var n = arguments[0],
  9939. r = arguments[1];
  9940. return !this.isNull() && (n >= this._minx && n <= this._maxx && r >= this._miny && r <= this._maxy)
  9941. }
  9942. }, Ll.prototype.intersects = function () {
  9943. if (1 === arguments.length) {
  9944. if (arguments[0] instanceof Ll) {
  9945. var t = arguments[0];
  9946. return !this.isNull() && !t.isNull() && !(t._minx > this._maxx || t._maxx < this._minx || t._miny > this._maxy || t._maxy < this._miny)
  9947. }
  9948. if (arguments[0] instanceof ul) {
  9949. var e = arguments[0];
  9950. return this.intersects(e.x, e.y)
  9951. }
  9952. } else if (2 === arguments.length) {
  9953. var n = arguments[0],
  9954. r = arguments[1];
  9955. return !this.isNull() && !(n > this._maxx || n < this._minx || r > this._maxy || r < this._miny)
  9956. }
  9957. }, Ll.prototype.getMinY = function () {
  9958. return this._miny
  9959. }, Ll.prototype.getMinX = function () {
  9960. return this._minx
  9961. }, Ll.prototype.expandToInclude = function () {
  9962. if (1 === arguments.length) {
  9963. if (arguments[0] instanceof ul) {
  9964. var t = arguments[0];
  9965. this.expandToInclude(t.x, t.y)
  9966. } else if (arguments[0] instanceof Ll) {
  9967. var e = arguments[0];
  9968. if (e.isNull()) return null;
  9969. this.isNull() ? (this._minx = e.getMinX(), this._maxx = e.getMaxX(), this._miny = e.getMinY(), this._maxy = e.getMaxY()) : (e._minx < this._minx && (this._minx = e._minx), e._maxx > this._maxx && (this._maxx = e._maxx), e._miny < this._miny && (this._miny = e._miny), e._maxy > this._maxy && (this._maxy = e._maxy))
  9970. }
  9971. } else if (2 === arguments.length) {
  9972. var n = arguments[0],
  9973. r = arguments[1];
  9974. this.isNull() ? (this._minx = n, this._maxx = n, this._miny = r, this._maxy = r) : (n < this._minx && (this._minx = n), n > this._maxx && (this._maxx = n), r < this._miny && (this._miny = r), r > this._maxy && (this._maxy = r))
  9975. }
  9976. }, Ll.prototype.minExtent = function () {
  9977. if (this.isNull()) return 0;
  9978. var t = this.getWidth(),
  9979. e = this.getHeight();
  9980. return t < e ? t : e
  9981. }, Ll.prototype.getWidth = function () {
  9982. return this.isNull() ? 0 : this._maxx - this._minx
  9983. }, Ll.prototype.compareTo = function (t) {
  9984. var e = t;
  9985. return this.isNull() ? e.isNull() ? 0 : -1 : e.isNull() ? 1 : this._minx < e._minx ? -1 : this._minx > e._minx ? 1 : this._miny < e._miny ? -1 : this._miny > e._miny ? 1 : this._maxx < e._maxx ? -1 : this._maxx > e._maxx ? 1 : this._maxy < e._maxy ? -1 : this._maxy > e._maxy ? 1 : 0
  9986. }, Ll.prototype.translate = function (t, e) {
  9987. if (this.isNull()) return null;
  9988. this.init(this.getMinX() + t, this.getMaxX() + t, this.getMinY() + e, this.getMaxY() + e)
  9989. }, Ll.prototype.toString = function () {
  9990. return "Env[" + this._minx + " : " + this._maxx + ", " + this._miny + " : " + this._maxy + "]"
  9991. }, Ll.prototype.setToNull = function () {
  9992. this._minx = 0, this._maxx = -1, this._miny = 0, this._maxy = -1
  9993. }, Ll.prototype.getHeight = function () {
  9994. return this.isNull() ? 0 : this._maxy - this._miny
  9995. }, Ll.prototype.maxExtent = function () {
  9996. if (this.isNull()) return 0;
  9997. var t = this.getWidth(),
  9998. e = this.getHeight();
  9999. return t > e ? t : e
  10000. }, Ll.prototype.expandBy = function () {
  10001. if (1 === arguments.length) {
  10002. var t = arguments[0];
  10003. this.expandBy(t, t)
  10004. } else if (2 === arguments.length) {
  10005. var e = arguments[0],
  10006. n = arguments[1];
  10007. if (this.isNull()) return null;
  10008. this._minx -= e, this._maxx += e, this._miny -= n, this._maxy += n, (this._minx > this._maxx || this._miny > this._maxy) && this.setToNull()
  10009. }
  10010. }, Ll.prototype.contains = function () {
  10011. if (1 === arguments.length) {
  10012. if (arguments[0] instanceof Ll) {
  10013. var t = arguments[0];
  10014. return this.covers(t)
  10015. }
  10016. if (arguments[0] instanceof ul) {
  10017. var e = arguments[0];
  10018. return this.covers(e)
  10019. }
  10020. } else if (2 === arguments.length) {
  10021. var n = arguments[0],
  10022. r = arguments[1];
  10023. return this.covers(n, r)
  10024. }
  10025. }, Ll.prototype.centre = function () {
  10026. return this.isNull() ? null : new ul((this.getMinX() + this.getMaxX()) / 2, (this.getMinY() + this.getMaxY()) / 2)
  10027. }, Ll.prototype.init = function () {
  10028. if (0 === arguments.length) this.setToNull();
  10029. else if (1 === arguments.length) {
  10030. if (arguments[0] instanceof ul) {
  10031. var t = arguments[0];
  10032. this.init(t.x, t.x, t.y, t.y)
  10033. } else if (arguments[0] instanceof Ll) {
  10034. var e = arguments[0];
  10035. this._minx = e._minx, this._maxx = e._maxx, this._miny = e._miny, this._maxy = e._maxy
  10036. }
  10037. } else if (2 === arguments.length) {
  10038. var n = arguments[0],
  10039. r = arguments[1];
  10040. this.init(n.x, r.x, n.y, r.y)
  10041. } else if (4 === arguments.length) {
  10042. var i = arguments[0],
  10043. o = arguments[1],
  10044. s = arguments[2],
  10045. a = arguments[3];
  10046. i < o ? (this._minx = i, this._maxx = o) : (this._minx = o, this._maxx = i), s < a ? (this._miny = s, this._maxy = a) : (this._miny = a, this._maxy = s)
  10047. }
  10048. }, Ll.prototype.getMaxY = function () {
  10049. return this._maxy
  10050. }, Ll.prototype.distance = function (t) {
  10051. if (this.intersects(t)) return 0;
  10052. var e = 0;
  10053. this._maxx < t._minx ? e = t._minx - this._maxx : this._minx > t._maxx && (e = this._minx - t._maxx);
  10054. var n = 0;
  10055. return this._maxy < t._miny ? n = t._miny - this._maxy : this._miny > t._maxy && (n = this._miny - t._maxy), 0 === e ? n : 0 === n ? e : Math.sqrt(e * e + n * n)
  10056. }, Ll.prototype.hashCode = function () {
  10057. var t = 17;
  10058. return t = 37 * (t = 37 * (t = 37 * (t = 37 * t + ul.hashCode(this._minx)) + ul.hashCode(this._maxx)) + ul.hashCode(this._miny)) + ul.hashCode(this._maxy)
  10059. }, Ll.prototype.interfaces_ = function () {
  10060. return [il, al]
  10061. }, Ll.prototype.getClass = function () {
  10062. return Ll
  10063. }, Ll.intersects = function () {
  10064. if (3 === arguments.length) {
  10065. var t = arguments[0],
  10066. e = arguments[1],
  10067. n = arguments[2];
  10068. return n.x >= (t.x < e.x ? t.x : e.x) && n.x <= (t.x > e.x ? t.x : e.x) && n.y >= (t.y < e.y ? t.y : e.y) && n.y <= (t.y > e.y ? t.y : e.y)
  10069. }
  10070. if (4 === arguments.length) {
  10071. var r = arguments[0],
  10072. i = arguments[1],
  10073. o = arguments[2],
  10074. s = arguments[3],
  10075. a = Math.min(o.x, s.x),
  10076. u = Math.max(o.x, s.x),
  10077. l = Math.min(r.x, i.x),
  10078. c = Math.max(r.x, i.x);
  10079. return !(l > u) && (!(c < a) && (a = Math.min(o.y, s.y), u = Math.max(o.y, s.y), l = Math.min(r.y, i.y), c = Math.max(r.y, i.y), !(l > u) && !(c < a)))
  10080. }
  10081. }, Ol.serialVersionUID.get = function () {
  10082. return 0x51845cd552189800
  10083. }, Object.defineProperties(Ll, Ol);
  10084. var Rl = {
  10085. typeStr: /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  10086. emptyTypeStr: /^\s*(\w+)\s*EMPTY\s*$/,
  10087. spaces: /\s+/,
  10088. parenComma: /\)\s*,\s*\(/,
  10089. doubleParenComma: /\)\s*\)\s*,\s*\(\s*\(/,
  10090. trimParens: /^\s*\(?(.*?)\)?\s*$/
  10091. },
  10092. Tl = function (t) {
  10093. this.geometryFactory = t || new _h
  10094. };
  10095. Tl.prototype.read = function (t) {
  10096. var e, n, r;
  10097. t = t.replace(/[\n\r]/g, " ");
  10098. var i = Rl.typeStr.exec(t);
  10099. if (-1 !== t.search("EMPTY") && ((i = Rl.emptyTypeStr.exec(t))[2] = void 0), i && (n = i[1].toLowerCase(), r = i[2], Dl[n] && (e = Dl[n].apply(this, [r]))), void 0 === e) throw new Error("Could not parse WKT " + t);
  10100. return e
  10101. }, Tl.prototype.write = function (t) {
  10102. return this.extractGeometry(t)
  10103. }, Tl.prototype.extractGeometry = function (t) {
  10104. var e = t.getGeometryType().toLowerCase();
  10105. if (!Al[e]) return null;
  10106. var n = e.toUpperCase();
  10107. return t.isEmpty() ? n + " EMPTY" : n + "(" + Al[e].apply(this, [t]) + ")"
  10108. };
  10109. var Al = {
  10110. coordinate: function (t) {
  10111. return t.x + " " + t.y
  10112. },
  10113. point: function (t) {
  10114. return Al.coordinate.call(this, t._coordinates._coordinates[0])
  10115. },
  10116. multipoint: function (t) {
  10117. for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push("(" + Al.point.apply(this, [t._geometries[n]]) + ")");
  10118. return e.join(",")
  10119. },
  10120. linestring: function (t) {
  10121. for (var e = [], n = 0, r = t._points._coordinates.length; n < r; ++n) e.push(Al.coordinate.apply(this, [t._points._coordinates[n]]));
  10122. return e.join(",")
  10123. },
  10124. linearring: function (t) {
  10125. for (var e = [], n = 0, r = t._points._coordinates.length; n < r; ++n) e.push(Al.coordinate.apply(this, [t._points._coordinates[n]]));
  10126. return e.join(",")
  10127. },
  10128. multilinestring: function (t) {
  10129. for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push("(" + Al.linestring.apply(this, [t._geometries[n]]) + ")");
  10130. return e.join(",")
  10131. },
  10132. polygon: function (t) {
  10133. var e = [];
  10134. e.push("(" + Al.linestring.apply(this, [t._shell]) + ")");
  10135. for (var n = 0, r = t._holes.length; n < r; ++n) e.push("(" + Al.linestring.apply(this, [t._holes[n]]) + ")");
  10136. return e.join(",")
  10137. },
  10138. multipolygon: function (t) {
  10139. for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push("(" + Al.polygon.apply(this, [t._geometries[n]]) + ")");
  10140. return e.join(",")
  10141. },
  10142. geometrycollection: function (t) {
  10143. for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push(this.extractGeometry(t._geometries[n]));
  10144. return e.join(",")
  10145. }
  10146. },
  10147. Dl = {
  10148. point: function (t) {
  10149. if (void 0 === t) return this.geometryFactory.createPoint();
  10150. var e = t.trim().split(Rl.spaces);
  10151. return this.geometryFactory.createPoint(new ul(Number.parseFloat(e[0]), Number.parseFloat(e[1])))
  10152. },
  10153. multipoint: function (t) {
  10154. var e;
  10155. if (void 0 === t) return this.geometryFactory.createMultiPoint();
  10156. for (var n = t.trim().split(","), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].replace(Rl.trimParens, "$1"), r.push(Dl.point.apply(this, [e]));
  10157. return this.geometryFactory.createMultiPoint(r)
  10158. },
  10159. linestring: function (t) {
  10160. if (void 0 === t) return this.geometryFactory.createLineString();
  10161. for (var e, n = t.trim().split(","), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].trim().split(Rl.spaces), r.push(new ul(Number.parseFloat(e[0]), Number.parseFloat(e[1])));
  10162. return this.geometryFactory.createLineString(r)
  10163. },
  10164. linearring: function (t) {
  10165. if (void 0 === t) return this.geometryFactory.createLinearRing();
  10166. for (var e, n = t.trim().split(","), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].trim().split(Rl.spaces), r.push(new ul(Number.parseFloat(e[0]), Number.parseFloat(e[1])));
  10167. return this.geometryFactory.createLinearRing(r)
  10168. },
  10169. multilinestring: function (t) {
  10170. var e;
  10171. if (void 0 === t) return this.geometryFactory.createMultiLineString();
  10172. for (var n = t.trim().split(Rl.parenComma), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].replace(Rl.trimParens, "$1"), r.push(Dl.linestring.apply(this, [e]));
  10173. return this.geometryFactory.createMultiLineString(r)
  10174. },
  10175. polygon: function (t) {
  10176. var e, n, r;
  10177. if (void 0 === t) return this.geometryFactory.createPolygon();
  10178. for (var i, o = t.trim().split(Rl.parenComma), s = [], a = 0, u = o.length; a < u; ++a) e = o[a].replace(Rl.trimParens, "$1"), n = Dl.linestring.apply(this, [e]), r = this.geometryFactory.createLinearRing(n._points), 0 === a ? i = r : s.push(r);
  10179. return this.geometryFactory.createPolygon(i, s)
  10180. },
  10181. multipolygon: function (t) {
  10182. var e;
  10183. if (void 0 === t) return this.geometryFactory.createMultiPolygon();
  10184. for (var n = t.trim().split(Rl.doubleParenComma), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].replace(Rl.trimParens, "$1"), r.push(Dl.polygon.apply(this, [e]));
  10185. return this.geometryFactory.createMultiPolygon(r)
  10186. },
  10187. geometrycollection: function (t) {
  10188. if (void 0 === t) return this.geometryFactory.createGeometryCollection();
  10189. for (var e = (t = t.replace(/,\s*([A-Za-z])/g, "|$1")).trim().split("|"), n = [], r = 0, i = e.length; r < i; ++r) n.push(this.read(e[r]));
  10190. return this.geometryFactory.createGeometryCollection(n)
  10191. }
  10192. },
  10193. Fl = function (t) {
  10194. this.parser = new Tl(t)
  10195. };
  10196. Fl.prototype.write = function (t) {
  10197. return this.parser.write(t)
  10198. }, Fl.toLineString = function (t, e) {
  10199. if (2 !== arguments.length) throw new Error("Not implemented");
  10200. return "LINESTRING ( " + t.x + " " + t.y + ", " + e.x + " " + e.y + " )"
  10201. };
  10202. var kl = function (t) {
  10203. function e(e) {
  10204. t.call(this, e), this.name = "RuntimeException", this.message = e, this.stack = (new t).stack
  10205. }
  10206. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e
  10207. }(Error),
  10208. Gl = function (t) {
  10209. function e() {
  10210. if (t.call(this), 0 === arguments.length) t.call(this);
  10211. else if (1 === arguments.length) {
  10212. var e = arguments[0];
  10213. t.call(this, e)
  10214. }
  10215. }
  10216. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.interfaces_ = function () {
  10217. return []
  10218. }, e.prototype.getClass = function () {
  10219. return e
  10220. }, e
  10221. }(kl),
  10222. ql = function () {};
  10223. ql.prototype.interfaces_ = function () {
  10224. return []
  10225. }, ql.prototype.getClass = function () {
  10226. return ql
  10227. }, ql.shouldNeverReachHere = function () {
  10228. if (0 === arguments.length) ql.shouldNeverReachHere(null);
  10229. else if (1 === arguments.length) {
  10230. var t = arguments[0];
  10231. throw new Gl("Should never reach here" + (null !== t ? ": " + t : ""))
  10232. }
  10233. }, ql.isTrue = function () {
  10234. var t;
  10235. if (1 === arguments.length) ql.isTrue(arguments[0], null);
  10236. else if (2 === arguments.length && (t = arguments[1], !arguments[0])) throw null === t ? new Gl : new Gl(t)
  10237. }, ql.equals = function () {
  10238. var t, e, n;
  10239. if (2 === arguments.length) ql.equals(t = arguments[0], e = arguments[1], null);
  10240. else if (3 === arguments.length && (t = arguments[0], n = arguments[2], !(e = arguments[1]).equals(t))) throw new Gl("Expected " + t + " but encountered " + e + (null !== n ? ": " + n : ""))
  10241. };
  10242. var Bl = function () {
  10243. this._result = null, this._inputLines = Array(2).fill().map((function () {
  10244. return Array(2)
  10245. })), this._intPt = new Array(2).fill(null), this._intLineIndex = null, this._isProper = null, this._pa = null, this._pb = null, this._precisionModel = null, this._intPt[0] = new ul, this._intPt[1] = new ul, this._pa = this._intPt[0], this._pb = this._intPt[1], this._result = 0
  10246. },
  10247. zl = {
  10248. DONT_INTERSECT: {
  10249. configurable: !0
  10250. },
  10251. DO_INTERSECT: {
  10252. configurable: !0
  10253. },
  10254. COLLINEAR: {
  10255. configurable: !0
  10256. },
  10257. NO_INTERSECTION: {
  10258. configurable: !0
  10259. },
  10260. POINT_INTERSECTION: {
  10261. configurable: !0
  10262. },
  10263. COLLINEAR_INTERSECTION: {
  10264. configurable: !0
  10265. }
  10266. };
  10267. Bl.prototype.getIndexAlongSegment = function (t, e) {
  10268. return this.computeIntLineIndex(), this._intLineIndex[t][e]
  10269. }, Bl.prototype.getTopologySummary = function () {
  10270. var t = new vl;
  10271. return this.isEndPoint() && t.append(" endpoint"), this._isProper && t.append(" proper"), this.isCollinear() && t.append(" collinear"), t.toString()
  10272. }, Bl.prototype.computeIntersection = function (t, e, n, r) {
  10273. this._inputLines[0][0] = t, this._inputLines[0][1] = e, this._inputLines[1][0] = n, this._inputLines[1][1] = r, this._result = this.computeIntersect(t, e, n, r)
  10274. }, Bl.prototype.getIntersectionNum = function () {
  10275. return this._result
  10276. }, Bl.prototype.computeIntLineIndex = function () {
  10277. if (0 === arguments.length) null === this._intLineIndex && (this._intLineIndex = Array(2).fill().map((function () {
  10278. return Array(2)
  10279. })), this.computeIntLineIndex(0), this.computeIntLineIndex(1));
  10280. else if (1 === arguments.length) {
  10281. var t = arguments[0],
  10282. e = this.getEdgeDistance(t, 0),
  10283. n = this.getEdgeDistance(t, 1);
  10284. e > n ? (this._intLineIndex[t][0] = 0, this._intLineIndex[t][1] = 1) : (this._intLineIndex[t][0] = 1, this._intLineIndex[t][1] = 0)
  10285. }
  10286. }, Bl.prototype.isProper = function () {
  10287. return this.hasIntersection() && this._isProper
  10288. }, Bl.prototype.setPrecisionModel = function (t) {
  10289. this._precisionModel = t
  10290. }, Bl.prototype.isInteriorIntersection = function () {
  10291. var t = this;
  10292. if (0 === arguments.length) return !!this.isInteriorIntersection(0) || !!this.isInteriorIntersection(1);
  10293. if (1 === arguments.length) {
  10294. for (var e = arguments[0], n = 0; n < this._result; n++)
  10295. if (!t._intPt[n].equals2D(t._inputLines[e][0]) && !t._intPt[n].equals2D(t._inputLines[e][1])) return !0;
  10296. return !1
  10297. }
  10298. }, Bl.prototype.getIntersection = function (t) {
  10299. return this._intPt[t]
  10300. }, Bl.prototype.isEndPoint = function () {
  10301. return this.hasIntersection() && !this._isProper
  10302. }, Bl.prototype.hasIntersection = function () {
  10303. return this._result !== Bl.NO_INTERSECTION
  10304. }, Bl.prototype.getEdgeDistance = function (t, e) {
  10305. return Bl.computeEdgeDistance(this._intPt[e], this._inputLines[t][0], this._inputLines[t][1])
  10306. }, Bl.prototype.isCollinear = function () {
  10307. return this._result === Bl.COLLINEAR_INTERSECTION
  10308. }, Bl.prototype.toString = function () {
  10309. return Fl.toLineString(this._inputLines[0][0], this._inputLines[0][1]) + " - " + Fl.toLineString(this._inputLines[1][0], this._inputLines[1][1]) + this.getTopologySummary()
  10310. }, Bl.prototype.getEndpoint = function (t, e) {
  10311. return this._inputLines[t][e]
  10312. }, Bl.prototype.isIntersection = function (t) {
  10313. for (var e = 0; e < this._result; e++)
  10314. if (this._intPt[e].equals2D(t)) return !0;
  10315. return !1
  10316. }, Bl.prototype.getIntersectionAlongSegment = function (t, e) {
  10317. return this.computeIntLineIndex(), this._intPt[this._intLineIndex[t][e]]
  10318. }, Bl.prototype.interfaces_ = function () {
  10319. return []
  10320. }, Bl.prototype.getClass = function () {
  10321. return Bl
  10322. }, Bl.computeEdgeDistance = function (t, e, n) {
  10323. var r = Math.abs(n.x - e.x),
  10324. i = Math.abs(n.y - e.y),
  10325. o = -1;
  10326. if (t.equals(e)) o = 0;
  10327. else if (t.equals(n)) o = r > i ? r : i;
  10328. else {
  10329. var s = Math.abs(t.x - e.x),
  10330. a = Math.abs(t.y - e.y);
  10331. 0 !== (o = r > i ? s : a) || t.equals(e) || (o = Math.max(s, a))
  10332. }
  10333. return ql.isTrue(!(0 === o && !t.equals(e)), "Bad distance calculation"), o
  10334. }, Bl.nonRobustComputeEdgeDistance = function (t, e, n) {
  10335. var r = t.x - e.x,
  10336. i = t.y - e.y,
  10337. o = Math.sqrt(r * r + i * i);
  10338. return ql.isTrue(!(0 === o && !t.equals(e)), "Invalid distance calculation"), o
  10339. }, zl.DONT_INTERSECT.get = function () {
  10340. return 0
  10341. }, zl.DO_INTERSECT.get = function () {
  10342. return 1
  10343. }, zl.COLLINEAR.get = function () {
  10344. return 2
  10345. }, zl.NO_INTERSECTION.get = function () {
  10346. return 0
  10347. }, zl.POINT_INTERSECTION.get = function () {
  10348. return 1
  10349. }, zl.COLLINEAR_INTERSECTION.get = function () {
  10350. return 2
  10351. }, Object.defineProperties(Bl, zl);
  10352. var jl = function (t) {
  10353. function e() {
  10354. t.apply(this, arguments)
  10355. }
  10356. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.isInSegmentEnvelopes = function (t) {
  10357. var e = new Ll(this._inputLines[0][0], this._inputLines[0][1]),
  10358. n = new Ll(this._inputLines[1][0], this._inputLines[1][1]);
  10359. return e.contains(t) && n.contains(t)
  10360. }, e.prototype.computeIntersection = function () {
  10361. if (3 !== arguments.length) return t.prototype.computeIntersection.apply(this, arguments);
  10362. var e = arguments[0],
  10363. n = arguments[1],
  10364. r = arguments[2];
  10365. if (this._isProper = !1, Ll.intersects(n, r, e) && 0 === Xl.orientationIndex(n, r, e) && 0 === Xl.orientationIndex(r, n, e)) return this._isProper = !0, (e.equals(n) || e.equals(r)) && (this._isProper = !1), this._result = t.POINT_INTERSECTION, null;
  10366. this._result = t.NO_INTERSECTION
  10367. }, e.prototype.normalizeToMinimum = function (t, e, n, r, i) {
  10368. i.x = this.smallestInAbsValue(t.x, e.x, n.x, r.x), i.y = this.smallestInAbsValue(t.y, e.y, n.y, r.y), t.x -= i.x, t.y -= i.y, e.x -= i.x, e.y -= i.y, n.x -= i.x, n.y -= i.y, r.x -= i.x, r.y -= i.y
  10369. }, e.prototype.safeHCoordinateIntersection = function (t, n, r, i) {
  10370. var o = null;
  10371. try {
  10372. o = Ml.intersection(t, n, r, i)
  10373. } catch (s) {
  10374. if (!(s instanceof Cl)) throw s;
  10375. o = e.nearestEndpoint(t, n, r, i)
  10376. }
  10377. return o
  10378. }, e.prototype.intersection = function (t, n, r, i) {
  10379. var o = this.intersectionWithNormalization(t, n, r, i);
  10380. return this.isInSegmentEnvelopes(o) || (o = new ul(e.nearestEndpoint(t, n, r, i))), null !== this._precisionModel && this._precisionModel.makePrecise(o), o
  10381. }, e.prototype.smallestInAbsValue = function (t, e, n, r) {
  10382. var i = t,
  10383. o = Math.abs(i);
  10384. return Math.abs(e) < o && (i = e, o = Math.abs(e)), Math.abs(n) < o && (i = n, o = Math.abs(n)), Math.abs(r) < o && (i = r), i
  10385. }, e.prototype.checkDD = function (t, e, n, r, i) {
  10386. var o = bl.intersection(t, e, n, r),
  10387. s = this.isInSegmentEnvelopes(o);
  10388. Pl.out.println("DD in env = " + s + " --------------------- " + o), i.distance(o) > 1e-4 && Pl.out.println("Distance = " + i.distance(o))
  10389. }, e.prototype.intersectionWithNormalization = function (t, e, n, r) {
  10390. var i = new ul(t),
  10391. o = new ul(e),
  10392. s = new ul(n),
  10393. a = new ul(r),
  10394. u = new ul;
  10395. this.normalizeToEnvCentre(i, o, s, a, u);
  10396. var l = this.safeHCoordinateIntersection(i, o, s, a);
  10397. return l.x += u.x, l.y += u.y, l
  10398. }, e.prototype.computeCollinearIntersection = function (e, n, r, i) {
  10399. var o = Ll.intersects(e, n, r),
  10400. s = Ll.intersects(e, n, i),
  10401. a = Ll.intersects(r, i, e),
  10402. u = Ll.intersects(r, i, n);
  10403. return o && s ? (this._intPt[0] = r, this._intPt[1] = i, t.COLLINEAR_INTERSECTION) : a && u ? (this._intPt[0] = e, this._intPt[1] = n, t.COLLINEAR_INTERSECTION) : o && a ? (this._intPt[0] = r, this._intPt[1] = e, !r.equals(e) || s || u ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : o && u ? (this._intPt[0] = r, this._intPt[1] = n, !r.equals(n) || s || a ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : s && a ? (this._intPt[0] = i, this._intPt[1] = e, !i.equals(e) || o || u ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : s && u ? (this._intPt[0] = i, this._intPt[1] = n, !i.equals(n) || o || a ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : t.NO_INTERSECTION
  10404. }, e.prototype.normalizeToEnvCentre = function (t, e, n, r, i) {
  10405. var o = t.x < e.x ? t.x : e.x,
  10406. s = t.y < e.y ? t.y : e.y,
  10407. a = t.x > e.x ? t.x : e.x,
  10408. u = t.y > e.y ? t.y : e.y,
  10409. l = n.x < r.x ? n.x : r.x,
  10410. c = n.y < r.y ? n.y : r.y,
  10411. h = n.x > r.x ? n.x : r.x,
  10412. p = n.y > r.y ? n.y : r.y,
  10413. f = ((o > l ? o : l) + (a < h ? a : h)) / 2,
  10414. g = ((s > c ? s : c) + (u < p ? u : p)) / 2;
  10415. i.x = f, i.y = g, t.x -= i.x, t.y -= i.y, e.x -= i.x, e.y -= i.y, n.x -= i.x, n.y -= i.y, r.x -= i.x, r.y -= i.y
  10416. }, e.prototype.computeIntersect = function (e, n, r, i) {
  10417. if (this._isProper = !1, !Ll.intersects(e, n, r, i)) return t.NO_INTERSECTION;
  10418. var o = Xl.orientationIndex(e, n, r),
  10419. s = Xl.orientationIndex(e, n, i);
  10420. if (o > 0 && s > 0 || o < 0 && s < 0) return t.NO_INTERSECTION;
  10421. var a = Xl.orientationIndex(r, i, e),
  10422. u = Xl.orientationIndex(r, i, n);
  10423. return a > 0 && u > 0 || a < 0 && u < 0 ? t.NO_INTERSECTION : 0 === o && 0 === s && 0 === a && 0 === u ? this.computeCollinearIntersection(e, n, r, i) : (0 === o || 0 === s || 0 === a || 0 === u ? (this._isProper = !1, e.equals2D(r) || e.equals2D(i) ? this._intPt[0] = e : n.equals2D(r) || n.equals2D(i) ? this._intPt[0] = n : 0 === o ? this._intPt[0] = new ul(r) : 0 === s ? this._intPt[0] = new ul(i) : 0 === a ? this._intPt[0] = new ul(e) : 0 === u && (this._intPt[0] = new ul(n))) : (this._isProper = !0, this._intPt[0] = this.intersection(e, n, r, i)), t.POINT_INTERSECTION)
  10424. }, e.prototype.interfaces_ = function () {
  10425. return []
  10426. }, e.prototype.getClass = function () {
  10427. return e
  10428. }, e.nearestEndpoint = function (t, e, n, r) {
  10429. var i = t,
  10430. o = Xl.distancePointLine(t, n, r),
  10431. s = Xl.distancePointLine(e, n, r);
  10432. return s < o && (o = s, i = e), (s = Xl.distancePointLine(n, t, e)) < o && (o = s, i = n), (s = Xl.distancePointLine(r, t, e)) < o && (o = s, i = r), i
  10433. }, e
  10434. }(Bl),
  10435. Ul = function () {};
  10436. Ul.prototype.interfaces_ = function () {
  10437. return []
  10438. }, Ul.prototype.getClass = function () {
  10439. return Ul
  10440. }, Ul.orientationIndex = function (t, e, n) {
  10441. var r = e.x - t.x,
  10442. i = e.y - t.y,
  10443. o = n.x - e.x,
  10444. s = n.y - e.y;
  10445. return Ul.signOfDet2x2(r, i, o, s)
  10446. }, Ul.signOfDet2x2 = function (t, e, n, r) {
  10447. var i = null,
  10448. o = null,
  10449. s = null;
  10450. if (i = 1, 0 === t || 0 === r) return 0 === e || 0 === n ? 0 : e > 0 ? n > 0 ? -i : i : n > 0 ? i : -i;
  10451. if (0 === e || 0 === n) return r > 0 ? t > 0 ? i : -i : t > 0 ? -i : i;
  10452. if (e > 0 ? r > 0 ? e <= r || (i = -i, o = t, t = n, n = o, o = e, e = r, r = o) : e <= -r ? (i = -i, n = -n, r = -r) : (o = t, t = -n, n = o, o = e, e = -r, r = o) : r > 0 ? -e <= r ? (i = -i, t = -t, e = -e) : (o = -t, t = n, n = o, o = -e, e = r, r = o) : e >= r ? (t = -t, e = -e, n = -n, r = -r) : (i = -i, o = -t, t = -n, n = o, o = -e, e = -r, r = o), t > 0) {
  10453. if (!(n > 0)) return i;
  10454. if (!(t <= n)) return i
  10455. } else {
  10456. if (n > 0) return -i;
  10457. if (!(t >= n)) return -i;
  10458. i = -i, t = -t, n = -n
  10459. }
  10460. for (;;) {
  10461. if ((r -= (s = Math.floor(n / t)) * e) < 0) return -i;
  10462. if (r > e) return i;
  10463. if (t > (n -= s * t) + n) {
  10464. if (e < r + r) return i
  10465. } else {
  10466. if (e > r + r) return -i;
  10467. n = t - n, r = e - r, i = -i
  10468. }
  10469. if (0 === r) return 0 === n ? 0 : -i;
  10470. if (0 === n) return i;
  10471. if ((e -= (s = Math.floor(t / n)) * r) < 0) return i;
  10472. if (e > r) return -i;
  10473. if (n > (t -= s * n) + t) {
  10474. if (r < e + e) return -i
  10475. } else {
  10476. if (r > e + e) return i;
  10477. t = n - t, e = r - e, i = -i
  10478. }
  10479. if (0 === e) return 0 === t ? 0 : i;
  10480. if (0 === t) return -i
  10481. }
  10482. };
  10483. var Vl = function () {
  10484. this._p = null, this._crossingCount = 0, this._isPointOnSegment = !1;
  10485. var t = arguments[0];
  10486. this._p = t
  10487. };
  10488. Vl.prototype.countSegment = function (t, e) {
  10489. if (t.x < this._p.x && e.x < this._p.x) return null;
  10490. if (this._p.x === e.x && this._p.y === e.y) return this._isPointOnSegment = !0, null;
  10491. if (t.y === this._p.y && e.y === this._p.y) {
  10492. var n = t.x,
  10493. r = e.x;
  10494. return n > r && (n = e.x, r = t.x), this._p.x >= n && this._p.x <= r && (this._isPointOnSegment = !0), null
  10495. }
  10496. if (t.y > this._p.y && e.y <= this._p.y || e.y > this._p.y && t.y <= this._p.y) {
  10497. var i = t.x - this._p.x,
  10498. o = t.y - this._p.y,
  10499. s = e.x - this._p.x,
  10500. a = e.y - this._p.y,
  10501. u = Ul.signOfDet2x2(i, o, s, a);
  10502. if (0 === u) return this._isPointOnSegment = !0, null;
  10503. a < o && (u = -u), u > 0 && this._crossingCount++
  10504. }
  10505. }, Vl.prototype.isPointInPolygon = function () {
  10506. return this.getLocation() !== pl.EXTERIOR
  10507. }, Vl.prototype.getLocation = function () {
  10508. return this._isPointOnSegment ? pl.BOUNDARY : this._crossingCount % 2 == 1 ? pl.INTERIOR : pl.EXTERIOR
  10509. }, Vl.prototype.isOnSegment = function () {
  10510. return this._isPointOnSegment
  10511. }, Vl.prototype.interfaces_ = function () {
  10512. return []
  10513. }, Vl.prototype.getClass = function () {
  10514. return Vl
  10515. }, Vl.locatePointInRing = function () {
  10516. if (arguments[0] instanceof ul && gl(arguments[1], Il)) {
  10517. for (var t = arguments[0], e = arguments[1], n = new Vl(t), r = new ul, i = new ul, o = 1; o < e.size(); o++)
  10518. if (e.getCoordinate(o, r), e.getCoordinate(o - 1, i), n.countSegment(r, i), n.isOnSegment()) return n.getLocation();
  10519. return n.getLocation()
  10520. }
  10521. if (arguments[0] instanceof ul && arguments[1] instanceof Array) {
  10522. for (var s = arguments[0], a = arguments[1], u = new Vl(s), l = 1; l < a.length; l++) {
  10523. var c = a[l],
  10524. h = a[l - 1];
  10525. if (u.countSegment(c, h), u.isOnSegment()) return u.getLocation()
  10526. }
  10527. return u.getLocation()
  10528. }
  10529. };
  10530. var Xl = function () {},
  10531. Yl = {
  10532. CLOCKWISE: {
  10533. configurable: !0
  10534. },
  10535. RIGHT: {
  10536. configurable: !0
  10537. },
  10538. COUNTERCLOCKWISE: {
  10539. configurable: !0
  10540. },
  10541. LEFT: {
  10542. configurable: !0
  10543. },
  10544. COLLINEAR: {
  10545. configurable: !0
  10546. },
  10547. STRAIGHT: {
  10548. configurable: !0
  10549. }
  10550. };
  10551. Xl.prototype.interfaces_ = function () {
  10552. return []
  10553. }, Xl.prototype.getClass = function () {
  10554. return Xl
  10555. }, Xl.orientationIndex = function (t, e, n) {
  10556. return bl.orientationIndex(t, e, n)
  10557. }, Xl.signedArea = function () {
  10558. if (arguments[0] instanceof Array) {
  10559. var t = arguments[0];
  10560. if (t.length < 3) return 0;
  10561. for (var e = 0, n = t[0].x, r = 1; r < t.length - 1; r++) {
  10562. var i = t[r].x - n,
  10563. o = t[r + 1].y,
  10564. s = t[r - 1].y;
  10565. e += i * (s - o)
  10566. }
  10567. return e / 2
  10568. }
  10569. if (gl(arguments[0], Il)) {
  10570. var a = arguments[0],
  10571. u = a.size();
  10572. if (u < 3) return 0;
  10573. var l = new ul,
  10574. c = new ul,
  10575. h = new ul;
  10576. a.getCoordinate(0, c), a.getCoordinate(1, h);
  10577. var p = c.x;
  10578. h.x -= p;
  10579. for (var f = 0, g = 1; g < u - 1; g++) l.y = c.y, c.x = h.x, c.y = h.y, a.getCoordinate(g + 1, h), h.x -= p, f += c.x * (l.y - h.y);
  10580. return f / 2
  10581. }
  10582. }, Xl.distanceLineLine = function (t, e, n, r) {
  10583. if (t.equals(e)) return Xl.distancePointLine(t, n, r);
  10584. if (n.equals(r)) return Xl.distancePointLine(r, t, e);
  10585. var i = !1;
  10586. if (Ll.intersects(t, e, n, r)) {
  10587. var o = (e.x - t.x) * (r.y - n.y) - (e.y - t.y) * (r.x - n.x);
  10588. if (0 === o) i = !0;
  10589. else {
  10590. var s = (t.y - n.y) * (r.x - n.x) - (t.x - n.x) * (r.y - n.y),
  10591. a = ((t.y - n.y) * (e.x - t.x) - (t.x - n.x) * (e.y - t.y)) / o,
  10592. u = s / o;
  10593. (u < 0 || u > 1 || a < 0 || a > 1) && (i = !0)
  10594. }
  10595. } else i = !0;
  10596. return i ? dl.min(Xl.distancePointLine(t, n, r), Xl.distancePointLine(e, n, r), Xl.distancePointLine(n, t, e), Xl.distancePointLine(r, t, e)) : 0
  10597. }, Xl.isPointInRing = function (t, e) {
  10598. return Xl.locatePointInRing(t, e) !== pl.EXTERIOR
  10599. }, Xl.computeLength = function (t) {
  10600. var e = t.size();
  10601. if (e <= 1) return 0;
  10602. var n = 0,
  10603. r = new ul;
  10604. t.getCoordinate(0, r);
  10605. for (var i = r.x, o = r.y, s = 1; s < e; s++) {
  10606. t.getCoordinate(s, r);
  10607. var a = r.x,
  10608. u = r.y,
  10609. l = a - i,
  10610. c = u - o;
  10611. n += Math.sqrt(l * l + c * c), i = a, o = u
  10612. }
  10613. return n
  10614. }, Xl.isCCW = function (t) {
  10615. var e = t.length - 1;
  10616. if (e < 3) throw new el("Ring has fewer than 4 points, so orientation cannot be determined");
  10617. for (var n = t[0], r = 0, i = 1; i <= e; i++) {
  10618. var o = t[i];
  10619. o.y > n.y && (n = o, r = i)
  10620. }
  10621. var s = r;
  10622. do {
  10623. (s -= 1) < 0 && (s = e)
  10624. } while (t[s].equals2D(n) && s !== r);
  10625. var a = r;
  10626. do {
  10627. a = (a + 1) % e
  10628. } while (t[a].equals2D(n) && a !== r);
  10629. var u = t[s],
  10630. l = t[a];
  10631. if (u.equals2D(n) || l.equals2D(n) || u.equals2D(l)) return !1;
  10632. var c = Xl.computeOrientation(u, n, l),
  10633. h = !1;
  10634. return h = 0 === c ? u.x > l.x : c > 0, h
  10635. }, Xl.locatePointInRing = function (t, e) {
  10636. return Vl.locatePointInRing(t, e)
  10637. }, Xl.distancePointLinePerpendicular = function (t, e, n) {
  10638. var r = (n.x - e.x) * (n.x - e.x) + (n.y - e.y) * (n.y - e.y),
  10639. i = ((e.y - t.y) * (n.x - e.x) - (e.x - t.x) * (n.y - e.y)) / r;
  10640. return Math.abs(i) * Math.sqrt(r)
  10641. }, Xl.computeOrientation = function (t, e, n) {
  10642. return Xl.orientationIndex(t, e, n)
  10643. }, Xl.distancePointLine = function () {
  10644. if (2 === arguments.length) {
  10645. var t = arguments[0],
  10646. e = arguments[1];
  10647. if (0 === e.length) throw new el("Line array must contain at least one vertex");
  10648. for (var n = t.distance(e[0]), r = 0; r < e.length - 1; r++) {
  10649. var i = Xl.distancePointLine(t, e[r], e[r + 1]);
  10650. i < n && (n = i)
  10651. }
  10652. return n
  10653. }
  10654. if (3 === arguments.length) {
  10655. var o = arguments[0],
  10656. s = arguments[1],
  10657. a = arguments[2];
  10658. if (s.x === a.x && s.y === a.y) return o.distance(s);
  10659. var u = (a.x - s.x) * (a.x - s.x) + (a.y - s.y) * (a.y - s.y),
  10660. l = ((o.x - s.x) * (a.x - s.x) + (o.y - s.y) * (a.y - s.y)) / u;
  10661. if (l <= 0) return o.distance(s);
  10662. if (l >= 1) return o.distance(a);
  10663. var c = ((s.y - o.y) * (a.x - s.x) - (s.x - o.x) * (a.y - s.y)) / u;
  10664. return Math.abs(c) * Math.sqrt(u)
  10665. }
  10666. }, Xl.isOnLine = function (t, e) {
  10667. for (var n = new jl, r = 1; r < e.length; r++) {
  10668. var i = e[r - 1],
  10669. o = e[r];
  10670. if (n.computeIntersection(t, i, o), n.hasIntersection()) return !0
  10671. }
  10672. return !1
  10673. }, Yl.CLOCKWISE.get = function () {
  10674. return -1
  10675. }, Yl.RIGHT.get = function () {
  10676. return Xl.CLOCKWISE
  10677. }, Yl.COUNTERCLOCKWISE.get = function () {
  10678. return 1
  10679. }, Yl.LEFT.get = function () {
  10680. return Xl.COUNTERCLOCKWISE
  10681. }, Yl.COLLINEAR.get = function () {
  10682. return 0
  10683. }, Yl.STRAIGHT.get = function () {
  10684. return Xl.COLLINEAR
  10685. }, Object.defineProperties(Xl, Yl);
  10686. var Hl = function () {};
  10687. Hl.prototype.filter = function (t) {}, Hl.prototype.interfaces_ = function () {
  10688. return []
  10689. }, Hl.prototype.getClass = function () {
  10690. return Hl
  10691. };
  10692. var Wl = function () {
  10693. var t = arguments[0];
  10694. this._envelope = null, this._factory = null, this._SRID = null, this._userData = null, this._factory = t, this._SRID = t.getSRID()
  10695. },
  10696. Jl = {
  10697. serialVersionUID: {
  10698. configurable: !0
  10699. },
  10700. SORTINDEX_POINT: {
  10701. configurable: !0
  10702. },
  10703. SORTINDEX_MULTIPOINT: {
  10704. configurable: !0
  10705. },
  10706. SORTINDEX_LINESTRING: {
  10707. configurable: !0
  10708. },
  10709. SORTINDEX_LINEARRING: {
  10710. configurable: !0
  10711. },
  10712. SORTINDEX_MULTILINESTRING: {
  10713. configurable: !0
  10714. },
  10715. SORTINDEX_POLYGON: {
  10716. configurable: !0
  10717. },
  10718. SORTINDEX_MULTIPOLYGON: {
  10719. configurable: !0
  10720. },
  10721. SORTINDEX_GEOMETRYCOLLECTION: {
  10722. configurable: !0
  10723. },
  10724. geometryChangedFilter: {
  10725. configurable: !0
  10726. }
  10727. };
  10728. Wl.prototype.isGeometryCollection = function () {
  10729. return this.getSortIndex() === Wl.SORTINDEX_GEOMETRYCOLLECTION
  10730. }, Wl.prototype.getFactory = function () {
  10731. return this._factory
  10732. }, Wl.prototype.getGeometryN = function (t) {
  10733. return this
  10734. }, Wl.prototype.getArea = function () {
  10735. return 0
  10736. }, Wl.prototype.isRectangle = function () {
  10737. return !1
  10738. }, Wl.prototype.equals = function () {
  10739. if (arguments[0] instanceof Wl) {
  10740. var t = arguments[0];
  10741. return null !== t && this.equalsTopo(t)
  10742. }
  10743. if (arguments[0] instanceof Object) {
  10744. var e = arguments[0];
  10745. if (!(e instanceof Wl)) return !1;
  10746. var n = e;
  10747. return this.equalsExact(n)
  10748. }
  10749. }, Wl.prototype.equalsExact = function (t) {
  10750. return this === t || this.equalsExact(t, 0)
  10751. }, Wl.prototype.geometryChanged = function () {
  10752. this.apply(Wl.geometryChangedFilter)
  10753. }, Wl.prototype.geometryChangedAction = function () {
  10754. this._envelope = null
  10755. }, Wl.prototype.equalsNorm = function (t) {
  10756. return null !== t && this.norm().equalsExact(t.norm())
  10757. }, Wl.prototype.getLength = function () {
  10758. return 0
  10759. }, Wl.prototype.getNumGeometries = function () {
  10760. return 1
  10761. }, Wl.prototype.compareTo = function () {
  10762. if (1 === arguments.length) {
  10763. var t = arguments[0],
  10764. e = t;
  10765. return this.getSortIndex() !== e.getSortIndex() ? this.getSortIndex() - e.getSortIndex() : this.isEmpty() && e.isEmpty() ? 0 : this.isEmpty() ? -1 : e.isEmpty() ? 1 : this.compareToSameClass(t)
  10766. }
  10767. if (2 === arguments.length) {
  10768. var n = arguments[0],
  10769. r = arguments[1];
  10770. return this.getSortIndex() !== n.getSortIndex() ? this.getSortIndex() - n.getSortIndex() : this.isEmpty() && n.isEmpty() ? 0 : this.isEmpty() ? -1 : n.isEmpty() ? 1 : this.compareToSameClass(n, r)
  10771. }
  10772. }, Wl.prototype.getUserData = function () {
  10773. return this._userData
  10774. }, Wl.prototype.getSRID = function () {
  10775. return this._SRID
  10776. }, Wl.prototype.getEnvelope = function () {
  10777. return this.getFactory().toGeometry(this.getEnvelopeInternal())
  10778. }, Wl.prototype.checkNotGeometryCollection = function (t) {
  10779. if (t.getSortIndex() === Wl.SORTINDEX_GEOMETRYCOLLECTION) throw new el("This method does not support GeometryCollection arguments")
  10780. }, Wl.prototype.equal = function (t, e, n) {
  10781. return 0 === n ? t.equals(e) : t.distance(e) <= n
  10782. }, Wl.prototype.norm = function () {
  10783. var t = this.copy();
  10784. return t.normalize(), t
  10785. }, Wl.prototype.getPrecisionModel = function () {
  10786. return this._factory.getPrecisionModel()
  10787. }, Wl.prototype.getEnvelopeInternal = function () {
  10788. return null === this._envelope && (this._envelope = this.computeEnvelopeInternal()), new Ll(this._envelope)
  10789. }, Wl.prototype.setSRID = function (t) {
  10790. this._SRID = t
  10791. }, Wl.prototype.setUserData = function (t) {
  10792. this._userData = t
  10793. }, Wl.prototype.compare = function (t, e) {
  10794. for (var n = t.iterator(), r = e.iterator(); n.hasNext() && r.hasNext();) {
  10795. var i = n.next(),
  10796. o = r.next(),
  10797. s = i.compareTo(o);
  10798. if (0 !== s) return s
  10799. }
  10800. return n.hasNext() ? 1 : r.hasNext() ? -1 : 0
  10801. }, Wl.prototype.hashCode = function () {
  10802. return this.getEnvelopeInternal().hashCode()
  10803. }, Wl.prototype.isGeometryCollectionOrDerived = function () {
  10804. return this.getSortIndex() === Wl.SORTINDEX_GEOMETRYCOLLECTION || this.getSortIndex() === Wl.SORTINDEX_MULTIPOINT || this.getSortIndex() === Wl.SORTINDEX_MULTILINESTRING || this.getSortIndex() === Wl.SORTINDEX_MULTIPOLYGON
  10805. }, Wl.prototype.interfaces_ = function () {
  10806. return [ol, il, al]
  10807. }, Wl.prototype.getClass = function () {
  10808. return Wl
  10809. }, Wl.hasNonEmptyElements = function (t) {
  10810. for (var e = 0; e < t.length; e++)
  10811. if (!t[e].isEmpty()) return !0;
  10812. return !1
  10813. }, Wl.hasNullElements = function (t) {
  10814. for (var e = 0; e < t.length; e++)
  10815. if (null === t[e]) return !0;
  10816. return !1
  10817. }, Jl.serialVersionUID.get = function () {
  10818. return 0x799ea46522854c00
  10819. }, Jl.SORTINDEX_POINT.get = function () {
  10820. return 0
  10821. }, Jl.SORTINDEX_MULTIPOINT.get = function () {
  10822. return 1
  10823. }, Jl.SORTINDEX_LINESTRING.get = function () {
  10824. return 2
  10825. }, Jl.SORTINDEX_LINEARRING.get = function () {
  10826. return 3
  10827. }, Jl.SORTINDEX_MULTILINESTRING.get = function () {
  10828. return 4
  10829. }, Jl.SORTINDEX_POLYGON.get = function () {
  10830. return 5
  10831. }, Jl.SORTINDEX_MULTIPOLYGON.get = function () {
  10832. return 6
  10833. }, Jl.SORTINDEX_GEOMETRYCOLLECTION.get = function () {
  10834. return 7
  10835. }, Jl.geometryChangedFilter.get = function () {
  10836. return Zl
  10837. }, Object.defineProperties(Wl, Jl);
  10838. var Zl = function () {};
  10839. Zl.interfaces_ = function () {
  10840. return [Hl]
  10841. }, Zl.filter = function (t) {
  10842. t.geometryChangedAction()
  10843. };
  10844. var Kl = function () {};
  10845. Kl.prototype.filter = function (t) {}, Kl.prototype.interfaces_ = function () {
  10846. return []
  10847. }, Kl.prototype.getClass = function () {
  10848. return Kl
  10849. };
  10850. var Ql = function () {},
  10851. $l = {
  10852. Mod2BoundaryNodeRule: {
  10853. configurable: !0
  10854. },
  10855. EndPointBoundaryNodeRule: {
  10856. configurable: !0
  10857. },
  10858. MultiValentEndPointBoundaryNodeRule: {
  10859. configurable: !0
  10860. },
  10861. MonoValentEndPointBoundaryNodeRule: {
  10862. configurable: !0
  10863. },
  10864. MOD2_BOUNDARY_RULE: {
  10865. configurable: !0
  10866. },
  10867. ENDPOINT_BOUNDARY_RULE: {
  10868. configurable: !0
  10869. },
  10870. MULTIVALENT_ENDPOINT_BOUNDARY_RULE: {
  10871. configurable: !0
  10872. },
  10873. MONOVALENT_ENDPOINT_BOUNDARY_RULE: {
  10874. configurable: !0
  10875. },
  10876. OGC_SFS_BOUNDARY_RULE: {
  10877. configurable: !0
  10878. }
  10879. };
  10880. Ql.prototype.isInBoundary = function (t) {}, Ql.prototype.interfaces_ = function () {
  10881. return []
  10882. }, Ql.prototype.getClass = function () {
  10883. return Ql
  10884. }, $l.Mod2BoundaryNodeRule.get = function () {
  10885. return tc
  10886. }, $l.EndPointBoundaryNodeRule.get = function () {
  10887. return ec
  10888. }, $l.MultiValentEndPointBoundaryNodeRule.get = function () {
  10889. return nc
  10890. }, $l.MonoValentEndPointBoundaryNodeRule.get = function () {
  10891. return rc
  10892. }, $l.MOD2_BOUNDARY_RULE.get = function () {
  10893. return new tc
  10894. }, $l.ENDPOINT_BOUNDARY_RULE.get = function () {
  10895. return new ec
  10896. }, $l.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get = function () {
  10897. return new nc
  10898. }, $l.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get = function () {
  10899. return new rc
  10900. }, $l.OGC_SFS_BOUNDARY_RULE.get = function () {
  10901. return Ql.MOD2_BOUNDARY_RULE
  10902. }, Object.defineProperties(Ql, $l);
  10903. var tc = function () {};
  10904. tc.prototype.isInBoundary = function (t) {
  10905. return t % 2 == 1
  10906. }, tc.prototype.interfaces_ = function () {
  10907. return [Ql]
  10908. }, tc.prototype.getClass = function () {
  10909. return tc
  10910. };
  10911. var ec = function () {};
  10912. ec.prototype.isInBoundary = function (t) {
  10913. return t > 0
  10914. }, ec.prototype.interfaces_ = function () {
  10915. return [Ql]
  10916. }, ec.prototype.getClass = function () {
  10917. return ec
  10918. };
  10919. var nc = function () {};
  10920. nc.prototype.isInBoundary = function (t) {
  10921. return t > 1
  10922. }, nc.prototype.interfaces_ = function () {
  10923. return [Ql]
  10924. }, nc.prototype.getClass = function () {
  10925. return nc
  10926. };
  10927. var rc = function () {};
  10928. rc.prototype.isInBoundary = function (t) {
  10929. return 1 === t
  10930. }, rc.prototype.interfaces_ = function () {
  10931. return [Ql]
  10932. }, rc.prototype.getClass = function () {
  10933. return rc
  10934. };
  10935. var ic = function () {};
  10936. function oc(t) {
  10937. this.message = t || ""
  10938. }
  10939. ic.prototype.add = function () {}, ic.prototype.addAll = function () {}, ic.prototype.isEmpty = function () {}, ic.prototype.iterator = function () {}, ic.prototype.size = function () {}, ic.prototype.toArray = function () {}, ic.prototype.remove = function () {}, oc.prototype = new Error, oc.prototype.name = "IndexOutOfBoundsException";
  10940. var sc = function () {};
  10941. sc.prototype.hasNext = function () {}, sc.prototype.next = function () {}, sc.prototype.remove = function () {};
  10942. var ac = function (t) {
  10943. function e() {
  10944. t.apply(this, arguments)
  10945. }
  10946. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function () {}, e.prototype.set = function () {}, e.prototype.isEmpty = function () {}, e
  10947. }(ic);
  10948. function uc(t) {
  10949. this.message = t || ""
  10950. }
  10951. uc.prototype = new Error, uc.prototype.name = "NoSuchElementException";
  10952. var lc = function (t) {
  10953. function e() {
  10954. t.call(this), this.array_ = [], arguments[0] instanceof ic && this.addAll(arguments[0])
  10955. }
  10956. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.ensureCapacity = function () {}, e.prototype.interfaces_ = function () {
  10957. return [t, ic]
  10958. }, e.prototype.add = function (t) {
  10959. return 1 === arguments.length ? this.array_.push(t) : this.array_.splice(arguments[0], arguments[1]), !0
  10960. }, e.prototype.clear = function () {
  10961. this.array_ = []
  10962. }, e.prototype.addAll = function (t) {
  10963. for (var e = t.iterator(); e.hasNext();) this.add(e.next());
  10964. return !0
  10965. }, e.prototype.set = function (t, e) {
  10966. var n = this.array_[t];
  10967. return this.array_[t] = e, n
  10968. }, e.prototype.iterator = function () {
  10969. return new cc(this)
  10970. }, e.prototype.get = function (t) {
  10971. if (t < 0 || t >= this.size()) throw new oc;
  10972. return this.array_[t]
  10973. }, e.prototype.isEmpty = function () {
  10974. return 0 === this.array_.length
  10975. }, e.prototype.size = function () {
  10976. return this.array_.length
  10977. }, e.prototype.toArray = function () {
  10978. for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);
  10979. return t
  10980. }, e.prototype.remove = function (t) {
  10981. for (var e = !1, n = 0, r = this.array_.length; n < r; n++)
  10982. if (this.array_[n] === t) {
  10983. this.array_.splice(n, 1), e = !0;
  10984. break
  10985. } return e
  10986. }, e
  10987. }(ac),
  10988. cc = function (t) {
  10989. function e(e) {
  10990. t.call(this), this.arrayList_ = e, this.position_ = 0
  10991. }
  10992. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.next = function () {
  10993. if (this.position_ === this.arrayList_.size()) throw new uc;
  10994. return this.arrayList_.get(this.position_++)
  10995. }, e.prototype.hasNext = function () {
  10996. return this.position_ < this.arrayList_.size()
  10997. }, e.prototype.set = function (t) {
  10998. return this.arrayList_.set(this.position_ - 1, t)
  10999. }, e.prototype.remove = function () {
  11000. this.arrayList_.remove(this.arrayList_.get(this.position_))
  11001. }, e
  11002. }(sc),
  11003. hc = function (t) {
  11004. function e() {
  11005. if (t.call(this), 0 === arguments.length);
  11006. else if (1 === arguments.length) {
  11007. var e = arguments[0];
  11008. this.ensureCapacity(e.length), this.add(e, !0)
  11009. } else if (2 === arguments.length) {
  11010. var n = arguments[0],
  11011. r = arguments[1];
  11012. this.ensureCapacity(n.length), this.add(n, r)
  11013. }
  11014. }
  11015. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  11016. var n = {
  11017. coordArrayType: {
  11018. configurable: !0
  11019. }
  11020. };
  11021. return n.coordArrayType.get = function () {
  11022. return new Array(0).fill(null)
  11023. }, e.prototype.getCoordinate = function (t) {
  11024. return this.get(t)
  11025. }, e.prototype.addAll = function () {
  11026. var e = this;
  11027. if (2 === arguments.length) {
  11028. for (var n = arguments[0], r = arguments[1], i = !1, o = n.iterator(); o.hasNext();) e.add(o.next(), r), i = !0;
  11029. return i
  11030. }
  11031. return t.prototype.addAll.apply(this, arguments)
  11032. }, e.prototype.clone = function () {
  11033. for (var e = t.prototype.clone.call(this), n = 0; n < this.size(); n++) e.add(n, this.get(n).copy());
  11034. return e
  11035. }, e.prototype.toCoordinateArray = function () {
  11036. return this.toArray(e.coordArrayType)
  11037. }, e.prototype.add = function () {
  11038. var e = this;
  11039. if (1 === arguments.length) {
  11040. var n = arguments[0];
  11041. t.prototype.add.call(this, n)
  11042. } else if (2 === arguments.length) {
  11043. if (arguments[0] instanceof Array && "boolean" == typeof arguments[1]) {
  11044. var r = arguments[0],
  11045. i = arguments[1];
  11046. return this.add(r, i, !0), !0
  11047. }
  11048. if (arguments[0] instanceof ul && "boolean" == typeof arguments[1]) {
  11049. var o = arguments[0],
  11050. s = arguments[1];
  11051. if (!s && this.size() >= 1) {
  11052. var a = this.get(this.size() - 1);
  11053. if (a.equals2D(o)) return null
  11054. }
  11055. t.prototype.add.call(this, o)
  11056. } else if (arguments[0] instanceof Object && "boolean" == typeof arguments[1]) {
  11057. var u = arguments[0],
  11058. l = arguments[1];
  11059. return this.add(u, l), !0
  11060. }
  11061. } else if (3 === arguments.length) {
  11062. if ("boolean" == typeof arguments[2] && arguments[0] instanceof Array && "boolean" == typeof arguments[1]) {
  11063. var c = arguments[0],
  11064. h = arguments[1],
  11065. p = arguments[2];
  11066. if (p)
  11067. for (var f = 0; f < c.length; f++) e.add(c[f], h);
  11068. else
  11069. for (var g = c.length - 1; g >= 0; g--) e.add(c[g], h);
  11070. return !0
  11071. }
  11072. if ("boolean" == typeof arguments[2] && Number.isInteger(arguments[0]) && arguments[1] instanceof ul) {
  11073. var d = arguments[0],
  11074. y = arguments[1],
  11075. v = arguments[2];
  11076. if (!v) {
  11077. var _ = this.size();
  11078. if (_ > 0) {
  11079. if (d > 0) {
  11080. var m = this.get(d - 1);
  11081. if (m.equals2D(y)) return null
  11082. }
  11083. if (d < _) {
  11084. var x = this.get(d);
  11085. if (x.equals2D(y)) return null
  11086. }
  11087. }
  11088. }
  11089. t.prototype.add.call(this, d, y)
  11090. }
  11091. } else if (4 === arguments.length) {
  11092. var E = arguments[0],
  11093. b = arguments[1],
  11094. w = arguments[2],
  11095. I = arguments[3],
  11096. N = 1;
  11097. w > I && (N = -1);
  11098. for (var S = w; S !== I; S += N) e.add(E[S], b);
  11099. return !0
  11100. }
  11101. }, e.prototype.closeRing = function () {
  11102. this.size() > 0 && this.add(new ul(this.get(0)), !1)
  11103. }, e.prototype.interfaces_ = function () {
  11104. return []
  11105. }, e.prototype.getClass = function () {
  11106. return e
  11107. }, Object.defineProperties(e, n), e
  11108. }(lc),
  11109. pc = function () {},
  11110. fc = {
  11111. ForwardComparator: {
  11112. configurable: !0
  11113. },
  11114. BidirectionalComparator: {
  11115. configurable: !0
  11116. },
  11117. coordArrayType: {
  11118. configurable: !0
  11119. }
  11120. };
  11121. fc.ForwardComparator.get = function () {
  11122. return gc
  11123. }, fc.BidirectionalComparator.get = function () {
  11124. return dc
  11125. }, fc.coordArrayType.get = function () {
  11126. return new Array(0).fill(null)
  11127. }, pc.prototype.interfaces_ = function () {
  11128. return []
  11129. }, pc.prototype.getClass = function () {
  11130. return pc
  11131. }, pc.isRing = function (t) {
  11132. return !(t.length < 4) && !!t[0].equals2D(t[t.length - 1])
  11133. }, pc.ptNotInList = function (t, e) {
  11134. for (var n = 0; n < t.length; n++) {
  11135. var r = t[n];
  11136. if (pc.indexOf(r, e) < 0) return r
  11137. }
  11138. return null
  11139. }, pc.scroll = function (t, e) {
  11140. var n = pc.indexOf(e, t);
  11141. if (n < 0) return null;
  11142. var r = new Array(t.length).fill(null);
  11143. Pl.arraycopy(t, n, r, 0, t.length - n), Pl.arraycopy(t, 0, r, t.length - n, n), Pl.arraycopy(r, 0, t, 0, t.length)
  11144. }, pc.equals = function () {
  11145. if (2 === arguments.length) {
  11146. var t = arguments[0],
  11147. e = arguments[1];
  11148. if (t === e) return !0;
  11149. if (null === t || null === e) return !1;
  11150. if (t.length !== e.length) return !1;
  11151. for (var n = 0; n < t.length; n++)
  11152. if (!t[n].equals(e[n])) return !1;
  11153. return !0
  11154. }
  11155. if (3 === arguments.length) {
  11156. var r = arguments[0],
  11157. i = arguments[1],
  11158. o = arguments[2];
  11159. if (r === i) return !0;
  11160. if (null === r || null === i) return !1;
  11161. if (r.length !== i.length) return !1;
  11162. for (var s = 0; s < r.length; s++)
  11163. if (0 !== o.compare(r[s], i[s])) return !1;
  11164. return !0
  11165. }
  11166. }, pc.intersection = function (t, e) {
  11167. for (var n = new hc, r = 0; r < t.length; r++) e.intersects(t[r]) && n.add(t[r], !0);
  11168. return n.toCoordinateArray()
  11169. }, pc.hasRepeatedPoints = function (t) {
  11170. for (var e = 1; e < t.length; e++)
  11171. if (t[e - 1].equals(t[e])) return !0;
  11172. return !1
  11173. }, pc.removeRepeatedPoints = function (t) {
  11174. return pc.hasRepeatedPoints(t) ? new hc(t, !1).toCoordinateArray() : t
  11175. }, pc.reverse = function (t) {
  11176. for (var e = t.length - 1, n = Math.trunc(e / 2), r = 0; r <= n; r++) {
  11177. var i = t[r];
  11178. t[r] = t[e - r], t[e - r] = i
  11179. }
  11180. }, pc.removeNull = function (t) {
  11181. for (var e = 0, n = 0; n < t.length; n++) null !== t[n] && e++;
  11182. var r = new Array(e).fill(null);
  11183. if (0 === e) return r;
  11184. for (var i = 0, o = 0; o < t.length; o++) null !== t[o] && (r[i++] = t[o]);
  11185. return r
  11186. }, pc.copyDeep = function () {
  11187. if (1 === arguments.length) {
  11188. for (var t = arguments[0], e = new Array(t.length).fill(null), n = 0; n < t.length; n++) e[n] = new ul(t[n]);
  11189. return e
  11190. }
  11191. if (5 === arguments.length)
  11192. for (var r = arguments[0], i = arguments[1], o = arguments[2], s = arguments[3], a = arguments[4], u = 0; u < a; u++) o[s + u] = new ul(r[i + u])
  11193. }, pc.isEqualReversed = function (t, e) {
  11194. for (var n = 0; n < t.length; n++) {
  11195. var r = t[n],
  11196. i = e[t.length - n - 1];
  11197. if (0 !== r.compareTo(i)) return !1
  11198. }
  11199. return !0
  11200. }, pc.envelope = function (t) {
  11201. for (var e = new Ll, n = 0; n < t.length; n++) e.expandToInclude(t[n]);
  11202. return e
  11203. }, pc.toCoordinateArray = function (t) {
  11204. return t.toArray(pc.coordArrayType)
  11205. }, pc.atLeastNCoordinatesOrNothing = function (t, e) {
  11206. return e.length >= t ? e : []
  11207. }, pc.indexOf = function (t, e) {
  11208. for (var n = 0; n < e.length; n++)
  11209. if (t.equals(e[n])) return n;
  11210. return -1
  11211. }, pc.increasingDirection = function (t) {
  11212. for (var e = 0; e < Math.trunc(t.length / 2); e++) {
  11213. var n = t.length - 1 - e,
  11214. r = t[e].compareTo(t[n]);
  11215. if (0 !== r) return r
  11216. }
  11217. return 1
  11218. }, pc.compare = function (t, e) {
  11219. for (var n = 0; n < t.length && n < e.length;) {
  11220. var r = t[n].compareTo(e[n]);
  11221. if (0 !== r) return r;
  11222. n++
  11223. }
  11224. return n < e.length ? -1 : n < t.length ? 1 : 0
  11225. }, pc.minCoordinate = function (t) {
  11226. for (var e = null, n = 0; n < t.length; n++)(null === e || e.compareTo(t[n]) > 0) && (e = t[n]);
  11227. return e
  11228. }, pc.extract = function (t, e, n) {
  11229. e = dl.clamp(e, 0, t.length);
  11230. var r = (n = dl.clamp(n, -1, t.length)) - e + 1;
  11231. n < 0 && (r = 0), e >= t.length && (r = 0), n < e && (r = 0);
  11232. var i = new Array(r).fill(null);
  11233. if (0 === r) return i;
  11234. for (var o = 0, s = e; s <= n; s++) i[o++] = t[s];
  11235. return i
  11236. }, Object.defineProperties(pc, fc);
  11237. var gc = function () {};
  11238. gc.prototype.compare = function (t, e) {
  11239. return pc.compare(t, e)
  11240. }, gc.prototype.interfaces_ = function () {
  11241. return [sl]
  11242. }, gc.prototype.getClass = function () {
  11243. return gc
  11244. };
  11245. var dc = function () {};
  11246. dc.prototype.compare = function (t, e) {
  11247. var n = t,
  11248. r = e;
  11249. if (n.length < r.length) return -1;
  11250. if (n.length > r.length) return 1;
  11251. if (0 === n.length) return 0;
  11252. var i = pc.compare(n, r);
  11253. return pc.isEqualReversed(n, r) ? 0 : i
  11254. }, dc.prototype.OLDcompare = function (t, e) {
  11255. var n = t,
  11256. r = e;
  11257. if (n.length < r.length) return -1;
  11258. if (n.length > r.length) return 1;
  11259. if (0 === n.length) return 0;
  11260. for (var i = pc.increasingDirection(n), o = pc.increasingDirection(r), s = i > 0 ? 0 : n.length - 1, a = o > 0 ? 0 : n.length - 1, u = 0; u < n.length; u++) {
  11261. var l = n[s].compareTo(r[a]);
  11262. if (0 !== l) return l;
  11263. s += i, a += o
  11264. }
  11265. return 0
  11266. }, dc.prototype.interfaces_ = function () {
  11267. return [sl]
  11268. }, dc.prototype.getClass = function () {
  11269. return dc
  11270. };
  11271. var yc = function () {};
  11272. yc.prototype.get = function () {}, yc.prototype.put = function () {}, yc.prototype.size = function () {}, yc.prototype.values = function () {}, yc.prototype.entrySet = function () {};
  11273. var vc = function (t) {
  11274. function e() {
  11275. t.apply(this, arguments)
  11276. }
  11277. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e
  11278. }(yc);
  11279. function _c(t) {
  11280. this.message = t || ""
  11281. }
  11282. function mc() {}
  11283. _c.prototype = new Error, _c.prototype.name = "OperationNotSupported", mc.prototype = new ic, mc.prototype.contains = function () {};
  11284. var xc = function (t) {
  11285. function e() {
  11286. t.call(this), this.array_ = [], arguments[0] instanceof ic && this.addAll(arguments[0])
  11287. }
  11288. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.contains = function (t) {
  11289. for (var e = 0, n = this.array_.length; e < n; e++) {
  11290. if (this.array_[e] === t) return !0
  11291. }
  11292. return !1
  11293. }, e.prototype.add = function (t) {
  11294. return !this.contains(t) && (this.array_.push(t), !0)
  11295. }, e.prototype.addAll = function (t) {
  11296. for (var e = t.iterator(); e.hasNext();) this.add(e.next());
  11297. return !0
  11298. }, e.prototype.remove = function (t) {
  11299. throw new Error
  11300. }, e.prototype.size = function () {
  11301. return this.array_.length
  11302. }, e.prototype.isEmpty = function () {
  11303. return 0 === this.array_.length
  11304. }, e.prototype.toArray = function () {
  11305. for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);
  11306. return t
  11307. }, e.prototype.iterator = function () {
  11308. return new Ec(this)
  11309. }, e
  11310. }(mc),
  11311. Ec = function (t) {
  11312. function e(e) {
  11313. t.call(this), this.hashSet_ = e, this.position_ = 0
  11314. }
  11315. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.next = function () {
  11316. if (this.position_ === this.hashSet_.size()) throw new uc;
  11317. return this.hashSet_.array_[this.position_++]
  11318. }, e.prototype.hasNext = function () {
  11319. return this.position_ < this.hashSet_.size()
  11320. }, e.prototype.remove = function () {
  11321. throw new _c
  11322. }, e
  11323. }(sc);
  11324. function bc(t) {
  11325. return null === t ? 0 : t.color
  11326. }
  11327. function wc(t) {
  11328. return null === t ? null : t.parent
  11329. }
  11330. function Ic(t, e) {
  11331. null !== t && (t.color = e)
  11332. }
  11333. function Nc(t) {
  11334. return null === t ? null : t.left
  11335. }
  11336. function Sc(t) {
  11337. return null === t ? null : t.right
  11338. }
  11339. function Cc() {
  11340. this.root_ = null, this.size_ = 0
  11341. }
  11342. Cc.prototype = new vc, Cc.prototype.get = function (t) {
  11343. for (var e = this.root_; null !== e;) {
  11344. var n = t.compareTo(e.key);
  11345. if (n < 0) e = e.left;
  11346. else {
  11347. if (!(n > 0)) return e.value;
  11348. e = e.right
  11349. }
  11350. }
  11351. return null
  11352. }, Cc.prototype.put = function (t, e) {
  11353. if (null === this.root_) return this.root_ = {
  11354. key: t,
  11355. value: e,
  11356. left: null,
  11357. right: null,
  11358. parent: null,
  11359. color: 0,
  11360. getValue: function () {
  11361. return this.value
  11362. },
  11363. getKey: function () {
  11364. return this.key
  11365. }
  11366. }, this.size_ = 1, null;
  11367. var n, r, i = this.root_;
  11368. do {
  11369. if (n = i, (r = t.compareTo(i.key)) < 0) i = i.left;
  11370. else {
  11371. if (!(r > 0)) {
  11372. var o = i.value;
  11373. return i.value = e, o
  11374. }
  11375. i = i.right
  11376. }
  11377. } while (null !== i);
  11378. var s = {
  11379. key: t,
  11380. left: null,
  11381. right: null,
  11382. value: e,
  11383. parent: n,
  11384. color: 0,
  11385. getValue: function () {
  11386. return this.value
  11387. },
  11388. getKey: function () {
  11389. return this.key
  11390. }
  11391. };
  11392. return r < 0 ? n.left = s : n.right = s, this.fixAfterInsertion(s), this.size_++, null
  11393. }, Cc.prototype.fixAfterInsertion = function (t) {
  11394. var e = this;
  11395. for (t.color = 1; null != t && t !== this.root_ && 1 === t.parent.color;)
  11396. if (wc(t) === Nc(wc(wc(t)))) {
  11397. var n = Sc(wc(wc(t)));
  11398. 1 === bc(n) ? (Ic(wc(t), 0), Ic(n, 0), Ic(wc(wc(t)), 1), t = wc(wc(t))) : (t === Sc(wc(t)) && (t = wc(t), e.rotateLeft(t)), Ic(wc(t), 0), Ic(wc(wc(t)), 1), e.rotateRight(wc(wc(t))))
  11399. } else {
  11400. var r = Nc(wc(wc(t)));
  11401. 1 === bc(r) ? (Ic(wc(t), 0), Ic(r, 0), Ic(wc(wc(t)), 1), t = wc(wc(t))) : (t === Nc(wc(t)) && (t = wc(t), e.rotateRight(t)), Ic(wc(t), 0), Ic(wc(wc(t)), 1), e.rotateLeft(wc(wc(t))))
  11402. } this.root_.color = 0
  11403. }, Cc.prototype.values = function () {
  11404. var t = new lc,
  11405. e = this.getFirstEntry();
  11406. if (null !== e)
  11407. for (t.add(e.value); null !== (e = Cc.successor(e));) t.add(e.value);
  11408. return t
  11409. }, Cc.prototype.entrySet = function () {
  11410. var t = new xc,
  11411. e = this.getFirstEntry();
  11412. if (null !== e)
  11413. for (t.add(e); null !== (e = Cc.successor(e));) t.add(e);
  11414. return t
  11415. }, Cc.prototype.rotateLeft = function (t) {
  11416. if (null != t) {
  11417. var e = t.right;
  11418. t.right = e.left, null != e.left && (e.left.parent = t), e.parent = t.parent, null === t.parent ? this.root_ = e : t.parent.left === t ? t.parent.left = e : t.parent.right = e, e.left = t, t.parent = e
  11419. }
  11420. }, Cc.prototype.rotateRight = function (t) {
  11421. if (null != t) {
  11422. var e = t.left;
  11423. t.left = e.right, null != e.right && (e.right.parent = t), e.parent = t.parent, null === t.parent ? this.root_ = e : t.parent.right === t ? t.parent.right = e : t.parent.left = e, e.right = t, t.parent = e
  11424. }
  11425. }, Cc.prototype.getFirstEntry = function () {
  11426. var t = this.root_;
  11427. if (null != t)
  11428. for (; null != t.left;) t = t.left;
  11429. return t
  11430. }, Cc.successor = function (t) {
  11431. if (null === t) return null;
  11432. if (null !== t.right) {
  11433. for (var e = t.right; null !== e.left;) e = e.left;
  11434. return e
  11435. }
  11436. for (var n = t.parent, r = t; null !== n && r === n.right;) r = n, n = n.parent;
  11437. return n
  11438. }, Cc.prototype.size = function () {
  11439. return this.size_
  11440. };
  11441. var Pc = function () {};
  11442. function Mc() {}
  11443. function Lc() {
  11444. this.array_ = [], arguments[0] instanceof ic && this.addAll(arguments[0])
  11445. }
  11446. Pc.prototype.interfaces_ = function () {
  11447. return []
  11448. }, Pc.prototype.getClass = function () {
  11449. return Pc
  11450. }, Mc.prototype = new mc, Lc.prototype = new Mc, Lc.prototype.contains = function (t) {
  11451. for (var e = 0, n = this.array_.length; e < n; e++) {
  11452. if (0 === this.array_[e].compareTo(t)) return !0
  11453. }
  11454. return !1
  11455. }, Lc.prototype.add = function (t) {
  11456. if (this.contains(t)) return !1;
  11457. for (var e = 0, n = this.array_.length; e < n; e++) {
  11458. if (1 === this.array_[e].compareTo(t)) return this.array_.splice(e, 0, t), !0
  11459. }
  11460. return this.array_.push(t), !0
  11461. }, Lc.prototype.addAll = function (t) {
  11462. for (var e = t.iterator(); e.hasNext();) this.add(e.next());
  11463. return !0
  11464. }, Lc.prototype.remove = function (t) {
  11465. throw new _c
  11466. }, Lc.prototype.size = function () {
  11467. return this.array_.length
  11468. }, Lc.prototype.isEmpty = function () {
  11469. return 0 === this.array_.length
  11470. }, Lc.prototype.toArray = function () {
  11471. for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);
  11472. return t
  11473. }, Lc.prototype.iterator = function () {
  11474. return new Oc(this)
  11475. };
  11476. var Oc = function (t) {
  11477. this.treeSet_ = t, this.position_ = 0
  11478. };
  11479. Oc.prototype.next = function () {
  11480. if (this.position_ === this.treeSet_.size()) throw new uc;
  11481. return this.treeSet_.array_[this.position_++]
  11482. }, Oc.prototype.hasNext = function () {
  11483. return this.position_ < this.treeSet_.size()
  11484. }, Oc.prototype.remove = function () {
  11485. throw new _c
  11486. };
  11487. var Rc = function () {};
  11488. Rc.sort = function () {
  11489. var t, e, n, r, i = arguments[0];
  11490. if (1 === arguments.length) r = function (t, e) {
  11491. return t.compareTo(e)
  11492. }, i.sort(r);
  11493. else if (2 === arguments.length) n = arguments[1], r = function (t, e) {
  11494. return n.compare(t, e)
  11495. }, i.sort(r);
  11496. else if (3 === arguments.length) {
  11497. (e = i.slice(arguments[1], arguments[2])).sort();
  11498. var o = i.slice(0, arguments[1]).concat(e, i.slice(arguments[2], i.length));
  11499. for (i.splice(0, i.length), t = 0; t < o.length; t++) i.push(o[t])
  11500. } else if (4 === arguments.length)
  11501. for (e = i.slice(arguments[1], arguments[2]), n = arguments[3], r = function (t, e) {
  11502. return n.compare(t, e)
  11503. }, e.sort(r), o = i.slice(0, arguments[1]).concat(e, i.slice(arguments[2], i.length)), i.splice(0, i.length), t = 0; t < o.length; t++) i.push(o[t])
  11504. }, Rc.asList = function (t) {
  11505. for (var e = new lc, n = 0, r = t.length; n < r; n++) e.add(t[n]);
  11506. return e
  11507. };
  11508. var Tc = function () {},
  11509. Ac = {
  11510. P: {
  11511. configurable: !0
  11512. },
  11513. L: {
  11514. configurable: !0
  11515. },
  11516. A: {
  11517. configurable: !0
  11518. },
  11519. FALSE: {
  11520. configurable: !0
  11521. },
  11522. TRUE: {
  11523. configurable: !0
  11524. },
  11525. DONTCARE: {
  11526. configurable: !0
  11527. },
  11528. SYM_FALSE: {
  11529. configurable: !0
  11530. },
  11531. SYM_TRUE: {
  11532. configurable: !0
  11533. },
  11534. SYM_DONTCARE: {
  11535. configurable: !0
  11536. },
  11537. SYM_P: {
  11538. configurable: !0
  11539. },
  11540. SYM_L: {
  11541. configurable: !0
  11542. },
  11543. SYM_A: {
  11544. configurable: !0
  11545. }
  11546. };
  11547. Ac.P.get = function () {
  11548. return 0
  11549. }, Ac.L.get = function () {
  11550. return 1
  11551. }, Ac.A.get = function () {
  11552. return 2
  11553. }, Ac.FALSE.get = function () {
  11554. return -1
  11555. }, Ac.TRUE.get = function () {
  11556. return -2
  11557. }, Ac.DONTCARE.get = function () {
  11558. return -3
  11559. }, Ac.SYM_FALSE.get = function () {
  11560. return "F"
  11561. }, Ac.SYM_TRUE.get = function () {
  11562. return "T"
  11563. }, Ac.SYM_DONTCARE.get = function () {
  11564. return "*"
  11565. }, Ac.SYM_P.get = function () {
  11566. return "0"
  11567. }, Ac.SYM_L.get = function () {
  11568. return "1"
  11569. }, Ac.SYM_A.get = function () {
  11570. return "2"
  11571. }, Tc.prototype.interfaces_ = function () {
  11572. return []
  11573. }, Tc.prototype.getClass = function () {
  11574. return Tc
  11575. }, Tc.toDimensionSymbol = function (t) {
  11576. switch (t) {
  11577. case Tc.FALSE:
  11578. return Tc.SYM_FALSE;
  11579. case Tc.TRUE:
  11580. return Tc.SYM_TRUE;
  11581. case Tc.DONTCARE:
  11582. return Tc.SYM_DONTCARE;
  11583. case Tc.P:
  11584. return Tc.SYM_P;
  11585. case Tc.L:
  11586. return Tc.SYM_L;
  11587. case Tc.A:
  11588. return Tc.SYM_A
  11589. }
  11590. throw new el("Unknown dimension value: " + t)
  11591. }, Tc.toDimensionValue = function (t) {
  11592. switch (ml.toUpperCase(t)) {
  11593. case Tc.SYM_FALSE:
  11594. return Tc.FALSE;
  11595. case Tc.SYM_TRUE:
  11596. return Tc.TRUE;
  11597. case Tc.SYM_DONTCARE:
  11598. return Tc.DONTCARE;
  11599. case Tc.SYM_P:
  11600. return Tc.P;
  11601. case Tc.SYM_L:
  11602. return Tc.L;
  11603. case Tc.SYM_A:
  11604. return Tc.A
  11605. }
  11606. throw new el("Unknown dimension symbol: " + t)
  11607. }, Object.defineProperties(Tc, Ac);
  11608. var Dc = function () {};
  11609. Dc.prototype.filter = function (t) {}, Dc.prototype.interfaces_ = function () {
  11610. return []
  11611. }, Dc.prototype.getClass = function () {
  11612. return Dc
  11613. };
  11614. var Fc = function () {};
  11615. Fc.prototype.filter = function (t, e) {}, Fc.prototype.isDone = function () {}, Fc.prototype.isGeometryChanged = function () {}, Fc.prototype.interfaces_ = function () {
  11616. return []
  11617. }, Fc.prototype.getClass = function () {
  11618. return Fc
  11619. };
  11620. var kc = function (t) {
  11621. function e(e, n) {
  11622. if (t.call(this, n), this._geometries = e || [], t.hasNullElements(this._geometries)) throw new el("geometries must not contain null elements")
  11623. }
  11624. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  11625. var n = {
  11626. serialVersionUID: {
  11627. configurable: !0
  11628. }
  11629. };
  11630. return e.prototype.computeEnvelopeInternal = function () {
  11631. for (var t = new Ll, e = 0; e < this._geometries.length; e++) t.expandToInclude(this._geometries[e].getEnvelopeInternal());
  11632. return t
  11633. }, e.prototype.getGeometryN = function (t) {
  11634. return this._geometries[t]
  11635. }, e.prototype.getSortIndex = function () {
  11636. return t.SORTINDEX_GEOMETRYCOLLECTION
  11637. }, e.prototype.getCoordinates = function () {
  11638. for (var t = new Array(this.getNumPoints()).fill(null), e = -1, n = 0; n < this._geometries.length; n++)
  11639. for (var r = this._geometries[n].getCoordinates(), i = 0; i < r.length; i++) t[++e] = r[i];
  11640. return t
  11641. }, e.prototype.getArea = function () {
  11642. for (var t = 0, e = 0; e < this._geometries.length; e++) t += this._geometries[e].getArea();
  11643. return t
  11644. }, e.prototype.equalsExact = function () {
  11645. var e = this;
  11646. if (2 === arguments.length) {
  11647. var n = arguments[0],
  11648. r = arguments[1];
  11649. if (!this.isEquivalentClass(n)) return !1;
  11650. var i = n;
  11651. if (this._geometries.length !== i._geometries.length) return !1;
  11652. for (var o = 0; o < this._geometries.length; o++)
  11653. if (!e._geometries[o].equalsExact(i._geometries[o], r)) return !1;
  11654. return !0
  11655. }
  11656. return t.prototype.equalsExact.apply(this, arguments)
  11657. }, e.prototype.normalize = function () {
  11658. for (var t = 0; t < this._geometries.length; t++) this._geometries[t].normalize();
  11659. Rc.sort(this._geometries)
  11660. }, e.prototype.getCoordinate = function () {
  11661. return this.isEmpty() ? null : this._geometries[0].getCoordinate()
  11662. }, e.prototype.getBoundaryDimension = function () {
  11663. for (var t = Tc.FALSE, e = 0; e < this._geometries.length; e++) t = Math.max(t, this._geometries[e].getBoundaryDimension());
  11664. return t
  11665. }, e.prototype.getDimension = function () {
  11666. for (var t = Tc.FALSE, e = 0; e < this._geometries.length; e++) t = Math.max(t, this._geometries[e].getDimension());
  11667. return t
  11668. }, e.prototype.getLength = function () {
  11669. for (var t = 0, e = 0; e < this._geometries.length; e++) t += this._geometries[e].getLength();
  11670. return t
  11671. }, e.prototype.getNumPoints = function () {
  11672. for (var t = 0, e = 0; e < this._geometries.length; e++) t += this._geometries[e].getNumPoints();
  11673. return t
  11674. }, e.prototype.getNumGeometries = function () {
  11675. return this._geometries.length
  11676. }, e.prototype.reverse = function () {
  11677. for (var t = this._geometries.length, e = new Array(t).fill(null), n = 0; n < this._geometries.length; n++) e[n] = this._geometries[n].reverse();
  11678. return this.getFactory().createGeometryCollection(e)
  11679. }, e.prototype.compareToSameClass = function () {
  11680. var t = this;
  11681. if (1 === arguments.length) {
  11682. var e = arguments[0],
  11683. n = new Lc(Rc.asList(this._geometries)),
  11684. r = new Lc(Rc.asList(e._geometries));
  11685. return this.compare(n, r)
  11686. }
  11687. if (2 === arguments.length) {
  11688. for (var i = arguments[0], o = arguments[1], s = i, a = this.getNumGeometries(), u = s.getNumGeometries(), l = 0; l < a && l < u;) {
  11689. var c = t.getGeometryN(l),
  11690. h = s.getGeometryN(l),
  11691. p = c.compareToSameClass(h, o);
  11692. if (0 !== p) return p;
  11693. l++
  11694. }
  11695. return l < a ? 1 : l < u ? -1 : 0
  11696. }
  11697. }, e.prototype.apply = function () {
  11698. var t = this;
  11699. if (gl(arguments[0], Kl))
  11700. for (var e = arguments[0], n = 0; n < this._geometries.length; n++) t._geometries[n].apply(e);
  11701. else if (gl(arguments[0], Fc)) {
  11702. var r = arguments[0];
  11703. if (0 === this._geometries.length) return null;
  11704. for (var i = 0; i < this._geometries.length && (t._geometries[i].apply(r), !r.isDone()); i++);
  11705. r.isGeometryChanged() && this.geometryChanged()
  11706. } else if (gl(arguments[0], Dc)) {
  11707. var o = arguments[0];
  11708. o.filter(this);
  11709. for (var s = 0; s < this._geometries.length; s++) t._geometries[s].apply(o)
  11710. } else if (gl(arguments[0], Hl)) {
  11711. var a = arguments[0];
  11712. a.filter(this);
  11713. for (var u = 0; u < this._geometries.length; u++) t._geometries[u].apply(a)
  11714. }
  11715. }, e.prototype.getBoundary = function () {
  11716. return this.checkNotGeometryCollection(this), ql.shouldNeverReachHere(), null
  11717. }, e.prototype.clone = function () {
  11718. var e = t.prototype.clone.call(this);
  11719. e._geometries = new Array(this._geometries.length).fill(null);
  11720. for (var n = 0; n < this._geometries.length; n++) e._geometries[n] = this._geometries[n].clone();
  11721. return e
  11722. }, e.prototype.getGeometryType = function () {
  11723. return "GeometryCollection"
  11724. }, e.prototype.copy = function () {
  11725. for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();
  11726. return new e(t, this._factory)
  11727. }, e.prototype.isEmpty = function () {
  11728. for (var t = 0; t < this._geometries.length; t++)
  11729. if (!this._geometries[t].isEmpty()) return !1;
  11730. return !0
  11731. }, e.prototype.interfaces_ = function () {
  11732. return []
  11733. }, e.prototype.getClass = function () {
  11734. return e
  11735. }, n.serialVersionUID.get = function () {
  11736. return -0x4f07bcb1f857d800
  11737. }, Object.defineProperties(e, n), e
  11738. }(Wl),
  11739. Gc = function (t) {
  11740. function e() {
  11741. t.apply(this, arguments)
  11742. }
  11743. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  11744. var n = {
  11745. serialVersionUID: {
  11746. configurable: !0
  11747. }
  11748. };
  11749. return e.prototype.getSortIndex = function () {
  11750. return Wl.SORTINDEX_MULTILINESTRING
  11751. }, e.prototype.equalsExact = function () {
  11752. if (2 === arguments.length) {
  11753. var e = arguments[0],
  11754. n = arguments[1];
  11755. return !!this.isEquivalentClass(e) && t.prototype.equalsExact.call(this, e, n)
  11756. }
  11757. return t.prototype.equalsExact.apply(this, arguments)
  11758. }, e.prototype.getBoundaryDimension = function () {
  11759. return this.isClosed() ? Tc.FALSE : 0
  11760. }, e.prototype.isClosed = function () {
  11761. if (this.isEmpty()) return !1;
  11762. for (var t = 0; t < this._geometries.length; t++)
  11763. if (!this._geometries[t].isClosed()) return !1;
  11764. return !0
  11765. }, e.prototype.getDimension = function () {
  11766. return 1
  11767. }, e.prototype.reverse = function () {
  11768. for (var t = this._geometries.length, e = new Array(t).fill(null), n = 0; n < this._geometries.length; n++) e[t - 1 - n] = this._geometries[n].reverse();
  11769. return this.getFactory().createMultiLineString(e)
  11770. }, e.prototype.getBoundary = function () {
  11771. return new qc(this).getBoundary()
  11772. }, e.prototype.getGeometryType = function () {
  11773. return "MultiLineString"
  11774. }, e.prototype.copy = function () {
  11775. for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();
  11776. return new e(t, this._factory)
  11777. }, e.prototype.interfaces_ = function () {
  11778. return [Pc]
  11779. }, e.prototype.getClass = function () {
  11780. return e
  11781. }, n.serialVersionUID.get = function () {
  11782. return 0x7155d2ab4afa8000
  11783. }, Object.defineProperties(e, n), e
  11784. }(kc),
  11785. qc = function () {
  11786. if (this._geom = null, this._geomFact = null, this._bnRule = null, this._endpointMap = null, 1 === arguments.length) {
  11787. var t = arguments[0],
  11788. e = Ql.MOD2_BOUNDARY_RULE;
  11789. this._geom = t, this._geomFact = t.getFactory(), this._bnRule = e
  11790. } else if (2 === arguments.length) {
  11791. var n = arguments[0],
  11792. r = arguments[1];
  11793. this._geom = n, this._geomFact = n.getFactory(), this._bnRule = r
  11794. }
  11795. };
  11796. qc.prototype.boundaryMultiLineString = function (t) {
  11797. if (this._geom.isEmpty()) return this.getEmptyMultiPoint();
  11798. var e = this.computeBoundaryCoordinates(t);
  11799. return 1 === e.length ? this._geomFact.createPoint(e[0]) : this._geomFact.createMultiPointFromCoords(e)
  11800. }, qc.prototype.getBoundary = function () {
  11801. return this._geom instanceof Zc ? this.boundaryLineString(this._geom) : this._geom instanceof Gc ? this.boundaryMultiLineString(this._geom) : this._geom.getBoundary()
  11802. }, qc.prototype.boundaryLineString = function (t) {
  11803. return this._geom.isEmpty() ? this.getEmptyMultiPoint() : t.isClosed() ? this._bnRule.isInBoundary(2) ? t.getStartPoint() : this._geomFact.createMultiPoint() : this._geomFact.createMultiPoint([t.getStartPoint(), t.getEndPoint()])
  11804. }, qc.prototype.getEmptyMultiPoint = function () {
  11805. return this._geomFact.createMultiPoint()
  11806. }, qc.prototype.computeBoundaryCoordinates = function (t) {
  11807. var e = this,
  11808. n = new lc;
  11809. this._endpointMap = new Cc;
  11810. for (var r = 0; r < t.getNumGeometries(); r++) {
  11811. var i = t.getGeometryN(r);
  11812. 0 !== i.getNumPoints() && (e.addEndpoint(i.getCoordinateN(0)), e.addEndpoint(i.getCoordinateN(i.getNumPoints() - 1)))
  11813. }
  11814. for (var o = this._endpointMap.entrySet().iterator(); o.hasNext();) {
  11815. var s = o.next(),
  11816. a = s.getValue().count;
  11817. e._bnRule.isInBoundary(a) && n.add(s.getKey())
  11818. }
  11819. return pc.toCoordinateArray(n)
  11820. }, qc.prototype.addEndpoint = function (t) {
  11821. var e = this._endpointMap.get(t);
  11822. null === e && (e = new Bc, this._endpointMap.put(t, e)), e.count++
  11823. }, qc.prototype.interfaces_ = function () {
  11824. return []
  11825. }, qc.prototype.getClass = function () {
  11826. return qc
  11827. }, qc.getBoundary = function () {
  11828. if (1 === arguments.length) {
  11829. var t = arguments[0],
  11830. e = new qc(t);
  11831. return e.getBoundary()
  11832. }
  11833. if (2 === arguments.length) {
  11834. var n = arguments[0],
  11835. r = arguments[1],
  11836. i = new qc(n, r);
  11837. return i.getBoundary()
  11838. }
  11839. };
  11840. var Bc = function () {
  11841. this.count = null
  11842. };
  11843. function zc() {}
  11844. function jc() {}
  11845. Bc.prototype.interfaces_ = function () {
  11846. return []
  11847. }, Bc.prototype.getClass = function () {
  11848. return Bc
  11849. };
  11850. var Uc = function () {};
  11851. function Vc() {}
  11852. function Xc() {}
  11853. function Yc() {}
  11854. var Hc = function () {},
  11855. Wc = {
  11856. NEWLINE: {
  11857. configurable: !0
  11858. },
  11859. SIMPLE_ORDINATE_FORMAT: {
  11860. configurable: !0
  11861. }
  11862. };
  11863. Hc.prototype.interfaces_ = function () {
  11864. return []
  11865. }, Hc.prototype.getClass = function () {
  11866. return Hc
  11867. }, Hc.chars = function (t, e) {
  11868. for (var n = new Array(e).fill(null), r = 0; r < e; r++) n[r] = t;
  11869. return String(n)
  11870. }, Hc.getStackTrace = function () {
  11871. if (1 === arguments.length) {
  11872. var t = arguments[0],
  11873. e = new Vc,
  11874. n = new zc(e);
  11875. return t.printStackTrace(n), e.toString()
  11876. }
  11877. if (2 === arguments.length) {
  11878. for (var r = arguments[0], i = arguments[1], o = "", s = new jc(Hc.getStackTrace(r)), a = new Yc(s), u = 0; u < i; u++) try {
  11879. o += a.readLine() + Hc.NEWLINE
  11880. } catch (t) {
  11881. if (!(t instanceof Xc)) throw t;
  11882. ql.shouldNeverReachHere()
  11883. }
  11884. return o
  11885. }
  11886. }, Hc.split = function (t, e) {
  11887. for (var n = e.length, r = new lc, i = "" + t, o = i.indexOf(e); o >= 0;) {
  11888. var s = i.substring(0, o);
  11889. r.add(s), o = (i = i.substring(o + n)).indexOf(e)
  11890. }
  11891. i.length > 0 && r.add(i);
  11892. for (var a = new Array(r.size()).fill(null), u = 0; u < a.length; u++) a[u] = r.get(u);
  11893. return a
  11894. }, Hc.toString = function () {
  11895. if (1 === arguments.length) {
  11896. var t = arguments[0];
  11897. return Hc.SIMPLE_ORDINATE_FORMAT.format(t)
  11898. }
  11899. }, Hc.spaces = function (t) {
  11900. return Hc.chars(" ", t)
  11901. }, Wc.NEWLINE.get = function () {
  11902. return Pl.getProperty("line.separator")
  11903. }, Wc.SIMPLE_ORDINATE_FORMAT.get = function () {
  11904. return new Uc("0.#")
  11905. }, Object.defineProperties(Hc, Wc);
  11906. var Jc = function () {};
  11907. Jc.prototype.interfaces_ = function () {
  11908. return []
  11909. }, Jc.prototype.getClass = function () {
  11910. return Jc
  11911. }, Jc.copyCoord = function (t, e, n, r) {
  11912. for (var i = Math.min(t.getDimension(), n.getDimension()), o = 0; o < i; o++) n.setOrdinate(r, o, t.getOrdinate(e, o))
  11913. }, Jc.isRing = function (t) {
  11914. var e = t.size();
  11915. return 0 === e || !(e <= 3) && (t.getOrdinate(0, Il.X) === t.getOrdinate(e - 1, Il.X) && t.getOrdinate(0, Il.Y) === t.getOrdinate(e - 1, Il.Y))
  11916. }, Jc.isEqual = function (t, e) {
  11917. var n = t.size();
  11918. if (n !== e.size()) return !1;
  11919. for (var r = Math.min(t.getDimension(), e.getDimension()), i = 0; i < n; i++)
  11920. for (var o = 0; o < r; o++) {
  11921. var s = t.getOrdinate(i, o),
  11922. a = e.getOrdinate(i, o);
  11923. if (t.getOrdinate(i, o) !== e.getOrdinate(i, o) && (!nl.isNaN(s) || !nl.isNaN(a))) return !1
  11924. }
  11925. return !0
  11926. }, Jc.extend = function (t, e, n) {
  11927. var r = t.create(n, e.getDimension()),
  11928. i = e.size();
  11929. if (Jc.copy(e, 0, r, 0, i), i > 0)
  11930. for (var o = i; o < n; o++) Jc.copy(e, i - 1, r, o, 1);
  11931. return r
  11932. }, Jc.reverse = function (t) {
  11933. for (var e = t.size() - 1, n = Math.trunc(e / 2), r = 0; r <= n; r++) Jc.swap(t, r, e - r)
  11934. }, Jc.swap = function (t, e, n) {
  11935. if (e === n) return null;
  11936. for (var r = 0; r < t.getDimension(); r++) {
  11937. var i = t.getOrdinate(e, r);
  11938. t.setOrdinate(e, r, t.getOrdinate(n, r)), t.setOrdinate(n, r, i)
  11939. }
  11940. }, Jc.copy = function (t, e, n, r, i) {
  11941. for (var o = 0; o < i; o++) Jc.copyCoord(t, e + o, n, r + o)
  11942. }, Jc.toString = function () {
  11943. if (1 === arguments.length) {
  11944. var t = arguments[0],
  11945. e = t.size();
  11946. if (0 === e) return "()";
  11947. var n = t.getDimension(),
  11948. r = new vl;
  11949. r.append("(");
  11950. for (var i = 0; i < e; i++) {
  11951. i > 0 && r.append(" ");
  11952. for (var o = 0; o < n; o++) o > 0 && r.append(","), r.append(Hc.toString(t.getOrdinate(i, o)))
  11953. }
  11954. return r.append(")"), r.toString()
  11955. }
  11956. }, Jc.ensureValidRing = function (t, e) {
  11957. var n = e.size();
  11958. return 0 === n ? e : n <= 3 ? Jc.createClosedRing(t, e, 4) : e.getOrdinate(0, Il.X) === e.getOrdinate(n - 1, Il.X) && e.getOrdinate(0, Il.Y) === e.getOrdinate(n - 1, Il.Y) ? e : Jc.createClosedRing(t, e, n + 1)
  11959. }, Jc.createClosedRing = function (t, e, n) {
  11960. var r = t.create(n, e.getDimension()),
  11961. i = e.size();
  11962. Jc.copy(e, 0, r, 0, i);
  11963. for (var o = i; o < n; o++) Jc.copy(e, 0, r, o, 1);
  11964. return r
  11965. };
  11966. var Zc = function (t) {
  11967. function e(e, n) {
  11968. t.call(this, n), this._points = null, this.init(e)
  11969. }
  11970. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  11971. var n = {
  11972. serialVersionUID: {
  11973. configurable: !0
  11974. }
  11975. };
  11976. return e.prototype.computeEnvelopeInternal = function () {
  11977. return this.isEmpty() ? new Ll : this._points.expandEnvelope(new Ll)
  11978. }, e.prototype.isRing = function () {
  11979. return this.isClosed() && this.isSimple()
  11980. }, e.prototype.getSortIndex = function () {
  11981. return t.SORTINDEX_LINESTRING
  11982. }, e.prototype.getCoordinates = function () {
  11983. return this._points.toCoordinateArray()
  11984. }, e.prototype.equalsExact = function () {
  11985. var e = this;
  11986. if (2 === arguments.length) {
  11987. var n = arguments[0],
  11988. r = arguments[1];
  11989. if (!this.isEquivalentClass(n)) return !1;
  11990. var i = n;
  11991. if (this._points.size() !== i._points.size()) return !1;
  11992. for (var o = 0; o < this._points.size(); o++)
  11993. if (!e.equal(e._points.getCoordinate(o), i._points.getCoordinate(o), r)) return !1;
  11994. return !0
  11995. }
  11996. return t.prototype.equalsExact.apply(this, arguments)
  11997. }, e.prototype.normalize = function () {
  11998. for (var t = this, e = 0; e < Math.trunc(this._points.size() / 2); e++) {
  11999. var n = t._points.size() - 1 - e;
  12000. if (!t._points.getCoordinate(e).equals(t._points.getCoordinate(n))) return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(n)) > 0 && Jc.reverse(t._points), null
  12001. }
  12002. }, e.prototype.getCoordinate = function () {
  12003. return this.isEmpty() ? null : this._points.getCoordinate(0)
  12004. }, e.prototype.getBoundaryDimension = function () {
  12005. return this.isClosed() ? Tc.FALSE : 0
  12006. }, e.prototype.isClosed = function () {
  12007. return !this.isEmpty() && this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints() - 1))
  12008. }, e.prototype.getEndPoint = function () {
  12009. return this.isEmpty() ? null : this.getPointN(this.getNumPoints() - 1)
  12010. }, e.prototype.getDimension = function () {
  12011. return 1
  12012. }, e.prototype.getLength = function () {
  12013. return Xl.computeLength(this._points)
  12014. }, e.prototype.getNumPoints = function () {
  12015. return this._points.size()
  12016. }, e.prototype.reverse = function () {
  12017. var t = this._points.copy();
  12018. return Jc.reverse(t), this.getFactory().createLineString(t)
  12019. }, e.prototype.compareToSameClass = function () {
  12020. var t = this;
  12021. if (1 === arguments.length) {
  12022. for (var e = arguments[0], n = e, r = 0, i = 0; r < this._points.size() && i < n._points.size();) {
  12023. var o = t._points.getCoordinate(r).compareTo(n._points.getCoordinate(i));
  12024. if (0 !== o) return o;
  12025. r++, i++
  12026. }
  12027. return r < this._points.size() ? 1 : i < n._points.size() ? -1 : 0
  12028. }
  12029. if (2 === arguments.length) {
  12030. var s = arguments[0],
  12031. a = arguments[1],
  12032. u = s;
  12033. return a.compare(this._points, u._points)
  12034. }
  12035. }, e.prototype.apply = function () {
  12036. var t = this;
  12037. if (gl(arguments[0], Kl))
  12038. for (var e = arguments[0], n = 0; n < this._points.size(); n++) e.filter(t._points.getCoordinate(n));
  12039. else if (gl(arguments[0], Fc)) {
  12040. var r = arguments[0];
  12041. if (0 === this._points.size()) return null;
  12042. for (var i = 0; i < this._points.size() && (r.filter(t._points, i), !r.isDone()); i++);
  12043. r.isGeometryChanged() && this.geometryChanged()
  12044. } else if (gl(arguments[0], Dc)) {
  12045. var o = arguments[0];
  12046. o.filter(this)
  12047. } else if (gl(arguments[0], Hl)) {
  12048. var s = arguments[0];
  12049. s.filter(this)
  12050. }
  12051. }, e.prototype.getBoundary = function () {
  12052. return new qc(this).getBoundary()
  12053. }, e.prototype.isEquivalentClass = function (t) {
  12054. return t instanceof e
  12055. }, e.prototype.clone = function () {
  12056. var e = t.prototype.clone.call(this);
  12057. return e._points = this._points.clone(), e
  12058. }, e.prototype.getCoordinateN = function (t) {
  12059. return this._points.getCoordinate(t)
  12060. }, e.prototype.getGeometryType = function () {
  12061. return "LineString"
  12062. }, e.prototype.copy = function () {
  12063. return new e(this._points.copy(), this._factory)
  12064. }, e.prototype.getCoordinateSequence = function () {
  12065. return this._points
  12066. }, e.prototype.isEmpty = function () {
  12067. return 0 === this._points.size()
  12068. }, e.prototype.init = function (t) {
  12069. if (null === t && (t = this.getFactory().getCoordinateSequenceFactory().create([])), 1 === t.size()) throw new el("Invalid number of points in LineString (found " + t.size() + " - must be 0 or >= 2)");
  12070. this._points = t
  12071. }, e.prototype.isCoordinate = function (t) {
  12072. for (var e = 0; e < this._points.size(); e++)
  12073. if (this._points.getCoordinate(e).equals(t)) return !0;
  12074. return !1
  12075. }, e.prototype.getStartPoint = function () {
  12076. return this.isEmpty() ? null : this.getPointN(0)
  12077. }, e.prototype.getPointN = function (t) {
  12078. return this.getFactory().createPoint(this._points.getCoordinate(t))
  12079. }, e.prototype.interfaces_ = function () {
  12080. return [Pc]
  12081. }, e.prototype.getClass = function () {
  12082. return e
  12083. }, n.serialVersionUID.get = function () {
  12084. return 0x2b2b51ba435c8e00
  12085. }, Object.defineProperties(e, n), e
  12086. }(Wl),
  12087. Kc = function () {};
  12088. Kc.prototype.interfaces_ = function () {
  12089. return []
  12090. }, Kc.prototype.getClass = function () {
  12091. return Kc
  12092. };
  12093. var Qc = function (t) {
  12094. function e(e, n) {
  12095. t.call(this, n), this._coordinates = e || null, this.init(this._coordinates)
  12096. }
  12097. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  12098. var n = {
  12099. serialVersionUID: {
  12100. configurable: !0
  12101. }
  12102. };
  12103. return e.prototype.computeEnvelopeInternal = function () {
  12104. if (this.isEmpty()) return new Ll;
  12105. var t = new Ll;
  12106. return t.expandToInclude(this._coordinates.getX(0), this._coordinates.getY(0)), t
  12107. }, e.prototype.getSortIndex = function () {
  12108. return t.SORTINDEX_POINT
  12109. }, e.prototype.getCoordinates = function () {
  12110. return this.isEmpty() ? [] : [this.getCoordinate()]
  12111. }, e.prototype.equalsExact = function () {
  12112. if (2 === arguments.length) {
  12113. var e = arguments[0],
  12114. n = arguments[1];
  12115. return !!this.isEquivalentClass(e) && (!(!this.isEmpty() || !e.isEmpty()) || this.isEmpty() === e.isEmpty() && this.equal(e.getCoordinate(), this.getCoordinate(), n))
  12116. }
  12117. return t.prototype.equalsExact.apply(this, arguments)
  12118. }, e.prototype.normalize = function () {}, e.prototype.getCoordinate = function () {
  12119. return 0 !== this._coordinates.size() ? this._coordinates.getCoordinate(0) : null
  12120. }, e.prototype.getBoundaryDimension = function () {
  12121. return Tc.FALSE
  12122. }, e.prototype.getDimension = function () {
  12123. return 0
  12124. }, e.prototype.getNumPoints = function () {
  12125. return this.isEmpty() ? 0 : 1
  12126. }, e.prototype.reverse = function () {
  12127. return this.copy()
  12128. }, e.prototype.getX = function () {
  12129. if (null === this.getCoordinate()) throw new Error("getX called on empty Point");
  12130. return this.getCoordinate().x
  12131. }, e.prototype.compareToSameClass = function () {
  12132. if (1 === arguments.length) {
  12133. var t = arguments[0],
  12134. e = t;
  12135. return this.getCoordinate().compareTo(e.getCoordinate())
  12136. }
  12137. if (2 === arguments.length) {
  12138. var n = arguments[0],
  12139. r = arguments[1],
  12140. i = n;
  12141. return r.compare(this._coordinates, i._coordinates)
  12142. }
  12143. }, e.prototype.apply = function () {
  12144. if (gl(arguments[0], Kl)) {
  12145. var t = arguments[0];
  12146. if (this.isEmpty()) return null;
  12147. t.filter(this.getCoordinate())
  12148. } else if (gl(arguments[0], Fc)) {
  12149. var e = arguments[0];
  12150. if (this.isEmpty()) return null;
  12151. e.filter(this._coordinates, 0), e.isGeometryChanged() && this.geometryChanged()
  12152. } else if (gl(arguments[0], Dc)) {
  12153. var n = arguments[0];
  12154. n.filter(this)
  12155. } else if (gl(arguments[0], Hl)) {
  12156. var r = arguments[0];
  12157. r.filter(this)
  12158. }
  12159. }, e.prototype.getBoundary = function () {
  12160. return this.getFactory().createGeometryCollection(null)
  12161. }, e.prototype.clone = function () {
  12162. var e = t.prototype.clone.call(this);
  12163. return e._coordinates = this._coordinates.clone(), e
  12164. }, e.prototype.getGeometryType = function () {
  12165. return "Point"
  12166. }, e.prototype.copy = function () {
  12167. return new e(this._coordinates.copy(), this._factory)
  12168. }, e.prototype.getCoordinateSequence = function () {
  12169. return this._coordinates
  12170. }, e.prototype.getY = function () {
  12171. if (null === this.getCoordinate()) throw new Error("getY called on empty Point");
  12172. return this.getCoordinate().y
  12173. }, e.prototype.isEmpty = function () {
  12174. return 0 === this._coordinates.size()
  12175. }, e.prototype.init = function (t) {
  12176. null === t && (t = this.getFactory().getCoordinateSequenceFactory().create([])), ql.isTrue(t.size() <= 1), this._coordinates = t
  12177. }, e.prototype.isSimple = function () {
  12178. return !0
  12179. }, e.prototype.interfaces_ = function () {
  12180. return [Kc]
  12181. }, e.prototype.getClass = function () {
  12182. return e
  12183. }, n.serialVersionUID.get = function () {
  12184. return 0x44077bad161cbc00
  12185. }, Object.defineProperties(e, n), e
  12186. }(Wl),
  12187. $c = function () {};
  12188. $c.prototype.interfaces_ = function () {
  12189. return []
  12190. }, $c.prototype.getClass = function () {
  12191. return $c
  12192. };
  12193. var th = function (t) {
  12194. function e(e, n, r) {
  12195. if (t.call(this, r), this._shell = null, this._holes = null, null === e && (e = this.getFactory().createLinearRing()), null === n && (n = []), t.hasNullElements(n)) throw new el("holes must not contain null elements");
  12196. if (e.isEmpty() && t.hasNonEmptyElements(n)) throw new el("shell is empty but holes are not");
  12197. this._shell = e, this._holes = n
  12198. }
  12199. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  12200. var n = {
  12201. serialVersionUID: {
  12202. configurable: !0
  12203. }
  12204. };
  12205. return e.prototype.computeEnvelopeInternal = function () {
  12206. return this._shell.getEnvelopeInternal()
  12207. }, e.prototype.getSortIndex = function () {
  12208. return t.SORTINDEX_POLYGON
  12209. }, e.prototype.getCoordinates = function () {
  12210. if (this.isEmpty()) return [];
  12211. for (var t = new Array(this.getNumPoints()).fill(null), e = -1, n = this._shell.getCoordinates(), r = 0; r < n.length; r++) t[++e] = n[r];
  12212. for (var i = 0; i < this._holes.length; i++)
  12213. for (var o = this._holes[i].getCoordinates(), s = 0; s < o.length; s++) t[++e] = o[s];
  12214. return t
  12215. }, e.prototype.getArea = function () {
  12216. var t = 0;
  12217. t += Math.abs(Xl.signedArea(this._shell.getCoordinateSequence()));
  12218. for (var e = 0; e < this._holes.length; e++) t -= Math.abs(Xl.signedArea(this._holes[e].getCoordinateSequence()));
  12219. return t
  12220. }, e.prototype.isRectangle = function () {
  12221. if (0 !== this.getNumInteriorRing()) return !1;
  12222. if (null === this._shell) return !1;
  12223. if (5 !== this._shell.getNumPoints()) return !1;
  12224. for (var t = this._shell.getCoordinateSequence(), e = this.getEnvelopeInternal(), n = 0; n < 5; n++) {
  12225. var r = t.getX(n);
  12226. if (r !== e.getMinX() && r !== e.getMaxX()) return !1;
  12227. var i = t.getY(n);
  12228. if (i !== e.getMinY() && i !== e.getMaxY()) return !1
  12229. }
  12230. for (var o = t.getX(0), s = t.getY(0), a = 1; a <= 4; a++) {
  12231. var u = t.getX(a),
  12232. l = t.getY(a);
  12233. if (u !== o === (l !== s)) return !1;
  12234. o = u, s = l
  12235. }
  12236. return !0
  12237. }, e.prototype.equalsExact = function () {
  12238. var e = this;
  12239. if (2 === arguments.length) {
  12240. var n = arguments[0],
  12241. r = arguments[1];
  12242. if (!this.isEquivalentClass(n)) return !1;
  12243. var i = n,
  12244. o = this._shell,
  12245. s = i._shell;
  12246. if (!o.equalsExact(s, r)) return !1;
  12247. if (this._holes.length !== i._holes.length) return !1;
  12248. for (var a = 0; a < this._holes.length; a++)
  12249. if (!e._holes[a].equalsExact(i._holes[a], r)) return !1;
  12250. return !0
  12251. }
  12252. return t.prototype.equalsExact.apply(this, arguments)
  12253. }, e.prototype.normalize = function () {
  12254. var t = this;
  12255. if (0 === arguments.length) {
  12256. this.normalize(this._shell, !0);
  12257. for (var e = 0; e < this._holes.length; e++) t.normalize(t._holes[e], !1);
  12258. Rc.sort(this._holes)
  12259. } else if (2 === arguments.length) {
  12260. var n = arguments[0],
  12261. r = arguments[1];
  12262. if (n.isEmpty()) return null;
  12263. var i = new Array(n.getCoordinates().length - 1).fill(null);
  12264. Pl.arraycopy(n.getCoordinates(), 0, i, 0, i.length);
  12265. var o = pc.minCoordinate(n.getCoordinates());
  12266. pc.scroll(i, o), Pl.arraycopy(i, 0, n.getCoordinates(), 0, i.length), n.getCoordinates()[i.length] = i[0], Xl.isCCW(n.getCoordinates()) === r && pc.reverse(n.getCoordinates())
  12267. }
  12268. }, e.prototype.getCoordinate = function () {
  12269. return this._shell.getCoordinate()
  12270. }, e.prototype.getNumInteriorRing = function () {
  12271. return this._holes.length
  12272. }, e.prototype.getBoundaryDimension = function () {
  12273. return 1
  12274. }, e.prototype.getDimension = function () {
  12275. return 2
  12276. }, e.prototype.getLength = function () {
  12277. var t = 0;
  12278. t += this._shell.getLength();
  12279. for (var e = 0; e < this._holes.length; e++) t += this._holes[e].getLength();
  12280. return t
  12281. }, e.prototype.getNumPoints = function () {
  12282. for (var t = this._shell.getNumPoints(), e = 0; e < this._holes.length; e++) t += this._holes[e].getNumPoints();
  12283. return t
  12284. }, e.prototype.reverse = function () {
  12285. var t = this.copy();
  12286. t._shell = this._shell.copy().reverse(), t._holes = new Array(this._holes.length).fill(null);
  12287. for (var e = 0; e < this._holes.length; e++) t._holes[e] = this._holes[e].copy().reverse();
  12288. return t
  12289. }, e.prototype.convexHull = function () {
  12290. return this.getExteriorRing().convexHull()
  12291. }, e.prototype.compareToSameClass = function () {
  12292. var t = this;
  12293. if (1 === arguments.length) {
  12294. var e = arguments[0],
  12295. n = this._shell,
  12296. r = e._shell;
  12297. return n.compareToSameClass(r)
  12298. }
  12299. if (2 === arguments.length) {
  12300. var i = arguments[0],
  12301. o = arguments[1],
  12302. s = i,
  12303. a = this._shell,
  12304. u = s._shell,
  12305. l = a.compareToSameClass(u, o);
  12306. if (0 !== l) return l;
  12307. for (var c = this.getNumInteriorRing(), h = s.getNumInteriorRing(), p = 0; p < c && p < h;) {
  12308. var f = t.getInteriorRingN(p),
  12309. g = s.getInteriorRingN(p),
  12310. d = f.compareToSameClass(g, o);
  12311. if (0 !== d) return d;
  12312. p++
  12313. }
  12314. return p < c ? 1 : p < h ? -1 : 0
  12315. }
  12316. }, e.prototype.apply = function (t) {
  12317. var e = this;
  12318. if (gl(t, Kl)) {
  12319. this._shell.apply(t);
  12320. for (var n = 0; n < this._holes.length; n++) e._holes[n].apply(t)
  12321. } else if (gl(t, Fc)) {
  12322. if (this._shell.apply(t), !t.isDone())
  12323. for (var r = 0; r < this._holes.length && (e._holes[r].apply(t), !t.isDone()); r++);
  12324. t.isGeometryChanged() && this.geometryChanged()
  12325. } else if (gl(t, Dc)) t.filter(this);
  12326. else if (gl(t, Hl)) {
  12327. t.filter(this), this._shell.apply(t);
  12328. for (var i = 0; i < this._holes.length; i++) e._holes[i].apply(t)
  12329. }
  12330. }, e.prototype.getBoundary = function () {
  12331. if (this.isEmpty()) return this.getFactory().createMultiLineString();
  12332. var t = new Array(this._holes.length + 1).fill(null);
  12333. t[0] = this._shell;
  12334. for (var e = 0; e < this._holes.length; e++) t[e + 1] = this._holes[e];
  12335. return t.length <= 1 ? this.getFactory().createLinearRing(t[0].getCoordinateSequence()) : this.getFactory().createMultiLineString(t)
  12336. }, e.prototype.clone = function () {
  12337. var e = t.prototype.clone.call(this);
  12338. e._shell = this._shell.clone(), e._holes = new Array(this._holes.length).fill(null);
  12339. for (var n = 0; n < this._holes.length; n++) e._holes[n] = this._holes[n].clone();
  12340. return e
  12341. }, e.prototype.getGeometryType = function () {
  12342. return "Polygon"
  12343. }, e.prototype.copy = function () {
  12344. for (var t = this._shell.copy(), n = new Array(this._holes.length).fill(null), r = 0; r < n.length; r++) n[r] = this._holes[r].copy();
  12345. return new e(t, n, this._factory)
  12346. }, e.prototype.getExteriorRing = function () {
  12347. return this._shell
  12348. }, e.prototype.isEmpty = function () {
  12349. return this._shell.isEmpty()
  12350. }, e.prototype.getInteriorRingN = function (t) {
  12351. return this._holes[t]
  12352. }, e.prototype.interfaces_ = function () {
  12353. return [$c]
  12354. }, e.prototype.getClass = function () {
  12355. return e
  12356. }, n.serialVersionUID.get = function () {
  12357. return -0x307ffefd8dc97200
  12358. }, Object.defineProperties(e, n), e
  12359. }(Wl),
  12360. eh = function (t) {
  12361. function e() {
  12362. t.apply(this, arguments)
  12363. }
  12364. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  12365. var n = {
  12366. serialVersionUID: {
  12367. configurable: !0
  12368. }
  12369. };
  12370. return e.prototype.getSortIndex = function () {
  12371. return Wl.SORTINDEX_MULTIPOINT
  12372. }, e.prototype.isValid = function () {
  12373. return !0
  12374. }, e.prototype.equalsExact = function () {
  12375. if (2 === arguments.length) {
  12376. var e = arguments[0],
  12377. n = arguments[1];
  12378. return !!this.isEquivalentClass(e) && t.prototype.equalsExact.call(this, e, n)
  12379. }
  12380. return t.prototype.equalsExact.apply(this, arguments)
  12381. }, e.prototype.getCoordinate = function () {
  12382. if (1 === arguments.length) {
  12383. var e = arguments[0];
  12384. return this._geometries[e].getCoordinate()
  12385. }
  12386. return t.prototype.getCoordinate.apply(this, arguments)
  12387. }, e.prototype.getBoundaryDimension = function () {
  12388. return Tc.FALSE
  12389. }, e.prototype.getDimension = function () {
  12390. return 0
  12391. }, e.prototype.getBoundary = function () {
  12392. return this.getFactory().createGeometryCollection(null)
  12393. }, e.prototype.getGeometryType = function () {
  12394. return "MultiPoint"
  12395. }, e.prototype.copy = function () {
  12396. for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();
  12397. return new e(t, this._factory)
  12398. }, e.prototype.interfaces_ = function () {
  12399. return [Kc]
  12400. }, e.prototype.getClass = function () {
  12401. return e
  12402. }, n.serialVersionUID.get = function () {
  12403. return -0x6fb1ed4162e0fc00
  12404. }, Object.defineProperties(e, n), e
  12405. }(kc),
  12406. nh = function (t) {
  12407. function e(e, n) {
  12408. e instanceof ul && n instanceof _h && (e = n.getCoordinateSequenceFactory().create(e)), t.call(this, e, n), this.validateConstruction()
  12409. }
  12410. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  12411. var n = {
  12412. MINIMUM_VALID_SIZE: {
  12413. configurable: !0
  12414. },
  12415. serialVersionUID: {
  12416. configurable: !0
  12417. }
  12418. };
  12419. return e.prototype.getSortIndex = function () {
  12420. return Wl.SORTINDEX_LINEARRING
  12421. }, e.prototype.getBoundaryDimension = function () {
  12422. return Tc.FALSE
  12423. }, e.prototype.isClosed = function () {
  12424. return !!this.isEmpty() || t.prototype.isClosed.call(this)
  12425. }, e.prototype.reverse = function () {
  12426. var t = this._points.copy();
  12427. return Jc.reverse(t), this.getFactory().createLinearRing(t)
  12428. }, e.prototype.validateConstruction = function () {
  12429. if (!this.isEmpty() && !t.prototype.isClosed.call(this)) throw new el("Points of LinearRing do not form a closed linestring");
  12430. if (this.getCoordinateSequence().size() >= 1 && this.getCoordinateSequence().size() < e.MINIMUM_VALID_SIZE) throw new el("Invalid number of points in LinearRing (found " + this.getCoordinateSequence().size() + " - must be 0 or >= 4)")
  12431. }, e.prototype.getGeometryType = function () {
  12432. return "LinearRing"
  12433. }, e.prototype.copy = function () {
  12434. return new e(this._points.copy(), this._factory)
  12435. }, e.prototype.interfaces_ = function () {
  12436. return []
  12437. }, e.prototype.getClass = function () {
  12438. return e
  12439. }, n.MINIMUM_VALID_SIZE.get = function () {
  12440. return 4
  12441. }, n.serialVersionUID.get = function () {
  12442. return -0x3b229e262367a600
  12443. }, Object.defineProperties(e, n), e
  12444. }(Zc),
  12445. rh = function (t) {
  12446. function e() {
  12447. t.apply(this, arguments)
  12448. }
  12449. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  12450. var n = {
  12451. serialVersionUID: {
  12452. configurable: !0
  12453. }
  12454. };
  12455. return e.prototype.getSortIndex = function () {
  12456. return Wl.SORTINDEX_MULTIPOLYGON
  12457. }, e.prototype.equalsExact = function () {
  12458. if (2 === arguments.length) {
  12459. var e = arguments[0],
  12460. n = arguments[1];
  12461. return !!this.isEquivalentClass(e) && t.prototype.equalsExact.call(this, e, n)
  12462. }
  12463. return t.prototype.equalsExact.apply(this, arguments)
  12464. }, e.prototype.getBoundaryDimension = function () {
  12465. return 1
  12466. }, e.prototype.getDimension = function () {
  12467. return 2
  12468. }, e.prototype.reverse = function () {
  12469. for (var t = this._geometries.length, e = new Array(t).fill(null), n = 0; n < this._geometries.length; n++) e[n] = this._geometries[n].reverse();
  12470. return this.getFactory().createMultiPolygon(e)
  12471. }, e.prototype.getBoundary = function () {
  12472. if (this.isEmpty()) return this.getFactory().createMultiLineString();
  12473. for (var t = new lc, e = 0; e < this._geometries.length; e++)
  12474. for (var n = this._geometries[e].getBoundary(), r = 0; r < n.getNumGeometries(); r++) t.add(n.getGeometryN(r));
  12475. var i = new Array(t.size()).fill(null);
  12476. return this.getFactory().createMultiLineString(t.toArray(i))
  12477. }, e.prototype.getGeometryType = function () {
  12478. return "MultiPolygon"
  12479. }, e.prototype.copy = function () {
  12480. for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();
  12481. return new e(t, this._factory)
  12482. }, e.prototype.interfaces_ = function () {
  12483. return [$c]
  12484. }, e.prototype.getClass = function () {
  12485. return e
  12486. }, n.serialVersionUID.get = function () {
  12487. return -0x7a5aa1369171980
  12488. }, Object.defineProperties(e, n), e
  12489. }(kc),
  12490. ih = function (t) {
  12491. this._factory = t || null, this._isUserDataCopied = !1
  12492. },
  12493. oh = {
  12494. NoOpGeometryOperation: {
  12495. configurable: !0
  12496. },
  12497. CoordinateOperation: {
  12498. configurable: !0
  12499. },
  12500. CoordinateSequenceOperation: {
  12501. configurable: !0
  12502. }
  12503. };
  12504. ih.prototype.setCopyUserData = function (t) {
  12505. this._isUserDataCopied = t
  12506. }, ih.prototype.edit = function (t, e) {
  12507. if (null === t) return null;
  12508. var n = this.editInternal(t, e);
  12509. return this._isUserDataCopied && n.setUserData(t.getUserData()), n
  12510. }, ih.prototype.editInternal = function (t, e) {
  12511. return null === this._factory && (this._factory = t.getFactory()), t instanceof kc ? this.editGeometryCollection(t, e) : t instanceof th ? this.editPolygon(t, e) : t instanceof Qc || t instanceof Zc ? e.edit(t, this._factory) : (ql.shouldNeverReachHere("Unsupported Geometry class: " + t.getClass().getName()), null)
  12512. }, ih.prototype.editGeometryCollection = function (t, e) {
  12513. for (var n = e.edit(t, this._factory), r = new lc, i = 0; i < n.getNumGeometries(); i++) {
  12514. var o = this.edit(n.getGeometryN(i), e);
  12515. null === o || o.isEmpty() || r.add(o)
  12516. }
  12517. return n.getClass() === eh ? this._factory.createMultiPoint(r.toArray([])) : n.getClass() === Gc ? this._factory.createMultiLineString(r.toArray([])) : n.getClass() === rh ? this._factory.createMultiPolygon(r.toArray([])) : this._factory.createGeometryCollection(r.toArray([]))
  12518. }, ih.prototype.editPolygon = function (t, e) {
  12519. var n = e.edit(t, this._factory);
  12520. if (null === n && (n = this._factory.createPolygon(null)), n.isEmpty()) return n;
  12521. var r = this.edit(n.getExteriorRing(), e);
  12522. if (null === r || r.isEmpty()) return this._factory.createPolygon();
  12523. for (var i = new lc, o = 0; o < n.getNumInteriorRing(); o++) {
  12524. var s = this.edit(n.getInteriorRingN(o), e);
  12525. null === s || s.isEmpty() || i.add(s)
  12526. }
  12527. return this._factory.createPolygon(r, i.toArray([]))
  12528. }, ih.prototype.interfaces_ = function () {
  12529. return []
  12530. }, ih.prototype.getClass = function () {
  12531. return ih
  12532. }, ih.GeometryEditorOperation = function () {}, oh.NoOpGeometryOperation.get = function () {
  12533. return sh
  12534. }, oh.CoordinateOperation.get = function () {
  12535. return ah
  12536. }, oh.CoordinateSequenceOperation.get = function () {
  12537. return uh
  12538. }, Object.defineProperties(ih, oh);
  12539. var sh = function () {};
  12540. sh.prototype.edit = function (t, e) {
  12541. return t
  12542. }, sh.prototype.interfaces_ = function () {
  12543. return [ih.GeometryEditorOperation]
  12544. }, sh.prototype.getClass = function () {
  12545. return sh
  12546. };
  12547. var ah = function () {};
  12548. ah.prototype.edit = function (t, e) {
  12549. var n = this.editCoordinates(t.getCoordinates(), t);
  12550. return null === n ? t : t instanceof nh ? e.createLinearRing(n) : t instanceof Zc ? e.createLineString(n) : t instanceof Qc ? n.length > 0 ? e.createPoint(n[0]) : e.createPoint() : t
  12551. }, ah.prototype.interfaces_ = function () {
  12552. return [ih.GeometryEditorOperation]
  12553. }, ah.prototype.getClass = function () {
  12554. return ah
  12555. };
  12556. var uh = function () {};
  12557. uh.prototype.edit = function (t, e) {
  12558. return t instanceof nh ? e.createLinearRing(this.edit(t.getCoordinateSequence(), t)) : t instanceof Zc ? e.createLineString(this.edit(t.getCoordinateSequence(), t)) : t instanceof Qc ? e.createPoint(this.edit(t.getCoordinateSequence(), t)) : t
  12559. }, uh.prototype.interfaces_ = function () {
  12560. return [ih.GeometryEditorOperation]
  12561. }, uh.prototype.getClass = function () {
  12562. return uh
  12563. };
  12564. var lh = function () {
  12565. var t = this;
  12566. if (this._dimension = 3, this._coordinates = null, 1 === arguments.length) {
  12567. if (arguments[0] instanceof Array) this._coordinates = arguments[0], this._dimension = 3;
  12568. else if (Number.isInteger(arguments[0])) {
  12569. var e = arguments[0];
  12570. this._coordinates = new Array(e).fill(null);
  12571. for (var n = 0; n < e; n++) t._coordinates[n] = new ul
  12572. } else if (gl(arguments[0], Il)) {
  12573. var r = arguments[0];
  12574. if (null === r) return this._coordinates = new Array(0).fill(null), null;
  12575. this._dimension = r.getDimension(), this._coordinates = new Array(r.size()).fill(null);
  12576. for (var i = 0; i < this._coordinates.length; i++) t._coordinates[i] = r.getCoordinateCopy(i)
  12577. }
  12578. } else if (2 === arguments.length)
  12579. if (arguments[0] instanceof Array && Number.isInteger(arguments[1])) {
  12580. var o = arguments[0],
  12581. s = arguments[1];
  12582. this._coordinates = o, this._dimension = s, null === o && (this._coordinates = new Array(0).fill(null))
  12583. } else if (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1])) {
  12584. var a = arguments[0],
  12585. u = arguments[1];
  12586. this._coordinates = new Array(a).fill(null), this._dimension = u;
  12587. for (var l = 0; l < a; l++) t._coordinates[l] = new ul
  12588. }
  12589. },
  12590. ch = {
  12591. serialVersionUID: {
  12592. configurable: !0
  12593. }
  12594. };
  12595. lh.prototype.setOrdinate = function (t, e, n) {
  12596. switch (e) {
  12597. case Il.X:
  12598. this._coordinates[t].x = n;
  12599. break;
  12600. case Il.Y:
  12601. this._coordinates[t].y = n;
  12602. break;
  12603. case Il.Z:
  12604. this._coordinates[t].z = n;
  12605. break;
  12606. default:
  12607. throw new el("invalid ordinateIndex")
  12608. }
  12609. }, lh.prototype.size = function () {
  12610. return this._coordinates.length
  12611. }, lh.prototype.getOrdinate = function (t, e) {
  12612. switch (e) {
  12613. case Il.X:
  12614. return this._coordinates[t].x;
  12615. case Il.Y:
  12616. return this._coordinates[t].y;
  12617. case Il.Z:
  12618. return this._coordinates[t].z
  12619. }
  12620. return nl.NaN
  12621. }, lh.prototype.getCoordinate = function () {
  12622. if (1 === arguments.length) {
  12623. var t = arguments[0];
  12624. return this._coordinates[t]
  12625. }
  12626. if (2 === arguments.length) {
  12627. var e = arguments[0],
  12628. n = arguments[1];
  12629. n.x = this._coordinates[e].x, n.y = this._coordinates[e].y, n.z = this._coordinates[e].z
  12630. }
  12631. }, lh.prototype.getCoordinateCopy = function (t) {
  12632. return new ul(this._coordinates[t])
  12633. }, lh.prototype.getDimension = function () {
  12634. return this._dimension
  12635. }, lh.prototype.getX = function (t) {
  12636. return this._coordinates[t].x
  12637. }, lh.prototype.clone = function () {
  12638. for (var t = new Array(this.size()).fill(null), e = 0; e < this._coordinates.length; e++) t[e] = this._coordinates[e].clone();
  12639. return new lh(t, this._dimension)
  12640. }, lh.prototype.expandEnvelope = function (t) {
  12641. for (var e = 0; e < this._coordinates.length; e++) t.expandToInclude(this._coordinates[e]);
  12642. return t
  12643. }, lh.prototype.copy = function () {
  12644. for (var t = new Array(this.size()).fill(null), e = 0; e < this._coordinates.length; e++) t[e] = this._coordinates[e].copy();
  12645. return new lh(t, this._dimension)
  12646. }, lh.prototype.toString = function () {
  12647. if (this._coordinates.length > 0) {
  12648. var t = new vl(17 * this._coordinates.length);
  12649. t.append("("), t.append(this._coordinates[0]);
  12650. for (var e = 1; e < this._coordinates.length; e++) t.append(", "), t.append(this._coordinates[e]);
  12651. return t.append(")"), t.toString()
  12652. }
  12653. return "()"
  12654. }, lh.prototype.getY = function (t) {
  12655. return this._coordinates[t].y
  12656. }, lh.prototype.toCoordinateArray = function () {
  12657. return this._coordinates
  12658. }, lh.prototype.interfaces_ = function () {
  12659. return [Il, al]
  12660. }, lh.prototype.getClass = function () {
  12661. return lh
  12662. }, ch.serialVersionUID.get = function () {
  12663. return -0xcb44a778db18e00
  12664. }, Object.defineProperties(lh, ch);
  12665. var hh = function () {},
  12666. ph = {
  12667. serialVersionUID: {
  12668. configurable: !0
  12669. },
  12670. instanceObject: {
  12671. configurable: !0
  12672. }
  12673. };
  12674. hh.prototype.readResolve = function () {
  12675. return hh.instance()
  12676. }, hh.prototype.create = function () {
  12677. if (1 === arguments.length) {
  12678. if (arguments[0] instanceof Array) {
  12679. var t = arguments[0];
  12680. return new lh(t)
  12681. }
  12682. if (gl(arguments[0], Il)) {
  12683. var e = arguments[0];
  12684. return new lh(e)
  12685. }
  12686. } else if (2 === arguments.length) {
  12687. var n = arguments[0],
  12688. r = arguments[1];
  12689. return r > 3 && (r = 3), r < 2 ? new lh(n) : new lh(n, r)
  12690. }
  12691. }, hh.prototype.interfaces_ = function () {
  12692. return [hl, al]
  12693. }, hh.prototype.getClass = function () {
  12694. return hh
  12695. }, hh.instance = function () {
  12696. return hh.instanceObject
  12697. }, ph.serialVersionUID.get = function () {
  12698. return -0x38e49fa6cf6f2e00
  12699. }, ph.instanceObject.get = function () {
  12700. return new hh
  12701. }, Object.defineProperties(hh, ph);
  12702. var fh = function (t) {
  12703. function e() {
  12704. t.call(this), this.map_ = new Map
  12705. }
  12706. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function (t) {
  12707. return this.map_.get(t) || null
  12708. }, e.prototype.put = function (t, e) {
  12709. return this.map_.set(t, e), e
  12710. }, e.prototype.values = function () {
  12711. for (var t = new lc, e = this.map_.values(), n = e.next(); !n.done;) t.add(n.value), n = e.next();
  12712. return t
  12713. }, e.prototype.entrySet = function () {
  12714. var t = new xc;
  12715. return this.map_.entries().forEach((function (e) {
  12716. return t.add(e)
  12717. })), t
  12718. }, e.prototype.size = function () {
  12719. return this.map_.size()
  12720. }, e
  12721. }(yc),
  12722. gh = function t() {
  12723. if (this._modelType = null, this._scale = null, 0 === arguments.length) this._modelType = t.FLOATING;
  12724. else if (1 === arguments.length)
  12725. if (arguments[0] instanceof yh) {
  12726. var e = arguments[0];
  12727. this._modelType = e, e === t.FIXED && this.setScale(1)
  12728. } else if ("number" == typeof arguments[0]) {
  12729. var n = arguments[0];
  12730. this._modelType = t.FIXED, this.setScale(n)
  12731. } else if (arguments[0] instanceof t) {
  12732. var r = arguments[0];
  12733. this._modelType = r._modelType, this._scale = r._scale
  12734. }
  12735. },
  12736. dh = {
  12737. serialVersionUID: {
  12738. configurable: !0
  12739. },
  12740. maximumPreciseValue: {
  12741. configurable: !0
  12742. }
  12743. };
  12744. gh.prototype.equals = function (t) {
  12745. if (!(t instanceof gh)) return !1;
  12746. var e = t;
  12747. return this._modelType === e._modelType && this._scale === e._scale
  12748. }, gh.prototype.compareTo = function (t) {
  12749. var e = t,
  12750. n = this.getMaximumSignificantDigits(),
  12751. r = e.getMaximumSignificantDigits();
  12752. return new _l(n).compareTo(new _l(r))
  12753. }, gh.prototype.getScale = function () {
  12754. return this._scale
  12755. }, gh.prototype.isFloating = function () {
  12756. return this._modelType === gh.FLOATING || this._modelType === gh.FLOATING_SINGLE
  12757. }, gh.prototype.getType = function () {
  12758. return this._modelType
  12759. }, gh.prototype.toString = function () {
  12760. var t = "UNKNOWN";
  12761. return this._modelType === gh.FLOATING ? t = "Floating" : this._modelType === gh.FLOATING_SINGLE ? t = "Floating-Single" : this._modelType === gh.FIXED && (t = "Fixed (Scale=" + this.getScale() + ")"), t
  12762. }, gh.prototype.makePrecise = function () {
  12763. if ("number" == typeof arguments[0]) {
  12764. var t = arguments[0];
  12765. if (nl.isNaN(t)) return t;
  12766. if (this._modelType === gh.FLOATING_SINGLE) {
  12767. return t
  12768. }
  12769. return this._modelType === gh.FIXED ? Math.round(t * this._scale) / this._scale : t
  12770. }
  12771. if (arguments[0] instanceof ul) {
  12772. var e = arguments[0];
  12773. if (this._modelType === gh.FLOATING) return null;
  12774. e.x = this.makePrecise(e.x), e.y = this.makePrecise(e.y)
  12775. }
  12776. }, gh.prototype.getMaximumSignificantDigits = function () {
  12777. var t = 16;
  12778. return this._modelType === gh.FLOATING ? t = 16 : this._modelType === gh.FLOATING_SINGLE ? t = 6 : this._modelType === gh.FIXED && (t = 1 + Math.trunc(Math.ceil(Math.log(this.getScale()) / Math.log(10)))), t
  12779. }, gh.prototype.setScale = function (t) {
  12780. this._scale = Math.abs(t)
  12781. }, gh.prototype.interfaces_ = function () {
  12782. return [al, il]
  12783. }, gh.prototype.getClass = function () {
  12784. return gh
  12785. }, gh.mostPrecise = function (t, e) {
  12786. return t.compareTo(e) >= 0 ? t : e
  12787. }, dh.serialVersionUID.get = function () {
  12788. return 0x6bee6404e9a25c00
  12789. }, dh.maximumPreciseValue.get = function () {
  12790. return 9007199254740992
  12791. }, Object.defineProperties(gh, dh);
  12792. var yh = function t(e) {
  12793. this._name = e || null, t.nameToTypeMap.put(e, this)
  12794. },
  12795. vh = {
  12796. serialVersionUID: {
  12797. configurable: !0
  12798. },
  12799. nameToTypeMap: {
  12800. configurable: !0
  12801. }
  12802. };
  12803. yh.prototype.readResolve = function () {
  12804. return yh.nameToTypeMap.get(this._name)
  12805. }, yh.prototype.toString = function () {
  12806. return this._name
  12807. }, yh.prototype.interfaces_ = function () {
  12808. return [al]
  12809. }, yh.prototype.getClass = function () {
  12810. return yh
  12811. }, vh.serialVersionUID.get = function () {
  12812. return -552860263173159e4
  12813. }, vh.nameToTypeMap.get = function () {
  12814. return new fh
  12815. }, Object.defineProperties(yh, vh), gh.Type = yh, gh.FIXED = new yh("FIXED"), gh.FLOATING = new yh("FLOATING"), gh.FLOATING_SINGLE = new yh("FLOATING SINGLE");
  12816. var _h = function t() {
  12817. this._precisionModel = new gh, this._SRID = 0, this._coordinateSequenceFactory = t.getDefaultCoordinateSequenceFactory(), 0 === arguments.length || (1 === arguments.length ? gl(arguments[0], hl) ? this._coordinateSequenceFactory = arguments[0] : arguments[0] instanceof gh && (this._precisionModel = arguments[0]) : 2 === arguments.length ? (this._precisionModel = arguments[0], this._SRID = arguments[1]) : 3 === arguments.length && (this._precisionModel = arguments[0], this._SRID = arguments[1], this._coordinateSequenceFactory = arguments[2]))
  12818. },
  12819. mh = {
  12820. serialVersionUID: {
  12821. configurable: !0
  12822. }
  12823. };
  12824. _h.prototype.toGeometry = function (t) {
  12825. return t.isNull() ? this.createPoint(null) : t.getMinX() === t.getMaxX() && t.getMinY() === t.getMaxY() ? this.createPoint(new ul(t.getMinX(), t.getMinY())) : t.getMinX() === t.getMaxX() || t.getMinY() === t.getMaxY() ? this.createLineString([new ul(t.getMinX(), t.getMinY()), new ul(t.getMaxX(), t.getMaxY())]) : this.createPolygon(this.createLinearRing([new ul(t.getMinX(), t.getMinY()), new ul(t.getMinX(), t.getMaxY()), new ul(t.getMaxX(), t.getMaxY()), new ul(t.getMaxX(), t.getMinY()), new ul(t.getMinX(), t.getMinY())]), null)
  12826. }, _h.prototype.createLineString = function (t) {
  12827. return t ? t instanceof Array ? new Zc(this.getCoordinateSequenceFactory().create(t), this) : gl(t, Il) ? new Zc(t, this) : void 0 : new Zc(this.getCoordinateSequenceFactory().create([]), this)
  12828. }, _h.prototype.createMultiLineString = function () {
  12829. if (0 === arguments.length) return new Gc(null, this);
  12830. if (1 === arguments.length) {
  12831. var t = arguments[0];
  12832. return new Gc(t, this)
  12833. }
  12834. }, _h.prototype.buildGeometry = function (t) {
  12835. for (var e = null, n = !1, r = !1, i = t.iterator(); i.hasNext();) {
  12836. var o = i.next(),
  12837. s = o.getClass();
  12838. null === e && (e = s), s !== e && (n = !0), o.isGeometryCollectionOrDerived() && (r = !0)
  12839. }
  12840. if (null === e) return this.createGeometryCollection();
  12841. if (n || r) return this.createGeometryCollection(_h.toGeometryArray(t));
  12842. var a = t.iterator().next();
  12843. if (t.size() > 1) {
  12844. if (a instanceof th) return this.createMultiPolygon(_h.toPolygonArray(t));
  12845. if (a instanceof Zc) return this.createMultiLineString(_h.toLineStringArray(t));
  12846. if (a instanceof Qc) return this.createMultiPoint(_h.toPointArray(t));
  12847. ql.shouldNeverReachHere("Unhandled class: " + a.getClass().getName())
  12848. }
  12849. return a
  12850. }, _h.prototype.createMultiPointFromCoords = function (t) {
  12851. return this.createMultiPoint(null !== t ? this.getCoordinateSequenceFactory().create(t) : null)
  12852. }, _h.prototype.createPoint = function () {
  12853. if (0 === arguments.length) return this.createPoint(this.getCoordinateSequenceFactory().create([]));
  12854. if (1 === arguments.length) {
  12855. if (arguments[0] instanceof ul) {
  12856. var t = arguments[0];
  12857. return this.createPoint(null !== t ? this.getCoordinateSequenceFactory().create([t]) : null)
  12858. }
  12859. if (gl(arguments[0], Il)) {
  12860. var e = arguments[0];
  12861. return new Qc(e, this)
  12862. }
  12863. }
  12864. }, _h.prototype.getCoordinateSequenceFactory = function () {
  12865. return this._coordinateSequenceFactory
  12866. }, _h.prototype.createPolygon = function () {
  12867. if (0 === arguments.length) return new th(null, null, this);
  12868. if (1 === arguments.length) {
  12869. if (gl(arguments[0], Il)) {
  12870. var t = arguments[0];
  12871. return this.createPolygon(this.createLinearRing(t))
  12872. }
  12873. if (arguments[0] instanceof Array) {
  12874. var e = arguments[0];
  12875. return this.createPolygon(this.createLinearRing(e))
  12876. }
  12877. if (arguments[0] instanceof nh) {
  12878. var n = arguments[0];
  12879. return this.createPolygon(n, null)
  12880. }
  12881. } else if (2 === arguments.length) {
  12882. var r = arguments[0],
  12883. i = arguments[1];
  12884. return new th(r, i, this)
  12885. }
  12886. }, _h.prototype.getSRID = function () {
  12887. return this._SRID
  12888. }, _h.prototype.createGeometryCollection = function () {
  12889. if (0 === arguments.length) return new kc(null, this);
  12890. if (1 === arguments.length) {
  12891. var t = arguments[0];
  12892. return new kc(t, this)
  12893. }
  12894. }, _h.prototype.createGeometry = function (t) {
  12895. return new ih(this).edit(t, {
  12896. edit: function () {
  12897. if (2 === arguments.length) {
  12898. var t = arguments[0];
  12899. return this._coordinateSequenceFactory.create(t)
  12900. }
  12901. }
  12902. })
  12903. }, _h.prototype.getPrecisionModel = function () {
  12904. return this._precisionModel
  12905. }, _h.prototype.createLinearRing = function () {
  12906. if (0 === arguments.length) return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));
  12907. if (1 === arguments.length) {
  12908. if (arguments[0] instanceof Array) {
  12909. var t = arguments[0];
  12910. return this.createLinearRing(null !== t ? this.getCoordinateSequenceFactory().create(t) : null)
  12911. }
  12912. if (gl(arguments[0], Il)) {
  12913. var e = arguments[0];
  12914. return new nh(e, this)
  12915. }
  12916. }
  12917. }, _h.prototype.createMultiPolygon = function () {
  12918. if (0 === arguments.length) return new rh(null, this);
  12919. if (1 === arguments.length) {
  12920. var t = arguments[0];
  12921. return new rh(t, this)
  12922. }
  12923. }, _h.prototype.createMultiPoint = function () {
  12924. var t = this;
  12925. if (0 === arguments.length) return new eh(null, this);
  12926. if (1 === arguments.length) {
  12927. if (arguments[0] instanceof Array) {
  12928. var e = arguments[0];
  12929. return new eh(e, this)
  12930. }
  12931. if (arguments[0] instanceof Array) {
  12932. var n = arguments[0];
  12933. return this.createMultiPoint(null !== n ? this.getCoordinateSequenceFactory().create(n) : null)
  12934. }
  12935. if (gl(arguments[0], Il)) {
  12936. var r = arguments[0];
  12937. if (null === r) return this.createMultiPoint(new Array(0).fill(null));
  12938. for (var i = new Array(r.size()).fill(null), o = 0; o < r.size(); o++) {
  12939. var s = t.getCoordinateSequenceFactory().create(1, r.getDimension());
  12940. Jc.copy(r, o, s, 0, 1), i[o] = t.createPoint(s)
  12941. }
  12942. return this.createMultiPoint(i)
  12943. }
  12944. }
  12945. }, _h.prototype.interfaces_ = function () {
  12946. return [al]
  12947. }, _h.prototype.getClass = function () {
  12948. return _h
  12949. }, _h.toMultiPolygonArray = function (t) {
  12950. var e = new Array(t.size()).fill(null);
  12951. return t.toArray(e)
  12952. }, _h.toGeometryArray = function (t) {
  12953. if (null === t) return null;
  12954. var e = new Array(t.size()).fill(null);
  12955. return t.toArray(e)
  12956. }, _h.getDefaultCoordinateSequenceFactory = function () {
  12957. return hh.instance()
  12958. }, _h.toMultiLineStringArray = function (t) {
  12959. var e = new Array(t.size()).fill(null);
  12960. return t.toArray(e)
  12961. }, _h.toLineStringArray = function (t) {
  12962. var e = new Array(t.size()).fill(null);
  12963. return t.toArray(e)
  12964. }, _h.toMultiPointArray = function (t) {
  12965. var e = new Array(t.size()).fill(null);
  12966. return t.toArray(e)
  12967. }, _h.toLinearRingArray = function (t) {
  12968. var e = new Array(t.size()).fill(null);
  12969. return t.toArray(e)
  12970. }, _h.toPointArray = function (t) {
  12971. var e = new Array(t.size()).fill(null);
  12972. return t.toArray(e)
  12973. }, _h.toPolygonArray = function (t) {
  12974. var e = new Array(t.size()).fill(null);
  12975. return t.toArray(e)
  12976. }, _h.createPointFromInternalCoord = function (t, e) {
  12977. return e.getPrecisionModel().makePrecise(t), e.getFactory().createPoint(t)
  12978. }, mh.serialVersionUID.get = function () {
  12979. return -0x5ea75f2051eeb400
  12980. }, Object.defineProperties(_h, mh);
  12981. var xh = ["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon"],
  12982. Eh = function (t) {
  12983. this.geometryFactory = t || new _h
  12984. };
  12985. Eh.prototype.read = function (t) {
  12986. var e, n = (e = "string" == typeof t ? JSON.parse(t) : t).type;
  12987. if (!bh[n]) throw new Error("Unknown GeoJSON type: " + e.type);
  12988. return -1 !== xh.indexOf(n) ? bh[n].apply(this, [e.coordinates]) : "GeometryCollection" === n ? bh[n].apply(this, [e.geometries]) : bh[n].apply(this, [e])
  12989. }, Eh.prototype.write = function (t) {
  12990. var e = t.getGeometryType();
  12991. if (!wh[e]) throw new Error("Geometry is not supported");
  12992. return wh[e].apply(this, [t])
  12993. };
  12994. var bh = {
  12995. Feature: function (t) {
  12996. var e = {};
  12997. for (var n in t) e[n] = t[n];
  12998. if (t.geometry) {
  12999. var r = t.geometry.type;
  13000. if (!bh[r]) throw new Error("Unknown GeoJSON type: " + t.type);
  13001. e.geometry = this.read(t.geometry)
  13002. }
  13003. return t.bbox && (e.bbox = bh.bbox.apply(this, [t.bbox])), e
  13004. },
  13005. FeatureCollection: function (t) {
  13006. var e = {};
  13007. if (t.features) {
  13008. e.features = [];
  13009. for (var n = 0; n < t.features.length; ++n) e.features.push(this.read(t.features[n]))
  13010. }
  13011. return t.bbox && (e.bbox = this.parse.bbox.apply(this, [t.bbox])), e
  13012. },
  13013. coordinates: function (t) {
  13014. for (var e = [], n = 0; n < t.length; ++n) {
  13015. var r = t[n];
  13016. e.push(new ul(r[0], r[1]))
  13017. }
  13018. return e
  13019. },
  13020. bbox: function (t) {
  13021. return this.geometryFactory.createLinearRing([new ul(t[0], t[1]), new ul(t[2], t[1]), new ul(t[2], t[3]), new ul(t[0], t[3]), new ul(t[0], t[1])])
  13022. },
  13023. Point: function (t) {
  13024. var e = new ul(t[0], t[1]);
  13025. return this.geometryFactory.createPoint(e)
  13026. },
  13027. MultiPoint: function (t) {
  13028. for (var e = [], n = 0; n < t.length; ++n) e.push(bh.Point.apply(this, [t[n]]));
  13029. return this.geometryFactory.createMultiPoint(e)
  13030. },
  13031. LineString: function (t) {
  13032. var e = bh.coordinates.apply(this, [t]);
  13033. return this.geometryFactory.createLineString(e)
  13034. },
  13035. MultiLineString: function (t) {
  13036. for (var e = [], n = 0; n < t.length; ++n) e.push(bh.LineString.apply(this, [t[n]]));
  13037. return this.geometryFactory.createMultiLineString(e)
  13038. },
  13039. Polygon: function (t) {
  13040. for (var e = bh.coordinates.apply(this, [t[0]]), n = this.geometryFactory.createLinearRing(e), r = [], i = 1; i < t.length; ++i) {
  13041. var o = t[i],
  13042. s = bh.coordinates.apply(this, [o]),
  13043. a = this.geometryFactory.createLinearRing(s);
  13044. r.push(a)
  13045. }
  13046. return this.geometryFactory.createPolygon(n, r)
  13047. },
  13048. MultiPolygon: function (t) {
  13049. for (var e = [], n = 0; n < t.length; ++n) {
  13050. var r = t[n];
  13051. e.push(bh.Polygon.apply(this, [r]))
  13052. }
  13053. return this.geometryFactory.createMultiPolygon(e)
  13054. },
  13055. GeometryCollection: function (t) {
  13056. for (var e = [], n = 0; n < t.length; ++n) {
  13057. var r = t[n];
  13058. e.push(this.read(r))
  13059. }
  13060. return this.geometryFactory.createGeometryCollection(e)
  13061. }
  13062. },
  13063. wh = {
  13064. coordinate: function (t) {
  13065. return [t.x, t.y]
  13066. },
  13067. Point: function (t) {
  13068. return {
  13069. type: "Point",
  13070. coordinates: wh.coordinate.apply(this, [t.getCoordinate()])
  13071. }
  13072. },
  13073. MultiPoint: function (t) {
  13074. for (var e = [], n = 0; n < t._geometries.length; ++n) {
  13075. var r = t._geometries[n],
  13076. i = wh.Point.apply(this, [r]);
  13077. e.push(i.coordinates)
  13078. }
  13079. return {
  13080. type: "MultiPoint",
  13081. coordinates: e
  13082. }
  13083. },
  13084. LineString: function (t) {
  13085. for (var e = [], n = t.getCoordinates(), r = 0; r < n.length; ++r) {
  13086. var i = n[r];
  13087. e.push(wh.coordinate.apply(this, [i]))
  13088. }
  13089. return {
  13090. type: "LineString",
  13091. coordinates: e
  13092. }
  13093. },
  13094. MultiLineString: function (t) {
  13095. for (var e = [], n = 0; n < t._geometries.length; ++n) {
  13096. var r = t._geometries[n],
  13097. i = wh.LineString.apply(this, [r]);
  13098. e.push(i.coordinates)
  13099. }
  13100. return {
  13101. type: "MultiLineString",
  13102. coordinates: e
  13103. }
  13104. },
  13105. Polygon: function (t) {
  13106. var e = [],
  13107. n = wh.LineString.apply(this, [t._shell]);
  13108. e.push(n.coordinates);
  13109. for (var r = 0; r < t._holes.length; ++r) {
  13110. var i = t._holes[r],
  13111. o = wh.LineString.apply(this, [i]);
  13112. e.push(o.coordinates)
  13113. }
  13114. return {
  13115. type: "Polygon",
  13116. coordinates: e
  13117. }
  13118. },
  13119. MultiPolygon: function (t) {
  13120. for (var e = [], n = 0; n < t._geometries.length; ++n) {
  13121. var r = t._geometries[n],
  13122. i = wh.Polygon.apply(this, [r]);
  13123. e.push(i.coordinates)
  13124. }
  13125. return {
  13126. type: "MultiPolygon",
  13127. coordinates: e
  13128. }
  13129. },
  13130. GeometryCollection: function (t) {
  13131. for (var e = [], n = 0; n < t._geometries.length; ++n) {
  13132. var r = t._geometries[n],
  13133. i = r.getGeometryType();
  13134. e.push(wh[i].apply(this, [r]))
  13135. }
  13136. return {
  13137. type: "GeometryCollection",
  13138. geometries: e
  13139. }
  13140. }
  13141. },
  13142. Ih = function (t) {
  13143. this.geometryFactory = t || new _h, this.precisionModel = this.geometryFactory.getPrecisionModel(), this.parser = new Eh(this.geometryFactory)
  13144. };
  13145. Ih.prototype.read = function (t) {
  13146. var e = this.parser.read(t);
  13147. return this.precisionModel.getType() === gh.FIXED && this.reducePrecision(e), e
  13148. }, Ih.prototype.reducePrecision = function (t) {
  13149. var e, n;
  13150. if (t.coordinate) this.precisionModel.makePrecise(t.coordinate);
  13151. else if (t.points)
  13152. for (e = 0, n = t.points.length; e < n; e++) this.precisionModel.makePrecise(t.points[e]);
  13153. else if (t.geometries)
  13154. for (e = 0, n = t.geometries.length; e < n; e++) this.reducePrecision(t.geometries[e])
  13155. };
  13156. var Nh = function () {
  13157. this.parser = new Eh(this.geometryFactory)
  13158. };
  13159. Nh.prototype.write = function (t) {
  13160. return this.parser.write(t)
  13161. };
  13162. var Sh = function () {},
  13163. Ch = {
  13164. ON: {
  13165. configurable: !0
  13166. },
  13167. LEFT: {
  13168. configurable: !0
  13169. },
  13170. RIGHT: {
  13171. configurable: !0
  13172. }
  13173. };
  13174. function Ph(t) {
  13175. this.message = t || ""
  13176. }
  13177. function Mh() {
  13178. this.array_ = []
  13179. }
  13180. Sh.prototype.interfaces_ = function () {
  13181. return []
  13182. }, Sh.prototype.getClass = function () {
  13183. return Sh
  13184. }, Sh.opposite = function (t) {
  13185. return t === Sh.LEFT ? Sh.RIGHT : t === Sh.RIGHT ? Sh.LEFT : t
  13186. }, Ch.ON.get = function () {
  13187. return 0
  13188. }, Ch.LEFT.get = function () {
  13189. return 1
  13190. }, Ch.RIGHT.get = function () {
  13191. return 2
  13192. }, Object.defineProperties(Sh, Ch), Ph.prototype = new Error, Ph.prototype.name = "EmptyStackException", Mh.prototype = new ac, Mh.prototype.add = function (t) {
  13193. return this.array_.push(t), !0
  13194. }, Mh.prototype.get = function (t) {
  13195. if (t < 0 || t >= this.size()) throw new Error;
  13196. return this.array_[t]
  13197. }, Mh.prototype.push = function (t) {
  13198. return this.array_.push(t), t
  13199. }, Mh.prototype.pop = function (t) {
  13200. if (0 === this.array_.length) throw new Ph;
  13201. return this.array_.pop()
  13202. }, Mh.prototype.peek = function () {
  13203. if (0 === this.array_.length) throw new Ph;
  13204. return this.array_[this.array_.length - 1]
  13205. }, Mh.prototype.empty = function () {
  13206. return 0 === this.array_.length
  13207. }, Mh.prototype.isEmpty = function () {
  13208. return this.empty()
  13209. }, Mh.prototype.search = function (t) {
  13210. return this.array_.indexOf(t)
  13211. }, Mh.prototype.size = function () {
  13212. return this.array_.length
  13213. }, Mh.prototype.toArray = function () {
  13214. for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);
  13215. return t
  13216. };
  13217. var Lh = function () {
  13218. this._minIndex = -1, this._minCoord = null, this._minDe = null, this._orientedDe = null
  13219. };
  13220. Lh.prototype.getCoordinate = function () {
  13221. return this._minCoord
  13222. }, Lh.prototype.getRightmostSide = function (t, e) {
  13223. var n = this.getRightmostSideOfSegment(t, e);
  13224. return n < 0 && (n = this.getRightmostSideOfSegment(t, e - 1)), n < 0 && (this._minCoord = null, this.checkForRightmostCoordinate(t)), n
  13225. }, Lh.prototype.findRightmostEdgeAtVertex = function () {
  13226. var t = this._minDe.getEdge().getCoordinates();
  13227. ql.isTrue(this._minIndex > 0 && this._minIndex < t.length, "rightmost point expected to be interior vertex of edge");
  13228. var e = t[this._minIndex - 1],
  13229. n = t[this._minIndex + 1],
  13230. r = Xl.computeOrientation(this._minCoord, n, e),
  13231. i = !1;
  13232. (e.y < this._minCoord.y && n.y < this._minCoord.y && r === Xl.COUNTERCLOCKWISE || e.y > this._minCoord.y && n.y > this._minCoord.y && r === Xl.CLOCKWISE) && (i = !0), i && (this._minIndex = this._minIndex - 1)
  13233. }, Lh.prototype.getRightmostSideOfSegment = function (t, e) {
  13234. var n = t.getEdge().getCoordinates();
  13235. if (e < 0 || e + 1 >= n.length) return -1;
  13236. if (n[e].y === n[e + 1].y) return -1;
  13237. var r = Sh.LEFT;
  13238. return n[e].y < n[e + 1].y && (r = Sh.RIGHT), r
  13239. }, Lh.prototype.getEdge = function () {
  13240. return this._orientedDe
  13241. }, Lh.prototype.checkForRightmostCoordinate = function (t) {
  13242. for (var e = this, n = t.getEdge().getCoordinates(), r = 0; r < n.length - 1; r++)(null === e._minCoord || n[r].x > e._minCoord.x) && (e._minDe = t, e._minIndex = r, e._minCoord = n[r])
  13243. }, Lh.prototype.findRightmostEdgeAtNode = function () {
  13244. var t = this._minDe.getNode().getEdges();
  13245. this._minDe = t.getRightmostEdge(), this._minDe.isForward() || (this._minDe = this._minDe.getSym(), this._minIndex = this._minDe.getEdge().getCoordinates().length - 1)
  13246. }, Lh.prototype.findEdge = function (t) {
  13247. for (var e = t.iterator(); e.hasNext();) {
  13248. var n = e.next();
  13249. n.isForward() && this.checkForRightmostCoordinate(n)
  13250. }
  13251. ql.isTrue(0 !== this._minIndex || this._minCoord.equals(this._minDe.getCoordinate()), "inconsistency in rightmost processing"), 0 === this._minIndex ? this.findRightmostEdgeAtNode() : this.findRightmostEdgeAtVertex(), this._orientedDe = this._minDe, this.getRightmostSide(this._minDe, this._minIndex) === Sh.LEFT && (this._orientedDe = this._minDe.getSym())
  13252. }, Lh.prototype.interfaces_ = function () {
  13253. return []
  13254. }, Lh.prototype.getClass = function () {
  13255. return Lh
  13256. };
  13257. var Oh = function (t) {
  13258. function e(n, r) {
  13259. t.call(this, e.msgWithCoord(n, r)), this.pt = r ? new ul(r) : null, this.name = "TopologyException"
  13260. }
  13261. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getCoordinate = function () {
  13262. return this.pt
  13263. }, e.prototype.interfaces_ = function () {
  13264. return []
  13265. }, e.prototype.getClass = function () {
  13266. return e
  13267. }, e.msgWithCoord = function (t, e) {
  13268. return e ? t : t + " [ " + e + " ]"
  13269. }, e
  13270. }(kl),
  13271. Rh = function () {
  13272. this.array_ = []
  13273. };
  13274. Rh.prototype.addLast = function (t) {
  13275. this.array_.push(t)
  13276. }, Rh.prototype.removeFirst = function () {
  13277. return this.array_.shift()
  13278. }, Rh.prototype.isEmpty = function () {
  13279. return 0 === this.array_.length
  13280. };
  13281. var Th = function () {
  13282. this._finder = null, this._dirEdgeList = new lc, this._nodes = new lc, this._rightMostCoord = null, this._env = null, this._finder = new Lh
  13283. };
  13284. Th.prototype.clearVisitedEdges = function () {
  13285. for (var t = this._dirEdgeList.iterator(); t.hasNext();) {
  13286. t.next().setVisited(!1)
  13287. }
  13288. }, Th.prototype.getRightmostCoordinate = function () {
  13289. return this._rightMostCoord
  13290. }, Th.prototype.computeNodeDepth = function (t) {
  13291. for (var e = null, n = t.getEdges().iterator(); n.hasNext();) {
  13292. var r = n.next();
  13293. if (r.isVisited() || r.getSym().isVisited()) {
  13294. e = r;
  13295. break
  13296. }
  13297. }
  13298. if (null === e) throw new Oh("unable to find edge to compute depths at " + t.getCoordinate());
  13299. t.getEdges().computeDepths(e);
  13300. for (var i = t.getEdges().iterator(); i.hasNext();) {
  13301. var o = i.next();
  13302. o.setVisited(!0), this.copySymDepths(o)
  13303. }
  13304. }, Th.prototype.computeDepth = function (t) {
  13305. this.clearVisitedEdges();
  13306. var e = this._finder.getEdge();
  13307. e.setEdgeDepths(Sh.RIGHT, t), this.copySymDepths(e), this.computeDepths(e)
  13308. }, Th.prototype.create = function (t) {
  13309. this.addReachable(t), this._finder.findEdge(this._dirEdgeList), this._rightMostCoord = this._finder.getCoordinate()
  13310. }, Th.prototype.findResultEdges = function () {
  13311. for (var t = this._dirEdgeList.iterator(); t.hasNext();) {
  13312. var e = t.next();
  13313. e.getDepth(Sh.RIGHT) >= 1 && e.getDepth(Sh.LEFT) <= 0 && !e.isInteriorAreaEdge() && e.setInResult(!0)
  13314. }
  13315. }, Th.prototype.computeDepths = function (t) {
  13316. var e = new xc,
  13317. n = new Rh,
  13318. r = t.getNode();
  13319. for (n.addLast(r), e.add(r), t.setVisited(!0); !n.isEmpty();) {
  13320. var i = n.removeFirst();
  13321. e.add(i), this.computeNodeDepth(i);
  13322. for (var o = i.getEdges().iterator(); o.hasNext();) {
  13323. var s = o.next().getSym();
  13324. if (!s.isVisited()) {
  13325. var a = s.getNode();
  13326. e.contains(a) || (n.addLast(a), e.add(a))
  13327. }
  13328. }
  13329. }
  13330. }, Th.prototype.compareTo = function (t) {
  13331. var e = t;
  13332. return this._rightMostCoord.x < e._rightMostCoord.x ? -1 : this._rightMostCoord.x > e._rightMostCoord.x ? 1 : 0
  13333. }, Th.prototype.getEnvelope = function () {
  13334. if (null === this._env) {
  13335. for (var t = new Ll, e = this._dirEdgeList.iterator(); e.hasNext();)
  13336. for (var n = e.next().getEdge().getCoordinates(), r = 0; r < n.length - 1; r++) t.expandToInclude(n[r]);
  13337. this._env = t
  13338. }
  13339. return this._env
  13340. }, Th.prototype.addReachable = function (t) {
  13341. var e = new Mh;
  13342. for (e.add(t); !e.empty();) {
  13343. var n = e.pop();
  13344. this.add(n, e)
  13345. }
  13346. }, Th.prototype.copySymDepths = function (t) {
  13347. var e = t.getSym();
  13348. e.setDepth(Sh.LEFT, t.getDepth(Sh.RIGHT)), e.setDepth(Sh.RIGHT, t.getDepth(Sh.LEFT))
  13349. }, Th.prototype.add = function (t, e) {
  13350. t.setVisited(!0), this._nodes.add(t);
  13351. for (var n = t.getEdges().iterator(); n.hasNext();) {
  13352. var r = n.next();
  13353. this._dirEdgeList.add(r);
  13354. var i = r.getSym().getNode();
  13355. i.isVisited() || e.push(i)
  13356. }
  13357. }, Th.prototype.getNodes = function () {
  13358. return this._nodes
  13359. }, Th.prototype.getDirectedEdges = function () {
  13360. return this._dirEdgeList
  13361. }, Th.prototype.interfaces_ = function () {
  13362. return [il]
  13363. }, Th.prototype.getClass = function () {
  13364. return Th
  13365. };
  13366. var Ah = function t() {
  13367. var e = this;
  13368. if (this.location = null, 1 === arguments.length) {
  13369. if (arguments[0] instanceof Array) {
  13370. var n = arguments[0];
  13371. this.init(n.length)
  13372. } else if (Number.isInteger(arguments[0])) {
  13373. var r = arguments[0];
  13374. this.init(1), this.location[Sh.ON] = r
  13375. } else if (arguments[0] instanceof t) {
  13376. var i = arguments[0];
  13377. if (this.init(i.location.length), null !== i)
  13378. for (var o = 0; o < this.location.length; o++) e.location[o] = i.location[o]
  13379. }
  13380. } else if (3 === arguments.length) {
  13381. var s = arguments[0],
  13382. a = arguments[1],
  13383. u = arguments[2];
  13384. this.init(3), this.location[Sh.ON] = s, this.location[Sh.LEFT] = a, this.location[Sh.RIGHT] = u
  13385. }
  13386. };
  13387. Ah.prototype.setAllLocations = function (t) {
  13388. for (var e = 0; e < this.location.length; e++) this.location[e] = t
  13389. }, Ah.prototype.isNull = function () {
  13390. for (var t = 0; t < this.location.length; t++)
  13391. if (this.location[t] !== pl.NONE) return !1;
  13392. return !0
  13393. }, Ah.prototype.setAllLocationsIfNull = function (t) {
  13394. for (var e = 0; e < this.location.length; e++) this.location[e] === pl.NONE && (this.location[e] = t)
  13395. }, Ah.prototype.isLine = function () {
  13396. return 1 === this.location.length
  13397. }, Ah.prototype.merge = function (t) {
  13398. if (t.location.length > this.location.length) {
  13399. var e = new Array(3).fill(null);
  13400. e[Sh.ON] = this.location[Sh.ON], e[Sh.LEFT] = pl.NONE, e[Sh.RIGHT] = pl.NONE, this.location = e
  13401. }
  13402. for (var n = 0; n < this.location.length; n++) this.location[n] === pl.NONE && n < t.location.length && (this.location[n] = t.location[n])
  13403. }, Ah.prototype.getLocations = function () {
  13404. return this.location
  13405. }, Ah.prototype.flip = function () {
  13406. if (this.location.length <= 1) return null;
  13407. var t = this.location[Sh.LEFT];
  13408. this.location[Sh.LEFT] = this.location[Sh.RIGHT], this.location[Sh.RIGHT] = t
  13409. }, Ah.prototype.toString = function () {
  13410. var t = new vl;
  13411. return this.location.length > 1 && t.append(pl.toLocationSymbol(this.location[Sh.LEFT])), t.append(pl.toLocationSymbol(this.location[Sh.ON])), this.location.length > 1 && t.append(pl.toLocationSymbol(this.location[Sh.RIGHT])), t.toString()
  13412. }, Ah.prototype.setLocations = function (t, e, n) {
  13413. this.location[Sh.ON] = t, this.location[Sh.LEFT] = e, this.location[Sh.RIGHT] = n
  13414. }, Ah.prototype.get = function (t) {
  13415. return t < this.location.length ? this.location[t] : pl.NONE
  13416. }, Ah.prototype.isArea = function () {
  13417. return this.location.length > 1
  13418. }, Ah.prototype.isAnyNull = function () {
  13419. for (var t = 0; t < this.location.length; t++)
  13420. if (this.location[t] === pl.NONE) return !0;
  13421. return !1
  13422. }, Ah.prototype.setLocation = function () {
  13423. if (1 === arguments.length) {
  13424. var t = arguments[0];
  13425. this.setLocation(Sh.ON, t)
  13426. } else if (2 === arguments.length) {
  13427. var e = arguments[0],
  13428. n = arguments[1];
  13429. this.location[e] = n
  13430. }
  13431. }, Ah.prototype.init = function (t) {
  13432. this.location = new Array(t).fill(null), this.setAllLocations(pl.NONE)
  13433. }, Ah.prototype.isEqualOnSide = function (t, e) {
  13434. return this.location[e] === t.location[e]
  13435. }, Ah.prototype.allPositionsEqual = function (t) {
  13436. for (var e = 0; e < this.location.length; e++)
  13437. if (this.location[e] !== t) return !1;
  13438. return !0
  13439. }, Ah.prototype.interfaces_ = function () {
  13440. return []
  13441. }, Ah.prototype.getClass = function () {
  13442. return Ah
  13443. };
  13444. var Dh = function t() {
  13445. if (this.elt = new Array(2).fill(null), 1 === arguments.length) {
  13446. if (Number.isInteger(arguments[0])) {
  13447. var e = arguments[0];
  13448. this.elt[0] = new Ah(e), this.elt[1] = new Ah(e)
  13449. } else if (arguments[0] instanceof t) {
  13450. var n = arguments[0];
  13451. this.elt[0] = new Ah(n.elt[0]), this.elt[1] = new Ah(n.elt[1])
  13452. }
  13453. } else if (2 === arguments.length) {
  13454. var r = arguments[0],
  13455. i = arguments[1];
  13456. this.elt[0] = new Ah(pl.NONE), this.elt[1] = new Ah(pl.NONE), this.elt[r].setLocation(i)
  13457. } else if (3 === arguments.length) {
  13458. var o = arguments[0],
  13459. s = arguments[1],
  13460. a = arguments[2];
  13461. this.elt[0] = new Ah(o, s, a), this.elt[1] = new Ah(o, s, a)
  13462. } else if (4 === arguments.length) {
  13463. var u = arguments[0],
  13464. l = arguments[1],
  13465. c = arguments[2],
  13466. h = arguments[3];
  13467. this.elt[0] = new Ah(pl.NONE, pl.NONE, pl.NONE), this.elt[1] = new Ah(pl.NONE, pl.NONE, pl.NONE), this.elt[u].setLocations(l, c, h)
  13468. }
  13469. };
  13470. Dh.prototype.getGeometryCount = function () {
  13471. var t = 0;
  13472. return this.elt[0].isNull() || t++, this.elt[1].isNull() || t++, t
  13473. }, Dh.prototype.setAllLocations = function (t, e) {
  13474. this.elt[t].setAllLocations(e)
  13475. }, Dh.prototype.isNull = function (t) {
  13476. return this.elt[t].isNull()
  13477. }, Dh.prototype.setAllLocationsIfNull = function () {
  13478. if (1 === arguments.length) {
  13479. var t = arguments[0];
  13480. this.setAllLocationsIfNull(0, t), this.setAllLocationsIfNull(1, t)
  13481. } else if (2 === arguments.length) {
  13482. var e = arguments[0],
  13483. n = arguments[1];
  13484. this.elt[e].setAllLocationsIfNull(n)
  13485. }
  13486. }, Dh.prototype.isLine = function (t) {
  13487. return this.elt[t].isLine()
  13488. }, Dh.prototype.merge = function (t) {
  13489. for (var e = this, n = 0; n < 2; n++) null === e.elt[n] && null !== t.elt[n] ? e.elt[n] = new Ah(t.elt[n]) : e.elt[n].merge(t.elt[n])
  13490. }, Dh.prototype.flip = function () {
  13491. this.elt[0].flip(), this.elt[1].flip()
  13492. }, Dh.prototype.getLocation = function () {
  13493. if (1 === arguments.length) {
  13494. var t = arguments[0];
  13495. return this.elt[t].get(Sh.ON)
  13496. }
  13497. if (2 === arguments.length) {
  13498. var e = arguments[0],
  13499. n = arguments[1];
  13500. return this.elt[e].get(n)
  13501. }
  13502. }, Dh.prototype.toString = function () {
  13503. var t = new vl;
  13504. return null !== this.elt[0] && (t.append("A:"), t.append(this.elt[0].toString())), null !== this.elt[1] && (t.append(" B:"), t.append(this.elt[1].toString())), t.toString()
  13505. }, Dh.prototype.isArea = function () {
  13506. if (0 === arguments.length) return this.elt[0].isArea() || this.elt[1].isArea();
  13507. if (1 === arguments.length) {
  13508. var t = arguments[0];
  13509. return this.elt[t].isArea()
  13510. }
  13511. }, Dh.prototype.isAnyNull = function (t) {
  13512. return this.elt[t].isAnyNull()
  13513. }, Dh.prototype.setLocation = function () {
  13514. if (2 === arguments.length) {
  13515. var t = arguments[0],
  13516. e = arguments[1];
  13517. this.elt[t].setLocation(Sh.ON, e)
  13518. } else if (3 === arguments.length) {
  13519. var n = arguments[0],
  13520. r = arguments[1],
  13521. i = arguments[2];
  13522. this.elt[n].setLocation(r, i)
  13523. }
  13524. }, Dh.prototype.isEqualOnSide = function (t, e) {
  13525. return this.elt[0].isEqualOnSide(t.elt[0], e) && this.elt[1].isEqualOnSide(t.elt[1], e)
  13526. }, Dh.prototype.allPositionsEqual = function (t, e) {
  13527. return this.elt[t].allPositionsEqual(e)
  13528. }, Dh.prototype.toLine = function (t) {
  13529. this.elt[t].isArea() && (this.elt[t] = new Ah(this.elt[t].location[0]))
  13530. }, Dh.prototype.interfaces_ = function () {
  13531. return []
  13532. }, Dh.prototype.getClass = function () {
  13533. return Dh
  13534. }, Dh.toLineLabel = function (t) {
  13535. for (var e = new Dh(pl.NONE), n = 0; n < 2; n++) e.setLocation(n, t.getLocation(n));
  13536. return e
  13537. };
  13538. var Fh = function () {
  13539. this._startDe = null, this._maxNodeDegree = -1, this._edges = new lc, this._pts = new lc, this._label = new Dh(pl.NONE), this._ring = null, this._isHole = null, this._shell = null, this._holes = new lc, this._geometryFactory = null;
  13540. var t = arguments[0],
  13541. e = arguments[1];
  13542. this._geometryFactory = e, this.computePoints(t), this.computeRing()
  13543. };
  13544. Fh.prototype.computeRing = function () {
  13545. if (null !== this._ring) return null;
  13546. for (var t = new Array(this._pts.size()).fill(null), e = 0; e < this._pts.size(); e++) t[e] = this._pts.get(e);
  13547. this._ring = this._geometryFactory.createLinearRing(t), this._isHole = Xl.isCCW(this._ring.getCoordinates())
  13548. }, Fh.prototype.isIsolated = function () {
  13549. return 1 === this._label.getGeometryCount()
  13550. }, Fh.prototype.computePoints = function (t) {
  13551. var e = this;
  13552. this._startDe = t;
  13553. var n = t,
  13554. r = !0;
  13555. do {
  13556. if (null === n) throw new Oh("Found null DirectedEdge");
  13557. if (n.getEdgeRing() === e) throw new Oh("Directed Edge visited twice during ring-building at " + n.getCoordinate());
  13558. e._edges.add(n);
  13559. var i = n.getLabel();
  13560. ql.isTrue(i.isArea()), e.mergeLabel(i), e.addPoints(n.getEdge(), n.isForward(), r), r = !1, e.setEdgeRing(n, e), n = e.getNext(n)
  13561. } while (n !== this._startDe)
  13562. }, Fh.prototype.getLinearRing = function () {
  13563. return this._ring
  13564. }, Fh.prototype.getCoordinate = function (t) {
  13565. return this._pts.get(t)
  13566. }, Fh.prototype.computeMaxNodeDegree = function () {
  13567. var t = this;
  13568. this._maxNodeDegree = 0;
  13569. var e = this._startDe;
  13570. do {
  13571. var n = e.getNode().getEdges().getOutgoingDegree(t);
  13572. n > t._maxNodeDegree && (t._maxNodeDegree = n), e = t.getNext(e)
  13573. } while (e !== this._startDe);
  13574. this._maxNodeDegree *= 2
  13575. }, Fh.prototype.addPoints = function (t, e, n) {
  13576. var r = t.getCoordinates();
  13577. if (e) {
  13578. var i = 1;
  13579. n && (i = 0);
  13580. for (var o = i; o < r.length; o++) this._pts.add(r[o])
  13581. } else {
  13582. var s = r.length - 2;
  13583. n && (s = r.length - 1);
  13584. for (var a = s; a >= 0; a--) this._pts.add(r[a])
  13585. }
  13586. }, Fh.prototype.isHole = function () {
  13587. return this._isHole
  13588. }, Fh.prototype.setInResult = function () {
  13589. var t = this._startDe;
  13590. do {
  13591. t.getEdge().setInResult(!0), t = t.getNext()
  13592. } while (t !== this._startDe)
  13593. }, Fh.prototype.containsPoint = function (t) {
  13594. var e = this.getLinearRing();
  13595. if (!e.getEnvelopeInternal().contains(t)) return !1;
  13596. if (!Xl.isPointInRing(t, e.getCoordinates())) return !1;
  13597. for (var n = this._holes.iterator(); n.hasNext();) {
  13598. if (n.next().containsPoint(t)) return !1
  13599. }
  13600. return !0
  13601. }, Fh.prototype.addHole = function (t) {
  13602. this._holes.add(t)
  13603. }, Fh.prototype.isShell = function () {
  13604. return null === this._shell
  13605. }, Fh.prototype.getLabel = function () {
  13606. return this._label
  13607. }, Fh.prototype.getEdges = function () {
  13608. return this._edges
  13609. }, Fh.prototype.getMaxNodeDegree = function () {
  13610. return this._maxNodeDegree < 0 && this.computeMaxNodeDegree(), this._maxNodeDegree
  13611. }, Fh.prototype.getShell = function () {
  13612. return this._shell
  13613. }, Fh.prototype.mergeLabel = function () {
  13614. if (1 === arguments.length) {
  13615. var t = arguments[0];
  13616. this.mergeLabel(t, 0), this.mergeLabel(t, 1)
  13617. } else if (2 === arguments.length) {
  13618. var e = arguments[0],
  13619. n = arguments[1],
  13620. r = e.getLocation(n, Sh.RIGHT);
  13621. if (r === pl.NONE) return null;
  13622. if (this._label.getLocation(n) === pl.NONE) return this._label.setLocation(n, r), null
  13623. }
  13624. }, Fh.prototype.setShell = function (t) {
  13625. this._shell = t, null !== t && t.addHole(this)
  13626. }, Fh.prototype.toPolygon = function (t) {
  13627. for (var e = new Array(this._holes.size()).fill(null), n = 0; n < this._holes.size(); n++) e[n] = this._holes.get(n).getLinearRing();
  13628. return t.createPolygon(this.getLinearRing(), e)
  13629. }, Fh.prototype.interfaces_ = function () {
  13630. return []
  13631. }, Fh.prototype.getClass = function () {
  13632. return Fh
  13633. };
  13634. var kh = function (t) {
  13635. function e() {
  13636. var e = arguments[0],
  13637. n = arguments[1];
  13638. t.call(this, e, n)
  13639. }
  13640. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.setEdgeRing = function (t, e) {
  13641. t.setMinEdgeRing(e)
  13642. }, e.prototype.getNext = function (t) {
  13643. return t.getNextMin()
  13644. }, e.prototype.interfaces_ = function () {
  13645. return []
  13646. }, e.prototype.getClass = function () {
  13647. return e
  13648. }, e
  13649. }(Fh),
  13650. Gh = function (t) {
  13651. function e() {
  13652. var e = arguments[0],
  13653. n = arguments[1];
  13654. t.call(this, e, n)
  13655. }
  13656. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.buildMinimalRings = function () {
  13657. var t = new lc,
  13658. e = this._startDe;
  13659. do {
  13660. if (null === e.getMinEdgeRing()) {
  13661. var n = new kh(e, this._geometryFactory);
  13662. t.add(n)
  13663. }
  13664. e = e.getNext()
  13665. } while (e !== this._startDe);
  13666. return t
  13667. }, e.prototype.setEdgeRing = function (t, e) {
  13668. t.setEdgeRing(e)
  13669. }, e.prototype.linkDirectedEdgesForMinimalEdgeRings = function () {
  13670. var t = this._startDe;
  13671. do {
  13672. t.getNode().getEdges().linkMinimalDirectedEdges(this), t = t.getNext()
  13673. } while (t !== this._startDe)
  13674. }, e.prototype.getNext = function (t) {
  13675. return t.getNext()
  13676. }, e.prototype.interfaces_ = function () {
  13677. return []
  13678. }, e.prototype.getClass = function () {
  13679. return e
  13680. }, e
  13681. }(Fh),
  13682. qh = function () {
  13683. if (this._label = null, this._isInResult = !1, this._isCovered = !1, this._isCoveredSet = !1, this._isVisited = !1, 0 === arguments.length);
  13684. else if (1 === arguments.length) {
  13685. var t = arguments[0];
  13686. this._label = t
  13687. }
  13688. };
  13689. qh.prototype.setVisited = function (t) {
  13690. this._isVisited = t
  13691. }, qh.prototype.setInResult = function (t) {
  13692. this._isInResult = t
  13693. }, qh.prototype.isCovered = function () {
  13694. return this._isCovered
  13695. }, qh.prototype.isCoveredSet = function () {
  13696. return this._isCoveredSet
  13697. }, qh.prototype.setLabel = function (t) {
  13698. this._label = t
  13699. }, qh.prototype.getLabel = function () {
  13700. return this._label
  13701. }, qh.prototype.setCovered = function (t) {
  13702. this._isCovered = t, this._isCoveredSet = !0
  13703. }, qh.prototype.updateIM = function (t) {
  13704. ql.isTrue(this._label.getGeometryCount() >= 2, "found partial label"), this.computeIM(t)
  13705. }, qh.prototype.isInResult = function () {
  13706. return this._isInResult
  13707. }, qh.prototype.isVisited = function () {
  13708. return this._isVisited
  13709. }, qh.prototype.interfaces_ = function () {
  13710. return []
  13711. }, qh.prototype.getClass = function () {
  13712. return qh
  13713. };
  13714. var Bh = function (t) {
  13715. function e() {
  13716. t.call(this), this._coord = null, this._edges = null;
  13717. var e = arguments[0],
  13718. n = arguments[1];
  13719. this._coord = e, this._edges = n, this._label = new Dh(0, pl.NONE)
  13720. }
  13721. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.isIncidentEdgeInResult = function () {
  13722. for (var t = this.getEdges().getEdges().iterator(); t.hasNext();) {
  13723. if (t.next().getEdge().isInResult()) return !0
  13724. }
  13725. return !1
  13726. }, e.prototype.isIsolated = function () {
  13727. return 1 === this._label.getGeometryCount()
  13728. }, e.prototype.getCoordinate = function () {
  13729. return this._coord
  13730. }, e.prototype.print = function (t) {
  13731. t.println("node " + this._coord + " lbl: " + this._label)
  13732. }, e.prototype.computeIM = function (t) {}, e.prototype.computeMergedLocation = function (t, e) {
  13733. var n = pl.NONE;
  13734. if (n = this._label.getLocation(e), !t.isNull(e)) {
  13735. var r = t.getLocation(e);
  13736. n !== pl.BOUNDARY && (n = r)
  13737. }
  13738. return n
  13739. }, e.prototype.setLabel = function () {
  13740. if (2 !== arguments.length) return t.prototype.setLabel.apply(this, arguments);
  13741. var e = arguments[0],
  13742. n = arguments[1];
  13743. null === this._label ? this._label = new Dh(e, n) : this._label.setLocation(e, n)
  13744. }, e.prototype.getEdges = function () {
  13745. return this._edges
  13746. }, e.prototype.mergeLabel = function () {
  13747. var t = this;
  13748. if (arguments[0] instanceof e) {
  13749. var n = arguments[0];
  13750. this.mergeLabel(n._label)
  13751. } else if (arguments[0] instanceof Dh)
  13752. for (var r = arguments[0], i = 0; i < 2; i++) {
  13753. var o = t.computeMergedLocation(r, i),
  13754. s = t._label.getLocation(i);
  13755. s === pl.NONE && t._label.setLocation(i, o)
  13756. }
  13757. }, e.prototype.add = function (t) {
  13758. this._edges.insert(t), t.setNode(this)
  13759. }, e.prototype.setLabelBoundary = function (t) {
  13760. if (null === this._label) return null;
  13761. var e = pl.NONE;
  13762. null !== this._label && (e = this._label.getLocation(t));
  13763. var n = null;
  13764. switch (e) {
  13765. case pl.BOUNDARY:
  13766. n = pl.INTERIOR;
  13767. break;
  13768. case pl.INTERIOR:
  13769. default:
  13770. n = pl.BOUNDARY
  13771. }
  13772. this._label.setLocation(t, n)
  13773. }, e.prototype.interfaces_ = function () {
  13774. return []
  13775. }, e.prototype.getClass = function () {
  13776. return e
  13777. }, e
  13778. }(qh),
  13779. zh = function () {
  13780. this.nodeMap = new Cc, this.nodeFact = null;
  13781. var t = arguments[0];
  13782. this.nodeFact = t
  13783. };
  13784. zh.prototype.find = function (t) {
  13785. return this.nodeMap.get(t)
  13786. }, zh.prototype.addNode = function () {
  13787. if (arguments[0] instanceof ul) {
  13788. var t = arguments[0],
  13789. e = this.nodeMap.get(t);
  13790. return null === e && (e = this.nodeFact.createNode(t), this.nodeMap.put(t, e)), e
  13791. }
  13792. if (arguments[0] instanceof Bh) {
  13793. var n = arguments[0],
  13794. r = this.nodeMap.get(n.getCoordinate());
  13795. return null === r ? (this.nodeMap.put(n.getCoordinate(), n), n) : (r.mergeLabel(n), r)
  13796. }
  13797. }, zh.prototype.print = function (t) {
  13798. for (var e = this.iterator(); e.hasNext();) {
  13799. e.next().print(t)
  13800. }
  13801. }, zh.prototype.iterator = function () {
  13802. return this.nodeMap.values().iterator()
  13803. }, zh.prototype.values = function () {
  13804. return this.nodeMap.values()
  13805. }, zh.prototype.getBoundaryNodes = function (t) {
  13806. for (var e = new lc, n = this.iterator(); n.hasNext();) {
  13807. var r = n.next();
  13808. r.getLabel().getLocation(t) === pl.BOUNDARY && e.add(r)
  13809. }
  13810. return e
  13811. }, zh.prototype.add = function (t) {
  13812. var e = t.getCoordinate();
  13813. this.addNode(e).add(t)
  13814. }, zh.prototype.interfaces_ = function () {
  13815. return []
  13816. }, zh.prototype.getClass = function () {
  13817. return zh
  13818. };
  13819. var jh = function () {},
  13820. Uh = {
  13821. NE: {
  13822. configurable: !0
  13823. },
  13824. NW: {
  13825. configurable: !0
  13826. },
  13827. SW: {
  13828. configurable: !0
  13829. },
  13830. SE: {
  13831. configurable: !0
  13832. }
  13833. };
  13834. jh.prototype.interfaces_ = function () {
  13835. return []
  13836. }, jh.prototype.getClass = function () {
  13837. return jh
  13838. }, jh.isNorthern = function (t) {
  13839. return t === jh.NE || t === jh.NW
  13840. }, jh.isOpposite = function (t, e) {
  13841. return t !== e && 2 === (t - e + 4) % 4
  13842. }, jh.commonHalfPlane = function (t, e) {
  13843. if (t === e) return t;
  13844. if (2 === (t - e + 4) % 4) return -1;
  13845. var n = t < e ? t : e;
  13846. return 0 === n && 3 === (t > e ? t : e) ? 3 : n
  13847. }, jh.isInHalfPlane = function (t, e) {
  13848. return e === jh.SE ? t === jh.SE || t === jh.SW : t === e || t === e + 1
  13849. }, jh.quadrant = function () {
  13850. if ("number" == typeof arguments[0] && "number" == typeof arguments[1]) {
  13851. var t = arguments[0],
  13852. e = arguments[1];
  13853. if (0 === t && 0 === e) throw new el("Cannot compute the quadrant for point ( " + t + ", " + e + " )");
  13854. return t >= 0 ? e >= 0 ? jh.NE : jh.SE : e >= 0 ? jh.NW : jh.SW
  13855. }
  13856. if (arguments[0] instanceof ul && arguments[1] instanceof ul) {
  13857. var n = arguments[0],
  13858. r = arguments[1];
  13859. if (r.x === n.x && r.y === n.y) throw new el("Cannot compute the quadrant for two identical points " + n);
  13860. return r.x >= n.x ? r.y >= n.y ? jh.NE : jh.SE : r.y >= n.y ? jh.NW : jh.SW
  13861. }
  13862. }, Uh.NE.get = function () {
  13863. return 0
  13864. }, Uh.NW.get = function () {
  13865. return 1
  13866. }, Uh.SW.get = function () {
  13867. return 2
  13868. }, Uh.SE.get = function () {
  13869. return 3
  13870. }, Object.defineProperties(jh, Uh);
  13871. var Vh = function () {
  13872. if (this._edge = null, this._label = null, this._node = null, this._p0 = null, this._p1 = null, this._dx = null, this._dy = null, this._quadrant = null, 1 === arguments.length) {
  13873. var t = arguments[0];
  13874. this._edge = t
  13875. } else if (3 === arguments.length) {
  13876. var e = arguments[0],
  13877. n = arguments[1],
  13878. r = arguments[2],
  13879. i = null;
  13880. this._edge = e, this.init(n, r), this._label = i
  13881. } else if (4 === arguments.length) {
  13882. var o = arguments[0],
  13883. s = arguments[1],
  13884. a = arguments[2],
  13885. u = arguments[3];
  13886. this._edge = o, this.init(s, a), this._label = u
  13887. }
  13888. };
  13889. Vh.prototype.compareDirection = function (t) {
  13890. return this._dx === t._dx && this._dy === t._dy ? 0 : this._quadrant > t._quadrant ? 1 : this._quadrant < t._quadrant ? -1 : Xl.computeOrientation(t._p0, t._p1, this._p1)
  13891. }, Vh.prototype.getDy = function () {
  13892. return this._dy
  13893. }, Vh.prototype.getCoordinate = function () {
  13894. return this._p0
  13895. }, Vh.prototype.setNode = function (t) {
  13896. this._node = t
  13897. }, Vh.prototype.print = function (t) {
  13898. var e = Math.atan2(this._dy, this._dx),
  13899. n = this.getClass().getName(),
  13900. r = n.lastIndexOf("."),
  13901. i = n.substring(r + 1);
  13902. t.print(" " + i + ": " + this._p0 + " - " + this._p1 + " " + this._quadrant + ":" + e + " " + this._label)
  13903. }, Vh.prototype.compareTo = function (t) {
  13904. var e = t;
  13905. return this.compareDirection(e)
  13906. }, Vh.prototype.getDirectedCoordinate = function () {
  13907. return this._p1
  13908. }, Vh.prototype.getDx = function () {
  13909. return this._dx
  13910. }, Vh.prototype.getLabel = function () {
  13911. return this._label
  13912. }, Vh.prototype.getEdge = function () {
  13913. return this._edge
  13914. }, Vh.prototype.getQuadrant = function () {
  13915. return this._quadrant
  13916. }, Vh.prototype.getNode = function () {
  13917. return this._node
  13918. }, Vh.prototype.toString = function () {
  13919. var t = Math.atan2(this._dy, this._dx),
  13920. e = this.getClass().getName(),
  13921. n = e.lastIndexOf(".");
  13922. return " " + e.substring(n + 1) + ": " + this._p0 + " - " + this._p1 + " " + this._quadrant + ":" + t + " " + this._label
  13923. }, Vh.prototype.computeLabel = function (t) {}, Vh.prototype.init = function (t, e) {
  13924. this._p0 = t, this._p1 = e, this._dx = e.x - t.x, this._dy = e.y - t.y, this._quadrant = jh.quadrant(this._dx, this._dy), ql.isTrue(!(0 === this._dx && 0 === this._dy), "EdgeEnd with identical endpoints found")
  13925. }, Vh.prototype.interfaces_ = function () {
  13926. return [il]
  13927. }, Vh.prototype.getClass = function () {
  13928. return Vh
  13929. };
  13930. var Xh = function (t) {
  13931. function e() {
  13932. var e = arguments[0],
  13933. n = arguments[1];
  13934. if (t.call(this, e), this._isForward = null, this._isInResult = !1, this._isVisited = !1, this._sym = null, this._next = null, this._nextMin = null, this._edgeRing = null, this._minEdgeRing = null, this._depth = [0, -999, -999], this._isForward = n, n) this.init(e.getCoordinate(0), e.getCoordinate(1));
  13935. else {
  13936. var r = e.getNumPoints() - 1;
  13937. this.init(e.getCoordinate(r), e.getCoordinate(r - 1))
  13938. }
  13939. this.computeDirectedLabel()
  13940. }
  13941. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getNextMin = function () {
  13942. return this._nextMin
  13943. }, e.prototype.getDepth = function (t) {
  13944. return this._depth[t]
  13945. }, e.prototype.setVisited = function (t) {
  13946. this._isVisited = t
  13947. }, e.prototype.computeDirectedLabel = function () {
  13948. this._label = new Dh(this._edge.getLabel()), this._isForward || this._label.flip()
  13949. }, e.prototype.getNext = function () {
  13950. return this._next
  13951. }, e.prototype.setDepth = function (t, e) {
  13952. if (-999 !== this._depth[t] && this._depth[t] !== e) throw new Oh("assigned depths do not match", this.getCoordinate());
  13953. this._depth[t] = e
  13954. }, e.prototype.isInteriorAreaEdge = function () {
  13955. for (var t = this, e = !0, n = 0; n < 2; n++) t._label.isArea(n) && t._label.getLocation(n, Sh.LEFT) === pl.INTERIOR && t._label.getLocation(n, Sh.RIGHT) === pl.INTERIOR || (e = !1);
  13956. return e
  13957. }, e.prototype.setNextMin = function (t) {
  13958. this._nextMin = t
  13959. }, e.prototype.print = function (e) {
  13960. t.prototype.print.call(this, e), e.print(" " + this._depth[Sh.LEFT] + "/" + this._depth[Sh.RIGHT]), e.print(" (" + this.getDepthDelta() + ")"), this._isInResult && e.print(" inResult")
  13961. }, e.prototype.setMinEdgeRing = function (t) {
  13962. this._minEdgeRing = t
  13963. }, e.prototype.isLineEdge = function () {
  13964. var t = this._label.isLine(0) || this._label.isLine(1),
  13965. e = !this._label.isArea(0) || this._label.allPositionsEqual(0, pl.EXTERIOR),
  13966. n = !this._label.isArea(1) || this._label.allPositionsEqual(1, pl.EXTERIOR);
  13967. return t && e && n
  13968. }, e.prototype.setEdgeRing = function (t) {
  13969. this._edgeRing = t
  13970. }, e.prototype.getMinEdgeRing = function () {
  13971. return this._minEdgeRing
  13972. }, e.prototype.getDepthDelta = function () {
  13973. var t = this._edge.getDepthDelta();
  13974. return this._isForward || (t = -t), t
  13975. }, e.prototype.setInResult = function (t) {
  13976. this._isInResult = t
  13977. }, e.prototype.getSym = function () {
  13978. return this._sym
  13979. }, e.prototype.isForward = function () {
  13980. return this._isForward
  13981. }, e.prototype.getEdge = function () {
  13982. return this._edge
  13983. }, e.prototype.printEdge = function (t) {
  13984. this.print(t), t.print(" "), this._isForward ? this._edge.print(t) : this._edge.printReverse(t)
  13985. }, e.prototype.setSym = function (t) {
  13986. this._sym = t
  13987. }, e.prototype.setVisitedEdge = function (t) {
  13988. this.setVisited(t), this._sym.setVisited(t)
  13989. }, e.prototype.setEdgeDepths = function (t, e) {
  13990. var n = this.getEdge().getDepthDelta();
  13991. this._isForward || (n = -n);
  13992. var r = 1;
  13993. t === Sh.LEFT && (r = -1);
  13994. var i = Sh.opposite(t),
  13995. o = e + n * r;
  13996. this.setDepth(t, e), this.setDepth(i, o)
  13997. }, e.prototype.getEdgeRing = function () {
  13998. return this._edgeRing
  13999. }, e.prototype.isInResult = function () {
  14000. return this._isInResult
  14001. }, e.prototype.setNext = function (t) {
  14002. this._next = t
  14003. }, e.prototype.isVisited = function () {
  14004. return this._isVisited
  14005. }, e.prototype.interfaces_ = function () {
  14006. return []
  14007. }, e.prototype.getClass = function () {
  14008. return e
  14009. }, e.depthFactor = function (t, e) {
  14010. return t === pl.EXTERIOR && e === pl.INTERIOR ? 1 : t === pl.INTERIOR && e === pl.EXTERIOR ? -1 : 0
  14011. }, e
  14012. }(Vh),
  14013. Yh = function () {};
  14014. Yh.prototype.createNode = function (t) {
  14015. return new Bh(t, null)
  14016. }, Yh.prototype.interfaces_ = function () {
  14017. return []
  14018. }, Yh.prototype.getClass = function () {
  14019. return Yh
  14020. };
  14021. var Hh = function () {
  14022. if (this._edges = new lc, this._nodes = null, this._edgeEndList = new lc, 0 === arguments.length) this._nodes = new zh(new Yh);
  14023. else if (1 === arguments.length) {
  14024. var t = arguments[0];
  14025. this._nodes = new zh(t)
  14026. }
  14027. };
  14028. Hh.prototype.printEdges = function (t) {
  14029. t.println("Edges:");
  14030. for (var e = 0; e < this._edges.size(); e++) {
  14031. t.println("edge " + e + ":");
  14032. var n = this._edges.get(e);
  14033. n.print(t), n.eiList.print(t)
  14034. }
  14035. }, Hh.prototype.find = function (t) {
  14036. return this._nodes.find(t)
  14037. }, Hh.prototype.addNode = function () {
  14038. if (arguments[0] instanceof Bh) {
  14039. var t = arguments[0];
  14040. return this._nodes.addNode(t)
  14041. }
  14042. if (arguments[0] instanceof ul) {
  14043. var e = arguments[0];
  14044. return this._nodes.addNode(e)
  14045. }
  14046. }, Hh.prototype.getNodeIterator = function () {
  14047. return this._nodes.iterator()
  14048. }, Hh.prototype.linkResultDirectedEdges = function () {
  14049. for (var t = this._nodes.iterator(); t.hasNext();) {
  14050. t.next().getEdges().linkResultDirectedEdges()
  14051. }
  14052. }, Hh.prototype.debugPrintln = function (t) {
  14053. Pl.out.println(t)
  14054. }, Hh.prototype.isBoundaryNode = function (t, e) {
  14055. var n = this._nodes.find(e);
  14056. if (null === n) return !1;
  14057. var r = n.getLabel();
  14058. return null !== r && r.getLocation(t) === pl.BOUNDARY
  14059. }, Hh.prototype.linkAllDirectedEdges = function () {
  14060. for (var t = this._nodes.iterator(); t.hasNext();) {
  14061. t.next().getEdges().linkAllDirectedEdges()
  14062. }
  14063. }, Hh.prototype.matchInSameDirection = function (t, e, n, r) {
  14064. return !!t.equals(n) && (Xl.computeOrientation(t, e, r) === Xl.COLLINEAR && jh.quadrant(t, e) === jh.quadrant(n, r))
  14065. }, Hh.prototype.getEdgeEnds = function () {
  14066. return this._edgeEndList
  14067. }, Hh.prototype.debugPrint = function (t) {
  14068. Pl.out.print(t)
  14069. }, Hh.prototype.getEdgeIterator = function () {
  14070. return this._edges.iterator()
  14071. }, Hh.prototype.findEdgeInSameDirection = function (t, e) {
  14072. for (var n = this, r = 0; r < this._edges.size(); r++) {
  14073. var i = n._edges.get(r),
  14074. o = i.getCoordinates();
  14075. if (n.matchInSameDirection(t, e, o[0], o[1])) return i;
  14076. if (n.matchInSameDirection(t, e, o[o.length - 1], o[o.length - 2])) return i
  14077. }
  14078. return null
  14079. }, Hh.prototype.insertEdge = function (t) {
  14080. this._edges.add(t)
  14081. }, Hh.prototype.findEdgeEnd = function (t) {
  14082. for (var e = this.getEdgeEnds().iterator(); e.hasNext();) {
  14083. var n = e.next();
  14084. if (n.getEdge() === t) return n
  14085. }
  14086. return null
  14087. }, Hh.prototype.addEdges = function (t) {
  14088. for (var e = this, n = t.iterator(); n.hasNext();) {
  14089. var r = n.next();
  14090. e._edges.add(r);
  14091. var i = new Xh(r, !0),
  14092. o = new Xh(r, !1);
  14093. i.setSym(o), o.setSym(i), e.add(i), e.add(o)
  14094. }
  14095. }, Hh.prototype.add = function (t) {
  14096. this._nodes.add(t), this._edgeEndList.add(t)
  14097. }, Hh.prototype.getNodes = function () {
  14098. return this._nodes.values()
  14099. }, Hh.prototype.findEdge = function (t, e) {
  14100. for (var n = 0; n < this._edges.size(); n++) {
  14101. var r = this._edges.get(n),
  14102. i = r.getCoordinates();
  14103. if (t.equals(i[0]) && e.equals(i[1])) return r
  14104. }
  14105. return null
  14106. }, Hh.prototype.interfaces_ = function () {
  14107. return []
  14108. }, Hh.prototype.getClass = function () {
  14109. return Hh
  14110. }, Hh.linkResultDirectedEdges = function (t) {
  14111. for (var e = t.iterator(); e.hasNext();) {
  14112. e.next().getEdges().linkResultDirectedEdges()
  14113. }
  14114. };
  14115. var Wh = function () {
  14116. this._geometryFactory = null, this._shellList = new lc;
  14117. var t = arguments[0];
  14118. this._geometryFactory = t
  14119. };
  14120. Wh.prototype.sortShellsAndHoles = function (t, e, n) {
  14121. for (var r = t.iterator(); r.hasNext();) {
  14122. var i = r.next();
  14123. i.isHole() ? n.add(i) : e.add(i)
  14124. }
  14125. }, Wh.prototype.computePolygons = function (t) {
  14126. for (var e = new lc, n = t.iterator(); n.hasNext();) {
  14127. var r = n.next().toPolygon(this._geometryFactory);
  14128. e.add(r)
  14129. }
  14130. return e
  14131. }, Wh.prototype.placeFreeHoles = function (t, e) {
  14132. for (var n = e.iterator(); n.hasNext();) {
  14133. var r = n.next();
  14134. if (null === r.getShell()) {
  14135. var i = this.findEdgeRingContaining(r, t);
  14136. if (null === i) throw new Oh("unable to assign hole to a shell", r.getCoordinate(0));
  14137. r.setShell(i)
  14138. }
  14139. }
  14140. }, Wh.prototype.buildMinimalEdgeRings = function (t, e, n) {
  14141. for (var r = new lc, i = t.iterator(); i.hasNext();) {
  14142. var o = i.next();
  14143. if (o.getMaxNodeDegree() > 2) {
  14144. o.linkDirectedEdgesForMinimalEdgeRings();
  14145. var s = o.buildMinimalRings(),
  14146. a = this.findShell(s);
  14147. null !== a ? (this.placePolygonHoles(a, s), e.add(a)) : n.addAll(s)
  14148. } else r.add(o)
  14149. }
  14150. return r
  14151. }, Wh.prototype.containsPoint = function (t) {
  14152. for (var e = this._shellList.iterator(); e.hasNext();) {
  14153. if (e.next().containsPoint(t)) return !0
  14154. }
  14155. return !1
  14156. }, Wh.prototype.buildMaximalEdgeRings = function (t) {
  14157. for (var e = new lc, n = t.iterator(); n.hasNext();) {
  14158. var r = n.next();
  14159. if (r.isInResult() && r.getLabel().isArea() && null === r.getEdgeRing()) {
  14160. var i = new Gh(r, this._geometryFactory);
  14161. e.add(i), i.setInResult()
  14162. }
  14163. }
  14164. return e
  14165. }, Wh.prototype.placePolygonHoles = function (t, e) {
  14166. for (var n = e.iterator(); n.hasNext();) {
  14167. var r = n.next();
  14168. r.isHole() && r.setShell(t)
  14169. }
  14170. }, Wh.prototype.getPolygons = function () {
  14171. return this.computePolygons(this._shellList)
  14172. }, Wh.prototype.findEdgeRingContaining = function (t, e) {
  14173. for (var n = t.getLinearRing(), r = n.getEnvelopeInternal(), i = n.getCoordinateN(0), o = null, s = null, a = e.iterator(); a.hasNext();) {
  14174. var u = a.next(),
  14175. l = u.getLinearRing(),
  14176. c = l.getEnvelopeInternal();
  14177. null !== o && (s = o.getLinearRing().getEnvelopeInternal());
  14178. var h = !1;
  14179. c.contains(r) && Xl.isPointInRing(i, l.getCoordinates()) && (h = !0), h && (null === o || s.contains(c)) && (o = u)
  14180. }
  14181. return o
  14182. }, Wh.prototype.findShell = function (t) {
  14183. for (var e = 0, n = null, r = t.iterator(); r.hasNext();) {
  14184. var i = r.next();
  14185. i.isHole() || (n = i, e++)
  14186. }
  14187. return ql.isTrue(e <= 1, "found two shells in MinimalEdgeRing list"), n
  14188. }, Wh.prototype.add = function () {
  14189. if (1 === arguments.length) {
  14190. var t = arguments[0];
  14191. this.add(t.getEdgeEnds(), t.getNodes())
  14192. } else if (2 === arguments.length) {
  14193. var e = arguments[0],
  14194. n = arguments[1];
  14195. Hh.linkResultDirectedEdges(n);
  14196. var r = this.buildMaximalEdgeRings(e),
  14197. i = new lc,
  14198. o = this.buildMinimalEdgeRings(r, this._shellList, i);
  14199. this.sortShellsAndHoles(o, this._shellList, i), this.placeFreeHoles(this._shellList, i)
  14200. }
  14201. }, Wh.prototype.interfaces_ = function () {
  14202. return []
  14203. }, Wh.prototype.getClass = function () {
  14204. return Wh
  14205. };
  14206. var Jh = function () {};
  14207. Jh.prototype.getBounds = function () {}, Jh.prototype.interfaces_ = function () {
  14208. return []
  14209. }, Jh.prototype.getClass = function () {
  14210. return Jh
  14211. };
  14212. var Zh = function () {
  14213. this._bounds = null, this._item = null;
  14214. var t = arguments[0],
  14215. e = arguments[1];
  14216. this._bounds = t, this._item = e
  14217. };
  14218. Zh.prototype.getItem = function () {
  14219. return this._item
  14220. }, Zh.prototype.getBounds = function () {
  14221. return this._bounds
  14222. }, Zh.prototype.interfaces_ = function () {
  14223. return [Jh, al]
  14224. }, Zh.prototype.getClass = function () {
  14225. return Zh
  14226. };
  14227. var Kh = function () {
  14228. this._size = null, this._items = null, this._size = 0, this._items = new lc, this._items.add(null)
  14229. };
  14230. Kh.prototype.poll = function () {
  14231. if (this.isEmpty()) return null;
  14232. var t = this._items.get(1);
  14233. return this._items.set(1, this._items.get(this._size)), this._size -= 1, this.reorder(1), t
  14234. }, Kh.prototype.size = function () {
  14235. return this._size
  14236. }, Kh.prototype.reorder = function (t) {
  14237. for (var e = this, n = null, r = this._items.get(t); 2 * t <= this._size && ((n = 2 * t) !== e._size && e._items.get(n + 1).compareTo(e._items.get(n)) < 0 && n++, e._items.get(n).compareTo(r) < 0); t = n) e._items.set(t, e._items.get(n));
  14238. this._items.set(t, r)
  14239. }, Kh.prototype.clear = function () {
  14240. this._size = 0, this._items.clear()
  14241. }, Kh.prototype.isEmpty = function () {
  14242. return 0 === this._size
  14243. }, Kh.prototype.add = function (t) {
  14244. this._items.add(null), this._size += 1;
  14245. var e = this._size;
  14246. for (this._items.set(0, t); t.compareTo(this._items.get(Math.trunc(e / 2))) < 0; e /= 2) this._items.set(e, this._items.get(Math.trunc(e / 2)));
  14247. this._items.set(e, t)
  14248. }, Kh.prototype.interfaces_ = function () {
  14249. return []
  14250. }, Kh.prototype.getClass = function () {
  14251. return Kh
  14252. };
  14253. var Qh = function () {};
  14254. Qh.prototype.visitItem = function (t) {}, Qh.prototype.interfaces_ = function () {
  14255. return []
  14256. }, Qh.prototype.getClass = function () {
  14257. return Qh
  14258. };
  14259. var $h = function () {};
  14260. $h.prototype.insert = function (t, e) {}, $h.prototype.remove = function (t, e) {}, $h.prototype.query = function () {}, $h.prototype.interfaces_ = function () {
  14261. return []
  14262. }, $h.prototype.getClass = function () {
  14263. return $h
  14264. };
  14265. var tp = function () {
  14266. if (this._childBoundables = new lc, this._bounds = null, this._level = null, 0 === arguments.length);
  14267. else if (1 === arguments.length) {
  14268. var t = arguments[0];
  14269. this._level = t
  14270. }
  14271. },
  14272. ep = {
  14273. serialVersionUID: {
  14274. configurable: !0
  14275. }
  14276. };
  14277. tp.prototype.getLevel = function () {
  14278. return this._level
  14279. }, tp.prototype.size = function () {
  14280. return this._childBoundables.size()
  14281. }, tp.prototype.getChildBoundables = function () {
  14282. return this._childBoundables
  14283. }, tp.prototype.addChildBoundable = function (t) {
  14284. ql.isTrue(null === this._bounds), this._childBoundables.add(t)
  14285. }, tp.prototype.isEmpty = function () {
  14286. return this._childBoundables.isEmpty()
  14287. }, tp.prototype.getBounds = function () {
  14288. return null === this._bounds && (this._bounds = this.computeBounds()), this._bounds
  14289. }, tp.prototype.interfaces_ = function () {
  14290. return [Jh, al]
  14291. }, tp.prototype.getClass = function () {
  14292. return tp
  14293. }, ep.serialVersionUID.get = function () {
  14294. return 0x5a1e55ec41369800
  14295. }, Object.defineProperties(tp, ep);
  14296. var np = function () {};
  14297. np.reverseOrder = function () {
  14298. return {
  14299. compare: function (t, e) {
  14300. return e.compareTo(t)
  14301. }
  14302. }
  14303. }, np.min = function (t) {
  14304. return np.sort(t), t.get(0)
  14305. }, np.sort = function (t, e) {
  14306. var n = t.toArray();
  14307. e ? Rc.sort(n, e) : Rc.sort(n);
  14308. for (var r = t.iterator(), i = 0, o = n.length; i < o; i++) r.next(), r.set(n[i])
  14309. }, np.singletonList = function (t) {
  14310. var e = new lc;
  14311. return e.add(t), e
  14312. };
  14313. var rp = function () {
  14314. this._boundable1 = null, this._boundable2 = null, this._distance = null, this._itemDistance = null;
  14315. var t = arguments[0],
  14316. e = arguments[1],
  14317. n = arguments[2];
  14318. this._boundable1 = t, this._boundable2 = e, this._itemDistance = n, this._distance = this.distance()
  14319. };
  14320. rp.prototype.expandToQueue = function (t, e) {
  14321. var n = rp.isComposite(this._boundable1),
  14322. r = rp.isComposite(this._boundable2);
  14323. if (n && r) return rp.area(this._boundable1) > rp.area(this._boundable2) ? (this.expand(this._boundable1, this._boundable2, t, e), null) : (this.expand(this._boundable2, this._boundable1, t, e), null);
  14324. if (n) return this.expand(this._boundable1, this._boundable2, t, e), null;
  14325. if (r) return this.expand(this._boundable2, this._boundable1, t, e), null;
  14326. throw new el("neither boundable is composite")
  14327. }, rp.prototype.isLeaves = function () {
  14328. return !(rp.isComposite(this._boundable1) || rp.isComposite(this._boundable2))
  14329. }, rp.prototype.compareTo = function (t) {
  14330. var e = t;
  14331. return this._distance < e._distance ? -1 : this._distance > e._distance ? 1 : 0
  14332. }, rp.prototype.expand = function (t, e, n, r) {
  14333. for (var i = t.getChildBoundables().iterator(); i.hasNext();) {
  14334. var o = i.next(),
  14335. s = new rp(o, e, this._itemDistance);
  14336. s.getDistance() < r && n.add(s)
  14337. }
  14338. }, rp.prototype.getBoundable = function (t) {
  14339. return 0 === t ? this._boundable1 : this._boundable2
  14340. }, rp.prototype.getDistance = function () {
  14341. return this._distance
  14342. }, rp.prototype.distance = function () {
  14343. return this.isLeaves() ? this._itemDistance.distance(this._boundable1, this._boundable2) : this._boundable1.getBounds().distance(this._boundable2.getBounds())
  14344. }, rp.prototype.interfaces_ = function () {
  14345. return [il]
  14346. }, rp.prototype.getClass = function () {
  14347. return rp
  14348. }, rp.area = function (t) {
  14349. return t.getBounds().getArea()
  14350. }, rp.isComposite = function (t) {
  14351. return t instanceof tp
  14352. };
  14353. var ip = function t() {
  14354. if (this._root = null, this._built = !1, this._itemBoundables = new lc, this._nodeCapacity = null, 0 === arguments.length) {
  14355. var e = t.DEFAULT_NODE_CAPACITY;
  14356. this._nodeCapacity = e
  14357. } else if (1 === arguments.length) {
  14358. var n = arguments[0];
  14359. ql.isTrue(n > 1, "Node capacity must be greater than 1"), this._nodeCapacity = n
  14360. }
  14361. },
  14362. op = {
  14363. IntersectsOp: {
  14364. configurable: !0
  14365. },
  14366. serialVersionUID: {
  14367. configurable: !0
  14368. },
  14369. DEFAULT_NODE_CAPACITY: {
  14370. configurable: !0
  14371. }
  14372. };
  14373. ip.prototype.getNodeCapacity = function () {
  14374. return this._nodeCapacity
  14375. }, ip.prototype.lastNode = function (t) {
  14376. return t.get(t.size() - 1)
  14377. }, ip.prototype.size = function () {
  14378. var t = this;
  14379. if (0 === arguments.length) return this.isEmpty() ? 0 : (this.build(), this.size(this._root));
  14380. if (1 === arguments.length) {
  14381. for (var e = arguments[0], n = 0, r = e.getChildBoundables().iterator(); r.hasNext();) {
  14382. var i = r.next();
  14383. i instanceof tp ? n += t.size(i) : i instanceof Zh && (n += 1)
  14384. }
  14385. return n
  14386. }
  14387. }, ip.prototype.removeItem = function (t, e) {
  14388. for (var n = null, r = t.getChildBoundables().iterator(); r.hasNext();) {
  14389. var i = r.next();
  14390. i instanceof Zh && i.getItem() === e && (n = i)
  14391. }
  14392. return null !== n && (t.getChildBoundables().remove(n), !0)
  14393. }, ip.prototype.itemsTree = function () {
  14394. var t = this;
  14395. if (0 === arguments.length) {
  14396. this.build();
  14397. var e = this.itemsTree(this._root);
  14398. return null === e ? new lc : e
  14399. }
  14400. if (1 === arguments.length) {
  14401. for (var n = arguments[0], r = new lc, i = n.getChildBoundables().iterator(); i.hasNext();) {
  14402. var o = i.next();
  14403. if (o instanceof tp) {
  14404. var s = t.itemsTree(o);
  14405. null !== s && r.add(s)
  14406. } else o instanceof Zh ? r.add(o.getItem()) : ql.shouldNeverReachHere()
  14407. }
  14408. return r.size() <= 0 ? null : r
  14409. }
  14410. }, ip.prototype.insert = function (t, e) {
  14411. ql.isTrue(!this._built, "Cannot insert items into an STR packed R-tree after it has been built."), this._itemBoundables.add(new Zh(t, e))
  14412. }, ip.prototype.boundablesAtLevel = function () {
  14413. var t = this;
  14414. if (1 === arguments.length) {
  14415. var e = arguments[0],
  14416. n = new lc;
  14417. return this.boundablesAtLevel(e, this._root, n), n
  14418. }
  14419. if (3 === arguments.length) {
  14420. var r = arguments[0],
  14421. i = arguments[1],
  14422. o = arguments[2];
  14423. if (ql.isTrue(r > -2), i.getLevel() === r) return o.add(i), null;
  14424. for (var s = i.getChildBoundables().iterator(); s.hasNext();) {
  14425. var a = s.next();
  14426. a instanceof tp ? t.boundablesAtLevel(r, a, o) : (ql.isTrue(a instanceof Zh), -1 === r && o.add(a))
  14427. }
  14428. return null
  14429. }
  14430. }, ip.prototype.query = function () {
  14431. var t = this;
  14432. if (1 === arguments.length) {
  14433. var e = arguments[0];
  14434. this.build();
  14435. var n = new lc;
  14436. return this.isEmpty() || this.getIntersectsOp().intersects(this._root.getBounds(), e) && this.query(e, this._root, n), n
  14437. }
  14438. if (2 === arguments.length) {
  14439. var r = arguments[0],
  14440. i = arguments[1];
  14441. if (this.build(), this.isEmpty()) return null;
  14442. this.getIntersectsOp().intersects(this._root.getBounds(), r) && this.query(r, this._root, i)
  14443. } else if (3 === arguments.length)
  14444. if (gl(arguments[2], Qh) && arguments[0] instanceof Object && arguments[1] instanceof tp)
  14445. for (var o = arguments[0], s = arguments[1], a = arguments[2], u = s.getChildBoundables(), l = 0; l < u.size(); l++) {
  14446. var c = u.get(l);
  14447. t.getIntersectsOp().intersects(c.getBounds(), o) && (c instanceof tp ? t.query(o, c, a) : c instanceof Zh ? a.visitItem(c.getItem()) : ql.shouldNeverReachHere())
  14448. } else if (gl(arguments[2], ac) && arguments[0] instanceof Object && arguments[1] instanceof tp)
  14449. for (var h = arguments[0], p = arguments[1], f = arguments[2], g = p.getChildBoundables(), d = 0; d < g.size(); d++) {
  14450. var y = g.get(d);
  14451. t.getIntersectsOp().intersects(y.getBounds(), h) && (y instanceof tp ? t.query(h, y, f) : y instanceof Zh ? f.add(y.getItem()) : ql.shouldNeverReachHere())
  14452. }
  14453. }, ip.prototype.build = function () {
  14454. if (this._built) return null;
  14455. this._root = this._itemBoundables.isEmpty() ? this.createNode(0) : this.createHigherLevels(this._itemBoundables, -1), this._itemBoundables = null, this._built = !0
  14456. }, ip.prototype.getRoot = function () {
  14457. return this.build(), this._root
  14458. }, ip.prototype.remove = function () {
  14459. var t = this;
  14460. if (2 === arguments.length) {
  14461. var e = arguments[0],
  14462. n = arguments[1];
  14463. return this.build(), !!this.getIntersectsOp().intersects(this._root.getBounds(), e) && this.remove(e, this._root, n)
  14464. }
  14465. if (3 === arguments.length) {
  14466. var r = arguments[0],
  14467. i = arguments[1],
  14468. o = arguments[2],
  14469. s = this.removeItem(i, o);
  14470. if (s) return !0;
  14471. for (var a = null, u = i.getChildBoundables().iterator(); u.hasNext();) {
  14472. var l = u.next();
  14473. if (t.getIntersectsOp().intersects(l.getBounds(), r) && (l instanceof tp && (s = t.remove(r, l, o)))) {
  14474. a = l;
  14475. break
  14476. }
  14477. }
  14478. return null !== a && a.getChildBoundables().isEmpty() && i.getChildBoundables().remove(a), s
  14479. }
  14480. }, ip.prototype.createHigherLevels = function (t, e) {
  14481. ql.isTrue(!t.isEmpty());
  14482. var n = this.createParentBoundables(t, e + 1);
  14483. return 1 === n.size() ? n.get(0) : this.createHigherLevels(n, e + 1)
  14484. }, ip.prototype.depth = function () {
  14485. var t = this;
  14486. if (0 === arguments.length) return this.isEmpty() ? 0 : (this.build(), this.depth(this._root));
  14487. if (1 === arguments.length) {
  14488. for (var e = arguments[0], n = 0, r = e.getChildBoundables().iterator(); r.hasNext();) {
  14489. var i = r.next();
  14490. if (i instanceof tp) {
  14491. var o = t.depth(i);
  14492. o > n && (n = o)
  14493. }
  14494. }
  14495. return n + 1
  14496. }
  14497. }, ip.prototype.createParentBoundables = function (t, e) {
  14498. var n = this;
  14499. ql.isTrue(!t.isEmpty());
  14500. var r = new lc;
  14501. r.add(this.createNode(e));
  14502. var i = new lc(t);
  14503. np.sort(i, this.getComparator());
  14504. for (var o = i.iterator(); o.hasNext();) {
  14505. var s = o.next();
  14506. n.lastNode(r).getChildBoundables().size() === n.getNodeCapacity() && r.add(n.createNode(e)), n.lastNode(r).addChildBoundable(s)
  14507. }
  14508. return r
  14509. }, ip.prototype.isEmpty = function () {
  14510. return this._built ? this._root.isEmpty() : this._itemBoundables.isEmpty()
  14511. }, ip.prototype.interfaces_ = function () {
  14512. return [al]
  14513. }, ip.prototype.getClass = function () {
  14514. return ip
  14515. }, ip.compareDoubles = function (t, e) {
  14516. return t > e ? 1 : t < e ? -1 : 0
  14517. }, op.IntersectsOp.get = function () {
  14518. return sp
  14519. }, op.serialVersionUID.get = function () {
  14520. return -0x35ef64c82d4c5400
  14521. }, op.DEFAULT_NODE_CAPACITY.get = function () {
  14522. return 10
  14523. }, Object.defineProperties(ip, op);
  14524. var sp = function () {},
  14525. ap = function () {};
  14526. ap.prototype.distance = function (t, e) {}, ap.prototype.interfaces_ = function () {
  14527. return []
  14528. }, ap.prototype.getClass = function () {
  14529. return ap
  14530. };
  14531. var up = function (t) {
  14532. function e(n) {
  14533. n = n || e.DEFAULT_NODE_CAPACITY, t.call(this, n)
  14534. }
  14535. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  14536. var n = {
  14537. STRtreeNode: {
  14538. configurable: !0
  14539. },
  14540. serialVersionUID: {
  14541. configurable: !0
  14542. },
  14543. xComparator: {
  14544. configurable: !0
  14545. },
  14546. yComparator: {
  14547. configurable: !0
  14548. },
  14549. intersectsOp: {
  14550. configurable: !0
  14551. },
  14552. DEFAULT_NODE_CAPACITY: {
  14553. configurable: !0
  14554. }
  14555. };
  14556. return e.prototype.createParentBoundablesFromVerticalSlices = function (t, e) {
  14557. ql.isTrue(t.length > 0);
  14558. for (var n = new lc, r = 0; r < t.length; r++) n.addAll(this.createParentBoundablesFromVerticalSlice(t[r], e));
  14559. return n
  14560. }, e.prototype.createNode = function (t) {
  14561. return new lp(t)
  14562. }, e.prototype.size = function () {
  14563. return 0 === arguments.length ? t.prototype.size.call(this) : t.prototype.size.apply(this, arguments)
  14564. }, e.prototype.insert = function () {
  14565. if (2 !== arguments.length) return t.prototype.insert.apply(this, arguments);
  14566. var e = arguments[0],
  14567. n = arguments[1];
  14568. if (e.isNull()) return null;
  14569. t.prototype.insert.call(this, e, n)
  14570. }, e.prototype.getIntersectsOp = function () {
  14571. return e.intersectsOp
  14572. }, e.prototype.verticalSlices = function (t, e) {
  14573. for (var n = Math.trunc(Math.ceil(t.size() / e)), r = new Array(e).fill(null), i = t.iterator(), o = 0; o < e; o++) {
  14574. r[o] = new lc;
  14575. for (var s = 0; i.hasNext() && s < n;) {
  14576. var a = i.next();
  14577. r[o].add(a), s++
  14578. }
  14579. }
  14580. return r
  14581. }, e.prototype.query = function () {
  14582. if (1 === arguments.length) {
  14583. var e = arguments[0];
  14584. return t.prototype.query.call(this, e)
  14585. }
  14586. if (2 === arguments.length) {
  14587. var n = arguments[0],
  14588. r = arguments[1];
  14589. t.prototype.query.call(this, n, r)
  14590. } else if (3 === arguments.length)
  14591. if (gl(arguments[2], Qh) && arguments[0] instanceof Object && arguments[1] instanceof tp) {
  14592. var i = arguments[0],
  14593. o = arguments[1],
  14594. s = arguments[2];
  14595. t.prototype.query.call(this, i, o, s)
  14596. } else if (gl(arguments[2], ac) && arguments[0] instanceof Object && arguments[1] instanceof tp) {
  14597. var a = arguments[0],
  14598. u = arguments[1],
  14599. l = arguments[2];
  14600. t.prototype.query.call(this, a, u, l)
  14601. }
  14602. }, e.prototype.getComparator = function () {
  14603. return e.yComparator
  14604. }, e.prototype.createParentBoundablesFromVerticalSlice = function (e, n) {
  14605. return t.prototype.createParentBoundables.call(this, e, n)
  14606. }, e.prototype.remove = function () {
  14607. if (2 === arguments.length) {
  14608. var e = arguments[0],
  14609. n = arguments[1];
  14610. return t.prototype.remove.call(this, e, n)
  14611. }
  14612. return t.prototype.remove.apply(this, arguments)
  14613. }, e.prototype.depth = function () {
  14614. return 0 === arguments.length ? t.prototype.depth.call(this) : t.prototype.depth.apply(this, arguments)
  14615. }, e.prototype.createParentBoundables = function (t, n) {
  14616. ql.isTrue(!t.isEmpty());
  14617. var r = Math.trunc(Math.ceil(t.size() / this.getNodeCapacity())),
  14618. i = new lc(t);
  14619. np.sort(i, e.xComparator);
  14620. var o = this.verticalSlices(i, Math.trunc(Math.ceil(Math.sqrt(r))));
  14621. return this.createParentBoundablesFromVerticalSlices(o, n)
  14622. }, e.prototype.nearestNeighbour = function () {
  14623. if (1 === arguments.length) {
  14624. if (gl(arguments[0], ap)) {
  14625. var t = arguments[0],
  14626. n = new rp(this.getRoot(), this.getRoot(), t);
  14627. return this.nearestNeighbour(n)
  14628. }
  14629. if (arguments[0] instanceof rp) {
  14630. var r = arguments[0];
  14631. return this.nearestNeighbour(r, nl.POSITIVE_INFINITY)
  14632. }
  14633. } else if (2 === arguments.length) {
  14634. if (arguments[0] instanceof e && gl(arguments[1], ap)) {
  14635. var i = arguments[0],
  14636. o = arguments[1],
  14637. s = new rp(this.getRoot(), i.getRoot(), o);
  14638. return this.nearestNeighbour(s)
  14639. }
  14640. if (arguments[0] instanceof rp && "number" == typeof arguments[1]) {
  14641. var a = arguments[0],
  14642. u = arguments[1],
  14643. l = u,
  14644. c = null,
  14645. h = new Kh;
  14646. for (h.add(a); !h.isEmpty() && l > 0;) {
  14647. var p = h.poll(),
  14648. f = p.getDistance();
  14649. if (f >= l) break;
  14650. p.isLeaves() ? (l = f, c = p) : p.expandToQueue(h, l)
  14651. }
  14652. return [c.getBoundable(0).getItem(), c.getBoundable(1).getItem()]
  14653. }
  14654. } else if (3 === arguments.length) {
  14655. var g = arguments[0],
  14656. d = arguments[1],
  14657. y = arguments[2],
  14658. v = new Zh(g, d),
  14659. _ = new rp(this.getRoot(), v, y);
  14660. return this.nearestNeighbour(_)[0]
  14661. }
  14662. }, e.prototype.interfaces_ = function () {
  14663. return [$h, al]
  14664. }, e.prototype.getClass = function () {
  14665. return e
  14666. }, e.centreX = function (t) {
  14667. return e.avg(t.getMinX(), t.getMaxX())
  14668. }, e.avg = function (t, e) {
  14669. return (t + e) / 2
  14670. }, e.centreY = function (t) {
  14671. return e.avg(t.getMinY(), t.getMaxY())
  14672. }, n.STRtreeNode.get = function () {
  14673. return lp
  14674. }, n.serialVersionUID.get = function () {
  14675. return 0x39920f7d5f261e0
  14676. }, n.xComparator.get = function () {
  14677. return {
  14678. interfaces_: function () {
  14679. return [sl]
  14680. },
  14681. compare: function (n, r) {
  14682. return t.compareDoubles(e.centreX(n.getBounds()), e.centreX(r.getBounds()))
  14683. }
  14684. }
  14685. }, n.yComparator.get = function () {
  14686. return {
  14687. interfaces_: function () {
  14688. return [sl]
  14689. },
  14690. compare: function (n, r) {
  14691. return t.compareDoubles(e.centreY(n.getBounds()), e.centreY(r.getBounds()))
  14692. }
  14693. }
  14694. }, n.intersectsOp.get = function () {
  14695. return {
  14696. interfaces_: function () {
  14697. return [t.IntersectsOp]
  14698. },
  14699. intersects: function (t, e) {
  14700. return t.intersects(e)
  14701. }
  14702. }
  14703. }, n.DEFAULT_NODE_CAPACITY.get = function () {
  14704. return 10
  14705. }, Object.defineProperties(e, n), e
  14706. }(ip),
  14707. lp = function (t) {
  14708. function e() {
  14709. var e = arguments[0];
  14710. t.call(this, e)
  14711. }
  14712. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.computeBounds = function () {
  14713. for (var t = null, e = this.getChildBoundables().iterator(); e.hasNext();) {
  14714. var n = e.next();
  14715. null === t ? t = new Ll(n.getBounds()) : t.expandToInclude(n.getBounds())
  14716. }
  14717. return t
  14718. }, e.prototype.interfaces_ = function () {
  14719. return []
  14720. }, e.prototype.getClass = function () {
  14721. return e
  14722. }, e
  14723. }(tp),
  14724. cp = function () {};
  14725. cp.prototype.interfaces_ = function () {
  14726. return []
  14727. }, cp.prototype.getClass = function () {
  14728. return cp
  14729. }, cp.relativeSign = function (t, e) {
  14730. return t < e ? -1 : t > e ? 1 : 0
  14731. }, cp.compare = function (t, e, n) {
  14732. if (e.equals2D(n)) return 0;
  14733. var r = cp.relativeSign(e.x, n.x),
  14734. i = cp.relativeSign(e.y, n.y);
  14735. switch (t) {
  14736. case 0:
  14737. return cp.compareValue(r, i);
  14738. case 1:
  14739. return cp.compareValue(i, r);
  14740. case 2:
  14741. return cp.compareValue(i, -r);
  14742. case 3:
  14743. return cp.compareValue(-r, i);
  14744. case 4:
  14745. return cp.compareValue(-r, -i);
  14746. case 5:
  14747. return cp.compareValue(-i, -r);
  14748. case 6:
  14749. return cp.compareValue(-i, r);
  14750. case 7:
  14751. return cp.compareValue(r, -i)
  14752. }
  14753. return ql.shouldNeverReachHere("invalid octant value"), 0
  14754. }, cp.compareValue = function (t, e) {
  14755. return t < 0 ? -1 : t > 0 ? 1 : e < 0 ? -1 : e > 0 ? 1 : 0
  14756. };
  14757. var hp = function () {
  14758. this._segString = null, this.coord = null, this.segmentIndex = null, this._segmentOctant = null, this._isInterior = null;
  14759. var t = arguments[0],
  14760. e = arguments[1],
  14761. n = arguments[2],
  14762. r = arguments[3];
  14763. this._segString = t, this.coord = new ul(e), this.segmentIndex = n, this._segmentOctant = r, this._isInterior = !e.equals2D(t.getCoordinate(n))
  14764. };
  14765. hp.prototype.getCoordinate = function () {
  14766. return this.coord
  14767. }, hp.prototype.print = function (t) {
  14768. t.print(this.coord), t.print(" seg # = " + this.segmentIndex)
  14769. }, hp.prototype.compareTo = function (t) {
  14770. var e = t;
  14771. return this.segmentIndex < e.segmentIndex ? -1 : this.segmentIndex > e.segmentIndex ? 1 : this.coord.equals2D(e.coord) ? 0 : cp.compare(this._segmentOctant, this.coord, e.coord)
  14772. }, hp.prototype.isEndPoint = function (t) {
  14773. return 0 === this.segmentIndex && !this._isInterior || this.segmentIndex === t
  14774. }, hp.prototype.isInterior = function () {
  14775. return this._isInterior
  14776. }, hp.prototype.interfaces_ = function () {
  14777. return [il]
  14778. }, hp.prototype.getClass = function () {
  14779. return hp
  14780. };
  14781. var pp = function () {
  14782. this._nodeMap = new Cc, this._edge = null;
  14783. var t = arguments[0];
  14784. this._edge = t
  14785. };
  14786. pp.prototype.getSplitCoordinates = function () {
  14787. var t = new hc;
  14788. this.addEndpoints();
  14789. for (var e = this.iterator(), n = e.next(); e.hasNext();) {
  14790. var r = e.next();
  14791. this.addEdgeCoordinates(n, r, t), n = r
  14792. }
  14793. return t.toCoordinateArray()
  14794. }, pp.prototype.addCollapsedNodes = function () {
  14795. var t = new lc;
  14796. this.findCollapsesFromInsertedNodes(t), this.findCollapsesFromExistingVertices(t);
  14797. for (var e = t.iterator(); e.hasNext();) {
  14798. var n = e.next().intValue();
  14799. this.add(this._edge.getCoordinate(n), n)
  14800. }
  14801. }, pp.prototype.print = function (t) {
  14802. t.println("Intersections:");
  14803. for (var e = this.iterator(); e.hasNext();) {
  14804. e.next().print(t)
  14805. }
  14806. }, pp.prototype.findCollapsesFromExistingVertices = function (t) {
  14807. for (var e = 0; e < this._edge.size() - 2; e++) {
  14808. var n = this._edge.getCoordinate(e),
  14809. r = this._edge.getCoordinate(e + 2);
  14810. n.equals2D(r) && t.add(new _l(e + 1))
  14811. }
  14812. }, pp.prototype.addEdgeCoordinates = function (t, e, n) {
  14813. var r = this._edge.getCoordinate(e.segmentIndex),
  14814. i = e.isInterior() || !e.coord.equals2D(r);
  14815. n.add(new ul(t.coord), !1);
  14816. for (var o = t.segmentIndex + 1; o <= e.segmentIndex; o++) n.add(this._edge.getCoordinate(o));
  14817. i && n.add(new ul(e.coord))
  14818. }, pp.prototype.iterator = function () {
  14819. return this._nodeMap.values().iterator()
  14820. }, pp.prototype.addSplitEdges = function (t) {
  14821. this.addEndpoints(), this.addCollapsedNodes();
  14822. for (var e = this.iterator(), n = e.next(); e.hasNext();) {
  14823. var r = e.next(),
  14824. i = this.createSplitEdge(n, r);
  14825. t.add(i), n = r
  14826. }
  14827. }, pp.prototype.findCollapseIndex = function (t, e, n) {
  14828. if (!t.coord.equals2D(e.coord)) return !1;
  14829. var r = e.segmentIndex - t.segmentIndex;
  14830. return e.isInterior() || r--, 1 === r && (n[0] = t.segmentIndex + 1, !0)
  14831. }, pp.prototype.findCollapsesFromInsertedNodes = function (t) {
  14832. for (var e = new Array(1).fill(null), n = this.iterator(), r = n.next(); n.hasNext();) {
  14833. var i = n.next();
  14834. this.findCollapseIndex(r, i, e) && t.add(new _l(e[0])), r = i
  14835. }
  14836. }, pp.prototype.getEdge = function () {
  14837. return this._edge
  14838. }, pp.prototype.addEndpoints = function () {
  14839. var t = this._edge.size() - 1;
  14840. this.add(this._edge.getCoordinate(0), 0), this.add(this._edge.getCoordinate(t), t)
  14841. }, pp.prototype.createSplitEdge = function (t, e) {
  14842. var n = e.segmentIndex - t.segmentIndex + 2,
  14843. r = this._edge.getCoordinate(e.segmentIndex),
  14844. i = e.isInterior() || !e.coord.equals2D(r);
  14845. i || n--;
  14846. var o = new Array(n).fill(null),
  14847. s = 0;
  14848. o[s++] = new ul(t.coord);
  14849. for (var a = t.segmentIndex + 1; a <= e.segmentIndex; a++) o[s++] = this._edge.getCoordinate(a);
  14850. return i && (o[s] = new ul(e.coord)), new yp(o, this._edge.getData())
  14851. }, pp.prototype.add = function (t, e) {
  14852. var n = new hp(this._edge, t, e, this._edge.getSegmentOctant(e)),
  14853. r = this._nodeMap.get(n);
  14854. return null !== r ? (ql.isTrue(r.coord.equals2D(t), "Found equal nodes with different coordinates"), r) : (this._nodeMap.put(n, n), n)
  14855. }, pp.prototype.checkSplitEdgesCorrectness = function (t) {
  14856. var e = this._edge.getCoordinates(),
  14857. n = t.get(0).getCoordinate(0);
  14858. if (!n.equals2D(e[0])) throw new kl("bad split edge start point at " + n);
  14859. var r = t.get(t.size() - 1).getCoordinates(),
  14860. i = r[r.length - 1];
  14861. if (!i.equals2D(e[e.length - 1])) throw new kl("bad split edge end point at " + i)
  14862. }, pp.prototype.interfaces_ = function () {
  14863. return []
  14864. }, pp.prototype.getClass = function () {
  14865. return pp
  14866. };
  14867. var fp = function () {};
  14868. fp.prototype.interfaces_ = function () {
  14869. return []
  14870. }, fp.prototype.getClass = function () {
  14871. return fp
  14872. }, fp.octant = function () {
  14873. if ("number" == typeof arguments[0] && "number" == typeof arguments[1]) {
  14874. var t = arguments[0],
  14875. e = arguments[1];
  14876. if (0 === t && 0 === e) throw new el("Cannot compute the octant for point ( " + t + ", " + e + " )");
  14877. var n = Math.abs(t),
  14878. r = Math.abs(e);
  14879. return t >= 0 ? e >= 0 ? n >= r ? 0 : 1 : n >= r ? 7 : 6 : e >= 0 ? n >= r ? 3 : 2 : n >= r ? 4 : 5
  14880. }
  14881. if (arguments[0] instanceof ul && arguments[1] instanceof ul) {
  14882. var i = arguments[0],
  14883. o = arguments[1],
  14884. s = o.x - i.x,
  14885. a = o.y - i.y;
  14886. if (0 === s && 0 === a) throw new el("Cannot compute the octant for two identical points " + i);
  14887. return fp.octant(s, a)
  14888. }
  14889. };
  14890. var gp = function () {};
  14891. gp.prototype.getCoordinates = function () {}, gp.prototype.size = function () {}, gp.prototype.getCoordinate = function (t) {}, gp.prototype.isClosed = function () {}, gp.prototype.setData = function (t) {}, gp.prototype.getData = function () {}, gp.prototype.interfaces_ = function () {
  14892. return []
  14893. }, gp.prototype.getClass = function () {
  14894. return gp
  14895. };
  14896. var dp = function () {};
  14897. dp.prototype.addIntersection = function (t, e) {}, dp.prototype.interfaces_ = function () {
  14898. return [gp]
  14899. }, dp.prototype.getClass = function () {
  14900. return dp
  14901. };
  14902. var yp = function () {
  14903. this._nodeList = new pp(this), this._pts = null, this._data = null;
  14904. var t = arguments[0],
  14905. e = arguments[1];
  14906. this._pts = t, this._data = e
  14907. };
  14908. yp.prototype.getCoordinates = function () {
  14909. return this._pts
  14910. }, yp.prototype.size = function () {
  14911. return this._pts.length
  14912. }, yp.prototype.getCoordinate = function (t) {
  14913. return this._pts[t]
  14914. }, yp.prototype.isClosed = function () {
  14915. return this._pts[0].equals(this._pts[this._pts.length - 1])
  14916. }, yp.prototype.getSegmentOctant = function (t) {
  14917. return t === this._pts.length - 1 ? -1 : this.safeOctant(this.getCoordinate(t), this.getCoordinate(t + 1))
  14918. }, yp.prototype.setData = function (t) {
  14919. this._data = t
  14920. }, yp.prototype.safeOctant = function (t, e) {
  14921. return t.equals2D(e) ? 0 : fp.octant(t, e)
  14922. }, yp.prototype.getData = function () {
  14923. return this._data
  14924. }, yp.prototype.addIntersection = function () {
  14925. if (2 === arguments.length) {
  14926. var t = arguments[0],
  14927. e = arguments[1];
  14928. this.addIntersectionNode(t, e)
  14929. } else if (4 === arguments.length) {
  14930. var n = arguments[0],
  14931. r = arguments[1],
  14932. i = arguments[3],
  14933. o = new ul(n.getIntersection(i));
  14934. this.addIntersection(o, r)
  14935. }
  14936. }, yp.prototype.toString = function () {
  14937. return Fl.toLineString(new lh(this._pts))
  14938. }, yp.prototype.getNodeList = function () {
  14939. return this._nodeList
  14940. }, yp.prototype.addIntersectionNode = function (t, e) {
  14941. var n = e,
  14942. r = n + 1;
  14943. if (r < this._pts.length) {
  14944. var i = this._pts[r];
  14945. t.equals2D(i) && (n = r)
  14946. }
  14947. return this._nodeList.add(t, n)
  14948. }, yp.prototype.addIntersections = function (t, e, n) {
  14949. for (var r = 0; r < t.getIntersectionNum(); r++) this.addIntersection(t, e, n, r)
  14950. }, yp.prototype.interfaces_ = function () {
  14951. return [dp]
  14952. }, yp.prototype.getClass = function () {
  14953. return yp
  14954. }, yp.getNodedSubstrings = function () {
  14955. if (1 === arguments.length) {
  14956. var t = arguments[0],
  14957. e = new lc;
  14958. return yp.getNodedSubstrings(t, e), e
  14959. }
  14960. if (2 === arguments.length)
  14961. for (var n = arguments[0], r = arguments[1], i = n.iterator(); i.hasNext();) {
  14962. var o = i.next();
  14963. o.getNodeList().addSplitEdges(r)
  14964. }
  14965. };
  14966. var vp = function () {
  14967. if (this.p0 = null, this.p1 = null, 0 === arguments.length) this.p0 = new ul, this.p1 = new ul;
  14968. else if (1 === arguments.length) {
  14969. var t = arguments[0];
  14970. this.p0 = new ul(t.p0), this.p1 = new ul(t.p1)
  14971. } else if (2 === arguments.length) this.p0 = arguments[0], this.p1 = arguments[1];
  14972. else if (4 === arguments.length) {
  14973. var e = arguments[0],
  14974. n = arguments[1],
  14975. r = arguments[2],
  14976. i = arguments[3];
  14977. this.p0 = new ul(e, n), this.p1 = new ul(r, i)
  14978. }
  14979. },
  14980. _p = {
  14981. serialVersionUID: {
  14982. configurable: !0
  14983. }
  14984. };
  14985. vp.prototype.minX = function () {
  14986. return Math.min(this.p0.x, this.p1.x)
  14987. }, vp.prototype.orientationIndex = function () {
  14988. if (arguments[0] instanceof vp) {
  14989. var t = arguments[0],
  14990. e = Xl.orientationIndex(this.p0, this.p1, t.p0),
  14991. n = Xl.orientationIndex(this.p0, this.p1, t.p1);
  14992. return e >= 0 && n >= 0 || e <= 0 && n <= 0 ? Math.max(e, n) : 0
  14993. }
  14994. if (arguments[0] instanceof ul) {
  14995. var r = arguments[0];
  14996. return Xl.orientationIndex(this.p0, this.p1, r)
  14997. }
  14998. }, vp.prototype.toGeometry = function (t) {
  14999. return t.createLineString([this.p0, this.p1])
  15000. }, vp.prototype.isVertical = function () {
  15001. return this.p0.x === this.p1.x
  15002. }, vp.prototype.equals = function (t) {
  15003. if (!(t instanceof vp)) return !1;
  15004. var e = t;
  15005. return this.p0.equals(e.p0) && this.p1.equals(e.p1)
  15006. }, vp.prototype.intersection = function (t) {
  15007. var e = new jl;
  15008. return e.computeIntersection(this.p0, this.p1, t.p0, t.p1), e.hasIntersection() ? e.getIntersection(0) : null
  15009. }, vp.prototype.project = function () {
  15010. if (arguments[0] instanceof ul) {
  15011. var t = arguments[0];
  15012. if (t.equals(this.p0) || t.equals(this.p1)) return new ul(t);
  15013. var e = this.projectionFactor(t),
  15014. n = new ul;
  15015. return n.x = this.p0.x + e * (this.p1.x - this.p0.x), n.y = this.p0.y + e * (this.p1.y - this.p0.y), n
  15016. }
  15017. if (arguments[0] instanceof vp) {
  15018. var r = arguments[0],
  15019. i = this.projectionFactor(r.p0),
  15020. o = this.projectionFactor(r.p1);
  15021. if (i >= 1 && o >= 1) return null;
  15022. if (i <= 0 && o <= 0) return null;
  15023. var s = this.project(r.p0);
  15024. i < 0 && (s = this.p0), i > 1 && (s = this.p1);
  15025. var a = this.project(r.p1);
  15026. return o < 0 && (a = this.p0), o > 1 && (a = this.p1), new vp(s, a)
  15027. }
  15028. }, vp.prototype.normalize = function () {
  15029. this.p1.compareTo(this.p0) < 0 && this.reverse()
  15030. }, vp.prototype.angle = function () {
  15031. return Math.atan2(this.p1.y - this.p0.y, this.p1.x - this.p0.x)
  15032. }, vp.prototype.getCoordinate = function (t) {
  15033. return 0 === t ? this.p0 : this.p1
  15034. }, vp.prototype.distancePerpendicular = function (t) {
  15035. return Xl.distancePointLinePerpendicular(t, this.p0, this.p1)
  15036. }, vp.prototype.minY = function () {
  15037. return Math.min(this.p0.y, this.p1.y)
  15038. }, vp.prototype.midPoint = function () {
  15039. return vp.midPoint(this.p0, this.p1)
  15040. }, vp.prototype.projectionFactor = function (t) {
  15041. if (t.equals(this.p0)) return 0;
  15042. if (t.equals(this.p1)) return 1;
  15043. var e = this.p1.x - this.p0.x,
  15044. n = this.p1.y - this.p0.y,
  15045. r = e * e + n * n;
  15046. return r <= 0 ? nl.NaN : ((t.x - this.p0.x) * e + (t.y - this.p0.y) * n) / r
  15047. }, vp.prototype.closestPoints = function (t) {
  15048. var e = this.intersection(t);
  15049. if (null !== e) return [e, e];
  15050. var n = new Array(2).fill(null),
  15051. r = nl.MAX_VALUE,
  15052. i = null,
  15053. o = this.closestPoint(t.p0);
  15054. r = o.distance(t.p0), n[0] = o, n[1] = t.p0;
  15055. var s = this.closestPoint(t.p1);
  15056. (i = s.distance(t.p1)) < r && (r = i, n[0] = s, n[1] = t.p1);
  15057. var a = t.closestPoint(this.p0);
  15058. (i = a.distance(this.p0)) < r && (r = i, n[0] = this.p0, n[1] = a);
  15059. var u = t.closestPoint(this.p1);
  15060. return (i = u.distance(this.p1)) < r && (r = i, n[0] = this.p1, n[1] = u), n
  15061. }, vp.prototype.closestPoint = function (t) {
  15062. var e = this.projectionFactor(t);
  15063. return e > 0 && e < 1 ? this.project(t) : this.p0.distance(t) < this.p1.distance(t) ? this.p0 : this.p1
  15064. }, vp.prototype.maxX = function () {
  15065. return Math.max(this.p0.x, this.p1.x)
  15066. }, vp.prototype.getLength = function () {
  15067. return this.p0.distance(this.p1)
  15068. }, vp.prototype.compareTo = function (t) {
  15069. var e = t,
  15070. n = this.p0.compareTo(e.p0);
  15071. return 0 !== n ? n : this.p1.compareTo(e.p1)
  15072. }, vp.prototype.reverse = function () {
  15073. var t = this.p0;
  15074. this.p0 = this.p1, this.p1 = t
  15075. }, vp.prototype.equalsTopo = function (t) {
  15076. return this.p0.equals(t.p0) && (this.p1.equals(t.p1) || this.p0.equals(t.p1)) && this.p1.equals(t.p0)
  15077. }, vp.prototype.lineIntersection = function (t) {
  15078. try {
  15079. return Ml.intersection(this.p0, this.p1, t.p0, t.p1)
  15080. } catch (t) {
  15081. if (!(t instanceof Cl)) throw t
  15082. }
  15083. return null
  15084. }, vp.prototype.maxY = function () {
  15085. return Math.max(this.p0.y, this.p1.y)
  15086. }, vp.prototype.pointAlongOffset = function (t, e) {
  15087. var n = this.p0.x + t * (this.p1.x - this.p0.x),
  15088. r = this.p0.y + t * (this.p1.y - this.p0.y),
  15089. i = this.p1.x - this.p0.x,
  15090. o = this.p1.y - this.p0.y,
  15091. s = Math.sqrt(i * i + o * o),
  15092. a = 0,
  15093. u = 0;
  15094. if (0 !== e) {
  15095. if (s <= 0) throw new Error("Cannot compute offset from zero-length line segment");
  15096. a = e * i / s, u = e * o / s
  15097. }
  15098. return new ul(n - u, r + a)
  15099. }, vp.prototype.setCoordinates = function () {
  15100. if (1 === arguments.length) {
  15101. var t = arguments[0];
  15102. this.setCoordinates(t.p0, t.p1)
  15103. } else if (2 === arguments.length) {
  15104. var e = arguments[0],
  15105. n = arguments[1];
  15106. this.p0.x = e.x, this.p0.y = e.y, this.p1.x = n.x, this.p1.y = n.y
  15107. }
  15108. }, vp.prototype.segmentFraction = function (t) {
  15109. var e = this.projectionFactor(t);
  15110. return e < 0 ? e = 0 : (e > 1 || nl.isNaN(e)) && (e = 1), e
  15111. }, vp.prototype.toString = function () {
  15112. return "LINESTRING( " + this.p0.x + " " + this.p0.y + ", " + this.p1.x + " " + this.p1.y + ")"
  15113. }, vp.prototype.isHorizontal = function () {
  15114. return this.p0.y === this.p1.y
  15115. }, vp.prototype.distance = function () {
  15116. if (arguments[0] instanceof vp) {
  15117. var t = arguments[0];
  15118. return Xl.distanceLineLine(this.p0, this.p1, t.p0, t.p1)
  15119. }
  15120. if (arguments[0] instanceof ul) {
  15121. var e = arguments[0];
  15122. return Xl.distancePointLine(e, this.p0, this.p1)
  15123. }
  15124. }, vp.prototype.pointAlong = function (t) {
  15125. var e = new ul;
  15126. return e.x = this.p0.x + t * (this.p1.x - this.p0.x), e.y = this.p0.y + t * (this.p1.y - this.p0.y), e
  15127. }, vp.prototype.hashCode = function () {
  15128. var t = nl.doubleToLongBits(this.p0.x);
  15129. t ^= 31 * nl.doubleToLongBits(this.p0.y);
  15130. var e = Math.trunc(t) ^ Math.trunc(t >> 32),
  15131. n = nl.doubleToLongBits(this.p1.x);
  15132. return n ^= 31 * nl.doubleToLongBits(this.p1.y), e ^ (Math.trunc(n) ^ Math.trunc(n >> 32))
  15133. }, vp.prototype.interfaces_ = function () {
  15134. return [il, al]
  15135. }, vp.prototype.getClass = function () {
  15136. return vp
  15137. }, vp.midPoint = function (t, e) {
  15138. return new ul((t.x + e.x) / 2, (t.y + e.y) / 2)
  15139. }, _p.serialVersionUID.get = function () {
  15140. return 0x2d2172135f411c00
  15141. }, Object.defineProperties(vp, _p);
  15142. var mp = function () {
  15143. this.tempEnv1 = new Ll, this.tempEnv2 = new Ll, this._overlapSeg1 = new vp, this._overlapSeg2 = new vp
  15144. };
  15145. mp.prototype.overlap = function () {
  15146. if (2 === arguments.length);
  15147. else if (4 === arguments.length) {
  15148. var t = arguments[0],
  15149. e = arguments[1],
  15150. n = arguments[2],
  15151. r = arguments[3];
  15152. t.getLineSegment(e, this._overlapSeg1), n.getLineSegment(r, this._overlapSeg2), this.overlap(this._overlapSeg1, this._overlapSeg2)
  15153. }
  15154. }, mp.prototype.interfaces_ = function () {
  15155. return []
  15156. }, mp.prototype.getClass = function () {
  15157. return mp
  15158. };
  15159. var xp = function () {
  15160. this._pts = null, this._start = null, this._end = null, this._env = null, this._context = null, this._id = null;
  15161. var t = arguments[0],
  15162. e = arguments[1],
  15163. n = arguments[2],
  15164. r = arguments[3];
  15165. this._pts = t, this._start = e, this._end = n, this._context = r
  15166. };
  15167. xp.prototype.getLineSegment = function (t, e) {
  15168. e.p0 = this._pts[t], e.p1 = this._pts[t + 1]
  15169. }, xp.prototype.computeSelect = function (t, e, n, r) {
  15170. var i = this._pts[e],
  15171. o = this._pts[n];
  15172. if (r.tempEnv1.init(i, o), n - e == 1) return r.select(this, e), null;
  15173. if (!t.intersects(r.tempEnv1)) return null;
  15174. var s = Math.trunc((e + n) / 2);
  15175. e < s && this.computeSelect(t, e, s, r), s < n && this.computeSelect(t, s, n, r)
  15176. }, xp.prototype.getCoordinates = function () {
  15177. for (var t = new Array(this._end - this._start + 1).fill(null), e = 0, n = this._start; n <= this._end; n++) t[e++] = this._pts[n];
  15178. return t
  15179. }, xp.prototype.computeOverlaps = function (t, e) {
  15180. this.computeOverlapsInternal(this._start, this._end, t, t._start, t._end, e)
  15181. }, xp.prototype.setId = function (t) {
  15182. this._id = t
  15183. }, xp.prototype.select = function (t, e) {
  15184. this.computeSelect(t, this._start, this._end, e)
  15185. }, xp.prototype.getEnvelope = function () {
  15186. if (null === this._env) {
  15187. var t = this._pts[this._start],
  15188. e = this._pts[this._end];
  15189. this._env = new Ll(t, e)
  15190. }
  15191. return this._env
  15192. }, xp.prototype.getEndIndex = function () {
  15193. return this._end
  15194. }, xp.prototype.getStartIndex = function () {
  15195. return this._start
  15196. }, xp.prototype.getContext = function () {
  15197. return this._context
  15198. }, xp.prototype.getId = function () {
  15199. return this._id
  15200. }, xp.prototype.computeOverlapsInternal = function (t, e, n, r, i, o) {
  15201. var s = this._pts[t],
  15202. a = this._pts[e],
  15203. u = n._pts[r],
  15204. l = n._pts[i];
  15205. if (e - t == 1 && i - r == 1) return o.overlap(this, t, n, r), null;
  15206. if (o.tempEnv1.init(s, a), o.tempEnv2.init(u, l), !o.tempEnv1.intersects(o.tempEnv2)) return null;
  15207. var c = Math.trunc((t + e) / 2),
  15208. h = Math.trunc((r + i) / 2);
  15209. t < c && (r < h && this.computeOverlapsInternal(t, c, n, r, h, o), h < i && this.computeOverlapsInternal(t, c, n, h, i, o)), c < e && (r < h && this.computeOverlapsInternal(c, e, n, r, h, o), h < i && this.computeOverlapsInternal(c, e, n, h, i, o))
  15210. }, xp.prototype.interfaces_ = function () {
  15211. return []
  15212. }, xp.prototype.getClass = function () {
  15213. return xp
  15214. };
  15215. var Ep = function () {};
  15216. Ep.prototype.interfaces_ = function () {
  15217. return []
  15218. }, Ep.prototype.getClass = function () {
  15219. return Ep
  15220. }, Ep.getChainStartIndices = function (t) {
  15221. var e = 0,
  15222. n = new lc;
  15223. n.add(new _l(e));
  15224. do {
  15225. var r = Ep.findChainEnd(t, e);
  15226. n.add(new _l(r)), e = r
  15227. } while (e < t.length - 1);
  15228. return Ep.toIntArray(n)
  15229. }, Ep.findChainEnd = function (t, e) {
  15230. for (var n = e; n < t.length - 1 && t[n].equals2D(t[n + 1]);) n++;
  15231. if (n >= t.length - 1) return t.length - 1;
  15232. for (var r = jh.quadrant(t[n], t[n + 1]), i = e + 1; i < t.length;) {
  15233. if (!t[i - 1].equals2D(t[i]))
  15234. if (jh.quadrant(t[i - 1], t[i]) !== r) break;
  15235. i++
  15236. }
  15237. return i - 1
  15238. }, Ep.getChains = function () {
  15239. if (1 === arguments.length) {
  15240. var t = arguments[0];
  15241. return Ep.getChains(t, null)
  15242. }
  15243. if (2 === arguments.length) {
  15244. for (var e = arguments[0], n = arguments[1], r = new lc, i = Ep.getChainStartIndices(e), o = 0; o < i.length - 1; o++) {
  15245. var s = new xp(e, i[o], i[o + 1], n);
  15246. r.add(s)
  15247. }
  15248. return r
  15249. }
  15250. }, Ep.toIntArray = function (t) {
  15251. for (var e = new Array(t.size()).fill(null), n = 0; n < e.length; n++) e[n] = t.get(n).intValue();
  15252. return e
  15253. };
  15254. var bp = function () {};
  15255. bp.prototype.computeNodes = function (t) {}, bp.prototype.getNodedSubstrings = function () {}, bp.prototype.interfaces_ = function () {
  15256. return []
  15257. }, bp.prototype.getClass = function () {
  15258. return bp
  15259. };
  15260. var wp = function () {
  15261. if (this._segInt = null, 0 === arguments.length);
  15262. else if (1 === arguments.length) {
  15263. var t = arguments[0];
  15264. this.setSegmentIntersector(t)
  15265. }
  15266. };
  15267. wp.prototype.setSegmentIntersector = function (t) {
  15268. this._segInt = t
  15269. }, wp.prototype.interfaces_ = function () {
  15270. return [bp]
  15271. }, wp.prototype.getClass = function () {
  15272. return wp
  15273. };
  15274. var Ip = function (t) {
  15275. function e(e) {
  15276. e ? t.call(this, e) : t.call(this), this._monoChains = new lc, this._index = new up, this._idCounter = 0, this._nodedSegStrings = null, this._nOverlaps = 0
  15277. }
  15278. t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
  15279. var n = {
  15280. SegmentOverlapAction: {
  15281. configurable: !0
  15282. }
  15283. };
  15284. return e.prototype.getMonotoneChains = function () {
  15285. return this._monoChains
  15286. }, e.prototype.getNodedSubstrings = function () {
  15287. return yp.getNodedSubstrings(this._nodedSegStrings)
  15288. }, e.prototype.getIndex = function () {
  15289. return this._index
  15290. }, e.prototype.add = function (t) {
  15291. for (var e = this, n = Ep.getChains(t.getCoordinates(), t).iterator(); n.hasNext();) {
  15292. var r = n.next();
  15293. r.setId(e._idCounter++), e._index.insert(r.getEnvelope(), r), e._monoChains.add(r)
  15294. }
  15295. }, e.prototype.computeNodes = function (t) {
  15296. this._nodedSegStrings = t;
  15297. for (var e = t.iterator(); e.hasNext();) this.add(e.next());
  15298. this.intersectChains()
  15299. }, e.prototype.intersectChains = function () {
  15300. for (var t = this, e = new Np(this._segInt), n = this._monoChains.iterator(); n.hasNext();)
  15301. for (var r = n.next(), i = t._index.query(r.getEnvelope()).iterator(); i.hasNext();) {
  15302. var o = i.next();
  15303. if (o.getId() > r.getId() && (r.computeOverlaps(o, e), t._nOverlaps++), t._segInt.isDone()) return null
  15304. }
  15305. }, e.prototype.interfaces_ = function () {
  15306. return []
  15307. }, e.prototype.getClass = function () {
  15308. return e
  15309. }, n.SegmentOverlapAction.get = function () {
  15310. return Np
  15311. }, Object.defineProperties(e, n), e
  15312. }(wp),
  15313. Np = function (t) {
  15314. function e() {
  15315. t.call(this), this._si = null;
  15316. var e = arguments[0];
  15317. this._si = e
  15318. }
  15319. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.overlap = function () {
  15320. if (4 !== arguments.length) return t.prototype.overlap.apply(this, arguments);
  15321. var e = arguments[0],
  15322. n = arguments[1],
  15323. r = arguments[2],
  15324. i = arguments[3],
  15325. o = e.getContext(),
  15326. s = r.getContext();
  15327. this._si.processIntersections(o, n, s, i)
  15328. }, e.prototype.interfaces_ = function () {
  15329. return []
  15330. }, e.prototype.getClass = function () {
  15331. return e
  15332. }, e
  15333. }(mp),
  15334. Sp = function t() {
  15335. if (this._quadrantSegments = t.DEFAULT_QUADRANT_SEGMENTS, this._endCapStyle = t.CAP_ROUND, this._joinStyle = t.JOIN_ROUND, this._mitreLimit = t.DEFAULT_MITRE_LIMIT, this._isSingleSided = !1, this._simplifyFactor = t.DEFAULT_SIMPLIFY_FACTOR, 0 === arguments.length);
  15336. else if (1 === arguments.length) {
  15337. var e = arguments[0];
  15338. this.setQuadrantSegments(e)
  15339. } else if (2 === arguments.length) {
  15340. var n = arguments[0],
  15341. r = arguments[1];
  15342. this.setQuadrantSegments(n), this.setEndCapStyle(r)
  15343. } else if (4 === arguments.length) {
  15344. var i = arguments[0],
  15345. o = arguments[1],
  15346. s = arguments[2],
  15347. a = arguments[3];
  15348. this.setQuadrantSegments(i), this.setEndCapStyle(o), this.setJoinStyle(s), this.setMitreLimit(a)
  15349. }
  15350. },
  15351. Cp = {
  15352. CAP_ROUND: {
  15353. configurable: !0
  15354. },
  15355. CAP_FLAT: {
  15356. configurable: !0
  15357. },
  15358. CAP_SQUARE: {
  15359. configurable: !0
  15360. },
  15361. JOIN_ROUND: {
  15362. configurable: !0
  15363. },
  15364. JOIN_MITRE: {
  15365. configurable: !0
  15366. },
  15367. JOIN_BEVEL: {
  15368. configurable: !0
  15369. },
  15370. DEFAULT_QUADRANT_SEGMENTS: {
  15371. configurable: !0
  15372. },
  15373. DEFAULT_MITRE_LIMIT: {
  15374. configurable: !0
  15375. },
  15376. DEFAULT_SIMPLIFY_FACTOR: {
  15377. configurable: !0
  15378. }
  15379. };
  15380. Sp.prototype.getEndCapStyle = function () {
  15381. return this._endCapStyle
  15382. }, Sp.prototype.isSingleSided = function () {
  15383. return this._isSingleSided
  15384. }, Sp.prototype.setQuadrantSegments = function (t) {
  15385. this._quadrantSegments = t, 0 === this._quadrantSegments && (this._joinStyle = Sp.JOIN_BEVEL), this._quadrantSegments < 0 && (this._joinStyle = Sp.JOIN_MITRE, this._mitreLimit = Math.abs(this._quadrantSegments)), t <= 0 && (this._quadrantSegments = 1), this._joinStyle !== Sp.JOIN_ROUND && (this._quadrantSegments = Sp.DEFAULT_QUADRANT_SEGMENTS)
  15386. }, Sp.prototype.getJoinStyle = function () {
  15387. return this._joinStyle
  15388. }, Sp.prototype.setJoinStyle = function (t) {
  15389. this._joinStyle = t
  15390. }, Sp.prototype.setSimplifyFactor = function (t) {
  15391. this._simplifyFactor = t < 0 ? 0 : t
  15392. }, Sp.prototype.getSimplifyFactor = function () {
  15393. return this._simplifyFactor
  15394. }, Sp.prototype.getQuadrantSegments = function () {
  15395. return this._quadrantSegments
  15396. }, Sp.prototype.setEndCapStyle = function (t) {
  15397. this._endCapStyle = t
  15398. }, Sp.prototype.getMitreLimit = function () {
  15399. return this._mitreLimit
  15400. }, Sp.prototype.setMitreLimit = function (t) {
  15401. this._mitreLimit = t
  15402. }, Sp.prototype.setSingleSided = function (t) {
  15403. this._isSingleSided = t
  15404. }, Sp.prototype.interfaces_ = function () {
  15405. return []
  15406. }, Sp.prototype.getClass = function () {
  15407. return Sp
  15408. }, Sp.bufferDistanceError = function (t) {
  15409. var e = Math.PI / 2 / t;
  15410. return 1 - Math.cos(e / 2)
  15411. }, Cp.CAP_ROUND.get = function () {
  15412. return 1
  15413. }, Cp.CAP_FLAT.get = function () {
  15414. return 2
  15415. }, Cp.CAP_SQUARE.get = function () {
  15416. return 3
  15417. }, Cp.JOIN_ROUND.get = function () {
  15418. return 1
  15419. }, Cp.JOIN_MITRE.get = function () {
  15420. return 2
  15421. }, Cp.JOIN_BEVEL.get = function () {
  15422. return 3
  15423. }, Cp.DEFAULT_QUADRANT_SEGMENTS.get = function () {
  15424. return 8
  15425. }, Cp.DEFAULT_MITRE_LIMIT.get = function () {
  15426. return 5
  15427. }, Cp.DEFAULT_SIMPLIFY_FACTOR.get = function () {
  15428. return .01
  15429. }, Object.defineProperties(Sp, Cp);
  15430. var Pp = function (t) {
  15431. this._distanceTol = null, this._isDeleted = null, this._angleOrientation = Xl.COUNTERCLOCKWISE, this._inputLine = t || null
  15432. },
  15433. Mp = {
  15434. INIT: {
  15435. configurable: !0
  15436. },
  15437. DELETE: {
  15438. configurable: !0
  15439. },
  15440. KEEP: {
  15441. configurable: !0
  15442. },
  15443. NUM_PTS_TO_CHECK: {
  15444. configurable: !0
  15445. }
  15446. };
  15447. Pp.prototype.isDeletable = function (t, e, n, r) {
  15448. var i = this._inputLine[t],
  15449. o = this._inputLine[e],
  15450. s = this._inputLine[n];
  15451. return !!this.isConcave(i, o, s) && (!!this.isShallow(i, o, s, r) && this.isShallowSampled(i, o, t, n, r))
  15452. }, Pp.prototype.deleteShallowConcavities = function () {
  15453. for (var t = this, e = 1, n = this.findNextNonDeletedIndex(e), r = this.findNextNonDeletedIndex(n), i = !1; r < this._inputLine.length;) {
  15454. var o = !1;
  15455. t.isDeletable(e, n, r, t._distanceTol) && (t._isDeleted[n] = Pp.DELETE, o = !0, i = !0), e = o ? r : n, n = t.findNextNonDeletedIndex(e), r = t.findNextNonDeletedIndex(n)
  15456. }
  15457. return i
  15458. }, Pp.prototype.isShallowConcavity = function (t, e, n, r) {
  15459. return Xl.computeOrientation(t, e, n) === this._angleOrientation && Xl.distancePointLine(e, t, n) < r
  15460. }, Pp.prototype.isShallowSampled = function (t, e, n, r, i) {
  15461. var o = Math.trunc((r - n) / Pp.NUM_PTS_TO_CHECK);
  15462. o <= 0 && (o = 1);
  15463. for (var s = n; s < r; s += o)
  15464. if (!this.isShallow(t, e, this._inputLine[s], i)) return !1;
  15465. return !0
  15466. }, Pp.prototype.isConcave = function (t, e, n) {
  15467. var r = Xl.computeOrientation(t, e, n) === this._angleOrientation;
  15468. return r
  15469. }, Pp.prototype.simplify = function (t) {
  15470. this._distanceTol = Math.abs(t), t < 0 && (this._angleOrientation = Xl.CLOCKWISE), this._isDeleted = new Array(this._inputLine.length).fill(null);
  15471. var e = !1;
  15472. do {
  15473. e = this.deleteShallowConcavities()
  15474. } while (e);
  15475. return this.collapseLine()
  15476. }, Pp.prototype.findNextNonDeletedIndex = function (t) {
  15477. for (var e = t + 1; e < this._inputLine.length && this._isDeleted[e] === Pp.DELETE;) e++;
  15478. return e
  15479. }, Pp.prototype.isShallow = function (t, e, n, r) {
  15480. return Xl.distancePointLine(e, t, n) < r
  15481. }, Pp.prototype.collapseLine = function () {
  15482. for (var t = new hc, e = 0; e < this._inputLine.length; e++) this._isDeleted[e] !== Pp.DELETE && t.add(this._inputLine[e]);
  15483. return t.toCoordinateArray()
  15484. }, Pp.prototype.interfaces_ = function () {
  15485. return []
  15486. }, Pp.prototype.getClass = function () {
  15487. return Pp
  15488. }, Pp.simplify = function (t, e) {
  15489. return new Pp(t).simplify(e)
  15490. }, Mp.INIT.get = function () {
  15491. return 0
  15492. }, Mp.DELETE.get = function () {
  15493. return 1
  15494. }, Mp.KEEP.get = function () {
  15495. return 1
  15496. }, Mp.NUM_PTS_TO_CHECK.get = function () {
  15497. return 10
  15498. }, Object.defineProperties(Pp, Mp);
  15499. var Lp = function () {
  15500. this._ptList = null, this._precisionModel = null, this._minimimVertexDistance = 0, this._ptList = new lc
  15501. },
  15502. Op = {
  15503. COORDINATE_ARRAY_TYPE: {
  15504. configurable: !0
  15505. }
  15506. };
  15507. Lp.prototype.getCoordinates = function () {
  15508. return this._ptList.toArray(Lp.COORDINATE_ARRAY_TYPE)
  15509. }, Lp.prototype.setPrecisionModel = function (t) {
  15510. this._precisionModel = t
  15511. }, Lp.prototype.addPt = function (t) {
  15512. var e = new ul(t);
  15513. if (this._precisionModel.makePrecise(e), this.isRedundant(e)) return null;
  15514. this._ptList.add(e)
  15515. }, Lp.prototype.revere = function () {}, Lp.prototype.addPts = function (t, e) {
  15516. if (e)
  15517. for (var n = 0; n < t.length; n++) this.addPt(t[n]);
  15518. else
  15519. for (var r = t.length - 1; r >= 0; r--) this.addPt(t[r])
  15520. }, Lp.prototype.isRedundant = function (t) {
  15521. if (this._ptList.size() < 1) return !1;
  15522. var e = this._ptList.get(this._ptList.size() - 1);
  15523. return t.distance(e) < this._minimimVertexDistance
  15524. }, Lp.prototype.toString = function () {
  15525. return (new _h).createLineString(this.getCoordinates()).toString()
  15526. }, Lp.prototype.closeRing = function () {
  15527. if (this._ptList.size() < 1) return null;
  15528. var t = new ul(this._ptList.get(0)),
  15529. e = this._ptList.get(this._ptList.size() - 1);
  15530. if (t.equals(e)) return null;
  15531. this._ptList.add(t)
  15532. }, Lp.prototype.setMinimumVertexDistance = function (t) {
  15533. this._minimimVertexDistance = t
  15534. }, Lp.prototype.interfaces_ = function () {
  15535. return []
  15536. }, Lp.prototype.getClass = function () {
  15537. return Lp
  15538. }, Op.COORDINATE_ARRAY_TYPE.get = function () {
  15539. return new Array(0).fill(null)
  15540. }, Object.defineProperties(Lp, Op);
  15541. var Rp = function () {},
  15542. Tp = {
  15543. PI_TIMES_2: {
  15544. configurable: !0
  15545. },
  15546. PI_OVER_2: {
  15547. configurable: !0
  15548. },
  15549. PI_OVER_4: {
  15550. configurable: !0
  15551. },
  15552. COUNTERCLOCKWISE: {
  15553. configurable: !0
  15554. },
  15555. CLOCKWISE: {
  15556. configurable: !0
  15557. },
  15558. NONE: {
  15559. configurable: !0
  15560. }
  15561. };
  15562. Rp.prototype.interfaces_ = function () {
  15563. return []
  15564. }, Rp.prototype.getClass = function () {
  15565. return Rp
  15566. }, Rp.toDegrees = function (t) {
  15567. return 180 * t / Math.PI
  15568. }, Rp.normalize = function (t) {
  15569. for (; t > Math.PI;) t -= Rp.PI_TIMES_2;
  15570. for (; t <= -Math.PI;) t += Rp.PI_TIMES_2;
  15571. return t
  15572. }, Rp.angle = function () {
  15573. if (1 === arguments.length) {
  15574. var t = arguments[0];
  15575. return Math.atan2(t.y, t.x)
  15576. }
  15577. if (2 === arguments.length) {
  15578. var e = arguments[0],
  15579. n = arguments[1],
  15580. r = n.x - e.x,
  15581. i = n.y - e.y;
  15582. return Math.atan2(i, r)
  15583. }
  15584. }, Rp.isAcute = function (t, e, n) {
  15585. var r = t.x - e.x,
  15586. i = t.y - e.y;
  15587. return r * (n.x - e.x) + i * (n.y - e.y) > 0
  15588. }, Rp.isObtuse = function (t, e, n) {
  15589. var r = t.x - e.x,
  15590. i = t.y - e.y;
  15591. return r * (n.x - e.x) + i * (n.y - e.y) < 0
  15592. }, Rp.interiorAngle = function (t, e, n) {
  15593. var r = Rp.angle(e, t),
  15594. i = Rp.angle(e, n);
  15595. return Math.abs(i - r)
  15596. }, Rp.normalizePositive = function (t) {
  15597. if (t < 0) {
  15598. for (; t < 0;) t += Rp.PI_TIMES_2;
  15599. t >= Rp.PI_TIMES_2 && (t = 0)
  15600. } else {
  15601. for (; t >= Rp.PI_TIMES_2;) t -= Rp.PI_TIMES_2;
  15602. t < 0 && (t = 0)
  15603. }
  15604. return t
  15605. }, Rp.angleBetween = function (t, e, n) {
  15606. var r = Rp.angle(e, t),
  15607. i = Rp.angle(e, n);
  15608. return Rp.diff(r, i)
  15609. }, Rp.diff = function (t, e) {
  15610. var n = null;
  15611. return (n = t < e ? e - t : t - e) > Math.PI && (n = 2 * Math.PI - n), n
  15612. }, Rp.toRadians = function (t) {
  15613. return t * Math.PI / 180
  15614. }, Rp.getTurn = function (t, e) {
  15615. var n = Math.sin(e - t);
  15616. return n > 0 ? Rp.COUNTERCLOCKWISE : n < 0 ? Rp.CLOCKWISE : Rp.NONE
  15617. }, Rp.angleBetweenOriented = function (t, e, n) {
  15618. var r = Rp.angle(e, t),
  15619. i = Rp.angle(e, n) - r;
  15620. return i <= -Math.PI ? i + Rp.PI_TIMES_2 : i > Math.PI ? i - Rp.PI_TIMES_2 : i
  15621. }, Tp.PI_TIMES_2.get = function () {
  15622. return 2 * Math.PI
  15623. }, Tp.PI_OVER_2.get = function () {
  15624. return Math.PI / 2
  15625. }, Tp.PI_OVER_4.get = function () {
  15626. return Math.PI / 4
  15627. }, Tp.COUNTERCLOCKWISE.get = function () {
  15628. return Xl.COUNTERCLOCKWISE
  15629. }, Tp.CLOCKWISE.get = function () {
  15630. return Xl.CLOCKWISE
  15631. }, Tp.NONE.get = function () {
  15632. return Xl.COLLINEAR
  15633. }, Object.defineProperties(Rp, Tp);
  15634. var Ap = function t() {
  15635. this._maxCurveSegmentError = 0, this._filletAngleQuantum = null, this._closingSegLengthFactor = 1, this._segList = null, this._distance = 0, this._precisionModel = null, this._bufParams = null, this._li = null, this._s0 = null, this._s1 = null, this._s2 = null, this._seg0 = new vp, this._seg1 = new vp, this._offset0 = new vp, this._offset1 = new vp, this._side = 0, this._hasNarrowConcaveAngle = !1;
  15636. var e = arguments[0],
  15637. n = arguments[1],
  15638. r = arguments[2];
  15639. this._precisionModel = e, this._bufParams = n, this._li = new jl, this._filletAngleQuantum = Math.PI / 2 / n.getQuadrantSegments(), n.getQuadrantSegments() >= 8 && n.getJoinStyle() === Sp.JOIN_ROUND && (this._closingSegLengthFactor = t.MAX_CLOSING_SEG_LEN_FACTOR), this.init(r)
  15640. },
  15641. Dp = {
  15642. OFFSET_SEGMENT_SEPARATION_FACTOR: {
  15643. configurable: !0
  15644. },
  15645. INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR: {
  15646. configurable: !0
  15647. },
  15648. CURVE_VERTEX_SNAP_DISTANCE_FACTOR: {
  15649. configurable: !0
  15650. },
  15651. MAX_CLOSING_SEG_LEN_FACTOR: {
  15652. configurable: !0
  15653. }
  15654. };
  15655. Ap.prototype.addNextSegment = function (t, e) {
  15656. if (this._s0 = this._s1, this._s1 = this._s2, this._s2 = t, this._seg0.setCoordinates(this._s0, this._s1), this.computeOffsetSegment(this._seg0, this._side, this._distance, this._offset0), this._seg1.setCoordinates(this._s1, this._s2), this.computeOffsetSegment(this._seg1, this._side, this._distance, this._offset1), this._s1.equals(this._s2)) return null;
  15657. var n = Xl.computeOrientation(this._s0, this._s1, this._s2),
  15658. r = n === Xl.CLOCKWISE && this._side === Sh.LEFT || n === Xl.COUNTERCLOCKWISE && this._side === Sh.RIGHT;
  15659. 0 === n ? this.addCollinear(e) : r ? this.addOutsideTurn(n, e) : this.addInsideTurn(n, e)
  15660. }, Ap.prototype.addLineEndCap = function (t, e) {
  15661. var n = new vp(t, e),
  15662. r = new vp;
  15663. this.computeOffsetSegment(n, Sh.LEFT, this._distance, r);
  15664. var i = new vp;
  15665. this.computeOffsetSegment(n, Sh.RIGHT, this._distance, i);
  15666. var o = e.x - t.x,
  15667. s = e.y - t.y,
  15668. a = Math.atan2(s, o);
  15669. switch (this._bufParams.getEndCapStyle()) {
  15670. case Sp.CAP_ROUND:
  15671. this._segList.addPt(r.p1), this.addFilletArc(e, a + Math.PI / 2, a - Math.PI / 2, Xl.CLOCKWISE, this._distance), this._segList.addPt(i.p1);
  15672. break;
  15673. case Sp.CAP_FLAT:
  15674. this._segList.addPt(r.p1), this._segList.addPt(i.p1);
  15675. break;
  15676. case Sp.CAP_SQUARE:
  15677. var u = new ul;
  15678. u.x = Math.abs(this._distance) * Math.cos(a), u.y = Math.abs(this._distance) * Math.sin(a);
  15679. var l = new ul(r.p1.x + u.x, r.p1.y + u.y),
  15680. c = new ul(i.p1.x + u.x, i.p1.y + u.y);
  15681. this._segList.addPt(l), this._segList.addPt(c)
  15682. }
  15683. }, Ap.prototype.getCoordinates = function () {
  15684. return this._segList.getCoordinates()
  15685. }, Ap.prototype.addMitreJoin = function (t, e, n, r) {
  15686. var i = !0,
  15687. o = null;
  15688. try {
  15689. o = Ml.intersection(e.p0, e.p1, n.p0, n.p1), (r <= 0 ? 1 : o.distance(t) / Math.abs(r)) > this._bufParams.getMitreLimit() && (i = !1)
  15690. } catch (t) {
  15691. if (!(t instanceof Cl)) throw t;
  15692. o = new ul(0, 0), i = !1
  15693. }
  15694. i ? this._segList.addPt(o) : this.addLimitedMitreJoin(e, n, r, this._bufParams.getMitreLimit())
  15695. }, Ap.prototype.addFilletCorner = function (t, e, n, r, i) {
  15696. var o = e.x - t.x,
  15697. s = e.y - t.y,
  15698. a = Math.atan2(s, o),
  15699. u = n.x - t.x,
  15700. l = n.y - t.y,
  15701. c = Math.atan2(l, u);
  15702. r === Xl.CLOCKWISE ? a <= c && (a += 2 * Math.PI) : a >= c && (a -= 2 * Math.PI), this._segList.addPt(e), this.addFilletArc(t, a, c, r, i), this._segList.addPt(n)
  15703. }, Ap.prototype.addOutsideTurn = function (t, e) {
  15704. if (this._offset0.p1.distance(this._offset1.p0) < this._distance * Ap.OFFSET_SEGMENT_SEPARATION_FACTOR) return this._segList.addPt(this._offset0.p1), null;
  15705. this._bufParams.getJoinStyle() === Sp.JOIN_MITRE ? this.addMitreJoin(this._s1, this._offset0, this._offset1, this._distance) : this._bufParams.getJoinStyle() === Sp.JOIN_BEVEL ? this.addBevelJoin(this._offset0, this._offset1) : (e && this._segList.addPt(this._offset0.p1), this.addFilletCorner(this._s1, this._offset0.p1, this._offset1.p0, t, this._distance), this._segList.addPt(this._offset1.p0))
  15706. }, Ap.prototype.createSquare = function (t) {
  15707. this._segList.addPt(new ul(t.x + this._distance, t.y + this._distance)), this._segList.addPt(new ul(t.x + this._distance, t.y - this._distance)), this._segList.addPt(new ul(t.x - this._distance, t.y - this._distance)), this._segList.addPt(new ul(t.x - this._distance, t.y + this._distance)), this._segList.closeRing()
  15708. }, Ap.prototype.addSegments = function (t, e) {
  15709. this._segList.addPts(t, e)
  15710. }, Ap.prototype.addFirstSegment = function () {
  15711. this._segList.addPt(this._offset1.p0)
  15712. }, Ap.prototype.addLastSegment = function () {
  15713. this._segList.addPt(this._offset1.p1)
  15714. }, Ap.prototype.initSideSegments = function (t, e, n) {
  15715. this._s1 = t, this._s2 = e, this._side = n, this._seg1.setCoordinates(t, e), this.computeOffsetSegment(this._seg1, n, this._distance, this._offset1)
  15716. }, Ap.prototype.addLimitedMitreJoin = function (t, e, n, r) {
  15717. var i = this._seg0.p1,
  15718. o = Rp.angle(i, this._seg0.p0),
  15719. s = Rp.angleBetweenOriented(this._seg0.p0, i, this._seg1.p1) / 2,
  15720. a = Rp.normalize(o + s),
  15721. u = Rp.normalize(a + Math.PI),
  15722. l = r * n,
  15723. c = n - l * Math.abs(Math.sin(s)),
  15724. h = i.x + l * Math.cos(u),
  15725. p = i.y + l * Math.sin(u),
  15726. f = new ul(h, p),
  15727. g = new vp(i, f),
  15728. d = g.pointAlongOffset(1, c),
  15729. y = g.pointAlongOffset(1, -c);
  15730. this._side === Sh.LEFT ? (this._segList.addPt(d), this._segList.addPt(y)) : (this._segList.addPt(y), this._segList.addPt(d))
  15731. }, Ap.prototype.computeOffsetSegment = function (t, e, n, r) {
  15732. var i = e === Sh.LEFT ? 1 : -1,
  15733. o = t.p1.x - t.p0.x,
  15734. s = t.p1.y - t.p0.y,
  15735. a = Math.sqrt(o * o + s * s),
  15736. u = i * n * o / a,
  15737. l = i * n * s / a;
  15738. r.p0.x = t.p0.x - l, r.p0.y = t.p0.y + u, r.p1.x = t.p1.x - l, r.p1.y = t.p1.y + u
  15739. }, Ap.prototype.addFilletArc = function (t, e, n, r, i) {
  15740. var o = r === Xl.CLOCKWISE ? -1 : 1,
  15741. s = Math.abs(e - n),
  15742. a = Math.trunc(s / this._filletAngleQuantum + .5);
  15743. if (a < 1) return null;
  15744. for (var u = s / a, l = 0, c = new ul; l < s;) {
  15745. var h = e + o * l;
  15746. c.x = t.x + i * Math.cos(h), c.y = t.y + i * Math.sin(h), this._segList.addPt(c), l += u
  15747. }
  15748. }, Ap.prototype.addInsideTurn = function (t, e) {
  15749. if (this._li.computeIntersection(this._offset0.p0, this._offset0.p1, this._offset1.p0, this._offset1.p1), this._li.hasIntersection()) this._segList.addPt(this._li.getIntersection(0));
  15750. else if (this._hasNarrowConcaveAngle = !0, this._offset0.p1.distance(this._offset1.p0) < this._distance * Ap.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR) this._segList.addPt(this._offset0.p1);
  15751. else {
  15752. if (this._segList.addPt(this._offset0.p1), this._closingSegLengthFactor > 0) {
  15753. var n = new ul((this._closingSegLengthFactor * this._offset0.p1.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset0.p1.y + this._s1.y) / (this._closingSegLengthFactor + 1));
  15754. this._segList.addPt(n);
  15755. var r = new ul((this._closingSegLengthFactor * this._offset1.p0.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset1.p0.y + this._s1.y) / (this._closingSegLengthFactor + 1));
  15756. this._segList.addPt(r)
  15757. } else this._segList.addPt(this._s1);
  15758. this._segList.addPt(this._offset1.p0)
  15759. }
  15760. }, Ap.prototype.createCircle = function (t) {
  15761. var e = new ul(t.x + this._distance, t.y);
  15762. this._segList.addPt(e), this.addFilletArc(t, 0, 2 * Math.PI, -1, this._distance), this._segList.closeRing()
  15763. }, Ap.prototype.addBevelJoin = function (t, e) {
  15764. this._segList.addPt(t.p1), this._segList.addPt(e.p0)
  15765. }, Ap.prototype.init = function (t) {
  15766. this._distance = t, this._maxCurveSegmentError = t * (1 - Math.cos(this._filletAngleQuantum / 2)), this._segList = new Lp, this._segList.setPrecisionModel(this._precisionModel), this._segList.setMinimumVertexDistance(t * Ap.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)
  15767. }, Ap.prototype.addCollinear = function (t) {
  15768. this._li.computeIntersection(this._s0, this._s1, this._s1, this._s2), this._li.getIntersectionNum() >= 2 && (this._bufParams.getJoinStyle() === Sp.JOIN_BEVEL || this._bufParams.getJoinStyle() === Sp.JOIN_MITRE ? (t && this._segList.addPt(this._offset0.p1), this._segList.addPt(this._offset1.p0)) : this.addFilletCorner(this._s1, this._offset0.p1, this._offset1.p0, Xl.CLOCKWISE, this._distance))
  15769. }, Ap.prototype.closeRing = function () {
  15770. this._segList.closeRing()
  15771. }, Ap.prototype.hasNarrowConcaveAngle = function () {
  15772. return this._hasNarrowConcaveAngle
  15773. }, Ap.prototype.interfaces_ = function () {
  15774. return []
  15775. }, Ap.prototype.getClass = function () {
  15776. return Ap
  15777. }, Dp.OFFSET_SEGMENT_SEPARATION_FACTOR.get = function () {
  15778. return .001
  15779. }, Dp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get = function () {
  15780. return .001
  15781. }, Dp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get = function () {
  15782. return 1e-6
  15783. }, Dp.MAX_CLOSING_SEG_LEN_FACTOR.get = function () {
  15784. return 80
  15785. }, Object.defineProperties(Ap, Dp);
  15786. var Fp = function () {
  15787. this._distance = 0, this._precisionModel = null, this._bufParams = null;
  15788. var t = arguments[0],
  15789. e = arguments[1];
  15790. this._precisionModel = t, this._bufParams = e
  15791. };
  15792. Fp.prototype.getOffsetCurve = function (t, e) {
  15793. if (this._distance = e, 0 === e) return null;
  15794. var n = e < 0,
  15795. r = Math.abs(e),
  15796. i = this.getSegGen(r);
  15797. t.length <= 1 ? this.computePointCurve(t[0], i) : this.computeOffsetCurve(t, n, i);
  15798. var o = i.getCoordinates();
  15799. return n && pc.reverse(o), o
  15800. }, Fp.prototype.computeSingleSidedBufferCurve = function (t, e, n) {
  15801. var r = this.simplifyTolerance(this._distance);
  15802. if (e) {
  15803. n.addSegments(t, !0);
  15804. var i = Pp.simplify(t, -r),
  15805. o = i.length - 1;
  15806. n.initSideSegments(i[o], i[o - 1], Sh.LEFT), n.addFirstSegment();
  15807. for (var s = o - 2; s >= 0; s--) n.addNextSegment(i[s], !0)
  15808. } else {
  15809. n.addSegments(t, !1);
  15810. var a = Pp.simplify(t, r),
  15811. u = a.length - 1;
  15812. n.initSideSegments(a[0], a[1], Sh.LEFT), n.addFirstSegment();
  15813. for (var l = 2; l <= u; l++) n.addNextSegment(a[l], !0)
  15814. }
  15815. n.addLastSegment(), n.closeRing()
  15816. }, Fp.prototype.computeRingBufferCurve = function (t, e, n) {
  15817. var r = this.simplifyTolerance(this._distance);
  15818. e === Sh.RIGHT && (r = -r);
  15819. var i = Pp.simplify(t, r),
  15820. o = i.length - 1;
  15821. n.initSideSegments(i[o - 1], i[0], e);
  15822. for (var s = 1; s <= o; s++) {
  15823. var a = 1 !== s;
  15824. n.addNextSegment(i[s], a)
  15825. }
  15826. n.closeRing()
  15827. }, Fp.prototype.computeLineBufferCurve = function (t, e) {
  15828. var n = this.simplifyTolerance(this._distance),
  15829. r = Pp.simplify(t, n),
  15830. i = r.length - 1;
  15831. e.initSideSegments(r[0], r[1], Sh.LEFT);
  15832. for (var o = 2; o <= i; o++) e.addNextSegment(r[o], !0);
  15833. e.addLastSegment(), e.addLineEndCap(r[i - 1], r[i]);
  15834. var s = Pp.simplify(t, -n),
  15835. a = s.length - 1;
  15836. e.initSideSegments(s[a], s[a - 1], Sh.LEFT);
  15837. for (var u = a - 2; u >= 0; u--) e.addNextSegment(s[u], !0);
  15838. e.addLastSegment(), e.addLineEndCap(s[1], s[0]), e.closeRing()
  15839. }, Fp.prototype.computePointCurve = function (t, e) {
  15840. switch (this._bufParams.getEndCapStyle()) {
  15841. case Sp.CAP_ROUND:
  15842. e.createCircle(t);
  15843. break;
  15844. case Sp.CAP_SQUARE:
  15845. e.createSquare(t)
  15846. }
  15847. }, Fp.prototype.getLineCurve = function (t, e) {
  15848. if (this._distance = e, e < 0 && !this._bufParams.isSingleSided()) return null;
  15849. if (0 === e) return null;
  15850. var n = Math.abs(e),
  15851. r = this.getSegGen(n);
  15852. if (t.length <= 1) this.computePointCurve(t[0], r);
  15853. else if (this._bufParams.isSingleSided()) {
  15854. var i = e < 0;
  15855. this.computeSingleSidedBufferCurve(t, i, r)
  15856. } else this.computeLineBufferCurve(t, r);
  15857. return r.getCoordinates()
  15858. }, Fp.prototype.getBufferParameters = function () {
  15859. return this._bufParams
  15860. }, Fp.prototype.simplifyTolerance = function (t) {
  15861. return t * this._bufParams.getSimplifyFactor()
  15862. }, Fp.prototype.getRingCurve = function (t, e, n) {
  15863. if (this._distance = n, t.length <= 2) return this.getLineCurve(t, n);
  15864. if (0 === n) return Fp.copyCoordinates(t);
  15865. var r = this.getSegGen(n);
  15866. return this.computeRingBufferCurve(t, e, r), r.getCoordinates()
  15867. }, Fp.prototype.computeOffsetCurve = function (t, e, n) {
  15868. var r = this.simplifyTolerance(this._distance);
  15869. if (e) {
  15870. var i = Pp.simplify(t, -r),
  15871. o = i.length - 1;
  15872. n.initSideSegments(i[o], i[o - 1], Sh.LEFT), n.addFirstSegment();
  15873. for (var s = o - 2; s >= 0; s--) n.addNextSegment(i[s], !0)
  15874. } else {
  15875. var a = Pp.simplify(t, r),
  15876. u = a.length - 1;
  15877. n.initSideSegments(a[0], a[1], Sh.LEFT), n.addFirstSegment();
  15878. for (var l = 2; l <= u; l++) n.addNextSegment(a[l], !0)
  15879. }
  15880. n.addLastSegment()
  15881. }, Fp.prototype.getSegGen = function (t) {
  15882. return new Ap(this._precisionModel, this._bufParams, t)
  15883. }, Fp.prototype.interfaces_ = function () {
  15884. return []
  15885. }, Fp.prototype.getClass = function () {
  15886. return Fp
  15887. }, Fp.copyCoordinates = function (t) {
  15888. for (var e = new Array(t.length).fill(null), n = 0; n < e.length; n++) e[n] = new ul(t[n]);
  15889. return e
  15890. };
  15891. var kp = function () {
  15892. this._subgraphs = null, this._seg = new vp, this._cga = new Xl;
  15893. var t = arguments[0];
  15894. this._subgraphs = t
  15895. },
  15896. Gp = {
  15897. DepthSegment: {
  15898. configurable: !0
  15899. }
  15900. };
  15901. kp.prototype.findStabbedSegments = function () {
  15902. var t = this;
  15903. if (1 === arguments.length) {
  15904. for (var e = arguments[0], n = new lc, r = this._subgraphs.iterator(); r.hasNext();) {
  15905. var i = r.next(),
  15906. o = i.getEnvelope();
  15907. e.y < o.getMinY() || e.y > o.getMaxY() || t.findStabbedSegments(e, i.getDirectedEdges(), n)
  15908. }
  15909. return n
  15910. }
  15911. if (3 === arguments.length)
  15912. if (gl(arguments[2], ac) && arguments[0] instanceof ul && arguments[1] instanceof Xh)
  15913. for (var s = arguments[0], a = arguments[1], u = arguments[2], l = a.getEdge().getCoordinates(), c = 0; c < l.length - 1; c++) {
  15914. t._seg.p0 = l[c], t._seg.p1 = l[c + 1], t._seg.p0.y > t._seg.p1.y && t._seg.reverse();
  15915. var h = Math.max(t._seg.p0.x, t._seg.p1.x);
  15916. if (!(h < s.x) && !(t._seg.isHorizontal() || s.y < t._seg.p0.y || s.y > t._seg.p1.y || Xl.computeOrientation(t._seg.p0, t._seg.p1, s) === Xl.RIGHT)) {
  15917. var p = a.getDepth(Sh.LEFT);
  15918. t._seg.p0.equals(l[c]) || (p = a.getDepth(Sh.RIGHT));
  15919. var f = new qp(t._seg, p);
  15920. u.add(f)
  15921. }
  15922. } else if (gl(arguments[2], ac) && arguments[0] instanceof ul && gl(arguments[1], ac))
  15923. for (var g = arguments[0], d = arguments[1], y = arguments[2], v = d.iterator(); v.hasNext();) {
  15924. var _ = v.next();
  15925. _.isForward() && t.findStabbedSegments(g, _, y)
  15926. }
  15927. }, kp.prototype.getDepth = function (t) {
  15928. var e = this.findStabbedSegments(t);
  15929. return 0 === e.size() ? 0 : np.min(e)._leftDepth
  15930. }, kp.prototype.interfaces_ = function () {
  15931. return []
  15932. }, kp.prototype.getClass = function () {
  15933. return kp
  15934. }, Gp.DepthSegment.get = function () {
  15935. return qp
  15936. }, Object.defineProperties(kp, Gp);
  15937. var qp = function () {
  15938. this._upwardSeg = null, this._leftDepth = null;
  15939. var t = arguments[0],
  15940. e = arguments[1];
  15941. this._upwardSeg = new vp(t), this._leftDepth = e
  15942. };
  15943. qp.prototype.compareTo = function (t) {
  15944. var e = t;
  15945. if (this._upwardSeg.minX() >= e._upwardSeg.maxX()) return 1;
  15946. if (this._upwardSeg.maxX() <= e._upwardSeg.minX()) return -1;
  15947. var n = this._upwardSeg.orientationIndex(e._upwardSeg);
  15948. return 0 !== n || 0 !== (n = -1 * e._upwardSeg.orientationIndex(this._upwardSeg)) ? n : this._upwardSeg.compareTo(e._upwardSeg)
  15949. }, qp.prototype.compareX = function (t, e) {
  15950. var n = t.p0.compareTo(e.p0);
  15951. return 0 !== n ? n : t.p1.compareTo(e.p1)
  15952. }, qp.prototype.toString = function () {
  15953. return this._upwardSeg.toString()
  15954. }, qp.prototype.interfaces_ = function () {
  15955. return [il]
  15956. }, qp.prototype.getClass = function () {
  15957. return qp
  15958. };
  15959. var Bp = function (t, e, n) {
  15960. this.p0 = t || null, this.p1 = e || null, this.p2 = n || null
  15961. };
  15962. Bp.prototype.area = function () {
  15963. return Bp.area(this.p0, this.p1, this.p2)
  15964. }, Bp.prototype.signedArea = function () {
  15965. return Bp.signedArea(this.p0, this.p1, this.p2)
  15966. }, Bp.prototype.interpolateZ = function (t) {
  15967. if (null === t) throw new el("Supplied point is null.");
  15968. return Bp.interpolateZ(t, this.p0, this.p1, this.p2)
  15969. }, Bp.prototype.longestSideLength = function () {
  15970. return Bp.longestSideLength(this.p0, this.p1, this.p2)
  15971. }, Bp.prototype.isAcute = function () {
  15972. return Bp.isAcute(this.p0, this.p1, this.p2)
  15973. }, Bp.prototype.circumcentre = function () {
  15974. return Bp.circumcentre(this.p0, this.p1, this.p2)
  15975. }, Bp.prototype.area3D = function () {
  15976. return Bp.area3D(this.p0, this.p1, this.p2)
  15977. }, Bp.prototype.centroid = function () {
  15978. return Bp.centroid(this.p0, this.p1, this.p2)
  15979. }, Bp.prototype.inCentre = function () {
  15980. return Bp.inCentre(this.p0, this.p1, this.p2)
  15981. }, Bp.prototype.interfaces_ = function () {
  15982. return []
  15983. }, Bp.prototype.getClass = function () {
  15984. return Bp
  15985. }, Bp.area = function (t, e, n) {
  15986. return Math.abs(((n.x - t.x) * (e.y - t.y) - (e.x - t.x) * (n.y - t.y)) / 2)
  15987. }, Bp.signedArea = function (t, e, n) {
  15988. return ((n.x - t.x) * (e.y - t.y) - (e.x - t.x) * (n.y - t.y)) / 2
  15989. }, Bp.det = function (t, e, n, r) {
  15990. return t * r - e * n
  15991. }, Bp.interpolateZ = function (t, e, n, r) {
  15992. var i = e.x,
  15993. o = e.y,
  15994. s = n.x - i,
  15995. a = r.x - i,
  15996. u = n.y - o,
  15997. l = r.y - o,
  15998. c = s * l - a * u,
  15999. h = t.x - i,
  16000. p = t.y - o,
  16001. f = (l * h - a * p) / c,
  16002. g = (-u * h + s * p) / c;
  16003. return e.z + f * (n.z - e.z) + g * (r.z - e.z)
  16004. }, Bp.longestSideLength = function (t, e, n) {
  16005. var r = t.distance(e),
  16006. i = e.distance(n),
  16007. o = n.distance(t),
  16008. s = r;
  16009. return i > s && (s = i), o > s && (s = o), s
  16010. }, Bp.isAcute = function (t, e, n) {
  16011. return !!Rp.isAcute(t, e, n) && (!!Rp.isAcute(e, n, t) && !!Rp.isAcute(n, t, e))
  16012. }, Bp.circumcentre = function (t, e, n) {
  16013. var r = n.x,
  16014. i = n.y,
  16015. o = t.x - r,
  16016. s = t.y - i,
  16017. a = e.x - r,
  16018. u = e.y - i,
  16019. l = 2 * Bp.det(o, s, a, u),
  16020. c = Bp.det(s, o * o + s * s, u, a * a + u * u),
  16021. h = Bp.det(o, o * o + s * s, a, a * a + u * u);
  16022. return new ul(r - c / l, i + h / l)
  16023. }, Bp.perpendicularBisector = function (t, e) {
  16024. var n = e.x - t.x,
  16025. r = e.y - t.y,
  16026. i = new Ml(t.x + n / 2, t.y + r / 2, 1),
  16027. o = new Ml(t.x - r + n / 2, t.y + n + r / 2, 1);
  16028. return new Ml(i, o)
  16029. }, Bp.angleBisector = function (t, e, n) {
  16030. var r = e.distance(t),
  16031. i = r / (r + e.distance(n)),
  16032. o = n.x - t.x,
  16033. s = n.y - t.y;
  16034. return new ul(t.x + i * o, t.y + i * s)
  16035. }, Bp.area3D = function (t, e, n) {
  16036. var r = e.x - t.x,
  16037. i = e.y - t.y,
  16038. o = e.z - t.z,
  16039. s = n.x - t.x,
  16040. a = n.y - t.y,
  16041. u = n.z - t.z,
  16042. l = i * u - o * a,
  16043. c = o * s - r * u,
  16044. h = r * a - i * s,
  16045. p = l * l + c * c + h * h,
  16046. f = Math.sqrt(p) / 2;
  16047. return f
  16048. }, Bp.centroid = function (t, e, n) {
  16049. var r = (t.x + e.x + n.x) / 3,
  16050. i = (t.y + e.y + n.y) / 3;
  16051. return new ul(r, i)
  16052. }, Bp.inCentre = function (t, e, n) {
  16053. var r = e.distance(n),
  16054. i = t.distance(n),
  16055. o = t.distance(e),
  16056. s = r + i + o,
  16057. a = (r * t.x + i * e.x + o * n.x) / s,
  16058. u = (r * t.y + i * e.y + o * n.y) / s;
  16059. return new ul(a, u)
  16060. };
  16061. var zp = function () {
  16062. this._inputGeom = null, this._distance = null, this._curveBuilder = null, this._curveList = new lc;
  16063. var t = arguments[0],
  16064. e = arguments[1],
  16065. n = arguments[2];
  16066. this._inputGeom = t, this._distance = e, this._curveBuilder = n
  16067. };
  16068. zp.prototype.addPoint = function (t) {
  16069. if (this._distance <= 0) return null;
  16070. var e = t.getCoordinates(),
  16071. n = this._curveBuilder.getLineCurve(e, this._distance);
  16072. this.addCurve(n, pl.EXTERIOR, pl.INTERIOR)
  16073. }, zp.prototype.addPolygon = function (t) {
  16074. var e = this,
  16075. n = this._distance,
  16076. r = Sh.LEFT;
  16077. this._distance < 0 && (n = -this._distance, r = Sh.RIGHT);
  16078. var i = t.getExteriorRing(),
  16079. o = pc.removeRepeatedPoints(i.getCoordinates());
  16080. if (this._distance < 0 && this.isErodedCompletely(i, this._distance)) return null;
  16081. if (this._distance <= 0 && o.length < 3) return null;
  16082. this.addPolygonRing(o, n, r, pl.EXTERIOR, pl.INTERIOR);
  16083. for (var s = 0; s < t.getNumInteriorRing(); s++) {
  16084. var a = t.getInteriorRingN(s),
  16085. u = pc.removeRepeatedPoints(a.getCoordinates());
  16086. e._distance > 0 && e.isErodedCompletely(a, -e._distance) || e.addPolygonRing(u, n, Sh.opposite(r), pl.INTERIOR, pl.EXTERIOR)
  16087. }
  16088. }, zp.prototype.isTriangleErodedCompletely = function (t, e) {
  16089. var n = new Bp(t[0], t[1], t[2]),
  16090. r = n.inCentre();
  16091. return Xl.distancePointLine(r, n.p0, n.p1) < Math.abs(e)
  16092. }, zp.prototype.addLineString = function (t) {
  16093. if (this._distance <= 0 && !this._curveBuilder.getBufferParameters().isSingleSided()) return null;
  16094. var e = pc.removeRepeatedPoints(t.getCoordinates()),
  16095. n = this._curveBuilder.getLineCurve(e, this._distance);
  16096. this.addCurve(n, pl.EXTERIOR, pl.INTERIOR)
  16097. }, zp.prototype.addCurve = function (t, e, n) {
  16098. if (null === t || t.length < 2) return null;
  16099. var r = new yp(t, new Dh(0, pl.BOUNDARY, e, n));
  16100. this._curveList.add(r)
  16101. }, zp.prototype.getCurves = function () {
  16102. return this.add(this._inputGeom), this._curveList
  16103. }, zp.prototype.addPolygonRing = function (t, e, n, r, i) {
  16104. if (0 === e && t.length < nh.MINIMUM_VALID_SIZE) return null;
  16105. var o = r,
  16106. s = i;
  16107. t.length >= nh.MINIMUM_VALID_SIZE && Xl.isCCW(t) && (o = i, s = r, n = Sh.opposite(n));
  16108. var a = this._curveBuilder.getRingCurve(t, n, e);
  16109. this.addCurve(a, o, s)
  16110. }, zp.prototype.add = function (t) {
  16111. if (t.isEmpty()) return null;
  16112. t instanceof th ? this.addPolygon(t) : t instanceof Zc ? this.addLineString(t) : t instanceof Qc ? this.addPoint(t) : (t instanceof eh || t instanceof Gc || t instanceof rh || t instanceof kc) && this.addCollection(t)
  16113. }, zp.prototype.isErodedCompletely = function (t, e) {
  16114. var n = t.getCoordinates();
  16115. if (n.length < 4) return e < 0;
  16116. if (4 === n.length) return this.isTriangleErodedCompletely(n, e);
  16117. var r = t.getEnvelopeInternal(),
  16118. i = Math.min(r.getHeight(), r.getWidth());
  16119. return e < 0 && 2 * Math.abs(e) > i
  16120. }, zp.prototype.addCollection = function (t) {
  16121. for (var e = 0; e < t.getNumGeometries(); e++) {
  16122. var n = t.getGeometryN(e);
  16123. this.add(n)
  16124. }
  16125. }, zp.prototype.interfaces_ = function () {
  16126. return []
  16127. }, zp.prototype.getClass = function () {
  16128. return zp
  16129. };
  16130. var jp = function () {};
  16131. jp.prototype.locate = function (t) {}, jp.prototype.interfaces_ = function () {
  16132. return []
  16133. }, jp.prototype.getClass = function () {
  16134. return jp
  16135. };
  16136. var Up = function () {
  16137. this._parent = null, this._atStart = null, this._max = null, this._index = null, this._subcollectionIterator = null;
  16138. var t = arguments[0];
  16139. this._parent = t, this._atStart = !0, this._index = 0, this._max = t.getNumGeometries()
  16140. };
  16141. Up.prototype.next = function () {
  16142. if (this._atStart) return this._atStart = !1, Up.isAtomic(this._parent) && this._index++, this._parent;
  16143. if (null !== this._subcollectionIterator) {
  16144. if (this._subcollectionIterator.hasNext()) return this._subcollectionIterator.next();
  16145. this._subcollectionIterator = null
  16146. }
  16147. if (this._index >= this._max) throw new uc;
  16148. var t = this._parent.getGeometryN(this._index++);
  16149. return t instanceof kc ? (this._subcollectionIterator = new Up(t), this._subcollectionIterator.next()) : t
  16150. }, Up.prototype.remove = function () {
  16151. throw new Error(this.getClass().getName())
  16152. }, Up.prototype.hasNext = function () {
  16153. if (this._atStart) return !0;
  16154. if (null !== this._subcollectionIterator) {
  16155. if (this._subcollectionIterator.hasNext()) return !0;
  16156. this._subcollectionIterator = null
  16157. }
  16158. return !(this._index >= this._max)
  16159. }, Up.prototype.interfaces_ = function () {
  16160. return [sc]
  16161. }, Up.prototype.getClass = function () {
  16162. return Up
  16163. }, Up.isAtomic = function (t) {
  16164. return !(t instanceof kc)
  16165. };
  16166. var Vp = function () {
  16167. this._geom = null;
  16168. var t = arguments[0];
  16169. this._geom = t
  16170. };
  16171. Vp.prototype.locate = function (t) {
  16172. return Vp.locate(t, this._geom)
  16173. }, Vp.prototype.interfaces_ = function () {
  16174. return [jp]
  16175. }, Vp.prototype.getClass = function () {
  16176. return Vp
  16177. }, Vp.isPointInRing = function (t, e) {
  16178. return !!e.getEnvelopeInternal().intersects(t) && Xl.isPointInRing(t, e.getCoordinates())
  16179. }, Vp.containsPointInPolygon = function (t, e) {
  16180. if (e.isEmpty()) return !1;
  16181. var n = e.getExteriorRing();
  16182. if (!Vp.isPointInRing(t, n)) return !1;
  16183. for (var r = 0; r < e.getNumInteriorRing(); r++) {
  16184. var i = e.getInteriorRingN(r);
  16185. if (Vp.isPointInRing(t, i)) return !1
  16186. }
  16187. return !0
  16188. }, Vp.containsPoint = function (t, e) {
  16189. if (e instanceof th) return Vp.containsPointInPolygon(t, e);
  16190. if (e instanceof kc)
  16191. for (var n = new Up(e); n.hasNext();) {
  16192. var r = n.next();
  16193. if (r !== e && Vp.containsPoint(t, r)) return !0
  16194. }
  16195. return !1
  16196. }, Vp.locate = function (t, e) {
  16197. return e.isEmpty() ? pl.EXTERIOR : Vp.containsPoint(t, e) ? pl.INTERIOR : pl.EXTERIOR
  16198. };
  16199. var Xp = function () {
  16200. this._edgeMap = new Cc, this._edgeList = null, this._ptInAreaLocation = [pl.NONE, pl.NONE]
  16201. };
  16202. Xp.prototype.getNextCW = function (t) {
  16203. this.getEdges();
  16204. var e = this._edgeList.indexOf(t),
  16205. n = e - 1;
  16206. return 0 === e && (n = this._edgeList.size() - 1), this._edgeList.get(n)
  16207. }, Xp.prototype.propagateSideLabels = function (t) {
  16208. for (var e = pl.NONE, n = this.iterator(); n.hasNext();) {
  16209. var r = n.next().getLabel();
  16210. r.isArea(t) && r.getLocation(t, Sh.LEFT) !== pl.NONE && (e = r.getLocation(t, Sh.LEFT))
  16211. }
  16212. if (e === pl.NONE) return null;
  16213. for (var i = e, o = this.iterator(); o.hasNext();) {
  16214. var s = o.next(),
  16215. a = s.getLabel();
  16216. if (a.getLocation(t, Sh.ON) === pl.NONE && a.setLocation(t, Sh.ON, i), a.isArea(t)) {
  16217. var u = a.getLocation(t, Sh.LEFT),
  16218. l = a.getLocation(t, Sh.RIGHT);
  16219. if (l !== pl.NONE) {
  16220. if (l !== i) throw new Oh("side location conflict", s.getCoordinate());
  16221. u === pl.NONE && ql.shouldNeverReachHere("found single null side (at " + s.getCoordinate() + ")"), i = u
  16222. } else ql.isTrue(a.getLocation(t, Sh.LEFT) === pl.NONE, "found single null side"), a.setLocation(t, Sh.RIGHT, i), a.setLocation(t, Sh.LEFT, i)
  16223. }
  16224. }
  16225. }, Xp.prototype.getCoordinate = function () {
  16226. var t = this.iterator();
  16227. return t.hasNext() ? t.next().getCoordinate() : null
  16228. }, Xp.prototype.print = function (t) {
  16229. Pl.out.println("EdgeEndStar: " + this.getCoordinate());
  16230. for (var e = this.iterator(); e.hasNext();) {
  16231. e.next().print(t)
  16232. }
  16233. }, Xp.prototype.isAreaLabelsConsistent = function (t) {
  16234. return this.computeEdgeEndLabels(t.getBoundaryNodeRule()), this.checkAreaLabelsConsistent(0)
  16235. }, Xp.prototype.checkAreaLabelsConsistent = function (t) {
  16236. var e = this.getEdges();
  16237. if (e.size() <= 0) return !0;
  16238. var n = e.size() - 1,
  16239. r = e.get(n).getLabel().getLocation(t, Sh.LEFT);
  16240. ql.isTrue(r !== pl.NONE, "Found unlabelled area edge");
  16241. for (var i = r, o = this.iterator(); o.hasNext();) {
  16242. var s = o.next().getLabel();
  16243. ql.isTrue(s.isArea(t), "Found non-area edge");
  16244. var a = s.getLocation(t, Sh.LEFT),
  16245. u = s.getLocation(t, Sh.RIGHT);
  16246. if (a === u) return !1;
  16247. if (u !== i) return !1;
  16248. i = a
  16249. }
  16250. return !0
  16251. }, Xp.prototype.findIndex = function (t) {
  16252. this.iterator();
  16253. for (var e = 0; e < this._edgeList.size(); e++) {
  16254. if (this._edgeList.get(e) === t) return e
  16255. }
  16256. return -1
  16257. }, Xp.prototype.iterator = function () {
  16258. return this.getEdges().iterator()
  16259. }, Xp.prototype.getEdges = function () {
  16260. return null === this._edgeList && (this._edgeList = new lc(this._edgeMap.values())), this._edgeList
  16261. }, Xp.prototype.getLocation = function (t, e, n) {
  16262. return this._ptInAreaLocation[t] === pl.NONE && (this._ptInAreaLocation[t] = Vp.locate(e, n[t].getGeometry())), this._ptInAreaLocation[t]
  16263. }, Xp.prototype.toString = function () {
  16264. var t = new vl;
  16265. t.append("EdgeEndStar: " + this.getCoordinate()), t.append("\n");
  16266. for (var e = this.iterator(); e.hasNext();) {
  16267. var n = e.next();
  16268. t.append(n), t.append("\n")
  16269. }
  16270. return t.toString()
  16271. }, Xp.prototype.computeEdgeEndLabels = function (t) {
  16272. for (var e = this.iterator(); e.hasNext();) {
  16273. e.next().computeLabel(t)
  16274. }
  16275. }, Xp.prototype.computeLabelling = function (t) {
  16276. this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()), this.propagateSideLabels(0), this.propagateSideLabels(1);
  16277. for (var e = [!1, !1], n = this.iterator(); n.hasNext();)
  16278. for (var r = n.next().getLabel(), i = 0; i < 2; i++) r.isLine(i) && r.getLocation(i) === pl.BOUNDARY && (e[i] = !0);
  16279. for (var o = this.iterator(); o.hasNext();)
  16280. for (var s = o.next(), a = s.getLabel(), u = 0; u < 2; u++)
  16281. if (a.isAnyNull(u)) {
  16282. var l = pl.NONE;
  16283. if (e[u]) l = pl.EXTERIOR;
  16284. else {
  16285. var c = s.getCoordinate();
  16286. l = this.getLocation(u, c, t)
  16287. }
  16288. a.setAllLocationsIfNull(u, l)
  16289. }
  16290. }, Xp.prototype.getDegree = function () {
  16291. return this._edgeMap.size()
  16292. }, Xp.prototype.insertEdgeEnd = function (t, e) {
  16293. this._edgeMap.put(t, e), this._edgeList = null
  16294. }, Xp.prototype.interfaces_ = function () {
  16295. return []
  16296. }, Xp.prototype.getClass = function () {
  16297. return Xp
  16298. };
  16299. var Yp = function (t) {
  16300. function e() {
  16301. t.call(this), this._resultAreaEdgeList = null, this._label = null, this._SCANNING_FOR_INCOMING = 1, this._LINKING_TO_OUTGOING = 2
  16302. }
  16303. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.linkResultDirectedEdges = function () {
  16304. var t = this;
  16305. this.getResultAreaEdges();
  16306. for (var e = null, n = null, r = this._SCANNING_FOR_INCOMING, i = 0; i < this._resultAreaEdgeList.size(); i++) {
  16307. var o = t._resultAreaEdgeList.get(i),
  16308. s = o.getSym();
  16309. if (o.getLabel().isArea()) switch (null === e && o.isInResult() && (e = o), r) {
  16310. case t._SCANNING_FOR_INCOMING:
  16311. if (!s.isInResult()) continue;
  16312. n = s, r = t._LINKING_TO_OUTGOING;
  16313. break;
  16314. case t._LINKING_TO_OUTGOING:
  16315. if (!o.isInResult()) continue;
  16316. n.setNext(o), r = t._SCANNING_FOR_INCOMING
  16317. }
  16318. }
  16319. if (r === this._LINKING_TO_OUTGOING) {
  16320. if (null === e) throw new Oh("no outgoing dirEdge found", this.getCoordinate());
  16321. ql.isTrue(e.isInResult(), "unable to link last incoming dirEdge"), n.setNext(e)
  16322. }
  16323. }, e.prototype.insert = function (t) {
  16324. var e = t;
  16325. this.insertEdgeEnd(e, e)
  16326. }, e.prototype.getRightmostEdge = function () {
  16327. var t = this.getEdges(),
  16328. e = t.size();
  16329. if (e < 1) return null;
  16330. var n = t.get(0);
  16331. if (1 === e) return n;
  16332. var r = t.get(e - 1),
  16333. i = n.getQuadrant(),
  16334. o = r.getQuadrant();
  16335. return jh.isNorthern(i) && jh.isNorthern(o) ? n : jh.isNorthern(i) || jh.isNorthern(o) ? 0 !== n.getDy() ? n : 0 !== r.getDy() ? r : (ql.shouldNeverReachHere("found two horizontal edges incident on node"), null) : r
  16336. }, e.prototype.print = function (t) {
  16337. Pl.out.println("DirectedEdgeStar: " + this.getCoordinate());
  16338. for (var e = this.iterator(); e.hasNext();) {
  16339. var n = e.next();
  16340. t.print("out "), n.print(t), t.println(), t.print("in "), n.getSym().print(t), t.println()
  16341. }
  16342. }, e.prototype.getResultAreaEdges = function () {
  16343. if (null !== this._resultAreaEdgeList) return this._resultAreaEdgeList;
  16344. this._resultAreaEdgeList = new lc;
  16345. for (var t = this.iterator(); t.hasNext();) {
  16346. var e = t.next();
  16347. (e.isInResult() || e.getSym().isInResult()) && this._resultAreaEdgeList.add(e)
  16348. }
  16349. return this._resultAreaEdgeList
  16350. }, e.prototype.updateLabelling = function (t) {
  16351. for (var e = this.iterator(); e.hasNext();) {
  16352. var n = e.next().getLabel();
  16353. n.setAllLocationsIfNull(0, t.getLocation(0)), n.setAllLocationsIfNull(1, t.getLocation(1))
  16354. }
  16355. }, e.prototype.linkAllDirectedEdges = function () {
  16356. this.getEdges();
  16357. for (var t = null, e = null, n = this._edgeList.size() - 1; n >= 0; n--) {
  16358. var r = this._edgeList.get(n),
  16359. i = r.getSym();
  16360. null === e && (e = i), null !== t && i.setNext(t), t = r
  16361. }
  16362. e.setNext(t)
  16363. }, e.prototype.computeDepths = function () {
  16364. var t = this;
  16365. if (1 === arguments.length) {
  16366. var e = arguments[0],
  16367. n = this.findIndex(e),
  16368. r = e.getDepth(Sh.LEFT),
  16369. i = e.getDepth(Sh.RIGHT),
  16370. o = this.computeDepths(n + 1, this._edgeList.size(), r),
  16371. s = this.computeDepths(0, n, o);
  16372. if (s !== i) throw new Oh("depth mismatch at " + e.getCoordinate())
  16373. } else if (3 === arguments.length) {
  16374. for (var a = arguments[0], u = arguments[1], l = arguments[2], c = l, h = a; h < u; h++) {
  16375. var p = t._edgeList.get(h);
  16376. p.setEdgeDepths(Sh.RIGHT, c), c = p.getDepth(Sh.LEFT)
  16377. }
  16378. return c
  16379. }
  16380. }, e.prototype.mergeSymLabels = function () {
  16381. for (var t = this.iterator(); t.hasNext();) {
  16382. var e = t.next();
  16383. e.getLabel().merge(e.getSym().getLabel())
  16384. }
  16385. }, e.prototype.linkMinimalDirectedEdges = function (t) {
  16386. for (var e = this, n = null, r = null, i = this._SCANNING_FOR_INCOMING, o = this._resultAreaEdgeList.size() - 1; o >= 0; o--) {
  16387. var s = e._resultAreaEdgeList.get(o),
  16388. a = s.getSym();
  16389. switch (null === n && s.getEdgeRing() === t && (n = s), i) {
  16390. case e._SCANNING_FOR_INCOMING:
  16391. if (a.getEdgeRing() !== t) continue;
  16392. r = a, i = e._LINKING_TO_OUTGOING;
  16393. break;
  16394. case e._LINKING_TO_OUTGOING:
  16395. if (s.getEdgeRing() !== t) continue;
  16396. r.setNextMin(s), i = e._SCANNING_FOR_INCOMING
  16397. }
  16398. }
  16399. i === this._LINKING_TO_OUTGOING && (ql.isTrue(null !== n, "found null for first outgoing dirEdge"), ql.isTrue(n.getEdgeRing() === t, "unable to link last incoming dirEdge"), r.setNextMin(n))
  16400. }, e.prototype.getOutgoingDegree = function () {
  16401. if (0 === arguments.length) {
  16402. for (var t = 0, e = this.iterator(); e.hasNext();) {
  16403. var n = e.next();
  16404. n.isInResult() && t++
  16405. }
  16406. return t
  16407. }
  16408. if (1 === arguments.length) {
  16409. for (var r = arguments[0], i = 0, o = this.iterator(); o.hasNext();) {
  16410. var s = o.next();
  16411. s.getEdgeRing() === r && i++
  16412. }
  16413. return i
  16414. }
  16415. }, e.prototype.getLabel = function () {
  16416. return this._label
  16417. }, e.prototype.findCoveredLineEdges = function () {
  16418. for (var t = pl.NONE, e = this.iterator(); e.hasNext();) {
  16419. var n = e.next(),
  16420. r = n.getSym();
  16421. if (!n.isLineEdge()) {
  16422. if (n.isInResult()) {
  16423. t = pl.INTERIOR;
  16424. break
  16425. }
  16426. if (r.isInResult()) {
  16427. t = pl.EXTERIOR;
  16428. break
  16429. }
  16430. }
  16431. }
  16432. if (t === pl.NONE) return null;
  16433. for (var i = t, o = this.iterator(); o.hasNext();) {
  16434. var s = o.next(),
  16435. a = s.getSym();
  16436. s.isLineEdge() ? s.getEdge().setCovered(i === pl.INTERIOR) : (s.isInResult() && (i = pl.EXTERIOR), a.isInResult() && (i = pl.INTERIOR))
  16437. }
  16438. }, e.prototype.computeLabelling = function (e) {
  16439. t.prototype.computeLabelling.call(this, e), this._label = new Dh(pl.NONE);
  16440. for (var n = this.iterator(); n.hasNext();)
  16441. for (var r = n.next().getEdge().getLabel(), i = 0; i < 2; i++) {
  16442. var o = r.getLocation(i);
  16443. o !== pl.INTERIOR && o !== pl.BOUNDARY || this._label.setLocation(i, pl.INTERIOR)
  16444. }
  16445. }, e.prototype.interfaces_ = function () {
  16446. return []
  16447. }, e.prototype.getClass = function () {
  16448. return e
  16449. }, e
  16450. }(Xp),
  16451. Hp = function (t) {
  16452. function e() {
  16453. t.apply(this, arguments)
  16454. }
  16455. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.createNode = function (t) {
  16456. return new Bh(t, new Yp)
  16457. }, e.prototype.interfaces_ = function () {
  16458. return []
  16459. }, e.prototype.getClass = function () {
  16460. return e
  16461. }, e
  16462. }(Yh),
  16463. Wp = function t() {
  16464. this._pts = null, this._orientation = null;
  16465. var e = arguments[0];
  16466. this._pts = e, this._orientation = t.orientation(e)
  16467. };
  16468. Wp.prototype.compareTo = function (t) {
  16469. var e = t;
  16470. return Wp.compareOriented(this._pts, this._orientation, e._pts, e._orientation)
  16471. }, Wp.prototype.interfaces_ = function () {
  16472. return [il]
  16473. }, Wp.prototype.getClass = function () {
  16474. return Wp
  16475. }, Wp.orientation = function (t) {
  16476. return 1 === pc.increasingDirection(t)
  16477. }, Wp.compareOriented = function (t, e, n, r) {
  16478. for (var i = e ? 1 : -1, o = r ? 1 : -1, s = e ? t.length : -1, a = r ? n.length : -1, u = e ? 0 : t.length - 1, l = r ? 0 : n.length - 1;;) {
  16479. var c = t[u].compareTo(n[l]);
  16480. if (0 !== c) return c;
  16481. var h = (u += i) === s,
  16482. p = (l += o) === a;
  16483. if (h && !p) return -1;
  16484. if (!h && p) return 1;
  16485. if (h && p) return 0
  16486. }
  16487. };
  16488. var Jp = function () {
  16489. this._edges = new lc, this._ocaMap = new Cc
  16490. };
  16491. Jp.prototype.print = function (t) {
  16492. t.print("MULTILINESTRING ( ");
  16493. for (var e = 0; e < this._edges.size(); e++) {
  16494. var n = this._edges.get(e);
  16495. e > 0 && t.print(","), t.print("(");
  16496. for (var r = n.getCoordinates(), i = 0; i < r.length; i++) i > 0 && t.print(","), t.print(r[i].x + " " + r[i].y);
  16497. t.println(")")
  16498. }
  16499. t.print(") ")
  16500. }, Jp.prototype.addAll = function (t) {
  16501. for (var e = t.iterator(); e.hasNext();) this.add(e.next())
  16502. }, Jp.prototype.findEdgeIndex = function (t) {
  16503. for (var e = 0; e < this._edges.size(); e++)
  16504. if (this._edges.get(e).equals(t)) return e;
  16505. return -1
  16506. }, Jp.prototype.iterator = function () {
  16507. return this._edges.iterator()
  16508. }, Jp.prototype.getEdges = function () {
  16509. return this._edges
  16510. }, Jp.prototype.get = function (t) {
  16511. return this._edges.get(t)
  16512. }, Jp.prototype.findEqualEdge = function (t) {
  16513. var e = new Wp(t.getCoordinates());
  16514. return this._ocaMap.get(e)
  16515. }, Jp.prototype.add = function (t) {
  16516. this._edges.add(t);
  16517. var e = new Wp(t.getCoordinates());
  16518. this._ocaMap.put(e, t)
  16519. }, Jp.prototype.interfaces_ = function () {
  16520. return []
  16521. }, Jp.prototype.getClass = function () {
  16522. return Jp
  16523. };
  16524. var Zp = function () {};
  16525. Zp.prototype.processIntersections = function (t, e, n, r) {}, Zp.prototype.isDone = function () {}, Zp.prototype.interfaces_ = function () {
  16526. return []
  16527. }, Zp.prototype.getClass = function () {
  16528. return Zp
  16529. };
  16530. var Kp = function () {
  16531. this._hasIntersection = !1, this._hasProper = !1, this._hasProperInterior = !1, this._hasInterior = !1, this._properIntersectionPoint = null, this._li = null, this._isSelfIntersection = null, this.numIntersections = 0, this.numInteriorIntersections = 0, this.numProperIntersections = 0, this.numTests = 0;
  16532. var t = arguments[0];
  16533. this._li = t
  16534. };
  16535. Kp.prototype.isTrivialIntersection = function (t, e, n, r) {
  16536. if (t === n && 1 === this._li.getIntersectionNum()) {
  16537. if (Kp.isAdjacentSegments(e, r)) return !0;
  16538. if (t.isClosed()) {
  16539. var i = t.size() - 1;
  16540. if (0 === e && r === i || 0 === r && e === i) return !0
  16541. }
  16542. }
  16543. return !1
  16544. }, Kp.prototype.getProperIntersectionPoint = function () {
  16545. return this._properIntersectionPoint
  16546. }, Kp.prototype.hasProperInteriorIntersection = function () {
  16547. return this._hasProperInterior
  16548. }, Kp.prototype.getLineIntersector = function () {
  16549. return this._li
  16550. }, Kp.prototype.hasProperIntersection = function () {
  16551. return this._hasProper
  16552. }, Kp.prototype.processIntersections = function (t, e, n, r) {
  16553. if (t === n && e === r) return null;
  16554. this.numTests++;
  16555. var i = t.getCoordinates()[e],
  16556. o = t.getCoordinates()[e + 1],
  16557. s = n.getCoordinates()[r],
  16558. a = n.getCoordinates()[r + 1];
  16559. this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && (this.numIntersections++, this._li.isInteriorIntersection() && (this.numInteriorIntersections++, this._hasInterior = !0), this.isTrivialIntersection(t, e, n, r) || (this._hasIntersection = !0, t.addIntersections(this._li, e, 0), n.addIntersections(this._li, r, 1), this._li.isProper() && (this.numProperIntersections++, this._hasProper = !0, this._hasProperInterior = !0)))
  16560. }, Kp.prototype.hasIntersection = function () {
  16561. return this._hasIntersection
  16562. }, Kp.prototype.isDone = function () {
  16563. return !1
  16564. }, Kp.prototype.hasInteriorIntersection = function () {
  16565. return this._hasInterior
  16566. }, Kp.prototype.interfaces_ = function () {
  16567. return [Zp]
  16568. }, Kp.prototype.getClass = function () {
  16569. return Kp
  16570. }, Kp.isAdjacentSegments = function (t, e) {
  16571. return 1 === Math.abs(t - e)
  16572. };
  16573. var Qp = function () {
  16574. this.coord = null, this.segmentIndex = null, this.dist = null;
  16575. var t = arguments[0],
  16576. e = arguments[1],
  16577. n = arguments[2];
  16578. this.coord = new ul(t), this.segmentIndex = e, this.dist = n
  16579. };
  16580. Qp.prototype.getSegmentIndex = function () {
  16581. return this.segmentIndex
  16582. }, Qp.prototype.getCoordinate = function () {
  16583. return this.coord
  16584. }, Qp.prototype.print = function (t) {
  16585. t.print(this.coord), t.print(" seg # = " + this.segmentIndex), t.println(" dist = " + this.dist)
  16586. }, Qp.prototype.compareTo = function (t) {
  16587. var e = t;
  16588. return this.compare(e.segmentIndex, e.dist)
  16589. }, Qp.prototype.isEndPoint = function (t) {
  16590. return 0 === this.segmentIndex && 0 === this.dist || this.segmentIndex === t
  16591. }, Qp.prototype.toString = function () {
  16592. return this.coord + " seg # = " + this.segmentIndex + " dist = " + this.dist
  16593. }, Qp.prototype.getDistance = function () {
  16594. return this.dist
  16595. }, Qp.prototype.compare = function (t, e) {
  16596. return this.segmentIndex < t ? -1 : this.segmentIndex > t ? 1 : this.dist < e ? -1 : this.dist > e ? 1 : 0
  16597. }, Qp.prototype.interfaces_ = function () {
  16598. return [il]
  16599. }, Qp.prototype.getClass = function () {
  16600. return Qp
  16601. };
  16602. var $p = function () {
  16603. this._nodeMap = new Cc, this.edge = null;
  16604. var t = arguments[0];
  16605. this.edge = t
  16606. };
  16607. $p.prototype.print = function (t) {
  16608. t.println("Intersections:");
  16609. for (var e = this.iterator(); e.hasNext();) {
  16610. e.next().print(t)
  16611. }
  16612. }, $p.prototype.iterator = function () {
  16613. return this._nodeMap.values().iterator()
  16614. }, $p.prototype.addSplitEdges = function (t) {
  16615. this.addEndpoints();
  16616. for (var e = this.iterator(), n = e.next(); e.hasNext();) {
  16617. var r = e.next(),
  16618. i = this.createSplitEdge(n, r);
  16619. t.add(i), n = r
  16620. }
  16621. }, $p.prototype.addEndpoints = function () {
  16622. var t = this.edge.pts.length - 1;
  16623. this.add(this.edge.pts[0], 0, 0), this.add(this.edge.pts[t], t, 0)
  16624. }, $p.prototype.createSplitEdge = function (t, e) {
  16625. var n = e.segmentIndex - t.segmentIndex + 2,
  16626. r = this.edge.pts[e.segmentIndex],
  16627. i = e.dist > 0 || !e.coord.equals2D(r);
  16628. i || n--;
  16629. var o = new Array(n).fill(null),
  16630. s = 0;
  16631. o[s++] = new ul(t.coord);
  16632. for (var a = t.segmentIndex + 1; a <= e.segmentIndex; a++) o[s++] = this.edge.pts[a];
  16633. return i && (o[s] = e.coord), new of (o, new Dh(this.edge._label))
  16634. }, $p.prototype.add = function (t, e, n) {
  16635. var r = new Qp(t, e, n),
  16636. i = this._nodeMap.get(r);
  16637. return null !== i ? i : (this._nodeMap.put(r, r), r)
  16638. }, $p.prototype.isIntersection = function (t) {
  16639. for (var e = this.iterator(); e.hasNext();) {
  16640. if (e.next().coord.equals(t)) return !0
  16641. }
  16642. return !1
  16643. }, $p.prototype.interfaces_ = function () {
  16644. return []
  16645. }, $p.prototype.getClass = function () {
  16646. return $p
  16647. };
  16648. var tf = function () {};
  16649. tf.prototype.getChainStartIndices = function (t) {
  16650. var e = 0,
  16651. n = new lc;
  16652. n.add(new _l(e));
  16653. do {
  16654. var r = this.findChainEnd(t, e);
  16655. n.add(new _l(r)), e = r
  16656. } while (e < t.length - 1);
  16657. return tf.toIntArray(n)
  16658. }, tf.prototype.findChainEnd = function (t, e) {
  16659. for (var n = jh.quadrant(t[e], t[e + 1]), r = e + 1; r < t.length;) {
  16660. if (jh.quadrant(t[r - 1], t[r]) !== n) break;
  16661. r++
  16662. }
  16663. return r - 1
  16664. }, tf.prototype.interfaces_ = function () {
  16665. return []
  16666. }, tf.prototype.getClass = function () {
  16667. return tf
  16668. }, tf.toIntArray = function (t) {
  16669. for (var e = new Array(t.size()).fill(null), n = 0; n < e.length; n++) e[n] = t.get(n).intValue();
  16670. return e
  16671. };
  16672. var ef = function () {
  16673. this.e = null, this.pts = null, this.startIndex = null, this.env1 = new Ll, this.env2 = new Ll;
  16674. var t = arguments[0];
  16675. this.e = t, this.pts = t.getCoordinates();
  16676. var e = new tf;
  16677. this.startIndex = e.getChainStartIndices(this.pts)
  16678. };
  16679. ef.prototype.getCoordinates = function () {
  16680. return this.pts
  16681. }, ef.prototype.getMaxX = function (t) {
  16682. var e = this.pts[this.startIndex[t]].x,
  16683. n = this.pts[this.startIndex[t + 1]].x;
  16684. return e > n ? e : n
  16685. }, ef.prototype.getMinX = function (t) {
  16686. var e = this.pts[this.startIndex[t]].x,
  16687. n = this.pts[this.startIndex[t + 1]].x;
  16688. return e < n ? e : n
  16689. }, ef.prototype.computeIntersectsForChain = function () {
  16690. if (4 === arguments.length) {
  16691. var t = arguments[0],
  16692. e = arguments[1],
  16693. n = arguments[2],
  16694. r = arguments[3];
  16695. this.computeIntersectsForChain(this.startIndex[t], this.startIndex[t + 1], e, e.startIndex[n], e.startIndex[n + 1], r)
  16696. } else if (6 === arguments.length) {
  16697. var i = arguments[0],
  16698. o = arguments[1],
  16699. s = arguments[2],
  16700. a = arguments[3],
  16701. u = arguments[4],
  16702. l = arguments[5],
  16703. c = this.pts[i],
  16704. h = this.pts[o],
  16705. p = s.pts[a],
  16706. f = s.pts[u];
  16707. if (o - i == 1 && u - a == 1) return l.addIntersections(this.e, i, s.e, a), null;
  16708. if (this.env1.init(c, h), this.env2.init(p, f), !this.env1.intersects(this.env2)) return null;
  16709. var g = Math.trunc((i + o) / 2),
  16710. d = Math.trunc((a + u) / 2);
  16711. i < g && (a < d && this.computeIntersectsForChain(i, g, s, a, d, l), d < u && this.computeIntersectsForChain(i, g, s, d, u, l)), g < o && (a < d && this.computeIntersectsForChain(g, o, s, a, d, l), d < u && this.computeIntersectsForChain(g, o, s, d, u, l))
  16712. }
  16713. }, ef.prototype.getStartIndexes = function () {
  16714. return this.startIndex
  16715. }, ef.prototype.computeIntersects = function (t, e) {
  16716. for (var n = 0; n < this.startIndex.length - 1; n++)
  16717. for (var r = 0; r < t.startIndex.length - 1; r++) this.computeIntersectsForChain(n, t, r, e)
  16718. }, ef.prototype.interfaces_ = function () {
  16719. return []
  16720. }, ef.prototype.getClass = function () {
  16721. return ef
  16722. };
  16723. var nf = function t() {
  16724. this._depth = Array(2).fill().map((function () {
  16725. return Array(3)
  16726. }));
  16727. for (var e = 0; e < 2; e++)
  16728. for (var n = 0; n < 3; n++) this._depth[e][n] = t.NULL_VALUE
  16729. },
  16730. rf = {
  16731. NULL_VALUE: {
  16732. configurable: !0
  16733. }
  16734. };
  16735. nf.prototype.getDepth = function (t, e) {
  16736. return this._depth[t][e]
  16737. }, nf.prototype.setDepth = function (t, e, n) {
  16738. this._depth[t][e] = n
  16739. }, nf.prototype.isNull = function () {
  16740. var t = this;
  16741. if (0 === arguments.length) {
  16742. for (var e = 0; e < 2; e++)
  16743. for (var n = 0; n < 3; n++)
  16744. if (t._depth[e][n] !== nf.NULL_VALUE) return !1;
  16745. return !0
  16746. }
  16747. if (1 === arguments.length) {
  16748. var r = arguments[0];
  16749. return this._depth[r][1] === nf.NULL_VALUE
  16750. }
  16751. if (2 === arguments.length) {
  16752. var i = arguments[0],
  16753. o = arguments[1];
  16754. return this._depth[i][o] === nf.NULL_VALUE
  16755. }
  16756. }, nf.prototype.normalize = function () {
  16757. for (var t = this, e = 0; e < 2; e++)
  16758. if (!t.isNull(e)) {
  16759. var n = t._depth[e][1];
  16760. t._depth[e][2] < n && (n = t._depth[e][2]), n < 0 && (n = 0);
  16761. for (var r = 1; r < 3; r++) {
  16762. var i = 0;
  16763. t._depth[e][r] > n && (i = 1), t._depth[e][r] = i
  16764. }
  16765. }
  16766. }, nf.prototype.getDelta = function (t) {
  16767. return this._depth[t][Sh.RIGHT] - this._depth[t][Sh.LEFT]
  16768. }, nf.prototype.getLocation = function (t, e) {
  16769. return this._depth[t][e] <= 0 ? pl.EXTERIOR : pl.INTERIOR
  16770. }, nf.prototype.toString = function () {
  16771. return "A: " + this._depth[0][1] + "," + this._depth[0][2] + " B: " + this._depth[1][1] + "," + this._depth[1][2]
  16772. }, nf.prototype.add = function () {
  16773. var t = this;
  16774. if (1 === arguments.length)
  16775. for (var e = arguments[0], n = 0; n < 2; n++)
  16776. for (var r = 1; r < 3; r++) {
  16777. var i = e.getLocation(n, r);
  16778. i !== pl.EXTERIOR && i !== pl.INTERIOR || (t.isNull(n, r) ? t._depth[n][r] = nf.depthAtLocation(i) : t._depth[n][r] += nf.depthAtLocation(i))
  16779. } else if (3 === arguments.length) {
  16780. var o = arguments[0],
  16781. s = arguments[1],
  16782. a = arguments[2];
  16783. a === pl.INTERIOR && this._depth[o][s]++
  16784. }
  16785. }, nf.prototype.interfaces_ = function () {
  16786. return []
  16787. }, nf.prototype.getClass = function () {
  16788. return nf
  16789. }, nf.depthAtLocation = function (t) {
  16790. return t === pl.EXTERIOR ? 0 : t === pl.INTERIOR ? 1 : nf.NULL_VALUE
  16791. }, rf.NULL_VALUE.get = function () {
  16792. return -1
  16793. }, Object.defineProperties(nf, rf);
  16794. var of = function (t) {
  16795. function e() {
  16796. if (t.call(this), this.pts = null, this._env = null, this.eiList = new $p(this), this._name = null, this._mce = null, this._isIsolated = !0, this._depth = new nf, this._depthDelta = 0, 1 === arguments.length) {
  16797. var n = arguments[0];
  16798. e.call(this, n, null)
  16799. } else if (2 === arguments.length) {
  16800. var r = arguments[0],
  16801. i = arguments[1];
  16802. this.pts = r, this._label = i
  16803. }
  16804. }
  16805. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDepth = function () {
  16806. return this._depth
  16807. }, e.prototype.getCollapsedEdge = function () {
  16808. var t = new Array(2).fill(null);
  16809. return t[0] = this.pts[0], t[1] = this.pts[1], new e(t, Dh.toLineLabel(this._label))
  16810. }, e.prototype.isIsolated = function () {
  16811. return this._isIsolated
  16812. }, e.prototype.getCoordinates = function () {
  16813. return this.pts
  16814. }, e.prototype.setIsolated = function (t) {
  16815. this._isIsolated = t
  16816. }, e.prototype.setName = function (t) {
  16817. this._name = t
  16818. }, e.prototype.equals = function (t) {
  16819. if (!(t instanceof e)) return !1;
  16820. var n = t;
  16821. if (this.pts.length !== n.pts.length) return !1;
  16822. for (var r = !0, i = !0, o = this.pts.length, s = 0; s < this.pts.length; s++)
  16823. if (this.pts[s].equals2D(n.pts[s]) || (r = !1), this.pts[s].equals2D(n.pts[--o]) || (i = !1), !r && !i) return !1;
  16824. return !0
  16825. }, e.prototype.getCoordinate = function () {
  16826. if (0 === arguments.length) return this.pts.length > 0 ? this.pts[0] : null;
  16827. if (1 === arguments.length) {
  16828. var t = arguments[0];
  16829. return this.pts[t]
  16830. }
  16831. }, e.prototype.print = function (t) {
  16832. t.print("edge " + this._name + ": "), t.print("LINESTRING (");
  16833. for (var e = 0; e < this.pts.length; e++) e > 0 && t.print(","), t.print(this.pts[e].x + " " + this.pts[e].y);
  16834. t.print(") " + this._label + " " + this._depthDelta)
  16835. }, e.prototype.computeIM = function (t) {
  16836. e.updateIM(this._label, t)
  16837. }, e.prototype.isCollapsed = function () {
  16838. return !!this._label.isArea() && (3 === this.pts.length && !!this.pts[0].equals(this.pts[2]))
  16839. }, e.prototype.isClosed = function () {
  16840. return this.pts[0].equals(this.pts[this.pts.length - 1])
  16841. }, e.prototype.getMaximumSegmentIndex = function () {
  16842. return this.pts.length - 1
  16843. }, e.prototype.getDepthDelta = function () {
  16844. return this._depthDelta
  16845. }, e.prototype.getNumPoints = function () {
  16846. return this.pts.length
  16847. }, e.prototype.printReverse = function (t) {
  16848. t.print("edge " + this._name + ": ");
  16849. for (var e = this.pts.length - 1; e >= 0; e--) t.print(this.pts[e] + " ");
  16850. t.println("")
  16851. }, e.prototype.getMonotoneChainEdge = function () {
  16852. return null === this._mce && (this._mce = new ef(this)), this._mce
  16853. }, e.prototype.getEnvelope = function () {
  16854. if (null === this._env) {
  16855. this._env = new Ll;
  16856. for (var t = 0; t < this.pts.length; t++) this._env.expandToInclude(this.pts[t])
  16857. }
  16858. return this._env
  16859. }, e.prototype.addIntersection = function (t, e, n, r) {
  16860. var i = new ul(t.getIntersection(r)),
  16861. o = e,
  16862. s = t.getEdgeDistance(n, r),
  16863. a = o + 1;
  16864. if (a < this.pts.length) {
  16865. var u = this.pts[a];
  16866. i.equals2D(u) && (o = a, s = 0)
  16867. }
  16868. this.eiList.add(i, o, s)
  16869. }, e.prototype.toString = function () {
  16870. var t = new vl;
  16871. t.append("edge " + this._name + ": "), t.append("LINESTRING (");
  16872. for (var e = 0; e < this.pts.length; e++) e > 0 && t.append(","), t.append(this.pts[e].x + " " + this.pts[e].y);
  16873. return t.append(") " + this._label + " " + this._depthDelta), t.toString()
  16874. }, e.prototype.isPointwiseEqual = function (t) {
  16875. if (this.pts.length !== t.pts.length) return !1;
  16876. for (var e = 0; e < this.pts.length; e++)
  16877. if (!this.pts[e].equals2D(t.pts[e])) return !1;
  16878. return !0
  16879. }, e.prototype.setDepthDelta = function (t) {
  16880. this._depthDelta = t
  16881. }, e.prototype.getEdgeIntersectionList = function () {
  16882. return this.eiList
  16883. }, e.prototype.addIntersections = function (t, e, n) {
  16884. for (var r = 0; r < t.getIntersectionNum(); r++) this.addIntersection(t, e, n, r)
  16885. }, e.prototype.interfaces_ = function () {
  16886. return []
  16887. }, e.prototype.getClass = function () {
  16888. return e
  16889. }, e.updateIM = function () {
  16890. if (2 !== arguments.length) return t.prototype.updateIM.apply(this, arguments);
  16891. var e = arguments[0],
  16892. n = arguments[1];
  16893. n.setAtLeastIfValid(e.getLocation(0, Sh.ON), e.getLocation(1, Sh.ON), 1), e.isArea() && (n.setAtLeastIfValid(e.getLocation(0, Sh.LEFT), e.getLocation(1, Sh.LEFT), 2), n.setAtLeastIfValid(e.getLocation(0, Sh.RIGHT), e.getLocation(1, Sh.RIGHT), 2))
  16894. }, e
  16895. }(qh), sf = function (t) {
  16896. this._workingPrecisionModel = null, this._workingNoder = null, this._geomFact = null, this._graph = null, this._edgeList = new Jp, this._bufParams = t || null
  16897. };
  16898. sf.prototype.setWorkingPrecisionModel = function (t) {
  16899. this._workingPrecisionModel = t
  16900. }, sf.prototype.insertUniqueEdge = function (t) {
  16901. var e = this._edgeList.findEqualEdge(t);
  16902. if (null !== e) {
  16903. var n = e.getLabel(),
  16904. r = t.getLabel();
  16905. e.isPointwiseEqual(t) || (r = new Dh(t.getLabel())).flip(), n.merge(r);
  16906. var i = sf.depthDelta(r),
  16907. o = e.getDepthDelta() + i;
  16908. e.setDepthDelta(o)
  16909. } else this._edgeList.add(t), t.setDepthDelta(sf.depthDelta(t.getLabel()))
  16910. }, sf.prototype.buildSubgraphs = function (t, e) {
  16911. for (var n = new lc, r = t.iterator(); r.hasNext();) {
  16912. var i = r.next(),
  16913. o = i.getRightmostCoordinate(),
  16914. s = new kp(n).getDepth(o);
  16915. i.computeDepth(s), i.findResultEdges(), n.add(i), e.add(i.getDirectedEdges(), i.getNodes())
  16916. }
  16917. }, sf.prototype.createSubgraphs = function (t) {
  16918. for (var e = new lc, n = t.getNodes().iterator(); n.hasNext();) {
  16919. var r = n.next();
  16920. if (!r.isVisited()) {
  16921. var i = new Th;
  16922. i.create(r), e.add(i)
  16923. }
  16924. }
  16925. return np.sort(e, np.reverseOrder()), e
  16926. }, sf.prototype.createEmptyResultGeometry = function () {
  16927. return this._geomFact.createPolygon()
  16928. }, sf.prototype.getNoder = function (t) {
  16929. if (null !== this._workingNoder) return this._workingNoder;
  16930. var e = new Ip,
  16931. n = new jl;
  16932. return n.setPrecisionModel(t), e.setSegmentIntersector(new Kp(n)), e
  16933. }, sf.prototype.buffer = function (t, e) {
  16934. var n = this._workingPrecisionModel;
  16935. null === n && (n = t.getPrecisionModel()), this._geomFact = t.getFactory();
  16936. var r = new Fp(n, this._bufParams),
  16937. i = new zp(t, e, r).getCurves();
  16938. if (i.size() <= 0) return this.createEmptyResultGeometry();
  16939. this.computeNodedEdges(i, n), this._graph = new Hh(new Hp), this._graph.addEdges(this._edgeList.getEdges());
  16940. var o = this.createSubgraphs(this._graph),
  16941. s = new Wh(this._geomFact);
  16942. this.buildSubgraphs(o, s);
  16943. var a = s.getPolygons();
  16944. return a.size() <= 0 ? this.createEmptyResultGeometry() : this._geomFact.buildGeometry(a)
  16945. }, sf.prototype.computeNodedEdges = function (t, e) {
  16946. var n = this.getNoder(e);
  16947. n.computeNodes(t);
  16948. for (var r = n.getNodedSubstrings().iterator(); r.hasNext();) {
  16949. var i = r.next(),
  16950. o = i.getCoordinates();
  16951. if (2 !== o.length || !o[0].equals2D(o[1])) {
  16952. var s = i.getData(),
  16953. a = new of (i.getCoordinates(), new Dh(s));
  16954. this.insertUniqueEdge(a)
  16955. }
  16956. }
  16957. }, sf.prototype.setNoder = function (t) {
  16958. this._workingNoder = t
  16959. }, sf.prototype.interfaces_ = function () {
  16960. return []
  16961. }, sf.prototype.getClass = function () {
  16962. return sf
  16963. }, sf.depthDelta = function (t) {
  16964. var e = t.getLocation(0, Sh.LEFT),
  16965. n = t.getLocation(0, Sh.RIGHT);
  16966. return e === pl.INTERIOR && n === pl.EXTERIOR ? 1 : e === pl.EXTERIOR && n === pl.INTERIOR ? -1 : 0
  16967. }, sf.convertSegStrings = function (t) {
  16968. for (var e = new _h, n = new lc; t.hasNext();) {
  16969. var r = t.next(),
  16970. i = e.createLineString(r.getCoordinates());
  16971. n.add(i)
  16972. }
  16973. return e.buildGeometry(n)
  16974. };
  16975. var af = function () {
  16976. if (this._noder = null, this._scaleFactor = null, this._offsetX = null, this._offsetY = null, this._isScaled = !1, 2 === arguments.length) {
  16977. var t = arguments[0],
  16978. e = arguments[1];
  16979. this._noder = t, this._scaleFactor = e, this._offsetX = 0, this._offsetY = 0, this._isScaled = !this.isIntegerPrecision()
  16980. } else if (4 === arguments.length) {
  16981. var n = arguments[0],
  16982. r = arguments[1],
  16983. i = arguments[2],
  16984. o = arguments[3];
  16985. this._noder = n, this._scaleFactor = r, this._offsetX = i, this._offsetY = o, this._isScaled = !this.isIntegerPrecision()
  16986. }
  16987. };
  16988. af.prototype.rescale = function () {
  16989. var t = this;
  16990. if (gl(arguments[0], ic))
  16991. for (var e = arguments[0], n = e.iterator(); n.hasNext();) {
  16992. var r = n.next();
  16993. t.rescale(r.getCoordinates())
  16994. } else if (arguments[0] instanceof Array) {
  16995. for (var i = arguments[0], o = 0; o < i.length; o++) i[o].x = i[o].x / t._scaleFactor + t._offsetX, i[o].y = i[o].y / t._scaleFactor + t._offsetY;
  16996. 2 === i.length && i[0].equals2D(i[1]) && Pl.out.println(i)
  16997. }
  16998. }, af.prototype.scale = function () {
  16999. var t = this;
  17000. if (gl(arguments[0], ic)) {
  17001. for (var e = arguments[0], n = new lc, r = e.iterator(); r.hasNext();) {
  17002. var i = r.next();
  17003. n.add(new yp(t.scale(i.getCoordinates()), i.getData()))
  17004. }
  17005. return n
  17006. }
  17007. if (arguments[0] instanceof Array) {
  17008. for (var o = arguments[0], s = new Array(o.length).fill(null), a = 0; a < o.length; a++) s[a] = new ul(Math.round((o[a].x - t._offsetX) * t._scaleFactor), Math.round((o[a].y - t._offsetY) * t._scaleFactor), o[a].z);
  17009. var u = pc.removeRepeatedPoints(s);
  17010. return u
  17011. }
  17012. }, af.prototype.isIntegerPrecision = function () {
  17013. return 1 === this._scaleFactor
  17014. }, af.prototype.getNodedSubstrings = function () {
  17015. var t = this._noder.getNodedSubstrings();
  17016. return this._isScaled && this.rescale(t), t
  17017. }, af.prototype.computeNodes = function (t) {
  17018. var e = t;
  17019. this._isScaled && (e = this.scale(t)), this._noder.computeNodes(e)
  17020. }, af.prototype.interfaces_ = function () {
  17021. return [bp]
  17022. }, af.prototype.getClass = function () {
  17023. return af
  17024. };
  17025. var uf = function () {
  17026. this._li = new jl, this._segStrings = null;
  17027. var t = arguments[0];
  17028. this._segStrings = t
  17029. },
  17030. lf = {
  17031. fact: {
  17032. configurable: !0
  17033. }
  17034. };
  17035. uf.prototype.checkEndPtVertexIntersections = function () {
  17036. var t = this;
  17037. if (0 === arguments.length)
  17038. for (var e = this._segStrings.iterator(); e.hasNext();) {
  17039. var n = e.next(),
  17040. r = n.getCoordinates();
  17041. t.checkEndPtVertexIntersections(r[0], t._segStrings), t.checkEndPtVertexIntersections(r[r.length - 1], t._segStrings)
  17042. } else if (2 === arguments.length)
  17043. for (var i = arguments[0], o = arguments[1], s = o.iterator(); s.hasNext();)
  17044. for (var a = s.next(), u = a.getCoordinates(), l = 1; l < u.length - 1; l++)
  17045. if (u[l].equals(i)) throw new kl("found endpt/interior pt intersection at index " + l + " :pt " + i)
  17046. }, uf.prototype.checkInteriorIntersections = function () {
  17047. var t = this;
  17048. if (0 === arguments.length)
  17049. for (var e = this._segStrings.iterator(); e.hasNext();)
  17050. for (var n = e.next(), r = this._segStrings.iterator(); r.hasNext();) {
  17051. var i = r.next();
  17052. t.checkInteriorIntersections(n, i)
  17053. } else if (2 === arguments.length)
  17054. for (var o = arguments[0], s = arguments[1], a = o.getCoordinates(), u = s.getCoordinates(), l = 0; l < a.length - 1; l++)
  17055. for (var c = 0; c < u.length - 1; c++) t.checkInteriorIntersections(o, l, s, c);
  17056. else if (4 === arguments.length) {
  17057. var h = arguments[0],
  17058. p = arguments[1],
  17059. f = arguments[2],
  17060. g = arguments[3];
  17061. if (h === f && p === g) return null;
  17062. var d = h.getCoordinates()[p],
  17063. y = h.getCoordinates()[p + 1],
  17064. v = f.getCoordinates()[g],
  17065. _ = f.getCoordinates()[g + 1];
  17066. if (this._li.computeIntersection(d, y, v, _), this._li.hasIntersection() && (this._li.isProper() || this.hasInteriorIntersection(this._li, d, y) || this.hasInteriorIntersection(this._li, v, _))) throw new kl("found non-noded intersection at " + d + "-" + y + " and " + v + "-" + _)
  17067. }
  17068. }, uf.prototype.checkValid = function () {
  17069. this.checkEndPtVertexIntersections(), this.checkInteriorIntersections(), this.checkCollapses()
  17070. }, uf.prototype.checkCollapses = function () {
  17071. var t = this;
  17072. if (0 === arguments.length)
  17073. for (var e = this._segStrings.iterator(); e.hasNext();) {
  17074. var n = e.next();
  17075. t.checkCollapses(n)
  17076. } else if (1 === arguments.length)
  17077. for (var r = arguments[0], i = r.getCoordinates(), o = 0; o < i.length - 2; o++) t.checkCollapse(i[o], i[o + 1], i[o + 2])
  17078. }, uf.prototype.hasInteriorIntersection = function (t, e, n) {
  17079. for (var r = 0; r < t.getIntersectionNum(); r++) {
  17080. var i = t.getIntersection(r);
  17081. if (!i.equals(e) && !i.equals(n)) return !0
  17082. }
  17083. return !1
  17084. }, uf.prototype.checkCollapse = function (t, e, n) {
  17085. if (t.equals(n)) throw new kl("found non-noded collapse at " + uf.fact.createLineString([t, e, n]))
  17086. }, uf.prototype.interfaces_ = function () {
  17087. return []
  17088. }, uf.prototype.getClass = function () {
  17089. return uf
  17090. }, lf.fact.get = function () {
  17091. return new _h
  17092. }, Object.defineProperties(uf, lf);
  17093. var cf = function () {
  17094. this._li = null, this._pt = null, this._originalPt = null, this._ptScaled = null, this._p0Scaled = null, this._p1Scaled = null, this._scaleFactor = null, this._minx = null, this._maxx = null, this._miny = null, this._maxy = null, this._corner = new Array(4).fill(null), this._safeEnv = null;
  17095. var t = arguments[0],
  17096. e = arguments[1],
  17097. n = arguments[2];
  17098. if (this._originalPt = t, this._pt = t, this._scaleFactor = e, this._li = n, e <= 0) throw new el("Scale factor must be non-zero");
  17099. 1 !== e && (this._pt = new ul(this.scale(t.x), this.scale(t.y)), this._p0Scaled = new ul, this._p1Scaled = new ul), this.initCorners(this._pt)
  17100. },
  17101. hf = {
  17102. SAFE_ENV_EXPANSION_FACTOR: {
  17103. configurable: !0
  17104. }
  17105. };
  17106. cf.prototype.intersectsScaled = function (t, e) {
  17107. var n = Math.min(t.x, e.x),
  17108. r = Math.max(t.x, e.x),
  17109. i = Math.min(t.y, e.y),
  17110. o = Math.max(t.y, e.y),
  17111. s = this._maxx < n || this._minx > r || this._maxy < i || this._miny > o;
  17112. if (s) return !1;
  17113. var a = this.intersectsToleranceSquare(t, e);
  17114. return ql.isTrue(!(s && a), "Found bad envelope test"), a
  17115. }, cf.prototype.initCorners = function (t) {
  17116. var e = .5;
  17117. this._minx = t.x - e, this._maxx = t.x + e, this._miny = t.y - e, this._maxy = t.y + e, this._corner[0] = new ul(this._maxx, this._maxy), this._corner[1] = new ul(this._minx, this._maxy), this._corner[2] = new ul(this._minx, this._miny), this._corner[3] = new ul(this._maxx, this._miny)
  17118. }, cf.prototype.intersects = function (t, e) {
  17119. return 1 === this._scaleFactor ? this.intersectsScaled(t, e) : (this.copyScaled(t, this._p0Scaled), this.copyScaled(e, this._p1Scaled), this.intersectsScaled(this._p0Scaled, this._p1Scaled))
  17120. }, cf.prototype.scale = function (t) {
  17121. return Math.round(t * this._scaleFactor)
  17122. }, cf.prototype.getCoordinate = function () {
  17123. return this._originalPt
  17124. }, cf.prototype.copyScaled = function (t, e) {
  17125. e.x = this.scale(t.x), e.y = this.scale(t.y)
  17126. }, cf.prototype.getSafeEnvelope = function () {
  17127. if (null === this._safeEnv) {
  17128. var t = cf.SAFE_ENV_EXPANSION_FACTOR / this._scaleFactor;
  17129. this._safeEnv = new Ll(this._originalPt.x - t, this._originalPt.x + t, this._originalPt.y - t, this._originalPt.y + t)
  17130. }
  17131. return this._safeEnv
  17132. }, cf.prototype.intersectsPixelClosure = function (t, e) {
  17133. return this._li.computeIntersection(t, e, this._corner[0], this._corner[1]), !!this._li.hasIntersection() || (this._li.computeIntersection(t, e, this._corner[1], this._corner[2]), !!this._li.hasIntersection() || (this._li.computeIntersection(t, e, this._corner[2], this._corner[3]), !!this._li.hasIntersection() || (this._li.computeIntersection(t, e, this._corner[3], this._corner[0]), !!this._li.hasIntersection())))
  17134. }, cf.prototype.intersectsToleranceSquare = function (t, e) {
  17135. var n = !1,
  17136. r = !1;
  17137. return this._li.computeIntersection(t, e, this._corner[0], this._corner[1]), !!this._li.isProper() || (this._li.computeIntersection(t, e, this._corner[1], this._corner[2]), !!this._li.isProper() || (this._li.hasIntersection() && (n = !0), this._li.computeIntersection(t, e, this._corner[2], this._corner[3]), !!this._li.isProper() || (this._li.hasIntersection() && (r = !0), this._li.computeIntersection(t, e, this._corner[3], this._corner[0]), !!this._li.isProper() || (!(!n || !r) || (!!t.equals(this._pt) || !!e.equals(this._pt))))))
  17138. }, cf.prototype.addSnappedNode = function (t, e) {
  17139. var n = t.getCoordinate(e),
  17140. r = t.getCoordinate(e + 1);
  17141. return !!this.intersects(n, r) && (t.addIntersection(this.getCoordinate(), e), !0)
  17142. }, cf.prototype.interfaces_ = function () {
  17143. return []
  17144. }, cf.prototype.getClass = function () {
  17145. return cf
  17146. }, hf.SAFE_ENV_EXPANSION_FACTOR.get = function () {
  17147. return .75
  17148. }, Object.defineProperties(cf, hf);
  17149. var pf = function () {
  17150. this.tempEnv1 = new Ll, this.selectedSegment = new vp
  17151. };
  17152. pf.prototype.select = function () {
  17153. if (1 === arguments.length);
  17154. else if (2 === arguments.length) {
  17155. var t = arguments[0],
  17156. e = arguments[1];
  17157. t.getLineSegment(e, this.selectedSegment), this.select(this.selectedSegment)
  17158. }
  17159. }, pf.prototype.interfaces_ = function () {
  17160. return []
  17161. }, pf.prototype.getClass = function () {
  17162. return pf
  17163. };
  17164. var ff = function () {
  17165. this._index = null;
  17166. var t = arguments[0];
  17167. this._index = t
  17168. },
  17169. gf = {
  17170. HotPixelSnapAction: {
  17171. configurable: !0
  17172. }
  17173. };
  17174. ff.prototype.snap = function () {
  17175. if (1 === arguments.length) {
  17176. var t = arguments[0];
  17177. return this.snap(t, null, -1)
  17178. }
  17179. if (3 === arguments.length) {
  17180. var e = arguments[0],
  17181. n = arguments[1],
  17182. r = arguments[2],
  17183. i = e.getSafeEnvelope(),
  17184. o = new df(e, n, r);
  17185. return this._index.query(i, {
  17186. interfaces_: function () {
  17187. return [Qh]
  17188. },
  17189. visitItem: function (t) {
  17190. t.select(i, o)
  17191. }
  17192. }), o.isNodeAdded()
  17193. }
  17194. }, ff.prototype.interfaces_ = function () {
  17195. return []
  17196. }, ff.prototype.getClass = function () {
  17197. return ff
  17198. }, gf.HotPixelSnapAction.get = function () {
  17199. return df
  17200. }, Object.defineProperties(ff, gf);
  17201. var df = function (t) {
  17202. function e() {
  17203. t.call(this), this._hotPixel = null, this._parentEdge = null, this._hotPixelVertexIndex = null, this._isNodeAdded = !1;
  17204. var e = arguments[0],
  17205. n = arguments[1],
  17206. r = arguments[2];
  17207. this._hotPixel = e, this._parentEdge = n, this._hotPixelVertexIndex = r
  17208. }
  17209. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.isNodeAdded = function () {
  17210. return this._isNodeAdded
  17211. }, e.prototype.select = function () {
  17212. if (2 !== arguments.length) return t.prototype.select.apply(this, arguments);
  17213. var e = arguments[0],
  17214. n = arguments[1],
  17215. r = e.getContext();
  17216. if (null !== this._parentEdge && r === this._parentEdge && n === this._hotPixelVertexIndex) return null;
  17217. this._isNodeAdded = this._hotPixel.addSnappedNode(r, n)
  17218. }, e.prototype.interfaces_ = function () {
  17219. return []
  17220. }, e.prototype.getClass = function () {
  17221. return e
  17222. }, e
  17223. }(pf),
  17224. yf = function () {
  17225. this._li = null, this._interiorIntersections = null;
  17226. var t = arguments[0];
  17227. this._li = t, this._interiorIntersections = new lc
  17228. };
  17229. yf.prototype.processIntersections = function (t, e, n, r) {
  17230. if (t === n && e === r) return null;
  17231. var i = t.getCoordinates()[e],
  17232. o = t.getCoordinates()[e + 1],
  17233. s = n.getCoordinates()[r],
  17234. a = n.getCoordinates()[r + 1];
  17235. if (this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && this._li.isInteriorIntersection()) {
  17236. for (var u = 0; u < this._li.getIntersectionNum(); u++) this._interiorIntersections.add(this._li.getIntersection(u));
  17237. t.addIntersections(this._li, e, 0), n.addIntersections(this._li, r, 1)
  17238. }
  17239. }, yf.prototype.isDone = function () {
  17240. return !1
  17241. }, yf.prototype.getInteriorIntersections = function () {
  17242. return this._interiorIntersections
  17243. }, yf.prototype.interfaces_ = function () {
  17244. return [Zp]
  17245. }, yf.prototype.getClass = function () {
  17246. return yf
  17247. };
  17248. var vf = function () {
  17249. this._pm = null, this._li = null, this._scaleFactor = null, this._noder = null, this._pointSnapper = null, this._nodedSegStrings = null;
  17250. var t = arguments[0];
  17251. this._pm = t, this._li = new jl, this._li.setPrecisionModel(t), this._scaleFactor = t.getScale()
  17252. };
  17253. vf.prototype.checkCorrectness = function (t) {
  17254. var e = yp.getNodedSubstrings(t),
  17255. n = new uf(e);
  17256. try {
  17257. n.checkValid()
  17258. } catch (t) {
  17259. if (!(t instanceof Sl)) throw t;
  17260. t.printStackTrace()
  17261. }
  17262. }, vf.prototype.getNodedSubstrings = function () {
  17263. return yp.getNodedSubstrings(this._nodedSegStrings)
  17264. }, vf.prototype.snapRound = function (t, e) {
  17265. var n = this.findInteriorIntersections(t, e);
  17266. this.computeIntersectionSnaps(n), this.computeVertexSnaps(t)
  17267. }, vf.prototype.findInteriorIntersections = function (t, e) {
  17268. var n = new yf(e);
  17269. return this._noder.setSegmentIntersector(n), this._noder.computeNodes(t), n.getInteriorIntersections()
  17270. }, vf.prototype.computeVertexSnaps = function () {
  17271. var t = this;
  17272. if (gl(arguments[0], ic))
  17273. for (var e = arguments[0], n = e.iterator(); n.hasNext();) {
  17274. var r = n.next();
  17275. t.computeVertexSnaps(r)
  17276. } else if (arguments[0] instanceof yp)
  17277. for (var i = arguments[0], o = i.getCoordinates(), s = 0; s < o.length; s++) {
  17278. var a = new cf(o[s], t._scaleFactor, t._li),
  17279. u = t._pointSnapper.snap(a, i, s);
  17280. u && i.addIntersection(o[s], s)
  17281. }
  17282. }, vf.prototype.computeNodes = function (t) {
  17283. this._nodedSegStrings = t, this._noder = new Ip, this._pointSnapper = new ff(this._noder.getIndex()), this.snapRound(t, this._li)
  17284. }, vf.prototype.computeIntersectionSnaps = function (t) {
  17285. for (var e = this, n = t.iterator(); n.hasNext();) {
  17286. var r = n.next(),
  17287. i = new cf(r, e._scaleFactor, e._li);
  17288. e._pointSnapper.snap(i)
  17289. }
  17290. }, vf.prototype.interfaces_ = function () {
  17291. return [bp]
  17292. }, vf.prototype.getClass = function () {
  17293. return vf
  17294. };
  17295. var _f = function () {
  17296. if (this._argGeom = null, this._distance = null, this._bufParams = new Sp, this._resultGeometry = null, this._saveException = null, 1 === arguments.length) {
  17297. var t = arguments[0];
  17298. this._argGeom = t
  17299. } else if (2 === arguments.length) {
  17300. var e = arguments[0],
  17301. n = arguments[1];
  17302. this._argGeom = e, this._bufParams = n
  17303. }
  17304. },
  17305. mf = {
  17306. CAP_ROUND: {
  17307. configurable: !0
  17308. },
  17309. CAP_BUTT: {
  17310. configurable: !0
  17311. },
  17312. CAP_FLAT: {
  17313. configurable: !0
  17314. },
  17315. CAP_SQUARE: {
  17316. configurable: !0
  17317. },
  17318. MAX_PRECISION_DIGITS: {
  17319. configurable: !0
  17320. }
  17321. };
  17322. _f.prototype.bufferFixedPrecision = function (t) {
  17323. var e = new af(new vf(new gh(1)), t.getScale()),
  17324. n = new sf(this._bufParams);
  17325. n.setWorkingPrecisionModel(t), n.setNoder(e), this._resultGeometry = n.buffer(this._argGeom, this._distance)
  17326. }, _f.prototype.bufferReducedPrecision = function () {
  17327. var t = this;
  17328. if (0 === arguments.length) {
  17329. for (var e = _f.MAX_PRECISION_DIGITS; e >= 0; e--) {
  17330. try {
  17331. t.bufferReducedPrecision(e)
  17332. } catch (e) {
  17333. if (!(e instanceof Oh)) throw e;
  17334. t._saveException = e
  17335. }
  17336. if (null !== t._resultGeometry) return null
  17337. }
  17338. throw this._saveException
  17339. }
  17340. if (1 === arguments.length) {
  17341. var n = arguments[0],
  17342. r = _f.precisionScaleFactor(this._argGeom, this._distance, n),
  17343. i = new gh(r);
  17344. this.bufferFixedPrecision(i)
  17345. }
  17346. }, _f.prototype.computeGeometry = function () {
  17347. if (this.bufferOriginalPrecision(), null !== this._resultGeometry) return null;
  17348. var t = this._argGeom.getFactory().getPrecisionModel();
  17349. t.getType() === gh.FIXED ? this.bufferFixedPrecision(t) : this.bufferReducedPrecision()
  17350. }, _f.prototype.setQuadrantSegments = function (t) {
  17351. this._bufParams.setQuadrantSegments(t)
  17352. }, _f.prototype.bufferOriginalPrecision = function () {
  17353. try {
  17354. var t = new sf(this._bufParams);
  17355. this._resultGeometry = t.buffer(this._argGeom, this._distance)
  17356. } catch (t) {
  17357. if (!(t instanceof kl)) throw t;
  17358. this._saveException = t
  17359. }
  17360. }, _f.prototype.getResultGeometry = function (t) {
  17361. return this._distance = t, this.computeGeometry(), this._resultGeometry
  17362. }, _f.prototype.setEndCapStyle = function (t) {
  17363. this._bufParams.setEndCapStyle(t)
  17364. }, _f.prototype.interfaces_ = function () {
  17365. return []
  17366. }, _f.prototype.getClass = function () {
  17367. return _f
  17368. }, _f.bufferOp = function () {
  17369. if (2 === arguments.length) {
  17370. var t = arguments[0],
  17371. e = arguments[1],
  17372. n = new _f(t),
  17373. r = n.getResultGeometry(e);
  17374. return r
  17375. }
  17376. if (3 === arguments.length) {
  17377. if (Number.isInteger(arguments[2]) && arguments[0] instanceof Wl && "number" == typeof arguments[1]) {
  17378. var i = arguments[0],
  17379. o = arguments[1],
  17380. s = arguments[2],
  17381. a = new _f(i);
  17382. a.setQuadrantSegments(s);
  17383. var u = a.getResultGeometry(o);
  17384. return u
  17385. }
  17386. if (arguments[2] instanceof Sp && arguments[0] instanceof Wl && "number" == typeof arguments[1]) {
  17387. var l = arguments[0],
  17388. c = arguments[1],
  17389. h = arguments[2],
  17390. p = new _f(l, h),
  17391. f = p.getResultGeometry(c);
  17392. return f
  17393. }
  17394. } else if (4 === arguments.length) {
  17395. var g = arguments[0],
  17396. d = arguments[1],
  17397. y = arguments[2],
  17398. v = arguments[3],
  17399. _ = new _f(g);
  17400. _.setQuadrantSegments(y), _.setEndCapStyle(v);
  17401. var m = _.getResultGeometry(d);
  17402. return m
  17403. }
  17404. }, _f.precisionScaleFactor = function (t, e, n) {
  17405. var r = t.getEnvelopeInternal(),
  17406. i = dl.max(Math.abs(r.getMaxX()), Math.abs(r.getMaxY()), Math.abs(r.getMinX()), Math.abs(r.getMinY())) + 2 * (e > 0 ? e : 0),
  17407. o = n - Math.trunc(Math.log(i) / Math.log(10) + 1);
  17408. return Math.pow(10, o)
  17409. }, mf.CAP_ROUND.get = function () {
  17410. return Sp.CAP_ROUND
  17411. }, mf.CAP_BUTT.get = function () {
  17412. return Sp.CAP_FLAT
  17413. }, mf.CAP_FLAT.get = function () {
  17414. return Sp.CAP_FLAT
  17415. }, mf.CAP_SQUARE.get = function () {
  17416. return Sp.CAP_SQUARE
  17417. }, mf.MAX_PRECISION_DIGITS.get = function () {
  17418. return 12
  17419. }, Object.defineProperties(_f, mf);
  17420. var xf = function () {
  17421. this._pt = [new ul, new ul], this._distance = nl.NaN, this._isNull = !0
  17422. };
  17423. xf.prototype.getCoordinates = function () {
  17424. return this._pt
  17425. }, xf.prototype.getCoordinate = function (t) {
  17426. return this._pt[t]
  17427. }, xf.prototype.setMinimum = function () {
  17428. if (1 === arguments.length) {
  17429. var t = arguments[0];
  17430. this.setMinimum(t._pt[0], t._pt[1])
  17431. } else if (2 === arguments.length) {
  17432. var e = arguments[0],
  17433. n = arguments[1];
  17434. if (this._isNull) return this.initialize(e, n), null;
  17435. var r = e.distance(n);
  17436. r < this._distance && this.initialize(e, n, r)
  17437. }
  17438. }, xf.prototype.initialize = function () {
  17439. if (0 === arguments.length) this._isNull = !0;
  17440. else if (2 === arguments.length) {
  17441. var t = arguments[0],
  17442. e = arguments[1];
  17443. this._pt[0].setCoordinate(t), this._pt[1].setCoordinate(e), this._distance = t.distance(e), this._isNull = !1
  17444. } else if (3 === arguments.length) {
  17445. var n = arguments[0],
  17446. r = arguments[1],
  17447. i = arguments[2];
  17448. this._pt[0].setCoordinate(n), this._pt[1].setCoordinate(r), this._distance = i, this._isNull = !1
  17449. }
  17450. }, xf.prototype.getDistance = function () {
  17451. return this._distance
  17452. }, xf.prototype.setMaximum = function () {
  17453. if (1 === arguments.length) {
  17454. var t = arguments[0];
  17455. this.setMaximum(t._pt[0], t._pt[1])
  17456. } else if (2 === arguments.length) {
  17457. var e = arguments[0],
  17458. n = arguments[1];
  17459. if (this._isNull) return this.initialize(e, n), null;
  17460. var r = e.distance(n);
  17461. r > this._distance && this.initialize(e, n, r)
  17462. }
  17463. }, xf.prototype.interfaces_ = function () {
  17464. return []
  17465. }, xf.prototype.getClass = function () {
  17466. return xf
  17467. };
  17468. var Ef = function () {};
  17469. Ef.prototype.interfaces_ = function () {
  17470. return []
  17471. }, Ef.prototype.getClass = function () {
  17472. return Ef
  17473. }, Ef.computeDistance = function () {
  17474. if (arguments[2] instanceof xf && arguments[0] instanceof Zc && arguments[1] instanceof ul)
  17475. for (var t = arguments[0], e = arguments[1], n = arguments[2], r = t.getCoordinates(), i = new vp, o = 0; o < r.length - 1; o++) {
  17476. i.setCoordinates(r[o], r[o + 1]);
  17477. var s = i.closestPoint(e);
  17478. n.setMinimum(s, e)
  17479. } else if (arguments[2] instanceof xf && arguments[0] instanceof th && arguments[1] instanceof ul) {
  17480. var a = arguments[0],
  17481. u = arguments[1],
  17482. l = arguments[2];
  17483. Ef.computeDistance(a.getExteriorRing(), u, l);
  17484. for (var c = 0; c < a.getNumInteriorRing(); c++) Ef.computeDistance(a.getInteriorRingN(c), u, l)
  17485. } else if (arguments[2] instanceof xf && arguments[0] instanceof Wl && arguments[1] instanceof ul) {
  17486. var h = arguments[0],
  17487. p = arguments[1],
  17488. f = arguments[2];
  17489. if (h instanceof Zc) Ef.computeDistance(h, p, f);
  17490. else if (h instanceof th) Ef.computeDistance(h, p, f);
  17491. else if (h instanceof kc)
  17492. for (var g = h, d = 0; d < g.getNumGeometries(); d++) {
  17493. var y = g.getGeometryN(d);
  17494. Ef.computeDistance(y, p, f)
  17495. } else f.setMinimum(h.getCoordinate(), p)
  17496. } else if (arguments[2] instanceof xf && arguments[0] instanceof vp && arguments[1] instanceof ul) {
  17497. var v = arguments[0],
  17498. _ = arguments[1],
  17499. m = arguments[2],
  17500. x = v.closestPoint(_);
  17501. m.setMinimum(x, _)
  17502. }
  17503. };
  17504. var bf = function (t) {
  17505. this._maxPtDist = new xf, this._inputGeom = t || null
  17506. },
  17507. wf = {
  17508. MaxPointDistanceFilter: {
  17509. configurable: !0
  17510. },
  17511. MaxMidpointDistanceFilter: {
  17512. configurable: !0
  17513. }
  17514. };
  17515. bf.prototype.computeMaxMidpointDistance = function (t) {
  17516. var e = new Nf(this._inputGeom);
  17517. t.apply(e), this._maxPtDist.setMaximum(e.getMaxPointDistance())
  17518. }, bf.prototype.computeMaxVertexDistance = function (t) {
  17519. var e = new If(this._inputGeom);
  17520. t.apply(e), this._maxPtDist.setMaximum(e.getMaxPointDistance())
  17521. }, bf.prototype.findDistance = function (t) {
  17522. return this.computeMaxVertexDistance(t), this.computeMaxMidpointDistance(t), this._maxPtDist.getDistance()
  17523. }, bf.prototype.getDistancePoints = function () {
  17524. return this._maxPtDist
  17525. }, bf.prototype.interfaces_ = function () {
  17526. return []
  17527. }, bf.prototype.getClass = function () {
  17528. return bf
  17529. }, wf.MaxPointDistanceFilter.get = function () {
  17530. return If
  17531. }, wf.MaxMidpointDistanceFilter.get = function () {
  17532. return Nf
  17533. }, Object.defineProperties(bf, wf);
  17534. var If = function (t) {
  17535. this._maxPtDist = new xf, this._minPtDist = new xf, this._geom = t || null
  17536. };
  17537. If.prototype.filter = function (t) {
  17538. this._minPtDist.initialize(), Ef.computeDistance(this._geom, t, this._minPtDist), this._maxPtDist.setMaximum(this._minPtDist)
  17539. }, If.prototype.getMaxPointDistance = function () {
  17540. return this._maxPtDist
  17541. }, If.prototype.interfaces_ = function () {
  17542. return [Kl]
  17543. }, If.prototype.getClass = function () {
  17544. return If
  17545. };
  17546. var Nf = function (t) {
  17547. this._maxPtDist = new xf, this._minPtDist = new xf, this._geom = t || null
  17548. };
  17549. Nf.prototype.filter = function (t, e) {
  17550. if (0 === e) return null;
  17551. var n = t.getCoordinate(e - 1),
  17552. r = t.getCoordinate(e),
  17553. i = new ul((n.x + r.x) / 2, (n.y + r.y) / 2);
  17554. this._minPtDist.initialize(), Ef.computeDistance(this._geom, i, this._minPtDist), this._maxPtDist.setMaximum(this._minPtDist)
  17555. }, Nf.prototype.isDone = function () {
  17556. return !1
  17557. }, Nf.prototype.isGeometryChanged = function () {
  17558. return !1
  17559. }, Nf.prototype.getMaxPointDistance = function () {
  17560. return this._maxPtDist
  17561. }, Nf.prototype.interfaces_ = function () {
  17562. return [Fc]
  17563. }, Nf.prototype.getClass = function () {
  17564. return Nf
  17565. };
  17566. var Sf = function (t) {
  17567. this._comps = t || null
  17568. };
  17569. Sf.prototype.filter = function (t) {
  17570. t instanceof th && this._comps.add(t)
  17571. }, Sf.prototype.interfaces_ = function () {
  17572. return [Dc]
  17573. }, Sf.prototype.getClass = function () {
  17574. return Sf
  17575. }, Sf.getPolygons = function () {
  17576. if (1 === arguments.length) {
  17577. var t = arguments[0];
  17578. return Sf.getPolygons(t, new lc)
  17579. }
  17580. if (2 === arguments.length) {
  17581. var e = arguments[0],
  17582. n = arguments[1];
  17583. return e instanceof th ? n.add(e) : e instanceof kc && e.apply(new Sf(n)), n
  17584. }
  17585. };
  17586. var Cf = function () {
  17587. if (this._lines = null, this._isForcedToLineString = !1, 1 === arguments.length) {
  17588. var t = arguments[0];
  17589. this._lines = t
  17590. } else if (2 === arguments.length) {
  17591. var e = arguments[0],
  17592. n = arguments[1];
  17593. this._lines = e, this._isForcedToLineString = n
  17594. }
  17595. };
  17596. Cf.prototype.filter = function (t) {
  17597. if (this._isForcedToLineString && t instanceof nh) {
  17598. var e = t.getFactory().createLineString(t.getCoordinateSequence());
  17599. return this._lines.add(e), null
  17600. }
  17601. t instanceof Zc && this._lines.add(t)
  17602. }, Cf.prototype.setForceToLineString = function (t) {
  17603. this._isForcedToLineString = t
  17604. }, Cf.prototype.interfaces_ = function () {
  17605. return [Hl]
  17606. }, Cf.prototype.getClass = function () {
  17607. return Cf
  17608. }, Cf.getGeometry = function () {
  17609. if (1 === arguments.length) {
  17610. var t = arguments[0];
  17611. return t.getFactory().buildGeometry(Cf.getLines(t))
  17612. }
  17613. if (2 === arguments.length) {
  17614. var e = arguments[0],
  17615. n = arguments[1];
  17616. return e.getFactory().buildGeometry(Cf.getLines(e, n))
  17617. }
  17618. }, Cf.getLines = function () {
  17619. if (1 === arguments.length) {
  17620. var t = arguments[0];
  17621. return Cf.getLines(t, !1)
  17622. }
  17623. if (2 === arguments.length) {
  17624. if (gl(arguments[0], ic) && gl(arguments[1], ic)) {
  17625. for (var e = arguments[0], n = arguments[1], r = e.iterator(); r.hasNext();) {
  17626. var i = r.next();
  17627. Cf.getLines(i, n)
  17628. }
  17629. return n
  17630. }
  17631. if (arguments[0] instanceof Wl && "boolean" == typeof arguments[1]) {
  17632. var o = arguments[0],
  17633. s = arguments[1],
  17634. a = new lc;
  17635. return o.apply(new Cf(a, s)), a
  17636. }
  17637. if (arguments[0] instanceof Wl && gl(arguments[1], ic)) {
  17638. var u = arguments[0],
  17639. l = arguments[1];
  17640. return u instanceof Zc ? l.add(u) : u.apply(new Cf(l)), l
  17641. }
  17642. } else if (3 === arguments.length) {
  17643. if ("boolean" == typeof arguments[2] && gl(arguments[0], ic) && gl(arguments[1], ic)) {
  17644. for (var c = arguments[0], h = arguments[1], p = arguments[2], f = c.iterator(); f.hasNext();) {
  17645. var g = f.next();
  17646. Cf.getLines(g, h, p)
  17647. }
  17648. return h
  17649. }
  17650. if ("boolean" == typeof arguments[2] && arguments[0] instanceof Wl && gl(arguments[1], ic)) {
  17651. var d = arguments[0],
  17652. y = arguments[1],
  17653. v = arguments[2];
  17654. return d.apply(new Cf(y, v)), y
  17655. }
  17656. }
  17657. };
  17658. var Pf = function () {
  17659. if (this._boundaryRule = Ql.OGC_SFS_BOUNDARY_RULE, this._isIn = null, this._numBoundaries = null, 0 === arguments.length);
  17660. else if (1 === arguments.length) {
  17661. var t = arguments[0];
  17662. if (null === t) throw new el("Rule must be non-null");
  17663. this._boundaryRule = t
  17664. }
  17665. };
  17666. Pf.prototype.locateInternal = function () {
  17667. var t = this;
  17668. if (arguments[0] instanceof ul && arguments[1] instanceof th) {
  17669. var e = arguments[0],
  17670. n = arguments[1];
  17671. if (n.isEmpty()) return pl.EXTERIOR;
  17672. var r = n.getExteriorRing(),
  17673. i = this.locateInPolygonRing(e, r);
  17674. if (i === pl.EXTERIOR) return pl.EXTERIOR;
  17675. if (i === pl.BOUNDARY) return pl.BOUNDARY;
  17676. for (var o = 0; o < n.getNumInteriorRing(); o++) {
  17677. var s = n.getInteriorRingN(o),
  17678. a = t.locateInPolygonRing(e, s);
  17679. if (a === pl.INTERIOR) return pl.EXTERIOR;
  17680. if (a === pl.BOUNDARY) return pl.BOUNDARY
  17681. }
  17682. return pl.INTERIOR
  17683. }
  17684. if (arguments[0] instanceof ul && arguments[1] instanceof Zc) {
  17685. var u = arguments[0],
  17686. l = arguments[1];
  17687. if (!l.getEnvelopeInternal().intersects(u)) return pl.EXTERIOR;
  17688. var c = l.getCoordinates();
  17689. return l.isClosed() || !u.equals(c[0]) && !u.equals(c[c.length - 1]) ? Xl.isOnLine(u, c) ? pl.INTERIOR : pl.EXTERIOR : pl.BOUNDARY
  17690. }
  17691. if (arguments[0] instanceof ul && arguments[1] instanceof Qc) {
  17692. var h = arguments[0],
  17693. p = arguments[1],
  17694. f = p.getCoordinate();
  17695. return f.equals2D(h) ? pl.INTERIOR : pl.EXTERIOR
  17696. }
  17697. }, Pf.prototype.locateInPolygonRing = function (t, e) {
  17698. return e.getEnvelopeInternal().intersects(t) ? Xl.locatePointInRing(t, e.getCoordinates()) : pl.EXTERIOR
  17699. }, Pf.prototype.intersects = function (t, e) {
  17700. return this.locate(t, e) !== pl.EXTERIOR
  17701. }, Pf.prototype.updateLocationInfo = function (t) {
  17702. t === pl.INTERIOR && (this._isIn = !0), t === pl.BOUNDARY && this._numBoundaries++
  17703. }, Pf.prototype.computeLocation = function (t, e) {
  17704. var n = this;
  17705. if (e instanceof Qc && this.updateLocationInfo(this.locateInternal(t, e)), e instanceof Zc) this.updateLocationInfo(this.locateInternal(t, e));
  17706. else if (e instanceof th) this.updateLocationInfo(this.locateInternal(t, e));
  17707. else if (e instanceof Gc)
  17708. for (var r = e, i = 0; i < r.getNumGeometries(); i++) {
  17709. var o = r.getGeometryN(i);
  17710. n.updateLocationInfo(n.locateInternal(t, o))
  17711. } else if (e instanceof rh)
  17712. for (var s = e, a = 0; a < s.getNumGeometries(); a++) {
  17713. var u = s.getGeometryN(a);
  17714. n.updateLocationInfo(n.locateInternal(t, u))
  17715. } else if (e instanceof kc)
  17716. for (var l = new Up(e); l.hasNext();) {
  17717. var c = l.next();
  17718. c !== e && n.computeLocation(t, c)
  17719. }
  17720. }, Pf.prototype.locate = function (t, e) {
  17721. return e.isEmpty() ? pl.EXTERIOR : e instanceof Zc || e instanceof th ? this.locateInternal(t, e) : (this._isIn = !1, this._numBoundaries = 0, this.computeLocation(t, e), this._boundaryRule.isInBoundary(this._numBoundaries) ? pl.BOUNDARY : this._numBoundaries > 0 || this._isIn ? pl.INTERIOR : pl.EXTERIOR)
  17722. }, Pf.prototype.interfaces_ = function () {
  17723. return []
  17724. }, Pf.prototype.getClass = function () {
  17725. return Pf
  17726. };
  17727. var Mf = function t() {
  17728. if (this._component = null, this._segIndex = null, this._pt = null, 2 === arguments.length) {
  17729. var e = arguments[0],
  17730. n = arguments[1];
  17731. t.call(this, e, t.INSIDE_AREA, n)
  17732. } else if (3 === arguments.length) {
  17733. var r = arguments[0],
  17734. i = arguments[1],
  17735. o = arguments[2];
  17736. this._component = r, this._segIndex = i, this._pt = o
  17737. }
  17738. },
  17739. Lf = {
  17740. INSIDE_AREA: {
  17741. configurable: !0
  17742. }
  17743. };
  17744. Mf.prototype.isInsideArea = function () {
  17745. return this._segIndex === Mf.INSIDE_AREA
  17746. }, Mf.prototype.getCoordinate = function () {
  17747. return this._pt
  17748. }, Mf.prototype.getGeometryComponent = function () {
  17749. return this._component
  17750. }, Mf.prototype.getSegmentIndex = function () {
  17751. return this._segIndex
  17752. }, Mf.prototype.interfaces_ = function () {
  17753. return []
  17754. }, Mf.prototype.getClass = function () {
  17755. return Mf
  17756. }, Lf.INSIDE_AREA.get = function () {
  17757. return -1
  17758. }, Object.defineProperties(Mf, Lf);
  17759. var Of = function (t) {
  17760. this._pts = t || null
  17761. };
  17762. Of.prototype.filter = function (t) {
  17763. t instanceof Qc && this._pts.add(t)
  17764. }, Of.prototype.interfaces_ = function () {
  17765. return [Dc]
  17766. }, Of.prototype.getClass = function () {
  17767. return Of
  17768. }, Of.getPoints = function () {
  17769. if (1 === arguments.length) {
  17770. var t = arguments[0];
  17771. return t instanceof Qc ? np.singletonList(t) : Of.getPoints(t, new lc)
  17772. }
  17773. if (2 === arguments.length) {
  17774. var e = arguments[0],
  17775. n = arguments[1];
  17776. return e instanceof Qc ? n.add(e) : e instanceof kc && e.apply(new Of(n)), n
  17777. }
  17778. };
  17779. var Rf = function () {
  17780. this._locations = null;
  17781. var t = arguments[0];
  17782. this._locations = t
  17783. };
  17784. Rf.prototype.filter = function (t) {
  17785. (t instanceof Qc || t instanceof Zc || t instanceof th) && this._locations.add(new Mf(t, 0, t.getCoordinate()))
  17786. }, Rf.prototype.interfaces_ = function () {
  17787. return [Dc]
  17788. }, Rf.prototype.getClass = function () {
  17789. return Rf
  17790. }, Rf.getLocations = function (t) {
  17791. var e = new lc;
  17792. return t.apply(new Rf(e)), e
  17793. };
  17794. var Tf = function () {
  17795. if (this._geom = null, this._terminateDistance = 0, this._ptLocator = new Pf, this._minDistanceLocation = null, this._minDistance = nl.MAX_VALUE, 2 === arguments.length) {
  17796. var t = arguments[0],
  17797. e = arguments[1];
  17798. this._geom = [t, e], this._terminateDistance = 0
  17799. } else if (3 === arguments.length) {
  17800. var n = arguments[0],
  17801. r = arguments[1],
  17802. i = arguments[2];
  17803. this._geom = new Array(2).fill(null), this._geom[0] = n, this._geom[1] = r, this._terminateDistance = i
  17804. }
  17805. };
  17806. Tf.prototype.computeContainmentDistance = function () {
  17807. var t = this;
  17808. if (0 === arguments.length) {
  17809. var e = new Array(2).fill(null);
  17810. if (this.computeContainmentDistance(0, e), this._minDistance <= this._terminateDistance) return null;
  17811. this.computeContainmentDistance(1, e)
  17812. } else if (2 === arguments.length) {
  17813. var n = arguments[0],
  17814. r = arguments[1],
  17815. i = 1 - n,
  17816. o = Sf.getPolygons(this._geom[n]);
  17817. if (o.size() > 0) {
  17818. var s = Rf.getLocations(this._geom[i]);
  17819. if (this.computeContainmentDistance(s, o, r), this._minDistance <= this._terminateDistance) return this._minDistanceLocation[i] = r[0], this._minDistanceLocation[n] = r[1], null
  17820. }
  17821. } else if (3 === arguments.length)
  17822. if (arguments[2] instanceof Array && gl(arguments[0], ac) && gl(arguments[1], ac)) {
  17823. for (var a = arguments[0], u = arguments[1], l = arguments[2], c = 0; c < a.size(); c++)
  17824. for (var h = a.get(c), p = 0; p < u.size(); p++)
  17825. if (t.computeContainmentDistance(h, u.get(p), l), t._minDistance <= t._terminateDistance) return null
  17826. } else if (arguments[2] instanceof Array && arguments[0] instanceof Mf && arguments[1] instanceof th) {
  17827. var f = arguments[0],
  17828. g = arguments[1],
  17829. d = arguments[2],
  17830. y = f.getCoordinate();
  17831. if (pl.EXTERIOR !== this._ptLocator.locate(y, g)) return this._minDistance = 0, d[0] = f, d[1] = new Mf(g, y), null
  17832. }
  17833. }, Tf.prototype.computeMinDistanceLinesPoints = function (t, e, n) {
  17834. for (var r = this, i = 0; i < t.size(); i++)
  17835. for (var o = t.get(i), s = 0; s < e.size(); s++) {
  17836. var a = e.get(s);
  17837. if (r.computeMinDistance(o, a, n), r._minDistance <= r._terminateDistance) return null
  17838. }
  17839. }, Tf.prototype.computeFacetDistance = function () {
  17840. var t = new Array(2).fill(null),
  17841. e = Cf.getLines(this._geom[0]),
  17842. n = Cf.getLines(this._geom[1]),
  17843. r = Of.getPoints(this._geom[0]),
  17844. i = Of.getPoints(this._geom[1]);
  17845. return this.computeMinDistanceLines(e, n, t), this.updateMinDistance(t, !1), this._minDistance <= this._terminateDistance ? null : (t[0] = null, t[1] = null, this.computeMinDistanceLinesPoints(e, i, t), this.updateMinDistance(t, !1), this._minDistance <= this._terminateDistance ? null : (t[0] = null, t[1] = null, this.computeMinDistanceLinesPoints(n, r, t), this.updateMinDistance(t, !0), this._minDistance <= this._terminateDistance ? null : (t[0] = null, t[1] = null, this.computeMinDistancePoints(r, i, t), void this.updateMinDistance(t, !1))))
  17846. }, Tf.prototype.nearestLocations = function () {
  17847. return this.computeMinDistance(), this._minDistanceLocation
  17848. }, Tf.prototype.updateMinDistance = function (t, e) {
  17849. if (null === t[0]) return null;
  17850. e ? (this._minDistanceLocation[0] = t[1], this._minDistanceLocation[1] = t[0]) : (this._minDistanceLocation[0] = t[0], this._minDistanceLocation[1] = t[1])
  17851. }, Tf.prototype.nearestPoints = function () {
  17852. return this.computeMinDistance(), [this._minDistanceLocation[0].getCoordinate(), this._minDistanceLocation[1].getCoordinate()]
  17853. }, Tf.prototype.computeMinDistance = function () {
  17854. var t = this;
  17855. if (0 === arguments.length) {
  17856. if (null !== this._minDistanceLocation) return null;
  17857. if (this._minDistanceLocation = new Array(2).fill(null), this.computeContainmentDistance(), this._minDistance <= this._terminateDistance) return null;
  17858. this.computeFacetDistance()
  17859. } else if (3 === arguments.length)
  17860. if (arguments[2] instanceof Array && arguments[0] instanceof Zc && arguments[1] instanceof Qc) {
  17861. var e = arguments[0],
  17862. n = arguments[1],
  17863. r = arguments[2];
  17864. if (e.getEnvelopeInternal().distance(n.getEnvelopeInternal()) > this._minDistance) return null;
  17865. for (var i = e.getCoordinates(), o = n.getCoordinate(), s = 0; s < i.length - 1; s++) {
  17866. var a = Xl.distancePointLine(o, i[s], i[s + 1]);
  17867. if (a < t._minDistance) {
  17868. t._minDistance = a;
  17869. var u = new vp(i[s], i[s + 1]),
  17870. l = u.closestPoint(o);
  17871. r[0] = new Mf(e, s, l), r[1] = new Mf(n, 0, o)
  17872. }
  17873. if (t._minDistance <= t._terminateDistance) return null
  17874. }
  17875. } else if (arguments[2] instanceof Array && arguments[0] instanceof Zc && arguments[1] instanceof Zc) {
  17876. var c = arguments[0],
  17877. h = arguments[1],
  17878. p = arguments[2];
  17879. if (c.getEnvelopeInternal().distance(h.getEnvelopeInternal()) > this._minDistance) return null;
  17880. for (var f = c.getCoordinates(), g = h.getCoordinates(), d = 0; d < f.length - 1; d++)
  17881. for (var y = 0; y < g.length - 1; y++) {
  17882. var v = Xl.distanceLineLine(f[d], f[d + 1], g[y], g[y + 1]);
  17883. if (v < t._minDistance) {
  17884. t._minDistance = v;
  17885. var _ = new vp(f[d], f[d + 1]),
  17886. m = new vp(g[y], g[y + 1]),
  17887. x = _.closestPoints(m);
  17888. p[0] = new Mf(c, d, x[0]), p[1] = new Mf(h, y, x[1])
  17889. }
  17890. if (t._minDistance <= t._terminateDistance) return null
  17891. }
  17892. }
  17893. }, Tf.prototype.computeMinDistancePoints = function (t, e, n) {
  17894. for (var r = this, i = 0; i < t.size(); i++)
  17895. for (var o = t.get(i), s = 0; s < e.size(); s++) {
  17896. var a = e.get(s),
  17897. u = o.getCoordinate().distance(a.getCoordinate());
  17898. if (u < r._minDistance && (r._minDistance = u, n[0] = new Mf(o, 0, o.getCoordinate()), n[1] = new Mf(a, 0, a.getCoordinate())), r._minDistance <= r._terminateDistance) return null
  17899. }
  17900. }, Tf.prototype.distance = function () {
  17901. if (null === this._geom[0] || null === this._geom[1]) throw new el("null geometries are not supported");
  17902. return this._geom[0].isEmpty() || this._geom[1].isEmpty() ? 0 : (this.computeMinDistance(), this._minDistance)
  17903. }, Tf.prototype.computeMinDistanceLines = function (t, e, n) {
  17904. for (var r = this, i = 0; i < t.size(); i++)
  17905. for (var o = t.get(i), s = 0; s < e.size(); s++) {
  17906. var a = e.get(s);
  17907. if (r.computeMinDistance(o, a, n), r._minDistance <= r._terminateDistance) return null
  17908. }
  17909. }, Tf.prototype.interfaces_ = function () {
  17910. return []
  17911. }, Tf.prototype.getClass = function () {
  17912. return Tf
  17913. }, Tf.distance = function (t, e) {
  17914. return new Tf(t, e).distance()
  17915. }, Tf.isWithinDistance = function (t, e, n) {
  17916. return new Tf(t, e, n).distance() <= n
  17917. }, Tf.nearestPoints = function (t, e) {
  17918. return new Tf(t, e).nearestPoints()
  17919. };
  17920. var Af = function () {
  17921. this._pt = [new ul, new ul], this._distance = nl.NaN, this._isNull = !0
  17922. };
  17923. Af.prototype.getCoordinates = function () {
  17924. return this._pt
  17925. }, Af.prototype.getCoordinate = function (t) {
  17926. return this._pt[t]
  17927. }, Af.prototype.setMinimum = function () {
  17928. if (1 === arguments.length) {
  17929. var t = arguments[0];
  17930. this.setMinimum(t._pt[0], t._pt[1])
  17931. } else if (2 === arguments.length) {
  17932. var e = arguments[0],
  17933. n = arguments[1];
  17934. if (this._isNull) return this.initialize(e, n), null;
  17935. var r = e.distance(n);
  17936. r < this._distance && this.initialize(e, n, r)
  17937. }
  17938. }, Af.prototype.initialize = function () {
  17939. if (0 === arguments.length) this._isNull = !0;
  17940. else if (2 === arguments.length) {
  17941. var t = arguments[0],
  17942. e = arguments[1];
  17943. this._pt[0].setCoordinate(t), this._pt[1].setCoordinate(e), this._distance = t.distance(e), this._isNull = !1
  17944. } else if (3 === arguments.length) {
  17945. var n = arguments[0],
  17946. r = arguments[1],
  17947. i = arguments[2];
  17948. this._pt[0].setCoordinate(n), this._pt[1].setCoordinate(r), this._distance = i, this._isNull = !1
  17949. }
  17950. }, Af.prototype.toString = function () {
  17951. return Fl.toLineString(this._pt[0], this._pt[1])
  17952. }, Af.prototype.getDistance = function () {
  17953. return this._distance
  17954. }, Af.prototype.setMaximum = function () {
  17955. if (1 === arguments.length) {
  17956. var t = arguments[0];
  17957. this.setMaximum(t._pt[0], t._pt[1])
  17958. } else if (2 === arguments.length) {
  17959. var e = arguments[0],
  17960. n = arguments[1];
  17961. if (this._isNull) return this.initialize(e, n), null;
  17962. var r = e.distance(n);
  17963. r > this._distance && this.initialize(e, n, r)
  17964. }
  17965. }, Af.prototype.interfaces_ = function () {
  17966. return []
  17967. }, Af.prototype.getClass = function () {
  17968. return Af
  17969. };
  17970. var Df = function () {};
  17971. Df.prototype.interfaces_ = function () {
  17972. return []
  17973. }, Df.prototype.getClass = function () {
  17974. return Df
  17975. }, Df.computeDistance = function () {
  17976. if (arguments[2] instanceof Af && arguments[0] instanceof Zc && arguments[1] instanceof ul)
  17977. for (var t = arguments[0], e = arguments[1], n = arguments[2], r = new vp, i = t.getCoordinates(), o = 0; o < i.length - 1; o++) {
  17978. r.setCoordinates(i[o], i[o + 1]);
  17979. var s = r.closestPoint(e);
  17980. n.setMinimum(s, e)
  17981. } else if (arguments[2] instanceof Af && arguments[0] instanceof th && arguments[1] instanceof ul) {
  17982. var a = arguments[0],
  17983. u = arguments[1],
  17984. l = arguments[2];
  17985. Df.computeDistance(a.getExteriorRing(), u, l);
  17986. for (var c = 0; c < a.getNumInteriorRing(); c++) Df.computeDistance(a.getInteriorRingN(c), u, l)
  17987. } else if (arguments[2] instanceof Af && arguments[0] instanceof Wl && arguments[1] instanceof ul) {
  17988. var h = arguments[0],
  17989. p = arguments[1],
  17990. f = arguments[2];
  17991. if (h instanceof Zc) Df.computeDistance(h, p, f);
  17992. else if (h instanceof th) Df.computeDistance(h, p, f);
  17993. else if (h instanceof kc)
  17994. for (var g = h, d = 0; d < g.getNumGeometries(); d++) {
  17995. var y = g.getGeometryN(d);
  17996. Df.computeDistance(y, p, f)
  17997. } else f.setMinimum(h.getCoordinate(), p)
  17998. } else if (arguments[2] instanceof Af && arguments[0] instanceof vp && arguments[1] instanceof ul) {
  17999. var v = arguments[0],
  18000. _ = arguments[1],
  18001. m = arguments[2],
  18002. x = v.closestPoint(_);
  18003. m.setMinimum(x, _)
  18004. }
  18005. };
  18006. var Ff = function () {
  18007. this._g0 = null, this._g1 = null, this._ptDist = new Af, this._densifyFrac = 0;
  18008. var t = arguments[0],
  18009. e = arguments[1];
  18010. this._g0 = t, this._g1 = e
  18011. },
  18012. kf = {
  18013. MaxPointDistanceFilter: {
  18014. configurable: !0
  18015. },
  18016. MaxDensifiedByFractionDistanceFilter: {
  18017. configurable: !0
  18018. }
  18019. };
  18020. Ff.prototype.getCoordinates = function () {
  18021. return this._ptDist.getCoordinates()
  18022. }, Ff.prototype.setDensifyFraction = function (t) {
  18023. if (t > 1 || t <= 0) throw new el("Fraction is not in range (0.0 - 1.0]");
  18024. this._densifyFrac = t
  18025. }, Ff.prototype.compute = function (t, e) {
  18026. this.computeOrientedDistance(t, e, this._ptDist), this.computeOrientedDistance(e, t, this._ptDist)
  18027. }, Ff.prototype.distance = function () {
  18028. return this.compute(this._g0, this._g1), this._ptDist.getDistance()
  18029. }, Ff.prototype.computeOrientedDistance = function (t, e, n) {
  18030. var r = new Gf(e);
  18031. if (t.apply(r), n.setMaximum(r.getMaxPointDistance()), this._densifyFrac > 0) {
  18032. var i = new qf(e, this._densifyFrac);
  18033. t.apply(i), n.setMaximum(i.getMaxPointDistance())
  18034. }
  18035. }, Ff.prototype.orientedDistance = function () {
  18036. return this.computeOrientedDistance(this._g0, this._g1, this._ptDist), this._ptDist.getDistance()
  18037. }, Ff.prototype.interfaces_ = function () {
  18038. return []
  18039. }, Ff.prototype.getClass = function () {
  18040. return Ff
  18041. }, Ff.distance = function () {
  18042. if (2 === arguments.length) {
  18043. var t = arguments[0],
  18044. e = arguments[1],
  18045. n = new Ff(t, e);
  18046. return n.distance()
  18047. }
  18048. if (3 === arguments.length) {
  18049. var r = arguments[0],
  18050. i = arguments[1],
  18051. o = arguments[2],
  18052. s = new Ff(r, i);
  18053. return s.setDensifyFraction(o), s.distance()
  18054. }
  18055. }, kf.MaxPointDistanceFilter.get = function () {
  18056. return Gf
  18057. }, kf.MaxDensifiedByFractionDistanceFilter.get = function () {
  18058. return qf
  18059. }, Object.defineProperties(Ff, kf);
  18060. var Gf = function () {
  18061. this._maxPtDist = new Af, this._minPtDist = new Af, this._euclideanDist = new Df, this._geom = null;
  18062. var t = arguments[0];
  18063. this._geom = t
  18064. };
  18065. Gf.prototype.filter = function (t) {
  18066. this._minPtDist.initialize(), Df.computeDistance(this._geom, t, this._minPtDist), this._maxPtDist.setMaximum(this._minPtDist)
  18067. }, Gf.prototype.getMaxPointDistance = function () {
  18068. return this._maxPtDist
  18069. }, Gf.prototype.interfaces_ = function () {
  18070. return [Kl]
  18071. }, Gf.prototype.getClass = function () {
  18072. return Gf
  18073. };
  18074. var qf = function () {
  18075. this._maxPtDist = new Af, this._minPtDist = new Af, this._geom = null, this._numSubSegs = 0;
  18076. var t = arguments[0],
  18077. e = arguments[1];
  18078. this._geom = t, this._numSubSegs = Math.trunc(Math.round(1 / e))
  18079. };
  18080. qf.prototype.filter = function (t, e) {
  18081. var n = this;
  18082. if (0 === e) return null;
  18083. for (var r = t.getCoordinate(e - 1), i = t.getCoordinate(e), o = (i.x - r.x) / this._numSubSegs, s = (i.y - r.y) / this._numSubSegs, a = 0; a < this._numSubSegs; a++) {
  18084. var u = r.x + a * o,
  18085. l = r.y + a * s,
  18086. c = new ul(u, l);
  18087. n._minPtDist.initialize(), Df.computeDistance(n._geom, c, n._minPtDist), n._maxPtDist.setMaximum(n._minPtDist)
  18088. }
  18089. }, qf.prototype.isDone = function () {
  18090. return !1
  18091. }, qf.prototype.isGeometryChanged = function () {
  18092. return !1
  18093. }, qf.prototype.getMaxPointDistance = function () {
  18094. return this._maxPtDist
  18095. }, qf.prototype.interfaces_ = function () {
  18096. return [Fc]
  18097. }, qf.prototype.getClass = function () {
  18098. return qf
  18099. };
  18100. var Bf = function (t, e, n) {
  18101. this._minValidDistance = null, this._maxValidDistance = null, this._minDistanceFound = null, this._maxDistanceFound = null, this._isValid = !0, this._errMsg = null, this._errorLocation = null, this._errorIndicator = null, this._input = t || null, this._bufDistance = e || null, this._result = n || null
  18102. },
  18103. zf = {
  18104. VERBOSE: {
  18105. configurable: !0
  18106. },
  18107. MAX_DISTANCE_DIFF_FRAC: {
  18108. configurable: !0
  18109. }
  18110. };
  18111. Bf.prototype.checkMaximumDistance = function (t, e, n) {
  18112. var r = new Ff(e, t);
  18113. if (r.setDensifyFraction(.25), this._maxDistanceFound = r.orientedDistance(), this._maxDistanceFound > n) {
  18114. this._isValid = !1;
  18115. var i = r.getCoordinates();
  18116. this._errorLocation = i[1], this._errorIndicator = t.getFactory().createLineString(i), this._errMsg = "Distance between buffer curve and input is too large (" + this._maxDistanceFound + " at " + Fl.toLineString(i[0], i[1]) + ")"
  18117. }
  18118. }, Bf.prototype.isValid = function () {
  18119. var t = Math.abs(this._bufDistance),
  18120. e = Bf.MAX_DISTANCE_DIFF_FRAC * t;
  18121. return this._minValidDistance = t - e, this._maxValidDistance = t + e, !(!this._input.isEmpty() && !this._result.isEmpty()) || (this._bufDistance > 0 ? this.checkPositiveValid() : this.checkNegativeValid(), Bf.VERBOSE && Pl.out.println("Min Dist= " + this._minDistanceFound + " err= " + (1 - this._minDistanceFound / this._bufDistance) + " Max Dist= " + this._maxDistanceFound + " err= " + (this._maxDistanceFound / this._bufDistance - 1)), this._isValid)
  18122. }, Bf.prototype.checkNegativeValid = function () {
  18123. if (!(this._input instanceof th || this._input instanceof rh || this._input instanceof kc)) return null;
  18124. var t = this.getPolygonLines(this._input);
  18125. if (this.checkMinimumDistance(t, this._result, this._minValidDistance), !this._isValid) return null;
  18126. this.checkMaximumDistance(t, this._result, this._maxValidDistance)
  18127. }, Bf.prototype.getErrorIndicator = function () {
  18128. return this._errorIndicator
  18129. }, Bf.prototype.checkMinimumDistance = function (t, e, n) {
  18130. var r = new Tf(t, e, n);
  18131. if (this._minDistanceFound = r.distance(), this._minDistanceFound < n) {
  18132. this._isValid = !1;
  18133. var i = r.nearestPoints();
  18134. this._errorLocation = r.nearestPoints()[1], this._errorIndicator = t.getFactory().createLineString(i), this._errMsg = "Distance between buffer curve and input is too small (" + this._minDistanceFound + " at " + Fl.toLineString(i[0], i[1]) + " )"
  18135. }
  18136. }, Bf.prototype.checkPositiveValid = function () {
  18137. var t = this._result.getBoundary();
  18138. if (this.checkMinimumDistance(this._input, t, this._minValidDistance), !this._isValid) return null;
  18139. this.checkMaximumDistance(this._input, t, this._maxValidDistance)
  18140. }, Bf.prototype.getErrorLocation = function () {
  18141. return this._errorLocation
  18142. }, Bf.prototype.getPolygonLines = function (t) {
  18143. for (var e = new lc, n = new Cf(e), r = Sf.getPolygons(t).iterator(); r.hasNext();) {
  18144. r.next().apply(n)
  18145. }
  18146. return t.getFactory().buildGeometry(e)
  18147. }, Bf.prototype.getErrorMessage = function () {
  18148. return this._errMsg
  18149. }, Bf.prototype.interfaces_ = function () {
  18150. return []
  18151. }, Bf.prototype.getClass = function () {
  18152. return Bf
  18153. }, zf.VERBOSE.get = function () {
  18154. return !1
  18155. }, zf.MAX_DISTANCE_DIFF_FRAC.get = function () {
  18156. return .012
  18157. }, Object.defineProperties(Bf, zf);
  18158. var jf = function (t, e, n) {
  18159. this._isValid = !0, this._errorMsg = null, this._errorLocation = null, this._errorIndicator = null, this._input = t || null, this._distance = e || null, this._result = n || null
  18160. },
  18161. Uf = {
  18162. VERBOSE: {
  18163. configurable: !0
  18164. },
  18165. MAX_ENV_DIFF_FRAC: {
  18166. configurable: !0
  18167. }
  18168. };
  18169. jf.prototype.isValid = function () {
  18170. return this.checkPolygonal(), this._isValid ? (this.checkExpectedEmpty(), this._isValid ? (this.checkEnvelope(), this._isValid ? (this.checkArea(), this._isValid ? (this.checkDistance(), this._isValid) : this._isValid) : this._isValid) : this._isValid) : this._isValid
  18171. }, jf.prototype.checkEnvelope = function () {
  18172. if (this._distance < 0) return null;
  18173. var t = this._distance * jf.MAX_ENV_DIFF_FRAC;
  18174. 0 === t && (t = .001);
  18175. var e = new Ll(this._input.getEnvelopeInternal());
  18176. e.expandBy(this._distance);
  18177. var n = new Ll(this._result.getEnvelopeInternal());
  18178. n.expandBy(t), n.contains(e) || (this._isValid = !1, this._errorMsg = "Buffer envelope is incorrect", this._errorIndicator = this._input.getFactory().toGeometry(n)), this.report("Envelope")
  18179. }, jf.prototype.checkDistance = function () {
  18180. var t = new Bf(this._input, this._distance, this._result);
  18181. t.isValid() || (this._isValid = !1, this._errorMsg = t.getErrorMessage(), this._errorLocation = t.getErrorLocation(), this._errorIndicator = t.getErrorIndicator()), this.report("Distance")
  18182. }, jf.prototype.checkArea = function () {
  18183. var t = this._input.getArea(),
  18184. e = this._result.getArea();
  18185. this._distance > 0 && t > e && (this._isValid = !1, this._errorMsg = "Area of positive buffer is smaller than input", this._errorIndicator = this._result), this._distance < 0 && t < e && (this._isValid = !1, this._errorMsg = "Area of negative buffer is larger than input", this._errorIndicator = this._result), this.report("Area")
  18186. }, jf.prototype.checkPolygonal = function () {
  18187. this._result instanceof th || this._result instanceof rh || (this._isValid = !1), this._errorMsg = "Result is not polygonal", this._errorIndicator = this._result, this.report("Polygonal")
  18188. }, jf.prototype.getErrorIndicator = function () {
  18189. return this._errorIndicator
  18190. }, jf.prototype.getErrorLocation = function () {
  18191. return this._errorLocation
  18192. }, jf.prototype.checkExpectedEmpty = function () {
  18193. return this._input.getDimension() >= 2 || this._distance > 0 ? null : (this._result.isEmpty() || (this._isValid = !1, this._errorMsg = "Result is non-empty", this._errorIndicator = this._result), void this.report("ExpectedEmpty"))
  18194. }, jf.prototype.report = function (t) {
  18195. if (!jf.VERBOSE) return null;
  18196. Pl.out.println("Check " + t + ": " + (this._isValid ? "passed" : "FAILED"))
  18197. }, jf.prototype.getErrorMessage = function () {
  18198. return this._errorMsg
  18199. }, jf.prototype.interfaces_ = function () {
  18200. return []
  18201. }, jf.prototype.getClass = function () {
  18202. return jf
  18203. }, jf.isValidMsg = function (t, e, n) {
  18204. var r = new jf(t, e, n);
  18205. return r.isValid() ? null : r.getErrorMessage()
  18206. }, jf.isValid = function (t, e, n) {
  18207. return !!new jf(t, e, n).isValid()
  18208. }, Uf.VERBOSE.get = function () {
  18209. return !1
  18210. }, Uf.MAX_ENV_DIFF_FRAC.get = function () {
  18211. return .012
  18212. }, Object.defineProperties(jf, Uf);
  18213. var Vf = function () {
  18214. this._pts = null, this._data = null;
  18215. var t = arguments[0],
  18216. e = arguments[1];
  18217. this._pts = t, this._data = e
  18218. };
  18219. Vf.prototype.getCoordinates = function () {
  18220. return this._pts
  18221. }, Vf.prototype.size = function () {
  18222. return this._pts.length
  18223. }, Vf.prototype.getCoordinate = function (t) {
  18224. return this._pts[t]
  18225. }, Vf.prototype.isClosed = function () {
  18226. return this._pts[0].equals(this._pts[this._pts.length - 1])
  18227. }, Vf.prototype.getSegmentOctant = function (t) {
  18228. return t === this._pts.length - 1 ? -1 : fp.octant(this.getCoordinate(t), this.getCoordinate(t + 1))
  18229. }, Vf.prototype.setData = function (t) {
  18230. this._data = t
  18231. }, Vf.prototype.getData = function () {
  18232. return this._data
  18233. }, Vf.prototype.toString = function () {
  18234. return Fl.toLineString(new lh(this._pts))
  18235. }, Vf.prototype.interfaces_ = function () {
  18236. return [gp]
  18237. }, Vf.prototype.getClass = function () {
  18238. return Vf
  18239. };
  18240. var Xf = function () {
  18241. this._findAllIntersections = !1, this._isCheckEndSegmentsOnly = !1, this._li = null, this._interiorIntersection = null, this._intSegments = null, this._intersections = new lc, this._intersectionCount = 0, this._keepIntersections = !0;
  18242. var t = arguments[0];
  18243. this._li = t, this._interiorIntersection = null
  18244. };
  18245. Xf.prototype.getInteriorIntersection = function () {
  18246. return this._interiorIntersection
  18247. }, Xf.prototype.setCheckEndSegmentsOnly = function (t) {
  18248. this._isCheckEndSegmentsOnly = t
  18249. }, Xf.prototype.getIntersectionSegments = function () {
  18250. return this._intSegments
  18251. }, Xf.prototype.count = function () {
  18252. return this._intersectionCount
  18253. }, Xf.prototype.getIntersections = function () {
  18254. return this._intersections
  18255. }, Xf.prototype.setFindAllIntersections = function (t) {
  18256. this._findAllIntersections = t
  18257. }, Xf.prototype.setKeepIntersections = function (t) {
  18258. this._keepIntersections = t
  18259. }, Xf.prototype.processIntersections = function (t, e, n, r) {
  18260. if (!this._findAllIntersections && this.hasIntersection()) return null;
  18261. if (t === n && e === r) return null;
  18262. if (this._isCheckEndSegmentsOnly && !(this.isEndSegment(t, e) || this.isEndSegment(n, r))) return null;
  18263. var i = t.getCoordinates()[e],
  18264. o = t.getCoordinates()[e + 1],
  18265. s = n.getCoordinates()[r],
  18266. a = n.getCoordinates()[r + 1];
  18267. this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && this._li.isInteriorIntersection() && (this._intSegments = new Array(4).fill(null), this._intSegments[0] = i, this._intSegments[1] = o, this._intSegments[2] = s, this._intSegments[3] = a, this._interiorIntersection = this._li.getIntersection(0), this._keepIntersections && this._intersections.add(this._interiorIntersection), this._intersectionCount++)
  18268. }, Xf.prototype.isEndSegment = function (t, e) {
  18269. return 0 === e || e >= t.size() - 2
  18270. }, Xf.prototype.hasIntersection = function () {
  18271. return null !== this._interiorIntersection
  18272. }, Xf.prototype.isDone = function () {
  18273. return !this._findAllIntersections && null !== this._interiorIntersection
  18274. }, Xf.prototype.interfaces_ = function () {
  18275. return [Zp]
  18276. }, Xf.prototype.getClass = function () {
  18277. return Xf
  18278. }, Xf.createAllIntersectionsFinder = function (t) {
  18279. var e = new Xf(t);
  18280. return e.setFindAllIntersections(!0), e
  18281. }, Xf.createAnyIntersectionFinder = function (t) {
  18282. return new Xf(t)
  18283. }, Xf.createIntersectionCounter = function (t) {
  18284. var e = new Xf(t);
  18285. return e.setFindAllIntersections(!0), e.setKeepIntersections(!1), e
  18286. };
  18287. var Yf = function () {
  18288. this._li = new jl, this._segStrings = null, this._findAllIntersections = !1, this._segInt = null, this._isValid = !0;
  18289. var t = arguments[0];
  18290. this._segStrings = t
  18291. };
  18292. Yf.prototype.execute = function () {
  18293. if (null !== this._segInt) return null;
  18294. this.checkInteriorIntersections()
  18295. }, Yf.prototype.getIntersections = function () {
  18296. return this._segInt.getIntersections()
  18297. }, Yf.prototype.isValid = function () {
  18298. return this.execute(), this._isValid
  18299. }, Yf.prototype.setFindAllIntersections = function (t) {
  18300. this._findAllIntersections = t
  18301. }, Yf.prototype.checkInteriorIntersections = function () {
  18302. this._isValid = !0, this._segInt = new Xf(this._li), this._segInt.setFindAllIntersections(this._findAllIntersections);
  18303. var t = new Ip;
  18304. if (t.setSegmentIntersector(this._segInt), t.computeNodes(this._segStrings), this._segInt.hasIntersection()) return this._isValid = !1, null
  18305. }, Yf.prototype.checkValid = function () {
  18306. if (this.execute(), !this._isValid) throw new Oh(this.getErrorMessage(), this._segInt.getInteriorIntersection())
  18307. }, Yf.prototype.getErrorMessage = function () {
  18308. if (this._isValid) return "no intersections found";
  18309. var t = this._segInt.getIntersectionSegments();
  18310. return "found non-noded intersection between " + Fl.toLineString(t[0], t[1]) + " and " + Fl.toLineString(t[2], t[3])
  18311. }, Yf.prototype.interfaces_ = function () {
  18312. return []
  18313. }, Yf.prototype.getClass = function () {
  18314. return Yf
  18315. }, Yf.computeIntersections = function (t) {
  18316. var e = new Yf(t);
  18317. return e.setFindAllIntersections(!0), e.isValid(), e.getIntersections()
  18318. };
  18319. var Hf = function t() {
  18320. this._nv = null;
  18321. var e = arguments[0];
  18322. this._nv = new Yf(t.toSegmentStrings(e))
  18323. };
  18324. Hf.prototype.checkValid = function () {
  18325. this._nv.checkValid()
  18326. }, Hf.prototype.interfaces_ = function () {
  18327. return []
  18328. }, Hf.prototype.getClass = function () {
  18329. return Hf
  18330. }, Hf.toSegmentStrings = function (t) {
  18331. for (var e = new lc, n = t.iterator(); n.hasNext();) {
  18332. var r = n.next();
  18333. e.add(new Vf(r.getCoordinates(), r))
  18334. }
  18335. return e
  18336. }, Hf.checkValid = function (t) {
  18337. new Hf(t).checkValid()
  18338. };
  18339. var Wf = function (t) {
  18340. this._mapOp = t
  18341. };
  18342. Wf.prototype.map = function (t) {
  18343. for (var e = new lc, n = 0; n < t.getNumGeometries(); n++) {
  18344. var r = this._mapOp.map(t.getGeometryN(n));
  18345. r.isEmpty() || e.add(r)
  18346. }
  18347. return t.getFactory().createGeometryCollection(_h.toGeometryArray(e))
  18348. }, Wf.prototype.interfaces_ = function () {
  18349. return []
  18350. }, Wf.prototype.getClass = function () {
  18351. return Wf
  18352. }, Wf.map = function (t, e) {
  18353. return new Wf(e).map(t)
  18354. };
  18355. var Jf = function () {
  18356. this._op = null, this._geometryFactory = null, this._ptLocator = null, this._lineEdgesList = new lc, this._resultLineList = new lc;
  18357. var t = arguments[0],
  18358. e = arguments[1],
  18359. n = arguments[2];
  18360. this._op = t, this._geometryFactory = e, this._ptLocator = n
  18361. };
  18362. Jf.prototype.collectLines = function (t) {
  18363. for (var e = this, n = this._op.getGraph().getEdgeEnds().iterator(); n.hasNext();) {
  18364. var r = n.next();
  18365. e.collectLineEdge(r, t, e._lineEdgesList), e.collectBoundaryTouchEdge(r, t, e._lineEdgesList)
  18366. }
  18367. }, Jf.prototype.labelIsolatedLine = function (t, e) {
  18368. var n = this._ptLocator.locate(t.getCoordinate(), this._op.getArgGeometry(e));
  18369. t.getLabel().setLocation(e, n)
  18370. }, Jf.prototype.build = function (t) {
  18371. return this.findCoveredLineEdges(), this.collectLines(t), this.buildLines(t), this._resultLineList
  18372. }, Jf.prototype.collectLineEdge = function (t, e, n) {
  18373. var r = t.getLabel(),
  18374. i = t.getEdge();
  18375. t.isLineEdge() && (t.isVisited() || !Mg.isResultOfOp(r, e) || i.isCovered() || (n.add(i), t.setVisitedEdge(!0)))
  18376. }, Jf.prototype.findCoveredLineEdges = function () {
  18377. for (var t = this._op.getGraph().getNodes().iterator(); t.hasNext();) {
  18378. t.next().getEdges().findCoveredLineEdges()
  18379. }
  18380. for (var e = this._op.getGraph().getEdgeEnds().iterator(); e.hasNext();) {
  18381. var n = e.next(),
  18382. r = n.getEdge();
  18383. if (n.isLineEdge() && !r.isCoveredSet()) {
  18384. var i = this._op.isCoveredByA(n.getCoordinate());
  18385. r.setCovered(i)
  18386. }
  18387. }
  18388. }, Jf.prototype.labelIsolatedLines = function (t) {
  18389. for (var e = t.iterator(); e.hasNext();) {
  18390. var n = e.next(),
  18391. r = n.getLabel();
  18392. n.isIsolated() && (r.isNull(0) ? this.labelIsolatedLine(n, 0) : this.labelIsolatedLine(n, 1))
  18393. }
  18394. }, Jf.prototype.buildLines = function (t) {
  18395. for (var e = this._lineEdgesList.iterator(); e.hasNext();) {
  18396. var n = e.next(),
  18397. r = this._geometryFactory.createLineString(n.getCoordinates());
  18398. this._resultLineList.add(r), n.setInResult(!0)
  18399. }
  18400. }, Jf.prototype.collectBoundaryTouchEdge = function (t, e, n) {
  18401. var r = t.getLabel();
  18402. return t.isLineEdge() || t.isVisited() || t.isInteriorAreaEdge() || t.getEdge().isInResult() ? null : (ql.isTrue(!(t.isInResult() || t.getSym().isInResult()) || !t.getEdge().isInResult()), void(Mg.isResultOfOp(r, e) && e === Mg.INTERSECTION && (n.add(t.getEdge()), t.setVisitedEdge(!0))))
  18403. }, Jf.prototype.interfaces_ = function () {
  18404. return []
  18405. }, Jf.prototype.getClass = function () {
  18406. return Jf
  18407. };
  18408. var Zf = function () {
  18409. this._op = null, this._geometryFactory = null, this._resultPointList = new lc;
  18410. var t = arguments[0],
  18411. e = arguments[1];
  18412. this._op = t, this._geometryFactory = e
  18413. };
  18414. Zf.prototype.filterCoveredNodeToPoint = function (t) {
  18415. var e = t.getCoordinate();
  18416. if (!this._op.isCoveredByLA(e)) {
  18417. var n = this._geometryFactory.createPoint(e);
  18418. this._resultPointList.add(n)
  18419. }
  18420. }, Zf.prototype.extractNonCoveredResultNodes = function (t) {
  18421. for (var e = this._op.getGraph().getNodes().iterator(); e.hasNext();) {
  18422. var n = e.next();
  18423. if (!n.isInResult() && (!n.isIncidentEdgeInResult() && (0 === n.getEdges().getDegree() || t === Mg.INTERSECTION))) {
  18424. var r = n.getLabel();
  18425. Mg.isResultOfOp(r, t) && this.filterCoveredNodeToPoint(n)
  18426. }
  18427. }
  18428. }, Zf.prototype.build = function (t) {
  18429. return this.extractNonCoveredResultNodes(t), this._resultPointList
  18430. }, Zf.prototype.interfaces_ = function () {
  18431. return []
  18432. }, Zf.prototype.getClass = function () {
  18433. return Zf
  18434. };
  18435. var Kf = function () {
  18436. this._inputGeom = null, this._factory = null, this._pruneEmptyGeometry = !0, this._preserveGeometryCollectionType = !0, this._preserveCollections = !1, this._preserveType = !1
  18437. };
  18438. Kf.prototype.transformPoint = function (t, e) {
  18439. return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(), t))
  18440. }, Kf.prototype.transformPolygon = function (t, e) {
  18441. var n = !0,
  18442. r = this.transformLinearRing(t.getExteriorRing(), t);
  18443. null !== r && r instanceof nh && !r.isEmpty() || (n = !1);
  18444. for (var i = new lc, o = 0; o < t.getNumInteriorRing(); o++) {
  18445. var s = this.transformLinearRing(t.getInteriorRingN(o), t);
  18446. null === s || s.isEmpty() || (s instanceof nh || (n = !1), i.add(s))
  18447. }
  18448. if (n) return this._factory.createPolygon(r, i.toArray([]));
  18449. var a = new lc;
  18450. return null !== r && a.add(r), a.addAll(i), this._factory.buildGeometry(a)
  18451. }, Kf.prototype.createCoordinateSequence = function (t) {
  18452. return this._factory.getCoordinateSequenceFactory().create(t)
  18453. }, Kf.prototype.getInputGeometry = function () {
  18454. return this._inputGeom
  18455. }, Kf.prototype.transformMultiLineString = function (t, e) {
  18456. for (var n = new lc, r = 0; r < t.getNumGeometries(); r++) {
  18457. var i = this.transformLineString(t.getGeometryN(r), t);
  18458. null !== i && (i.isEmpty() || n.add(i))
  18459. }
  18460. return this._factory.buildGeometry(n)
  18461. }, Kf.prototype.transformCoordinates = function (t, e) {
  18462. return this.copy(t)
  18463. }, Kf.prototype.transformLineString = function (t, e) {
  18464. return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(), t))
  18465. }, Kf.prototype.transformMultiPoint = function (t, e) {
  18466. for (var n = new lc, r = 0; r < t.getNumGeometries(); r++) {
  18467. var i = this.transformPoint(t.getGeometryN(r), t);
  18468. null !== i && (i.isEmpty() || n.add(i))
  18469. }
  18470. return this._factory.buildGeometry(n)
  18471. }, Kf.prototype.transformMultiPolygon = function (t, e) {
  18472. for (var n = new lc, r = 0; r < t.getNumGeometries(); r++) {
  18473. var i = this.transformPolygon(t.getGeometryN(r), t);
  18474. null !== i && (i.isEmpty() || n.add(i))
  18475. }
  18476. return this._factory.buildGeometry(n)
  18477. }, Kf.prototype.copy = function (t) {
  18478. return t.copy()
  18479. }, Kf.prototype.transformGeometryCollection = function (t, e) {
  18480. for (var n = new lc, r = 0; r < t.getNumGeometries(); r++) {
  18481. var i = this.transform(t.getGeometryN(r));
  18482. null !== i && (this._pruneEmptyGeometry && i.isEmpty() || n.add(i))
  18483. }
  18484. return this._preserveGeometryCollectionType ? this._factory.createGeometryCollection(_h.toGeometryArray(n)) : this._factory.buildGeometry(n)
  18485. }, Kf.prototype.transform = function (t) {
  18486. if (this._inputGeom = t, this._factory = t.getFactory(), t instanceof Qc) return this.transformPoint(t, null);
  18487. if (t instanceof eh) return this.transformMultiPoint(t, null);
  18488. if (t instanceof nh) return this.transformLinearRing(t, null);
  18489. if (t instanceof Zc) return this.transformLineString(t, null);
  18490. if (t instanceof Gc) return this.transformMultiLineString(t, null);
  18491. if (t instanceof th) return this.transformPolygon(t, null);
  18492. if (t instanceof rh) return this.transformMultiPolygon(t, null);
  18493. if (t instanceof kc) return this.transformGeometryCollection(t, null);
  18494. throw new el("Unknown Geometry subtype: " + t.getClass().getName())
  18495. }, Kf.prototype.transformLinearRing = function (t, e) {
  18496. var n = this.transformCoordinates(t.getCoordinateSequence(), t);
  18497. if (null === n) return this._factory.createLinearRing(null);
  18498. var r = n.size();
  18499. return r > 0 && r < 4 && !this._preserveType ? this._factory.createLineString(n) : this._factory.createLinearRing(n)
  18500. }, Kf.prototype.interfaces_ = function () {
  18501. return []
  18502. }, Kf.prototype.getClass = function () {
  18503. return Kf
  18504. };
  18505. var Qf = function t() {
  18506. if (this._snapTolerance = 0, this._srcPts = null, this._seg = new vp, this._allowSnappingToSourceVertices = !1, this._isClosed = !1, arguments[0] instanceof Zc && "number" == typeof arguments[1]) {
  18507. var e = arguments[0],
  18508. n = arguments[1];
  18509. t.call(this, e.getCoordinates(), n)
  18510. } else if (arguments[0] instanceof Array && "number" == typeof arguments[1]) {
  18511. var r = arguments[0],
  18512. i = arguments[1];
  18513. this._srcPts = r, this._isClosed = t.isClosed(r), this._snapTolerance = i
  18514. }
  18515. };
  18516. Qf.prototype.snapVertices = function (t, e) {
  18517. for (var n = this._isClosed ? t.size() - 1 : t.size(), r = 0; r < n; r++) {
  18518. var i = t.get(r),
  18519. o = this.findSnapForVertex(i, e);
  18520. null !== o && (t.set(r, new ul(o)), 0 === r && this._isClosed && t.set(t.size() - 1, new ul(o)))
  18521. }
  18522. }, Qf.prototype.findSnapForVertex = function (t, e) {
  18523. for (var n = 0; n < e.length; n++) {
  18524. if (t.equals2D(e[n])) return null;
  18525. if (t.distance(e[n]) < this._snapTolerance) return e[n]
  18526. }
  18527. return null
  18528. }, Qf.prototype.snapTo = function (t) {
  18529. var e = new hc(this._srcPts);
  18530. return this.snapVertices(e, t), this.snapSegments(e, t), e.toCoordinateArray()
  18531. }, Qf.prototype.snapSegments = function (t, e) {
  18532. if (0 === e.length) return null;
  18533. var n = e.length;
  18534. e[0].equals2D(e[e.length - 1]) && (n = e.length - 1);
  18535. for (var r = 0; r < n; r++) {
  18536. var i = e[r],
  18537. o = this.findSegmentIndexToSnap(i, t);
  18538. o >= 0 && t.add(o + 1, new ul(i), !1)
  18539. }
  18540. }, Qf.prototype.findSegmentIndexToSnap = function (t, e) {
  18541. for (var n = this, r = nl.MAX_VALUE, i = -1, o = 0; o < e.size() - 1; o++) {
  18542. if (n._seg.p0 = e.get(o), n._seg.p1 = e.get(o + 1), n._seg.p0.equals2D(t) || n._seg.p1.equals2D(t)) {
  18543. if (n._allowSnappingToSourceVertices) continue;
  18544. return -1
  18545. }
  18546. var s = n._seg.distance(t);
  18547. s < n._snapTolerance && s < r && (r = s, i = o)
  18548. }
  18549. return i
  18550. }, Qf.prototype.setAllowSnappingToSourceVertices = function (t) {
  18551. this._allowSnappingToSourceVertices = t
  18552. }, Qf.prototype.interfaces_ = function () {
  18553. return []
  18554. }, Qf.prototype.getClass = function () {
  18555. return Qf
  18556. }, Qf.isClosed = function (t) {
  18557. return !(t.length <= 1) && t[0].equals2D(t[t.length - 1])
  18558. };
  18559. var $f = function (t) {
  18560. this._srcGeom = t || null
  18561. },
  18562. tg = {
  18563. SNAP_PRECISION_FACTOR: {
  18564. configurable: !0
  18565. }
  18566. };
  18567. $f.prototype.snapTo = function (t, e) {
  18568. var n = this.extractTargetCoordinates(t);
  18569. return new eg(e, n).transform(this._srcGeom)
  18570. }, $f.prototype.snapToSelf = function (t, e) {
  18571. var n = this.extractTargetCoordinates(this._srcGeom),
  18572. r = new eg(t, n, !0).transform(this._srcGeom),
  18573. i = r;
  18574. return e && gl(i, $c) && (i = r.buffer(0)), i
  18575. }, $f.prototype.computeSnapTolerance = function (t) {
  18576. return this.computeMinimumSegmentLength(t) / 10
  18577. }, $f.prototype.extractTargetCoordinates = function (t) {
  18578. for (var e = new Lc, n = t.getCoordinates(), r = 0; r < n.length; r++) e.add(n[r]);
  18579. return e.toArray(new Array(0).fill(null))
  18580. }, $f.prototype.computeMinimumSegmentLength = function (t) {
  18581. for (var e = nl.MAX_VALUE, n = 0; n < t.length - 1; n++) {
  18582. var r = t[n].distance(t[n + 1]);
  18583. r < e && (e = r)
  18584. }
  18585. return e
  18586. }, $f.prototype.interfaces_ = function () {
  18587. return []
  18588. }, $f.prototype.getClass = function () {
  18589. return $f
  18590. }, $f.snap = function (t, e, n) {
  18591. var r = new Array(2).fill(null),
  18592. i = new $f(t);
  18593. r[0] = i.snapTo(e, n);
  18594. var o = new $f(e);
  18595. return r[1] = o.snapTo(r[0], n), r
  18596. }, $f.computeOverlaySnapTolerance = function () {
  18597. if (1 === arguments.length) {
  18598. var t = arguments[0],
  18599. e = $f.computeSizeBasedSnapTolerance(t),
  18600. n = t.getPrecisionModel();
  18601. if (n.getType() === gh.FIXED) {
  18602. var r = 1 / n.getScale() * 2 / 1.415;
  18603. r > e && (e = r)
  18604. }
  18605. return e
  18606. }
  18607. if (2 === arguments.length) {
  18608. var i = arguments[0],
  18609. o = arguments[1];
  18610. return Math.min($f.computeOverlaySnapTolerance(i), $f.computeOverlaySnapTolerance(o))
  18611. }
  18612. }, $f.computeSizeBasedSnapTolerance = function (t) {
  18613. var e = t.getEnvelopeInternal();
  18614. return Math.min(e.getHeight(), e.getWidth()) * $f.SNAP_PRECISION_FACTOR
  18615. }, $f.snapToSelf = function (t, e, n) {
  18616. return new $f(t).snapToSelf(e, n)
  18617. }, tg.SNAP_PRECISION_FACTOR.get = function () {
  18618. return 1e-9
  18619. }, Object.defineProperties($f, tg);
  18620. var eg = function (t) {
  18621. function e(e, n, r) {
  18622. t.call(this), this._snapTolerance = e || null, this._snapPts = n || null, this._isSelfSnap = void 0 !== r && r
  18623. }
  18624. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.snapLine = function (t, e) {
  18625. var n = new Qf(t, this._snapTolerance);
  18626. return n.setAllowSnappingToSourceVertices(this._isSelfSnap), n.snapTo(e)
  18627. }, e.prototype.transformCoordinates = function (t, e) {
  18628. var n = t.toCoordinateArray(),
  18629. r = this.snapLine(n, this._snapPts);
  18630. return this._factory.getCoordinateSequenceFactory().create(r)
  18631. }, e.prototype.interfaces_ = function () {
  18632. return []
  18633. }, e.prototype.getClass = function () {
  18634. return e
  18635. }, e
  18636. }(Kf),
  18637. ng = function () {
  18638. this._isFirst = !0, this._commonMantissaBitsCount = 53, this._commonBits = 0, this._commonSignExp = null
  18639. };
  18640. ng.prototype.getCommon = function () {
  18641. return nl.longBitsToDouble(this._commonBits)
  18642. }, ng.prototype.add = function (t) {
  18643. var e = nl.doubleToLongBits(t);
  18644. return this._isFirst ? (this._commonBits = e, this._commonSignExp = ng.signExpBits(this._commonBits), this._isFirst = !1, null) : ng.signExpBits(e) !== this._commonSignExp ? (this._commonBits = 0, null) : (this._commonMantissaBitsCount = ng.numCommonMostSigMantissaBits(this._commonBits, e), void(this._commonBits = ng.zeroLowerBits(this._commonBits, 64 - (12 + this._commonMantissaBitsCount))))
  18645. }, ng.prototype.toString = function () {
  18646. if (1 === arguments.length) {
  18647. var t = arguments[0],
  18648. e = nl.longBitsToDouble(t),
  18649. n = nl.toBinaryString(t),
  18650. r = "0000000000000000000000000000000000000000000000000000000000000000" + n,
  18651. i = r.substring(r.length - 64),
  18652. o = i.substring(0, 1) + " " + i.substring(1, 12) + "(exp) " + i.substring(12) + " [ " + e + " ]";
  18653. return o
  18654. }
  18655. }, ng.prototype.interfaces_ = function () {
  18656. return []
  18657. }, ng.prototype.getClass = function () {
  18658. return ng
  18659. }, ng.getBit = function (t, e) {
  18660. return 0 != (t & 1 << e) ? 1 : 0
  18661. }, ng.signExpBits = function (t) {
  18662. return t >> 52
  18663. }, ng.zeroLowerBits = function (t, e) {
  18664. return t & ~((1 << e) - 1)
  18665. }, ng.numCommonMostSigMantissaBits = function (t, e) {
  18666. for (var n = 0, r = 52; r >= 0; r--) {
  18667. if (ng.getBit(t, r) !== ng.getBit(e, r)) return n;
  18668. n++
  18669. }
  18670. return 52
  18671. };
  18672. var rg = function () {
  18673. this._commonCoord = null, this._ccFilter = new og
  18674. },
  18675. ig = {
  18676. CommonCoordinateFilter: {
  18677. configurable: !0
  18678. },
  18679. Translater: {
  18680. configurable: !0
  18681. }
  18682. };
  18683. rg.prototype.addCommonBits = function (t) {
  18684. var e = new sg(this._commonCoord);
  18685. t.apply(e), t.geometryChanged()
  18686. }, rg.prototype.removeCommonBits = function (t) {
  18687. if (0 === this._commonCoord.x && 0 === this._commonCoord.y) return t;
  18688. var e = new ul(this._commonCoord);
  18689. e.x = -e.x, e.y = -e.y;
  18690. var n = new sg(e);
  18691. return t.apply(n), t.geometryChanged(), t
  18692. }, rg.prototype.getCommonCoordinate = function () {
  18693. return this._commonCoord
  18694. }, rg.prototype.add = function (t) {
  18695. t.apply(this._ccFilter), this._commonCoord = this._ccFilter.getCommonCoordinate()
  18696. }, rg.prototype.interfaces_ = function () {
  18697. return []
  18698. }, rg.prototype.getClass = function () {
  18699. return rg
  18700. }, ig.CommonCoordinateFilter.get = function () {
  18701. return og
  18702. }, ig.Translater.get = function () {
  18703. return sg
  18704. }, Object.defineProperties(rg, ig);
  18705. var og = function () {
  18706. this._commonBitsX = new ng, this._commonBitsY = new ng
  18707. };
  18708. og.prototype.filter = function (t) {
  18709. this._commonBitsX.add(t.x), this._commonBitsY.add(t.y)
  18710. }, og.prototype.getCommonCoordinate = function () {
  18711. return new ul(this._commonBitsX.getCommon(), this._commonBitsY.getCommon())
  18712. }, og.prototype.interfaces_ = function () {
  18713. return [Kl]
  18714. }, og.prototype.getClass = function () {
  18715. return og
  18716. };
  18717. var sg = function () {
  18718. this.trans = null;
  18719. var t = arguments[0];
  18720. this.trans = t
  18721. };
  18722. sg.prototype.filter = function (t, e) {
  18723. var n = t.getOrdinate(e, 0) + this.trans.x,
  18724. r = t.getOrdinate(e, 1) + this.trans.y;
  18725. t.setOrdinate(e, 0, n), t.setOrdinate(e, 1, r)
  18726. }, sg.prototype.isDone = function () {
  18727. return !1
  18728. }, sg.prototype.isGeometryChanged = function () {
  18729. return !0
  18730. }, sg.prototype.interfaces_ = function () {
  18731. return [Fc]
  18732. }, sg.prototype.getClass = function () {
  18733. return sg
  18734. };
  18735. var ag = function (t, e) {
  18736. this._geom = new Array(2).fill(null), this._snapTolerance = null, this._cbr = null, this._geom[0] = t, this._geom[1] = e, this.computeSnapTolerance()
  18737. };
  18738. ag.prototype.selfSnap = function (t) {
  18739. return new $f(t).snapTo(t, this._snapTolerance)
  18740. }, ag.prototype.removeCommonBits = function (t) {
  18741. this._cbr = new rg, this._cbr.add(t[0]), this._cbr.add(t[1]);
  18742. var e = new Array(2).fill(null);
  18743. return e[0] = this._cbr.removeCommonBits(t[0].copy()), e[1] = this._cbr.removeCommonBits(t[1].copy()), e
  18744. }, ag.prototype.prepareResult = function (t) {
  18745. return this._cbr.addCommonBits(t), t
  18746. }, ag.prototype.getResultGeometry = function (t) {
  18747. var e = this.snap(this._geom),
  18748. n = Mg.overlayOp(e[0], e[1], t);
  18749. return this.prepareResult(n)
  18750. }, ag.prototype.checkValid = function (t) {
  18751. t.isValid() || Pl.out.println("Snapped geometry is invalid")
  18752. }, ag.prototype.computeSnapTolerance = function () {
  18753. this._snapTolerance = $f.computeOverlaySnapTolerance(this._geom[0], this._geom[1])
  18754. }, ag.prototype.snap = function (t) {
  18755. var e = this.removeCommonBits(t);
  18756. return $f.snap(e[0], e[1], this._snapTolerance)
  18757. }, ag.prototype.interfaces_ = function () {
  18758. return []
  18759. }, ag.prototype.getClass = function () {
  18760. return ag
  18761. }, ag.overlayOp = function (t, e, n) {
  18762. return new ag(t, e).getResultGeometry(n)
  18763. }, ag.union = function (t, e) {
  18764. return ag.overlayOp(t, e, Mg.UNION)
  18765. }, ag.intersection = function (t, e) {
  18766. return ag.overlayOp(t, e, Mg.INTERSECTION)
  18767. }, ag.symDifference = function (t, e) {
  18768. return ag.overlayOp(t, e, Mg.SYMDIFFERENCE)
  18769. }, ag.difference = function (t, e) {
  18770. return ag.overlayOp(t, e, Mg.DIFFERENCE)
  18771. };
  18772. var ug = function (t, e) {
  18773. this._geom = new Array(2).fill(null), this._geom[0] = t, this._geom[1] = e
  18774. };
  18775. ug.prototype.getResultGeometry = function (t) {
  18776. var e = null,
  18777. n = !1,
  18778. r = null;
  18779. try {
  18780. e = Mg.overlayOp(this._geom[0], this._geom[1], t);
  18781. n = !0
  18782. } catch (t) {
  18783. if (!(t instanceof kl)) throw t;
  18784. r = t
  18785. }
  18786. if (!n) try {
  18787. e = ag.overlayOp(this._geom[0], this._geom[1], t)
  18788. } catch (t) {
  18789. throw t instanceof kl ? r : t
  18790. }
  18791. return e
  18792. }, ug.prototype.interfaces_ = function () {
  18793. return []
  18794. }, ug.prototype.getClass = function () {
  18795. return ug
  18796. }, ug.overlayOp = function (t, e, n) {
  18797. return new ug(t, e).getResultGeometry(n)
  18798. }, ug.union = function (t, e) {
  18799. return ug.overlayOp(t, e, Mg.UNION)
  18800. }, ug.intersection = function (t, e) {
  18801. return ug.overlayOp(t, e, Mg.INTERSECTION)
  18802. }, ug.symDifference = function (t, e) {
  18803. return ug.overlayOp(t, e, Mg.SYMDIFFERENCE)
  18804. }, ug.difference = function (t, e) {
  18805. return ug.overlayOp(t, e, Mg.DIFFERENCE)
  18806. };
  18807. var lg = function () {
  18808. this.mce = null, this.chainIndex = null;
  18809. var t = arguments[0],
  18810. e = arguments[1];
  18811. this.mce = t, this.chainIndex = e
  18812. };
  18813. lg.prototype.computeIntersections = function (t, e) {
  18814. this.mce.computeIntersectsForChain(this.chainIndex, t.mce, t.chainIndex, e)
  18815. }, lg.prototype.interfaces_ = function () {
  18816. return []
  18817. }, lg.prototype.getClass = function () {
  18818. return lg
  18819. };
  18820. var cg = function t() {
  18821. if (this._label = null, this._xValue = null, this._eventType = null, this._insertEvent = null, this._deleteEventIndex = null, this._obj = null, 2 === arguments.length) {
  18822. var e = arguments[0],
  18823. n = arguments[1];
  18824. this._eventType = t.DELETE, this._xValue = e, this._insertEvent = n
  18825. } else if (3 === arguments.length) {
  18826. var r = arguments[0],
  18827. i = arguments[1],
  18828. o = arguments[2];
  18829. this._eventType = t.INSERT, this._label = r, this._xValue = i, this._obj = o
  18830. }
  18831. },
  18832. hg = {
  18833. INSERT: {
  18834. configurable: !0
  18835. },
  18836. DELETE: {
  18837. configurable: !0
  18838. }
  18839. };
  18840. cg.prototype.isDelete = function () {
  18841. return this._eventType === cg.DELETE
  18842. }, cg.prototype.setDeleteEventIndex = function (t) {
  18843. this._deleteEventIndex = t
  18844. }, cg.prototype.getObject = function () {
  18845. return this._obj
  18846. }, cg.prototype.compareTo = function (t) {
  18847. var e = t;
  18848. return this._xValue < e._xValue ? -1 : this._xValue > e._xValue ? 1 : this._eventType < e._eventType ? -1 : this._eventType > e._eventType ? 1 : 0
  18849. }, cg.prototype.getInsertEvent = function () {
  18850. return this._insertEvent
  18851. }, cg.prototype.isInsert = function () {
  18852. return this._eventType === cg.INSERT
  18853. }, cg.prototype.isSameLabel = function (t) {
  18854. return null !== this._label && this._label === t._label
  18855. }, cg.prototype.getDeleteEventIndex = function () {
  18856. return this._deleteEventIndex
  18857. }, cg.prototype.interfaces_ = function () {
  18858. return [il]
  18859. }, cg.prototype.getClass = function () {
  18860. return cg
  18861. }, hg.INSERT.get = function () {
  18862. return 1
  18863. }, hg.DELETE.get = function () {
  18864. return 2
  18865. }, Object.defineProperties(cg, hg);
  18866. var pg = function () {};
  18867. pg.prototype.interfaces_ = function () {
  18868. return []
  18869. }, pg.prototype.getClass = function () {
  18870. return pg
  18871. };
  18872. var fg = function () {
  18873. this._hasIntersection = !1, this._hasProper = !1, this._hasProperInterior = !1, this._properIntersectionPoint = null, this._li = null, this._includeProper = null, this._recordIsolated = null, this._isSelfIntersection = null, this._numIntersections = 0, this.numTests = 0, this._bdyNodes = null, this._isDone = !1, this._isDoneWhenProperInt = !1;
  18874. var t = arguments[0],
  18875. e = arguments[1],
  18876. n = arguments[2];
  18877. this._li = t, this._includeProper = e, this._recordIsolated = n
  18878. };
  18879. fg.prototype.isTrivialIntersection = function (t, e, n, r) {
  18880. if (t === n && 1 === this._li.getIntersectionNum()) {
  18881. if (fg.isAdjacentSegments(e, r)) return !0;
  18882. if (t.isClosed()) {
  18883. var i = t.getNumPoints() - 1;
  18884. if (0 === e && r === i || 0 === r && e === i) return !0
  18885. }
  18886. }
  18887. return !1
  18888. }, fg.prototype.getProperIntersectionPoint = function () {
  18889. return this._properIntersectionPoint
  18890. }, fg.prototype.setIsDoneIfProperInt = function (t) {
  18891. this._isDoneWhenProperInt = t
  18892. }, fg.prototype.hasProperInteriorIntersection = function () {
  18893. return this._hasProperInterior
  18894. }, fg.prototype.isBoundaryPointInternal = function (t, e) {
  18895. for (var n = e.iterator(); n.hasNext();) {
  18896. var r = n.next().getCoordinate();
  18897. if (t.isIntersection(r)) return !0
  18898. }
  18899. return !1
  18900. }, fg.prototype.hasProperIntersection = function () {
  18901. return this._hasProper
  18902. }, fg.prototype.hasIntersection = function () {
  18903. return this._hasIntersection
  18904. }, fg.prototype.isDone = function () {
  18905. return this._isDone
  18906. }, fg.prototype.isBoundaryPoint = function (t, e) {
  18907. return null !== e && (!!this.isBoundaryPointInternal(t, e[0]) || !!this.isBoundaryPointInternal(t, e[1]))
  18908. }, fg.prototype.setBoundaryNodes = function (t, e) {
  18909. this._bdyNodes = new Array(2).fill(null), this._bdyNodes[0] = t, this._bdyNodes[1] = e
  18910. }, fg.prototype.addIntersections = function (t, e, n, r) {
  18911. if (t === n && e === r) return null;
  18912. this.numTests++;
  18913. var i = t.getCoordinates()[e],
  18914. o = t.getCoordinates()[e + 1],
  18915. s = n.getCoordinates()[r],
  18916. a = n.getCoordinates()[r + 1];
  18917. this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && (this._recordIsolated && (t.setIsolated(!1), n.setIsolated(!1)), this._numIntersections++, this.isTrivialIntersection(t, e, n, r) || (this._hasIntersection = !0, !this._includeProper && this._li.isProper() || (t.addIntersections(this._li, e, 0), n.addIntersections(this._li, r, 1)), this._li.isProper() && (this._properIntersectionPoint = this._li.getIntersection(0).copy(), this._hasProper = !0, this._isDoneWhenProperInt && (this._isDone = !0), this.isBoundaryPoint(this._li, this._bdyNodes) || (this._hasProperInterior = !0))))
  18918. }, fg.prototype.interfaces_ = function () {
  18919. return []
  18920. }, fg.prototype.getClass = function () {
  18921. return fg
  18922. }, fg.isAdjacentSegments = function (t, e) {
  18923. return 1 === Math.abs(t - e)
  18924. };
  18925. var gg = function (t) {
  18926. function e() {
  18927. t.call(this), this.events = new lc, this.nOverlaps = null
  18928. }
  18929. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.prepareEvents = function () {
  18930. np.sort(this.events);
  18931. for (var t = 0; t < this.events.size(); t++) {
  18932. var e = this.events.get(t);
  18933. e.isDelete() && e.getInsertEvent().setDeleteEventIndex(t)
  18934. }
  18935. }, e.prototype.computeIntersections = function () {
  18936. var t = this;
  18937. if (1 === arguments.length) {
  18938. var e = arguments[0];
  18939. this.nOverlaps = 0, this.prepareEvents();
  18940. for (var n = 0; n < this.events.size(); n++) {
  18941. var r = t.events.get(n);
  18942. if (r.isInsert() && t.processOverlaps(n, r.getDeleteEventIndex(), r, e), e.isDone()) break
  18943. }
  18944. } else if (3 === arguments.length)
  18945. if (arguments[2] instanceof fg && gl(arguments[0], ac) && gl(arguments[1], ac)) {
  18946. var i = arguments[0],
  18947. o = arguments[1],
  18948. s = arguments[2];
  18949. this.addEdges(i, i), this.addEdges(o, o), this.computeIntersections(s)
  18950. } else if ("boolean" == typeof arguments[2] && gl(arguments[0], ac) && arguments[1] instanceof fg) {
  18951. var a = arguments[0],
  18952. u = arguments[1],
  18953. l = arguments[2];
  18954. l ? this.addEdges(a, null) : this.addEdges(a), this.computeIntersections(u)
  18955. }
  18956. }, e.prototype.addEdge = function (t, e) {
  18957. for (var n = t.getMonotoneChainEdge(), r = n.getStartIndexes(), i = 0; i < r.length - 1; i++) {
  18958. var o = new lg(n, i),
  18959. s = new cg(e, n.getMinX(i), o);
  18960. this.events.add(s), this.events.add(new cg(n.getMaxX(i), s))
  18961. }
  18962. }, e.prototype.processOverlaps = function (t, e, n, r) {
  18963. for (var i = n.getObject(), o = t; o < e; o++) {
  18964. var s = this.events.get(o);
  18965. if (s.isInsert()) {
  18966. var a = s.getObject();
  18967. n.isSameLabel(s) || (i.computeIntersections(a, r), this.nOverlaps++)
  18968. }
  18969. }
  18970. }, e.prototype.addEdges = function () {
  18971. var t = this;
  18972. if (1 === arguments.length)
  18973. for (var e = arguments[0], n = e.iterator(); n.hasNext();) {
  18974. var r = n.next();
  18975. t.addEdge(r, r)
  18976. } else if (2 === arguments.length)
  18977. for (var i = arguments[0], o = arguments[1], s = i.iterator(); s.hasNext();) {
  18978. var a = s.next();
  18979. t.addEdge(a, o)
  18980. }
  18981. }, e.prototype.interfaces_ = function () {
  18982. return []
  18983. }, e.prototype.getClass = function () {
  18984. return e
  18985. }, e
  18986. }(pg),
  18987. dg = function () {
  18988. this._min = nl.POSITIVE_INFINITY, this._max = nl.NEGATIVE_INFINITY
  18989. },
  18990. yg = {
  18991. NodeComparator: {
  18992. configurable: !0
  18993. }
  18994. };
  18995. dg.prototype.getMin = function () {
  18996. return this._min
  18997. }, dg.prototype.intersects = function (t, e) {
  18998. return !(this._min > e || this._max < t)
  18999. }, dg.prototype.getMax = function () {
  19000. return this._max
  19001. }, dg.prototype.toString = function () {
  19002. return Fl.toLineString(new ul(this._min, 0), new ul(this._max, 0))
  19003. }, dg.prototype.interfaces_ = function () {
  19004. return []
  19005. }, dg.prototype.getClass = function () {
  19006. return dg
  19007. }, yg.NodeComparator.get = function () {
  19008. return vg
  19009. }, Object.defineProperties(dg, yg);
  19010. var vg = function () {};
  19011. vg.prototype.compare = function (t, e) {
  19012. var n = t,
  19013. r = e,
  19014. i = (n._min + n._max) / 2,
  19015. o = (r._min + r._max) / 2;
  19016. return i < o ? -1 : i > o ? 1 : 0
  19017. }, vg.prototype.interfaces_ = function () {
  19018. return [sl]
  19019. }, vg.prototype.getClass = function () {
  19020. return vg
  19021. };
  19022. var _g = function (t) {
  19023. function e() {
  19024. t.call(this), this._item = null;
  19025. var e = arguments[0],
  19026. n = arguments[1],
  19027. r = arguments[2];
  19028. this._min = e, this._max = n, this._item = r
  19029. }
  19030. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.query = function (t, e, n) {
  19031. if (!this.intersects(t, e)) return null;
  19032. n.visitItem(this._item)
  19033. }, e.prototype.interfaces_ = function () {
  19034. return []
  19035. }, e.prototype.getClass = function () {
  19036. return e
  19037. }, e
  19038. }(dg),
  19039. mg = function (t) {
  19040. function e() {
  19041. t.call(this), this._node1 = null, this._node2 = null;
  19042. var e = arguments[0],
  19043. n = arguments[1];
  19044. this._node1 = e, this._node2 = n, this.buildExtent(this._node1, this._node2)
  19045. }
  19046. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.buildExtent = function (t, e) {
  19047. this._min = Math.min(t._min, e._min), this._max = Math.max(t._max, e._max)
  19048. }, e.prototype.query = function (t, e, n) {
  19049. if (!this.intersects(t, e)) return null;
  19050. null !== this._node1 && this._node1.query(t, e, n), null !== this._node2 && this._node2.query(t, e, n)
  19051. }, e.prototype.interfaces_ = function () {
  19052. return []
  19053. }, e.prototype.getClass = function () {
  19054. return e
  19055. }, e
  19056. }(dg),
  19057. xg = function () {
  19058. this._leaves = new lc, this._root = null, this._level = 0
  19059. };
  19060. xg.prototype.buildTree = function () {
  19061. np.sort(this._leaves, new dg.NodeComparator);
  19062. for (var t = this._leaves, e = null, n = new lc;;) {
  19063. if (this.buildLevel(t, n), 1 === n.size()) return n.get(0);
  19064. e = t, t = n, n = e
  19065. }
  19066. }, xg.prototype.insert = function (t, e, n) {
  19067. if (null !== this._root) throw new Error("Index cannot be added to once it has been queried");
  19068. this._leaves.add(new _g(t, e, n))
  19069. }, xg.prototype.query = function (t, e, n) {
  19070. this.init(), this._root.query(t, e, n)
  19071. }, xg.prototype.buildRoot = function () {
  19072. if (null !== this._root) return null;
  19073. this._root = this.buildTree()
  19074. }, xg.prototype.printNode = function (t) {
  19075. Pl.out.println(Fl.toLineString(new ul(t._min, this._level), new ul(t._max, this._level)))
  19076. }, xg.prototype.init = function () {
  19077. if (null !== this._root) return null;
  19078. this.buildRoot()
  19079. }, xg.prototype.buildLevel = function (t, e) {
  19080. this._level++, e.clear();
  19081. for (var n = 0; n < t.size(); n += 2) {
  19082. var r = t.get(n);
  19083. if (null === (n + 1 < t.size() ? t.get(n) : null)) e.add(r);
  19084. else {
  19085. var i = new mg(t.get(n), t.get(n + 1));
  19086. e.add(i)
  19087. }
  19088. }
  19089. }, xg.prototype.interfaces_ = function () {
  19090. return []
  19091. }, xg.prototype.getClass = function () {
  19092. return xg
  19093. };
  19094. var Eg = function () {
  19095. this._items = new lc
  19096. };
  19097. Eg.prototype.visitItem = function (t) {
  19098. this._items.add(t)
  19099. }, Eg.prototype.getItems = function () {
  19100. return this._items
  19101. }, Eg.prototype.interfaces_ = function () {
  19102. return [Qh]
  19103. }, Eg.prototype.getClass = function () {
  19104. return Eg
  19105. };
  19106. var bg = function () {
  19107. this._index = null;
  19108. var t = arguments[0];
  19109. if (!gl(t, $c)) throw new el("Argument must be Polygonal");
  19110. this._index = new Ng(t)
  19111. },
  19112. wg = {
  19113. SegmentVisitor: {
  19114. configurable: !0
  19115. },
  19116. IntervalIndexedGeometry: {
  19117. configurable: !0
  19118. }
  19119. };
  19120. bg.prototype.locate = function (t) {
  19121. var e = new Vl(t),
  19122. n = new Ig(e);
  19123. return this._index.query(t.y, t.y, n), e.getLocation()
  19124. }, bg.prototype.interfaces_ = function () {
  19125. return [jp]
  19126. }, bg.prototype.getClass = function () {
  19127. return bg
  19128. }, wg.SegmentVisitor.get = function () {
  19129. return Ig
  19130. }, wg.IntervalIndexedGeometry.get = function () {
  19131. return Ng
  19132. }, Object.defineProperties(bg, wg);
  19133. var Ig = function () {
  19134. this._counter = null;
  19135. var t = arguments[0];
  19136. this._counter = t
  19137. };
  19138. Ig.prototype.visitItem = function (t) {
  19139. var e = t;
  19140. this._counter.countSegment(e.getCoordinate(0), e.getCoordinate(1))
  19141. }, Ig.prototype.interfaces_ = function () {
  19142. return [Qh]
  19143. }, Ig.prototype.getClass = function () {
  19144. return Ig
  19145. };
  19146. var Ng = function () {
  19147. this._index = new xg;
  19148. var t = arguments[0];
  19149. this.init(t)
  19150. };
  19151. Ng.prototype.init = function (t) {
  19152. for (var e = Cf.getLines(t).iterator(); e.hasNext();) {
  19153. var n = e.next().getCoordinates();
  19154. this.addLine(n)
  19155. }
  19156. }, Ng.prototype.addLine = function (t) {
  19157. for (var e = 1; e < t.length; e++) {
  19158. var n = new vp(t[e - 1], t[e]),
  19159. r = Math.min(n.p0.y, n.p1.y),
  19160. i = Math.max(n.p0.y, n.p1.y);
  19161. this._index.insert(r, i, n)
  19162. }
  19163. }, Ng.prototype.query = function () {
  19164. if (2 === arguments.length) {
  19165. var t = arguments[0],
  19166. e = arguments[1],
  19167. n = new Eg;
  19168. return this._index.query(t, e, n), n.getItems()
  19169. }
  19170. if (3 === arguments.length) {
  19171. var r = arguments[0],
  19172. i = arguments[1],
  19173. o = arguments[2];
  19174. this._index.query(r, i, o)
  19175. }
  19176. }, Ng.prototype.interfaces_ = function () {
  19177. return []
  19178. }, Ng.prototype.getClass = function () {
  19179. return Ng
  19180. };
  19181. var Sg = function (t) {
  19182. function e() {
  19183. if (t.call(this), this._parentGeom = null, this._lineEdgeMap = new fh, this._boundaryNodeRule = null, this._useBoundaryDeterminationRule = !0, this._argIndex = null, this._boundaryNodes = null, this._hasTooFewPoints = !1, this._invalidPoint = null, this._areaPtLocator = null, this._ptLocator = new Pf, 2 === arguments.length) {
  19184. var e = arguments[0],
  19185. n = arguments[1],
  19186. r = Ql.OGC_SFS_BOUNDARY_RULE;
  19187. this._argIndex = e, this._parentGeom = n, this._boundaryNodeRule = r, null !== n && this.add(n)
  19188. } else if (3 === arguments.length) {
  19189. var i = arguments[0],
  19190. o = arguments[1],
  19191. s = arguments[2];
  19192. this._argIndex = i, this._parentGeom = o, this._boundaryNodeRule = s, null !== o && this.add(o)
  19193. }
  19194. }
  19195. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.insertBoundaryPoint = function (t, n) {
  19196. var r = this._nodes.addNode(n).getLabel(),
  19197. i = 1;
  19198. r.getLocation(t, Sh.ON) === pl.BOUNDARY && i++;
  19199. var o = e.determineBoundary(this._boundaryNodeRule, i);
  19200. r.setLocation(t, o)
  19201. }, e.prototype.computeSelfNodes = function () {
  19202. if (2 === arguments.length) {
  19203. var t = arguments[0],
  19204. e = arguments[1];
  19205. return this.computeSelfNodes(t, e, !1)
  19206. }
  19207. if (3 === arguments.length) {
  19208. var n = arguments[0],
  19209. r = arguments[1],
  19210. i = arguments[2],
  19211. o = new fg(n, !0, !1);
  19212. o.setIsDoneIfProperInt(i);
  19213. var s = this.createEdgeSetIntersector(),
  19214. a = this._parentGeom instanceof nh || this._parentGeom instanceof th || this._parentGeom instanceof rh,
  19215. u = r || !a;
  19216. return s.computeIntersections(this._edges, o, u), this.addSelfIntersectionNodes(this._argIndex), o
  19217. }
  19218. }, e.prototype.computeSplitEdges = function (t) {
  19219. for (var e = this._edges.iterator(); e.hasNext();) {
  19220. e.next().eiList.addSplitEdges(t)
  19221. }
  19222. }, e.prototype.computeEdgeIntersections = function (t, e, n) {
  19223. var r = new fg(e, n, !0);
  19224. return r.setBoundaryNodes(this.getBoundaryNodes(), t.getBoundaryNodes()), this.createEdgeSetIntersector().computeIntersections(this._edges, t._edges, r), r
  19225. }, e.prototype.getGeometry = function () {
  19226. return this._parentGeom
  19227. }, e.prototype.getBoundaryNodeRule = function () {
  19228. return this._boundaryNodeRule
  19229. }, e.prototype.hasTooFewPoints = function () {
  19230. return this._hasTooFewPoints
  19231. }, e.prototype.addPoint = function () {
  19232. if (arguments[0] instanceof Qc) {
  19233. var t = arguments[0],
  19234. e = t.getCoordinate();
  19235. this.insertPoint(this._argIndex, e, pl.INTERIOR)
  19236. } else if (arguments[0] instanceof ul) {
  19237. var n = arguments[0];
  19238. this.insertPoint(this._argIndex, n, pl.INTERIOR)
  19239. }
  19240. }, e.prototype.addPolygon = function (t) {
  19241. this.addPolygonRing(t.getExteriorRing(), pl.EXTERIOR, pl.INTERIOR);
  19242. for (var e = 0; e < t.getNumInteriorRing(); e++) {
  19243. var n = t.getInteriorRingN(e);
  19244. this.addPolygonRing(n, pl.INTERIOR, pl.EXTERIOR)
  19245. }
  19246. }, e.prototype.addEdge = function (t) {
  19247. this.insertEdge(t);
  19248. var e = t.getCoordinates();
  19249. this.insertPoint(this._argIndex, e[0], pl.BOUNDARY), this.insertPoint(this._argIndex, e[e.length - 1], pl.BOUNDARY)
  19250. }, e.prototype.addLineString = function (t) {
  19251. var e = pc.removeRepeatedPoints(t.getCoordinates());
  19252. if (e.length < 2) return this._hasTooFewPoints = !0, this._invalidPoint = e[0], null;
  19253. var n = new of (e, new Dh(this._argIndex, pl.INTERIOR));
  19254. this._lineEdgeMap.put(t, n), this.insertEdge(n), ql.isTrue(e.length >= 2, "found LineString with single point"), this.insertBoundaryPoint(this._argIndex, e[0]), this.insertBoundaryPoint(this._argIndex, e[e.length - 1])
  19255. }, e.prototype.getInvalidPoint = function () {
  19256. return this._invalidPoint
  19257. }, e.prototype.getBoundaryPoints = function () {
  19258. for (var t = this.getBoundaryNodes(), e = new Array(t.size()).fill(null), n = 0, r = t.iterator(); r.hasNext();) {
  19259. var i = r.next();
  19260. e[n++] = i.getCoordinate().copy()
  19261. }
  19262. return e
  19263. }, e.prototype.getBoundaryNodes = function () {
  19264. return null === this._boundaryNodes && (this._boundaryNodes = this._nodes.getBoundaryNodes(this._argIndex)), this._boundaryNodes
  19265. }, e.prototype.addSelfIntersectionNode = function (t, e, n) {
  19266. if (this.isBoundaryNode(t, e)) return null;
  19267. n === pl.BOUNDARY && this._useBoundaryDeterminationRule ? this.insertBoundaryPoint(t, e) : this.insertPoint(t, e, n)
  19268. }, e.prototype.addPolygonRing = function (t, e, n) {
  19269. if (t.isEmpty()) return null;
  19270. var r = pc.removeRepeatedPoints(t.getCoordinates());
  19271. if (r.length < 4) return this._hasTooFewPoints = !0, this._invalidPoint = r[0], null;
  19272. var i = e,
  19273. o = n;
  19274. Xl.isCCW(r) && (i = n, o = e);
  19275. var s = new of (r, new Dh(this._argIndex, pl.BOUNDARY, i, o));
  19276. this._lineEdgeMap.put(t, s), this.insertEdge(s), this.insertPoint(this._argIndex, r[0], pl.BOUNDARY)
  19277. }, e.prototype.insertPoint = function (t, e, n) {
  19278. var r = this._nodes.addNode(e),
  19279. i = r.getLabel();
  19280. null === i ? r._label = new Dh(t, n) : i.setLocation(t, n)
  19281. }, e.prototype.createEdgeSetIntersector = function () {
  19282. return new gg
  19283. }, e.prototype.addSelfIntersectionNodes = function (t) {
  19284. for (var e = this._edges.iterator(); e.hasNext();)
  19285. for (var n = e.next(), r = n.getLabel().getLocation(t), i = n.eiList.iterator(); i.hasNext();) {
  19286. var o = i.next();
  19287. this.addSelfIntersectionNode(t, o.coord, r)
  19288. }
  19289. }, e.prototype.add = function () {
  19290. if (1 !== arguments.length) return t.prototype.add.apply(this, arguments);
  19291. var e = arguments[0];
  19292. if (e.isEmpty()) return null;
  19293. if (e instanceof rh && (this._useBoundaryDeterminationRule = !1), e instanceof th) this.addPolygon(e);
  19294. else if (e instanceof Zc) this.addLineString(e);
  19295. else if (e instanceof Qc) this.addPoint(e);
  19296. else if (e instanceof eh) this.addCollection(e);
  19297. else if (e instanceof Gc) this.addCollection(e);
  19298. else if (e instanceof rh) this.addCollection(e);
  19299. else {
  19300. if (!(e instanceof kc)) throw new Error(e.getClass().getName());
  19301. this.addCollection(e)
  19302. }
  19303. }, e.prototype.addCollection = function (t) {
  19304. for (var e = 0; e < t.getNumGeometries(); e++) {
  19305. var n = t.getGeometryN(e);
  19306. this.add(n)
  19307. }
  19308. }, e.prototype.locate = function (t) {
  19309. return gl(this._parentGeom, $c) && this._parentGeom.getNumGeometries() > 50 ? (null === this._areaPtLocator && (this._areaPtLocator = new bg(this._parentGeom)), this._areaPtLocator.locate(t)) : this._ptLocator.locate(t, this._parentGeom)
  19310. }, e.prototype.findEdge = function () {
  19311. if (1 === arguments.length) {
  19312. var e = arguments[0];
  19313. return this._lineEdgeMap.get(e)
  19314. }
  19315. return t.prototype.findEdge.apply(this, arguments)
  19316. }, e.prototype.interfaces_ = function () {
  19317. return []
  19318. }, e.prototype.getClass = function () {
  19319. return e
  19320. }, e.determineBoundary = function (t, e) {
  19321. return t.isInBoundary(e) ? pl.BOUNDARY : pl.INTERIOR
  19322. }, e
  19323. }(Hh),
  19324. Cg = function () {
  19325. if (this._li = new jl, this._resultPrecisionModel = null, this._arg = null, 1 === arguments.length) {
  19326. var t = arguments[0];
  19327. this.setComputationPrecision(t.getPrecisionModel()), this._arg = new Array(1).fill(null), this._arg[0] = new Sg(0, t)
  19328. } else if (2 === arguments.length) {
  19329. var e = arguments[0],
  19330. n = arguments[1],
  19331. r = Ql.OGC_SFS_BOUNDARY_RULE;
  19332. e.getPrecisionModel().compareTo(n.getPrecisionModel()) >= 0 ? this.setComputationPrecision(e.getPrecisionModel()) : this.setComputationPrecision(n.getPrecisionModel()), this._arg = new Array(2).fill(null), this._arg[0] = new Sg(0, e, r), this._arg[1] = new Sg(1, n, r)
  19333. } else if (3 === arguments.length) {
  19334. var i = arguments[0],
  19335. o = arguments[1],
  19336. s = arguments[2];
  19337. i.getPrecisionModel().compareTo(o.getPrecisionModel()) >= 0 ? this.setComputationPrecision(i.getPrecisionModel()) : this.setComputationPrecision(o.getPrecisionModel()), this._arg = new Array(2).fill(null), this._arg[0] = new Sg(0, i, s), this._arg[1] = new Sg(1, o, s)
  19338. }
  19339. };
  19340. Cg.prototype.getArgGeometry = function (t) {
  19341. return this._arg[t].getGeometry()
  19342. }, Cg.prototype.setComputationPrecision = function (t) {
  19343. this._resultPrecisionModel = t, this._li.setPrecisionModel(this._resultPrecisionModel)
  19344. }, Cg.prototype.interfaces_ = function () {
  19345. return []
  19346. }, Cg.prototype.getClass = function () {
  19347. return Cg
  19348. };
  19349. var Pg = function () {};
  19350. Pg.prototype.interfaces_ = function () {
  19351. return []
  19352. }, Pg.prototype.getClass = function () {
  19353. return Pg
  19354. }, Pg.map = function () {
  19355. if (arguments[0] instanceof Wl && gl(arguments[1], Pg.MapOp)) {
  19356. for (var t = arguments[0], e = arguments[1], n = new lc, r = 0; r < t.getNumGeometries(); r++) {
  19357. var i = e.map(t.getGeometryN(r));
  19358. null !== i && n.add(i)
  19359. }
  19360. return t.getFactory().buildGeometry(n)
  19361. }
  19362. if (gl(arguments[0], ic) && gl(arguments[1], Pg.MapOp)) {
  19363. for (var o = arguments[0], s = arguments[1], a = new lc, u = o.iterator(); u.hasNext();) {
  19364. var l = u.next(),
  19365. c = s.map(l);
  19366. null !== c && a.add(c)
  19367. }
  19368. return a
  19369. }
  19370. }, Pg.MapOp = function () {};
  19371. var Mg = function (t) {
  19372. function e() {
  19373. var e = arguments[0],
  19374. n = arguments[1];
  19375. t.call(this, e, n), this._ptLocator = new Pf, this._geomFact = null, this._resultGeom = null, this._graph = null, this._edgeList = new Jp, this._resultPolyList = new lc, this._resultLineList = new lc, this._resultPointList = new lc, this._graph = new Hh(new Hp), this._geomFact = e.getFactory()
  19376. }
  19377. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.insertUniqueEdge = function (t) {
  19378. var e = this._edgeList.findEqualEdge(t);
  19379. if (null !== e) {
  19380. var n = e.getLabel(),
  19381. r = t.getLabel();
  19382. e.isPointwiseEqual(t) || (r = new Dh(t.getLabel())).flip();
  19383. var i = e.getDepth();
  19384. i.isNull() && i.add(n), i.add(r), n.merge(r)
  19385. } else this._edgeList.add(t)
  19386. }, e.prototype.getGraph = function () {
  19387. return this._graph
  19388. }, e.prototype.cancelDuplicateResultEdges = function () {
  19389. for (var t = this._graph.getEdgeEnds().iterator(); t.hasNext();) {
  19390. var e = t.next(),
  19391. n = e.getSym();
  19392. e.isInResult() && n.isInResult() && (e.setInResult(!1), n.setInResult(!1))
  19393. }
  19394. }, e.prototype.isCoveredByLA = function (t) {
  19395. return !!this.isCovered(t, this._resultLineList) || !!this.isCovered(t, this._resultPolyList)
  19396. }, e.prototype.computeGeometry = function (t, n, r, i) {
  19397. var o = new lc;
  19398. return o.addAll(t), o.addAll(n), o.addAll(r), o.isEmpty() ? e.createEmptyResult(i, this._arg[0].getGeometry(), this._arg[1].getGeometry(), this._geomFact) : this._geomFact.buildGeometry(o)
  19399. }, e.prototype.mergeSymLabels = function () {
  19400. for (var t = this._graph.getNodes().iterator(); t.hasNext();) {
  19401. t.next().getEdges().mergeSymLabels()
  19402. }
  19403. }, e.prototype.isCovered = function (t, e) {
  19404. for (var n = e.iterator(); n.hasNext();) {
  19405. var r = n.next();
  19406. if (this._ptLocator.locate(t, r) !== pl.EXTERIOR) return !0
  19407. }
  19408. return !1
  19409. }, e.prototype.replaceCollapsedEdges = function () {
  19410. for (var t = new lc, e = this._edgeList.iterator(); e.hasNext();) {
  19411. var n = e.next();
  19412. n.isCollapsed() && (e.remove(), t.add(n.getCollapsedEdge()))
  19413. }
  19414. this._edgeList.addAll(t)
  19415. }, e.prototype.updateNodeLabelling = function () {
  19416. for (var t = this._graph.getNodes().iterator(); t.hasNext();) {
  19417. var e = t.next(),
  19418. n = e.getEdges().getLabel();
  19419. e.getLabel().merge(n)
  19420. }
  19421. }, e.prototype.getResultGeometry = function (t) {
  19422. return this.computeOverlay(t), this._resultGeom
  19423. }, e.prototype.insertUniqueEdges = function (t) {
  19424. for (var e = t.iterator(); e.hasNext();) {
  19425. var n = e.next();
  19426. this.insertUniqueEdge(n)
  19427. }
  19428. }, e.prototype.computeOverlay = function (t) {
  19429. this.copyPoints(0), this.copyPoints(1), this._arg[0].computeSelfNodes(this._li, !1), this._arg[1].computeSelfNodes(this._li, !1), this._arg[0].computeEdgeIntersections(this._arg[1], this._li, !0);
  19430. var e = new lc;
  19431. this._arg[0].computeSplitEdges(e), this._arg[1].computeSplitEdges(e), this.insertUniqueEdges(e), this.computeLabelsFromDepths(), this.replaceCollapsedEdges(), Hf.checkValid(this._edgeList.getEdges()), this._graph.addEdges(this._edgeList.getEdges()), this.computeLabelling(), this.labelIncompleteNodes(), this.findResultAreaEdges(t), this.cancelDuplicateResultEdges();
  19432. var n = new Wh(this._geomFact);
  19433. n.add(this._graph), this._resultPolyList = n.getPolygons();
  19434. var r = new Jf(this, this._geomFact, this._ptLocator);
  19435. this._resultLineList = r.build(t);
  19436. var i = new Zf(this, this._geomFact, this._ptLocator);
  19437. this._resultPointList = i.build(t), this._resultGeom = this.computeGeometry(this._resultPointList, this._resultLineList, this._resultPolyList, t)
  19438. }, e.prototype.labelIncompleteNode = function (t, e) {
  19439. var n = this._ptLocator.locate(t.getCoordinate(), this._arg[e].getGeometry());
  19440. t.getLabel().setLocation(e, n)
  19441. }, e.prototype.copyPoints = function (t) {
  19442. for (var e = this._arg[t].getNodeIterator(); e.hasNext();) {
  19443. var n = e.next();
  19444. this._graph.addNode(n.getCoordinate()).setLabel(t, n.getLabel().getLocation(t))
  19445. }
  19446. }, e.prototype.findResultAreaEdges = function (t) {
  19447. for (var n = this._graph.getEdgeEnds().iterator(); n.hasNext();) {
  19448. var r = n.next(),
  19449. i = r.getLabel();
  19450. i.isArea() && !r.isInteriorAreaEdge() && e.isResultOfOp(i.getLocation(0, Sh.RIGHT), i.getLocation(1, Sh.RIGHT), t) && r.setInResult(!0)
  19451. }
  19452. }, e.prototype.computeLabelsFromDepths = function () {
  19453. for (var t = this._edgeList.iterator(); t.hasNext();) {
  19454. var e = t.next(),
  19455. n = e.getLabel(),
  19456. r = e.getDepth();
  19457. if (!r.isNull()) {
  19458. r.normalize();
  19459. for (var i = 0; i < 2; i++) n.isNull(i) || !n.isArea() || r.isNull(i) || (0 === r.getDelta(i) ? n.toLine(i) : (ql.isTrue(!r.isNull(i, Sh.LEFT), "depth of LEFT side has not been initialized"), n.setLocation(i, Sh.LEFT, r.getLocation(i, Sh.LEFT)), ql.isTrue(!r.isNull(i, Sh.RIGHT), "depth of RIGHT side has not been initialized"), n.setLocation(i, Sh.RIGHT, r.getLocation(i, Sh.RIGHT))))
  19460. }
  19461. }
  19462. }, e.prototype.computeLabelling = function () {
  19463. for (var t = this._graph.getNodes().iterator(); t.hasNext();) {
  19464. t.next().getEdges().computeLabelling(this._arg)
  19465. }
  19466. this.mergeSymLabels(), this.updateNodeLabelling()
  19467. }, e.prototype.labelIncompleteNodes = function () {
  19468. for (var t = this._graph.getNodes().iterator(); t.hasNext();) {
  19469. var e = t.next(),
  19470. n = e.getLabel();
  19471. e.isIsolated() && (n.isNull(0) ? this.labelIncompleteNode(e, 0) : this.labelIncompleteNode(e, 1)), e.getEdges().updateLabelling(n)
  19472. }
  19473. }, e.prototype.isCoveredByA = function (t) {
  19474. return !!this.isCovered(t, this._resultPolyList)
  19475. }, e.prototype.interfaces_ = function () {
  19476. return []
  19477. }, e.prototype.getClass = function () {
  19478. return e
  19479. }, e
  19480. }(Cg);
  19481. Mg.overlayOp = function (t, e, n) {
  19482. return new Mg(t, e).getResultGeometry(n)
  19483. }, Mg.intersection = function (t, e) {
  19484. if (t.isEmpty() || e.isEmpty()) return Mg.createEmptyResult(Mg.INTERSECTION, t, e, t.getFactory());
  19485. if (t.isGeometryCollection()) {
  19486. var n = e;
  19487. return Wf.map(t, {
  19488. interfaces_: function () {
  19489. return [Pg.MapOp]
  19490. },
  19491. map: function (t) {
  19492. return t.intersection(n)
  19493. }
  19494. })
  19495. }
  19496. return t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), ug.overlayOp(t, e, Mg.INTERSECTION)
  19497. }, Mg.symDifference = function (t, e) {
  19498. if (t.isEmpty() || e.isEmpty()) {
  19499. if (t.isEmpty() && e.isEmpty()) return Mg.createEmptyResult(Mg.SYMDIFFERENCE, t, e, t.getFactory());
  19500. if (t.isEmpty()) return e.copy();
  19501. if (e.isEmpty()) return t.copy()
  19502. }
  19503. return t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), ug.overlayOp(t, e, Mg.SYMDIFFERENCE)
  19504. }, Mg.resultDimension = function (t, e, n) {
  19505. var r = e.getDimension(),
  19506. i = n.getDimension(),
  19507. o = -1;
  19508. switch (t) {
  19509. case Mg.INTERSECTION:
  19510. o = Math.min(r, i);
  19511. break;
  19512. case Mg.UNION:
  19513. o = Math.max(r, i);
  19514. break;
  19515. case Mg.DIFFERENCE:
  19516. o = r;
  19517. break;
  19518. case Mg.SYMDIFFERENCE:
  19519. o = Math.max(r, i)
  19520. }
  19521. return o
  19522. }, Mg.createEmptyResult = function (t, e, n, r) {
  19523. var i = null;
  19524. switch (Mg.resultDimension(t, e, n)) {
  19525. case -1:
  19526. i = r.createGeometryCollection(new Array(0).fill(null));
  19527. break;
  19528. case 0:
  19529. i = r.createPoint();
  19530. break;
  19531. case 1:
  19532. i = r.createLineString();
  19533. break;
  19534. case 2:
  19535. i = r.createPolygon()
  19536. }
  19537. return i
  19538. }, Mg.difference = function (t, e) {
  19539. return t.isEmpty() ? Mg.createEmptyResult(Mg.DIFFERENCE, t, e, t.getFactory()) : e.isEmpty() ? t.copy() : (t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), ug.overlayOp(t, e, Mg.DIFFERENCE))
  19540. }, Mg.isResultOfOp = function () {
  19541. if (2 === arguments.length) {
  19542. var t = arguments[0],
  19543. e = arguments[1],
  19544. n = t.getLocation(0),
  19545. r = t.getLocation(1);
  19546. return Mg.isResultOfOp(n, r, e)
  19547. }
  19548. if (3 === arguments.length) {
  19549. var i = arguments[0],
  19550. o = arguments[1],
  19551. s = arguments[2];
  19552. switch (i === pl.BOUNDARY && (i = pl.INTERIOR), o === pl.BOUNDARY && (o = pl.INTERIOR), s) {
  19553. case Mg.INTERSECTION:
  19554. return i === pl.INTERIOR && o === pl.INTERIOR;
  19555. case Mg.UNION:
  19556. return i === pl.INTERIOR || o === pl.INTERIOR;
  19557. case Mg.DIFFERENCE:
  19558. return i === pl.INTERIOR && o !== pl.INTERIOR;
  19559. case Mg.SYMDIFFERENCE:
  19560. return i === pl.INTERIOR && o !== pl.INTERIOR || i !== pl.INTERIOR && o === pl.INTERIOR
  19561. }
  19562. return !1
  19563. }
  19564. }, Mg.INTERSECTION = 1, Mg.UNION = 2, Mg.DIFFERENCE = 3, Mg.SYMDIFFERENCE = 4;
  19565. var Lg = function () {
  19566. this._g = null, this._boundaryDistanceTolerance = null, this._linework = null, this._ptLocator = new Pf, this._seg = new vp;
  19567. var t = arguments[0],
  19568. e = arguments[1];
  19569. this._g = t, this._boundaryDistanceTolerance = e, this._linework = this.extractLinework(t)
  19570. };
  19571. Lg.prototype.isWithinToleranceOfBoundary = function (t) {
  19572. for (var e = this, n = 0; n < this._linework.getNumGeometries(); n++)
  19573. for (var r = e._linework.getGeometryN(n).getCoordinateSequence(), i = 0; i < r.size() - 1; i++) {
  19574. if (r.getCoordinate(i, e._seg.p0), r.getCoordinate(i + 1, e._seg.p1), e._seg.distance(t) <= e._boundaryDistanceTolerance) return !0
  19575. }
  19576. return !1
  19577. }, Lg.prototype.getLocation = function (t) {
  19578. return this.isWithinToleranceOfBoundary(t) ? pl.BOUNDARY : this._ptLocator.locate(t, this._g)
  19579. }, Lg.prototype.extractLinework = function (t) {
  19580. var e = new Og;
  19581. t.apply(e);
  19582. var n = e.getLinework(),
  19583. r = _h.toLineStringArray(n);
  19584. return t.getFactory().createMultiLineString(r)
  19585. }, Lg.prototype.interfaces_ = function () {
  19586. return []
  19587. }, Lg.prototype.getClass = function () {
  19588. return Lg
  19589. };
  19590. var Og = function () {
  19591. this._linework = null, this._linework = new lc
  19592. };
  19593. Og.prototype.getLinework = function () {
  19594. return this._linework
  19595. }, Og.prototype.filter = function (t) {
  19596. if (t instanceof th) {
  19597. var e = t;
  19598. this._linework.add(e.getExteriorRing());
  19599. for (var n = 0; n < e.getNumInteriorRing(); n++) this._linework.add(e.getInteriorRingN(n))
  19600. }
  19601. }, Og.prototype.interfaces_ = function () {
  19602. return [Dc]
  19603. }, Og.prototype.getClass = function () {
  19604. return Og
  19605. };
  19606. var Rg = function () {
  19607. this._g = null, this._doLeft = !0, this._doRight = !0;
  19608. var t = arguments[0];
  19609. this._g = t
  19610. };
  19611. Rg.prototype.extractPoints = function (t, e, n) {
  19612. for (var r = t.getCoordinates(), i = 0; i < r.length - 1; i++) this.computeOffsetPoints(r[i], r[i + 1], e, n)
  19613. }, Rg.prototype.setSidesToGenerate = function (t, e) {
  19614. this._doLeft = t, this._doRight = e
  19615. }, Rg.prototype.getPoints = function (t) {
  19616. for (var e = new lc, n = Cf.getLines(this._g).iterator(); n.hasNext();) {
  19617. var r = n.next();
  19618. this.extractPoints(r, t, e)
  19619. }
  19620. return e
  19621. }, Rg.prototype.computeOffsetPoints = function (t, e, n, r) {
  19622. var i = e.x - t.x,
  19623. o = e.y - t.y,
  19624. s = Math.sqrt(i * i + o * o),
  19625. a = n * i / s,
  19626. u = n * o / s,
  19627. l = (e.x + t.x) / 2,
  19628. c = (e.y + t.y) / 2;
  19629. if (this._doLeft) {
  19630. var h = new ul(l - u, c + a);
  19631. r.add(h)
  19632. }
  19633. if (this._doRight) {
  19634. var p = new ul(l + u, c - a);
  19635. r.add(p)
  19636. }
  19637. }, Rg.prototype.interfaces_ = function () {
  19638. return []
  19639. }, Rg.prototype.getClass = function () {
  19640. return Rg
  19641. };
  19642. var Tg = function t() {
  19643. this._geom = null, this._locFinder = null, this._location = new Array(3).fill(null), this._invalidLocation = null, this._boundaryDistanceTolerance = t.TOLERANCE, this._testCoords = new lc;
  19644. var e = arguments[0],
  19645. n = arguments[1],
  19646. r = arguments[2];
  19647. this._boundaryDistanceTolerance = t.computeBoundaryDistanceTolerance(e, n), this._geom = [e, n, r], this._locFinder = [new Lg(this._geom[0], this._boundaryDistanceTolerance), new Lg(this._geom[1], this._boundaryDistanceTolerance), new Lg(this._geom[2], this._boundaryDistanceTolerance)]
  19648. },
  19649. Ag = {
  19650. TOLERANCE: {
  19651. configurable: !0
  19652. }
  19653. };
  19654. Tg.prototype.reportResult = function (t, e, n) {
  19655. Pl.out.println("Overlay result invalid - A:" + pl.toLocationSymbol(e[0]) + " B:" + pl.toLocationSymbol(e[1]) + " expected:" + (n ? "i" : "e") + " actual:" + pl.toLocationSymbol(e[2]))
  19656. }, Tg.prototype.isValid = function (t) {
  19657. this.addTestPts(this._geom[0]), this.addTestPts(this._geom[1]);
  19658. var e = this.checkValid(t);
  19659. return e
  19660. }, Tg.prototype.checkValid = function () {
  19661. var t = this;
  19662. if (1 === arguments.length) {
  19663. for (var e = arguments[0], n = 0; n < this._testCoords.size(); n++) {
  19664. var r = t._testCoords.get(n);
  19665. if (!t.checkValid(e, r)) return t._invalidLocation = r, !1
  19666. }
  19667. return !0
  19668. }
  19669. if (2 === arguments.length) {
  19670. var i = arguments[0],
  19671. o = arguments[1];
  19672. return this._location[0] = this._locFinder[0].getLocation(o), this._location[1] = this._locFinder[1].getLocation(o), this._location[2] = this._locFinder[2].getLocation(o), !!Tg.hasLocation(this._location, pl.BOUNDARY) || this.isValidResult(i, this._location)
  19673. }
  19674. }, Tg.prototype.addTestPts = function (t) {
  19675. var e = new Rg(t);
  19676. this._testCoords.addAll(e.getPoints(5 * this._boundaryDistanceTolerance))
  19677. }, Tg.prototype.isValidResult = function (t, e) {
  19678. var n = Mg.isResultOfOp(e[0], e[1], t),
  19679. r = !(n ^ e[2] === pl.INTERIOR);
  19680. return r || this.reportResult(t, e, n), r
  19681. }, Tg.prototype.getInvalidLocation = function () {
  19682. return this._invalidLocation
  19683. }, Tg.prototype.interfaces_ = function () {
  19684. return []
  19685. }, Tg.prototype.getClass = function () {
  19686. return Tg
  19687. }, Tg.hasLocation = function (t, e) {
  19688. for (var n = 0; n < 3; n++)
  19689. if (t[n] === e) return !0;
  19690. return !1
  19691. }, Tg.computeBoundaryDistanceTolerance = function (t, e) {
  19692. return Math.min($f.computeSizeBasedSnapTolerance(t), $f.computeSizeBasedSnapTolerance(e))
  19693. }, Tg.isValid = function (t, e, n, r) {
  19694. return new Tg(t, e, r).isValid(n)
  19695. }, Ag.TOLERANCE.get = function () {
  19696. return 1e-6
  19697. }, Object.defineProperties(Tg, Ag);
  19698. var Dg = function t(e) {
  19699. this._geomFactory = null, this._skipEmpty = !1, this._inputGeoms = null, this._geomFactory = t.extractFactory(e), this._inputGeoms = e
  19700. };
  19701. Dg.prototype.extractElements = function (t, e) {
  19702. if (null === t) return null;
  19703. for (var n = 0; n < t.getNumGeometries(); n++) {
  19704. var r = t.getGeometryN(n);
  19705. this._skipEmpty && r.isEmpty() || e.add(r)
  19706. }
  19707. }, Dg.prototype.combine = function () {
  19708. for (var t = new lc, e = this._inputGeoms.iterator(); e.hasNext();) {
  19709. var n = e.next();
  19710. this.extractElements(n, t)
  19711. }
  19712. return 0 === t.size() ? null !== this._geomFactory ? this._geomFactory.createGeometryCollection(null) : null : this._geomFactory.buildGeometry(t)
  19713. }, Dg.prototype.interfaces_ = function () {
  19714. return []
  19715. }, Dg.prototype.getClass = function () {
  19716. return Dg
  19717. }, Dg.combine = function () {
  19718. if (1 === arguments.length) {
  19719. var t = arguments[0],
  19720. e = new Dg(t);
  19721. return e.combine()
  19722. }
  19723. if (2 === arguments.length) {
  19724. var n = arguments[0],
  19725. r = arguments[1],
  19726. i = new Dg(Dg.createList(n, r));
  19727. return i.combine()
  19728. }
  19729. if (3 === arguments.length) {
  19730. var o = arguments[0],
  19731. s = arguments[1],
  19732. a = arguments[2],
  19733. u = new Dg(Dg.createList(o, s, a));
  19734. return u.combine()
  19735. }
  19736. }, Dg.extractFactory = function (t) {
  19737. return t.isEmpty() ? null : t.iterator().next().getFactory()
  19738. }, Dg.createList = function () {
  19739. if (2 === arguments.length) {
  19740. var t = arguments[0],
  19741. e = arguments[1],
  19742. n = new lc;
  19743. return n.add(t), n.add(e), n
  19744. }
  19745. if (3 === arguments.length) {
  19746. var r = arguments[0],
  19747. i = arguments[1],
  19748. o = arguments[2],
  19749. s = new lc;
  19750. return s.add(r), s.add(i), s.add(o), s
  19751. }
  19752. };
  19753. var Fg = function () {
  19754. this._inputPolys = null, this._geomFactory = null;
  19755. var t = arguments[0];
  19756. this._inputPolys = t, null === this._inputPolys && (this._inputPolys = new lc)
  19757. },
  19758. kg = {
  19759. STRTREE_NODE_CAPACITY: {
  19760. configurable: !0
  19761. }
  19762. };
  19763. Fg.prototype.reduceToGeometries = function (t) {
  19764. for (var e = new lc, n = t.iterator(); n.hasNext();) {
  19765. var r = n.next(),
  19766. i = null;
  19767. gl(r, ac) ? i = this.unionTree(r) : r instanceof Wl && (i = r), e.add(i)
  19768. }
  19769. return e
  19770. }, Fg.prototype.extractByEnvelope = function (t, e, n) {
  19771. for (var r = new lc, i = 0; i < e.getNumGeometries(); i++) {
  19772. var o = e.getGeometryN(i);
  19773. o.getEnvelopeInternal().intersects(t) ? r.add(o) : n.add(o)
  19774. }
  19775. return this._geomFactory.buildGeometry(r)
  19776. }, Fg.prototype.unionOptimized = function (t, e) {
  19777. var n = t.getEnvelopeInternal(),
  19778. r = e.getEnvelopeInternal();
  19779. if (!n.intersects(r)) return Dg.combine(t, e);
  19780. if (t.getNumGeometries() <= 1 && e.getNumGeometries() <= 1) return this.unionActual(t, e);
  19781. var i = n.intersection(r);
  19782. return this.unionUsingEnvelopeIntersection(t, e, i)
  19783. }, Fg.prototype.union = function () {
  19784. if (null === this._inputPolys) throw new Error("union() method cannot be called twice");
  19785. if (this._inputPolys.isEmpty()) return null;
  19786. this._geomFactory = this._inputPolys.iterator().next().getFactory();
  19787. for (var t = new up(Fg.STRTREE_NODE_CAPACITY), e = this._inputPolys.iterator(); e.hasNext();) {
  19788. var n = e.next();
  19789. t.insert(n.getEnvelopeInternal(), n)
  19790. }
  19791. this._inputPolys = null;
  19792. var r = t.itemsTree();
  19793. return this.unionTree(r)
  19794. }, Fg.prototype.binaryUnion = function () {
  19795. if (1 === arguments.length) {
  19796. var t = arguments[0];
  19797. return this.binaryUnion(t, 0, t.size())
  19798. }
  19799. if (3 === arguments.length) {
  19800. var e = arguments[0],
  19801. n = arguments[1],
  19802. r = arguments[2];
  19803. if (r - n <= 1) {
  19804. var i = Fg.getGeometry(e, n);
  19805. return this.unionSafe(i, null)
  19806. }
  19807. if (r - n == 2) return this.unionSafe(Fg.getGeometry(e, n), Fg.getGeometry(e, n + 1));
  19808. var o = Math.trunc((r + n) / 2),
  19809. s = this.binaryUnion(e, n, o),
  19810. a = this.binaryUnion(e, o, r);
  19811. return this.unionSafe(s, a)
  19812. }
  19813. }, Fg.prototype.repeatedUnion = function (t) {
  19814. for (var e = null, n = t.iterator(); n.hasNext();) {
  19815. var r = n.next();
  19816. e = null === e ? r.copy() : e.union(r)
  19817. }
  19818. return e
  19819. }, Fg.prototype.unionSafe = function (t, e) {
  19820. return null === t && null === e ? null : null === t ? e.copy() : null === e ? t.copy() : this.unionOptimized(t, e)
  19821. }, Fg.prototype.unionActual = function (t, e) {
  19822. return Fg.restrictToPolygons(t.union(e))
  19823. }, Fg.prototype.unionTree = function (t) {
  19824. var e = this.reduceToGeometries(t);
  19825. return this.binaryUnion(e)
  19826. }, Fg.prototype.unionUsingEnvelopeIntersection = function (t, e, n) {
  19827. var r = new lc,
  19828. i = this.extractByEnvelope(n, t, r),
  19829. o = this.extractByEnvelope(n, e, r),
  19830. s = this.unionActual(i, o);
  19831. return r.add(s), Dg.combine(r)
  19832. }, Fg.prototype.bufferUnion = function () {
  19833. if (1 === arguments.length) {
  19834. var t = arguments[0],
  19835. e = t.get(0).getFactory(),
  19836. n = e.buildGeometry(t),
  19837. r = n.buffer(0);
  19838. return r
  19839. }
  19840. if (2 === arguments.length) {
  19841. var i = arguments[0],
  19842. o = arguments[1],
  19843. s = i.getFactory(),
  19844. a = s.createGeometryCollection([i, o]),
  19845. u = a.buffer(0);
  19846. return u
  19847. }
  19848. }, Fg.prototype.interfaces_ = function () {
  19849. return []
  19850. }, Fg.prototype.getClass = function () {
  19851. return Fg
  19852. }, Fg.restrictToPolygons = function (t) {
  19853. if (gl(t, $c)) return t;
  19854. var e = Sf.getPolygons(t);
  19855. return 1 === e.size() ? e.get(0) : t.getFactory().createMultiPolygon(_h.toPolygonArray(e))
  19856. }, Fg.getGeometry = function (t, e) {
  19857. return e >= t.size() ? null : t.get(e)
  19858. }, Fg.union = function (t) {
  19859. return new Fg(t).union()
  19860. }, kg.STRTREE_NODE_CAPACITY.get = function () {
  19861. return 4
  19862. }, Object.defineProperties(Fg, kg);
  19863. var Gg = function () {};
  19864. function qg() {
  19865. return new Bg
  19866. }
  19867. function Bg() {
  19868. this.reset()
  19869. }
  19870. Gg.prototype.interfaces_ = function () {
  19871. return []
  19872. }, Gg.prototype.getClass = function () {
  19873. return Gg
  19874. }, Gg.union = function (t, e) {
  19875. if (t.isEmpty() || e.isEmpty()) {
  19876. if (t.isEmpty() && e.isEmpty()) return Mg.createEmptyResult(Mg.UNION, t, e, t.getFactory());
  19877. if (t.isEmpty()) return e.copy();
  19878. if (e.isEmpty()) return t.copy()
  19879. }
  19880. return t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), ug.overlayOp(t, e, Mg.UNION)
  19881. }, Bg.prototype = {
  19882. constructor: Bg,
  19883. reset: function () {
  19884. this.s = this.t = 0
  19885. },
  19886. add: function (t) {
  19887. jg(zg, t, this.t), jg(this, zg.s, this.s), this.s ? this.t += zg.t : this.s = zg.t
  19888. },
  19889. valueOf: function () {
  19890. return this.s
  19891. }
  19892. };
  19893. var zg = new Bg;
  19894. function jg(t, e, n) {
  19895. var r = t.s = e + n,
  19896. i = r - e,
  19897. o = r - i;
  19898. t.t = e - o + (n - i)
  19899. }
  19900. var Ug = 1e-6,
  19901. Vg = Math.PI,
  19902. Xg = Vg / 2,
  19903. Yg = Vg / 4,
  19904. Hg = 2 * Vg,
  19905. Wg = 180 / Vg,
  19906. Jg = Vg / 180,
  19907. Zg = Math.abs,
  19908. Kg = Math.atan,
  19909. Qg = Math.atan2,
  19910. $g = Math.cos,
  19911. td = Math.sin,
  19912. ed = Math.sqrt;
  19913. function nd(t) {
  19914. return t > 1 ? 0 : t < -1 ? Vg : Math.acos(t)
  19915. }
  19916. function rd(t) {
  19917. return t > 1 ? Xg : t < -1 ? -Xg : Math.asin(t)
  19918. }
  19919. function id() {}
  19920. function od(t, e) {
  19921. t && ad.hasOwnProperty(t.type) && ad[t.type](t, e)
  19922. }
  19923. var sd = {
  19924. Feature: function (t, e) {
  19925. od(t.geometry, e)
  19926. },
  19927. FeatureCollection: function (t, e) {
  19928. for (var n = t.features, r = -1, i = n.length; ++r < i;) od(n[r].geometry, e)
  19929. }
  19930. },
  19931. ad = {
  19932. Sphere: function (t, e) {
  19933. e.sphere()
  19934. },
  19935. Point: function (t, e) {
  19936. t = t.coordinates, e.point(t[0], t[1], t[2])
  19937. },
  19938. MultiPoint: function (t, e) {
  19939. for (var n = t.coordinates, r = -1, i = n.length; ++r < i;) t = n[r], e.point(t[0], t[1], t[2])
  19940. },
  19941. LineString: function (t, e) {
  19942. ud(t.coordinates, e, 0)
  19943. },
  19944. MultiLineString: function (t, e) {
  19945. for (var n = t.coordinates, r = -1, i = n.length; ++r < i;) ud(n[r], e, 0)
  19946. },
  19947. Polygon: function (t, e) {
  19948. ld(t.coordinates, e)
  19949. },
  19950. MultiPolygon: function (t, e) {
  19951. for (var n = t.coordinates, r = -1, i = n.length; ++r < i;) ld(n[r], e)
  19952. },
  19953. GeometryCollection: function (t, e) {
  19954. for (var n = t.geometries, r = -1, i = n.length; ++r < i;) od(n[r], e)
  19955. }
  19956. };
  19957. function ud(t, e, n) {
  19958. var r, i = -1,
  19959. o = t.length - n;
  19960. for (e.lineStart(); ++i < o;) r = t[i], e.point(r[0], r[1], r[2]);
  19961. e.lineEnd()
  19962. }
  19963. function ld(t, e) {
  19964. var n = -1,
  19965. r = t.length;
  19966. for (e.polygonStart(); ++n < r;) ud(t[n], e, 1);
  19967. e.polygonEnd()
  19968. }
  19969. qg(), qg();
  19970. function cd(t) {
  19971. return [Qg(t[1], t[0]), rd(t[2])]
  19972. }
  19973. function hd(t) {
  19974. var e = t[0],
  19975. n = t[1],
  19976. r = $g(n);
  19977. return [r * $g(e), r * td(e), td(n)]
  19978. }
  19979. function pd(t, e) {
  19980. return t[0] * e[0] + t[1] * e[1] + t[2] * e[2]
  19981. }
  19982. function fd(t, e) {
  19983. return [t[1] * e[2] - t[2] * e[1], t[2] * e[0] - t[0] * e[2], t[0] * e[1] - t[1] * e[0]]
  19984. }
  19985. function gd(t, e) {
  19986. t[0] += e[0], t[1] += e[1], t[2] += e[2]
  19987. }
  19988. function dd(t, e) {
  19989. return [t[0] * e, t[1] * e, t[2] * e]
  19990. }
  19991. function yd(t) {
  19992. var e = ed(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);
  19993. t[0] /= e, t[1] /= e, t[2] /= e
  19994. }
  19995. qg();
  19996. function vd(t, e) {
  19997. function n(n, r) {
  19998. return n = t(n, r), e(n[0], n[1])
  19999. }
  20000. return t.invert && e.invert && (n.invert = function (n, r) {
  20001. return (n = e.invert(n, r)) && t.invert(n[0], n[1])
  20002. }), n
  20003. }
  20004. function _d(t, e) {
  20005. return [t > Vg ? t - Hg : t < -Vg ? t + Hg : t, e]
  20006. }
  20007. function md(t) {
  20008. return function (e, n) {
  20009. return [(e += t) > Vg ? e - Hg : e < -Vg ? e + Hg : e, n]
  20010. }
  20011. }
  20012. function xd(t) {
  20013. var e = md(t);
  20014. return e.invert = md(-t), e
  20015. }
  20016. function Ed(t, e) {
  20017. var n = $g(t),
  20018. r = td(t),
  20019. i = $g(e),
  20020. o = td(e);
  20021. function s(t, e) {
  20022. var s = $g(e),
  20023. a = $g(t) * s,
  20024. u = td(t) * s,
  20025. l = td(e),
  20026. c = l * n + a * r;
  20027. return [Qg(u * i - c * o, a * n - l * r), rd(c * i + u * o)]
  20028. }
  20029. return s.invert = function (t, e) {
  20030. var s = $g(e),
  20031. a = $g(t) * s,
  20032. u = td(t) * s,
  20033. l = td(e),
  20034. c = l * i - u * o;
  20035. return [Qg(u * i + l * o, a * n + c * r), rd(c * n - a * r)]
  20036. }, s
  20037. }
  20038. function bd(t, e) {
  20039. (e = hd(e))[0] -= t, yd(e);
  20040. var n = nd(-e[1]);
  20041. return ((-e[2] < 0 ? -n : n) + Hg - Ug) % Hg
  20042. }
  20043. function wd() {
  20044. var t, e = [];
  20045. return {
  20046. point: function (e, n) {
  20047. t.push([e, n])
  20048. },
  20049. lineStart: function () {
  20050. e.push(t = [])
  20051. },
  20052. lineEnd: id,
  20053. rejoin: function () {
  20054. e.length > 1 && e.push(e.pop().concat(e.shift()))
  20055. },
  20056. result: function () {
  20057. var n = e;
  20058. return e = [], t = null, n
  20059. }
  20060. }
  20061. }
  20062. function Id(t, e) {
  20063. return Zg(t[0] - e[0]) < Ug && Zg(t[1] - e[1]) < Ug
  20064. }
  20065. function Nd(t, e, n, r) {
  20066. this.x = t, this.z = e, this.o = n, this.e = r, this.v = !1, this.n = this.p = null
  20067. }
  20068. function Sd(t, e, n, r, i) {
  20069. var o, s, a = [],
  20070. u = [];
  20071. if (t.forEach((function (t) {
  20072. if (!((e = t.length - 1) <= 0)) {
  20073. var e, n, r = t[0],
  20074. s = t[e];
  20075. if (Id(r, s)) {
  20076. for (i.lineStart(), o = 0; o < e; ++o) i.point((r = t[o])[0], r[1]);
  20077. i.lineEnd()
  20078. } else a.push(n = new Nd(r, t, null, !0)), u.push(n.o = new Nd(r, null, n, !1)), a.push(n = new Nd(s, t, null, !1)), u.push(n.o = new Nd(s, null, n, !0))
  20079. }
  20080. })), a.length) {
  20081. for (u.sort(e), Cd(a), Cd(u), o = 0, s = u.length; o < s; ++o) u[o].e = n = !n;
  20082. for (var l, c, h = a[0];;) {
  20083. for (var p = h, f = !0; p.v;)
  20084. if ((p = p.n) === h) return;
  20085. l = p.z, i.lineStart();
  20086. do {
  20087. if (p.v = p.o.v = !0, p.e) {
  20088. if (f)
  20089. for (o = 0, s = l.length; o < s; ++o) i.point((c = l[o])[0], c[1]);
  20090. else r(p.x, p.n.x, 1, i);
  20091. p = p.n
  20092. } else {
  20093. if (f)
  20094. for (l = p.p.z, o = l.length - 1; o >= 0; --o) i.point((c = l[o])[0], c[1]);
  20095. else r(p.x, p.p.x, -1, i);
  20096. p = p.p
  20097. }
  20098. l = (p = p.o).z, f = !f
  20099. } while (!p.v);
  20100. i.lineEnd()
  20101. }
  20102. }
  20103. }
  20104. function Cd(t) {
  20105. if (e = t.length) {
  20106. for (var e, n, r = 0, i = t[0]; ++r < e;) i.n = n = t[r], n.p = i, i = n;
  20107. i.n = n = t[0], n.p = i
  20108. }
  20109. }
  20110. function Pd(t, e) {
  20111. return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN
  20112. }
  20113. _d.invert = _d;
  20114. var Md, Ld;
  20115. 1 === (Md = Pd).length && (Ld = Md, Md = function (t, e) {
  20116. return Pd(Ld(t), e)
  20117. });
  20118. function Od(t) {
  20119. for (var e, n, r, i = t.length, o = -1, s = 0; ++o < i;) s += t[o].length;
  20120. for (n = new Array(s); --i >= 0;)
  20121. for (e = (r = t[i]).length; --e >= 0;) n[--s] = r[e];
  20122. return n
  20123. }
  20124. var Rd = 1e9,
  20125. Td = -Rd;
  20126. function Ad(t, e, n, r) {
  20127. function i(i, o) {
  20128. return t <= i && i <= n && e <= o && o <= r
  20129. }
  20130. function o(i, o, a, l) {
  20131. var c = 0,
  20132. h = 0;
  20133. if (null == i || (c = s(i, a)) !== (h = s(o, a)) || u(i, o) < 0 ^ a > 0)
  20134. do {
  20135. l.point(0 === c || 3 === c ? t : n, c > 1 ? r : e)
  20136. } while ((c = (c + a + 4) % 4) !== h);
  20137. else l.point(o[0], o[1])
  20138. }
  20139. function s(r, i) {
  20140. return Zg(r[0] - t) < Ug ? i > 0 ? 0 : 3 : Zg(r[0] - n) < Ug ? i > 0 ? 2 : 1 : Zg(r[1] - e) < Ug ? i > 0 ? 1 : 0 : i > 0 ? 3 : 2
  20141. }
  20142. function a(t, e) {
  20143. return u(t.x, e.x)
  20144. }
  20145. function u(t, e) {
  20146. var n = s(t, 1),
  20147. r = s(e, 1);
  20148. return n !== r ? n - r : 0 === n ? e[1] - t[1] : 1 === n ? t[0] - e[0] : 2 === n ? t[1] - e[1] : e[0] - t[0]
  20149. }
  20150. return function (s) {
  20151. var u, l, c, h, p, f, g, d, y, v, _, m = s,
  20152. x = wd(),
  20153. E = {
  20154. point: b,
  20155. lineStart: function () {
  20156. E.point = w, l && l.push(c = []);
  20157. v = !0, y = !1, g = d = NaN
  20158. },
  20159. lineEnd: function () {
  20160. u && (w(h, p), f && y && x.rejoin(), u.push(x.result()));
  20161. E.point = b, y && m.lineEnd()
  20162. },
  20163. polygonStart: function () {
  20164. m = x, u = [], l = [], _ = !0
  20165. },
  20166. polygonEnd: function () {
  20167. var e = function () {
  20168. for (var e = 0, n = 0, i = l.length; n < i; ++n)
  20169. for (var o, s, a = l[n], u = 1, c = a.length, h = a[0], p = h[0], f = h[1]; u < c; ++u) o = p, s = f, p = (h = a[u])[0], f = h[1], s <= r ? f > r && (p - o) * (r - s) > (f - s) * (t - o) && ++e : f <= r && (p - o) * (r - s) < (f - s) * (t - o) && --e;
  20170. return e
  20171. }(),
  20172. n = _ && e,
  20173. i = (u = Od(u)).length;
  20174. (n || i) && (s.polygonStart(), n && (s.lineStart(), o(null, null, 1, s), s.lineEnd()), i && Sd(u, a, e, o, s), s.polygonEnd());
  20175. m = s, u = l = c = null
  20176. }
  20177. };
  20178. function b(t, e) {
  20179. i(t, e) && m.point(t, e)
  20180. }
  20181. function w(o, s) {
  20182. var a = i(o, s);
  20183. if (l && c.push([o, s]), v) h = o, p = s, f = a, v = !1, a && (m.lineStart(), m.point(o, s));
  20184. else if (a && y) m.point(o, s);
  20185. else {
  20186. var u = [g = Math.max(Td, Math.min(Rd, g)), d = Math.max(Td, Math.min(Rd, d))],
  20187. x = [o = Math.max(Td, Math.min(Rd, o)), s = Math.max(Td, Math.min(Rd, s))];
  20188. ! function (t, e, n, r, i, o) {
  20189. var s, a = t[0],
  20190. u = t[1],
  20191. l = 0,
  20192. c = 1,
  20193. h = e[0] - a,
  20194. p = e[1] - u;
  20195. if (s = n - a, h || !(s > 0)) {
  20196. if (s /= h, h < 0) {
  20197. if (s < l) return;
  20198. s < c && (c = s)
  20199. } else if (h > 0) {
  20200. if (s > c) return;
  20201. s > l && (l = s)
  20202. }
  20203. if (s = i - a, h || !(s < 0)) {
  20204. if (s /= h, h < 0) {
  20205. if (s > c) return;
  20206. s > l && (l = s)
  20207. } else if (h > 0) {
  20208. if (s < l) return;
  20209. s < c && (c = s)
  20210. }
  20211. if (s = r - u, p || !(s > 0)) {
  20212. if (s /= p, p < 0) {
  20213. if (s < l) return;
  20214. s < c && (c = s)
  20215. } else if (p > 0) {
  20216. if (s > c) return;
  20217. s > l && (l = s)
  20218. }
  20219. if (s = o - u, p || !(s < 0)) {
  20220. if (s /= p, p < 0) {
  20221. if (s > c) return;
  20222. s > l && (l = s)
  20223. } else if (p > 0) {
  20224. if (s < l) return;
  20225. s < c && (c = s)
  20226. }
  20227. return l > 0 && (t[0] = a + l * h, t[1] = u + l * p), c < 1 && (e[0] = a + c * h, e[1] = u + c * p), !0
  20228. }
  20229. }
  20230. }
  20231. }
  20232. }(u, x, t, e, n, r) ? a && (m.lineStart(), m.point(o, s), _ = !1): (y || (m.lineStart(), m.point(u[0], u[1])), m.point(x[0], x[1]), a || m.lineEnd(), _ = !1)
  20233. }
  20234. g = o, d = s, y = a
  20235. }
  20236. return E
  20237. }
  20238. }
  20239. var Dd = qg();
  20240. qg();
  20241. function Fd(t) {
  20242. return t
  20243. }
  20244. qg(), qg();
  20245. var kd = 1 / 0,
  20246. Gd = kd,
  20247. qd = -kd,
  20248. Bd = qd,
  20249. zd = {
  20250. point: function (t, e) {
  20251. t < kd && (kd = t);
  20252. t > qd && (qd = t);
  20253. e < Gd && (Gd = e);
  20254. e > Bd && (Bd = e)
  20255. },
  20256. lineStart: id,
  20257. lineEnd: id,
  20258. polygonStart: id,
  20259. polygonEnd: id,
  20260. result: function () {
  20261. var t = [
  20262. [kd, Gd],
  20263. [qd, Bd]
  20264. ];
  20265. return qd = Bd = -(Gd = kd = 1 / 0), t
  20266. }
  20267. };
  20268. qg();
  20269. function jd(t, e, n, r) {
  20270. return function (i, o) {
  20271. var s, a, u, l = e(o),
  20272. c = i.invert(r[0], r[1]),
  20273. h = wd(),
  20274. p = e(h),
  20275. f = !1,
  20276. g = {
  20277. point: d,
  20278. lineStart: v,
  20279. lineEnd: _,
  20280. polygonStart: function () {
  20281. g.point = m, g.lineStart = x, g.lineEnd = E, a = [], s = []
  20282. },
  20283. polygonEnd: function () {
  20284. g.point = d, g.lineStart = v, g.lineEnd = _, a = Od(a);
  20285. var t = function (t, e) {
  20286. var n = e[0],
  20287. r = e[1],
  20288. i = [td(n), -$g(n), 0],
  20289. o = 0,
  20290. s = 0;
  20291. Dd.reset();
  20292. for (var a = 0, u = t.length; a < u; ++a)
  20293. if (c = (l = t[a]).length)
  20294. for (var l, c, h = l[c - 1], p = h[0], f = h[1] / 2 + Yg, g = td(f), d = $g(f), y = 0; y < c; ++y, p = _, g = x, d = E, h = v) {
  20295. var v = l[y],
  20296. _ = v[0],
  20297. m = v[1] / 2 + Yg,
  20298. x = td(m),
  20299. E = $g(m),
  20300. b = _ - p,
  20301. w = b >= 0 ? 1 : -1,
  20302. I = w * b,
  20303. N = I > Vg,
  20304. S = g * x;
  20305. if (Dd.add(Qg(S * w * td(I), d * E + S * $g(I))), o += N ? b + w * Hg : b, N ^ p >= n ^ _ >= n) {
  20306. var C = fd(hd(h), hd(v));
  20307. yd(C);
  20308. var P = fd(i, C);
  20309. yd(P);
  20310. var M = (N ^ b >= 0 ? -1 : 1) * rd(P[2]);
  20311. (r > M || r === M && (C[0] || C[1])) && (s += N ^ b >= 0 ? 1 : -1)
  20312. }
  20313. }
  20314. return (o < -1e-6 || o < Ug && Dd < -1e-6) ^ 1 & s
  20315. }(s, c);
  20316. a.length ? (f || (o.polygonStart(), f = !0), Sd(a, Vd, t, n, o)) : t && (f || (o.polygonStart(), f = !0), o.lineStart(), n(null, null, 1, o), o.lineEnd()), f && (o.polygonEnd(), f = !1), a = s = null
  20317. },
  20318. sphere: function () {
  20319. o.polygonStart(), o.lineStart(), n(null, null, 1, o), o.lineEnd(), o.polygonEnd()
  20320. }
  20321. };
  20322. function d(e, n) {
  20323. var r = i(e, n);
  20324. t(e = r[0], n = r[1]) && o.point(e, n)
  20325. }
  20326. function y(t, e) {
  20327. var n = i(t, e);
  20328. l.point(n[0], n[1])
  20329. }
  20330. function v() {
  20331. g.point = y, l.lineStart()
  20332. }
  20333. function _() {
  20334. g.point = d, l.lineEnd()
  20335. }
  20336. function m(t, e) {
  20337. u.push([t, e]);
  20338. var n = i(t, e);
  20339. p.point(n[0], n[1])
  20340. }
  20341. function x() {
  20342. p.lineStart(), u = []
  20343. }
  20344. function E() {
  20345. m(u[0][0], u[0][1]), p.lineEnd();
  20346. var t, e, n, r, i = p.clean(),
  20347. l = h.result(),
  20348. c = l.length;
  20349. if (u.pop(), s.push(u), u = null, c)
  20350. if (1 & i) {
  20351. if ((e = (n = l[0]).length - 1) > 0) {
  20352. for (f || (o.polygonStart(), f = !0), o.lineStart(), t = 0; t < e; ++t) o.point((r = n[t])[0], r[1]);
  20353. o.lineEnd()
  20354. }
  20355. } else c > 1 && 2 & i && l.push(l.pop().concat(l.shift())), a.push(l.filter(Ud))
  20356. }
  20357. return g
  20358. }
  20359. }
  20360. function Ud(t) {
  20361. return t.length > 1
  20362. }
  20363. function Vd(t, e) {
  20364. return ((t = t.x)[0] < 0 ? t[1] - Xg - Ug : Xg - t[1]) - ((e = e.x)[0] < 0 ? e[1] - Xg - Ug : Xg - e[1])
  20365. }
  20366. var Xd = jd((function () {
  20367. return !0
  20368. }), (function (t) {
  20369. var e, n = NaN,
  20370. r = NaN,
  20371. i = NaN;
  20372. return {
  20373. lineStart: function () {
  20374. t.lineStart(), e = 1
  20375. },
  20376. point: function (o, s) {
  20377. var a = o > 0 ? Vg : -Vg,
  20378. u = Zg(o - n);
  20379. Zg(u - Vg) < Ug ? (t.point(n, r = (r + s) / 2 > 0 ? Xg : -Xg), t.point(i, r), t.lineEnd(), t.lineStart(), t.point(a, r), t.point(o, r), e = 0) : i !== a && u >= Vg && (Zg(n - i) < Ug && (n -= i * Ug), Zg(o - a) < Ug && (o -= a * Ug), r = function (t, e, n, r) {
  20380. var i, o, s = td(t - n);
  20381. return Zg(s) > Ug ? Kg((td(e) * (o = $g(r)) * td(n) - td(r) * (i = $g(e)) * td(t)) / (i * o * s)) : (e + r) / 2
  20382. }(n, r, o, s), t.point(i, r), t.lineEnd(), t.lineStart(), t.point(a, r), e = 0), t.point(n = o, r = s), i = a
  20383. },
  20384. lineEnd: function () {
  20385. t.lineEnd(), n = r = NaN
  20386. },
  20387. clean: function () {
  20388. return 2 - e
  20389. }
  20390. }
  20391. }), (function (t, e, n, r) {
  20392. var i;
  20393. if (null == t) i = n * Xg, r.point(-Vg, i), r.point(0, i), r.point(Vg, i), r.point(Vg, 0), r.point(Vg, -i), r.point(0, -i), r.point(-Vg, -i), r.point(-Vg, 0), r.point(-Vg, i);
  20394. else if (Zg(t[0] - e[0]) > Ug) {
  20395. var o = t[0] < e[0] ? Vg : -Vg;
  20396. i = n * o / 2, r.point(-o, i), r.point(0, i), r.point(o, i)
  20397. } else r.point(e[0], e[1])
  20398. }), [-Vg, -Xg]);
  20399. function Yd(t, e) {
  20400. var n = $g(t),
  20401. r = n > 0,
  20402. i = Zg(n) > Ug;
  20403. function o(t, e) {
  20404. return $g(t) * $g(e) > n
  20405. }
  20406. function s(t, e, r) {
  20407. var i = [1, 0, 0],
  20408. o = fd(hd(t), hd(e)),
  20409. s = pd(o, o),
  20410. a = o[0],
  20411. u = s - a * a;
  20412. if (!u) return !r && t;
  20413. var l = n * s / u,
  20414. c = -n * a / u,
  20415. h = fd(i, o),
  20416. p = dd(i, l);
  20417. gd(p, dd(o, c));
  20418. var f = h,
  20419. g = pd(p, f),
  20420. d = pd(f, f),
  20421. y = g * g - d * (pd(p, p) - 1);
  20422. if (!(y < 0)) {
  20423. var v = ed(y),
  20424. _ = dd(f, (-g - v) / d);
  20425. if (gd(_, p), _ = cd(_), !r) return _;
  20426. var m, x = t[0],
  20427. E = e[0],
  20428. b = t[1],
  20429. w = e[1];
  20430. E < x && (m = x, x = E, E = m);
  20431. var I = E - x,
  20432. N = Zg(I - Vg) < Ug;
  20433. if (!N && w < b && (m = b, b = w, w = m), N || I < Ug ? N ? b + w > 0 ^ _[1] < (Zg(_[0] - x) < Ug ? b : w) : b <= _[1] && _[1] <= w : I > Vg ^ (x <= _[0] && _[0] <= E)) {
  20434. var S = dd(f, (-g + v) / d);
  20435. return gd(S, p), [_, cd(S)]
  20436. }
  20437. }
  20438. }
  20439. function a(e, n) {
  20440. var i = r ? t : Vg - t,
  20441. o = 0;
  20442. return e < -i ? o |= 1 : e > i && (o |= 2), n < -i ? o |= 4 : n > i && (o |= 8), o
  20443. }
  20444. return jd(o, (function (t) {
  20445. var e, n, u, l, c;
  20446. return {
  20447. lineStart: function () {
  20448. l = u = !1, c = 1
  20449. },
  20450. point: function (h, p) {
  20451. var f, g = [h, p],
  20452. d = o(h, p),
  20453. y = r ? d ? 0 : a(h, p) : d ? a(h + (h < 0 ? Vg : -Vg), p) : 0;
  20454. if (!e && (l = u = d) && t.lineStart(), d !== u && (!(f = s(e, g)) || Id(e, f) || Id(g, f)) && (g[0] += Ug, g[1] += Ug, d = o(g[0], g[1])), d !== u) c = 0, d ? (t.lineStart(), f = s(g, e), t.point(f[0], f[1])) : (f = s(e, g), t.point(f[0], f[1]), t.lineEnd()), e = f;
  20455. else if (i && e && r ^ d) {
  20456. var v;
  20457. y & n || !(v = s(g, e, !0)) || (c = 0, r ? (t.lineStart(), t.point(v[0][0], v[0][1]), t.point(v[1][0], v[1][1]), t.lineEnd()) : (t.point(v[1][0], v[1][1]), t.lineEnd(), t.lineStart(), t.point(v[0][0], v[0][1])))
  20458. }!d || e && Id(e, g) || t.point(g[0], g[1]), e = g, u = d, n = y
  20459. },
  20460. lineEnd: function () {
  20461. u && t.lineEnd(), e = null
  20462. },
  20463. clean: function () {
  20464. return c | (l && u) << 1
  20465. }
  20466. }
  20467. }), (function (n, r, i, o) {
  20468. ! function (t, e, n, r, i, o) {
  20469. if (n) {
  20470. var s = $g(e),
  20471. a = td(e),
  20472. u = r * n;
  20473. null == i ? (i = e + r * Hg, o = e - u / 2) : (i = bd(s, i), o = bd(s, o), (r > 0 ? i < o : i > o) && (i += r * Hg));
  20474. for (var l, c = i; r > 0 ? c > o : c < o; c -= u) l = cd([s, -a * $g(c), -a * td(c)]), t.point(l[0], l[1])
  20475. }
  20476. }(o, t, e, i, n, r)
  20477. }), r ? [0, -t] : [-Vg, t - Vg])
  20478. }
  20479. function Hd(t) {
  20480. return function (e) {
  20481. var n = new Wd;
  20482. for (var r in t) n[r] = t[r];
  20483. return n.stream = e, n
  20484. }
  20485. }
  20486. function Wd() {}
  20487. function Jd(t, e, n) {
  20488. var r = e[1][0] - e[0][0],
  20489. i = e[1][1] - e[0][1],
  20490. o = t.clipExtent && t.clipExtent();
  20491. t.scale(150).translate([0, 0]), null != o && t.clipExtent(null),
  20492. function (t, e) {
  20493. t && sd.hasOwnProperty(t.type) ? sd[t.type](t, e) : od(t, e)
  20494. }(n, t.stream(zd));
  20495. var s = zd.result(),
  20496. a = Math.min(r / (s[1][0] - s[0][0]), i / (s[1][1] - s[0][1])),
  20497. u = +e[0][0] + (r - a * (s[1][0] + s[0][0])) / 2,
  20498. l = +e[0][1] + (i - a * (s[1][1] + s[0][1])) / 2;
  20499. return null != o && t.clipExtent(o), t.scale(150 * a).translate([u, l])
  20500. }
  20501. Wd.prototype = {
  20502. constructor: Wd,
  20503. point: function (t, e) {
  20504. this.stream.point(t, e)
  20505. },
  20506. sphere: function () {
  20507. this.stream.sphere()
  20508. },
  20509. lineStart: function () {
  20510. this.stream.lineStart()
  20511. },
  20512. lineEnd: function () {
  20513. this.stream.lineEnd()
  20514. },
  20515. polygonStart: function () {
  20516. this.stream.polygonStart()
  20517. },
  20518. polygonEnd: function () {
  20519. this.stream.polygonEnd()
  20520. }
  20521. };
  20522. var Zd = $g(30 * Jg);
  20523. function Kd(t, e) {
  20524. return +e ? function (t, e) {
  20525. function n(r, i, o, s, a, u, l, c, h, p, f, g, d, y) {
  20526. var v = l - r,
  20527. _ = c - i,
  20528. m = v * v + _ * _;
  20529. if (m > 4 * e && d--) {
  20530. var x = s + p,
  20531. E = a + f,
  20532. b = u + g,
  20533. w = ed(x * x + E * E + b * b),
  20534. I = rd(b /= w),
  20535. N = Zg(Zg(b) - 1) < Ug || Zg(o - h) < Ug ? (o + h) / 2 : Qg(E, x),
  20536. S = t(N, I),
  20537. C = S[0],
  20538. P = S[1],
  20539. M = C - r,
  20540. L = P - i,
  20541. O = _ * M - v * L;
  20542. (O * O / m > e || Zg((v * M + _ * L) / m - .5) > .3 || s * p + a * f + u * g < Zd) && (n(r, i, o, s, a, u, C, P, N, x /= w, E /= w, b, d, y), y.point(C, P), n(C, P, N, x, E, b, l, c, h, p, f, g, d, y))
  20543. }
  20544. }
  20545. return function (e) {
  20546. var r, i, o, s, a, u, l, c, h, p, f, g, d = {
  20547. point: y,
  20548. lineStart: v,
  20549. lineEnd: m,
  20550. polygonStart: function () {
  20551. e.polygonStart(), d.lineStart = x
  20552. },
  20553. polygonEnd: function () {
  20554. e.polygonEnd(), d.lineStart = v
  20555. }
  20556. };
  20557. function y(n, r) {
  20558. n = t(n, r), e.point(n[0], n[1])
  20559. }
  20560. function v() {
  20561. c = NaN, d.point = _, e.lineStart()
  20562. }
  20563. function _(r, i) {
  20564. var o = hd([r, i]),
  20565. s = t(r, i);
  20566. n(c, h, l, p, f, g, c = s[0], h = s[1], l = r, p = o[0], f = o[1], g = o[2], 16, e), e.point(c, h)
  20567. }
  20568. function m() {
  20569. d.point = y, e.lineEnd()
  20570. }
  20571. function x() {
  20572. v(), d.point = E, d.lineEnd = b
  20573. }
  20574. function E(t, e) {
  20575. _(r = t, e), i = c, o = h, s = p, a = f, u = g, d.point = _
  20576. }
  20577. function b() {
  20578. n(c, h, l, p, f, g, i, o, r, s, a, u, 16, e), d.lineEnd = m, m()
  20579. }
  20580. return d
  20581. }
  20582. }(t, e) : function (t) {
  20583. return Hd({
  20584. point: function (e, n) {
  20585. e = t(e, n), this.stream.point(e[0], e[1])
  20586. }
  20587. })
  20588. }(t)
  20589. }
  20590. var Qd = Hd({
  20591. point: function (t, e) {
  20592. this.stream.point(t * Jg, e * Jg)
  20593. }
  20594. });
  20595. function $d(t) {
  20596. return function (t) {
  20597. var e, n, r, i, o, s, a, u, l, c, h = 150,
  20598. p = 480,
  20599. f = 250,
  20600. g = 0,
  20601. d = 0,
  20602. y = 0,
  20603. v = 0,
  20604. _ = 0,
  20605. m = null,
  20606. x = Xd,
  20607. E = null,
  20608. b = Fd,
  20609. w = .5,
  20610. I = Kd(C, w);
  20611. function N(t) {
  20612. return [(t = o(t[0] * Jg, t[1] * Jg))[0] * h + n, r - t[1] * h]
  20613. }
  20614. function S(t) {
  20615. return (t = o.invert((t[0] - n) / h, (r - t[1]) / h)) && [t[0] * Wg, t[1] * Wg]
  20616. }
  20617. function C(t, i) {
  20618. return [(t = e(t, i))[0] * h + n, r - t[1] * h]
  20619. }
  20620. function P() {
  20621. o = vd(i = function (t, e, n) {
  20622. return (t %= Hg) ? e || n ? vd(xd(t), Ed(e, n)) : xd(t) : e || n ? Ed(e, n) : _d
  20623. }(y, v, _), e);
  20624. var t = e(g, d);
  20625. return n = p - t[0] * h, r = f + t[1] * h, M()
  20626. }
  20627. function M() {
  20628. return l = c = null, N
  20629. }
  20630. return N.stream = function (t) {
  20631. return l && c === t ? l : l = Qd(x(i, I(b(c = t))))
  20632. }, N.clipAngle = function (t) {
  20633. return arguments.length ? (x = +t ? Yd(m = t * Jg, 6 * Jg) : (m = null, Xd), M()) : m * Wg
  20634. }, N.clipExtent = function (t) {
  20635. return arguments.length ? (b = null == t ? (E = s = a = u = null, Fd) : Ad(E = +t[0][0], s = +t[0][1], a = +t[1][0], u = +t[1][1]), M()) : null == E ? null : [
  20636. [E, s],
  20637. [a, u]
  20638. ]
  20639. }, N.scale = function (t) {
  20640. return arguments.length ? (h = +t, P()) : h
  20641. }, N.translate = function (t) {
  20642. return arguments.length ? (p = +t[0], f = +t[1], P()) : [p, f]
  20643. }, N.center = function (t) {
  20644. return arguments.length ? (g = t[0] % 360 * Jg, d = t[1] % 360 * Jg, P()) : [g * Wg, d * Wg]
  20645. }, N.rotate = function (t) {
  20646. return arguments.length ? (y = t[0] % 360 * Jg, v = t[1] % 360 * Jg, _ = t.length > 2 ? t[2] % 360 * Jg : 0, P()) : [y * Wg, v * Wg, _ * Wg]
  20647. }, N.precision = function (t) {
  20648. return arguments.length ? (I = Kd(C, w = t * t), M()) : ed(w)
  20649. }, N.fitExtent = function (t, e) {
  20650. return Jd(N, t, e)
  20651. }, N.fitSize = function (t, e) {
  20652. return function (t, e, n) {
  20653. return Jd(t, [
  20654. [0, 0], e
  20655. ], n)
  20656. }(N, t, e)
  20657. },
  20658. function () {
  20659. return e = t.apply(this, arguments), N.invert = e.invert && S, P()
  20660. }
  20661. }((function () {
  20662. return t
  20663. }))()
  20664. }
  20665. var ty = function (t) {
  20666. return function (e, n) {
  20667. var r = $g(e),
  20668. i = $g(n),
  20669. o = t(r * i);
  20670. return [o * i * td(e), o * td(n)]
  20671. }
  20672. }((function (t) {
  20673. return (t = nd(t)) && t / td(t)
  20674. }));
  20675. function ey() {
  20676. return $d(ty).scale(79.4188).clipAngle(179.999)
  20677. }
  20678. function ny(t, n, r, i) {
  20679. var s = t.properties || {},
  20680. a = "Feature" === t.type ? t.geometry : t;
  20681. if ("GeometryCollection" === a.type) {
  20682. var u = [];
  20683. return q(t, (function (t) {
  20684. var e = ny(t, n, r, i);
  20685. e && u.push(e)
  20686. })), f(u)
  20687. }
  20688. var l = function (t) {
  20689. var n = xn(t).geometry.coordinates,
  20690. r = [-n[0], -n[1]];
  20691. return ey().rotate(r).scale(e)
  20692. }(a),
  20693. c = {
  20694. type: a.type,
  20695. coordinates: iy(a.coordinates, l)
  20696. },
  20697. h = (new Ih).read(c),
  20698. p = m(x(n, r), "meters"),
  20699. g = _f.bufferOp(h, p, i);
  20700. if (!ry((g = (new Nh).write(g)).coordinates)) return o({
  20701. type: g.type,
  20702. coordinates: oy(g.coordinates, l)
  20703. }, s)
  20704. }
  20705. function ry(t) {
  20706. return Array.isArray(t[0]) ? ry(t[0]) : isNaN(t[0])
  20707. }
  20708. function iy(t, e) {
  20709. return "object" != typeof t[0] ? e(t) : t.map((function (t) {
  20710. return iy(t, e)
  20711. }))
  20712. }
  20713. function oy(t, e) {
  20714. return "object" != typeof t[0] ? e.invert(t) : t.map((function (t) {
  20715. return oy(t, e)
  20716. }))
  20717. }
  20718. function sy(t, e, n) {
  20719. void 0 === n && (n = {});
  20720. var r = rt(t),
  20721. i = rt(e),
  20722. o = $u.intersection(r.coordinates, i.coordinates);
  20723. return 0 === o.length ? null : 1 === o.length ? l(o[0], n.properties) : y(o, n.properties)
  20724. }
  20725. function ay(t, e, n) {
  20726. void 0 === n && (n = {});
  20727. var r = JSON.stringify(n.properties || {}),
  20728. i = t[0],
  20729. o = t[1],
  20730. s = t[2],
  20731. a = t[3],
  20732. u = (o + a) / 2,
  20733. l = (i + s) / 2,
  20734. c = 2 * e / me([i, u], [s, u], n) * (s - i),
  20735. h = 2 * e / me([l, o], [l, a], n) * (a - o),
  20736. p = c / 2,
  20737. g = 2 * p,
  20738. d = Math.sqrt(3) / 2 * h,
  20739. y = s - i,
  20740. v = a - o,
  20741. _ = 3 / 4 * g,
  20742. m = d,
  20743. x = (y - g) / (g - p / 2),
  20744. E = Math.floor(x),
  20745. b = (E * _ - p / 2 - y) / 2 - p / 2 + _ / 2,
  20746. w = Math.floor((v - d) / d),
  20747. I = (v - w * d) / 2,
  20748. N = w * d - v > d / 2;
  20749. N && (I -= d / 4);
  20750. for (var S = [], C = [], P = 0; P < 6; P++) {
  20751. var M = 2 * Math.PI / 6 * P;
  20752. S.push(Math.cos(M)), C.push(Math.sin(M))
  20753. }
  20754. for (var L = [], O = 0; O <= E; O++)
  20755. for (var R = 0; R <= w; R++) {
  20756. var T = O % 2 == 1;
  20757. if ((0 !== R || !T) && (0 !== R || !N)) {
  20758. var A = O * _ + i - b,
  20759. D = R * m + o + I;
  20760. if (T && (D -= d / 2), !0 === n.triangles) ly([A, D], c / 2, h / 2, JSON.parse(r), S, C).forEach((function (t) {
  20761. n.mask ? sy(n.mask, t) && L.push(t) : L.push(t)
  20762. }));
  20763. else {
  20764. var F = uy([A, D], c / 2, h / 2, JSON.parse(r), S, C);
  20765. n.mask ? sy(n.mask, F) && L.push(F) : L.push(F)
  20766. }
  20767. }
  20768. }
  20769. return f(L)
  20770. }
  20771. function uy(t, e, n, r, i, o) {
  20772. for (var s = [], a = 0; a < 6; a++) {
  20773. var u = t[0] + e * i[a],
  20774. c = t[1] + n * o[a];
  20775. s.push([u, c])
  20776. }
  20777. return s.push(s[0].slice()), l([s], r)
  20778. }
  20779. function ly(t, e, n, r, i, o) {
  20780. for (var s = [], a = 0; a < 6; a++) {
  20781. var u = [];
  20782. u.push(t), u.push([t[0] + e * i[a], t[1] + n * o[a]]), u.push([t[0] + e * i[(a + 1) % 6], t[1] + n * o[(a + 1) % 6]]), u.push(t), s.push(l([u], r))
  20783. }
  20784. return s
  20785. }
  20786. function cy(t) {
  20787. return y(t)
  20788. }
  20789. function hy(t) {
  20790. return l(t && t.geometry.coordinates || [
  20791. [
  20792. [180, 90],
  20793. [-180, 90],
  20794. [-180, -90],
  20795. [180, -90],
  20796. [180, 90]
  20797. ]
  20798. ])
  20799. }
  20800. function py(t, e, n) {
  20801. return void 0 === n && (n = {}),
  20802. function (t, e, n, r) {
  20803. void 0 === r && (r = {});
  20804. for (var i = [], o = t[0], s = t[1], a = t[2], u = t[3], c = e / me([o, s], [a, s], r) * (a - o), h = n / me([o, s], [o, u], r) * (u - s), p = a - o, g = u - s, d = Math.floor(p / c), y = Math.floor(g / h), v = (g - y * h) / 2, _ = o + (p - d * c) / 2, m = 0; m < d; m++) {
  20805. for (var x = s + v, E = 0; E < y; E++) {
  20806. var b = l([
  20807. [
  20808. [_, x],
  20809. [_, x + h],
  20810. [_ + c, x + h],
  20811. [_ + c, x],
  20812. [_, x]
  20813. ]
  20814. ], r.properties);
  20815. r.mask ? Ps(r.mask, b) && i.push(b) : i.push(b), x += h
  20816. }
  20817. _ += c
  20818. }
  20819. return f(i)
  20820. }(t, e, e, n)
  20821. }
  20822. function fy(t, e, n) {
  20823. void 0 === n && (n = {});
  20824. for (var r = [], i = e / me([t[0], t[1]], [t[2], t[1]], n) * (t[2] - t[0]), o = e / me([t[0], t[1]], [t[0], t[3]], n) * (t[3] - t[1]), s = 0, a = t[0]; a <= t[2];) {
  20825. for (var u = 0, c = t[1]; c <= t[3];) {
  20826. var h = null,
  20827. p = null;
  20828. s % 2 == 0 && u % 2 == 0 ? (h = l([
  20829. [
  20830. [a, c],
  20831. [a, c + o],
  20832. [a + i, c],
  20833. [a, c]
  20834. ]
  20835. ], n.properties), p = l([
  20836. [
  20837. [a, c + o],
  20838. [a + i, c + o],
  20839. [a + i, c],
  20840. [a, c + o]
  20841. ]
  20842. ], n.properties)) : s % 2 == 0 && u % 2 == 1 ? (h = l([
  20843. [
  20844. [a, c],
  20845. [a + i, c + o],
  20846. [a + i, c],
  20847. [a, c]
  20848. ]
  20849. ], n.properties), p = l([
  20850. [
  20851. [a, c],
  20852. [a, c + o],
  20853. [a + i, c + o],
  20854. [a, c]
  20855. ]
  20856. ], n.properties)) : u % 2 == 0 && s % 2 == 1 ? (h = l([
  20857. [
  20858. [a, c],
  20859. [a, c + o],
  20860. [a + i, c + o],
  20861. [a, c]
  20862. ]
  20863. ], n.properties), p = l([
  20864. [
  20865. [a, c],
  20866. [a + i, c + o],
  20867. [a + i, c],
  20868. [a, c]
  20869. ]
  20870. ], n.properties)) : u % 2 == 1 && s % 2 == 1 && (h = l([
  20871. [
  20872. [a, c],
  20873. [a, c + o],
  20874. [a + i, c],
  20875. [a, c]
  20876. ]
  20877. ], n.properties), p = l([
  20878. [
  20879. [a, c + o],
  20880. [a + i, c + o],
  20881. [a + i, c],
  20882. [a, c + o]
  20883. ]
  20884. ], n.properties)), n.mask ? (sy(n.mask, h) && r.push(h), sy(n.mask, p) && r.push(p)) : (r.push(h), r.push(p)), c += o, u++
  20885. }
  20886. s++, a += i
  20887. }
  20888. return f(r)
  20889. }
  20890. ty.invert = function (t) {
  20891. return function (e, n) {
  20892. var r = ed(e * e + n * n),
  20893. i = t(r),
  20894. o = td(i),
  20895. s = $g(i);
  20896. return [Qg(e * o, r * s), rd(r && n * o / r)]
  20897. }
  20898. }((function (t) {
  20899. return t
  20900. })), t.along = function (t, e, n) {
  20901. void 0 === n && (n = {});
  20902. for (var r = rt(t).coordinates, i = 0, o = 0; o < r.length && !(e >= i && o === r.length - 1); o++) {
  20903. if (i >= e) {
  20904. var s = e - i;
  20905. if (s) {
  20906. var u = mn(r[o], r[o - 1]) - 180;
  20907. return vn(r[o], s, u, n)
  20908. }
  20909. return a(r[o])
  20910. }
  20911. i += me(r[o], r[o + 1], n)
  20912. }
  20913. return a(r[r.length - 1])
  20914. }, t.angle = function (t, e, n, r) {
  20915. if (void 0 === r && (r = {}), !P(r)) throw new Error("options is invalid");
  20916. if (!t) throw new Error("startPoint is required");
  20917. if (!e) throw new Error("midPoint is required");
  20918. if (!n) throw new Error("endPoint is required");
  20919. var i = t,
  20920. o = e,
  20921. s = n,
  20922. a = b(!0 !== r.mercator ? mn(i, o) : Bi(i, o)),
  20923. u = b(!0 !== r.mercator ? mn(s, o) : Bi(s, o)),
  20924. l = Math.abs(a - u);
  20925. return !0 === r.explementary ? 360 - l : l
  20926. }, t.applyFilter = uu, t.area = jr, t.areaFactors = i, t.bbox = Z, t.bboxClip = function (t, e) {
  20927. var n = rt(t),
  20928. r = n.type,
  20929. i = "Feature" === t.type ? t.properties : {},
  20930. o = n.coordinates;
  20931. switch (r) {
  20932. case "LineString":
  20933. case "MultiLineString":
  20934. var s = [];
  20935. return "LineString" === r && (o = [o]), o.forEach((function (t) {
  20936. ! function (t, e, n) {
  20937. var r, i, o, s, a, u = t.length,
  20938. l = Ri(t[0], e),
  20939. c = [];
  20940. for (n || (n = []), r = 1; r < u; r++) {
  20941. for (s = t[r - 1], i = o = Ri(a = t[r], e);;) {
  20942. if (!(l | i)) {
  20943. c.push(s), i !== o ? (c.push(a), r < u - 1 && (n.push(c), c = [])) : r === u - 1 && c.push(a);
  20944. break
  20945. }
  20946. if (l & i) break;
  20947. l ? l = Ri(s = Oi(s, a, l, e), e) : i = Ri(a = Oi(s, a, i, e), e)
  20948. }
  20949. l = o
  20950. }
  20951. c.length && n.push(c)
  20952. }(t, e, s)
  20953. })), 1 === s.length ? h(s[0], i) : g(s, i);
  20954. case "Polygon":
  20955. return l(Ti(o, e), i);
  20956. case "MultiPolygon":
  20957. return y(o.map((function (t) {
  20958. return Ti(t, e)
  20959. })), i);
  20960. default:
  20961. throw new Error("geometry " + r + " not supported")
  20962. }
  20963. }, t.bboxPolygon = gn, t.bearing = mn, t.bearingToAngle = b, t.bearingToAzimuth = b, t.bezier = fn, t.bezierSpline = fn, t.booleanClockwise = Yi, t.booleanContains = function (t, e) {
  20964. var n = rt(t),
  20965. r = rt(e),
  20966. i = n.type,
  20967. o = r.type,
  20968. s = n.coordinates,
  20969. a = r.coordinates;
  20970. switch (i) {
  20971. case "Point":
  20972. switch (o) {
  20973. case "Point":
  20974. return vs(s, a);
  20975. default:
  20976. throw new Error("feature2 " + o + " geometry not supported")
  20977. }
  20978. case "MultiPoint":
  20979. switch (o) {
  20980. case "Point":
  20981. return function (t, e) {
  20982. var n, r = !1;
  20983. for (n = 0; n < t.coordinates.length; n++)
  20984. if (vs(t.coordinates[n], e.coordinates)) {
  20985. r = !0;
  20986. break
  20987. } return r
  20988. }(n, r);
  20989. case "MultiPoint":
  20990. return function (t, e) {
  20991. for (var n = 0, r = e.coordinates; n < r.length; n++) {
  20992. for (var i = r[n], o = !1, s = 0, a = t.coordinates; s < a.length; s++) {
  20993. if (vs(i, a[s])) {
  20994. o = !0;
  20995. break
  20996. }
  20997. }
  20998. if (!o) return !1
  20999. }
  21000. return !0
  21001. }(n, r);
  21002. default:
  21003. throw new Error("feature2 " + o + " geometry not supported")
  21004. }
  21005. case "LineString":
  21006. switch (o) {
  21007. case "Point":
  21008. return Wr(r, n, {
  21009. ignoreEndVertices: !0
  21010. });
  21011. case "LineString":
  21012. return function (t, e) {
  21013. for (var n = !1, r = 0, i = e.coordinates; r < i.length; r++) {
  21014. var o = i[r];
  21015. if (Wr({
  21016. type: "Point",
  21017. coordinates: o
  21018. }, t, {
  21019. ignoreEndVertices: !0
  21020. }) && (n = !0), !Wr({
  21021. type: "Point",
  21022. coordinates: o
  21023. }, t, {
  21024. ignoreEndVertices: !1
  21025. })) return !1
  21026. }
  21027. return n
  21028. }(n, r);
  21029. case "MultiPoint":
  21030. return function (t, e) {
  21031. for (var n = !1, r = 0, i = e.coordinates; r < i.length; r++) {
  21032. var o = i[r];
  21033. if (Wr(o, t, {
  21034. ignoreEndVertices: !0
  21035. }) && (n = !0), !Wr(o, t)) return !1
  21036. }
  21037. if (n) return !0;
  21038. return !1
  21039. }(n, r);
  21040. default:
  21041. throw new Error("feature2 " + o + " geometry not supported")
  21042. }
  21043. case "Polygon":
  21044. switch (o) {
  21045. case "Point":
  21046. return ye(r, n, {
  21047. ignoreBoundary: !0
  21048. });
  21049. case "LineString":
  21050. return function (t, e) {
  21051. var n = !1,
  21052. r = 0,
  21053. i = Z(t),
  21054. o = Z(e);
  21055. if (!ys(i, o)) return !1;
  21056. for (; r < e.coordinates.length - 1; r++) {
  21057. if (ye({
  21058. type: "Point",
  21059. coordinates: _s(e.coordinates[r], e.coordinates[r + 1])
  21060. }, t, {
  21061. ignoreBoundary: !0
  21062. })) {
  21063. n = !0;
  21064. break
  21065. }
  21066. }
  21067. return n
  21068. }(n, r);
  21069. case "Polygon":
  21070. return function (t, e) {
  21071. if ("Feature" === t.type && null === t.geometry) return !1;
  21072. if ("Feature" === e.type && null === e.geometry) return !1;
  21073. var n = Z(t),
  21074. r = Z(e);
  21075. if (!ys(n, r)) return !1;
  21076. for (var i = rt(e).coordinates, o = 0, s = i; o < s.length; o++)
  21077. for (var a = 0, u = s[o]; a < u.length; a++) {
  21078. if (!ye(u[a], t)) return !1
  21079. }
  21080. return !0
  21081. }(n, r);
  21082. case "MultiPoint":
  21083. return function (t, e) {
  21084. for (var n = 0, r = e.coordinates; n < r.length; n++) {
  21085. if (!ye(r[n], t, {
  21086. ignoreBoundary: !0
  21087. })) return !1
  21088. }
  21089. return !0
  21090. }(n, r);
  21091. default:
  21092. throw new Error("feature2 " + o + " geometry not supported")
  21093. }
  21094. default:
  21095. throw new Error("feature1 " + i + " geometry not supported")
  21096. }
  21097. }, t.booleanCrosses = function (t, e) {
  21098. var n = rt(t),
  21099. r = rt(e),
  21100. i = n.type,
  21101. o = r.type;
  21102. switch (i) {
  21103. case "MultiPoint":
  21104. switch (o) {
  21105. case "LineString":
  21106. return ms(n, r);
  21107. case "Polygon":
  21108. return Es(n, r);
  21109. default:
  21110. throw new Error("feature2 " + o + " geometry not supported")
  21111. }
  21112. case "LineString":
  21113. switch (o) {
  21114. case "MultiPoint":
  21115. return ms(r, n);
  21116. case "LineString":
  21117. return function (t, e) {
  21118. if (Or(t, e).features.length > 0)
  21119. for (var n = 0; n < t.coordinates.length - 1; n++)
  21120. for (var r = 0; r < e.coordinates.length - 1; r++) {
  21121. var i = !0;
  21122. if (0 !== r && r !== e.coordinates.length - 2 || (i = !1), bs(t.coordinates[n], t.coordinates[n + 1], e.coordinates[r], i)) return !0
  21123. }
  21124. return !1
  21125. }(n, r);
  21126. case "Polygon":
  21127. return xs(n, r);
  21128. default:
  21129. throw new Error("feature2 " + o + " geometry not supported")
  21130. }
  21131. case "Polygon":
  21132. switch (o) {
  21133. case "MultiPoint":
  21134. return Es(r, n);
  21135. case "LineString":
  21136. return xs(r, n);
  21137. default:
  21138. throw new Error("feature2 " + o + " geometry not supported")
  21139. }
  21140. default:
  21141. throw new Error("feature1 " + i + " geometry not supported")
  21142. }
  21143. }, t.booleanDisjoint = ps, t.booleanEqual = function (t, e) {
  21144. return rt(t).type === rt(e).type && new Cs({
  21145. precision: 6
  21146. }).compare(tn(t), tn(e))
  21147. }, t.booleanIntersects = Ps, t.booleanOverlap = function (t, e) {
  21148. var n = rt(t),
  21149. r = rt(e),
  21150. i = n.type,
  21151. o = r.type;
  21152. if ("MultiPoint" === i && "MultiPoint" !== o || ("LineString" === i || "MultiLineString" === i) && "LineString" !== o && "MultiLineString" !== o || ("Polygon" === i || "MultiPolygon" === i) && "Polygon" !== o && "MultiPolygon" !== o) throw new Error("features must be of the same type");
  21153. if ("Point" === i) throw new Error("Point geometry not supported");
  21154. if (new Cs({
  21155. precision: 6
  21156. }).compare(t, e)) return !1;
  21157. var s = 0;
  21158. switch (i) {
  21159. case "MultiPoint":
  21160. for (var a = 0; a < n.coordinates.length; a++)
  21161. for (var u = 0; u < r.coordinates.length; u++) {
  21162. var l = n.coordinates[a],
  21163. c = r.coordinates[u];
  21164. if (l[0] === c[0] && l[1] === c[1]) return !0
  21165. }
  21166. return !1;
  21167. case "LineString":
  21168. case "MultiLineString":
  21169. U(t, (function (t) {
  21170. U(e, (function (e) {
  21171. ki(t, e).features.length && s++
  21172. }))
  21173. }));
  21174. break;
  21175. case "Polygon":
  21176. case "MultiPolygon":
  21177. U(t, (function (t) {
  21178. U(e, (function (e) {
  21179. Or(t, e).features.length && s++
  21180. }))
  21181. }))
  21182. }
  21183. return s > 0
  21184. }, t.booleanParallel = function (t, e) {
  21185. if (!t) throw new Error("line1 is required");
  21186. if (!e) throw new Error("line2 is required");
  21187. if ("LineString" !== Us(t, "line1")) throw new Error("line1 must be a LineString");
  21188. if ("LineString" !== Us(e, "line2")) throw new Error("line2 must be a LineString");
  21189. for (var n = Zn(tn(t)).features, r = Zn(tn(e)).features, i = 0; i < n.length; i++) {
  21190. var o = n[i].geometry.coordinates;
  21191. if (!r[i]) break;
  21192. if (!js(o, r[i].geometry.coordinates)) return !1
  21193. }
  21194. return !0
  21195. }, t.booleanPointInPolygon = ye, t.booleanPointOnLine = Wr, t.booleanWithin = Zr, t.buffer = function (t, e, n) {
  21196. var r = (n = n || {}).units || "kilometers",
  21197. i = n.steps || 8;
  21198. if (!t) throw new Error("geojson is required");
  21199. if ("object" != typeof n) throw new Error("options must be an object");
  21200. if ("number" != typeof i) throw new Error("steps must be an number");
  21201. if (void 0 === e) throw new Error("radius is required");
  21202. if (i <= 0) throw new Error("steps must be greater than 0");
  21203. var o = [];
  21204. switch (t.type) {
  21205. case "GeometryCollection":
  21206. return q(t, (function (t) {
  21207. var n = ny(t, e, r, i);
  21208. n && o.push(n)
  21209. })), f(o);
  21210. case "FeatureCollection":
  21211. return F(t, (function (t) {
  21212. var n = ny(t, e, r, i);
  21213. n && F(n, (function (t) {
  21214. t && o.push(t)
  21215. }))
  21216. })), f(o)
  21217. }
  21218. return ny(t, e, r, i)
  21219. }, t.center = xn, t.centerMean = Fa, t.centerMedian = function (t, e) {
  21220. if (void 0 === e && (e = {}), !P(e = e || {})) throw new Error("options is invalid");
  21221. var n = e.counter || 10;
  21222. if (!C(n)) throw new Error("counter must be a number");
  21223. var r = e.weight,
  21224. i = Fa(t, {
  21225. weight: e.weight
  21226. }),
  21227. o = f([]);
  21228. F(t, (function (t) {
  21229. var e;
  21230. o.features.push(En(t, {
  21231. properties: {
  21232. weight: null === (e = t.properties) || void 0 === e ? void 0 : e[r]
  21233. }
  21234. }))
  21235. }));
  21236. var s = {
  21237. tolerance: e.tolerance,
  21238. medianCandidates: []
  21239. };
  21240. return ka(i.geometry.coordinates, [0, 0], o, s, n)
  21241. }, t.centerOfMass = function t(e, n) {
  21242. switch (void 0 === n && (n = {}), it(e)) {
  21243. case "Point":
  21244. return a(K(e), n.properties);
  21245. case "Polygon":
  21246. var r = [];
  21247. R(e, (function (t) {
  21248. r.push(t)
  21249. }));
  21250. var i, o, s, u, l, c, h, p, f = En(e, {
  21251. properties: n.properties
  21252. }),
  21253. g = f.geometry.coordinates,
  21254. d = 0,
  21255. y = 0,
  21256. v = 0,
  21257. _ = r.map((function (t) {
  21258. return [t[0] - g[0], t[1] - g[1]]
  21259. }));
  21260. for (i = 0; i < r.length - 1; i++) u = (o = _[i])[0], c = o[1], l = (s = _[i + 1])[0], v += p = u * (h = s[1]) - l * c, d += (u + l) * p, y += (c + h) * p;
  21261. if (0 === v) return f;
  21262. var m = 1 / (6 * (.5 * v));
  21263. return a([g[0] + m * d, g[1] + m * y], n.properties);
  21264. default:
  21265. var x = de(e);
  21266. return x ? t(x, {
  21267. properties: n.properties
  21268. }) : En(e, {
  21269. properties: n.properties
  21270. })
  21271. }
  21272. }, t.centroid = En, t.circle = _n, t.cleanCoords = tn, t.clone = Ie, t.clusterEach = ou, t.clusterReduce = su, t.clusters = hu, t.clustersDbscan = function (t, e, n) {
  21273. void 0 === n && (n = {}), !0 !== n.mutate && (t = Ie(t)), n.minPoints = n.minPoints || 3;
  21274. var r = new Ts.DBSCAN,
  21275. i = r.run(G(t), N(e, n.units), n.minPoints, me),
  21276. o = -1;
  21277. return i.forEach((function (e) {
  21278. o++, e.forEach((function (e) {
  21279. var n = t.features[e];
  21280. n.properties || (n.properties = {}), n.properties.cluster = o, n.properties.dbscan = "core"
  21281. }))
  21282. })), r.noise.forEach((function (e) {
  21283. var n = t.features[e];
  21284. n.properties || (n.properties = {}), n.properties.cluster ? n.properties.dbscan = "edge" : n.properties.dbscan = "noise"
  21285. })), t
  21286. }, t.clustersKmeans = function (t, e) {
  21287. void 0 === e && (e = {});
  21288. var n = t.features.length;
  21289. e.numberOfClusters = e.numberOfClusters || Math.round(Math.sqrt(n / 2)), e.numberOfClusters > n && (e.numberOfClusters = n), !0 !== e.mutate && (t = Ie(t));
  21290. var r = G(t),
  21291. i = r.slice(0, e.numberOfClusters),
  21292. o = zs(r, e.numberOfClusters, i),
  21293. s = {};
  21294. return o.centroids.forEach((function (t, e) {
  21295. s[e] = t
  21296. })), F(t, (function (t, e) {
  21297. var n = o.idxs[e];
  21298. t.properties.cluster = n, t.properties.centroid = s[n]
  21299. })), t
  21300. }, t.collect = function (t, e, n, r) {
  21301. var i = Nt(6),
  21302. o = e.features.map((function (t) {
  21303. var e;
  21304. return {
  21305. minX: t.geometry.coordinates[0],
  21306. minY: t.geometry.coordinates[1],
  21307. maxX: t.geometry.coordinates[0],
  21308. maxY: t.geometry.coordinates[1],
  21309. property: null === (e = t.properties) || void 0 === e ? void 0 : e[n]
  21310. }
  21311. }));
  21312. return i.load(o), t.features.forEach((function (t) {
  21313. t.properties || (t.properties = {});
  21314. var e = Z(t),
  21315. n = i.search({
  21316. minX: e[0],
  21317. minY: e[1],
  21318. maxX: e[2],
  21319. maxY: e[3]
  21320. }),
  21321. o = [];
  21322. n.forEach((function (e) {
  21323. ye([e.minX, e.minY], t) && o.push(e.property)
  21324. })), t.properties[r] = o
  21325. })), t
  21326. }, t.collectionOf = nt, t.combine = function (t) {
  21327. var e = {
  21328. MultiPoint: {
  21329. coordinates: [],
  21330. properties: []
  21331. },
  21332. MultiLineString: {
  21333. coordinates: [],
  21334. properties: []
  21335. },
  21336. MultiPolygon: {
  21337. coordinates: [],
  21338. properties: []
  21339. }
  21340. };
  21341. return F(t, (function (t) {
  21342. var n, r, i, o;
  21343. switch (null === (o = t.geometry) || void 0 === o ? void 0 : o.type) {
  21344. case "Point":
  21345. e.MultiPoint.coordinates.push(t.geometry.coordinates), e.MultiPoint.properties.push(t.properties);
  21346. break;
  21347. case "MultiPoint":
  21348. (n = e.MultiPoint.coordinates).push.apply(n, t.geometry.coordinates), e.MultiPoint.properties.push(t.properties);
  21349. break;
  21350. case "LineString":
  21351. e.MultiLineString.coordinates.push(t.geometry.coordinates), e.MultiLineString.properties.push(t.properties);
  21352. break;
  21353. case "MultiLineString":
  21354. (r = e.MultiLineString.coordinates).push.apply(r, t.geometry.coordinates), e.MultiLineString.properties.push(t.properties);
  21355. break;
  21356. case "Polygon":
  21357. e.MultiPolygon.coordinates.push(t.geometry.coordinates), e.MultiPolygon.properties.push(t.properties);
  21358. break;
  21359. case "MultiPolygon":
  21360. (i = e.MultiPolygon.coordinates).push.apply(i, t.geometry.coordinates), e.MultiPolygon.properties.push(t.properties)
  21361. }
  21362. })), f(Object.keys(e).filter((function (t) {
  21363. return e[t].coordinates.length
  21364. })).sort().map((function (t) {
  21365. return o({
  21366. type: t,
  21367. coordinates: e[t].coordinates
  21368. }, {
  21369. collectedProperties: e[t].properties
  21370. })
  21371. })))
  21372. }, t.concave = function (t, e) {
  21373. void 0 === e && (e = {});
  21374. var n = e.maxEdge || 1 / 0,
  21375. r = xe(function (t) {
  21376. var e = [],
  21377. n = {};
  21378. return F(t, (function (t) {
  21379. if (t.geometry) {
  21380. var r = t.geometry.coordinates.join("-");
  21381. Object.prototype.hasOwnProperty.call(n, r) || (e.push(t), n[r] = !0)
  21382. }
  21383. })), f(e)
  21384. }(t));
  21385. if (r.features = r.features.filter((function (t) {
  21386. var r = t.geometry.coordinates[0][0],
  21387. i = t.geometry.coordinates[0][1],
  21388. o = t.geometry.coordinates[0][2],
  21389. s = me(r, i, e),
  21390. a = me(i, o, e),
  21391. u = me(r, o, e);
  21392. return s <= n && a <= n && u <= n
  21393. })), r.features.length < 1) return null;
  21394. var i = $e(r);
  21395. return 1 === i.coordinates.length && (i.coordinates = i.coordinates[0], i.type = "Polygon"), o(i)
  21396. }, t.containsNumber = $, t.convertArea = S, t.convertDistance = N, t.convertLength = N, t.convex = de, t.coordAll = G, t.coordEach = R, t.coordReduce = T, t.createBins = au, t.degrees2radians = I, t.degreesToRadians = I, t.destination = vn, t.difference = function (t, e) {
  21397. var n = rt(t),
  21398. r = rt(e),
  21399. i = t.properties || {},
  21400. o = $u.difference(n.coordinates, r.coordinates);
  21401. return 0 === o.length ? null : 1 === o.length ? l(o[0], i) : y(o, i)
  21402. }, t.dissolve = function (t, e) {
  21403. if (!P(e = e || {})) throw new Error("options is invalid");
  21404. var n = e.propertyName;
  21405. nt(t, "Polygon", "dissolve");
  21406. var r = [];
  21407. if (!e.propertyName) return ni(y($u.union.apply(null, t.features.map((function (t) {
  21408. return t.geometry.coordinates
  21409. })))));
  21410. var i = {};
  21411. F(t, (function (t) {
  21412. Object.prototype.hasOwnProperty.call(i, t.properties[n]) || (i[t.properties[n]] = []), i[t.properties[n]].push(t)
  21413. }));
  21414. for (var o = Object.keys(i), s = 0; s < o.length; s++) {
  21415. var a = y($u.union.apply(null, i[o[s]].map((function (t) {
  21416. return t.geometry.coordinates
  21417. }))));
  21418. a.properties[n] = o[s], r.push(a)
  21419. }
  21420. return ni(f(r))
  21421. }, t.distance = me, t.distanceToDegrees = E, t.distanceToRadians = x, t.distanceWeight = ja, t.earthRadius = e, t.ellipse = Aa, t.envelope = dn, t.explode = bn, t.factors = n, t.feature = o, t.featureCollection = f, t.featureEach = F, t.featureOf = et, t.featureReduce = k, t.filterProperties = cu, t.findPoint = W, t.findSegment = H, t.flatten = ni, t.flattenEach = z, t.flattenReduce = j, t.flip = function (t, e) {
  21422. if (!P(e = e || {})) throw new Error("options is invalid");
  21423. var n = e.mutate;
  21424. if (!t) throw new Error("geojson is required");
  21425. return !1 !== n && void 0 !== n || (t = Ie(t)), R(t, (function (t) {
  21426. var e = t[0],
  21427. n = t[1];
  21428. t[0] = n, t[1] = e
  21429. })), t
  21430. }, t.geojsonType = tt, t.geomEach = q, t.geomReduce = B, t.geometry = s, t.geometryCollection = v, t.getCluster = iu, t.getCoord = K, t.getCoords = Q, t.getGeom = rt, t.getType = it, t.greatCircle = function (t, e, n) {
  21431. if ("object" != typeof (n = n || {})) throw new Error("options is invalid");
  21432. var r = n.properties,
  21433. i = n.npoints,
  21434. o = n.offset;
  21435. return t = K(t), e = K(e), r = r || {}, i = i || 100, o = o || 10, new vi({
  21436. x: t[0],
  21437. y: t[1]
  21438. }, {
  21439. x: e[0],
  21440. y: e[1]
  21441. }, r).Arc(i, {
  21442. offset: o
  21443. }).json()
  21444. }, t.helpers = O, t.hexGrid = ay, t.inside = ye, t.interpolate = function (t, e, n) {
  21445. if ("object" != typeof (n = n || {})) throw new Error("options is invalid");
  21446. var r = n.gridType,
  21447. i = n.property,
  21448. o = n.weight;
  21449. if (!t) throw new Error("points is required");
  21450. if (nt(t, "Point", "input must contain Points"), !e) throw new Error("cellSize is required");
  21451. if (void 0 !== o && "number" != typeof o) throw new Error("weight must be a number");
  21452. i = i || "elevation", r = r || "square", o = o || 1;
  21453. var s, a = Z(t);
  21454. switch (r) {
  21455. case "point":
  21456. case "points":
  21457. s = ti(a, e, n);
  21458. break;
  21459. case "square":
  21460. case "squares":
  21461. s = py(a, e, n);
  21462. break;
  21463. case "hex":
  21464. case "hexes":
  21465. s = ay(a, e, n);
  21466. break;
  21467. case "triangle":
  21468. case "triangles":
  21469. s = fy(a, e, n);
  21470. break;
  21471. default:
  21472. throw new Error("invalid gridType")
  21473. }
  21474. var u = [];
  21475. return F(s, (function (e) {
  21476. var s = 0,
  21477. a = 0;
  21478. F(t, (function (t) {
  21479. var u, l = me("point" === r ? e : En(e), t, n);
  21480. if (void 0 !== i && (u = t.properties[i]), void 0 === u && (u = t.geometry.coordinates[2]), void 0 === u) throw new Error("zValue is missing");
  21481. 0 === l && (s = u);
  21482. var c = 1 / Math.pow(l, o);
  21483. a += c, s += c * u
  21484. }));
  21485. var l = Ie(e);
  21486. l.properties[i] = s / a, u.push(l)
  21487. })), f(u)
  21488. }, t.intersect = sy, t.invariant = ot, t.isNumber = C, t.isObject = P, t.isobands = function (t, e, n) {
  21489. if (!P(n = n || {})) throw new Error("options is invalid");
  21490. var r = n.zProperty || "elevation",
  21491. i = n.commonProperties || {},
  21492. o = n.breaksProperties || [];
  21493. if (nt(t, "Point", "Input must contain Points"), !e) throw new Error("breaks is required");
  21494. if (!Array.isArray(e)) throw new Error("breaks is not an Array");
  21495. if (!P(i)) throw new Error("commonProperties is not an Object");
  21496. if (!Array.isArray(o)) throw new Error("breaksProperties is not an Array");
  21497. var s = Zi(t, {
  21498. zProperty: r,
  21499. flip: !0
  21500. }),
  21501. a = function (t, e, n) {
  21502. for (var r = [], i = 1; i < e.length; i++) {
  21503. var o = +e[i - 1],
  21504. s = +e[i],
  21505. a = Zo(Jo($i(t, o, s - o))),
  21506. u = {};
  21507. u.groupedRings = a, u[n] = o + "-" + s, r.push(u)
  21508. }
  21509. return r
  21510. }(s, e, r);
  21511. return f((a = function (t, e, n) {
  21512. var r = Z(n),
  21513. i = r[2] - r[0],
  21514. o = r[3] - r[1],
  21515. s = r[0],
  21516. a = r[1],
  21517. u = e[0].length - 1,
  21518. l = e.length - 1,
  21519. c = i / u,
  21520. h = o / l,
  21521. p = function (t) {
  21522. t[0] = t[0] * c + s, t[1] = t[1] * h + a
  21523. };
  21524. return t.forEach((function (t) {
  21525. t.groupedRings.forEach((function (t) {
  21526. t.forEach((function (t) {
  21527. t.forEach(p)
  21528. }))
  21529. }))
  21530. })), t
  21531. }(a, s, t)).map((function (t, e) {
  21532. if (o[e] && !P(o[e])) throw new Error("Each mappedProperty is required to be an Object");
  21533. var n = ct({}, i, o[e]);
  21534. return n[r] = t[r], y(t.groupedRings, n)
  21535. })))
  21536. }, t.isolines = function (t, e, n) {
  21537. if (!P(n = n || {})) throw new Error("options is invalid");
  21538. var r = n.zProperty || "elevation",
  21539. i = n.commonProperties || {},
  21540. o = n.breaksProperties || [];
  21541. if (nt(t, "Point", "Input must contain Points"), !e) throw new Error("breaks is required");
  21542. if (!Array.isArray(e)) throw new Error("breaks must be an Array");
  21543. if (!P(i)) throw new Error("commonProperties must be an Object");
  21544. if (!Array.isArray(o)) throw new Error("breaksProperties must be an Array");
  21545. var s = _t(t, {
  21546. zProperty: r,
  21547. flip: !0
  21548. });
  21549. return f(function (t, e, n) {
  21550. var r = Z(n),
  21551. i = r[2] - r[0],
  21552. o = r[3] - r[1],
  21553. s = r[0],
  21554. a = r[1],
  21555. u = e[0].length - 1,
  21556. l = e.length - 1,
  21557. c = i / u,
  21558. h = o / l,
  21559. p = function (t) {
  21560. t[0] = t[0] * c + s, t[1] = t[1] * h + a
  21561. };
  21562. return t.forEach((function (t) {
  21563. R(t, p)
  21564. })), t
  21565. }(function (t, e, n, r, i) {
  21566. for (var o = [], s = 1; s < e.length; s++) {
  21567. var a = +e[s],
  21568. u = ct({}, r, i[s]);
  21569. u[n] = a;
  21570. var l = g(ft(t, a), u);
  21571. o.push(l)
  21572. }
  21573. return o
  21574. }(s, e, r, i, o), s, t))
  21575. }, t.kinks = function (t) {
  21576. var e, n, r = {
  21577. type: "FeatureCollection",
  21578. features: []
  21579. };
  21580. if ("LineString" === (n = "Feature" === t.type ? t.geometry : t).type) e = [n.coordinates];
  21581. else if ("MultiLineString" === n.type) e = n.coordinates;
  21582. else if ("MultiPolygon" === n.type) e = [].concat.apply([], n.coordinates);
  21583. else {
  21584. if ("Polygon" !== n.type) throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");
  21585. e = n.coordinates
  21586. }
  21587. return e.forEach((function (t) {
  21588. e.forEach((function (e) {
  21589. for (var n = 0; n < t.length - 1; n++)
  21590. for (var i = n; i < e.length - 1; i++) {
  21591. if (t === e) {
  21592. if (1 === Math.abs(n - i)) continue;
  21593. if (0 === n && i === t.length - 2 && t[n][0] === t[t.length - 1][0] && t[n][1] === t[t.length - 1][1]) continue
  21594. }
  21595. var o = Gr(t[n][0], t[n][1], t[n + 1][0], t[n + 1][1], e[i][0], e[i][1], e[i + 1][0], e[i + 1][1]);
  21596. o && r.features.push(a([o[0], o[1]]))
  21597. }
  21598. }))
  21599. })), r
  21600. }, t.length = Yr, t.lengthToDegrees = E, t.lengthToRadians = x, t.lineArc = bi, t.lineChunk = function (t, e, n) {
  21601. if (!P(n = n || {})) throw new Error("options is invalid");
  21602. var r = n.units,
  21603. i = n.reverse;
  21604. if (!t) throw new Error("geojson is required");
  21605. if (e <= 0) throw new Error("segmentLength must be greater than 0");
  21606. var o = [];
  21607. return z(t, (function (t) {
  21608. i && (t.geometry.coordinates = t.geometry.coordinates.reverse()),
  21609. function (t, e, n, r) {
  21610. var i = Yr(t, {
  21611. units: n
  21612. });
  21613. if (i <= e) return r(t);
  21614. var o = i / e;
  21615. Number.isInteger(o) || (o = Math.floor(o) + 1);
  21616. for (var s = 0; s < o; s++) {
  21617. r(Hr(t, e * s, e * (s + 1), {
  21618. units: n
  21619. }), s)
  21620. }
  21621. }(t, e, r, (function (t) {
  21622. o.push(t)
  21623. }))
  21624. })), f(o)
  21625. }, t.lineDistance = Yr, t.lineEach = X, t.lineIntersect = Or, t.lineOffset = function (t, e, n) {
  21626. if (!P(n = n || {})) throw new Error("options is invalid");
  21627. var r = n.units;
  21628. if (!t) throw new Error("geojson is required");
  21629. if (null == e || isNaN(e)) throw new Error("distance is required");
  21630. var i = it(t),
  21631. o = t.properties;
  21632. switch (i) {
  21633. case "LineString":
  21634. return os(t, e, r);
  21635. case "MultiLineString":
  21636. var s = [];
  21637. return z(t, (function (t) {
  21638. s.push(os(t, e, r).geometry.coordinates)
  21639. })), g(s, o);
  21640. default:
  21641. throw new Error("geometry " + i + " is not supported")
  21642. }
  21643. }, t.lineOverlap = ki, t.lineReduce = Y, t.lineSegment = Zn, t.lineSlice = function (t, e, n) {
  21644. var r = Q(n);
  21645. if ("LineString" !== it(n)) throw new Error("line must be a LineString");
  21646. for (var i, o = Tr(n, t), s = Tr(n, e), a = [(i = o.properties.index <= s.properties.index ? [o, s] : [s, o])[0].geometry.coordinates], u = i[0].properties.index + 1; u < i[1].properties.index + 1; u++) a.push(r[u]);
  21647. return a.push(i[1].geometry.coordinates), h(a, n.properties)
  21648. }, t.lineSliceAlong = Hr, t.lineSplit = function (t, e) {
  21649. if (!t) throw new Error("line is required");
  21650. if (!e) throw new Error("splitter is required");
  21651. var n = it(t),
  21652. r = it(e);
  21653. if ("LineString" !== n) throw new Error("line must be LineString");
  21654. if ("FeatureCollection" === r) throw new Error("splitter cannot be a FeatureCollection");
  21655. if ("GeometryCollection" === r) throw new Error("splitter cannot be a GeometryCollection");
  21656. var i = ei(e, {
  21657. precision: 7
  21658. });
  21659. switch (r) {
  21660. case "Point":
  21661. return mi(t, i);
  21662. case "MultiPoint":
  21663. return _i(t, i);
  21664. case "LineString":
  21665. case "MultiLineString":
  21666. case "Polygon":
  21667. case "MultiPolygon":
  21668. return _i(t, Or(t, i))
  21669. }
  21670. }, t.lineString = h, t.lineStringToPolygon = Ci, t.lineStrings = p, t.lineToPolygon = Ci, t.mask = function (t, e) {
  21671. var n, r = hy(e),
  21672. i = null;
  21673. return "FeatureCollection" === t.type ? i = cy(2 === (n = t).features.length ? $u.union(n.features[0].geometry.coordinates, n.features[1].geometry.coordinates) : $u.union.apply($u, n.features.map((function (t) {
  21674. return t.geometry.coordinates
  21675. })))) : i = cy($u.union(t.geometry.coordinates)), i.geometry.coordinates.forEach((function (t) {
  21676. r.geometry.coordinates.push(t[0])
  21677. })), r
  21678. }, t.meta = J, t.midpoint = function (t, e) {
  21679. return vn(t, me(t, e) / 2, mn(t, e))
  21680. }, t.moranIndex = function (t, e) {
  21681. var n = e.inputField,
  21682. r = e.threshold || 1e5,
  21683. i = e.p || 2,
  21684. o = e.binary || !1,
  21685. s = ja(t, {
  21686. alpha: e.alpha || -1,
  21687. binary: o,
  21688. p: i,
  21689. standardization: e.standardization || !0,
  21690. threshold: r
  21691. }),
  21692. a = [];
  21693. F(t, (function (t) {
  21694. var e = t.properties || {};
  21695. a.push(e[n])
  21696. }));
  21697. for (var u = Ua(a), l = function (t) {
  21698. for (var e = Ua(t), n = 0, r = 0, i = t; r < i.length; r++) {
  21699. var o = i[r];
  21700. n += Math.pow(o - e, 2)
  21701. }
  21702. return n / t.length
  21703. }(a), c = 0, h = 0, p = 0, f = 0, g = s.length, d = 0; d < g; d++) {
  21704. for (var y = 0, v = 0; v < g; v++) c += s[d][v] * (a[d] - u) * (a[v] - u), h += s[d][v], p += Math.pow(s[d][v] + s[v][d], 2), y += s[d][v] + s[v][d];
  21705. f += Math.pow(y, 2)
  21706. }
  21707. var _ = c / h / l,
  21708. m = -1 / (g - 1),
  21709. x = (g * g * (p *= .5) - g * f + h * h * 3) / ((g - 1) * (g + 1) * (h * h)) - m * m,
  21710. E = Math.sqrt(x);
  21711. return {
  21712. expectedMoranIndex: m,
  21713. moranIndex: _,
  21714. stdNorm: E,
  21715. zNorm: (_ - m) / E
  21716. }
  21717. }, t.multiLineString = g, t.multiPoint = d, t.multiPolygon = y, t.nearest = Jn, t.nearestPoint = Jn, t.nearestPointOnLine = Tr, t.nearestPointToLine = function (t, e, n) {
  21718. void 0 === n && (n = {});
  21719. var r = n.units,
  21720. i = n.properties || {},
  21721. o = function (t) {
  21722. var e = [];
  21723. switch (t.geometry ? t.geometry.type : t.type) {
  21724. case "GeometryCollection":
  21725. return q(t, (function (t) {
  21726. "Point" === t.type && e.push({
  21727. type: "Feature",
  21728. properties: {},
  21729. geometry: t
  21730. })
  21731. })), {
  21732. type: "FeatureCollection",
  21733. features: e
  21734. };
  21735. case "FeatureCollection":
  21736. return t.features = t.features.filter((function (t) {
  21737. return "Point" === t.geometry.type
  21738. })), t;
  21739. default:
  21740. throw new Error("points must be a Point Collection")
  21741. }
  21742. }(t);
  21743. if (!o.features.length) throw new Error("points must contain features");
  21744. if (!e) throw new Error("line is required");
  21745. if ("LineString" !== it(e)) throw new Error("line must be a LineString");
  21746. var s = 1 / 0,
  21747. a = null;
  21748. return F(o, (function (t) {
  21749. var n = Dr(t, e, {
  21750. units: r
  21751. });
  21752. n < s && (s = n, a = t)
  21753. })), a && (a.properties = ct({
  21754. dist: s
  21755. }, a.properties, i)), a
  21756. }, t.planepoint = function (t, e) {
  21757. var n = K(t),
  21758. r = rt(e).coordinates[0];
  21759. if (r.length < 4) throw new Error("OuterRing of a Polygon must have 4 or more Positions.");
  21760. var i = e.properties || {},
  21761. o = i.a,
  21762. s = i.b,
  21763. a = i.c,
  21764. u = n[0],
  21765. l = n[1],
  21766. c = r[0][0],
  21767. h = r[0][1],
  21768. p = void 0 !== o ? o : r[0][2],
  21769. f = r[1][0],
  21770. g = r[1][1],
  21771. d = void 0 !== s ? s : r[1][2],
  21772. y = r[2][0],
  21773. v = r[2][1],
  21774. _ = void 0 !== a ? a : r[2][2];
  21775. return (_ * (u - c) * (l - g) + p * (u - f) * (l - v) + d * (u - y) * (l - h) - d * (u - c) * (l - v) - _ * (u - f) * (l - h) - p * (u - y) * (l - g)) / ((u - c) * (l - g) + (u - f) * (l - v) + (u - y) * (l - h) - (u - c) * (l - v) - (u - f) * (l - h) - (u - y) * (l - g))
  21776. }, t.point = a, t.pointGrid = ti, t.pointOnFeature = qr, t.pointOnLine = Tr, t.pointOnSurface = qr, t.pointToLineDistance = Dr, t.points = u, t.pointsWithinPolygon = _e, t.polygon = l, t.polygonSmooth = function (t, e) {
  21777. var n = [],
  21778. r = e.iterations || 1;
  21779. if (!t) throw new Error("inputPolys is required");
  21780. return q(t, (function (t, e, i) {
  21781. var o, s, a;
  21782. switch (t.type) {
  21783. case "Polygon":
  21784. o = [
  21785. []
  21786. ];
  21787. for (var u = 0; u < r; u++) a = [
  21788. []
  21789. ], s = t, u > 0 && (s = l(o).geometry), qa(s, a), o = a.slice(0);
  21790. n.push(l(o, i));
  21791. break;
  21792. case "MultiPolygon":
  21793. o = [
  21794. [
  21795. []
  21796. ]
  21797. ];
  21798. for (var c = 0; c < r; c++) a = [
  21799. [
  21800. []
  21801. ]
  21802. ], s = t, c > 0 && (s = y(o).geometry), Ba(s, a), o = a.slice(0);
  21803. n.push(y(o, i));
  21804. break;
  21805. default:
  21806. throw new Error("geometry is invalid, must be Polygon or MultiPolygon")
  21807. }
  21808. })), f(n)
  21809. }, t.polygonTangents = function (t, e) {
  21810. var n, r, i, o, s = Q(t),
  21811. u = Q(e),
  21812. l = Z(e),
  21813. c = 0,
  21814. h = null;
  21815. switch (s[0] > l[0] && s[0] < l[2] && s[1] > l[1] && s[1] < l[3] && (c = (h = Jn(t, bn(e))).properties.featureIndex), it(e)) {
  21816. case "Polygon":
  21817. n = u[0][c], r = u[0][0], null !== h && h.geometry.coordinates[1] < s[1] && (r = u[0][c]), o = Xi(u[0][0], u[0][u[0].length - 1], s);
  21818. var p = Ui(u[0], s, o, i, n, r);
  21819. n = p[0], r = p[1];
  21820. break;
  21821. case "MultiPolygon":
  21822. for (var g = 0, d = 0, y = 0, v = 0; v < u[0].length; v++) {
  21823. g = v;
  21824. for (var _ = !1, m = 0; m < u[0][v].length; m++) {
  21825. if (d = m, y === c) {
  21826. _ = !0;
  21827. break
  21828. }
  21829. y++
  21830. }
  21831. if (_) break
  21832. }
  21833. n = u[0][g][d], r = u[0][g][d], o = Xi(u[0][0][0], u[0][0][u[0][0].length - 1], s), u.forEach((function (t) {
  21834. var e = Ui(t[0], s, o, i, n, r);
  21835. n = e[0], r = e[1]
  21836. }))
  21837. }
  21838. return f([a(n), a(r)])
  21839. }, t.polygonToLine = Ii, t.polygonToLineString = Ii, t.polygonize = function (t) {
  21840. var e = hs.fromGeoJson(t);
  21841. e.deleteDangles(), e.deleteCutEdges();
  21842. var n = [],
  21843. r = [];
  21844. return e.getEdgeRings().filter((function (t) {
  21845. return t.isValid()
  21846. })).forEach((function (t) {
  21847. t.isHole() ? n.push(t) : r.push(t)
  21848. })), n.forEach((function (t) {
  21849. cs.findEdgeRingContaining(t, r) && r.push(t)
  21850. })), f(r.map((function (t) {
  21851. return t.toPolygon()
  21852. })))
  21853. }, t.polygons = c, t.projection = Ja, t.propEach = A, t.propReduce = D, t.propertiesContainsFilter = lu, t.radians2degrees = w, t.radiansToDegrees = w, t.radiansToDistance = m, t.radiansToLength = m, t.random = ru, t.randomLineString = tu, t.randomPoint = Qa, t.randomPolygon = $a, t.randomPosition = Ka, t.rewind = function (t, e) {
  21854. if (!P(e = e || {})) throw new Error("options is invalid");
  21855. var n = e.reverse || !1,
  21856. r = e.mutate || !1;
  21857. if (!t) throw new Error("<geojson> is required");
  21858. if ("boolean" != typeof n) throw new Error("<reverse> must be a boolean");
  21859. if ("boolean" != typeof r) throw new Error("<mutate> must be a boolean");
  21860. !1 === r && (t = Ie(t));
  21861. var i = [];
  21862. switch (t.type) {
  21863. case "GeometryCollection":
  21864. return q(t, (function (t) {
  21865. Hi(t, n)
  21866. })), t;
  21867. case "FeatureCollection":
  21868. return F(t, (function (t) {
  21869. F(Hi(t, n), (function (t) {
  21870. i.push(t)
  21871. }))
  21872. })), f(i)
  21873. }
  21874. return Hi(t, n)
  21875. }, t.rhumbBearing = Bi, t.rhumbDestination = ji, t.rhumbDistance = Ar, t.round = _, t.sample = function (t, e) {
  21876. if (!t) throw new Error("featurecollection is required");
  21877. if (null == e) throw new Error("num is required");
  21878. if ("number" != typeof e) throw new Error("num must be a number");
  21879. return f(function (t, e) {
  21880. var n, r, i = t.slice(0),
  21881. o = t.length,
  21882. s = o - e;
  21883. for (; o-- > s;) n = i[r = Math.floor((o + 1) * Math.random())], i[r] = i[o], i[o] = n;
  21884. return i.slice(s)
  21885. }(t.features, e))
  21886. }, t.sector = function (t, e, n, r, i) {
  21887. if (!P(i = i || {})) throw new Error("options is invalid");
  21888. var o = i.properties;
  21889. if (!t) throw new Error("center is required");
  21890. if (null == n) throw new Error("bearing1 is required");
  21891. if (null == r) throw new Error("bearing2 is required");
  21892. if (!e) throw new Error("radius is required");
  21893. if ("object" != typeof i) throw new Error("options must be an object");
  21894. if (qi(n) === qi(r)) return _n(t, e, i);
  21895. var s = Q(t),
  21896. a = bi(t, e, n, r, i),
  21897. u = [
  21898. [s]
  21899. ];
  21900. return R(a, (function (t) {
  21901. u[0].push(t)
  21902. })), u[0].push(s), l(u, o)
  21903. }, t.segmentEach = U, t.segmentReduce = V, t.shortestPath = function (t, e, n) {
  21904. if (!P(n = n || {})) throw new Error("options is invalid");
  21905. var r = n.resolution,
  21906. i = n.minDistance,
  21907. s = n.obstacles || f([]);
  21908. if (!t) throw new Error("start is required");
  21909. if (!e) throw new Error("end is required");
  21910. if (r && !C(r) || r <= 0) throw new Error("options.resolution must be a number, greater than 0");
  21911. if (i) throw new Error("options.minDistance is not yet implemented");
  21912. var u = K(t),
  21913. l = K(e);
  21914. switch (t = a(u), e = a(l), it(s)) {
  21915. case "FeatureCollection":
  21916. if (0 === s.features.length) return h([u, l]);
  21917. break;
  21918. case "Polygon":
  21919. s = f([o(rt(s))]);
  21920. break;
  21921. default:
  21922. throw new Error("invalid obstacles")
  21923. }
  21924. var c = s;
  21925. c.features.push(t), c.features.push(e);
  21926. var p = Z(ts(gn(Z(c)), 1.15));
  21927. r || (r = me([p[0], p[1]], [p[2], p[1]], n) / 100), c.features.pop(), c.features.pop();
  21928. for (var g = p[0], d = p[1], y = p[2], v = p[3], _ = r / me([g, d], [y, d], n) * (y - g), m = r / me([g, d], [g, v], n) * (v - d), x = y - g, E = v - d, b = Math.floor(x / _), w = Math.floor(E / m), I = (x - b * _) / 2, N = [], S = [], M = [], L = [], O = 1 / 0, R = 1 / 0, T = v - (E - w * m) / 2, A = 0; T >= d;) {
  21929. for (var D = [], F = [], k = g + I, G = 0; k <= y;) {
  21930. var q = a([k, T]),
  21931. B = Js(q, s);
  21932. D.push(B ? 0 : 1), F.push(k + "|" + T);
  21933. var z = me(q, t);
  21934. !B && z < O && (O = z, M = {
  21935. x: G,
  21936. y: A
  21937. });
  21938. var j = me(q, e);
  21939. !B && j < R && (R = j, L = {
  21940. x: G,
  21941. y: A
  21942. }), k += _, G++
  21943. }
  21944. S.push(D), N.push(F), T -= m, A++
  21945. }
  21946. var U = new Ys(S, {
  21947. diagonal: !0
  21948. }),
  21949. V = U.grid[M.y][M.x],
  21950. X = U.grid[L.y][L.x],
  21951. Y = Xs.search(U, V, X),
  21952. H = [u];
  21953. return Y.forEach((function (t) {
  21954. var e = N[t.x][t.y].split("|");
  21955. H.push([+e[0], +e[1]])
  21956. })), H.push(l), tn(h(H))
  21957. }, t.simplify = function (t, e) {
  21958. if (!P(e = e || {})) throw new Error("options is invalid");
  21959. var n = void 0 !== e.tolerance ? e.tolerance : 1,
  21960. r = e.highQuality || !1,
  21961. i = e.mutate || !1;
  21962. if (!t) throw new Error("geojson is required");
  21963. if (n && n < 0) throw new Error("invalid tolerance");
  21964. return !0 !== i && (t = Ie(t)), q(t, (function (t) {
  21965. ! function (t, e, n) {
  21966. var r = t.type;
  21967. if ("Point" === r || "MultiPoint" === r) return t;
  21968. tn(t, !0);
  21969. var i = t.coordinates;
  21970. switch (r) {
  21971. case "LineString":
  21972. t.coordinates = ln(i, e, n);
  21973. break;
  21974. case "MultiLineString":
  21975. t.coordinates = i.map((function (t) {
  21976. return ln(t, e, n)
  21977. }));
  21978. break;
  21979. case "Polygon":
  21980. t.coordinates = cn(i, e, n);
  21981. break;
  21982. case "MultiPolygon":
  21983. t.coordinates = i.map((function (t) {
  21984. return cn(t, e, n)
  21985. }))
  21986. }
  21987. }(t, n, r)
  21988. })), t
  21989. }, t.square = yn, t.squareGrid = py, t.standardDeviationalEllipse = function (t, e) {
  21990. if (!P(e = e || {})) throw new Error("options is invalid");
  21991. var n = e.steps || 64,
  21992. r = e.weight,
  21993. i = e.properties || {};
  21994. if (!C(n)) throw new Error("steps must be a number");
  21995. if (!P(i)) throw new Error("properties must be a number");
  21996. var o = G(t).length,
  21997. s = Fa(t, {
  21998. weight: r
  21999. }),
  22000. a = 0,
  22001. u = 0,
  22002. l = 0;
  22003. F(t, (function (t) {
  22004. var e = t.properties[r] || 1,
  22005. n = Ga(Q(t), Q(s));
  22006. a += Math.pow(n.x, 2) * e, u += Math.pow(n.y, 2) * e, l += n.x * n.y * e
  22007. }));
  22008. var c = a - u,
  22009. h = Math.sqrt(Math.pow(c, 2) + 4 * Math.pow(l, 2)),
  22010. p = 2 * l,
  22011. g = Math.atan((c + h) / p),
  22012. d = 180 * g / Math.PI,
  22013. y = 0,
  22014. v = 0,
  22015. _ = 0;
  22016. F(t, (function (t) {
  22017. var e = t.properties[r] || 1,
  22018. n = Ga(Q(t), Q(s));
  22019. y += Math.pow(n.x * Math.cos(g) - n.y * Math.sin(g), 2) * e, v += Math.pow(n.x * Math.sin(g) + n.y * Math.cos(g), 2) * e, _ += e
  22020. }));
  22021. var m = Math.sqrt(2 * y / _),
  22022. x = Math.sqrt(2 * v / _),
  22023. E = Aa(s, m, x, {
  22024. units: "degrees",
  22025. angle: d,
  22026. steps: n,
  22027. properties: i
  22028. }),
  22029. b = _e(t, f([E])),
  22030. w = {
  22031. meanCenterCoordinates: Q(s),
  22032. semiMajorAxis: m,
  22033. semiMinorAxis: x,
  22034. numberOfFeatures: o,
  22035. angle: d,
  22036. percentageWithinEllipse: 100 * G(b).length / o
  22037. };
  22038. return E.properties.standardDeviationalEllipse = w, E
  22039. }, t.tag = function (t, e, n, r) {
  22040. return t = Ie(t), e = Ie(e), F(t, (function (t) {
  22041. t.properties || (t.properties = {}), F(e, (function (e) {
  22042. void 0 === t.properties[r] && ye(t, e) && (t.properties[r] = e.properties[n])
  22043. }))
  22044. })), t
  22045. }, t.tesselate = function (t) {
  22046. if (!t.geometry || "Polygon" !== t.geometry.type && "MultiPolygon" !== t.geometry.type) throw new Error("input must be a Polygon or MultiPolygon");
  22047. var e = {
  22048. type: "FeatureCollection",
  22049. features: []
  22050. };
  22051. return "Polygon" === t.geometry.type ? e.features = Wn(t.geometry.coordinates) : t.geometry.coordinates.forEach((function (t) {
  22052. e.features = e.features.concat(Wn(t))
  22053. })), e
  22054. }, t.tin = xe, t.toMercator = Va, t.toWgs84 = Xa, t.transformRotate = $o, t.transformScale = ts, t.transformTranslate = function (t, e, n, r) {
  22055. if (!P(r = r || {})) throw new Error("options is invalid");
  22056. var i = r.units,
  22057. o = r.zTranslation,
  22058. s = r.mutate;
  22059. if (!t) throw new Error("geojson is required");
  22060. if (null == e || isNaN(e)) throw new Error("distance is required");
  22061. if (o && "number" != typeof o && isNaN(o)) throw new Error("zTranslation is not a number");
  22062. if (o = void 0 !== o ? o : 0, 0 === e && 0 === o) return t;
  22063. if (null == n || isNaN(n)) throw new Error("direction is required");
  22064. return e < 0 && (e = -e, n += 180), !1 !== s && void 0 !== s || (t = Ie(t)), R(t, (function (t) {
  22065. var r = Q(ji(t, e, n, {
  22066. units: i
  22067. }));
  22068. t[0] = r[0], t[1] = r[1], o && 3 === t.length && (t[2] += o)
  22069. })), t
  22070. }, t.triangleGrid = fy, t.truncate = ei, t.union = function (t, e, n) {
  22071. void 0 === n && (n = {});
  22072. var r = rt(t),
  22073. i = rt(e),
  22074. o = $u.union(r.coordinates, i.coordinates);
  22075. return 0 === o.length ? null : 1 === o.length ? l(o[0], n.properties) : y(o, n.properties)
  22076. }, t.unitsFactors = r, t.unkinkPolygon = function (t) {
  22077. var e = [];
  22078. return z(t, (function (t) {
  22079. "Polygon" === t.geometry.type && F(oi(t), (function (n) {
  22080. e.push(l(n.geometry.coordinates, t.properties))
  22081. }))
  22082. })), f(e)
  22083. }, t.validateBBox = M, t.validateId = L, t.voronoi = function (t, e) {
  22084. if (!P(e = e || {})) throw new Error("options is invalid");
  22085. var n = e.bbox || [-180, -85, 180, 85];
  22086. if (!t) throw new Error("points is required");
  22087. if (!Array.isArray(n)) throw new Error("bbox is invalid");
  22088. return nt(t, "Point", "points"), f(function () {
  22089. var t = Ks,
  22090. e = Qs,
  22091. n = null;
  22092. function r(r) {
  22093. return new Ra(r.map((function (n, i) {
  22094. var o = [Math.round(t(n, i, r) / Ma) * Ma, Math.round(e(n, i, r) / Ma) * Ma];
  22095. return o.index = i, o.data = n, o
  22096. })), n)
  22097. }
  22098. return r.polygons = function (t) {
  22099. return r(t).polygons()
  22100. }, r.links = function (t) {
  22101. return r(t).links()
  22102. }, r.triangles = function (t) {
  22103. return r(t).triangles()
  22104. }, r.x = function (e) {
  22105. return arguments.length ? (t = "function" == typeof e ? e : Zs(+e), r) : t
  22106. }, r.y = function (t) {
  22107. return arguments.length ? (e = "function" == typeof t ? t : Zs(+t), r) : e
  22108. }, r.extent = function (t) {
  22109. return arguments.length ? (n = null == t ? null : [
  22110. [+t[0][0], +t[0][1]],
  22111. [+t[1][0], +t[1][1]]
  22112. ], r) : n && [
  22113. [n[0][0], n[0][1]],
  22114. [n[1][0], n[1][1]]
  22115. ]
  22116. }, r.size = function (t) {
  22117. return arguments.length ? (n = null == t ? null : [
  22118. [0, 0],
  22119. [+t[0], +t[1]]
  22120. ], r) : n && [n[1][0] - n[0][0], n[1][1] - n[0][1]]
  22121. }, r
  22122. }().x((function (t) {
  22123. return t.geometry.coordinates[0]
  22124. })).y((function (t) {
  22125. return t.geometry.coordinates[1]
  22126. })).extent([
  22127. [n[0], n[1]],
  22128. [n[2], n[3]]
  22129. ]).polygons(t.features).map(Ta))
  22130. }, t.within = _e, Object.defineProperty(t, "__esModule", {
  22131. value: !0
  22132. })
  22133. }));