UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

2 lines • 569 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{Envelope2D as s}from"./Envelope2D.js";import{a as n,c as r,G as i,f as o,d as a,h,y as m,g as l,e as g,z as u,v as c,A as _,t as d,q as p,n as f,i as x,p as y,B as P,C as E,w as S,l as C,D as I,r as b}from"./Geometry.js";import{a as w,I as v,J as N,P as T,M as G,K as D,E as V,c as F,g as H,S as k,L as A,N as M,O as U,n as q,Q as B,R as O,y as Y,T as R,D as X,l as L,U as z,V as W,W as j,X as Z,Y as K,Z as Q,_ as J,$,a0 as ee,a1 as te,a2 as se,a3 as ne,a4 as re,a5 as ie,a6 as oe,a7 as ae,a8 as he,a9 as me,b as le}from"./MultiPathImpl.js";import{e as ge,d as ue,N as ce,Q as _e,i as de,g as pe,c as fe,E as xe,P as ye,C as Pe,h as Ee,R as Se,T as Ce,U as Ie,a as be,B as we,W as ve,b as Ne,X as Te,V as Ge,Y as De,p as Ve,Z as Fe,H as He,_ as ke,$ as Ae,a0 as Me,a1 as Ue,a2 as qe,k as Be,a3 as Oe,f as Ye,a4 as Re,a5 as Xe,S as Le,A as ze,a6 as We,a7 as je,j as Ze}from"./Envelope.js";import{at as Ke,au as Qe,n as Je,d as $e,P as et,av as tt,v as st,aw as nt,Q as rt,ax as it,l as ot,E as at,c as ht,e as mt,O as lt,m as gt,S as ut,q as ct,f as _t,K as dt,a as pt,r as ft,ay as xt,o as yt,s as Pt,az as Et,g as St,U as Ct,aA as It,B as bt,aB as wt,j as vt,b as Nt,i as Tt,h as Gt,k as Dt,a7 as Vt,aC as Ft,aD as Ht,aE as kt,H as At,M as Mt,J as Ut,aF as qt,aG as Bt,aH as Ot,aI as Yt,aJ as Rt,aq as Xt,y as Lt,aK as zt,p as Wt}from"./Point2D.js";import{T as jt}from"./Transformation2D.js";import{c as Zt,O as Kt,a as Qt}from"./OperatorClip.js";import{O as Jt}from"./OperatorDensify.js";import{G as $t}from"./GeometryCursor.js";import{S as es}from"./SimpleGeometryCursor.js";import{NonSimpleResult as ts}from"./OperatorDefinitions.js";class ss{constructor(e){if(this.m_geom=this.m_sr=null,e){if(e.move)return this.m_geom=e.move.m_geom,e.move.m_geom=null,this.m_sr=e.move.m_sr,void(e.move.m_sr=null);if(e.copy)return this.m_geom=e.copy.m_geom?e.copy.m_geom.clone():null,void(this.m_sr=e.copy.m_sr);e.geom&&(this.m_geom=e.geom),e.sr&&(this.m_sr=e.sr)}}getGeometry(){return this.m_geom}getSpatialReference(){return this.m_sr}setGeometry(e){this.m_geom=e}setSpatialReference(e){this.m_sr=e}equals(e,t){const s=e;return!(!this.m_sr&&s.m_sr)&&(!(this.m_sr&&!s.m_sr)&&(!(!this.m_geom&&s.m_geom)&&(!(this.m_geom&&!s.m_geom)&&(!(this.m_sr&&s.m_sr&&!this.m_sr.equals(s.m_sr))&&!(this.m_geom&&s.m_geom&&!this.m_geom.equals(s.m_geom,t))))))}clone(){let e=null;return this.m_geom&&(e=this.m_geom.clone()),new ss({geom:e,sr:this.m_sr})}hasGeom(){return!!this.m_geom}}class ns{constructor(e){this.m_factor=1,this.m_wkid=0,this.m_peUnit=null,e&&(this.m_peUnit=e,this.m_factor=e.getUnitFactor(),this.m_wkid=e.getCode(),this.m_wkid<0&&(this.m_wkid=0))}getName(){return this.m_peUnit?this.m_peUnit.getName():""}getID(){return this.m_wkid}getConversionFactor(e){return this.getUnitType()!==e.getUnitType()&&n("unit type mismatch"),this.getUnitToBaseFactor()/e.getUnitToBaseFactor()}getUnitToBaseFactor(){return this.m_factor}getHashCode(){return Ke(Qe(this.getUnitType()),Qe(this.getUnitToBaseFactor()))}equals(e){return!!e&&(this.getUnitType()===e.getUnitType()&&this.getUnitToBaseFactor()===e.getUnitToBaseFactor()&&this.getID()===e.getID()&&this.getName()===e.getName())}static isValidWkid(e){return!1}}const rs={330:104878,500:104879,1300:104899,1450:104986,2230:104988,3800:104978,5e3:104919,6200:104906,8200:104909,9500:104927,9600:104977,1e4:[104911,104936],11e3:104941,11080:104872,11100:104907,12e3:104920,12400:104995,13e3:104948,14e3:[104923,104989],15e3:[104913,104954],15100:104976,16e3:[104926,104931],18e3:[104922,104982],21e3:104947,21500:104877,27e3:[104950,104957],29e3:104964,3e4:104921,31e3:104949,33e3:104946,4e4:[104914,104967],40600:104897,41900:104937,42e3:104951,43100:104993,49300:104924,50100:104939,54e3:104955,58200:104981,59500:104930,74e3:104961,77e3:104956,79e3:104962,83500:104910,85e3:104917,88800:104934,89200:104985,96e3:104997,104e3:104963,106500:104898,11e4:104938,133e3:104932,135e3:104983,17e4:104965,198200:104987,198630:104935,208e3:104966,235800:104952,249400:104929,252100:104980,255e3:104973,47e4:104972,529800:104942,531e3:104996,56e4:104928,561400:104979,578900:104945,584700:104959,593e3:104970,606e3:104999,718e3:104933,745700:104984,761400:104953,763500:104994,764e3:104940,788900:104958,1188300:104998,1195e3:104969,1352600:104968,1560800:104874,1562090:104915,1737400:104903,1821460:104918,1821490:104876,2409300:104912,2410300:104873,2439400:104974,2439700:104900,2575e3:104943,2631200:104875,2632345:104916,3393400:104904,3396190:[104905,104971],6051e3:104901,6051800:104902,637e4:104128,6370997:[4052,37008],6371e3:4035,6371007:4047,6371228:[4053,10346],6376045:[8042,8043],6376523:[4027,4901,4902],6376896:37007,6378135:[4122,4322,4324,4720,4985,4987],6378136:[4740,4923,7678,7680,9474,9475,104017,104018],6378137:[3823,3824,3888,3889,4017,4019,4023,4031,4040,4046,4055,4074,4075,4080,4081,4121,4126,4130,4133,4140,4141,4148,4151,4152,4163,4166,4167,4170,4171,4172,4173,4176,4180,4189,4190,4258,4269,4283,4318,4319,4326,4463,4466,4469,4470,4480,4482,4483,4490,4557,4558,4612,4617,4619,4624,4627,4659,4661,4667,4669,4670,4674,4686,4687,4693,4694,4702,4737,4742,4747,4749,4750,4755,4756,4757,4758,4759,4761,4762,4763,4764,4765,4883,4885,4887,4889,4893,4895,4898,4907,4909,4921,4925,4927,4929,4931,4933,4935,4937,4939,4941,4943,4945,4947,4949,4951,4953,4955,4957,4959,4961,4963,4965,4967,4971,4975,4977,4979,4981,4983,4989,4997,4999,5012,5013,5245,5246,5251,5252,5263,5264,5323,5324,5340,5342,5353,5354,5359,5360,5364,5365,5370,5371,5372,5373,5380,5381,5392,5393,5488,5489,5545,5546,5592,5593,5885,5886,6134,6135,6310,6311,6318,6319,6321,6322,6324,6325,6364,6365,6667,6668,6705,6706,6782,6783,6980,6982,6983,6987,6989,6990,7034,7035,7036,7037,7038,7039,7040,7041,7042,7072,7073,7084,7085,7086,7087,7133,7135,7136,7138,7139,7372,7373,7657,7659,7661,7663,7665,7685,7686,7797,7798,7816,7843,7844,7880,7881,7885,7886,7900,7901,7902,7903,7904,7905,7906,7907,7908,7909,7910,7911,7912,7915,7917,7919,7921,7923,7925,7927,7929,7931,8085,8086,8231,8232,8235,8237,8239,8240,8244,8246,8248,8249,8251,8252,8254,8255,8399,8403,8426,8427,8449,8542,8544,8545,8684,8685,8698,8699,8817,8818,8860,8888,8899,8900,8901,8902,8906,8907,8916,8918,8920,8922,8924,8926,8928,8930,8932,8934,8936,8938,8940,8942,8944,8946,8948,8949,8972,8973,8974,8975,8976,8977,8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,8993,8994,8995,8996,8997,8998,8999,9e3,9002,9003,9005,9006,9008,9009,9011,9012,9013,9014,9016,9017,9018,9019,9053,9054,9055,9056,9057,9059,9060,9061,9062,9063,9064,9065,9066,9067,9068,9069,9071,9072,9074,9075,9139,9140,9147,9148,9152,9153,9183,9184,9293,9294,9299,9308,9309,9332,9333,9364,9372,9379,9380,9384,9453,9469,9470,9546,9547,9695,9696,9701,9702,9739,9754,9755,9758,9763,9776,9777,9778,9779,9781,9782,9783,9784,9866,9871,9939,9964,9969,9974,9989,9990,10175,10177,10178,10185,10191,10196,10204,10209,10214,10219,10224,10229,10237,10272,10277,10283,10284,10298,10299,10300,10304,10305,10307,10309,10310,10311,10312,10327,10328,10413,10414,10468,10474,10475,10570,10571,10605,10606,10623,10628,10638,10639,10670,10671,10672,10673,10689,10690,10724,10725,10738,10739,10761,10762,10780,10781,10784,10785,10790,10791,10799,10800,10830,10831,10849,10860,10909,10910,10940,10941,10951,10952,10955,10956,10958,10959,20033,20040,20041,20045,20046,104009,104010,104011,104012,104013,104014,104015,104016,104019,104020,104021,104022,104024,104027,104028,104030,104031,104033,104048,104049,104050,104100,104107,104108,104110,104111,104114,104115,104116,104117,104118,104119,104120,104121,104122,104123,104124,104129,104133,104134,104137,104141,104142,104143,104144,104145,104179,104180,104181,104182,104183,104184,104185,104186,104199,104220,104221,104223,104257,104258,104259,104260,104286,104287,104602,104613,104644,104645,104646,104647,104653,104804,104896,104991],6378140:4610,6378145:[4025,4276,4760,4891,37001],6378150:37003,6378155:[37004,37207],6378160:[3821,4003,4021,4036,4202,4203,4237,4238,4291,4618,4708,5527,37231,104023,104136],6378166:37002,6378200:[4020,4229,4286,4303,4706],6378245:[4024,4147,4164,4178,4179,4191,4200,4205,4214,4284,4317,4555,4676,4677,4678,4991,4993,5560,5561,37257,104135],6378270:[4732,37005,37229],6378273:[4054,10345],6378300:[4029,4168,4174],6378388:[4022,4123,4153,4154,4158,4159,4160,4161,4165,4181,4182,4183,4184,4185,4192,4194,4195,4196,4199,4204,4207,4208,4215,4218,4221,4224,4225,4230,4231,4233,4235,4236,4247,4248,4249,4254,4255,4259,4264,4265,4271,4272,4274,4285,4287,4288,4292,4297,4309,4311,4313,4316,4472,4475,4611,4614,4615,4616,4621,4622,4623,4625,4626,4628,4629,4630,4631,4632,4633,4636,4637,4639,4641,4642,4643,4644,4645,4646,4658,4660,4662,4663,4664,4665,4668,4672,4673,4684,4688,4689,4690,4691,4692,4698,4704,4705,4707,4709,4710,4711,4712,4714,4715,4716,4718,4719,4721,4722,4724,4725,4727,4728,4729,4730,4733,4734,4735,4739,4741,4753,4754,4802,4803,4806,4809,4810,4823,4824,4900,5524,6883,8428,8430,8431,9248,9251,9253,9403,9893,10158,10249,10252,10635,10636,10735,10736,10758,37e3,37201,37204,37205,37212,37213,37214,37215,37216,37217,37218,37219,37221,37222,37224,37226,37227,37230,37232,37233,37234,37235,37237,37238,37241,37242,37245,37246,37247,37249,37250,37251,37253,37259,104104,104106,104125,104126,104127,104130,104138,104248],6378523:104786,24764e3:104960,25559e3:104944,60268e3:104925,71492e3:104908,6957e5:104975,6377397.155:[3819,3906,4004,4120,4124,4125,4149,4150,4156,4162,4211,4219,4257,4262,4280,4289,4294,4295,4301,4306,4308,4312,4314,4613,4666,4745,4746,4801,4804,4805,4808,4813,4814,4815,4818,4820,4904,5132,5228,5229,5681,5830,8351,9267,10268,10898,37255,104101,104102,104105,104131,104648,104696,104697,104990,104992],6377563.396:[4001,4188,4277,4278,4279],6377340.189:[4002,4299,4300],6377492.018:[4005,4273,4817],6377483.865280418:[4006,4293],6378293.645208759:[4007,4157,4302,4738,5464],6378206.4:[4008,4127,4128,4129,4135,4136,4137,4138,4139,4169,4216,4242,4253,4267,4608,4609,4638,4675,4683,4695,4717,4723,4726,4995,5451,5467,37220,37239,37243,37252,37260,104e3,104109,104112,104113,104132],6378450.047:[4009,4268],6378300.789:[4010,4281],6378249.2:[4011,4014,4155,4193,4206,4213,4223,4226,4227,4228,4252,4261,4266,4275,4282,4296,4304,4310,4315,4671,4807,4811,4816,4821,37223,37225,104139,104140,104261,104304],6378249.145:[4012,4013,4132,4134,4142,4143,4175,4197,4198,4201,4209,4210,4212,4220,4222,4232,4234,4246,4250,4251,4256,4260,4263,4270,4305,4307,4600,4601,4602,4603,4604,4605,4606,4607,4620,4679,4680,4696,4697,4699,4700,4701,4703,4713,4731,4736,4743,4744,4812,4819,6881,6882,6892,6894,8694,37206,37208,37211,37228,37240,37254,104025,104026,104032,104103,104305],6377276.345:[4015,4131,4144,4239,4240,4244,4682,5233,6207,37202,104256,104664,104693],6377298.556:[4016,4298],6377304.063:[4018,4245],6378298.3:[4028,4903],6378136.2:4032,6378136.3:4033,6378249.144808011:[4034,4241],20922931.8:[4042,4243],6377301.243:[4044,4145,37203],6377299.151:[4045,4146],6377019.27:[4657,10256,10260,10265],6378306.3696:[4748,4752],6377295.664:[4751,37006],6378136.5:[7682,7683],6371008.7714:104047,6378418.941:[104700,104726,104760],6378586.581:[104701,104743],6378505.809:104702,6378544.823:104703,6378490.569:104704,6378470.757:[104705,104776],6378403.701:[104706,104750],6378434.181:[104707,104724,104739,104764],6378454.907:104708,6378400.653:104709,6378567.378:104710,6378546.957:[104711,104717,104780],6378476.853:[104712,104736],6378411.321:[104713,104728],6378647.541:[104714,104715],6378514.953:[104716,104782],6378421.989:[104718,104770],6378481.425:[104719,104753,104774,104781],6378518.001:[104720,104725],6378521.049:[104721,104723,104731,104745,104748],6378464.661:104722,6378436.619:104727,6378574.389:[104729,104730],6378472.281:[104732,104756],6378498.189:[104733,104746],6378449.421:[104734,104766],6378525.621:[104735,104754],6378466.185:104737,6378496.665:104738,6378643.579:104740,6378559.758:104741,6378414.369:[104742,104763,104772],6378441.801:104744,6378502.761:[104747,104759,104773,104775],6378617.061:104749,6378624.681:[104751,104765],6378468.623:104752,6378445.763:[104755,104758,104761],6378670.401:104757,6378438.753:104762,6378543.909:104767,6378605.783:104768,6378540.861:104769,6378443.325:[104771,104784],6378548.481:104777,6378463.746:104778,6378426.561:104779,6378453.688:104783,6378530.193:104785,6378376.271:[104800,104828],6378471.92:104801,6378472.931:104802,6378411.351:104803,6378380.991:104805,6378414.96:104806,6378345.09:[104807,104819,104844,104870],6378412.542:104808,6378470.401:104809,6378376.331:104810,6378379.031:104811,6378407.621:104812,6378376.811:[104813,104827],6378313.92:104814,6378414.93:104815,6378413.021:104816,6378380.381:104817,6378530.851:104818,6378591.521:104820,6378378.881:104821,6378408.481:[104822,104832],6378375.601:[104823,104838],6378408.041:104824,6378655.071:104825,6378409.151:104826,6378315.7:[104829,104840,104845,104851],6378285.86:[104830,104835,104859],6378379.301:104831,6378560.121:104833,6378531.821:104834,6378500.6:104836,6378376.041:104837,6378406.601:104839,6378438.991:104841,6378345.42:104842,6378593.86:104843,6378381.271:[104846,104847],6378413.671:104848,6378344.377:104849,6378563.891:104850,6378408.091:104852,6378377.671:104853,6378472.751:104854,6378412.511:104855,6378407.281:104856,6378534.451:104857,6378406.051:104858,6378532.921:104860,6378380.091:104861,6378408.941:104862,6378624.171:104863,6378377.411:104864,6378474.591:104865,6378407.141:104866,6378376.871:104867,6378375.251:104868,6378405.971:104869,6378437.651:104871};function is(){for(const e in rs)delete rs[e]}class os extends ns{constructor(e){if("number"==typeof e)return super(),this.m_factor=e,void(this.m_wkid=0);super(e)}getUnitType(){return 1}convertFromRadians(e){return e/this.getUnitToBaseFactor()}convertToRadians(e){return e*this.getUnitToBaseFactor()}}function as(e){return new bu}function hs(e){return e.getType()===bc.PE_TYPE_LINUNIT?new bu(e):e.getType()===bc.PE_TYPE_ANGUNIT?new os(e):void n("peUnit")}function ms(e){const t=Hc(null);return e.getType()===bc.PE_TYPE_PROJCS||e.getType()===bc.PE_TYPE_GEOGCS?t.reset(e.getUnit()):n("PE_coord_sys"),t.get()||a("cannot create units from coord sys"),hs(t.get())}class ls{constructor(e,t,s){void 0===e?(this.x=new At,this.y=new At,this.z=new At):e instanceof Ye?(this.x=new At(e.x),this.y=new At(e.y),this.z=new At(e.z)):e instanceof At?(this.x=e.clone(),this.y=t.clone(),this.z=s.clone()):n("EPoint3D constructor")}dotProduct(e){return this.x.mulE(e.x).addE(this.y.mulE(e.y)).addE(this.z.mulE(e.z))}crossProduct(e){return new ls(this.y.mulE(e.z).subE(this.z.mulE(e.y)),this.z.mulE(e.x).subE(this.x.mulE(e.z)),this.x.mulE(e.y).subE(this.y.mulE(e.x)))}crossProductVector(e){const t=this.y.mulE(e.z).subE(e.y.mulE(this.z)),s=e.x.mulE(this.z).subE(this.x.mulE(e.z)),n=this.x.mulE(e.y).subE(e.x.mulE(this.y));return new ls(t,s,n)}sqrLength(){return this.x.mulE(this.x).addE(this.y.mulE(this.y)).addE(this.z.mulE(this.z))}length(){return this.sqrLength().sqrt()}static distance(e,t){return e.sub(t).length()}negate(){return new ls(this.x.negate(),this.y.negate(),this.z.negate())}add(e){return new ls(this.x.addE(e.x),this.y.addE(e.y),this.z.addE(e.z))}sub(e){return new ls(this.x.subE(e.x),this.y.subE(e.y),this.z.subE(e.z))}subThis(e){return this.x.subThisE(e.x),this.y.subThisE(e.y),this.z.subThisE(e.z),this}addThis(e){return this.x.addThisE(e.x),this.y.addThisE(e.y),this.z.addThisE(e.z),this}mul(e){return new ls(this.x.mulE(e),this.y.mulE(e),this.z.mulE(e))}div(e){return new ls(this.x.divE(e),this.y.divE(e),this.z.divE(e))}eq(e){return this.x.eq(e.x)&&this.y.eq(e.y)&&this.z.eq(e.z)}isZero(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()}value(){return Ye.construct(this.x.value(),this.y.value(),this.z.value())}}class gs{constructor(e){if(this.m_origin=new Ye,this.m_normal=new Ye,this.m_axisX=new Ye,this.m_axisY=new Ye,!e)return this.m_origin=new Ye,this.m_normal=new Ye(0,0,1),this.m_axisX=new Ye(1,0,0),void(this.m_axisY=new Ye(0,1,0));e.pt0&&e.pt1&&e.pt2?this.setFromPoints(e.pt0,e.pt1,e.pt2):l(0,`unimplemented constructor options ${JSON.stringify(e)}`)}assign(e){return l(0),this}set(e,t,s,n){l(0)}setFromPoints(e,t,s){let n=t.sub(e);const r=s.sub(e);this.m_normal=n.crossProductVector(r);let i=!0;if(this.m_normal.isZero()){if(i=!1,n.isZero()&&(n=r),n.isZero()){const t=0,s=1;return this.m_normal.setCoords(t,t,s),this.m_axisX.setCoords(s,t,t),this.m_axisY.setCoords(t,s,t),this.m_origin=e,!1}this.m_axisX=n.getUnitVector(),this.m_normal=this.m_axisX.createAPerpendicular()}else this.m_normal.normalizeThis(),this.m_axisX=n.getUnitVector();return this.m_axisY=this.m_normal.crossProductVector(this.m_axisX),this.m_origin=e,i}getCoord(e,t){return l(0),{}}getCoord2D(e){return l(0),{}}getCoordX(e,t){return l(0),0}getCoordY(e,t){return l(0),0}getCoordZ(e,t){return l(0),0}setPreferredAxisX(e){l(0)}getOrigin(){return l(0),{}}getNormal(){return l(0),{}}getAxisX(){return this.m_axisX.clone()}getAxisY(){return this.m_axisY.clone()}setAxisX(e,t=!1){l(0)}setAxisY(e,t=!1){l(0)}recalculateAxisY(){l(0)}setOrigin(e){l(0)}setNormal(e,t){l(0)}intersect(e,t){return l(0),!1}intersectLine(e){return l(0),0}intersectLineEx(e,t){return l(0),0}closestCoordinate(e){const t=e.sub(this.m_origin),s=new et;return s.x=t.dotProduct(this.m_axisX),s.y=t.dotProduct(this.m_axisY),s}projectVector(e){return l(0),{}}signedDistance(e){return l(0),0}distance(e){return l(0),0}}function us(e,t){return!1}function cs(e,t,s,n,r=100,i=us){let o,a,h,m,g,u,c,_,d;l(n>0);let p,f,x,y=0,P=0;const E=Xt();t>s&&(s=ht(t,t=s));const S=e(t),C=e(s);S<C?(o=a=h=t,m=g=u=S):(o=a=h=s,m=g=u=C);let I=0;for(;I<r&&(x=.5*(s-t),d=t+x,p=n*(Math.abs(o)+.25),f=2*p,!(i(o,m)||Math.abs(o-d)<=f-x));++I){if(Math.abs(P)>p){const e=(o-a)*(m-u);let n=(o-h)*(m-g),r=(o-h)*n-(o-a)*e;n=2*(n-e),n>0&&(r=-r),n=Math.abs(n);const i=P;P=y,Math.abs(r)>=Math.abs(n*i*.5)||r<=n*(t-o)||r>=n*(s-o)?(P=o>=d?t-o:s-o,y=Xt()*P):(y=r/n,_=o+y,(_-t<f||s-_<f)&&(y=d-o<0?-Math.abs(p):Math.abs(p)))}else P=o>=d?t-o:s-o,y=P*E;_=o+y,c=e(_),c<m?(_>=o?t=o:s=o,h=a,a=o,o=_,u=g,g=m,m=c):(_<o?t=_:s=_,c<=g||a===o?(h=a,a=_,u=g,g=c):(c<=u||h===o||h===a)&&(h=_,u=c))}return ot(o,m)}function _s(e,t,s){if(e>s){e-=Math.ceil((e-s)/Wt)*Wt}else if(e<t){e+=Math.ceil((t-e)/Wt)*Wt}return e}function ds(e,t,s){return ps(e,t,s,0)}function ps(e,t,s,n){const r=s.x,i=s.y;return xs(e,t,Math.cos(r),Math.sin(r),Math.cos(i),Math.sin(i),n)}function fs(e,t,s,n,r,i){return xs(e,t,s,n,r,i,0)}function xs(e,t,s,n,r,i,o){const a=e/Math.sqrt(1-t*i*i),h=a+o,m=h*r*s,l=h*r*n,g=(a*(1-t)+o)*i;return Ye.construct(m,l,g)}function ys(e,t,s){const n=new At,r=new At,i=new At,o=new At;n.setCos(s.x),r.setSin(s.x),i.setCos(s.y),o.setSin(s.y);const a=o.negate().mulE(o.mul(t)).add(1).sqrt(),h=new At(e).divE(a),m=h.mulE(i).mulE(n),l=h.mulE(i).mulE(r),g=h.mul(1-t).mulE(o);return new ls(m,l,g)}function Ps(e,t,s){const n=s.x,r=s.y,i=s.z,o=Math.atan2(r,n),a=Math.sqrt(n*n+r*r),h=Math.atan2(i,(1-t)*a);return et.construct(o,h)}function Es(e,t,s){const n=1-t,r=e/Math.sqrt(pt(s.x)+pt(s.y)+pt(s.z)/n);return s.mul(r)}function Ss(e,t,s,n,r){const i=ds(e,t,s),o=ds(e,t,n);return Ps(e,t,Ye.lerp(i,o,r))}function Cs(e,t,s){const n=new Ye;return n.setCrossProductVector(t,s),Math.abs(Math.atan2(n.length(),t.dotProduct(s)))*e}function Is(e,t,s,n,r){const i=s.getUnitVector(),o=n.getUnitVector(),a=t.getUnitVector(),h=new Ye;if(h.setCrossProductVector(i,o),!h.isZero()){h.normalizeThis();const t=a.sub(h.mul(h.dotProduct(a)));if(!t.isZero()){t.normalizeThis();const s=i.add(o).mul(.5);if(s.dotProduct(t)>s.dotProduct(i)){const s=Math.abs(h.dotProduct(a)),n=Math.asin(s);return r.assign(t.getUnitVector().mul(e)),n*e}}}const m=Cs(1,i,a),l=Cs(1,o,a);return m<=l?(r.assign(s),m*e):(r.assign(n),l*e)}function bs(s,n,r,i){const o={stack:[],error:void 0,hasError:!1};try{const t=e(o,new Cc,!1);return Dc.geodeticDistance(s,n,r.x,r.y,i.x,i.y,t,null,null,bc.PE_LINETYPE_GEODESIC),t.val}catch(a){o.error=a,o.hasError=!0}finally{t(o)}}function ws(e,t,s,n,r){switch(l(s.isFinite()&&n.isFinite()),r){case 0:return bs(e,t,s,n);case 1:return Ts(e,t,s);case 2:case 3:{const r=ds(e,t,s),i=ds(e,t,n);return Ye.distance(r,i)}default:d("")}}function vs(e,t,s,n,r,i=0,o){if(2===i||3===i)return Ns(e,t,s,n,r,3===i,o);const a=Ps(e,t,s),h=s=>{const o=Ps(e,t,Ye.lerp(n,r,s));return ws(e,t,a,o,i)},m=Ye.distance(n,r);if(m>0){const s=Os(e,m),{first:i,second:a}=cs(h,0,1,s);return o&&o.assign(Es(e,t,Ye.lerp(n,r,i))),ot(i,a)}{const e=h(0);return o&&o.assign(n),ot(.5,e)}}function Ns(e,t,s,n,r,i=!1,o){const a=Es(e,t,s);if(i){const i=new gs({pt0:new Ye(0,0,0),pt1:n,pt2:r}),h=i.closestCoordinate(s),m=i.closestCoordinate(n),l=i.closestCoordinate(r),g=et.getClosestCoordinate(m,l,h),u=Es(e,t,Ye.lerp(n,r,g)),c=Ye.distance(u,a);return o&&o.assign(u),ot(g,c)}const h=s=>{const i=Es(e,t,Ye.lerp(n,r,s));return Ye.distance(i,a)},m=Ye.distance(n,r);if(m>0){const s=Os(e,m),{first:i,second:a}=cs(h,0,1,s);return o&&o.assign(Es(e,t,Ye.lerp(n,r,i))),ot(i,a)}{const e=Ye.distance(s,n);return o&&o.assign(s),ot(.5,e)}}function Ts(s,n,r,i){const o={stack:[],error:void 0,hasError:!1};try{const t=e(o,new Cc,!1);return Dc.greatEllipticDistance(s,n,r.x,r.y,r.x,r.y,t,null,null),t.val}catch(a){o.error=a,o.hasError=!0}finally{t(o)}}function Gs(e,t,s,n,r){if(Math.abs(s.x-n.x)>Math.PI)return Number.NaN;if(Math.abs(s.y)>yt||Math.abs(n.y)>yt)return Number.NaN;if((Math.abs(s.y)===yt||Math.abs(n.y)===yt)&&s.x!==n.x)return Number.NaN;const{first:i,second:o}=kt(s.x,n.x);let a=r;a=_s(a,i,o);if(!at.construct(s.x,n.x).containsCoordinate(a))return Number.NaN;const h=J.constructPoint2D(s),m=J.constructPoint2D(n),l=ys(1,t,h),g=ys(1,t,m),u=l.crossProductVector(g);if(u.z.isZero()){return s.y}const c=u.x.divE(u.z.negate()),_=u.y.divE(u.z.negate()),d=c.mulE(c).addE(_.mulE(_)).sqrt();if(d.isZero()||c.isZero()&&_.isZero()){return s.y}const p=Math.atan2(_.value(),c.value());let f=Math.atan2(d.value()*Math.cos(p-a),1-t);const x=ds(1,t,et.construct(a,f)),y=Ye.construct(x.x,x.y,-x.z),P=u.value().dotProduct(x),E=u.value().dotProduct(y);return Math.abs(E)<Math.abs(P)&&(f=-f),f}function Ds(e,t,s,n,r,i){if(i[0]=Number.NaN,i[1]=Number.NaN,Math.abs(s.x-n.x)>Math.PI)return 0;if(Math.abs(s.y)>yt||Math.abs(n.y)>yt)return 0;if((Math.abs(s.y)===yt||Math.abs(n.y)===yt)&&s.x!==n.x)return 0;if(Math.abs(r)>=yt)return 0;if(s.y>0&&n.y>0&&s.y>r&&n.y>r||s.y<0&&n.y<0&&s.y<r&&n.y<r)return 0;const o=J.constructPoint2D(s),a=J.constructPoint2D(n),h=ys(1,t,o),m=ys(1,t,a),l=h.crossProductVector(m);if(l.z.isZero()){return at.construct(s.y,n.y).containsCoordinate(r)?(i[0]=s.x,1):0}const g=l.x.divE(l.z.negate()),u=l.y.divE(l.z.negate()),c=g.mulE(g).addE(u.mulE(u)).sqrt();if(c.isZero()||g.isZero()&&u.isZero())return 0===r?(i[0]=s.x,i[1]=n.x,2):0;const _=(1-t)*Math.tan(r)/c.value();if(Math.abs(_)>1)return 0;const d=Math.acos(_),p=Math.atan2(u.value(),g.value()),f=p-d;let x=p+d;const y=Math.min(s.x,n.x),P=Math.max(s.x,n.x);_s(f,y,P),0!==r?_s(x,y,P):x=f;let E=0;return y<=f&&f<=P&&(i[E]=f,E++),x!==f&&y<=x&&x<=P&&(i[E]=x,E++),E}function Vs(e,t){t[0]>.5*Math.PI?(e[0]+=Math.PI,t[0]=Math.PI-t[0]):t[0]<.5*-Math.PI&&(e[0]-=Math.PI,t[0]=-Math.PI-t[0]),l(t[0]>=.5*-Math.PI&&t[0]<=.5*Math.PI)}function Fs(e,t){return e*Math.sqrt(1-t)}function Hs(e){return 1-e}function ks(e,t,s,n,r){n=Pt(n,-yt,yt),r=Pt(r,-yt,yt);const i=yt-.03;let o;o=n>i&&r>i||n<-i&&r<-i?As(e,n,r):Ms(e,r)-Ms(e,n);return.5*(s-t)*o*Hs(e)}function As(e,t,s){let n=1;if(t<0&&(n=-1,t=-t,s=-s),0!==e){const r=e*e,i=r*e,o=[1,(1+11*e)/12,(1+118*e+241*r)/360,(1+1089*e+10419*r+8651*i)/20160,(1+9836*e+318246*r+1027436*i+458881*(i*e))/1814400],a=t=>{let s=0;const n=pt(t)/(e-1);for(let e=o.length-1;e>=0;--e)s=o[e]+s*n;return s*=-pt(t/(1-e)),s},h=a(yt-t);return(a(yt-s)-h)*n}{const e=yt-t,r=yt-s,i=-4*pt(Math.sin(e/2));return(-4*pt(Math.sin(r/2))-i)*n}}function Ms(e,t){if(0===t)return 0;const s=Math.sin(t);let n=s,r=s;if(0!==e){n/=1-e*s*s;const t=Math.sqrt(e);r=s*Lt(t*s)}return n+r}function Us(e,t){return e/Math.sqrt(1-t)}function qs(e,t){return(1-t)*e}function Bs(e,t,s){const n=s/(2*qs(e,t)),r=n*n;return s*(1-r*(.16666666666666666-.008333333333333333*r))}function Os(e,t){if(0!==t){const s=e*Bt()/t;return Math.min(s,1e-10)}return 0}class Ys{constructor(e){this.m_currentShift=63n,this.m_currentElt=0n,this.m_iCurrentElt=-1,this.m_parent=e,this.m_aiSetElts=e.m_bits.flatMap((e,t)=>t)}next(){if(this.m_currentShift++,64n===this.m_currentShift){if(this.m_iCurrentElt++,this.m_iCurrentElt===this.m_aiSetElts.length)return Ys.npos();this.m_currentShift=0n,this.m_currentElt=this.m_parent.m_bits[this.m_aiSetElts[this.m_iCurrentElt]]}for(;this.m_currentShift<63n&&!(this.m_currentElt&1n<<this.m_currentShift);)this.m_currentShift++;return this.m_currentElt&1n<<this.m_currentShift?64*this.m_aiSetElts[this.m_iCurrentElt]+Number(this.m_currentShift):this.next()}static npos(){return Number.MAX_SAFE_INTEGER}}function Rs(e){return 1n<<(0x3fn&BigInt(e))}function Xs(e){return e>>6}class Ls{constructor(e){this.m_bits=[],void 0!==e&&e.copy&&(this.m_bits=e.copy.m_bits.slice())}assignMove(){return this}assignCopy(){return this}hasBit(e){const t=Rs(e),s=Xs(e);return void 0!==this.m_bits[s]&&!!(this.m_bits[s]&t)}setBit(e){const t=Rs(e),s=Xs(e);void 0===this.m_bits[s]&&(this.m_bits[s]=0n),this.m_bits[s]|=t}clearBit(e){}flipBit(e){const t=Rs(e),s=Xs(e);return void 0===this.m_bits[s]&&(this.m_bits[s]=0n),this.m_bits[s]^=t,0n!==(this.m_bits[s]&t)}clear(){this.m_bits.length=0}isZero(){let e=0;return this.m_bits.forEach(t=>{e|=t?2:1}),!(2&e)}equals(e){if(this===e)return!0;if(this.m_bits.length!==e.m_bits.length)return!1;let t=0;return this.m_bits.forEach((s,n)=>{t|=s===e.m_bits[n]?2:1}),!(1&t)&&(e.m_bits.forEach((e,s)=>{t|=e===this.m_bits[s]?2:1}),!(1&t))}notEquals(e){return!this.equals(e)}assignOr(e){return e.m_bits.forEach((e,t)=>{void 0===this.m_bits[t]?this.m_bits[t]=e:this.m_bits[t]|=e}),this}assignSubtract(e){return e.m_bits.forEach((e,t)=>{void 0!==this.m_bits[t]&&(this.m_bits[t]&=~e)}),this}assignAnd(e){return e.m_bits.forEach((e,t)=>{void 0!==this.m_bits[t]&&(this.m_bits[t]&=e)}),this}assignXor(e){return e.m_bits.forEach((e,t)=>{void 0===this.m_bits[t]?this.m_bits[t]=e:this.m_bits[t]^=e}),this}getHashCode(){return this.m_bits.reduce((e,t)=>Et(e,t),Qe(0))}getUnorderedBitIterator(){return new Ys(this)}}class zs{constructor(e,t){this.m_map=new Map,this.m_hf=e,this.m_ef=t}add(e){const t=this.m_hf(e);if(!this.m_map.has(t))return this.m_map.set(t,e),this;const s=this.m_map.get(t);return s instanceof Array?s.find(t=>this.m_ef(t,e))||s.push(e):this.m_ef(s,e)||this.m_map.set(t,[s,e]),this}clear(){this.m_map.clear()}delete(e){return!1}has(e){const t=this.m_hf(e);if(!this.m_map.has(t))return!1;const s=this.m_map.get(t);return s instanceof Array?void 0!==s.find(t=>this.m_ef(t,e)):this.m_ef(s,e)}get(e){const t=this.m_hf(e),s=this.m_map.get(t);if(void 0!==s)return s instanceof Array?s.find(t=>this.m_ef(t,e)):s}get size(){let e=0;for(const t of this.m_map.values())e+=t instanceof Array?t.length:1;return e}forEach(e,t){}[Symbol.iterator](){return(new Set)[Symbol.iterator]()}entries(){return(new Set).entries()}keys(){return(new Set).keys()}values(){return(new Set).values()}get[Symbol.toStringTag](){return"ValueSet"}}class Ws extends We{constructor(e){super(),this.m_bufferLeft=new k,this.m_bufferRight=new k,this.m_intervalLeft=at.constructEmpty(),this.m_intervalRight=at.constructEmpty(),this.m_yScanline=Number.NaN,this.m_helper=e}compare(e,t,s){const n=t,r=e.getElement(s);this.m_helper.querySegmentXY(n,this.m_bufferLeft),this.m_helper.querySegmentXY(r,this.m_bufferRight);const i=this.m_bufferLeft.get(),o=this.m_bufferRight.get();if(this.m_intervalLeft.setCoords(i.getStartX(),i.getEndX()),this.m_intervalRight.setCoords(o.getStartX(),o.getEndX()),this.m_intervalLeft.vmax<this.m_intervalRight.vmin)return-1;if(this.m_intervalLeft.vmin>this.m_intervalRight.vmax)return 1;const a=i.getStartY()===i.getEndY(),h=o.getStartY()===o.getEndY();if(a||h){if(a&&h)return 0;if(i.getStartY()===o.getStartY()&&i.getStartX()===o.getStartX())return a?1:-1;if(i.getEndY()===o.getEndY()&&i.getEndX()===o.getEndX())return a?-1:1}let m=i.intersectionOfYMonotonicWithAxisX(this.m_yScanline,this.m_intervalLeft.vmin),l=o.intersectionOfYMonotonicWithAxisX(this.m_yScanline,this.m_intervalRight.vmin);if(m===l){const e=i.getEndY(),t=o.getEndY(),s=Math.min(e,t);let n=.5*(s+this.m_yScanline);n===this.m_yScanline&&(n=s),m=i.intersectionOfYMonotonicWithAxisX(n,this.m_intervalLeft.vmin),l=o.intersectionOfYMonotonicWithAxisX(n,this.m_intervalRight.vmin)}return m<l?-1:m>l?1:0}setY(e){this.m_yScanline=e}}class js{constructor(e){this.m_segmentBuffer=new k,this.m_point=et.getNAN(),this.m_parent=e}setPointXY(e){this.m_point.assign(e)}compare(e,t){const s=e.getElement(t);this.m_parent.querySegmentXY(s,this.m_segmentBuffer);const n=this.m_segmentBuffer.get(),r=new at;if(r.setCoords(n.getStartX(),n.getEndX()),this.m_point.x<r.vmin)return-1;if(this.m_point.x>r.vmax)return 1;const i=n.intersectionOfYMonotonicWithAxisX(this.m_point.y,this.m_point.x);return this.m_point.x<i?-1:this.m_point.x>i?1:0}}var Zs,Ks;function Qs(e,t){return{parentage:e,rank:t}}function Js(e,t){const s=e.length;if(s!==t.length)return!1;const n=e[0].parentage;if(n!==t[0].parentage)return!1;if(-1===n)return!0;for(let r=1;r<s;++r)if(e[r].parentage!==t[r].parentage)return!1;return!0}function $s(e,t,s){s.length=0;let n=!1;{let r=e.getHalfEdgeVertexIterator(t);for(;r!==q;){const t=e.getVertexFromVertexIterator(r),i=e.getShape().getSegmentRank(t),o=e.getShape().getSegmentParentage(t);n||=o>=0,s.push(Qs(o,i)),r=e.incrementVertexIterator(r)}}{let r=e.getHalfEdgeVertexIterator(e.getHalfEdgeTwin(t));for(;r!==q;){const t=e.getVertexFromVertexIterator(r),i=e.getShape().getSegmentRank(t),o=e.getShape().getSegmentParentage(t);n||=o>=0,s.push(Qs(o,i)),r=e.incrementVertexIterator(r)}}n&&s.sort((e,t)=>e.rank>t.rank?-1:e.rank<t.rank?1:e.parentage<t.parentage?-1:e.parentage>t.parentage?1:0),-1===s[0].parentage&&(s.length=1)}function en(){return new zs(e=>e.getHashCode(),(e,t)=>e.equals(t))}!function(e){e[e.enumInputModeBuildGraph=0]="enumInputModeBuildGraph",e[e.enumInputModeSimplifyAlternate=1]="enumInputModeSimplifyAlternate",e[e.enumInputModeSimplifyWinding=2]="enumInputModeSimplifyWinding"}(Zs||(Zs={})),function(e){e[e.enumSegmentParentageBreakNode=1]="enumSegmentParentageBreakNode",e[e.enumPathBreakNode=2]="enumPathBreakNode"}(Ks||(Ks={}));class tn{constructor(){this.m_shape=null,this.m_clusterData=new Le(8),this.m_clusterVertices=new Le(2),this.m_firstCluster=q,this.m_lastCluster=q,this.m_halfEdgeData=new Le(8),this.m_chainData=new Le(8),this.m_chainAreas=null,this.m_chainPerimeters=null,this.m_universeChain=-1,this.m_simplifiedGeometry=-1,this.m_edgeIndices=[],this.m_clusterIndices=[],this.m_chainIndices=[],this.m_bBuildGeometryParentageSets=!1,this.m_chainBitSetIndex=-1,this.m_edgeBitSetIndex=-1,this.m_edgeBitSetIndexLeft=-1,this.m_emptyBitSet=null,this.m_geometryMapID=null,this.m_uniqueBitSets=null,this.m_chainBitSets=[],this.m_edgeBitSets=[],this.m_checkDirtyPlanesweepTolerance=Number.NaN,this.m_geometryIDIndex=-1,this.m_clusterIndex=-1,this.m_halfEdgeIndex=-1,this.m_tmpHalfEdgeParentageIndex=-1,this.m_tmpHalfEdgeParentageIndexLeft=-1,this.m_tmpHalfEdgeWindingNumberIndex=-1,this.m_tmpHalfEdgeOddEvenNumberIndex=-1,this.m_segmentParentageIndex=-1,this.m_segmentIndexHe=-1,this.m_clusterBreakNodeIndex=-1,this.m_universeGeomID=-1,this.m_pointCount=0,this.m_progressCounter=0,this.m_bBuildChains=!0,this.m_bDirtyCheckFailed=!1}setCheckDirtyPlanesweepTolerance(e){this.m_checkDirtyPlanesweepTolerance=e}dirtyCheckFailed(){return this.m_bDirtyCheckFailed}getShape(){return this.m_shape}setEditShape(e,t,s=!0,n=!1){n?this.setEditShapeImpl3D_(e,Zs.enumInputModeBuildGraph,null,t,!1):this.setEditShapeImpl_(e,Zs.enumInputModeBuildGraph,null,t,s)}setAndSimplifyEditShapeAlternate(e,t,s=null,n=!1){const r=[];r.push(t),this.m_simplifiedGeometry=t,n?this.setEditShapeImpl3D_(e,Zs.enumInputModeSimplifyAlternate,r,s,!1):this.setEditShapeImpl_(e,Zs.enumInputModeSimplifyAlternate,r,s,e.getGeometryType(t)===i.enumPolygon)}setAndSimplifyEditShapeWinding(e,t,s=null){const n=[];n.push(t),this.m_simplifiedGeometry=t,this.setEditShapeImpl_(e,Zs.enumInputModeSimplifyWinding,n,s,!0)}removeShape(){null!==this.m_shape&&(-1!==this.m_geometryIDIndex&&(this.m_shape.removeGeometryUserIndex(this.m_geometryIDIndex),this.m_geometryIDIndex=-1),-1!==this.m_clusterIndex&&(this.m_shape.removeUserIndex(this.m_clusterIndex),this.m_clusterIndex=-1),-1!==this.m_halfEdgeIndex&&(this.m_shape.removeUserIndex(this.m_halfEdgeIndex),this.m_halfEdgeIndex=-1),-1!==this.m_tmpHalfEdgeParentageIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndex),this.m_tmpHalfEdgeParentageIndex=-1),-1!==this.m_tmpHalfEdgeParentageIndexLeft&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndexLeft),this.m_tmpHalfEdgeParentageIndexLeft=-1),-1!==this.m_tmpHalfEdgeWindingNumberIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeWindingNumberIndex),this.m_tmpHalfEdgeWindingNumberIndex=-1),-1!==this.m_tmpHalfEdgeOddEvenNumberIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeOddEvenNumberIndex),this.m_tmpHalfEdgeOddEvenNumberIndex=-1),-1!==this.m_segmentParentageIndex&&(this.deleteUserIndexForHalfEdges(this.m_segmentParentageIndex),this.m_segmentParentageIndex=-1),-1!==this.m_segmentIndexHe&&(this.deleteUserIndexForHalfEdges(this.m_segmentIndexHe),this.m_segmentIndexHe=-1),-1!==this.m_clusterBreakNodeIndex&&(this.deleteUserIndexForClusters(this.m_clusterBreakNodeIndex),this.m_clusterBreakNodeIndex=-1),this.deleteEdgeBitSets_(),this.deleteChainBitSets_(),this.m_emptyBitSet=null,this.m_geometryMapID=null,this.m_shape=null,this.m_clusterData.deleteAll(!0),this.m_clusterVertices.deleteAll(!0),this.m_firstCluster=q,this.m_lastCluster=q,this.m_halfEdgeData.deleteAll(!0),this.m_edgeIndices.length=0,this.m_clusterIndices.length=0,this.m_chainIndices.length=0,this.m_chainData.deleteAll(!0),this.m_universeChain=q,this.m_chainAreas=null)}getClusterHalfEdge(e){return this.m_clusterData.getField(e,2)}queryXY(e,t){const s=this.getClusterVertexIndex_(e);t.assign(this.m_shape.getXYWithIndex(s))}queryXYZ(e,t){l(0)}getClusterParentage(e){return this.m_clusterData.getField(e,1)}getFirstCluster(){return this.m_firstCluster}getPrevCluster(e){return this.m_clusterData.getField(e,3)}getNextCluster(e){return this.m_clusterData.getField(e,4)}getClusterChain(e){return this.m_clusterData.getField(e,6)}getClusterVertexIterator(e){return this.m_clusterData.getField(e,7)}incrementVertexIterator(e){return this.m_clusterVertices.getField(e,1)}getVertexFromVertexIterator(e){return this.m_clusterVertices.getField(e,0)}getClusterUserIndex(e,t){const s=this.getClusterIndex_(e),n=this.m_clusterIndices[t];return n.size()<=s?-1:n.read(s)}setClusterUserIndex(e,t,s){const n=this.getClusterIndex_(e),r=this.m_clusterIndices[t];r.size()<=n&&r.resize(this.m_clusterData.size(),-1),r.write(n,s)}hasClusterUserIndexFlags(e,t,s){if(-1===t)return!1;const n=this.getClusterUserIndex(e,t);return-1!==n&&0!==(s&n)}setClusterUserIndexFlags(e,t,s){const n=this.getClusterIndex_(e),r=this.m_clusterIndices[t];r.size()<=n&&r.resize(this.m_clusterData.size(),-1);let i=r.read(n);-1===i&&(i=0),r.write(n,s|i)}clearClusterUserIndexFlags(e,t,s){const n=this.getClusterIndex_(e),r=this.m_clusterIndices[t];r.size()<=n&&r.resize(this.m_clusterData.size(),-1);let i=r.read(n);-1===i&&(i=0),r.write(n,~s&i)}createUserIndexForClusters(e=-1){const t=new be(this.m_clusterData.capacity(),e);for(let s=0,n=this.m_clusterIndices.length;s<n;s++)if(null===this.m_clusterIndices[s])return this.m_clusterIndices[s]=t,s;this.m_clusterIndices.push(t);return this.m_clusterIndices.length-1}deleteUserIndexForClusters(e){this.m_clusterIndices[e]=null}getHalfEdgeOrigin(e){return this.m_halfEdgeData.getField(e,1)}getHalfEdgeTo(e){return this.getHalfEdgeOrigin(this.getHalfEdgeTwin(e))}getHalfEdgeTwin(e){return this.m_halfEdgeData.getField(e,4)}getHalfEdgePrev(e){return this.m_halfEdgeData.getField(e,5)}getHalfEdgeNext(e){return this.m_halfEdgeData.getField(e,6)}getHalfEdgeChain(e){return this.m_halfEdgeData.getField(e,2)}getHalfEdgeFaceParentage(e){return this.getChainParentage(this.getHalfEdgeChain(e))}getHalfEdgeVertexIterator(e){return this.m_halfEdgeData.getField(e,7)}getHalfEdgeFromXY(e,t){this.queryXY(this.getHalfEdgeOrigin(e),t)}getHalfEdgeToXY(e,t){this.queryXY(this.getHalfEdgeTo(e),t)}isHalfEdgeCurve(e){if(-1!==this.m_segmentIndexHe){return-1!==this.getHalfEdgeUserIndex(e,this.m_segmentIndexHe)}return!1}getHalfEdgeFromXYZ(e,t){l(0)}getHalfEdgeToXYZ(e,t){l(0)}getHalfEdgeParentage(e){return this.m_halfEdgeData.getField(e,3)&tn.c_EdgeParentageMask}getHalfEdgeUserIndex(e,t){const s=this.getHalfEdgeIndex_(e),n=this.m_edgeIndices[t];return n.size()<=s?-1:n.read(s)}setHalfEdgeUserIndex(e,t,s){const n=this.getHalfEdgeIndex_(e),r=this.m_edgeIndices[t];r.size()<=n&&r.resize(this.m_halfEdgeData.size(),-1),r.write(n,s)}createUserIndexForHalfEdges(e){void 0===e&&(e=-1);const t=new be(this.m_halfEdgeData.capacity(),e);for(let n=0,r=this.m_edgeIndices.length;n<r;n++)if(null===this.m_edgeIndices[n])return this.m_edgeIndices[n]=t,n;this.m_edgeIndices.push(t);const s=this.m_edgeIndices.length-1;return l(s>=0&&s<=Number.MAX_SAFE_INTEGER),s}deleteUserIndexForHalfEdges(e){this.m_edgeIndices[e]=null}deleteEdgesBreakFaces_(e){for(let t=0,s=e.length;t<s;t++){const s=e[t],n=this.getHalfEdgeChain(s),r=this.getHalfEdgeTwin(s),i=this.getHalfEdgeChain(r);this.setChainHalfEdge_(n,q),this.setChainHalfEdge_(i,q),this.updateVertexToHalfEdgeConnection_(s,!0),this.deleteEdgeImpl_(s)}}doesHalfEdgeBelongToAPolygonInterior(e,t){return l(0),!1}doesHalfEdgeBelongToAPolygonExterior(e,t){return l(0),!1}doesHalfEdgeBelongToAPolygonBoundary(e,t){return l(0),!1}doesHalfEdgeBelongToAPolylineInterior(e,t){return l(0),!1}doesHalfEdgeBelongToAPolylineExterior(e,t){return l(0),!1}doesClusterBelongToAPolygonInterior(e,t){return l(0),!1}doesClusterBelongToAPolygonExterior(e,t){return l(0),!1}doesClusterBelongToAPolygonBoundary(e,t){return l(0),!1}getFirstChain(){return this.m_universeChain}getChainHalfEdge(e){return this.m_chainData.getField(e,1)}getChainParentage(e){return this.m_chainData.getField(e,2)}getChainParent(e){return this.m_chainData.getField(e,3)}getChainFirstIsland(e){return this.m_chainData.getField(e,4)}getChainNextInParent(e){return this.m_chainData.getField(e,5)}getChainNext(e){return this.m_chainData.getField(e,7)}getChainArea(e){const t=this.getChainIndex_(e);let s=this.m_chainAreas.read(t);return Number.isNaN(s)&&(this.updateChainAreaAndPerimeter_(e),s=this.m_chainAreas.read(t)),s}getChainPerimeter(e){return l(0),0}getChainUserIndex(e,t){const s=this.getChainIndex_(e),n=this.m_chainIndices[t];return n.size()<=s?-1:n.read(s)}setChainUserIndex(e,t,s){const n=this.getChainIndex_(e),r=this.m_chainIndices[t];r.size()<=n&&r.resize(this.m_chainData.size(),-1),r.write(n,s)}createUserIndexForChains(){const e=new be(this.m_chainData.capacity(),-1);for(let t=0,s=this.m_chainIndices.length;t<s;t++)if(null===this.m_chainIndices[t])return this.m_chainIndices[t]=e,t;this.m_chainIndices.push(e);return this.m_chainIndices.length-1}deleteUserIndexForChains(e){this.m_chainIndices[e]=null}extractPolygonFromChainAndIslands(e,t,s,n){const r=t===q?e.createGeometry(i.enumPolygon):t,o=new k;this.extractPolygonPathFromChain_(e,r,s,n,o);for(let i=this.getChainFirstIsland(s);i!==q;i=this.getChainNextInParent(i))this.extractPolygonPathFromChain_(e,r,i,n,o);return r}getGeometryID(e){const t=this.m_shape.getGeometryUserIndex(e,this.m_geometryIDIndex);return l(t>=0),1<<Math.min(t,31)}getClusterFromVertex(e){return this.m_shape.getUserIndex(e,this.m_clusterIndex)}getHalfEdgeFromVertex(e){return this.m_shape.getUserIndex(e,this.m_halfEdgeIndex)}buildGeometryParentageSets(){this.m_bBuildGeometryParentageSets=!0}getChainBitSet(e){if(l(this.m_bBuildGeometryParentageSets),-1===this.m_chainBitSetIndex)return this.getEmptySet();const t=this.getChainUserIndex(e,this.m_chainBitSetIndex);l(t>=0);let s=this.m_chainBitSets.at(t);return s||(s=this.getEmptySet()),s}getChainBoundaryBitSet(e){l(this.m_bBuildGeometryParentageSets);const t=new Ls,s=e=>{const s=this.getChainHalfEdge(e);let n=s;do{const e=this.getEdgeBitSet_(n);null!==e&&t.assignOr(e);const s=this.getEdgeBitSet_(this.getHalfEdgeTwin(n));null!==s&&t.assignOr(s),n=this.getHalfEdgeNext(n)}while(n!==s)};s(e);for(let n=this.getChainFirstIsland(e);n!==q;n=this.getChainNextInParent(n))s(e);return t}getChainPolygons(e){return l(0),[]}getGeometriesFromBits(e){if(!this.m_bBuildGeometryParentageSets||null===e)return[];if(null===this.m_geometryMapID){this.m_geometryMapID=new Map;for(let e=this.m_shape.getFirstGeometry();e!==q;e=this.m_shape.getNextGeometry(e))this.m_geometryMapID.set(this.m_shape.getGeometryUserIndex(e,this.m_geometryIDIndex),e)}const t=[],s=e.getUnorderedBitIterator();for(let n=s.next();n!==Ys.npos();n=s.next())l(this.m_geometryMapID.has(n)),t.push(this.m_geometryMapID.get(n));return t}getVertexDominant(e,t){if(t===q)return e;const s=this.getClusterFromVertex(e);return this.getVertexDominantFromCluster(s,t)}getVertexDominantFromCluster(e,t){if(t!==q){let s=q;for(let n=this.getClusterVertexIterator(e);n!==q;n=this.incrementVertexIterator(n)){const e=this.getVertexFromVertexIterator(n);s===q&&(s=e);const r=this.m_shape.getPathFromVertex(e);if(this.m_shape.getGeometryFromPath(r)===t){s=e;break}}return s}{const t=this.getClusterVertexIterator(e);if(t!==q){return this.getVertexFromVertexIterator(t)}return q}}isBreakNode(e){return this.hasClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,Ks.enumSegmentParentageBreakNode)}setBreakNode(e,t){l(-1!==this.m_clusterBreakNodeIndex),t?this.setClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,Ks.enumSegmentParentageBreakNode):this.clearClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,Ks.enumSegmentParentageBreakNode)}isStrongPathNode(e){return this.hasClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,Ks.enumPathBreakNode)}setStrongPathNode(e,t){if(-1===this.m_clusterBreakNodeIndex){if(!t)return;this.m_clusterBreakNodeIndex=this.createUserIndexForClusters()}t?this.setClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,Ks.enumPathBreakNode):this.clearClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,Ks.enumPathBreakNode)}getSegmentParentage(e){if(-1===this.m_segmentParentageIndex)return-1;const t=this.getHalfEdgeUserIndex(e,this.m_segmentParentageIndex);return t>=0?t:-1}isCrossroadAhead(e){const t=this.getHalfEdgeNext(e);if(this.isStrongPathNode(this.getHalfEdgeOrigin(t)))return!0;const s=this.getHalfEdgeTwin(t),n=this.getHalfEdgeNext(s);return e!==this.getHalfEdgeTwin(n)}isCrossroadBehind(e){return l(0),!1}getHalfEdgeConnector(e,t){const s=this.getClusterHalfEdge(e);if(s===q)return q;let n=s,r=q,i=q;do{if(this.getHalfEdgeTo(n)===t)return n;if(r===q){if(r=this.getClusterHalfEdge(t),r===q)return q;i=r}if(this.getHalfEdgeTo(i)===e)return n=this.getHalfEdgeTwin(i),n;n=this.getHalfEdgeNext(this.getHalfEdgeTwin(n)),i=this.getHalfEdgeNext(this.getHalfEdgeTwin(i))}while(n!==s&&i!==r);return q}querySegmentXY(e,t){if(-1!==this.m_segmentIndexHe){let s=this.getHalfEdgeUserIndex(e,this.m_segmentIndexHe);if(-1!==s){if(-2!==s){const e=this.m_shape.getSegmentFromIndex(s);t.copyFrom(e,!0)}else{s=this.getHalfEdgeUserIndex(this.getHalfEdgeTwin(e),this.m_segmentIndexHe);const n=this.m_shape.getSegmentFromIndex(s);t.copyFrom(n,!0),t.get().reverse()}return}}t.createLine();const s=t.get(),n=et.getNAN();this.getHalfEdgeFromXY(e,n),s.setStartXY(n),this.getHalfEdgeToXY(e,n),s.setEndXY(n)}isCurveEdge(e){if(-1!==this.m_segmentIndexHe){return-1!==this.getHalfEdgeUserIndex(e,this.m_segmentIndexHe)}return!1}compareEdgeAnglesCurveHelper_(e,t,s){const n=new k,r=new k;this.querySegmentXY(e,n),this.querySegmentXY(t,r);const i=n.get(),o=r.get();if(i.equals(o))return 0;const a=new et;this.getHalfEdgeFromXY(e,a);const h=new et;this.getHalfEdgeToXY(e,h);const m=new et;this.getHalfEdgeToXY(t,m),l(!h.isEqualPoint2D(m));return O(i,o)}compareEdgeAnglesHelper_(e,t,s){if(e===t)return 0;if(this.isHalfEdgeCurve(e)||this.isHalfEdgeCurve(t))return this.compareEdgeAnglesCurveHelper_(e,t,s);const n=et.getNAN();this.getHalfEdgeToXY(e,n);const r=et.getNAN();if(this.getHalfEdgeToXY(t,r),n.isEqualPoint2D(r))return 0;const i=et.getNAN();this.getHalfEdgeFromXY(e,i);const o=et.getNAN();o.setSub(n,i);const a=et.getNAN();if(a.setSub(r,i),!s||a.y>=0&&o.y>0){return et.compareVectors(o,a)}return 0}compareEdgeAngles_(e,t){return this.compareEdgeAnglesHelper_(e,t,!1)}compareEdgeAnglesForPair_(e,t){return this.compareEdgeAnglesHelper_(e,t,!0)}compareEdgeAngles3D_(e,t){return l(0),0}compareEdgeAnglesForPair3D_(e,t){return l(0),0}dbgDumpChains_(){}dbgDumpChainToPolygon_(e,t){}deleteEdgeInternal_(e){const t=this.getHalfEdgeChain(e),s=this.getHalfEdgeTwin(e),n=this.getHalfEdgeChain(s);l(n===t),l(e===this.getHalfEdgeNext(s)||s===this.getHalfEdgeNext(e));let r=this.getHalfEdgeNext(e);r===s&&(r=this.getHalfEdgeNext(r),r===e&&(r=q));const i=this.getChainIndex_(t),o=this.m_chainAreas.read(i);Number.isNaN(o)||(this.setChainArea_(t,Number.NaN),this.setChainPerimeter_(t,Number.NaN));const a=this.getChainHalfEdge(t);a!==e&&a!==s||this.setChainHalfEdge_(t,r),this.updateVertexToHalfEdgeConnection_(e,!0),this.deleteEdgeImpl_(e)}getFirstUnvisitedHalfEdgeOnCluster_(e,t,s){let n=t!==q?t:this.getClusterHalfEdge(e);if(n===q)return q;const r=n;for(;;){if(1!==this.getHalfEdgeUserIndex(n,s))return n;const e=this.getHalfEdgeNext(this.getHalfEdgeTwin(n));if(e===r)return q;n=e}}removeSpikes_(){let e=!1;const t=this.createUserIndexForHalfEdges();for(let s=this.getFirstCluster();s!==q;s=this.getNextCluster(s)){let n=q;for(;;){let r=this.getFirstUnvisitedHalfEdgeOnCluster_(s,n,t);if(r===q)break;n=this.getHalfEdgeNext(this.getHalfEdgeTwin(r));let i=r;for(;;){const s=this.getHalfEdgeNext(i),o=this.getHalfEdgePrev(i),a=this.getHalfEdgeTwin(i);if(o===a){if(this.deleteEdgeInternal_(i),e=!0,n!==i&&n!==a||(n=q),i===r||o===r){if(r=s,i===r||o===r)break;i=s;continue}}else this.setHalfEdgeUserIndex(i,t,1);if(i=s,i===r)break}}}return this.deleteUserIndexForHalfEdges(t),e}progress_(e,t=!1){}newCluster_(){const e=this.m_clusterData.newElement();return this.m_clusterData.setField(e,1,0),e}newHalfEdgePair_(){const e=this.m_halfEdgeData.newElement();this.m_halfEdgeData.setField(e,2,0),this.m_halfEdgeData.setField(e,3,0);const t=this.m_halfEdgeData.newElement();return this.m_halfEdgeData.setField(t,2,0),this.m_halfEdgeData.setField(t,3,0),this.setHalfEdgeTwin_(e,t),this.setHalfEdgeTwin_(t,e),e}newChain_(){const e=this.m_chainData.newElement();return this.m_chainData.setField(e,2,0),e}deleteChain_(e){return l(0),0}getClusterIndex_(e){return this.m_clusterData.elementToIndex(e)}setClusterVertexIterator_(e,t){this.m_clusterData.setField(e,7,t)}setClusterHalfEdge_(e,t){this.m_clusterData.setField(e,2,t)}setClusterParentage_(e,t){this.m_clusterData.setField(e,1,t)}setPrevCluster_(e,t){this.m_clusterData.setField(e,3,t)}setNextCluster_(e,t){this.m_clusterData.setField(e,4,t)}setClusterVertexIndex_(e,t){this.m_clusterData.setField(e,5,t)}getClusterVertexIndex_(e){return this.m_clusterData.getField(e,5)}setClusterChain_(e,t){this.m_clusterData.setField(e,6,t)}addClusterToExteriorChain_(e,t){this.setClusterChain_(t,e)}getHalfEdgeIndex_(e){return this.m_halfEdgeData.elementToIndex(e)}setHalfEdgeOrigin_(e,t){this.m_halfEdgeData.setField(e,1,t)}setHalfEdgeTwin_(e,t){this.m_halfEdgeData.setField(e,4,t)}setHalfEdgePrev_(e,t){this.m_halfEdgeData.setField(e,5,t)}setHalfEdgeNext_(e,t){this.m_halfEdgeData.setField(e,6,t)}setHalfEdgeChain_(e,t){this.m_halfEdgeData.setField(e,2,t)}setHalfEdgeParentage_(e,t){this.m_halfEdgeData.setField(e,3,t)}getHalfEdgeParentageMask_(e){return this.m_halfEdgeData.getField(e,3)}setHalfEdgeVertexIterator_(e,t){this.m_halfEdgeData.setField(e,7,t)}updateVertexToHalfEdgeConnectionHelper_(e,t){const s=t?q:e;for(let n=this.getHalfEdgeVertexIterator(e);n!==q;n=this.incrementVertexIterator(n)){const e=this.getVertexFromVertexIterator(n);this.m_shape.setUserIndex(e,this.m_halfEdgeIndex,s)}}updateVertexToHalfEdgeConnection_(e,t){e!==q&&(this.updateVertexToHalfEdgeConnectionHelper_(e,t),this.updateVertexToHalfEdgeConnectionHelper_(this.getHalfEdgeTwin(e),t))}getChainIndex_(e){return this.m_chainData.elementToIndex(e)}setChainHalfEdge_(e,t){this.m_chainData.setField(e,1,t)}setChainParentage_(e,t){this.m_chainData.setField(e,2,t)}setChainParent_(e,t){this.m_chainData.setField(e,3,t);const s=this.getChainFirstIsland(t);this.setChainNextInParent_(e,s),this.setChainFirstIsland_(t,e)}setChainFirstIsland_(e,t){this.m_chainData.setField(e,4,t)}setChainNextInParent_(e,t){this.m_chainData.setField(e,5,t)}setChainPrev_(e,t){this.m_chainData.setField(e,6,t)}setChainNext_(e,t){this.m_chainData.setField(e,7,t)}setChainArea_(e,t){const s=this.getChainIndex_(e);this.m_chainAreas.write(s,t)}setChainPerimeter_(e,t){const s=this.getChainIndex_(e);this.m_chainPerimeters.write(s,t)}updateChainAreaAndPerimeter_(e){const t=this.m_shape.hasCurves(),s=new dt(0),n=new dt(0),r=this.getChainHalfEdge(e),i=et.getNAN(),o=et.getNAN(),a=et.getNAN();this.getHalfEdgeFromXY(r,i),o.setCoordsPoint2D(i);let h=r;do{this.getHalfEdgeToXY(h,a),t&&this.isCurveEdge(h)||n.pe(et.distance(o,a));this.getHalfEdgeChain(this.getHalfEdgeTwin(h))!==e&&s.pe((a.x-i.x-(o.x-i.x))*(a.y-i.y+(o.y-i.y))*.5),o.setCoordsPoint2D(a),h=this.getHalfEdgeNext(h)}while(h!==r);if(t){const t=new k;h=r;do{this.getHalfEdgeToXY(h,a);const r=this.isCurveEdge(h);r&&(this.querySegmentXY(h,t),n.pe(t.get().calculateLength2D()));if(this.getHalfEdgeChain(this.getHalfEdgeTwin(h))!==e&&r){const e=t.get().calculateArea2DHelper();s.pe(e)}h=this.getHalfEdgeNext(h)}while(h!==r)}const m=this.getChainIndex_(e);this.m_chainAreas.write(m,s.getResult()),this.m_chainPerimeters.write(m,n.getResult())}getChainTopmostEdge_(e){return l(0),0}planeSweepParentage_(e,t){const s=new Ws(this),n=new Ce;n.setCapacity(Math.trunc(this.m_pointCount/2