@arcgis/core 4.33.0-next.20250513 → 4.33.0-next.20250515
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.js +1 -1
- package/Map.js +1 -1
- package/WebScene.js +1 -1
- package/applications/Components/SelectionOperation.js +1 -1
- package/arcade/functions/centroid.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/geometry/operators.js +1 -1
- package/arcade/geometry/operatorsWorker.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/assets/components/assets/combobox/t9n/messages.en.json +1 -1
- package/assets/components/assets/combobox/t9n/messages.json +1 -1
- package/assets/components/assets/icon/calendarHeatChart16.json +1 -0
- package/assets/components/assets/icon/calendarHeatChart24.json +1 -0
- package/assets/components/assets/icon/calendarHeatChart32.json +1 -0
- package/assets/components/assets/icon/matrixHeatChart16.json +1 -0
- package/assets/components/assets/icon/matrixHeatChart24.json +1 -0
- package/assets/components/assets/icon/matrixHeatChart32.json +1 -0
- package/assets/components/assets/icon/progressBarChart16.json +1 -0
- package/assets/components/assets/icon/progressBarChart24.json +1 -0
- package/assets/components/assets/icon/progressBarChart32.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualization16.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualization24.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualization32.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOpen16.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOpen24.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOpen32.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlined16F.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlined24F.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlined32F.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedColorLocked16.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedColorLocked24.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedColorLocked32.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpen16.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpen24.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpen32.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpenColorLocked16.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpenColorLocked24.json +1 -0
- package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpenColorLocked32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/009730713ed9bc7c7388.js +1 -0
- package/assets/esri/core/workers/chunks/02853ab923245459b32e.js +1 -0
- package/assets/esri/core/workers/chunks/0624ae07d3af8d5f1ac8.js +1 -0
- package/assets/esri/core/workers/chunks/0817ddd885ce8b2459cb.js +1 -0
- package/assets/esri/core/workers/chunks/{69e8aabe5a1eb2d1e414.js → 0832bd5195b5791dd803.js} +1 -1
- package/assets/esri/core/workers/chunks/{4deeeceb784e4390441d.js → 0a4cece5e96fb7e8a57b.js} +1 -1
- package/assets/esri/core/workers/chunks/0d23610475c85385fbff.js +1 -0
- package/assets/esri/core/workers/chunks/{b4f38fe9cc948a39ad87.js → 0fd6d80393722132e044.js} +2 -2
- package/assets/esri/core/workers/chunks/{0766ecb677d667e5fb83.js.LICENSE.txt → 0fd6d80393722132e044.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/1051a5a57b2fb843a555.js +1 -0
- package/assets/esri/core/workers/chunks/12e99071f6582f6caeaf.js +1 -0
- package/assets/esri/core/workers/chunks/133e4bde346828d4510b.js +1 -0
- package/assets/esri/core/workers/chunks/1991f0d0f0a12175f849.js +1 -0
- package/assets/esri/core/workers/chunks/19a58adc75a34f84b0ef.js +1 -0
- package/assets/esri/core/workers/chunks/1d7f2abfccc54659d6f2.js +1 -0
- package/assets/esri/core/workers/chunks/{339e7a900e2bba9d3647.js → 1f19bd3ef795c6765384.js} +1 -1
- package/assets/esri/core/workers/chunks/{837f886f759fc6f0489d.js → 1f4fd9e3849f4e593375.js} +1 -1
- package/assets/esri/core/workers/chunks/1f9c6fbcd4d0eae1e574.js +1 -0
- package/assets/esri/core/workers/chunks/234117cc5cb7c6863313.js +1 -0
- package/assets/esri/core/workers/chunks/{07695960aa0344dbfbf3.js → 28d9e2ffc3059a55311e.js} +1 -1
- package/assets/esri/core/workers/chunks/{1c025beaaac5ec7c04fb.js → 2adf558cd8d8155d07d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{47f64a340b5d56bf9e59.js → 2cf82d3645c75d311e99.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7ab3511f6627f467796.js → 377a7f0f7d304ff9fe5b.js} +1 -1
- package/assets/esri/core/workers/chunks/3b4b4f84d594db8945f9.js +1 -0
- package/assets/esri/core/workers/chunks/3bf1cf6c3cba172e2f6d.js +1 -0
- package/assets/esri/core/workers/chunks/{b3ca65d6112079fb1d00.js → 3ce5d7ad16e41eea05be.js} +1 -1
- package/assets/esri/core/workers/chunks/465f2db4ab8aa9c9f907.js +1 -0
- package/assets/esri/core/workers/chunks/{1e13e03aad422f9e871e.js → 47fe2379f2214bf50036.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c45603af279ad7fed8c.js → 4954e0cf4a40e45d237f.js} +1 -1
- package/assets/esri/core/workers/chunks/4a362a35bcdb8405a53a.js +1 -0
- package/assets/esri/core/workers/chunks/4f8ebd9f0758b801835c.js +1 -0
- package/assets/esri/core/workers/chunks/5228d39c05d660a135b6.js +1 -0
- package/assets/esri/core/workers/chunks/{736cb9f74bf050b70f4c.js → 52a3d0e041717da7697e.js} +1 -1
- package/assets/esri/core/workers/chunks/54ea93f416ab52b413c1.js +1 -0
- package/assets/esri/core/workers/chunks/554a8bf4626336e68798.js +1 -0
- package/assets/esri/core/workers/chunks/55f087bca75c3f2a4515.js +1 -0
- package/assets/esri/core/workers/chunks/56569d0c2cf5c5167651.js +1 -0
- package/assets/esri/core/workers/chunks/{bbaadce582df7e20397b.js → 56d2a20c1b143697aa19.js} +1 -1
- package/assets/esri/core/workers/chunks/57211c35a9646f088d86.js +1 -0
- package/assets/esri/core/workers/chunks/58526def64536b6581ab.js +1 -0
- package/assets/esri/core/workers/chunks/5890740d5a761b038560.js +1 -0
- package/assets/esri/core/workers/chunks/{9a641fb94819574e48f6.js → 5a73d8b7b01758ed4fdd.js} +1 -1
- package/assets/esri/core/workers/chunks/{ba3193ea145960a50e87.js → 5c8d52b72a3bea4202ac.js} +1 -1
- package/assets/esri/core/workers/chunks/5dbd8d81d94cfda5bb32.js +1 -0
- package/assets/esri/core/workers/chunks/5e52c1c076a1502f9fe4.js +1 -0
- package/assets/esri/core/workers/chunks/609c7c9b7046b3a7acde.js +1 -0
- package/assets/esri/core/workers/chunks/{30f3014c0ac6e2bc14bf.js → 622c0552ca3cd674d46c.js} +1 -1
- package/assets/esri/core/workers/chunks/62798f66872dc32e77d6.js +346 -0
- package/assets/esri/core/workers/chunks/6409160d226a0bea5ac6.js +1 -0
- package/assets/esri/core/workers/chunks/65fd971d0574d69cbc26.js +1 -0
- package/assets/esri/core/workers/chunks/6993a59cbb78bc26f029.js +1 -0
- package/assets/esri/core/workers/chunks/6b23ca6570357f9fb724.js +1 -0
- package/assets/esri/core/workers/chunks/6c37a5bd00d255d1337a.js +1 -0
- package/assets/esri/core/workers/chunks/{2b01e3bce78541620a86.js → 6cbe8205a4e0f62da519.js} +1 -1
- package/assets/esri/core/workers/chunks/6ce4327f63e6eb92bba8.js +1 -0
- package/assets/esri/core/workers/chunks/6f9b8df290b0ce09beae.js +1 -0
- package/assets/esri/core/workers/chunks/{fef1a5f8a6fd3502b33b.js → 6fa1a5b7276a037dbd6a.js} +67 -89
- package/assets/esri/core/workers/chunks/7c819b3e6d69c526f4b2.js +1 -0
- package/assets/esri/core/workers/chunks/7df147da40474b028705.js +1 -0
- package/assets/esri/core/workers/chunks/{0766ecb677d667e5fb83.js → 7e1dc8e5e18f18dd21e2.js} +2 -2
- package/assets/esri/core/workers/chunks/{b4f38fe9cc948a39ad87.js.LICENSE.txt → 7e1dc8e5e18f18dd21e2.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e662c86b8bafc5512d3d.js → 847e88e1d6da1e74cdc8.js} +1 -1
- package/assets/esri/core/workers/chunks/{6f5ec9bf7cf8a36d8e8b.js → 87eca6de502d18d8b7eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{a73c6b4bc5baf440f85a.js → 88b7265270feede80e1d.js} +1 -1
- package/assets/esri/core/workers/chunks/{10e6dffa57aa1a626708.js → 8a6aac37b3133de74cce.js} +1 -1
- package/assets/esri/core/workers/chunks/8a87c181b85d0b86b9bb.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{243dc74ec62891ba1ef7.js → 8e82acd1f730571680f4.js} +1 -1
- package/assets/esri/core/workers/chunks/8f1fbfdac04e694f621d.js +1 -0
- package/assets/esri/core/workers/chunks/91cd29f53f07bc38fe75.js +1 -0
- package/assets/esri/core/workers/chunks/{5583d18032ed8bc17c74.js → 938f1eebc48871be64e9.js} +1 -1
- package/assets/esri/core/workers/chunks/97c148adf0347c69a79c.js +1 -0
- package/assets/esri/core/workers/chunks/{029a118e6dfb3f544a5c.js → 98ef17d15517368d2383.js} +1 -1
- package/assets/esri/core/workers/chunks/9c8224ca29475556e5ea.js +1 -0
- package/assets/esri/core/workers/chunks/9d5eac3bd1526e2b33e3.js +1 -0
- package/assets/esri/core/workers/chunks/{38f5e6a202ce292edd9f.js → 9eb9c8db2510154c09cc.js} +1 -1
- package/assets/esri/core/workers/chunks/a036503087baa1f9fd00.js +1 -0
- package/assets/esri/core/workers/chunks/a09b5700c92bb76c3234.js +1 -0
- package/assets/esri/core/workers/chunks/a673128da9e6656ead2e.js +1 -0
- package/assets/esri/core/workers/chunks/{90ae15ce22a49bd84876.js → ab9614555a15f04396f6.js} +2 -2
- package/assets/esri/core/workers/chunks/{90ae15ce22a49bd84876.js.LICENSE.txt → ab9614555a15f04396f6.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/ae733c963d61065faa54.js +1 -0
- package/assets/esri/core/workers/chunks/b0522dffa5600345c07e.js +1 -0
- package/assets/esri/core/workers/chunks/b06cb23048c32940f5de.js +1 -0
- package/assets/esri/core/workers/chunks/{079434fe765c53d304f2.js → b1e275607d9754079f60.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1f7bfb8daf11ecada9f.js → b4273381dc069f4e1fa2.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb2e28e6a87956267d1c.js → b92a34f88569c481ed10.js} +1 -1
- package/assets/esri/core/workers/chunks/{352b7dcd1633e0c98194.js → ba940ebdae84b174a7be.js} +1 -1
- package/assets/esri/core/workers/chunks/bf9b6b74654d303a6dae.js +1 -0
- package/assets/esri/core/workers/chunks/c07c1bb7ae09136dc1f6.js +1 -0
- package/assets/esri/core/workers/chunks/c938f5d269ba202d10ef.js +1 -0
- package/assets/esri/core/workers/chunks/cbbca011f8b176d4b5db.js +1 -0
- package/assets/esri/core/workers/chunks/ce321fd8fc5551e190ec.js +1 -0
- package/assets/esri/core/workers/chunks/ce53ddda04e09ba2f860.js +1 -0
- package/assets/esri/core/workers/chunks/d166f805990353578494.js +1 -0
- package/assets/esri/core/workers/chunks/{b816b608f31954128246.js → d21d9e8b8c8a2e0485d5.js} +1 -1
- package/assets/esri/core/workers/chunks/d9a23fb0c6c936d5e8ec.js +1 -0
- package/assets/esri/core/workers/chunks/da3c62a851a4332f6dda.js +1 -0
- package/assets/esri/core/workers/chunks/db3f710d770adf631b28.js +2 -0
- package/assets/esri/core/workers/chunks/{aa82925ffb00babb0543.js.LICENSE.txt → db3f710d770adf631b28.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{6805e7b43d6ecf3ea93c.js → dcf5719f38ad40b92941.js} +1 -1
- package/assets/esri/core/workers/chunks/e2cada6644c49b1b6e79.js +1 -0
- package/assets/esri/core/workers/chunks/e2fb4bebce3aee406efa.js +1 -0
- package/assets/esri/core/workers/chunks/e3638f9d4c0fda238f4b.js +1 -0
- package/assets/esri/core/workers/chunks/e85f892ea44d67d53ff0.js +2 -0
- package/assets/esri/core/workers/chunks/{3596540ef49e5330ceb2.js.LICENSE.txt → e85f892ea44d67d53ff0.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/e89345c7af9d3d4d8452.js +1 -0
- package/assets/esri/core/workers/chunks/{a31658f544ac6e1801d6.js → ead5d4e271effc04def3.js} +1 -1
- package/assets/esri/core/workers/chunks/ece68a25651ef03fc95d.js +1 -0
- package/assets/esri/core/workers/chunks/f218a190015de1444018.js +1 -0
- package/assets/esri/core/workers/chunks/f229044615af3142bcb0.js +1 -0
- package/assets/esri/core/workers/chunks/f2692f25ef693cf12ce0.js +1 -0
- package/assets/esri/core/workers/chunks/f4c6ea630cecf0f260d7.js +2 -0
- package/assets/esri/core/workers/chunks/{e0dc8794343c2a949ffb.js.LICENSE.txt → f4c6ea630cecf0f260d7.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/f718cb847c4eb1e43ad9.js +1 -0
- package/assets/esri/core/workers/chunks/f8fb0c7eaf73709bd855.js +1 -0
- package/assets/esri/core/workers/chunks/faa40ef04604c7cce706.js +1 -0
- package/assets/esri/core/workers/chunks/{218a66d53f7cf4f285aa.js → fbd2f45d5adce4ca323f.js} +2 -2
- package/assets/esri/core/workers/chunks/{218a66d53f7cf4f285aa.js.LICENSE.txt → fbd2f45d5adce4ca323f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/ffaa977cd97a2b7190c5.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +17 -10
- package/assets/esri/themes/base/widgets/_SelectionList.scss +7 -3
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +5 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/Jpg.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorDefinitions.js +5 -0
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/ShadowCastAccumulate.glsl.js +7 -5
- package/chunks/ShadowCastVisualize.glsl.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +8 -7
- package/chunks/Transformation2D.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/bundle.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/dxt_encoder.js +1 -1
- package/chunks/geometryEngineBase.js +1 -1
- package/chunks/i3s.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/libtess-asm.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/vec4.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/core/Accessor.js +1 -1
- package/core/accessorSupport/Lifecycle.js +5 -0
- package/core/accessorSupport/Properties.js +1 -1
- package/core/accessorSupport/decorators/subclass.js +1 -1
- package/core/accessorSupport/tracking/Flags.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/image/apng.js +1 -1
- package/core/image/gif.js +1 -1
- package/core/mapCollectionUtils.js +1 -1
- package/core/mathUtils.js +1 -1
- package/core/urlUtils.js +1 -1
- package/core/workers/Connection.js +1 -1
- package/geometry/operators/densifyOperator.d.ts +0 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSimplifyOGC.js +1 -1
- package/geometry/operators/simplifyOGCOperator.js +1 -1
- package/geometry/support/meshProperties.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/interfaces.d.ts +463 -2595
- package/intl/date.js +1 -1
- package/intl/number.js +1 -1
- package/layers/BingMapsLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/OptimizedFeatureSet.js +1 -1
- package/layers/graphics/controllers/StreamController.js +1 -1
- package/layers/graphics/data/FeatureIdInfo.js +5 -0
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/StreamFeatureManager.js +1 -1
- package/layers/graphics/data/createFeatureId.js +5 -0
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/orientedImagery/queries.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/LercWorker.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/support/rasterFunctions/stretchUtils.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/networks/support/NetworkElement.js +1 -1
- package/rest/networks/support/QueryAssociationsParameters.js +1 -1
- package/rest/networks/support/TelecomNetworkElement.js +1 -1
- package/rest/networks/support/TraceResult.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/query/operations/queryRelatedRecords.js +1 -1
- package/smartMapping/statistics/uniqueValues.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/layerUtils.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/symbols/cim/effects/EffectRadial.js +1 -1
- package/versionManagement/versionAdapters/FeatureLayerVersionAdapter.js +1 -1
- package/versionManagement/versionAdapters/NetworkVersionAdapter.js +1 -1
- package/versionManagement/versionAdapters/SubTypeGroupLayerVersionAdapter.js +1 -1
- package/views/2d/engine/ManagedCanvas.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/webgl/TileContainer.js +1 -1
- package/views/2d/engine/webgl/grouping.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/VideoLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
- package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/FocusAreasView.js +5 -0
- package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
- package/views/3d/analysis/DimensionAnalysisView3D.d.ts +4 -0
- package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolManipulatorUtils.js +1 -1
- package/views/3d/camera/constraintUtils/common.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DimensionLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWasm.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/ViewshedLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/graphics/focusAreaStyle.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
- package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/I3SQueryResultGeometry.js +1 -1
- package/views/3d/layers/i3s/PagedNodeIndex.js +1 -1
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/i3s/meshUtils.js +5 -0
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/LayerViewAnalysisViewManager.js +5 -0
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileAgent.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ShadowmapFiltering.glsl.js +3 -25
- package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadow.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Texture2DShadowBindUniform.js +5 -0
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +3 -3
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/FocusArea.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/layers/BuildingComponentSublayerView.js +1 -1
- package/views/layers/BuildingSceneLayerView.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/support/TextureCompressionWorkerHandle.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/ElevationProfile/support/profileUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/NavigationManagerPanoramic.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/errors.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/queries.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/utils.js +5 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
- package/assets/esri/core/workers/chunks/009dbddfc6499e2cee4f.js +0 -1
- package/assets/esri/core/workers/chunks/0516bd18334d3af6c555.js +0 -1
- package/assets/esri/core/workers/chunks/0d8a635c1f9aeaf7564c.js +0 -1
- package/assets/esri/core/workers/chunks/0f57b6a3a85a47ebd9d0.js +0 -346
- package/assets/esri/core/workers/chunks/1abd026ed12c863e1d94.js +0 -1
- package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +0 -1
- package/assets/esri/core/workers/chunks/1c6542315390037053a6.js +0 -1
- package/assets/esri/core/workers/chunks/201db423e3c6f947b77c.js +0 -1
- package/assets/esri/core/workers/chunks/23de8aeed5b82c682cbe.js +0 -1
- package/assets/esri/core/workers/chunks/26ebb7816dd8c8cd4f3b.js +0 -1
- package/assets/esri/core/workers/chunks/2abce00d812c7f6b542d.js +0 -1
- package/assets/esri/core/workers/chunks/2e0af748eba93f3ea6cb.js +0 -1
- package/assets/esri/core/workers/chunks/3596540ef49e5330ceb2.js +0 -2
- package/assets/esri/core/workers/chunks/3604a77c93cf2927787b.js +0 -1
- package/assets/esri/core/workers/chunks/391b1c3e736a62befbaf.js +0 -1
- package/assets/esri/core/workers/chunks/40e556a0645af8658658.js +0 -1
- package/assets/esri/core/workers/chunks/4402336db7210cd583e0.js +0 -1
- package/assets/esri/core/workers/chunks/47cd99ab3ed11a931084.js +0 -1
- package/assets/esri/core/workers/chunks/4bd5cbf6e0be2fc7e84d.js +0 -1
- package/assets/esri/core/workers/chunks/4c8052e81916579841f4.js +0 -1
- package/assets/esri/core/workers/chunks/4c9aa1dafdc0d9537231.js +0 -1
- package/assets/esri/core/workers/chunks/4feb774f123da26e9f2a.js +0 -1
- package/assets/esri/core/workers/chunks/51b5dfc7085272d26b89.js +0 -1
- package/assets/esri/core/workers/chunks/51d9eaeeb781fd1d1162.js +0 -1
- package/assets/esri/core/workers/chunks/5228fc7fcdf57f44781e.js +0 -1
- package/assets/esri/core/workers/chunks/566c2ce50af225e556ac.js +0 -1
- package/assets/esri/core/workers/chunks/5ddf463c85c33428e807.js +0 -1
- package/assets/esri/core/workers/chunks/61032b5050464cb48056.js +0 -1
- package/assets/esri/core/workers/chunks/63dade3e1cc7f5b76846.js +0 -1
- package/assets/esri/core/workers/chunks/6e12900a9f4c3c9941ec.js +0 -1
- package/assets/esri/core/workers/chunks/6e5d8a6b29c06a27998c.js +0 -1
- package/assets/esri/core/workers/chunks/6f506303017903b9a06f.js +0 -1
- package/assets/esri/core/workers/chunks/71e46e866c23372b0b58.js +0 -1
- package/assets/esri/core/workers/chunks/75fa861b5757551f8fdc.js +0 -1
- package/assets/esri/core/workers/chunks/7c49a8877bd744daa3d5.js +0 -1
- package/assets/esri/core/workers/chunks/7ea5bbb52e84be9a608e.js +0 -1
- package/assets/esri/core/workers/chunks/83e13baab4b90a88d967.js +0 -1
- package/assets/esri/core/workers/chunks/86138c297095af1ac604.js +0 -1
- package/assets/esri/core/workers/chunks/8b74b609de4f70e1a75c.js +0 -1
- package/assets/esri/core/workers/chunks/8e6301006abdf47cc88d.js +0 -1
- package/assets/esri/core/workers/chunks/90f93091fe088875f80f.js +0 -1
- package/assets/esri/core/workers/chunks/91a02ee91f61cf841111.js +0 -1
- package/assets/esri/core/workers/chunks/93cc26e5636040fdc0b8.js +0 -1
- package/assets/esri/core/workers/chunks/9baeb3b5733acdda4e7c.js +0 -1
- package/assets/esri/core/workers/chunks/a1d697e2be1e892a666a.js +0 -1
- package/assets/esri/core/workers/chunks/a1f27c4f4b5ef3e359f7.js +0 -1
- package/assets/esri/core/workers/chunks/a348ff2dd936c6bf9399.js +0 -1
- package/assets/esri/core/workers/chunks/a8430e1e2142f1ce9b92.js +0 -1
- package/assets/esri/core/workers/chunks/aa82925ffb00babb0543.js +0 -2
- package/assets/esri/core/workers/chunks/b64f708f821dd2bb51cd.js +0 -1
- package/assets/esri/core/workers/chunks/bf453744067267e84d1b.js +0 -1
- package/assets/esri/core/workers/chunks/c1175477dfcdee90a453.js +0 -1
- package/assets/esri/core/workers/chunks/c17c269cc30e7e1d0bfb.js +0 -1
- package/assets/esri/core/workers/chunks/c3f144ca69995dca34a9.js +0 -1
- package/assets/esri/core/workers/chunks/c4e2b75b9135920babc3.js +0 -1
- package/assets/esri/core/workers/chunks/cb80b7ddc9acf625d754.js +0 -1
- package/assets/esri/core/workers/chunks/d22f91bc16a7641bcbef.js +0 -1
- package/assets/esri/core/workers/chunks/d52cf7b795ee52034f9e.js +0 -1
- package/assets/esri/core/workers/chunks/d551f70560a2b1ef5696.js +0 -1
- package/assets/esri/core/workers/chunks/d971571a957de70d5a8d.js +0 -1
- package/assets/esri/core/workers/chunks/d9d9d4f99140e579eabb.js +0 -1
- package/assets/esri/core/workers/chunks/dc3a6beb3028009b3c23.js +0 -1
- package/assets/esri/core/workers/chunks/e0dc8794343c2a949ffb.js +0 -2
- package/assets/esri/core/workers/chunks/e483d2f169e51a361742.js +0 -1
- package/assets/esri/core/workers/chunks/e613df03ceb39e29befa.js +0 -1
- package/assets/esri/core/workers/chunks/e697dd4508f02dcfe329.js +0 -1
- package/assets/esri/core/workers/chunks/e9b1349a2b3a3f300808.js +0 -1
- package/assets/esri/core/workers/chunks/eabfab23246d4a052ea3.js +0 -1
- package/assets/esri/core/workers/chunks/ec8e8048b3df2c92008d.js +0 -1
- package/assets/esri/core/workers/chunks/ed6d0fea159dea638c2f.js +0 -1
- package/assets/esri/core/workers/chunks/f5fcba6ca6f43bf1d65d.js +0 -1
- package/assets/esri/core/workers/chunks/f92d76b694ff0cdb212c.js +0 -1
- package/chunks/NetworkElement.js +0 -5
- package/core/accessorSupport/interfaces.js +0 -5
- package/views/FocusAreasUtils.js +0 -5
- package/views/FocusAreasView.js +0 -5
- package/views/analysis/DimensionAnalysisView.d.ts +0 -4
- package/views/analysis/DimensionAnalysisView.js +0 -5
package/chunks/Envelope.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Q as t,d as e,a as s,F as i,x as n,E as r,c as h,P as o,i as a,b as m,A as _,B as l,j as u,m as d,w as c}from"./Point2D.js";import{Envelope2D as p}from"./Envelope2D.js";import{g,a as f,q as v,G as y,t as x,u as E,d as b,p as N,i as D,f as I}from"./Geometry.js";const C=[0,0,Number.NaN,0,0,0,0,0,-1,-1,0,0,0,0],T=[2,1,1,1,3,1,2,3,2,4,1,1,2,1],R=[1,1,1,0,2,1,1,1,0,0,0,0,0,1],A=[1,1,1,2,0,0,0,0,2,2,4,2,2,1],q=[4,8,4,8,1],w=25;function B(){return e(w,Number.NaN)}let z=class s{getAttributeCount(){return this.m_attributeCount}getSemantics(t){return this.m_indexToSemantics[t]}getSemanticsBitArray(){return this.m_semanticsBitArray}getAttributeIndex(t){return this.m_semanticsToIndexMap[t]}static getInterpolation(t){return R[t]}static getPersistence(t){return A[t]}static getPersistenceSize(t){return q[t]}static getPersistenceSizeFromSemantics(t){return s.getPersistenceSize(s.getPersistence(t))*s.getComponentCount(t)}static getComponentCount(t){return T[t]}static maxComponentCount(){return 4}static isInteger(t){return 2===t||3===t||4===t}static isIntegerSemantics(t){return s.isInteger(s.getPersistence(t))}static isTexture(t){return 5===t||6===t||7===t}hasAttribute(t){return!!(this.m_semanticsBitArray&1<<t)}hasAttributesFrom(t){return(this.m_semanticsBitArray&t.m_semanticsBitArray)===t.m_semanticsBitArray}hasZ(){return this.hasAttribute(1)}hasM(){return this.hasAttribute(2)}hasID(){return this.hasAttribute(3)}getTotalComponentCount(){return this.m_totalComponentCount}static getDefaultValue(t){return C[t]}static isDefaultValue(e,s){return t(C[e],s)}equals(t){return this===t}getDefaultPointAttributes(){return this.m_defaultPointAttributes}getPointAttributeOffset(t){return this.m_pointAttributeOffsets[t]}constructor(t){this.m_semanticsBitArray=t,this.m_attributeCount=0,this.m_totalComponentCount=0,this.m_semanticsToIndexMap=new Int32Array(14),this.m_indexToSemantics=new Int32Array(14),this.m_pointAttributeOffsets=new Int32Array(14),this.m_defaultPointAttributes=e(w,Number.NaN),this.m_semanticsToIndexMap.fill(-1),this.m_indexToSemantics.fill(-1);let i=0,n=1,r=14;for(;i<r;i++)t&n&&(this.m_semanticsToIndexMap[i]=this.m_attributeCount,this.m_indexToSemantics[this.m_attributeCount]=i,this.m_attributeCount++,this.m_totalComponentCount+=s.getComponentCount(i)),n<<=1;let h=0;for(i=0,r=this.getAttributeCount();i<r;i++){const t=this.getSemantics(i),e=s.getComponentCount(t),n=s.getDefaultValue(t);this.m_pointAttributeOffsets[i]=h;for(let s=0;s<e;s++)this.m_defaultPointAttributes[h]=n,h++}}};var L=z;function S(){return e(14,0)}class F{static getInstance(){return F.s_thisInstance}constructor(){this.m_map=new Map,this.m_vd2D=new L(1),this.m_map.set(1,this.m_vd2D),this.m_vd3D=new L(3),this.m_map.set(3,this.m_vd2D)}GetVD2D(){return this.m_vd2D}GetVD3D(){return this.m_vd3D}FindOrAdd(t){if(1===t)return this.GetVD2D();if(3===t)return this.GetVD3D();const e=this.m_map.get(t);if(e)return e;const s=new L(t);return this.m_map.set(t,s),s}}function P(t){return F.getInstance().FindOrAdd(t)}function H(t,e){if(!t||!e)return e||t;const s=t.getSemanticsBitArray()|e.getSemanticsBitArray();return(s&t.getSemanticsBitArray())===s?t:(s&e.getSemanticsBitArray())===s?e:P(s)}function V(t,e){const s=t.getSemanticsBitArray()|1<<e;return(s&t.getSemanticsBitArray())===s?t:P(s)}function k(t,e){const s=(t.getSemanticsBitArray()|1<<e)-(1<<e);return s===t.getSemanticsBitArray()?t:P(s)}function M(){return F.getInstance().GetVD2D()}function O(){return F.getInstance().GetVD3D()}function Y(t,e,s){if(s.fill(-1),null!==t&&null!==e)for(let i=0,n=t.getAttributeCount();i<n;i++)s[i]=e.getAttributeIndex(t.getSemantics(i))}F.s_thisInstance=new F;class X{static construct(t,e,s){return new X(t,e,s)}constructor(t,e,s){void 0!==t?(this.x=t,this.y=e,this.z=s):this.x=this.y=this.z=Number.NaN}get 0(){return this.x}get 1(){return this.y}get 2(){return this.z}set 0(t){this.x=t}set 1(t){this.y=t}set 2(t){this.z=t}clone(){return new X(this.x,this.y,this.z)}assign(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}setCoords(t,e,s){return this.x=t,this.y=e,this.z=s,this}setCoordsPoint2DZ(t,e){return this.setCoords(t.x,t.y,e)}setCoordsPoint3D(t){this.x=t.x,this.y=t.y,this.z=t.z}setZero(){this.x=0,this.y=0,this.z=0}setNormalized(t){this.assign(t),this.normalizeThis()}normalizeThis(){const t=this.length();return t?(this.x/=t,this.y/=t,this.z/=t):(this.x=1,this.y=0,this.z=0),this}getUnitVector(){const t=new X;return t.setNormalized(this),t}sqrLength(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthXY(){return g(0),0}static sqrDistance(t,e){return s(t.x-e.x)+s(t.y-e.y)+s(t.z-e.z)}static sqrDistanceCoords(t,e,i,n,r,h){return s(t-n)+s(e-r)+s(i-h)}static distance(t,e){return Math.sqrt(X.sqrDistance(t,e))}isEqual(t,e){return void 0===e&&(e=0),Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e&&i(this.z,t.z,e)}static compareByLength(t,e,s,i){return g(0),0}isEqualCoords(t,e,s,i){return g(0),this.x===t&&this.y===e&&this.z===s}isEqualsTols(t,e,s){return g(0),!1}isEqualCoordsTols(t,e,s,i,n){return g(0),!1}static st_isEqual(t,e,s,i){return g(0),!1}equals(t,e){return this.isEqual(t,e)}equalsTols(t,e,s){return g(0),!1}divThis(t){return this.x/=t,this.y/=t,this.z/=t,this}subThis(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}setSub(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}sub(t){return X.construct(this.x-t.x,this.y-t.y,this.z-t.z)}addThis(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}add(t){return this.clone().addThis(t)}setAdd(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}mul(t){return X.construct(this.x*t,this.y*t,this.z*t)}dotProduct(t){return this.x*t.x+this.y*t.y+this.z*t.z}crossProductVector(t){const e=this.y*t.z-t.y*this.z,s=t.x*this.z-this.x*t.z,i=this.x*t.y-t.x*this.y;return new X(e,s,i)}setCrossProductVector(t,e){const s=t.y*e.z-e.y*t.z,i=e.x*t.z-t.x*e.z,n=t.x*e.y-e.x*t.y;return this.x=s,this.y=i,this.z=n,this}setScaled(t,e){return this.x=t*e.x,this.y=t*e.y,this.z=t*e.z,this}scaleThis(t){return this.x*=t,this.y*=t,this.z*=t,this}scaleZThis(t){return this.z*=t,this}setNAN(){return g(0),this}isNAN(){return Number.isNaN(this.x)||Number.isNaN(this.y)||Number.isNaN(this.z)}static getNAN(){return X.construct(Number.NaN,Number.NaN,Number.NaN)}isFinite(){return g(0),!1}isZero(){return 0===this.x&&0===this.y&&0===this.z}norm(t){return g(0),0}sqrDistanceFromCenterToSpheroidSurface(t,e){return g(0),0}distanceFromCenterToSpheroidSurface(t,e){return Math.sqrt(this.sqrDistanceFromCenterToSpheroidSurface(t,e))}static getClosestCoordinate(t,e,s,i=!1){return g(0),0}compare(t){return this.y<t.y?-1:this.y>t.y?1:this.x<t.x?-1:this.x>t.x?1:this.z<t.z?-1:this.z>t.z?1:0}compareXYZ(t){return g(0),0}negateThis(){this.x=-this.x,this.y=-this.y,this.z=-this.z}static averageFast(t,e){return g(0),{}}static average(t,e){return g(0),{}}static size(){return X.dimensions}static lerp(t,e,s){const i=new X;return n(t,e,s,i),i}static slerp(t,e,s){return g(0),{}}static compareVectors(t,e){return g(0),0}static selectRightHandedBasisFromNormal(t,e,s){const i=t.getUnitVector(),n=i.createAPerpendicular(),r=new X;r.setCrossProductVector(i,n),r.normalizeThis(),e.setCoordsPoint3D(n),s.setCoordsPoint3D(r)}createAPerpendicular(){const t=[this.crossProductVector(new X(0,0,1)),this.crossProductVector(new X(1,0,0)),this.crossProductVector(new X(0,1,0))],e=[t[0].sqrLength(),t[1].sqrLength(),t[2].sqrLength()],s=t[e.reduce(((t,s,i)=>e[t]>e[i]?t:i),0)];return s.normalizeThis(),s}calculateAngle(t){return g(0),0}static crossDotSign(t,e,s){return g(0),0}static isBisectorRobust(t,e,s){return g(0),0}static compareZOrder(t,e){return g(0),!1}}X.dimensions=3;class G{static constructEmpty(){return new G(Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN)}constructor(t,e,s,i,n,r){this.m_EnvelopeType=3,this.xmin=t,this.ymin=e,this.zmin=s,this.xmax=i,this.ymax=n,this.zmax=r,this.normalize()}inflate(t){this.inflateCoords(t,t,t)}inflateCoords(t,e,s){g(0)}getEnvelope2D(){return new p(this.xmin,this.ymin,this.xmax,this.ymax)}getEnvelopeZs(){return new r(this.zmin,this.zmax)}setEmptyZ(){this.zmin=Number.NaN,this.zmax=Number.NaN}normalize(){let t=!1;this.xmin<=this.xmax||(this.xmax=h(this.xmin,this.xmin=this.xmax),t=!0),this.ymin<=this.ymax||(this.ymax=h(this.ymin,this.ymin=this.ymax),t=!0),!t||this.xmin<=this.xmax&&this.ymin<=this.ymax?this.zmin<=this.zmax||(this.zmax=h(this.zmin,this.zmin=this.zmax),this.zmin<=this.zmax||this.setEmptyZ()):this.setEmpty()}isEmpty(){return Number.isNaN(this.xmin)||Number.isNaN(this.ymin)||Number.isNaN(this.xmax)||Number.isNaN(this.ymax)}isEmptyZ(){return Number.isNaN(this.zmin)||Number.isNaN(this.zmax)}setEmpty(){this.xmin=Number.NaN,this.ymin=Number.NaN,this.zmin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN,this.zmax=Number.NaN}mergeEnv3D(t){t.isEmpty()||(this.mergeCoords(t.xmin,t.ymin,t.zmin),this.mergeCoords(t.xmax,t.ymax,t.zmax))}mergeNe(t){this.mergeNeCoords(t.x,t.y,t.z)}mergeNeCoords(t,e,s){this.xmin>t?this.xmin=t:this.xmax<t&&(this.xmax=t),this.ymin>e?this.ymin=e:this.ymax<e&&(this.ymax=e),this.zmin>s?this.zmin=s:this.zmax<s&&(this.zmax=s)}mergeCoords(t,e,s){this.isEmpty()?(this.xmin=t,this.xmax=t,this.ymin=e,this.ymax=e,this.zmin=s,this.zmax=s):(this.isEmptyZ()&&(this.zmin=s,this.zmax=s),this.mergeNeCoords(t,e,s))}setCoords(t,e,s,i,n,r){this.xmin=t,this.ymin=e,this.zmin=s,this.xmax=i,this.ymax=n,this.zmax=r,this.normalize()}sqrDistanceEnvelope3DAndPoints(t,e,s,i=1){return g(0),0}sqrMaxDistance(t,e=1){return g(0),0}}const U=-559038737;var Z=z;function Q(t,e,s){switch(t){case 0:return new it(e,s);case 1:return new nt(e,s);case 2:return new st(e,s);case 3:throw new Error("64 bit int attribute stream not implemented");case 4:return new et(e,s);default:f("")}}function j(t,e){const s=Z.getComponentCount(t);return Q(Z.getPersistence(t),e*s,Z.getDefaultValue(t))}function W(t,e){const s=Z.getComponentCount(t);return Q(Z.getPersistence(t),e*s)}function J(t,e){return new st(t,e)}function K(t,e){return new et(t,e)}function $(t,e){return new nt(t,e)}class tt{size(){return this.m_size}checkResize(t,e){t>this.m_size&&this.resize(t,e)}resize(t,e){if((t=Math.trunc(t))===this.m_size)return;const s=!!e||Number.isNaN(e);if(t<this.m_a.length)this.m_a.length>tt.s_resizeMin&&1.25*t<this.m_a.length&&(this.m_a=this.m_a.slice(0,t)),s&&t>this.m_size&&this.m_a.fill(e,this.m_size,t);else if(t>=this.m_a.length){const i=1.25*t,n=new this.m_a.constructor(i);n.set(this.m_a),this.m_a=n,s&&this.m_a.fill(e,this.m_size,t)}this.m_size=t}resizeRounded(t,e){return this.resize(t,e)}reserve(t){}read(t){return this.m_a[t]}readAsDbl(t){return this.read(t)}write(t,e){this.m_a[t]=e}writeAsDbl(t,e){this.write(t,e)}setRange(t,e,s){(e<0||s<0||s+e>this.size())&&f(),this.m_a.fill(t,e,e+s)}add(t){this.resize(this.m_size+1),this.m_a[this.m_size-1]=t}addArray(t,e){const s=this.m_size;void 0===e?(this.resize(this.m_size+t.length),this.m_a.set(t,s)):(this.resize(this.m_size+e),this.m_a.set(t.slice(0,e),s))}equals(t,e,s,i){if(this.getPersistence()!==t.getPersistence())return!1;return rt(this,t,e,s,i)}insertRange(t,e,s,i){const n=this.m_size;this.checkResize(Math.max(0,i)+s),this.m_a.copyWithin(t+s,t,i>=0?i:n),this.m_a.fill(e,t,t+s)}readRange(t,e){return this.m_a.slice(t,t+e)}insertRangeFromStream(t,e,s,i,n,r,h){g(this.getPersistence()===e.getPersistence());const o=e,a=this.m_size;i&&this.checkResize(Math.max(0,h)+i),this.m_a.copyWithin(t+i,t,h>=0?h:a),this.m_a.set(o.readRange(s,i),t),n||this.reverseRange(t,i,r)}writeRange(t,e,s,i,n,r){g(this.getPersistence()===s.getPersistence());const h=s;if((t<0||e<0||i<0)&&f(),h.size()<i+e&&f(),0===e)return;this.size()<e+t&&this.resize(e+t);const o=h.m_a.subarray(i,i+e);ht(this.m_a,t,e,o)}insertAttributes(t,e,s,i){const n=Z.getComponentCount(s);this.m_a.copyWithin(t+n,t,i>=0?i:this.m_size);for(let r=0;r<n;r++)this.m_a[t+r]=e.getAttributeAsDbl(s,r)}insertAttributesFromPoints(t,e,s,i,n){g(Z.getPersistence(i)===this.getPersistence());const r=Z.getComponentCount(i),h=this.m_size;if(this.checkResize(Math.max(0,n)+r*s),this.m_a.copyWithin(t+r*s,t,n>=0?n:h),0===i){const i=new o;for(let n=t,r=0;r<s;r++,n+=2)e[r].queryXY(i),this.m_a[n]=i.x,this.m_a[n+1]=i.y}else if(1===r)for(let o=t,a=0;a<s;a++,o++)this.m_a[o]=e[a].getAttributeAsDbl(i,0);else for(let o=t,a=0;a<s;a++,o+=r)for(let t=0;t<r;t++)this.m_a[o+t]=e[a].getAttributeAsDbl(i,t)}eraseRange(t,e,s){this.m_size<t+e&&f(),this.m_a.copyWithin(t,t+e),this.m_size-=e}reverseRange(t,e,s){if((s<1||e%s!=0)&&f(),this.m_a.subarray(t,t+e).reverse(),s>1)for(let i=t,n=t+e;i<n;i+=s){let t=i,e=i+s-1;for(;t<e;){const s=this.m_a[t];this.m_a[t]=this.m_a[e],this.m_a[e]=s,t++,e--}}}rotate(t,e,s){(e<t||e>s||t>s)&&v("rotate"),e!==t&&e!==s&&(this.reverseRange(t,e-t,1),this.reverseRange(e,s-e,1),this.reverseRange(t,s-t,1))}sort(t,e,s){this.m_a.subarray(t,e).sort(s)}constructor(t){if(t.move)this.m_a=t.move.m_a,this.m_size=t.move.m_size,t.move.m_a=t.move.m_a.slice(0,0),t.move.m_size=0;else if(t.copy)this.m_size=t.copy.m_size,t.maxSize&&(this.m_size=Math.min(t.maxSize,this.m_size)),this.m_a=t.copy.m_a.slice(0,this.m_size);else{const e=Math.max(t.size,tt.s_constructMin);this.m_a=new t.ctor(e),(t.defaultValue||Number.isNaN(t.defaultValue))&&this.m_a.fill(t.defaultValue),this.m_size=t.size}}}tt.s_constructMin=2,tt.s_resizeMin=30;class et extends tt{setBits(t,e){this.m_a[t]|=e}clearBits(t,e){this.m_a[t]&=~e}getPersistence(){return 4}clone(){return new et({ctor:Int8Array,copy:this})}restrictedClone(t){return new et({ctor:Int8Array,copy:this,maxSize:t})}constructor(t,e){super("number"==typeof t?{ctor:Int8Array,size:t,defaultValue:e}:t)}}class st extends tt{getPersistence(){return 2}clone(){return new st({ctor:Int32Array,copy:this})}restrictedClone(t){return new st({ctor:Int32Array,copy:this,maxSize:t})}write(t,e){g(e<=a()),super.write(t,e)}constructor(t,e){super("number"==typeof t?{ctor:Int32Array,size:t,defaultValue:e}:t)}}class it extends tt{getPersistence(){return 0}clone(){return new it({ctor:Float32Array,copy:this})}restrictedClone(t){return new it({ctor:Float32Array,copy:this,maxSize:t})}constructor(t,e){super("number"==typeof t?{ctor:Float32Array,size:t,defaultValue:e}:t)}}class nt extends tt{getPersistence(){return 1}getArray(){return this.m_a}applyTransformation(t,e,s){(1&e||e+2*s>this.size())&&f();const i=0===e?this.m_a:this.m_a.subarray(e);t.transformInterleavedPoints(i,s,i)}readPoint2D(t){const e=this.m_a[t],s=this.m_a[t+1];return new o(e,s)}queryPoint2D(t,e){return e.x=this.m_a[t],e.y=this.m_a[t+1],e}writePoint2D(t,e){this.write(t,e.x),this.write(t+1,e.y)}insert(t,e,s){this.checkResize(s+2),this.m_a.copyWithin(t+2,t,s),this.m_a[t]=e.x,this.m_a[t+1]=e.y}insertRangeFromPoints(t,e,s,i,n,r){const h=this.m_size;if(this.checkResize(Math.max(r,0)+2*i),this.m_a.copyWithin(t+2*i,t,r>=0?r:h),n)for(let o=s,a=t,m=0;m<i;++m,++o){const t=e[o];this.m_a[a++]=t.x,this.m_a[a++]=t.y}else for(let o=s+i-1,a=t,m=0;m<i;++m,--o){const t=e[o];this.m_a[a++]=t.x,this.m_a[a++]=t.y}}queryRange(t,e,s,i,n){if((t<0||e<0)&&f(),!i&&(n<=0||e%n!=0)&&f(),0===e)return;if(1===e)return void(s[0]=this.m_a[t]);const r=this.m_a.subarray(t,t+e);s.set(r)}writeRangeFromArray(t,e,s,i,n){if((t<0||e<0)&&f(),0===e)return;if(1===e)return void(this.m_a[t]=s[0]);let r=s;e<s.length&&(r=s.subarray(0,e)),this.m_a.set(r,t)}clone(){return new nt({ctor:Float64Array,copy:this})}restrictedClone(t){return new nt({ctor:Float64Array,copy:this,maxSize:t})}constructor(t,e){super("number"==typeof t?{ctor:Float64Array,size:t,defaultValue:e}:t)}}function rt(t,e,s,n,r){if(t.getPersistence()!==e.getPersistence())return!1;const h=t.getPersistence()<=1,o=t.size(),a=e.size();if(n>o||n>a)return!1;if(r)if(h){for(let m=s;m<n;m++)if(!i(t.read(m),e.read(m),r))return!1}else for(let i=s;i<n;i++){let s=t.read(i)-e.read(i);if(s<0&&(s=-s),s>r)return!1}else for(let i=s;i<n;i++){const s=t.read(i),n=e.read(i);if(s!==n){if(h&&Number.isNaN(s)&&Number.isNaN(n))continue;return!1}}return!0}function ht(t,e,s,i,n,r){if((e<0||s<0)&&f(),0===s)return;if(1===s)return void(t[e]=i[0]);let h=i;s<i.length&&(h=i.subarray(0,s)),t.set(h,e)}class ot{constructor(){this.m_minValue=-1,this.m_maxValue=-1,this.m_dy=Number.NaN,this.m_buckets=new st(0),this.m_bucketedIndices=new st(0)}static sortEx(t,e,s,i,n=32){if(s-e<=n)return void i.userSort(e,s,t);(new ot).sort(t,e,s,i,n)}sort(t,e,s,i,n=32){if(s-e<=n)return void i.userSort(e,s,t);let r=!0,h=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let m=e;m<s;m++){const e=i.getValue(t.read(m));e<h&&(h=e),e>o&&(o=e)}if(this.reset(s-e,h,o,s-e)){for(let r=e;r<s;r++){const s=t.read(r),n=i.getValue(s),h=this.getBucket(n);this.m_buckets.write(h,this.m_buckets.read(h)+1),this.m_bucketedIndices.write(r-e,s)}let n=this.m_buckets.read(0);this.m_buckets.write(0,0);for(let t=1,e=this.m_buckets.size();t<e;t++){const e=this.m_buckets.read(t);this.m_buckets.write(t,n),n+=e}for(let r=e;r<s;r++){const s=this.m_bucketedIndices.read(r-e),n=i.getValue(s),h=this.getBucket(n),o=this.m_buckets.read(h);t.write(o+e,s),this.m_buckets.write(h,o+1)}r=!1}if(r)return void i.userSort(e,s,t);let a=0;for(let m=0,_=this.m_buckets.size();m<_;m++){const s=a;a=this.m_buckets.read(m),a>s&&i.userSort(e+s,e+a,t)}this.m_buckets.size()>100&&(this.m_buckets.resize(0),this.m_bucketedIndices.resize(0))}reset(t,e,s,i){if(t<2||s===e)return!1;const n=Math.min(ot.c_maxBuckets,t);return this.m_buckets.resize(n),this.m_buckets.setRange(0,0,this.m_buckets.size()),this.m_minValue=e,this.m_maxValue=s,this.m_bucketedIndices.resize(i),this.m_dy=(s-e)/(n-1),!0}getBucket(t){return Math.trunc((t-this.m_minValue)/this.m_dy)}getBucketCount(){return this.m_buckets.size()}}ot.c_maxBuckets=65536;class at{capacity(){return this.capacity_}constructor(t){this.m_buffer=new Int32Array(0),this.m_firstFree=-1,this.m_last=0,this.size_=0,this.capacity_=0,this.stride=t}size(){return this.size_}deleteElement(t){t<this.m_last?(this.m_buffer[t*this.stride]=this.m_firstFree,this.m_firstFree=t):this.m_last--,this.size_--}getField(t,e){return this.m_buffer[t*this.stride+e]}setField(t,e,s){this.m_buffer[t*this.stride+e]=s}elementToIndex(t){return t}newElement(){let t=this.m_firstFree;if(-1===t){if(this.m_last===this.capacity_){let t=0!==this.capacity_?Math.trunc(3*(this.capacity_+1)/2):1;if(t>Number.MAX_SAFE_INTEGER&&(t=Number.MAX_SAFE_INTEGER),t===this.capacity_)throw new Error("index out of bounds");this.grow_(t)}t=this.m_last,this.m_last++}else this.m_firstFree=this.m_buffer[t*this.stride];this.size_++;for(let e=t*this.stride;e<t*this.stride+this.stride;e++)this.m_buffer[e]=-1;return t}newElementPset(t){let e=this.m_firstFree;if(-1===e){if(this.m_last===this.capacity_){let t=0!==this.capacity_?Math.trunc(3*(this.capacity_+1)/2):1;if(t>Number.MAX_SAFE_INTEGER&&(t=Number.MAX_SAFE_INTEGER),t===this.capacity_)throw new Error("index out of bounds");this.grow_(t)}e=this.m_last,this.m_last++}else this.m_firstFree=this.m_buffer[e*this.stride];this.size_++;const s=e*this.stride;for(let i=0;i<t.length;i++)this.m_buffer[s+i]=t[i];return e}deleteAll(t){this.m_firstFree=-1,this.m_last=0,this.size_=0,t&&(this.m_buffer=new Int32Array(0),this.capacity_=0)}setCapacity(t){t>this.capacity_&&this.grow_(t)}swap(t,e){const s=t*this.stride,i=e*this.stride;for(let n=0;n<this.stride;n++){const t=this.m_buffer[i+n];this.m_buffer[i+n]=this.m_buffer[s+n],this.m_buffer[s+n]=t}}swapField(t,e,s){const i=this.m_buffer[this.stride*e+s];this.m_buffer[this.stride*e+s]=this.m_buffer[this.stride*t+s],this.m_buffer[this.stride*t+s]=i}static impossibleIndex2(){return-2}static impossibleIndex3(){return-3}static isValidElement(t){return t>=0}grow_(t){null==this.m_buffer&&(this.m_buffer=new Int32Array(0));const e=this.stride*t,s=new Int32Array(e);s.set(this.m_buffer,0),this.m_buffer=s,this.capacity_=t}}function mt(t,e){return{element:t,box:e.clone()}}class _t{constructor(t,e,s){this.m_extent=new p,this.m_dataExtent=new p,this.m_childExtents=[new p,new p,new p,new p],this.m_elementNodes=new at(4),this.m_data=[],this.m_freeData=[],this.m_root=-1,this.m_height=8,void 0===s&&(s=!1),this.m_quadTreeNodes=new at(s?11:10),this.m_bStoreDuplicates=s,this.reset_(t,e)}reset(t,e){this.m_quadTreeNodes.deleteAll(!1),this.m_elementNodes.deleteAll(!1),this.m_data.length=0,this.m_freeData.length=0,this.reset_(t,e)}insert(t,e){if(-1===this.m_root&&this.createRoot_(),this.m_bStoreDuplicates){const s=this.insertDuplicates_(t,e,0,this.m_extent,this.m_root,!1,-1);return-1!==s&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),s}const s=this.insert_(t,e,0,this.m_extent,this.m_root,!1,-1);return-1!==s&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),s}insertEx(t,e,s){if(-1===this.m_root&&this.createRoot_(),this.m_bStoreDuplicates){const s=this.insertDuplicates_(t,e,0,this.m_extent,this.m_root,!1,-1);return-1!==s&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),s}let i;i=-1===s?this.m_root:this.getQuad_(s);const n=this.getHeight(i),r=this.getExtent(i),h=this.insert_(t,e,n,r,i,!1,-1);return-1!==h&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),h}removeElement(t){g(0)}getElement(t){return this.getElementValue_(this.getData_(t))}getElementAtIndex(t){return g(0),0}getElementExtent(t){const e=this.getData_(t);return this.getBoundingBoxValue_(e).clone()}getElementExtentAtIndex(t){return g(0),{}}getDataExtent(){return this.m_dataExtent.clone()}getQuadTreeExtent(){return g(0),{}}getHeight(t){return this.m_quadTreeNodes.getField(t,6)>>_t.m_heightBitShift}getMaxHeight(){return this.m_height}getExtent(t){const e=new p;if(e.setCoords({env2D:this.m_extent}),t===this.m_root)return e;const s=[];let i=t;do{s.push(this.getQuadrant_(i)),i=this.getParent_(i)}while(i!==this.m_root);const n=s.length;for(let r=0;r<n;r++){const t=s.at(-1);s.pop(),0===t?(e.xmin=.5*(e.xmin+e.xmax),e.ymin=.5*(e.ymin+e.ymax)):1===t?(e.xmax=.5*(e.xmin+e.xmax),e.ymin=.5*(e.ymin+e.ymax)):2===t?(e.xmax=.5*(e.xmin+e.xmax),e.ymax=.5*(e.ymin+e.ymax)):(e.xmin=.5*(e.xmin+e.xmax),e.ymax=.5*(e.ymin+e.ymax))}return e}getQuad(t){return this.getQuad_(t)}getElementCount(){return-1===this.m_root?0:this.getSubTreeElementCount_(this.m_root)}getSubTreeElementCount(t){return this.getSubTreeElementCount_(t)}getContainedSubTreeElementCount(t){return this.m_bStoreDuplicates?this.getContainedSubTreeElementCount_(t):this.getSubTreeElementCount_(t)}getIntersectionCount(t,e,s){if(-1===this.m_root)return 0;const i=new p;i.setCoords({env2D:t}),i.inflateCoords(e,e);const n=[],r=[];n.push(this.m_root),r.push(this.m_extent.clone());const h=d(p,4);let o=0;for(;n.length>0;){let t=!1;const e=n.at(-1),a=r.at(-1);if(n.pop(),r.pop(),i.containsEnvelope(a)){if(o+=this.getSubTreeElementCount(e),s>0&&o>=s)return s}else if(i.isIntersecting(a)){for(let t=this.getFirstElement_(e);-1!==t;t=this.getNextElement_(t)){const e=this.getData_(t);if(this.getBoundingBoxValue_(e).isIntersecting(i)&&(o++,s>0&&o>=s))return s}t=this.getHeight(e)+1<=this.m_height}if(t){_t.setChildExtents_(a,h);for(let t=0;t<4;t++){const s=this.getChild_(e,t);if(-1!==s&&this.getSubTreeElementCount_(s)>0){i.isIntersecting(h[t])&&(n.push(s),r.push(h[t].clone()))}}}}return o}hasData(t,e){return this.getIntersectionCount(t,e,1)>=1}getIterator(t,e){return new lt(this,t,e)}getIteratorForQT(){return new lt(this)}getSortedIterator(t,e){return new ut(this.getIterator(t,e))}getSortedIteratorForQT(){return new ut(this.getIteratorForQT())}visitLeavesNearest(t,e,s,i){g(0)}reset_(t,e){(e<0||e>127)&&f("invalid height"),this.m_height=e,this.m_extent.setCoords({env2D:t}),this.m_dataExtent.setEmpty(),this.m_root=-1}insert_(t,e,s,i,n,r,h){if(!i.containsEnvelope(e))return 0===s?-1:this.insert_(t,e,0,this.m_extent,this.m_root,r,h);if(!r)for(let _=n;-1!==_;_=this.getParent_(_))this.setSubTreeElementCount_(_,this.getSubTreeElementCount_(_)+1);const o=new p;o.setCoords({env2D:i});let a,m=n;for(a=s;a<this.m_height&&this.canPushDown_(m);a++){_t.setChildExtents_(o,this.m_childExtents);let t=!1;for(let s=0;s<4;s++)if(this.m_childExtents[s].containsEnvelope(e)){t=!0;let e=this.getChild_(m,s);-1===e&&(e=this.createChild_(m,s)),this.setSubTreeElementCount_(e,this.getSubTreeElementCount_(e)+1),m=e,o.setCoords({env2D:this.m_childExtents[s]});break}if(!t)break}return this.insertAtQuad_(t,e,a,o,m,r,n,h,-1)}insertDuplicates_(t,e,s,i,n,r,h){if(!r){if(!i.containsEnvelope(e))return-1;this.setSubTreeElementCount_(n,this.getSubTreeElementCount_(n)+1),this.setContainedSubTreeElementCount_(n,this.getContainedSubTreeElementCount_(n)+1)}const o=Math.max(e.width(),e.height());let a=-1;const m=[],_=[],l=[];m.push(n),_.push(i.clone()),l.push(s);const u=d(p,4);for(;m.length>0;){let s=!1;const i=m.at(-1),d=_.at(-1),c=l.at(-1);if(m.pop(),_.pop(),l.pop(),c+1<this.m_height&&this.canPushDown_(i)){o<=Math.max(d.width(),d.height())/2&&(s=!0)}if(s){_t.setChildExtents_(d,u);let t=!1;for(let s=0;s<4;s++)if(t=u[s].containsEnvelope(e),t){let t=this.getChild_(i,s);-1===t&&(t=this.createChild_(i,s)),m.push(t),_.push(u[s].clone()),l.push(c+1),this.setSubTreeElementCount_(t,this.getSubTreeElementCount_(t)+1),this.setContainedSubTreeElementCount_(t,this.getContainedSubTreeElementCount_(t)+1);break}if(!t)for(let s=0;s<4;s++){if(u[s].isIntersecting(e)){let t=this.getChild_(i,s);-1===t&&(t=this.createChild_(i,s)),m.push(t),_.push(u[s].clone()),l.push(c+1),this.setSubTreeElementCount_(t,this.getSubTreeElementCount_(t)+1)}}}else a=this.insertAtQuad_(t,e,c,d,i,r,n,h,a),r=!1}return 0}insertAtQuad_(t,e,s,i,n,r,h,o,a){this.getFirstElement_(n);const m=this.getLastElement_(n);let _=-1;if(r){if(n===h)return o;this.disconnectElementHandle_(o),_=o}else-1===a?(_=this.createElement_(),this.setDataValues_(this.getData_(_),t,e)):_=this.createElementFromDuplicate_(a);return this.setQuad_(_,n),-1!==m?(this.setPrevElement_(_,m),this.setNextElement_(m,_)):this.setFirstElement_(n,_),this.setLastElement_(n,_),this.setLocalElementCount_(n,this.getLocalElementCount_(n)+1),this.canFlush_(n)&&this.flush_(s,i,n),_}static setChildExtents_(t,e){const s=.5*(t.xmin+t.xmax),i=.5*(t.ymin+t.ymax);e[0].setCoords({xmin:s,ymin:i,xmax:t.xmax,ymax:t.ymax}),e[1].setCoords({xmin:t.xmin,ymin:i,xmax:s,ymax:t.ymax}),e[2].setCoords({xmin:t.xmin,ymin:t.ymin,xmax:s,ymax:i}),e[3].setCoords({xmin:s,ymin:t.ymin,xmax:t.xmax,ymax:i})}disconnectElementHandle_(t){const e=this.getQuad_(t),s=this.getFirstElement_(e),i=this.getLastElement_(e),n=this.getPrevElement_(t),r=this.getNextElement_(t);s===t?(-1!==r?this.setPrevElement_(r,-1):this.setLastElement_(e,-1),this.setFirstElement_(e,r)):i===t?(this.setNextElement_(n,-1),this.setLastElement_(e,n)):(this.setPrevElement_(r,n),this.setNextElement_(n,r)),this.setPrevElement_(t,-1),this.setNextElement_(t,-1),this.setLocalElementCount_(e,this.getLocalElementCount_(e)-1)}canFlush_(t){return this.getLocalElementCount_(t)===_t.m_flushingCount&&!this.hasChildren_(t)}flush_(t,e,s){let i;const n=new p;let r=this.getFirstElement_(s),h=-1,o=-1;do{o=this.getData_(r),i=this.getElementValue_(o),n.setCoords({env2D:this.getBoundingBoxValue_(o)}),h=this.getNextElement_(r),this.m_bStoreDuplicates?this.insertDuplicates_(i,n,t,e,s,!0,r):this.insert_(i,n,t,e,s,!0,r),r=h}while(-1!==r)}canPushDown_(t){return this.getLocalElementCount_(t)>=_t.m_flushingCount||this.hasChildren_(t)}hasChildren_(t){return-1!==this.getChild_(t,0)||-1!==this.getChild_(t,1)||-1!==this.getChild_(t,2)||-1!==this.getChild_(t,3)}createChild_(t,e){const s=this.m_quadTreeNodes.newElement();return this.setChild_(t,e,s),this.setSubTreeElementCount_(s,0),this.setLocalElementCount_(s,0),this.setParent_(s,t),this.setHeightAndQuadrant_(s,this.getHeight_(t)+1,e),this.m_bStoreDuplicates&&this.setContainedSubTreeElementCount_(s,0),s}createRoot_(){this.m_root=this.m_quadTreeNodes.newElement(),this.setSubTreeElementCount_(this.m_root,0),this.setLocalElementCount_(this.m_root,0),this.setHeightAndQuadrant_(this.m_root,0,0),this.m_bStoreDuplicates&&this.setContainedSubTreeElementCount_(this.m_root,0)}createElement_(){const t=this.m_elementNodes.newElement();let e;return this.m_freeData.length>0?(e=this.m_freeData.at(-1),this.m_freeData.pop()):(e=this.m_data.length,this.m_data.length=e+1),this.setData_(t,e),t}createElementFromDuplicate_(t){const e=this.m_elementNodes.newElement(),s=this.getData_(t);return this.setData_(e,s),e}freeElementAndBoxNode_(t){g(0)}getChild_(t,e){return this.m_quadTreeNodes.getField(t,e)}setChild_(t,e,s){this.m_quadTreeNodes.setField(t,e,s)}getFirstElement_(t){return this.m_quadTreeNodes.getField(t,4)}setFirstElement_(t,e){this.m_quadTreeNodes.setField(t,4,e)}getLastElement_(t){return this.m_quadTreeNodes.getField(t,5)}setLastElement_(t,e){this.m_quadTreeNodes.setField(t,5,e)}getQuadrant_(t){return this.m_quadTreeNodes.getField(t,6)&_t.m_quadrantMask}getHeight_(t){return this.m_quadTreeNodes.getField(t,6)>>_t.m_heightBitShift}setHeightAndQuadrant_(t,e,s){const i=e<<_t.m_heightBitShift|s;this.m_quadTreeNodes.setField(t,6,i)}getLocalElementCount_(t){return this.m_quadTreeNodes.getField(t,7)}setLocalElementCount_(t,e){this.m_quadTreeNodes.setField(t,7,e)}getSubTreeElementCount_(t){return this.m_quadTreeNodes.getField(t,8)}setSubTreeElementCount_(t,e){this.m_quadTreeNodes.setField(t,8,e)}getParent_(t){return this.m_quadTreeNodes.getField(t,9)}setParent_(t,e){this.m_quadTreeNodes.setField(t,9,e)}getContainedSubTreeElementCount_(t){return this.m_quadTreeNodes.getField(t,10)}setContainedSubTreeElementCount_(t,e){this.m_quadTreeNodes.setField(t,10,e)}getData_(t){return this.m_elementNodes.getField(t,0)}setData_(t,e){this.m_elementNodes.setField(t,0,e)}getPrevElement_(t){return this.m_elementNodes.getField(t,1)}getNextElement_(t){return this.m_elementNodes.getField(t,2)}setPrevElement_(t,e){this.m_elementNodes.setField(t,1,e)}setNextElement_(t,e){this.m_elementNodes.setField(t,2,e)}getQuad_(t){return this.m_elementNodes.getField(t,3)}setQuad_(t,e){this.m_elementNodes.setField(t,3,e)}getElementValue_(t){return this.m_data[t].element}getBoundingBoxValue_(t){return this.m_data[t].box}setDataValues_(t,e,s){this.m_data[t]=mt(e,s)}}_t.m_quadrantMask=3,_t.m_heightBitShift=2,_t.m_flushingCount=5;class lt{constructor(t,e,s){this.m_bLinear=!1,this.m_queryStart=new o,this.m_queryEnd=new o,this.m_queryBox=new p,this.m_tolerance=0,this.m_currentElementHandle=-1,this.m_nextElementHandle=-1,this.m_quadsStack=[],this.m_extentsStack=[],this.m_childExtents=[new p,new p,new p,new p],this.m_quadTree=t,e&&this.resetIterator(e,s)}resetIterator(t,e){if(void 0===e&&(e=0),t instanceof p)return this.m_quadsStack.length=0,this.m_extentsStack.length=0,this.m_currentElementHandle=-1,this.m_queryBox.setCoords({env2D:t}),this.m_queryBox.inflateCoords(e,e),this.m_tolerance=Number.NaN,void(-1!==this.m_quadTree.m_root&&this.m_queryBox.isIntersecting(this.m_quadTree.m_extent)?(this.m_quadsStack.push(this.m_quadTree.m_root),this.m_extentsStack.push(this.m_quadTree.m_extent.clone()),this.m_nextElementHandle=this.m_quadTree.getFirstElement_(this.m_quadTree.m_root),this.m_bLinear=!1):this.m_nextElementHandle=-1);if(this.m_quadsStack.length=0,this.m_extentsStack.length=0,this.m_currentElementHandle=-1,t.queryLooseEnvelope(this.m_queryBox),this.m_queryBox.inflateCoords(e,e),-1!==this.m_quadTree.m_root&&this.m_queryBox.isIntersecting(this.m_quadTree.m_extent)){const s=t.getGeometryType();if(this.m_bLinear=s===y.enumLine,this.m_bLinear){const s=t;this.m_queryStart.assign(s.getStartXY()),this.m_queryEnd.assign(s.getEndXY()),this.m_tolerance=e}else this.m_tolerance=Number.NaN;this.m_quadsStack.push(this.m_quadTree.m_root),this.m_extentsStack.push(this.m_quadTree.m_extent.clone()),this.m_nextElementHandle=this.m_quadTree.getFirstElement_(this.m_quadTree.m_root)}else this.m_nextElementHandle=-1}next(){if(0===this.m_quadsStack.length)return-1;this.m_currentElementHandle=this.m_nextElementHandle;const t=new o,e=new o,s=new p;let i=!1;for(;!i;){for(;-1!==this.m_currentElementHandle;){const n=this.m_quadTree.getData_(this.m_currentElementHandle);if(s.setCoords({env2D:this.m_quadTree.getBoundingBoxValue_(n)}),s.isIntersecting(this.m_queryBox)){if(!this.m_bLinear){i=!0;break}if(t.setCoordsPoint2D(this.m_queryStart),e.setCoordsPoint2D(this.m_queryEnd),s.inflateCoords(this.m_tolerance,this.m_tolerance),s.clipLine(t,e)>0){i=!0;break}}this.m_currentElementHandle=this.m_quadTree.getNextElement_(this.m_currentElementHandle)}if(-1===this.m_currentElementHandle){const s=this.m_quadsStack.at(-1),i=this.m_extentsStack.at(-1);_t.setChildExtents_(i,this.m_childExtents),this.m_quadsStack.pop(),this.m_extentsStack.pop();for(let n=0;n<4;n++){const i=this.m_quadTree.getChild_(s,n);if(-1!==i&&this.m_quadTree.getSubTreeElementCount(i)>0&&this.m_childExtents[n].isIntersecting(this.m_queryBox))if(this.m_bLinear){t.setCoordsPoint2D(this.m_queryStart),e.setCoordsPoint2D(this.m_queryEnd);const s=new p;s.setCoords({env2D:this.m_childExtents[n]}),s.inflateCoords(this.m_tolerance,this.m_tolerance),s.clipLine(t,e)>0&&(this.m_quadsStack.push(i),this.m_extentsStack.push(this.m_childExtents[n].clone()))}else this.m_quadsStack.push(i),this.m_extentsStack.push(this.m_childExtents[n].clone())}if(0===this.m_quadsStack.length)return-1;this.m_currentElementHandle=this.m_quadTree.getFirstElement_(this.m_quadsStack.at(-1))}}return this.m_nextElementHandle=this.m_quadTree.getNextElement_(this.m_currentElementHandle),this.m_currentElementHandle}clone(){return g(0),{}}}class ut{constructor(t){this.m_bucketSort=new ot,this.m_sortedHandles=new st(0),this.m_index=-1,this.m_quadTreeIteratorImpl=t}resetIterator(t,e){this.m_quadTreeIteratorImpl.resetIterator(t,e),this.m_sortedHandles.resize(0),this.m_index=-1}next(){if(-1===this.m_index){let t=-1;for(;-1!==(t=this.m_quadTreeIteratorImpl.next());)this.m_sortedHandles.add(t);const e=this,s={userSort(t,s,i){i.sort(t,s,((t,s)=>e.m_quadTreeIteratorImpl.m_quadTree.getElement(t)-e.m_quadTreeIteratorImpl.m_quadTree.getElement(s)))},getValue:t=>e.m_quadTreeIteratorImpl.m_quadTree.getElement(t)};this.m_bucketSort.sort(this.m_sortedHandles,0,this.m_sortedHandles.size(),s)}return this.m_index===this.m_sortedHandles.size()-1?-1:(this.m_index++,this.m_sortedHandles.read(this.m_index))}clone(){return g(0),{}}}class dt{constructor(t=!1){this.m_bNotifyOnActions=t}onDelete(t){}onSet(t){}onEndSearch(t){}onAddUniqueElementFailed(t){}onDeleteImpl(t,e){this.m_bNotifyOnActions&&this.onDelete(t.getElement(e))}onSetImpl(t,e){this.m_bNotifyOnActions&&this.onSet(t.getElement(e))}onAddUniqueElementFailedImpl(t){this.m_bNotifyOnActions&&this.onAddUniqueElementFailed(t)}onEndSearchImpl(t){this.m_bNotifyOnActions&&this.onEndSearch(t)}}class ct{static st_nullNode(){return-1}constructor(){this.m_defaultTreap=-1,this.m_random=124234251,this.m_comparator=null,this.m_treapData=new at(7),this.m_treapCount=0,this.m_maxDepthEver=0,this.m_bBalancing=!0}setComparator(t){this.m_comparator=t}getComparator(){return this.m_comparator}disableBalancing(){this.m_bBalancing=!1}enableBalancing(){this.m_bBalancing||(g(this.m_treapCount<=1),this.rebalance(-1),this.m_bBalancing=!0)}isAutoBalancing(){return this.m_bBalancing}rebalance(t){if(this.m_bBalancing)return;if(-1===t&&(t=this.m_defaultTreap),0===this.size(t))return;const e=[];for(let s=this.getFirst(t);-1!==s;s=this.getNext(s))e.push(s),this.setParent_(s,-1),this.setRight_(s,-1),this.setLeft_(s,-1);this.setRoot_(-1,t),this.setFirst_(-1,t),this.setLast_(-1,t),this.setSize_(0,t),this.m_bBalancing=!0;for(const s of e)this.addBiggestElement_(s,t);this.m_bBalancing=!1}setCapacity(t){this.m_treapData.setCapacity(t)}createTreap(t){const e=this.m_treapData.newElement();return this.setSize_(0,e),this.setTreapData_(t,e),this.m_treapCount++,e}deleteTreap(t){this.m_treapData.deleteElement(t),this.m_treapCount--}addElement(t,e=-1){return-1===e&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),e=this.m_defaultTreap),this.addElement_(t,0,e)}addUniqueElement(t,e=-1){return-1===e&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),e=this.m_defaultTreap),this.addElement_(t,1,e)}addBiggestElement(t,e=-1){-1===e&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),e=this.m_defaultTreap);const s=this.newNode_(t);return this.addBiggestElement_(s,e),s}addElementAtPosition(t,e,s,i,n,r=-1){if(-1===r&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),r=this.m_defaultTreap),this.getRoot_(r)===ct.st_nullNode()){const t=this.newNode_(s);return this.setRoot_(t,r),this.addToList_(-1,t,r),t}let h,o,a,m,_;if(n?(h=e!==ct.st_nullNode()?this.m_comparator.compare(this,s,e):-1,o=t!==ct.st_nullNode()?this.m_comparator.compare(this,s,t):1):(h=-1,o=1),i&&(0===h||0===o)){this.m_comparator.onAddUniqueElementFailedImpl(s);const i=0===h?e:t;return this.setDuplicateElement_(i,r),-1}_=e!==ct.st_nullNode()&&t!==ct.st_nullNode()?this.m_random>l(this.m_random)>>1:e!==ct.st_nullNode(),_?(m=h,a=e):(m=o,a=t);let u=-1,d=-1,c=!0;for(;;){if(m<0){const t=this.getLeft(a);if(t===ct.st_nullNode()){d=a,u=this.newNode_(s),this.setLeft_(a,u),this.setParent_(u,a);break}a=t}else{const t=this.getRight(a);if(t===ct.st_nullNode()){d=this.getNext(a),u=this.newNode_(s),this.setRight_(a,u),this.setParent_(u,a);break}a=t}c&&(m*=-1,c=!1)}return this.bubbleUp_(u),this.getParent(u)===ct.st_nullNode()&&this.setRoot_(u,r),this.addToList_(d,u,r),u}replaceElementAtPosition(t,e,s,i,n=-1){if(i){const i=this.getNext(t);let r=-1;i!==ct.st_nullNode()&&(r=this.m_comparator.compare(this,e,i));const h=this.getPrev(t);let o=-1;if(h!==ct.st_nullNode()&&(o=this.m_comparator.compare(this,e,h)),s&&(0===r||0===o)){this.m_comparator.onAddUniqueElementFailedImpl(e);const t=0===r?i:h;return n===ct.st_nullNode()&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),n=this.m_defaultTreap),this.setDuplicateElement_(t,n),-1}}return this.setElement_(t,e),t}getDuplicateElement(t=-1){return-1===t?this.getDuplicateElement_(this.m_defaultTreap):this.getDuplicateElement_(t)}deleteNode(t,e=-1){this.m_comparator&&this.m_comparator.onDeleteImpl(this,t),-1===e&&(e=this.m_defaultTreap),this.m_bBalancing?this.deleteNode_(t,e):this.unbalancedDelete_(t,e)}search(t,e=-1){let s=this.getRoot(e);for(;s!==ct.st_nullNode();){const e=this.m_comparator.compare(this,t,s);if(!e)return s;s=e<0?this.getLeft(s):this.getRight(s)}return this.m_comparator.onEndSearchImpl(t),ct.st_nullNode()}searchLowerBound(t,e=-1){let s=this.getRoot(e),i=-1;for(;s!==ct.st_nullNode();){const e=t.compare(this,s);if(!e)return s;e<0?s=this.getLeft(s):(i=s,s=this.getRight(s))}return i}searchUpperBound(t,e=-1){let s=this.getRoot(e),i=-1;for(;s!==ct.st_nullNode();){const e=t.compare(this,s);if(!e)return s;e<0?(i=s,s=this.getLeft(s)):s=this.getRight(s)}return i}getElement(t){return this.m_treapData.getField(t,3)}getLeft(t){return this.m_treapData.getField(t,0)}getRight(t){return this.m_treapData.getField(t,1)}getParent(t){return this.m_treapData.getField(t,2)}getNext(t){return this.m_treapData.getField(t,6)}getPrev(t){return this.m_treapData.getField(t,5)}getFirst(t=-1){return-1===t?this.getFirst_(this.m_defaultTreap):this.getFirst_(t)}getLast(t=-1){return-1===t?this.getLast_(this.m_defaultTreap):this.getLast_(t)}getTreapData(t=-1){return-1===t?this.getTreapData_(this.m_defaultTreap):this.getTreapData_(t)}setElement(t,e){null!==this.m_comparator&&this.m_comparator.onSetImpl(this,t),this.setElement_(t,e)}getRoot(t=-1){return-1===t?this.getRoot_(this.m_defaultTreap):this.getRoot_(t)}clear(){this.m_treapData.deleteAll(!1),this.m_defaultTreap=ct.st_nullNode(),this.m_treapCount=0,this.m_maxDepthEver=0}addToList_(t,e,s){let i;-1!==t?(i=this.getPrev(t),this.setPrev_(t,e)):i=this.getLast_(s),this.setPrev_(e,i),-1!==i&&this.setNext_(i,e),this.setNext_(e,t),t===this.getFirst_(s)&&this.setFirst_(e,s),-1===t&&this.setLast_(e,s),this.setSize_(this.getSize_(s)+1,s)}size(t=-1){return-1===t?this.getSize_(this.m_defaultTreap):this.getSize_(t)}getMaxDepth(t=-1){return this.getMaxDepthHelper_(this.getRoot(t))}getMaxDepthEver(){return this.m_maxDepthEver}static st_isValidNode(t){return at.isValidElement(t)}dbgCheck_(t){}getPriority_(t){return this.m_treapData.getField(t,4)}bubbleDown_(t){let e=this.getLeft(t),s=this.getRight(t);const i=this.getPriority_(t);for(;e!==ct.st_nullNode()||s!==ct.st_nullNode();){const n=e!==ct.st_nullNode()?this.getPriority_(e):u(),r=s!==ct.st_nullNode()?this.getPriority_(s):u();if(i<=Math.min(n,r))return;n<=r?this.rotateRight_(e):this.rotateLeft_(t),e=this.getLeft(t),s=this.getRight(t)}}bubbleUp_(t){if(!this.m_bBalancing)return;const e=this.getPriority_(t);let s=this.getParent(t);for(;s!==ct.st_nullNode()&&this.getPriority_(s)>e;)this.getLeft(s)===t?this.rotateRight_(t):this.rotateLeft_(s),s=this.getParent(t)}rotateLeft_(t){const e=t,s=this.getRight(t);let i;this.setParent_(s,this.getParent(e)),this.setParent_(e,s),i=this.getLeft(s),this.setRight_(e,i),i!==ct.st_nullNode()&&this.setParent_(i,e),this.setLeft_(s,e),i=this.getParent(s),i!==ct.st_nullNode()&&(this.getLeft(i)===e?this.setLeft_(i,s):this.setRight_(i,s))}rotateRight_(t){const e=this.getParent(t),s=t;let i;this.setParent_(s,this.getParent(e)),this.setParent_(e,s),i=this.getRight(s),this.setLeft_(e,i),i!==ct.st_nullNode()&&this.setParent_(i,e),this.setRight_(s,e),i=this.getParent(s),i!==ct.st_nullNode()&&(this.getLeft(i)===e?this.setLeft_(i,s):this.setRight_(i,s))}setParent_(t,e){this.m_treapData.setField(t,2,e)}setLeft_(t,e){this.m_treapData.setField(t,0,e)}setRight_(t,e){this.m_treapData.setField(t,1,e)}setPriority_(t,e){this.m_treapData.setField(t,4,e)}setPrev_(t,e){this.m_treapData.setField(t,5,e)}setNext_(t,e){this.m_treapData.setField(t,6,e)}setRoot_(t,e){this.m_treapData.setField(e,0,t)}setFirst_(t,e){this.m_treapData.setField(e,1,t)}setLast_(t,e){this.m_treapData.setField(e,2,t)}setDuplicateElement_(t,e){this.m_treapData.setField(e,3,t)}setSize_(t,e){this.m_treapData.setField(e,4,t)}setTreapData_(t,e){this.m_treapData.setField(e,5,t)}getRoot_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,0)}getFirst_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,1)}getLast_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,2)}getDuplicateElement_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,3)}getSize_(t){return-1===t?0:this.m_treapData.getField(t,4)}getTreapData_(t){return this.m_treapData.getField(t,5)}newNode_(t){const e=this.m_treapData.newElement();return this.setPriority_(e,this.generatePriority_()),this.setElement_(e,t),e}freeNode_(t,e){t!==ct.st_nullNode()&&this.m_treapData.deleteElement(t)}generatePriority_(){return this.m_random=l(this.m_random),this.m_random&u()>>1}maxPriority(){return g(0),0}getMaxDepthHelper_(t){return t===ct.st_nullNode()?0:1+Math.max(this.getMaxDepthHelper_(this.getLeft(t)),this.getMaxDepthHelper_(this.getRight(t)))}addElement_(t,e,s){if(this.getRoot(s)===ct.st_nullNode()){const e=this.newNode_(t);return this.setRoot_(e,s),this.addToList_(-1,e,s),this.m_maxDepthEver=Math.max(this.m_maxDepthEver,1),e}let i=this.getRoot_(s),n=-1,r=-1,h=1;for(;;){const o=-1===e?1:this.m_comparator.compare(this,t,i);if(o<0){const e=this.getLeft(i);if(e===ct.st_nullNode()){r=i,n=this.newNode_(t),this.setLeft_(i,n),this.setParent_(n,i);break}i=e}else{if(1===e&&0===o)return this.m_comparator.onAddUniqueElementFailedImpl(t),this.setDuplicateElement_(i,s),-1;const h=this.getRight(i);if(h===ct.st_nullNode()){r=this.getNext(i),n=this.newNode_(t),this.setRight_(i,n),this.setParent_(n,i);break}i=h}h++}return this.bubbleUp_(n),this.getParent(n)===ct.st_nullNode()&&this.setRoot_(n,s),this.addToList_(r,n,s),this.m_maxDepthEver=Math.max(h,this.m_maxDepthEver),n}removeFromList_(t,e){const s=this.getPrev(t),i=this.getNext(t);-1!==s?this.setNext_(s,i):this.setFirst_(i,e),-1!==i?this.setPrev_(i,s):this.setLast_(s,e),this.setSize_(this.getSize_(e)-1,e)}unbalancedDelete_(t,e){this.removeFromList_(t,e);let s=this.getLeft(t),i=this.getRight(t),n=this.getParent(t),r=t;if(-1!==s&&-1!==i){let h;this.m_random=l(this.m_random),h=this.m_random>u()>>1?this.getNext(t):this.getPrev(t);const o=this.getParent(h)===t;this.m_treapData.swapField(t,h,0),this.m_treapData.swapField(t,h,1),this.m_treapData.swapField(t,h,2),-1!==n?this.getLeft(n)===t?this.setLeft_(n,h):this.setRight_(n,h):this.setRoot_(h,e),o?(s===h?(this.setLeft_(h,t),this.setParent_(i,h)):i===h&&(this.setRight_(h,t),this.setParent_(s,h)),this.setParent_(t,h),n=h):(this.setParent_(s,h),this.setParent_(i,h),n=this.getParent(t),r=h),s=this.getLeft(t),i=this.getRight(t),-1!==s&&this.setParent_(s,t),-1!==i&&this.setParent_(i,t)}const h=-1!==s?s:i;-1===n?this.setRoot_(h,e):this.getLeft(n)===r?this.setLeft_(n,h):this.setRight_(n,h),-1!==h&&this.setParent_(h,n),this.freeNode_(t,e)}deleteNode_(t,e){this.setPriority_(t,u());let s=ct.st_nullNode(),i=ct.st_nullNode();const n=this.getRoot_(e),r=n===t;if(r&&(s=this.getLeft(n),i=this.getRight(n),s===ct.st_nullNode()&&i===ct.st_nullNode()))return this.removeFromList_(n,e),this.freeNode_(n,e),void this.setRoot_(ct.st_nullNode(),e);this.bubbleDown_(t);const h=this.getParent(t);h!==ct.st_nullNode()&&(this.getLeft(h)===t?this.setLeft_(h,ct.st_nullNode()):this.setRight_(h,ct.st_nullNode())),this.removeFromList_(t,e),this.freeNode_(t,e),r&&this.setRoot_(s===ct.st_nullNode()||this.getParent(s)!==ct.st_nullNode()?i:s,e)}setElement_(t,e){this.m_treapData.setField(t,3,e)}addBiggestElement_(t,e){if(this.getRoot_(e)===ct.st_nullNode())return this.setRoot_(t,e),void this.addToList_(-1,t,e);const s=this.getLast_(e);this.setRight_(s,t),this.setParent_(t,s),this.bubbleUp_(t),this.getParent(t)===ct.st_nullNode()&&this.setRoot_(t,e),this.addToList_(-1,t,e)}}class pt{constructor(t){this.m_lists=new at(6),this.m_listOfLists=pt.st_nullNode(),void 0===t?(this.m_listNodes=new at(3),this.m_bStoreListIndexWithNode=!1):(this.m_listNodes=new at(t?4:3),this.m_bStoreListIndexWithNode=t)}freeNode_(t){this.m_listNodes.deleteElement(t)}newNode_(){return this.m_listNodes.newElement()}freeList_(t){g(0)}newList_(){return this.m_lists.newElement()}setPrev_(t,e){this.m_listNodes.setField(t,1,e)}setNext_(t,e){this.m_listNodes.setField(t,2,e)}setData_(t,e){g(0)}setList_(t,e){return this.m_listNodes.setField(t,3,e)}setListSize_(t,e){this.m_lists.setField(t,4,e)}setNextList_(t,e){g(0)}setPrevList_(t,e){this.m_lists.setField(t,2,e)}createList(t){const e=this.newList_();return this.m_lists.setField(e,3,this.m_listOfLists),this.m_lists.setField(e,4,0),this.m_lists.setField(e,5,t),this.m_listOfLists!==pt.st_nullNode()&&this.setPrevList_(this.m_listOfLists,e),this.m_listOfLists=e,e}deleteList(t){this.clear(t);const e=this.m_lists.getField(t,2),s=this.m_lists.getField(t,3);return e!==pt.st_nullNode()?this.setNextList_(e,s):this.m_listOfLists=s,s!==pt.st_nullNode()&&this.setPrevList_(s,e),this.freeList_(t),s}reserveLists(t){g(0)}getListData(t){return this.m_lists.getField(t,5)}getList(t){return g(0),0}setListData(t,e){this.m_lists.setField(t,5,e)}addElement(t,e){return this.insertElement(t,-1,e)}insertElement(t,e,s){const i=this.newNode_();let n=-1;e!==pt.st_nullNode()&&(n=this.getPrev(e),this.setPrev_(e,i)),this.setNext_(i,e),n!==pt.st_nullNode()&&this.setNext_(n,i);if(e===this.m_lists.getField(t,0)&&this.m_lists.setField(t,0,i),e===pt.st_nullNode()){const e=this.m_lists.getField(t,1);this.setPrev_(i,e),-1!==e&&this.setNext_(e,i),this.m_lists.setField(t,1,i)}return this.setData(i,s),this.setListSize_(t,this.getListSize(t)+1),this.m_bStoreListIndexWithNode&&this.setList_(i,t),i}deleteElement(t,e){const s=this.getPrev(e),i=this.getNext(e);return s!==pt.st_nullNode()?this.setNext_(s,i):this.m_lists.setField(t,0,i),i!==pt.st_nullNode()?this.setPrev_(i,s):this.m_lists.setField(t,1,s),this.freeNode_(e),this.setListSize_(t,this.getListSize(t)-1),i}reserveNodes(t){this.m_listNodes.setCapacity(t)}getData(t){return this.m_listNodes.getField(t,0)}getElement(t){return this.getData(t)}setData(t,e){this.m_listNodes.setField(t,0,e)}getNext(t){return this.m_listNodes.getField(t,2)}getPrev(t){return this.m_listNodes.getField(t,1)}getFirst(t){return this.m_lists.getField(t,0)}getLast(t){return this.m_lists.getField(t,1)}static st_nullNode(){return-1}clear(t){if(void 0!==t){let e=this.getLast(t);for(;e!==pt.st_nullNode();){const t=e;e=this.getPrev(t),this.freeNode_(t)}return this.m_lists.setField(t,0,-1),this.m_lists.setField(t,1,-1),void this.setListSize_(t,0)}for(let e=this.getFirstList();-1!==e;)e=this.deleteList(e)}isEmpty(t){return g(0),!1}getNodeCount(){return this.m_listNodes.size()}getListCount(){return this.m_lists.size()}getListSize(t){return this.m_lists.getField(t,4)}getFirstList(){return this.m_listOfLists}getNextList(t){return this.m_lists.getField(t,3)}}class gt extends dt{constructor(t){super(),this.m_intervalTree=t}compare(t,e,s){const i=t.getElement(s),n=this.m_intervalTree.getValue_(e),r=this.m_intervalTree.getValue_(i);return n<r?-1:n===r?ft.isLeft_(e)&&ft.isRight_(i)?-1:ft.isLeft_(i)&&ft.isRight_(e)?1:0:1}}class ft{constructor(t){this.m_bEnvelopesRef=!1,this.m_intervals=[],this.m_envelopesRef=null,this.m_intervalNodes=new at(3),this.m_intervalHandles=[],this.m_endIndicesUnique=[],this.m_cCount=-1,this.m_root=-1,this.m_bSortIntervals=!1,this.m_bConstructing=!1,this.m_bConstructionEnded=!1,this.m_bOfflineDynamic=t,this.m_tertiaryNodes=new at(this.m_bOfflineDynamic?5:4),this.m_secondaryTreaps=new ct,this.m_secondaryTreaps.setComparator(new gt(this)),this.m_secondaryLists=new pt}addEnvelopesRef(t){this.reset_(!0,!0),this.m_bEnvelopesRef=!0,this.m_envelopesRef=t,this.m_bConstructing=!1,this.m_bConstructionEnded=!0,this.m_bOfflineDynamic||(this.insertIntervalsStatic_(),this.m_cCount=this.m_envelopesRef.length)}startConstruction(){this.reset_(!0,!1)}addInterval(t){this.m_bConstructing||N(""),this.m_intervals.push(t.clone())}addIntervalCoords(t,e){g(0)}endConstruction(){this.m_bConstructing||N(""),this.m_bConstructing=!1,this.m_bConstructionEnded=!0,this.m_bOfflineDynamic||(this.insertIntervalsStatic_(),this.m_cCount=this.m_intervals.length)}insert(t){if(this.m_bOfflineDynamic&&this.m_bConstructionEnded||N(""),-1===this.m_root){const t=this.m_bEnvelopesRef?this.m_envelopesRef.length:this.m_intervals.length;if(this.m_bSortIntervals){const e=new st(0);this.querySortedEndPointIndices_(e),this.m_endIndicesUnique.length=0,this.querySortedDuplicatesRemoved_(e),this.m_intervalHandles.length=t,this.m_intervalHandles.fill(-1),this.m_bSortIntervals=!1}else this.m_intervalHandles.fill(-1,0,t);this.m_root=this.createRoot_()}const e=this.insertIntervalEnd_(t<<1,this.m_root),s=this.getSecondaryFromInterval_(e),i=this.m_secondaryTreaps.addElement(1+(t<<1),s);this.setRightEnd_(e,i),this.m_intervalHandles[t]=e,this.m_cCount++}remove(t){this.m_bOfflineDynamic&&this.m_bConstructionEnded||N("");const e=this.m_intervalHandles[t];let s;-1===e&&f("the interval does not exist in the interval tree"),this.m_intervalHandles[t]=-1,this.m_cCount--;let i=this.getSecondaryFromInterval_(e),n=-1;n=this.m_secondaryTreaps.getTreapData(i),this.m_secondaryTreaps.deleteNode(this.getLeftEnd_(e),i),this.m_secondaryTreaps.deleteNode(this.getRightEnd_(e),i),s=this.m_secondaryTreaps.size(i),0===s&&(this.m_secondaryTreaps.deleteTreap(i),this.setSecondaryToTertiary_(n,-1)),this.m_intervalNodes.deleteElement(e);let r=this.getPptr_(n),h=this.getLptr_(n),o=this.getRptr_(n);for(;!(s>0||n===this.m_root||-1!==h&&-1!==o);)n===this.getLptr_(r)?-1!==h?(this.setLptr_(r,h),this.setPptr_(h,r),this.setLptr_(n,-1),this.setPptr_(n,-1)):-1!==o?(this.setLptr_(r,o),this.setPptr_(o,r),this.setRptr_(n,-1),this.setPptr_(n,-1)):(this.setLptr_(r,-1),this.setPptr_(n,-1)):-1!==h?(this.setRptr_(r,h),this.setPptr_(h,r),this.setLptr_(n,-1),this.setPptr_(n,-1)):-1!==o?(this.setRptr_(r,o),this.setPptr_(o,r),this.setRptr_(n,-1),this.setPptr_(n,-1)):(this.setRptr_(r,-1),this.setPptr_(n,-1)),this.m_tertiaryNodes.deleteElement(n),n=r,i=this.getSecondaryFromTertiary_(n),s=-1!==i?this.m_secondaryTreaps.size(i):0,h=this.getLptr_(n),o=this.getRptr_(n),r=this.getPptr_(n)}size(){return this.m_cCount}getIteratorQuery(t,e){return t instanceof r?new vt(this,t,e):(g(0),{})}getIterator(){return new vt(this)}querySortedEndPointIndices_(t){const e=this.m_bEnvelopesRef?this.m_envelopesRef.length:this.m_intervals.length;for(let s=0;s<2*e;s++)t.add(s);this.sortEndIndices_(t,0,2*e)}querySortedDuplicatesRemoved_(t){let e=Number.NaN;for(let s=0;s<t.size();s++){const i=t.read(s),n=this.getValue_(i);n!==e&&(this.m_endIndicesUnique.push(i),e=n)}}insertIntervalsStatic_(){const t=this.m_bEnvelopesRef?this.m_envelopesRef.length:this.m_intervals.length,s=new st(0);this.querySortedEndPointIndices_(s),this.m_endIndicesUnique.length=0,this.querySortedDuplicatesRemoved_(s),this.m_intervalNodes.setCapacity(t),this.m_secondaryLists.reserveNodes(2*t);const i=e(t,-1);this.m_root=this.createRoot_();for(let e=0;e<s.size();e++){const t=s.read(e);let n=i[t>>1];if(-1!==n){const e=this.getSecondaryFromInterval_(n);this.setRightEnd_(n,this.m_secondaryLists.addElement(e,t))}else n=this.insertIntervalEnd_(t,this.m_root),i[t>>1]=n}}createRoot_(){const t=this.calculateDiscriminantIndex1_(0,this.m_endIndicesUnique.length-1);return this.createTertiaryNode_(t)}insertIntervalEnd_(t,e){let s=-1,i=e,n=-1,r=-1,h=0,o=this.m_endIndicesUnique.length-1,a=0;const m=t>>1;let _=Number.NaN,l=Number.NaN,u=!0;const d=this.getMin_(m),c=this.getMax_(m);let p=-1;for(;u;){a=h+(o-h>>1),p=this.calculateDiscriminantIndex1_(h,o);const e=this.getDiscriminantFromIndex1_(p);if(c<e){if(-1!==i)if(p===this.getDiscriminantIndex1_(i))s=i,_=e,i=this.getLptr_(i),l=-1!==i?this.getDiscriminant_(i):Number.NaN;else if(l>e){const t=this.createTertiaryNode_(p);e<_?this.setLptr_(s,t):this.setRptr_(s,t),this.setRptr_(t,i),this.m_bOfflineDynamic&&(this.setPptr_(t,s),this.setPptr_(i,t)),s=t,_=e,i=-1,l=Number.NaN}o=a;continue}if(d>e){if(-1!==i)if(p===this.getDiscriminantIndex1_(i))s=i,_=e,i=this.getRptr_(i),l=-1!==i?this.getDiscriminant_(i):Number.NaN;else if(l<e){const t=this.createTertiaryNode_(p);e<_?this.setLptr_(s,t):this.setRptr_(s,t),this.setLptr_(t,i),this.m_bOfflineDynamic&&(this.setPptr_(t,s),this.setPptr_(i,t)),s=t,_=e,i=-1,l=Number.NaN}h=a+1;continue}let m=-1;m=-1===i||p!==this.getDiscriminantIndex1_(i)?this.createTertiaryNode_(p):i,n=this.getSecondaryFromTertiary_(m),-1===n&&(n=this.createSecondary_(m),this.setSecondaryToTertiary_(m,n));const g=this.addEndIndex_(n,t);r=this.createIntervalNode_(),this.setSecondaryToInterval_(r,n),this.setLeftEnd_(r,g),-1!==i&&p===this.getDiscriminantIndex1_(i)||(e<_?this.setLptr_(s,m):this.setRptr_(s,m),this.m_bOfflineDynamic&&this.setPptr_(m,s),-1!==i&&(l<e?this.setLptr_(m,i):this.setRptr_(m,i),this.m_bOfflineDynamic&&this.setPptr_(i,m))),u=!1;break}return r}createTertiaryNode_(t){const e=this.m_tertiaryNodes.newElement();return this.setDiscriminantIndex1_(e,t),e}createSecondary_(t){return this.m_bOfflineDynamic?this.m_secondaryTreaps.createTreap(t):this.m_secondaryLists.createList(t)}createIntervalNode_(){return this.m_intervalNodes.newElement()}reset(){this.m_bOfflineDynamic&&this.m_bConstructionEnded||N(""),this.reset_(!1,this.m_bEnvelopesRef)}reset_(t,e){t?(this.m_bEnvelopesRef=!1,this.m_envelopesRef=null,this.m_bSortIntervals=!0,this.m_bConstructing=!0,this.m_bConstructionEnded=!1,this.m_endIndicesUnique.length=0,e?(this.m_intervals.length=0,this.m_bEnvelopesRef=!0):this.m_intervals.length=0):this.m_bSortIntervals=!1,this.m_bOfflineDynamic?this.m_secondaryTreaps.clear():this.m_secondaryLists.clear(),this.m_intervalNodes.deleteAll(!1),this.m_tertiaryNodes.deleteAll(!1),this.m_root=-1,this.m_cCount=0}getDiscriminant_(t){const e=this.getDiscriminantIndex1_(t);return this.getDiscriminantFromIndex1_(e)}getDiscriminantFromIndex1_(t){if(-1===t)return Number.NaN;if(t>0){const e=t-2,s=this.m_endIndicesUnique[e],i=this.m_endIndicesUnique[e+1];return.5*(this.getValue_(s)+this.getValue_(i))}const e=-t-2,s=this.m_endIndicesUnique[e];return this.getValue_(s)}calculateDiscriminantIndex1_(t,e){let s;if(t<e){s=t+(e-t>>1)+2}else s=-(t+2);return s}setDiscriminantIndex1_(t,e){this.m_tertiaryNodes.setField(t,0,e)}setSecondaryToTertiary_(t,e){this.m_tertiaryNodes.setField(t,1,e)}setLptr_(t,e){this.m_tertiaryNodes.setField(t,2,e)}setRptr_(t,e){this.m_tertiaryNodes.setField(t,3,e)}setPptr_(t,e){this.m_tertiaryNodes.setField(t,4,e)}setSecondaryToInterval_(t,e){this.m_intervalNodes.setField(t,0,e)}addEndIndex_(t,e){let s=-1;return s=this.m_bOfflineDynamic?this.m_secondaryTreaps.addElement(e,t):this.m_secondaryLists.addElement(t,e),s}setLeftEnd_(t,e){this.m_intervalNodes.setField(t,1,e)}setRightEnd_(t,e){this.m_intervalNodes.setField(t,2,e)}getFirst_(t){return this.m_bOfflineDynamic?this.m_secondaryTreaps.getFirst(t):this.m_secondaryLists.getFirst(t)}getLast_(t){return this.m_bOfflineDynamic?this.m_secondaryTreaps.getLast(t):this.m_secondaryLists.getLast(t)}static isLeft_(t){return!(1&t)}static isRight_(t){return!(1&~t)}getDiscriminantIndex1_(t){return this.m_tertiaryNodes.getField(t,0)}getSecondaryFromTertiary_(t){return this.m_tertiaryNodes.getField(t,1)}getLptr_(t){return this.m_tertiaryNodes.getField(t,2)}getRptr_(t){return this.m_tertiaryNodes.getField(t,3)}getPptr_(t){return this.m_tertiaryNodes.getField(t,4)}getSecondaryFromInterval_(t){return this.m_intervalNodes.getField(t,0)}getLeftEnd_(t){return this.m_intervalNodes.getField(t,1)}getRightEnd_(t){return this.m_intervalNodes.getField(t,2)}getMin_(t){return this.m_bEnvelopesRef?this.m_envelopesRef[t].xmin:this.m_intervals[t].vmin}getMax_(t){return this.m_bEnvelopesRef?this.m_envelopesRef[t].xmax:this.m_intervals[t].vmax}sortEndIndices_(t,e,s){const i=this,n={userSort(t,e,s){i.sortEndIndicesHelper_(s,t,e)},getValue:t=>i.getValue_(t)};(new ot).sort(t,e,s,n)}sortEndIndicesHelper_(t,e,s){t.sort(e,s,((t,e)=>{const s=this.getValue_(t),i=this.getValue_(e);return s<i||s===i&&ft.isLeft_(t)&&ft.isRight_(e)?-1:1}))}getValue_(t){if(!this.m_bEnvelopesRef){const e=this.m_intervals[t>>1];return ft.isLeft_(t)?e.vmin:e.vmax}const e=this.m_envelopesRef[t>>1];return ft.isLeft_(t)?e.xmin:e.xmax}}class vt{constructor(t,e,s){this.m_query=r.constructEmpty(),this.m_tertiaryHandle=-1,this.m_nextTertiaryHandle=-1,this.m_forkedHandle=-1,this.m_currentEndHandle=-1,this.m_nextEndHandle=-1,this.m_tertiaryStack=[],this.m_functionIndex=0,this.m_intervalTree=t,this.m_functionStack=new Array(2),this.m_functionStack[0]=this.nullFunc_,this.m_functionStack[1]=this.nullFunc_,void 0!==e&&this.resetIterator(e,s)}nullFunc_(){return b("should not be called"),!1}resetIterator(t,e){if("number"==typeof t){const s=new r;s.setCoords(t,t),this.resetIterator(s,e)}else void 0===e&&(e=0),this.m_query.vmin=t.vmin-e,this.m_query.vmax=t.vmax+e,this.m_tertiaryStack.length=0,this.m_functionIndex=0,this.m_functionStack[0]=this.initialize_}next(){if(this.m_intervalTree.m_bConstructionEnded||N(""),this.m_functionIndex<0)return-1;for(;this.m_fi=this.m_functionStack[this.m_functionIndex],this.m_fi(););return-1!==this.m_currentEndHandle?this.getCurrentEndIndex_()>>1:-1}initialize_(){return this.m_tertiaryHandle=-1,this.m_nextTertiaryHandle=-1,this.m_forkedHandle=-1,this.m_currentEndHandle=-1,this.m_intervalTree.m_tertiaryNodes.size()>0?(this.m_functionStack[0]=this.pIn_,this.m_nextTertiaryHandle=this.m_intervalTree.m_root,!0):(this.m_functionIndex=-1,!1)}pIn_(){if(this.m_tertiaryHandle=this.m_nextTertiaryHandle,-1===this.m_tertiaryHandle)return this.m_functionIndex=-1,this.m_currentEndHandle=-1,!1;const t=this.m_intervalTree.getDiscriminant_(this.m_tertiaryHandle);if(this.m_query.vmax<t){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.left_),!0}if(t<this.m_query.vmin){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getLast_(t),this.m_functionStack[++this.m_functionIndex]=this.right_),!0}this.m_functionStack[this.m_functionIndex]=this.pL_,this.m_forkedHandle=this.m_tertiaryHandle;const e=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==e&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(e),this.m_functionStack[++this.m_functionIndex]=this.all_),!0}pL_(){if(this.m_tertiaryHandle=this.m_nextTertiaryHandle,-1===this.m_tertiaryHandle)return this.m_functionStack[this.m_functionIndex]=this.pR_,this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_forkedHandle),!0;if(this.m_intervalTree.getDiscriminant_(this.m_tertiaryHandle)<this.m_query.vmin){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getLast_(t),this.m_functionStack[++this.m_functionIndex]=this.right_),!0}const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.all_);const e=this.m_intervalTree.getRptr_(this.m_tertiaryHandle);return-1!==e&&this.m_tertiaryStack.push(e),!0}pR_(){if(this.m_tertiaryHandle=this.m_nextTertiaryHandle,-1===this.m_tertiaryHandle)return this.m_functionStack[this.m_functionIndex]=this.pT_,!0;const t=this.m_intervalTree.getDiscriminant_(this.m_tertiaryHandle);if(this.m_query.vmax<t){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.left_),!0}const e=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_tertiaryHandle),-1!==e&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(e),this.m_functionStack[++this.m_functionIndex]=this.all_);const s=this.m_intervalTree.getLptr_(this.m_tertiaryHandle);return-1!==s&&this.m_tertiaryStack.push(s),!0}pT_(){if(0===this.m_tertiaryStack.length)return this.m_functionIndex=-1,this.m_currentEndHandle=-1,!1;this.m_tertiaryHandle=this.m_tertiaryStack.at(-1),this.m_tertiaryStack.pop();const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.all_),-1!==this.m_intervalTree.getLptr_(this.m_tertiaryHandle)&&this.m_tertiaryStack.push(this.m_intervalTree.getLptr_(this.m_tertiaryHandle)),-1!==this.m_intervalTree.getRptr_(this.m_tertiaryHandle)&&this.m_tertiaryStack.push(this.m_intervalTree.getRptr_(this.m_tertiaryHandle)),!0}left_(){return this.m_currentEndHandle=this.m_nextEndHandle,-1!==this.m_currentEndHandle&&ft.isLeft_(this.getCurrentEndIndex_())&&this.m_intervalTree.getValue_(this.getCurrentEndIndex_())<=this.m_query.vmax?(this.m_nextEndHandle=this.getNext_(),!1):(this.m_functionIndex--,!0)}right_(){return this.m_currentEndHandle=this.m_nextEndHandle,-1!==this.m_currentEndHandle&&ft.isRight_(this.getCurrentEndIndex_())&&this.m_intervalTree.getValue_(this.getCurrentEndIndex_())>=this.m_query.vmin?(this.m_nextEndHandle=this.getPrev_(),!1):(this.m_functionIndex--,!0)}all_(){return this.m_currentEndHandle=this.m_nextEndHandle,-1!==this.m_currentEndHandle&&ft.isLeft_(this.getCurrentEndIndex_())?(this.m_nextEndHandle=this.getNext_(),!1):(this.m_functionIndex--,!0)}getNext_(){return this.m_intervalTree.m_bOfflineDynamic?this.m_intervalTree.m_secondaryTreaps.getNext(this.m_currentEndHandle):this.m_intervalTree.m_secondaryLists.getNext(this.m_currentEndHandle)}getPrev_(){return this.m_intervalTree.m_bOfflineDynamic?this.m_intervalTree.m_secondaryTreaps.getPrev(this.m_currentEndHandle):this.m_intervalTree.m_secondaryLists.getPrev(this.m_currentEndHandle)}getCurrentEndIndex_(){return this.m_intervalTree.m_bOfflineDynamic?this.m_intervalTree.m_secondaryTreaps.getElement(this.m_currentEndHandle):this.m_intervalTree.m_secondaryLists.getData(this.m_currentEndHandle)}}class yt{constructor(){this.m_tolerance=0,this.m_sweepIndexRed=-1,this.m_sweepIndexBlue=-1,this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_intervalTreeRed=null,this.m_intervalTreeBlue=null,this.m_iteratorRed=null,this.m_iteratorBlue=null,this.m_envelopesRed=[],this.m_envelopesBlue=[],this.m_elementsRed=[],this.m_elementsBlue=[],this.m_sortedEndIndicesRed=new st(0),this.m_sortedEndIndicesBlue=new st(0),this.m_queuedListRed=-1,this.m_queuedListBlue=-1,this.m_queuedEnvelopes=new pt,this.m_queuedIndicesRed=[],this.m_queuedIndicesBlue=[],this.m_bAddRed=!1,this.m_bAddBlue=!1,this.m_bAddRedRed=!1,this.m_bDone=!0,this.m_function=this.nullFunc_,this.reset_()}startConstruction(){this.reset_(),this.m_bAddRedRed=!0,this.m_elementsRed.length=0,this.m_envelopesRed.length=0}addEnvelope(t,e){this.m_bAddRedRed||N(""),this.m_elementsRed.push(t),this.m_envelopesRed.push(new p(e))}endConstruction(){this.m_bAddRedRed||N(""),this.m_bAddRedRed=!1,this.m_envelopesRed.length>0&&(this.m_function=this.initialize_,this.m_bDone=!1)}startRedConstruction(){this.reset_(),this.m_bAddRed=!0,this.m_elementsRed.length=0,this.m_envelopesRed.length=0}addRedEnvelope(t,e){this.m_bAddRed||N(""),this.m_elementsRed.push(t),this.m_envelopesRed.push(e.clone())}endRedConstruction(){this.m_bAddRed||N(""),this.m_bAddRed=!1,this.m_envelopesRed.length>0&&this.m_envelopesBlue.length>0&&(this.m_function===this.nullFunc_||this.m_function===this.initializeBlue_?this.m_function=this.initializeRedBlue_:this.m_function!==this.initializeRedBlue_&&(this.m_function=this.initializeRed_),this.m_bDone=!1)}startBlueConstruction(){this.reset_(),this.m_bAddBlue=!0,this.m_elementsBlue.length=0,this.m_envelopesBlue.length=0}addBlueEnvelope(t,e){this.m_bAddBlue||N(""),this.m_elementsBlue.push(t),this.m_envelopesBlue.push(e.clone())}endBlueConstruction(){this.m_bAddBlue||N(""),this.m_bAddBlue=!1,this.m_envelopesRed.length>0&&this.m_envelopesBlue.length>0&&(this.m_function===this.nullFunc_||this.m_function===this.initializeRed_?this.m_function=this.initializeRedBlue_:this.m_function!==this.initializeRedBlue_&&(this.m_function=this.initializeBlue_),this.m_bDone=!1)}next(){if(this.m_bDone)return!1;for(;this.m_function(););return!this.m_bDone}getHandleA(){return this.m_envelopeHandleA}getHandleB(){return this.m_envelopeHandleB}setTolerance(t){this.m_tolerance=t}getElement(t){return this.m_elementsRed[t]}getRedEnvelope(t){return this.m_envelopesRed[t]}getBlueEnvelope(t){return this.m_envelopesBlue[t]}getRedElement(t){return this.m_elementsRed[t]}getBlueElement(t){return this.m_elementsBlue[t]}isTop_(t){return!(1&~t)}isBottom_(t){return!(1&t)}reset_(){this.m_bAddRed=!1,this.m_bAddBlue=!1,this.m_bAddRedRed=!1,this.m_sweepIndexRed=-1,this.m_sweepIndexBlue=-1,this.m_queuedListRed=-1,this.m_queuedListBlue=-1,this.m_bDone=!0}initialize_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepBruteForce_,!0;this.m_intervalTreeRed||(this.m_intervalTreeRed=new ft(!0)),this.m_intervalTreeRed.addEnvelopesRef(this.m_envelopesRed),null===this.m_iteratorRed&&(this.m_iteratorRed=this.m_intervalTreeRed.getIterator()),this.m_sortedEndIndicesRed.resize(0);for(let t=0;t<2*this.m_envelopesRed.length;t++)this.m_sortedEndIndicesRed.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesRed,0,2*this.m_envelopesRed.length,!0),this.m_sweepIndexRed=2*this.m_envelopesRed.length,this.m_function=this.sweep_,!0}initializeRed_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10||this.m_envelopesBlue.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepRedBlueBruteForce_,!0;this.m_intervalTreeRed||(this.m_intervalTreeRed=new ft(!0)),this.m_intervalTreeRed.addEnvelopesRef(this.m_envelopesRed),null===this.m_iteratorRed&&(this.m_iteratorRed=this.m_intervalTreeRed.getIterator()),this.m_sortedEndIndicesRed.resize(0);for(let t=0;t<2*this.m_envelopesRed.length;t++)this.m_sortedEndIndicesRed.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesRed,0,this.m_sortedEndIndicesRed.size(),!0),this.m_sweepIndexRed=this.m_sortedEndIndicesRed.size(),-1!==this.m_queuedListRed&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListRed),this.m_queuedIndicesRed.length=0,this.m_queuedListRed=-1),this.m_function=this.sweepRedBlue_,this.resetBlue_()}initializeBlue_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10||this.m_envelopesBlue.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepRedBlueBruteForce_,!0;this.m_intervalTreeBlue||(this.m_intervalTreeBlue=new ft(!0)),this.m_intervalTreeBlue.addEnvelopesRef(this.m_envelopesBlue),null==this.m_iteratorBlue&&(this.m_iteratorBlue=this.m_intervalTreeBlue.getIterator()),this.m_sortedEndIndicesBlue.resize(0);for(let t=0;t<2*this.m_envelopesBlue.length;t++)this.m_sortedEndIndicesBlue.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesBlue,0,this.m_sortedEndIndicesBlue.size(),!1),this.m_sweepIndexBlue=this.m_sortedEndIndicesBlue.size(),-1!==this.m_queuedListBlue&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListBlue),this.m_queuedIndicesBlue.length=0,this.m_queuedListBlue=-1),this.m_function=this.sweepRedBlue_,this.resetRed_()}initializeRedBlue_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10||this.m_envelopesBlue.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepRedBlueBruteForce_,!0;this.m_intervalTreeRed||(this.m_intervalTreeRed=new ft(!0)),this.m_intervalTreeBlue||(this.m_intervalTreeBlue=new ft(!0)),this.m_intervalTreeRed.addEnvelopesRef(this.m_envelopesRed),this.m_intervalTreeBlue.addEnvelopesRef(this.m_envelopesBlue),null===this.m_iteratorRed&&(this.m_iteratorRed=this.m_intervalTreeRed.getIterator()),null===this.m_iteratorBlue&&(this.m_iteratorBlue=this.m_intervalTreeBlue.getIterator()),this.m_sortedEndIndicesRed.resize(0),this.m_sortedEndIndicesBlue.resize(0);for(let t=0;t<2*this.m_envelopesRed.length;t++)this.m_sortedEndIndicesRed.add(t);for(let t=0;t<2*this.m_envelopesBlue.length;t++)this.m_sortedEndIndicesBlue.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesRed,0,this.m_sortedEndIndicesRed.size(),!0),this.sortYEndIndices_(this.m_sortedEndIndicesBlue,0,this.m_sortedEndIndicesBlue.size(),!1),this.m_sweepIndexRed=this.m_sortedEndIndicesRed.size(),this.m_sweepIndexBlue=this.m_sortedEndIndicesBlue.size(),-1!==this.m_queuedListRed&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListRed),this.m_queuedIndicesRed.length=0,this.m_queuedListRed=-1),-1!==this.m_queuedListBlue&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListBlue),this.m_queuedIndicesBlue.length=0,this.m_queuedListBlue=-1),this.m_function=this.sweepRedBlue_,!0}sweep_(){const t=this.m_sortedEndIndicesRed.read(--this.m_sweepIndexRed),e=t>>1;if(this.isBottom_(t))return this.m_intervalTreeRed.remove(e),0!==this.m_sweepIndexRed||(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1);const s=r.construct(this.m_envelopesRed[e].xmin,this.m_envelopesRed[e].xmax);return this.m_iteratorRed.resetIterator(s,this.m_tolerance),this.m_envelopeHandleA=e,this.m_function=this.iterate_,!0}sweepBruteForce_(){return-1==--this.m_sweepIndexRed?(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1):(this.m_envelopeHandleA=this.m_sweepIndexRed,this.m_sweepIndexBlue=this.m_sweepIndexRed,this.m_function=this.iterateBruteForce_,!0)}sweepRedBlueBruteForce_(){return-1==--this.m_sweepIndexRed?(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1):(this.m_envelopeHandleA=this.m_sweepIndexRed,this.m_sweepIndexBlue=this.m_envelopesBlue.length,this.m_function=this.iterateRedBlueBruteForce_,!0)}sweepRedBlue_(){const t=this.m_sortedEndIndicesRed.read(this.m_sweepIndexRed-1),e=this.m_sortedEndIndicesBlue.read(this.m_sweepIndexBlue-1),s=this.getAdjustedValue_(t,!0),i=this.getAdjustedValue_(e,!1);return s>i?this.sweepRed_():s<i?this.sweepBlue_():this.isTop_(t)?this.sweepRed_():this.isTop_(e)?this.sweepBlue_():this.sweepRed_()}sweepRed_(){const t=this.m_sortedEndIndicesRed.read(--this.m_sweepIndexRed),e=t>>1;if(this.isBottom_(t))return-1!==this.m_queuedListRed&&-1!==this.m_queuedIndicesRed[e]?(this.m_queuedEnvelopes.deleteElement(this.m_queuedListRed,this.m_queuedIndicesRed[e]),this.m_queuedIndicesRed[e]=-1):this.m_intervalTreeRed.remove(e),0!==this.m_sweepIndexRed||(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1);if(-1!==this.m_queuedListBlue&&this.m_queuedEnvelopes.getListSize(this.m_queuedListBlue)>0){let t=this.m_queuedEnvelopes.getFirst(this.m_queuedListBlue);for(;-1!==t;){const e=this.m_queuedEnvelopes.getData(t);this.m_intervalTreeBlue.insert(e),this.m_queuedIndicesBlue[e]=-1;const s=this.m_queuedEnvelopes.getNext(t);this.m_queuedEnvelopes.deleteElement(this.m_queuedListBlue,t),t=s}}if(this.m_intervalTreeBlue.size()>0){const t=r.construct(this.m_envelopesRed[e].xmin,this.m_envelopesRed[e].xmax);this.m_iteratorBlue.resetIterator(t,this.m_tolerance),this.m_envelopeHandleA=e,this.m_function=this.iterateBlue_}else-1===this.m_queuedListRed&&(c(this.m_queuedIndicesRed,this.m_envelopesRed.length,-1),this.m_queuedListRed=this.m_queuedEnvelopes.createList(1)),this.m_queuedIndicesRed[e]=this.m_queuedEnvelopes.addElement(this.m_queuedListRed,e),this.m_function=this.sweepRedBlue_;return!0}sweepBlue_(){const t=this.m_sortedEndIndicesBlue.read(--this.m_sweepIndexBlue),e=t>>1;if(this.isBottom_(t))return-1!==this.m_queuedListBlue&&-1!==this.m_queuedIndicesBlue[e]?(this.m_queuedEnvelopes.deleteElement(this.m_queuedListBlue,this.m_queuedIndicesBlue[e]),this.m_queuedIndicesBlue[e]=-1):this.m_intervalTreeBlue.remove(e),0!==this.m_sweepIndexBlue||(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1);if(-1!==this.m_queuedListRed&&this.m_queuedEnvelopes.getListSize(this.m_queuedListRed)>0){let t=this.m_queuedEnvelopes.getFirst(this.m_queuedListRed);for(;-1!==t;){const e=this.m_queuedEnvelopes.getData(t);this.m_intervalTreeRed.insert(e),this.m_queuedIndicesRed[e]=-1;const s=this.m_queuedEnvelopes.getNext(t);this.m_queuedEnvelopes.deleteElement(this.m_queuedListRed,t),t=s}}if(this.m_intervalTreeRed.size()>0){const t=r.construct(this.m_envelopesBlue[e].xmin,this.m_envelopesBlue[e].xmax);this.m_iteratorRed.resetIterator(t,this.m_tolerance),this.m_envelopeHandleB=e,this.m_function=this.iterateRed_}else-1===this.m_queuedListBlue&&(c(this.m_queuedIndicesBlue,this.m_envelopesBlue.length,-1),this.m_queuedListBlue=this.m_queuedEnvelopes.createList(0)),this.m_queuedIndicesBlue[e]=this.m_queuedEnvelopes.addElement(this.m_queuedListBlue,e),this.m_function=this.sweepRedBlue_;return!0}iterate_(){if(this.m_envelopeHandleB=this.m_iteratorRed.next(),-1!==this.m_envelopeHandleB)return!1;const t=this.m_sortedEndIndicesRed.read(this.m_sweepIndexRed)>>1;return this.m_intervalTreeRed.insert(t),this.m_function=this.sweep_,!0}iterateRed_(){if(this.m_envelopeHandleA=this.m_iteratorRed.next(),-1!==this.m_envelopeHandleA)return!1;this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1;const t=this.m_sortedEndIndicesBlue.read(this.m_sweepIndexBlue)>>1;return this.m_intervalTreeBlue.insert(t),this.m_function=this.sweepRedBlue_,!0}iterateBlue_(){if(this.m_envelopeHandleB=this.m_iteratorBlue.next(),-1!==this.m_envelopeHandleB)return!1;const t=this.m_sortedEndIndicesRed.read(this.m_sweepIndexRed)>>1;return this.m_intervalTreeRed.insert(t),this.m_function=this.sweepRedBlue_,!0}iterateBruteForce_(){if(-1==--this.m_sweepIndexBlue)return this.m_function=this.sweepBruteForce_,!0;const t=this.m_envelopesRed[this.m_sweepIndexRed].clone(),e=this.m_envelopesRed[this.m_sweepIndexBlue];return t.inflateCoords(this.m_tolerance,this.m_tolerance),!t.isIntersecting(e)||(this.m_envelopeHandleB=this.m_sweepIndexBlue,!1)}iterateRedBlueBruteForce_(){if(-1==--this.m_sweepIndexBlue)return this.m_function=this.sweepRedBlueBruteForce_,!0;const t=this.m_envelopesRed[this.m_sweepIndexRed].clone(),e=this.m_envelopesBlue[this.m_sweepIndexBlue];return t.inflateCoords(this.m_tolerance,this.m_tolerance),!t.isIntersecting(e)||(this.m_envelopeHandleB=this.m_sweepIndexBlue,!1)}resetRed_(){return this.m_sweepIndexRed=this.m_sortedEndIndicesRed.size(),this.m_intervalTreeRed.size()>0&&this.m_intervalTreeRed.reset(),-1!==this.m_queuedListRed&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListRed),this.m_queuedIndicesRed.length=0,this.m_queuedListRed=-1),this.m_bDone=!1,!0}resetBlue_(){return this.m_sweepIndexBlue=this.m_sortedEndIndicesBlue.size(),this.m_intervalTreeBlue.size()>0&&this.m_intervalTreeBlue.reset(),-1!==this.m_queuedListBlue&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListBlue),this.m_queuedIndicesBlue.length=0,this.m_queuedListBlue=-1),this.m_bDone=!1,!0}nullFunc_(){return b("should not be called"),!1}sortYEndIndices_(t,e,s,i){const n=this,r={userSort(t,e,s){n.sortYEndIndicesHelper_(s,t,e,i)},getValue:t=>n.getAdjustedValue_(t,i)};(new ot).sort(t,e,s,r)}sortYEndIndicesHelper_(t,e,s,i){t.sort(e,s,((t,e)=>{const s=this.getAdjustedValue_(t,i),n=this.getAdjustedValue_(e,i);return s<n||s===n&&this.isBottom_(t)&&this.isTop_(e)?-1:1}))}getAdjustedValue_(t,e){const s=.5*this.m_tolerance;if(e){const e=this.m_envelopesRed[t>>1];return this.isBottom_(t)?e.ymin-s:e.ymax+s}const i=this.m_envelopesBlue[t>>1];return this.isBottom_(t)?i.ymin-s:i.ymax+s}}var xt=z;class Et{constructor(t,e){this.tolerance=void 0!==t?t:Number.NaN,this.resolution=void 0!==e?e:Number.NaN}add(t){return new Et(this.tolerance+t,this.resolution)}scale(t){return new Et(this.tolerance*t,this.resolution*t)}total(){return this.tolerance+this.resolution}}function bt(t,e,i,n,r){const h=n*n,o=t.sub(e),a=i.sub(e),m=o.sqrLength(),_=a.sqrLength();if(m<=h||_<=h)return!0;const l=s(o.crossProduct(a));if(l<=h*m||l<=h*_){return o.dotProduct(a)>=0}return!1}function Nt(t,e,s){return i=>0===s?(i+t)*e:1*(i-t*e)/e}function Dt(t,e){const s=new p;return t.queryLooseEnvelope(s),s.mergeEnvelope2D(e),s}function It(t,e){const s=p.constructEmpty();t.queryLooseEnvelope(s);const i=p.constructEmpty();return e.queryLooseEnvelope(i),s.mergeEnvelope2D(i),s}function Ct(t,e){return(Number.isFinite(t)||Number.isNaN(t))&&(Number.isFinite(e)||Number.isNaN(e))}function Tt(t,e){return Number.isFinite(t)&&Number.isFinite(e)}function Rt(t,e,s){const i=p.constructEmpty();i.setFromPoints(t,e);return St(0,null,i.calculateToleranceFromEnvelope(),s,!1)}function At(t,e,s){return St(0,t,e.calculateToleranceFromEnvelope(),s,!1)}function qt(t,e,s){return St(1,t,e.calculateToleranceFromEnvelope(),s,!1)}function wt(t,e,s){return qt(t,e.queryInterval(1,0),s)}function Bt(t,e,s){const i=p.constructEmpty();return e.queryEnvelope(i),At(t,i,s)}function zt(t,e,s=!1){return St(0,t,e.calculateToleranceFromEnvelope(),s,!0).total()}function Lt(t,e,s){const i=p.constructEmpty();return e.queryEnvelope(i),zt(t,i,s)}function St(t,e,s,i,n){const r=new Et(0,0);if(null!==e&&(r.tolerance=e.getTolerance(t),(!n||i)&&null!==e)){const s=e.getResolution(t);r.resolution=s,i&&(r.resolution*=2)}i&&(s*=4,r.tolerance*=1.01,r.resolution*=1.01);return r.total()<s?new Et(s,0):r}function Ft(t){return Math.sqrt(2)*(2*t.tolerance+t.resolution)}function Pt(t){return Math.sqrt(2)*(t.tolerance+t.resolution)}function Ht(t){return t>=3}function Vt(t,e){const s=[0];return t.getImpl().getIsSimple(e,s)>=3}function kt(t,e){t.getImpl().setIsSimple(3,e)}function Mt(t,e,n,r){if(s(e.x-t.x)+s(e.y-t.y)<=n*n){const s=t.z,n=e.z;return i(s,n,r)}return!1}function Ot(t){return t>=4}function Yt(t,e){return t===y.enumPolygon?Ht(e):e>=1}function Xt(t,e,s){const i=p.constructEmpty(),n=p.constructEmpty();t.queryLooseEnvelope(i),e.queryLooseEnvelope(n),i.inflateCoords(s,s),n.inflateCoords(s,s);const r=p.constructEmpty();r.setCoords({env2D:i}),r.intersect(n);const h=t.querySegmentIterator(),o=e.querySegmentIterator(),a=p.constructEmpty(),m=p.constructEmpty(),_=new yt;_.setTolerance(s);let l=!1;for(_.startRedConstruction();h.nextPath();)for(;h.hasNextSegment();){h.nextSegment().queryLooseEnvelope(a),a.isIntersecting(r)&&(l=!0,_.addRedEnvelope(h.getStartPointIndex(),a))}if(_.endRedConstruction(),!l)return null;let u=!1;for(_.startBlueConstruction();o.nextPath();)for(;o.hasNextSegment();){o.nextSegment().queryLooseEnvelope(m),m.isIntersecting(r)&&(u=!0,_.addBlueEnvelope(o.getStartPointIndex(),m))}return _.endBlueConstruction(),u?_:null}function Gt(t,e,s,i,n){t.getGeometryType(),e.getGeometryType();const r=p.constructEmpty(),h=p.constructEmpty();t.queryLooseEnvelope(r),e.queryLooseEnvelope(h),r.inflateCoords(s,s),h.inflateCoords(s,s);const o=p.constructEmpty();o.setCoords({env2D:r}),o.intersect(h);const a=new yt;a.setTolerance(s);let m=!1;a.startRedConstruction();for(let l=0,u=t.getPathCount();l<u;l++)t.queryLoosePathEnvelope(l,r),r.isIntersecting(o)&&(m=!0,a.addRedEnvelope(l,r));if(a.endRedConstruction(),!m)return null;let _=!1;a.startBlueConstruction();for(let l=0,u=e.getPathCount();l<u;l++)e.queryLoosePathEnvelope(l,h),h.isIntersecting(o)&&(_=!0,a.addBlueEnvelope(l,h));return a.endBlueConstruction(),_?a:null}function Ut(t,e,s){const i=p.constructEmpty(),n=p.constructEmpty();t.queryLooseEnvelope(i),e.queryEnvelope(n),i.inflateCoords(s,s),n.inflateCoords(s,s);const r=p.constructEmpty();r.setCoords({env2D:i}),r.intersect(n);const h=t.querySegmentIterator(),o=new yt;o.setTolerance(s);let a=!1;for(o.startRedConstruction();h.nextPath();)for(;h.hasNextSegment();){h.nextSegment().queryLooseEnvelope(i),i.isIntersecting(r)&&(a=!0,o.addRedEnvelope(h.getStartPointIndex(),i))}if(o.endRedConstruction(),!a)return null;let m=!1;o.startBlueConstruction();for(let _=0,l=e.getPointCount();_<l;_++){const t=e.getXY(_);r.contains(t)&&(m=!0,o.addBlueEnvelope(_,p.construct(t.x,t.y,t.x,t.y)))}return o.endBlueConstruction(),m?o:null}function Zt(t,e,s){const i=p.constructEmpty(),n=p.constructEmpty();t.queryEnvelope(i),e.queryEnvelope(n),i.inflateCoords(s,s),n.inflateCoords(s,s);const r=p.constructEmpty();r.setCoords({env2D:i}),r.intersect(n);const h=new yt;h.setTolerance(s);let a=!1;h.startRedConstruction();const m=new o;for(let o=0,u=t.getPointCount();o<u;o++)t.queryXY(o,m),r.contains(m)&&(a=!0,h.addRedEnvelope(o,p.construct(m.x,m.y,m.x,m.y)));if(h.endRedConstruction(),!a)return null;let _=!1;h.startBlueConstruction();const l=new o;for(let o=0,u=e.getPointCount();o<u;o++)e.queryXY(o,l),r.contains(l)&&(_=!0,h.addBlueEnvelope(o,p.construct(l.x,l.y,l.x,l.y)));return h.endBlueConstruction(),_?h:null}function Qt(t){const e=new p;return t.queryLooseEnvelope(e),e.inflateCoords(1,1),jt(t,e)}function jt(t,e,s){const i=new p;if(t.queryLooseEnvelope(i),i.isEmpty())return null;t.getGeometryType();const n=new _t(i,8);let r=-1;const h=new p;let o=!1;do{for(let s=0,a=t.getPathCount();s<a;s++)if(t.queryLoosePathEnvelope(s,h),h.isIntersecting(e)){if(r=n.insertEx(s,h,r),-1===r){o&&b("build_quad_tree_for_paths"),i.assign(t.calculateEnvelope2D(!1)),o=!0,n.reset(i,8);break}o=!1}}while(o);return n}function Wt(t,e){if(!e){const e=new p;t.queryLooseEnvelope(e);const s=new _t(e,8);let i=-1;const n=new p,r=t.querySegmentIterator();let h=!1;for(;r.nextPath();)for(;r.hasNextSegment();){const o=r.nextSegment(),a=r.getStartPointIndex();if(o.queryLooseEnvelope(n),i=s.insertEx(a,n,i),-1===i){h&&b(""),e.assign(t.calculateEnvelope2D(!1)),h=!0,s.reset(e,8),r.resetToFirstPath();break}}return s}const s=new p;t.queryLooseEnvelope(s);const i=new _t(s,8);let n=-1;const r=new p,h=t.querySegmentIterator();let o=!1;for(;h.nextPath();)for(;h.hasNextSegment();){const a=h.nextSegment(),m=h.getStartPointIndex();if(a.queryLooseEnvelope(r),r.isIntersecting(e)&&(n=i.insertEx(m,r,n),-1===n)){o&&b(""),s.assign(t.calculateEnvelope2D(!1)),o=!0,i.reset(s,8),h.resetToFirstPath();break}}return i}function Jt(t,e){if(e){const s=new _t(e,8),i=new o,n=new p;let r=!1;for(let h=0;h<t.getPointCount();h++){if(i.setCoordsPoint2D(t.getXY(h)),!e.contains(i))continue;n.setCoords({pt:i});-1!==s.insert(h,n)||(r&&b(""),r=!0,s.reset(t.calculateEnvelope2D(),8),h=-1)}return s}return x("no-extent version not yet impl"),null}function Kt(t,e,s,i,n){let r=!1;const h=n.vmin,o=n.vmax;for(let a=s;a<e;a+=i){const e=t.read(a);e<h?(r=!0,t.write(a,h)):e>o&&(r=!0,t.write(a,o))}return r}function $t(t,e,s,i){if(!t.hasAttribute(s))return!1;const n=t.getGeometryType();if(n===y.enumGeometryCollection){const n=t,r=n.getGeometryCount();let h=0;for(let t=0;t<r;++t){h|=$t(n.getGeometry(t),e,s,i)?1:0}return!!h}if(D(n)){const n=t,r=xt.getPersistence(s),h=xt.getComponentCount(s),o=n.getPointCount();if(1===r){const t=Kt(n.getAttributeStreamRef(s),o*h,i,h,e);return t&&n.notifyModified(),t}if(2===r){const t=Kt(n.getAttributeStreamRef(s),o*h,i,h,e);return t&&n.notifyModified(),t}b("snap_coordinate not implemented")}if(n===y.enumEnvelope){const n=t,r=n.queryInterval(s,i);let h=!1;return r.vmin<e.vmin&&(h=!0,r.vmin=e.vmin),r.vmax>e.vmax&&(h=!0,r.vmax=e.vmax),h&&n.setIntervalEnvelope(s,i,r),h}if(n===y.enumPoint){const n=t;let r=n.getAttributeAsDbl(s,i),h=!1;return r<e.vmin&&(h=!0,r=e.vmin),r>e.vmax&&(h=!0,r=e.vmax),h&&n.setAttributeBasic(s,i,r),h}if(I(n)){const n=t;let r=n.getStartAttributeAsDbl(s,i),h=!1;return r<e.vmin&&(h=!0,r=e.vmin),r>e.vmax&&(h=!0,r=e.vmax),h&&n.setStartAttribute(s,i,r),r=n.getEndAttributeAsDbl(s,i),r<e.vmin&&(h=!0,r=e.vmin),r>e.vmax&&(h=!0,r=e.vmax),h&&n.setEndAttribute(s,i,r),h}b("snap_coordinate not implemented")}var te=z;class ee{constructor(t){if(this.m_description=null,this.x=Number.NaN,this.y=Number.NaN,this.m_attribs=null,t){if(!t.copy)return t.move?(this.m_description=t.move.m_description,t.move.m_description=null,this.m_attribs=t.move.m_attribs,t.move.m_attribs=null,this.x=t.move.x,void(this.y=t.move.y)):t.vd?(this.m_description=t.vd,void(t.attribBuffer?(this.m_attribs=t.attribBuffer,t.initDefaultValues&&this.setDefaultAttributeValues()):this.ensureAttributes())):t.pt?(this.m_description=M(),void this.setXY(t.pt)):void("x"in t&&("z"in t?(this.m_description=O(),this.ensureAttributes(),this.setXYZ(new X(t.x,t.y,t.z))):(this.m_description=M(),this.setXYCoords(t.x,t.y))));t.copy.copyTo(this)}else this.m_description=M()}assignCopy(t){return this.m_attribs=null,t.copyTo(this),this}assignMove(t){return this.m_attribs=null,t.copyTo(this),t.setEmpty(),this}getXY(){return new o(this.x,this.y)}queryXY(t){t.x=this.x,t.y=this.y}setXY(t){this.x=t.x,this.y=t.y}setXYCoords(t,e){this.x=t,this.y=e}getXYZ(){const t=new X;return t.x=this.x,t.y=this.y,t.z=this.getZ(),t}setXYZ(t){this.addAttribute(1),this.x=t.x,this.y=t.y,this.m_attribs[0]=t.z}getX(){return this.x}setX(t){this.x=t}getY(){return this.y}setY(t){this.y=t}getZ(){return this.m_description.hasZ()?this.m_attribs[0]:te.getDefaultValue(1)}setZ(t){this.addAttribute(1),this.m_attribs[0]=t}getM(){return this.getAttributeAsDbl(2,0)}setM(t){this.addAttribute(2),this.m_description.hasZ()?this.m_attribs[1]=t:this.m_attribs[0]=t}getID(){return this.getAttributeAsInt(3,0)}setID(t){this.setAttributeBasic(3,0,t)}isEqualXY(t,e){return void 0===e&&(e=0),Math.abs(t.x-this.x)<=e&&Math.abs(t.y-this.y)<=e}isEqualXYCoords(t,e,s){return void 0===s&&(s=0),Math.abs(t-this.x)<=s&&Math.abs(e-this.y)<=s}getAttributeAsDbl(t,e){if(0===t){if(0===e)return this.x;if(1===e)return this.y;v("")}const s=te.getComponentCount(t);(e<0||e>=s)&&v("");const i=this.m_description.getAttributeIndex(t);return i>=0?this.m_attribs[this.m_description.getPointAttributeOffset(i)-2+e]:te.getDefaultValue(t)}getAttributeAsInt(t,e){return Math.trunc(this.getAttributeAsDbl(t,e))}setAttributeBasic(t,e,s){if(0===t)return void(0===e?this.x=s:1===e?this.y=s:v(""));const i=te.getComponentCount(t);(e<0||e>=i)&&v("");let n=this.m_description.getAttributeIndex(t);n<0&&(this.addAttribute(t),n=this.m_description.getAttributeIndex(t)),this.m_attribs[this.m_description.getPointAttributeOffset(n)-2+e]=s}copyAttributesFrom(t,e){if(this===t)return;const s=t.getDescription();for(let i=e&&s.hasZ()?2:1,n=s.getAttributeCount();i<n;++i){const e=s.getSemantics(i),n=te.getComponentCount(e);for(let s=0;s<n;++s){const i=t.getAttributeAsDbl(e,s);this.setAttributeBasic(e,s,i)}}}getAttributeArray(){return this.m_attribs}getDescription(){return this.m_description}assignVertexDescription(t){this.m_description!==t&&this.assignVertexDescriptionImpl(t)}mergeVertexDescription(t){this.m_description!==t&&(this.m_description.hasAttributesFrom(t)||this.mergeVertexDescriptionImpl(t))}hasAttribute(t){return this.m_description.hasAttribute(t)}addAttribute(t){if(this.m_description.hasAttribute(t))return;const e=V(this.m_description,t);this.assignVertexDescription(e)}dropAttribute(t){if(!this.m_description.hasAttribute(t))return;const e=k(this.m_description,t);this.assignVertexDescription(e)}dropAllAttributes(){const t=M();t!==this.m_description&&this.assignVertexDescription(t)}getGeometryType(){return y.enumPoint}getDimension(){return 0}queryEnvelope(t){if(t instanceof re)return t.setEmpty(),t.assignVertexDescription(this.m_description),void t.merge(this);if(t instanceof G){if(this.isEmpty())return void t.setEmpty();const e=this.getXYZ();return t.xmin=e.x,t.ymin=e.y,t.zmin=e.z,t.xmax=e.x,t.ymax=e.y,void(t.zmax=e.z)}this.isEmpty()?t.setEmpty():(t.xmin=this.x,t.ymin=this.y,t.xmax=this.x,t.ymax=this.y)}queryLooseEnvelope(t){this.queryEnvelope(t)}queryInterval(t,e){const s=new r;if(this.isEmpty())return s.setEmpty(),s;const i=this.getAttributeAsDbl(t,e);return s.vmin=i,s.vmax=i,s}applyTransformation(t){if(!this.isEmpty()){if(1===t.m_TransformationType){const e=this.getXY();return t.transformInPlace(e),void this.setXY(e)}x("3d not impl")}}transformAttribute(t,e,s,i,n){if(this.isEmpty())return;this.addAttribute(t);const r=this.getAttributeAsDbl(t,e),h=Nt(s,i,n);this.setAttributeBasic(t,e,h(r))}createInstance(){return new ee({vd:this.m_description})}copyTo(t){if(this===t)return;t.getGeometryType()!==y.enumPoint&&f();const e=t;e.x=this.x,e.y=this.y,this.m_attribs?(e.assignVertexDescription(this.m_description),e.m_attribs=this.m_attribs.slice()):(e.releaseAttributes(),e.assignVertexDescription(this.m_description))}isEmpty(){return Number.isNaN(this.x)||Number.isNaN(this.y)}setEmpty(){this.m_description||(this.m_description=M(),this.releaseAttributes()),this.x=Number.NaN,this.y=Number.NaN,this.m_attribs&&m(this.m_attribs,this.m_description.getDefaultPointAttributes(),0,2,this.m_description.getTotalComponentCount()-2)}calculateArea2D(){return 0}calculateLength2D(){return 0}calculateLength3D(t){return 0}equals(t,e){if(t===this)return!0;if(t.getGeometryType()!==y.enumPoint)return!1;const s=t;if(this.m_description!==s.m_description)return!1;if(this.isEmpty()!==s.isEmpty())return!1;if(this.isEmpty())return!0;if(void 0===e&&(e=0),Math.abs(this.x-s.x)>e)return!1;if(Math.abs(this.y-s.y)>e)return!1;for(let n=0,r=this.m_description.getTotalComponentCount()-2;n<r;n++)if(!i(this.m_attribs[n],s.m_attribs[n],e))return!1;return!0}getBoundary(){return null}clone(){const t=new ee({vd:this.m_description});return this.copyTo(t),t}swap(t){if(this===t)return;t.getGeometryType()!==y.enumPoint&&f("wrong geometry type");const e=t;e.m_description=h(this.m_description,this.m_description=e.m_description),e.x=h(this.x,this.x=e.x),e.y=h(this.y,this.y=e.y),e.m_attribs=h(this.m_attribs,this.m_attribs=e.m_attribs)}replaceNaNs(t,e){if(this.addAttribute(t),this.isEmpty())return;const s=te.getComponentCount(t);for(let i=0;i<s;i++){const s=this.getAttributeAsDbl(t,i);Number.isNaN(s)&&this.setAttributeBasic(t,i,e)}}lerp(t,e,s){if(t.getDescription()!==e.getDescription()&&f("Point.lerp"),this.assignVertexDescription(t.getDescription()),t.isEmpty()||e.isEmpty())return this.setEmpty(),this;this.ensureAttributes();const i=B();t.queryValues(i,i.length);const n=B();e.queryValues(n,n.length);const r=B();let h=i,o=n;const a=r;let m=0;for(let l=0,u=this.m_description.getAttributeCount();l<u;l++){const t=this.m_description.getSemantics(l),e=te.getInterpolation(t),i=te.getComponentCount(t),n=te.getDefaultValue(t);_(e,h,o,a,m,i,s,n),h=h.slice(i),o=o.slice(i),m+=i}return this.setValues(r,m),this}static lerp(t,e,s,i){i.lerp(t,e,s)}setDefaultAttributeValues(){const t=this.m_description.getTotalComponentCount()-2;t>0&&(this.m_attribs?m(this.m_attribs,this.m_description.getDefaultPointAttributes(),0,2,t):this.m_attribs=this.m_description.getDefaultPointAttributes().slice(2))}static sqrDistance2D(t,e){return o.sqrDistanceCoords(t.x,t.y,e.x,e.y)}getImpl(){return this}mergeVertexDescriptionImpl(t){const e=H(this.getDescription(),t);this.assignVertexDescription(e)}releaseAttributes(){this.m_attribs=null}assignVertexDescriptionImpl(t){this.m_description||(this.m_description=M());const e=S();Y(t,this.m_description,e);let s=null;t.getTotalComponentCount()-2>0&&(s=t.getDefaultPointAttributes().slice(2));for(let i=1,n=t.getAttributeCount();i<n;i++){const n=e[i];if(-1!==n){const e=this.m_description.getPointAttributeOffset(n)-2,r=t.getPointAttributeOffset(i)-2,h=te.getComponentCount(t.getSemantics(i));for(let t=0;t<h;t++)s[r+t]=this.m_attribs[e+t]}}this.m_attribs=s,this.m_description=t}ensureAttributes(){this.m_description.getTotalComponentCount()-2>0&&null===this.m_attribs&&(this.m_attribs=this.m_description.getDefaultPointAttributes().slice(2))}queryValues(t,e){const s=this.m_description.getTotalComponentCount();g(s<=e),t[0]=this.x,t[1]=this.y,m(t,this.m_attribs,2,0,s-2)}copyCommonAttributesTo(t){t.x=this.x,t.y=this.y;const e=t.getDescription();if(e===this.m_description)this.m_attribs&&m(t.m_attribs,this.m_attribs,0,0,this.m_description.getTotalComponentCount()-2);else{let s=0;for(let i=1,n=e.getAttributeCount();i<n;i++){const n=e.getSemantics(i);let r=te.getComponentCount(n);if(this.m_description.hasAttribute(n)){let e=this.m_description.getPointAttributeOffset(this.m_description.getAttributeIndex(n))-2;for(;0!==r;)t.m_attribs[s++]=this.m_attribs[e++],r--}else{const e=te.getDefaultValue(n);for(;0!==r;)t.m_attribs[s++]=e,r--}}}}setValues(t,e){const s=this.m_description.getTotalComponentCount();g(s<=e),this.x=t[0],this.y=t[1],m(this.m_attribs,t,0,2,s-2)}dbgDefaultAttribs(){}}ee.type=y.enumPoint;var se=z;function ie(t,e){return e*(t.getTotalComponentCount()-2)}class ne{constructor(t){if(this.m_attributes=null,t)if(void 0!==t.xmin)this.m_envelope2D=new p(t.xmin,t.ymin,t.xmax,t.ymax);else if(void 0!==t.env2D)this.m_envelope2D=new p(t.env2D);else if(t.move)this.m_envelope2D=new p(t.move.m_envelope2D),this.m_attributes=t.move.m_attributes,t.move.m_attributes=null;else{if(!t.moveEnv)throw new Error("unrecognized EnvelopeData constructor options");{const e=t.moveEnv.accessEnvelopeData();this.m_envelope2D=new p(e.m_envelope2D),this.m_attributes=e.m_attributes,e.m_attributes=null}}else this.m_envelope2D=p.constructEmpty()}ensureAttributes(t){const s=t.getTotalComponentCount()-2;!this.m_attributes&&s&&(this.m_attributes=e(2*s,Number.NaN),this.m_attributes.fill(Number.NaN))}copyTo(t,s){const i=s,n=t.getTotalComponentCount()-2;if(i.m_description!==t&&(i.releaseAttributes_(),i.m_description=t,n&&(i.m_data.m_attributes=e(2*n,Number.NaN))),n){g(this.m_attributes&&i.m_data.m_attributes);const t=2*n;m(i.m_data.m_attributes,this.m_attributes,0,0,t)}i.m_data.m_envelope2D=new p(this.m_envelope2D)}copyToIfNotNull(t,e){e.m_envelope2D=new p(this.m_envelope2D),e.releaseAttributes();t.getTotalComponentCount()-2&&this.m_attributes&&(e.m_attributes=this.m_attributes.slice())}releaseAttributes(){this.m_attributes=null}isEmpty(){return this.m_envelope2D.isEmpty()}transformAttribute(t,e,s,i,n){g(0)}queryInterval(t,e,s,i){if(this.isEmpty())return void i.setEmpty();if(0===e)return void(0===s?this.m_envelope2D.queryIntervalX(i):1===s?this.m_envelope2D.queryIntervalY(i):v(""));const n=se.getComponentCount(e);(s<0||s>=n)&&v("");const r=t.getAttributeIndex(e);if(r>=0)return i.vmin=this.m_attributes[ie(t,0)+t.getPointAttributeOffset(r)-2+s],void(i.vmax=this.m_attributes[ie(t,1)+t.getPointAttributeOffset(r)-2+s]);{const t=se.getDefaultValue(e);return void i.setCoords(t,t)}}queryEnvelope3D(t,e){const s=new r;this.queryInterval(t,1,0,s),e.setCoords(this.m_envelope2D.xmin,this.m_envelope2D.ymin,s.vmin,this.m_envelope2D.xmax,this.m_envelope2D.ymax,s.vmax)}setEmpty(t){this.m_envelope2D.setEmpty();const s=t.getTotalComponentCount()-2;s&&(this.m_attributes?this.dbgAssertSize(s):this.m_attributes=e(2*s,Number.NaN),this.m_attributes.fill(Number.NaN))}dbgAssertSize(t){}}let re=class t{constructor(t){if(this.m_EnvelopeType=4,this.m_description=M(),void 0===t)this.m_data=new ne;else if(void 0!==t.vd)this.m_description=t.vd,this.m_data=new ne,this.ensureAttributes_();else if(t?.env2D)this.m_data=new ne({env2D:t.env2D});else if(void 0!==t.xmin)this.m_data=new ne({xmin:t.xmin,ymin:t.ymin,xmax:t.xmax,ymax:t.ymax});else if(t.copy)this.m_data=new ne,t.copy.copyTo(this);else if(t.move)this.m_description=t.move.m_description,t.move.m_description=null,this.m_data=new ne({move:t.move.m_data});else{if(!t.centerPoint)throw new Error("unrecognized Envelope constructor options");this.m_description=t.centerPoint.getDescription(),this.m_data=new ne,this.ensureAttributes_(),this.setFromPoint(t.centerPoint,t.width,t.height)}}accessEnvelopeData(){return this.m_description=null,this.m_data}assignMove(t){return this===t||(this.m_description=t.m_description,t.m_description=null,this.m_data=new ne({move:t.m_data})),this}assignCopy(t){return this===t||t.copyTo(this),this}transformAttribute(t,e,s,i,n){g(0)}setAttributeBasic(t,e,s){if(this.addAttribute(t),this.m_data.isEmpty())return;const i=this.queryInterval(t,e);i.vmin=s,i.vmax=s,this.setIntervalEnvelope(t,e,i)}mergeVertexDescriptionImpl(t){const e=H(this.getDescription(),t);this.assignVertexDescription(e)}asEnvelope2D(){return new p(this.m_data.m_envelope2D)}assignVertexDescription(t){this.m_description!==t&&this.assignVertexDescriptionImpl(t)}getGeometryType(){return y.enumEnvelope}getDimension(){return 2}getXMin(){return this.m_data.m_envelope2D.xmin}getYMin(){return this.m_data.m_envelope2D.ymin}getXMax(){return this.m_data.m_envelope2D.xmax}getYMax(){return this.m_data.m_envelope2D.ymax}width(){return this.m_data.isEmpty()?Number.NaN:this.m_data.m_envelope2D.width()}height(){return this.m_data.isEmpty()?Number.NaN:this.m_data.m_envelope2D.height()}getCenterXY(){return this.m_data.isEmpty()?new o:this.m_data.m_envelope2D.getCenter()}getCenter(t){if(t.assignVertexDescription(this.m_description),this.m_data.isEmpty())return void t.setEmpty();const e=this.m_description.getAttributeCount();for(let s=1;s<e;s++){const e=this.m_description.getSemantics(s),i=se.getComponentCount(e);for(let s=0;s<i;s++){const i=.5*(this.getAttributeAsDblImpl(0,e,s)+this.getAttributeAsDblImpl(1,e,s));t.setAttributeBasic(e,s,i)}}t.setXY(this.m_data.m_envelope2D.getCenter())}setCoords(t,e,s,i){this.m_data.m_envelope2D.setCoords({xmin:t,ymin:e,xmax:s,ymax:i})}setEnvelope(t){if(t instanceof p)this.m_data.m_envelope2D=new p(t),this.m_data.m_envelope2D.normalize();else{this.addAttribute(1),this.m_data.m_envelope2D=t.getEnvelope2D(),this.m_data.m_envelope2D.normalize();const e=r.constructEmpty();e.setCoords(t.zmin,t.zmax),this.setInterval(1,0,e.vmin,e.vmax)}}merge(e){if(e instanceof p)return e.isValid()||f(""),void this.m_data.m_envelope2D.mergeEnvelope2D(e);if(e instanceof t){if(e.m_data.isEmpty())return;const t=e.getDescription();this.mergeVertexDescription(t),this.m_data.m_envelope2D.mergeEnvelope2D(e.m_data.m_envelope2D);for(let s=1,i=t.getAttributeCount();s<i;s++){const i=t.getSemantics(s),n=se.getComponentCount(i);for(let t=0;t<n;t++){const s=e.queryInterval(i,t),n=this.queryInterval(i,t);n.merge(s),this.setIntervalEnvelope(i,t,n)}}}else if(e instanceof ee){const t=e;if(t.isEmpty())return;const s=t.getDescription();if(this.mergeVertexDescription(s),this.m_data.isEmpty())return void this.setFromPoint(t);this.m_data.m_envelope2D.merge(t.getXY());for(let e=1,i=s.getAttributeCount();e<i;e++){const i=s.getSemantics(e),n=se.getComponentCount(i);for(let e=0;e<n;e++){const s=t.getAttributeAsDbl(i,e),n=this.queryInterval(i,e);n.mergeCoordinate(s),this.setIntervalEnvelope(i,e,n)}}}else x("unrecognized type for envelope.merge")}intersect(t){if(!this.m_data.m_envelope2D.intersect(t.m_data.m_envelope2D))return this.setEmpty(),!1;const e=t.getDescription();this.mergeVertexDescription(e);for(let s=1,i=this.m_description.getAttributeCount();s<i;s++){const e=this.m_description.getSemantics(s),i=se.getComponentCount(e);for(let s=0;s<i;s++){const i=t.queryInterval(e,s),n=this.queryInterval(e,s);n.intersect(i),this.setIntervalEnvelope(e,s,n)}}return!0}intersectCommonAttributes(t){if(!this.m_data.m_envelope2D.intersect(t.m_data.m_envelope2D))return this.setEmpty(),!1;const e=t.getDescription();for(let s=1,i=this.m_description.getAttributeCount();s<i;s++){const i=this.m_description.getSemantics(s);if(!e.hasAttribute(i))continue;const n=se.getComponentCount(i);for(let e=0;e<n;e++){const s=t.queryInterval(i,e),n=this.queryInterval(i,e);n.intersect(s),this.setIntervalEnvelope(i,e,n)}}return!0}move(t,e){this.m_data.m_envelope2D.move(t,e)}centerAt(t,e){this.m_data.m_envelope2D.centerAtCoords(t,e)}centerAtPoint(t){this.m_data.m_envelope2D.centerAt(t)}reaspect(t,e){this.m_data.m_envelope2D.reaspect(t,e)}inflateCoords(t,e){this.m_data.m_envelope2D.inflateCoords(t,e)}containsCoords(t,e){return this.m_data.m_envelope2D.containsCoords(t,e)}contains(t){return this.m_data.m_envelope2D.contains(t)}containsPoint(t){return!t.isEmpty()&&this.m_data.m_envelope2D.contains(t.getXY())}containsEnvelope(t){return this.m_data.m_envelope2D.containsEnvelope(t.m_data.m_envelope2D)}setIntervalEnvelope(t,e,s){if(this.addAttribute(t),this.m_data.isEmpty())return;const i=new r(s);if(i.normalize(),0===t){if(i.isEmpty())return void this.setEmpty();0===e?(this.m_data.m_envelope2D.xmin=i.vmin,this.m_data.m_envelope2D.xmax=i.vmax):1===e?(this.m_data.m_envelope2D.ymin=i.vmin,this.m_data.m_envelope2D.ymax=i.vmax):v("")}else this.setAttributeAsDblImpl(0,t,e,i.vmin),this.setAttributeAsDblImpl(1,t,e,i.vmax)}setInterval(t,e,s,i){this.setIntervalEnvelope(t,e,new r(s,i))}queryInterval(t,e){const s=new r;return this.m_data.queryInterval(this.m_description,t,e,s),s}queryEnvelope(t){2!==t.m_EnvelopeType?3!==t.m_EnvelopeType?4!==t.m_EnvelopeType?x("unrecognized type for queryEnveloper"):this.copyTo(t):this.m_data.queryEnvelope3D(this.m_description,t):t.setCoords({env2D:this.m_data.m_envelope2D})}applyTransformation(t){1!==t.m_TransformationType?g(0):t.transformEnvInPlace(this.m_data.m_envelope2D)}createInstance(){return new t({vd:this.m_description})}copyTo(t){t!==this&&this.m_data.copyTo(this.m_description,t)}isEmpty(){return this.m_data.isEmpty()}setEmpty(){this.m_description||(this.m_description=M()),this.m_data.setEmpty(this.m_description)}calculateArea2D(){return this.m_data.m_envelope2D.getArea()}calculateLength2D(){return this.m_data.m_envelope2D.getLength()}calculateLength3D(t){return g(0),0}equals(t,e){if(t===this)return!0;const s=t;if(this.m_description!==s.m_description)return!1;if(this.m_data.isEmpty()!==s.m_data.isEmpty())return!1;if(this.m_data.isEmpty())return!0;if(void 0===e&&(e=0),Math.abs(this.m_data.m_envelope2D.xmin-s.m_data.m_envelope2D.xmin)>e)return!1;if(Math.abs(this.m_data.m_envelope2D.ymin-s.m_data.m_envelope2D.ymin)>e)return!1;if(Math.abs(this.m_data.m_envelope2D.xmax-s.m_data.m_envelope2D.xmax)>e)return!1;if(Math.abs(this.m_data.m_envelope2D.ymax-s.m_data.m_envelope2D.ymax)>e)return!1;for(let n=0,r=2*(this.m_description.getTotalComponentCount()-2);n<r;n++)if(!i(this.m_data.m_attributes[n],s.m_data.m_attributes[n],e))return!1;return!0}getBoundary(){return x("getBoundary not available in this context. Use the boundary operator with an envelope parameter"),null}clone(){return new t({copy:this})}swap(t){if(this===t)return;t.getGeometryType()!==y.enumEnvelope&&f("wrong geometry type");const e=t;e.m_description=h(this.m_description,this.m_description=e.m_description),e.m_data.m_envelope2D=h(this.m_data.m_envelope2D,this.m_data.m_envelope2D=e.m_data.m_envelope2D),e.m_data.m_attributes=h(this.m_data.m_attributes,this.m_data.m_attributes=e.m_data.m_attributes)}queryCoordinates(t){this.m_data.isEmpty()&&f(""),this.m_data.m_envelope2D.queryCorners(t)}queryCornerByVal(t,e){(t<0||t>3)&&v(""),e.assignVertexDescription(this.m_description);const s=this.getDescription().getAttributeCount();for(let i=1;i<s;i++){const s=this.m_description.getSemantics(i),n=se.getComponentCount(s);for(let i=0;i<n;i++)e.setAttributeBasic(s,i,this.getAttributeAsDblImpl(t%2,s,i))}e.setXY(this.m_data.m_envelope2D.queryCorner(t))}queryCorner(t,e){e.assign(this.m_data.m_envelope2D.queryCorner(t))}getDescription(){return this.m_description}mergeVertexDescription(t){this.m_description!==t&&(this.m_description&&this.m_description.hasAttributesFrom(t)||this.mergeVertexDescriptionImpl(t))}hasAttribute(t){return this.m_description.hasAttribute(t)}addAttribute(t){if(this.m_description.hasAttribute(t))return;const e=V(this.m_description,t);this.assignVertexDescription(e)}dropAttribute(t){if(!this.m_description.hasAttribute(t))return;const e=k(this.m_description,t);this.assignVertexDescription(e)}dropAllAttributes(){const t=M();t!==this.m_description&&this.assignVertexDescription(t)}queryLooseEnvelope(t){this.queryEnvelope(t)}replaceNaNs(t,e){if(this.addAttribute(t),this.m_data.isEmpty())return;const s=se.getComponentCount(t);for(let i=0;i<s;i++){const s=this.queryInterval(t,i);s.isEmpty()&&(s.vmin=e,s.vmax=e,this.setIntervalEnvelope(t,i,s))}}getImpl(){return this}setFromPoint(t,e,s){this.m_data.m_envelope2D.setCoords({center:t.getXY(),width:e??0,height:s??0});const i=t.getDescription();for(let n=1,r=i.getAttributeCount();n<r;n++){const e=i.getSemantics(n),s=se.getComponentCount(e);for(let i=0;i<s;i++){const s=t.getAttributeAsDbl(e,i);this.setInterval(e,i,s,s)}}}assignVertexDescriptionImpl(t){const s=S();Y(t,this.m_description,s);let i=null;const n=t.getTotalComponentCount()-2,r=this.m_description?this.m_description.getTotalComponentCount()-2:0;n>0&&(i=e(2*n,Number.NaN));for(let e=1;e<t.getAttributeCount();e++){const h=s[e];if(-1!==h){const s=t.getPointAttributeOffset(e)-2,o=se.getComponentCount(t.getSemantics(e)),a=this.m_description.getPointAttributeOffset(h)-2;m(i,this.m_data.m_attributes,s,a,o),m(i,this.m_data.m_attributes,n+s,r+a,o)}}this.releaseAttributes_(),this.m_data.m_attributes=i,this.m_description=t}getAttributeAsDblImpl(t,e,s){if(this.m_data.isEmpty()&&E(""),0===e)return t?s?this.m_data.m_envelope2D.ymax:this.m_data.m_envelope2D.xmax:s?this.m_data.m_envelope2D.ymin:this.m_data.m_envelope2D.xmin;s>=se.getComponentCount(e)&&v("");const i=this.m_description.getAttributeIndex(e);return i>=0?this.m_data.m_attributes[ie(this.m_description,t)+this.m_description.getPointAttributeOffset(i)-2+s]:z.getDefaultValue(e)}setAttributeAsDblImpl(t,e,s,i){0===e&&(t?1===s?this.m_data.m_envelope2D.ymax=i:0===s?this.m_data.m_envelope2D.xmax=i:v(""):1===s?this.m_data.m_envelope2D.ymin=i:0===s?this.m_data.m_envelope2D.xmin=i:v(""));const n=se.getComponentCount(e);(s<0||s>=n)&&v(""),this.addAttribute(e);const r=this.m_description.getAttributeIndex(e);this.m_data.m_attributes[ie(this.m_description,t)+this.m_description.getPointAttributeOffset(r)-2+s]=i}releaseAttributes_(){this.m_data.releaseAttributes()}ensureAttributes_(){this.m_data.ensureAttributes(this.m_description)}};re.type=y.enumEnvelope;const he=Object.freeze(Object.defineProperty({__proto__:null,Envelope:re,EnvelopeData:ne},Symbol.toStringTag,{value:"Module"}));export{Ut as $,st as A,ot as B,Et as C,$ as D,re as E,Wt as F,Qt as G,Rt as H,Ct as I,Tt as J,Q as K,Lt as L,Yt as M,pt as N,w as O,ee as P,Pt as Q,wt as R,at as S,ct as T,et as U,z as V,Mt as W,Ht as X,qt as Y,Jt as Z,Xt as _,zt as a,Zt as a0,Gt as a1,yt as a2,dt as a3,bt as a4,$t as a5,U as a6,he as a7,Bt as b,At as c,X as d,Ft as e,Dt as f,It as g,Vt as h,Ot as i,M as j,ne as k,H as l,V as m,G as n,B as o,S as p,Y as q,k as r,kt as s,j as t,W as u,Nt as v,O as w,nt as x,J as y,K as z};
|
|
5
|
+
import{Q as t,d as e,a as s,F as i,x as n,E as r,c as h,P as o,i as a,b as m,A as _,B as l,j as u,m as d,w as c}from"./Point2D.js";import{Envelope2D as p}from"./Envelope2D.js";import{g,a as f,q as v,G as y,t as x,u as E,d as b,p as N,i as D,f as I}from"./Geometry.js";const C=[0,0,Number.NaN,0,0,0,0,0,-1,-1,0,0,0,0],T=[2,1,1,1,3,1,2,3,2,4,1,1,2,1],R=[1,1,1,0,2,1,1,1,0,0,0,0,0,1],A=[1,1,1,2,0,0,0,0,2,2,4,2,2,1],q=[4,8,4,8,1],w=25;function B(){return e(w,Number.NaN)}let z=class s{getAttributeCount(){return this.m_attributeCount}getSemantics(t){return this.m_indexToSemantics[t]}getSemanticsBitArray(){return this.m_semanticsBitArray}getAttributeIndex(t){return this.m_semanticsToIndexMap[t]}static getInterpolation(t){return R[t]}static getPersistence(t){return A[t]}static getPersistenceSize(t){return q[t]}static getPersistenceSizeFromSemantics(t){return s.getPersistenceSize(s.getPersistence(t))*s.getComponentCount(t)}static getComponentCount(t){return T[t]}static maxComponentCount(){return 4}static isInteger(t){return 2===t||3===t||4===t}static isIntegerSemantics(t){return s.isInteger(s.getPersistence(t))}static isTexture(t){return 5===t||6===t||7===t}hasAttribute(t){return!!(this.m_semanticsBitArray&1<<t)}hasAttributesFrom(t){return(this.m_semanticsBitArray&t.m_semanticsBitArray)===t.m_semanticsBitArray}hasZ(){return this.hasAttribute(1)}hasM(){return this.hasAttribute(2)}hasID(){return this.hasAttribute(3)}getTotalComponentCount(){return this.m_totalComponentCount}static getDefaultValue(t){return C[t]}static isDefaultValue(e,s){return t(C[e],s)}equals(t){return this===t}getDefaultPointAttributes(){return this.m_defaultPointAttributes}getPointAttributeOffset(t){return this.m_pointAttributeOffsets[t]}constructor(t){this.m_semanticsBitArray=t,this.m_attributeCount=0,this.m_totalComponentCount=0,this.m_semanticsToIndexMap=new Int32Array(14),this.m_indexToSemantics=new Int32Array(14),this.m_pointAttributeOffsets=new Int32Array(14),this.m_defaultPointAttributes=e(w,Number.NaN),this.m_semanticsToIndexMap.fill(-1),this.m_indexToSemantics.fill(-1);let i=0,n=1,r=14;for(;i<r;i++)t&n&&(this.m_semanticsToIndexMap[i]=this.m_attributeCount,this.m_indexToSemantics[this.m_attributeCount]=i,this.m_attributeCount++,this.m_totalComponentCount+=s.getComponentCount(i)),n<<=1;let h=0;for(i=0,r=this.getAttributeCount();i<r;i++){const t=this.getSemantics(i),e=s.getComponentCount(t),n=s.getDefaultValue(t);this.m_pointAttributeOffsets[i]=h;for(let s=0;s<e;s++)this.m_defaultPointAttributes[h]=n,h++}}};var L=z;function S(){return e(14,0)}class F{static getInstance(){return F.s_thisInstance}constructor(){this.m_map=new Map,this.m_vd2D=new L(1),this.m_map.set(1,this.m_vd2D),this.m_vd3D=new L(3),this.m_map.set(3,this.m_vd2D)}GetVD2D(){return this.m_vd2D}GetVD3D(){return this.m_vd3D}FindOrAdd(t){if(1===t)return this.GetVD2D();if(3===t)return this.GetVD3D();const e=this.m_map.get(t);if(e)return e;const s=new L(t);return this.m_map.set(t,s),s}}function P(t){return F.getInstance().FindOrAdd(t)}function H(t,e){if(!t||!e)return e||t;const s=t.getSemanticsBitArray()|e.getSemanticsBitArray();return(s&t.getSemanticsBitArray())===s?t:(s&e.getSemanticsBitArray())===s?e:P(s)}function V(t,e){const s=t.getSemanticsBitArray()|1<<e;return(s&t.getSemanticsBitArray())===s?t:P(s)}function k(t,e){const s=(t.getSemanticsBitArray()|1<<e)-(1<<e);return s===t.getSemanticsBitArray()?t:P(s)}function M(){return F.getInstance().GetVD2D()}function O(){return F.getInstance().GetVD3D()}function Y(t,e,s){if(s.fill(-1),null!==t&&null!==e)for(let i=0,n=t.getAttributeCount();i<n;i++)s[i]=e.getAttributeIndex(t.getSemantics(i))}F.s_thisInstance=new F;class X{static construct(t,e,s){return new X(t,e,s)}constructor(t,e,s){void 0!==t?(this.x=t,this.y=e,this.z=s):this.x=this.y=this.z=Number.NaN}get 0(){return this.x}get 1(){return this.y}get 2(){return this.z}set 0(t){this.x=t}set 1(t){this.y=t}set 2(t){this.z=t}clone(){return new X(this.x,this.y,this.z)}assign(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}setCoords(t,e,s){return this.x=t,this.y=e,this.z=s,this}setCoordsPoint2DZ(t,e){return this.setCoords(t.x,t.y,e)}setCoordsPoint3D(t){this.x=t.x,this.y=t.y,this.z=t.z}setZero(){this.x=0,this.y=0,this.z=0}setNormalized(t){this.assign(t),this.normalizeThis()}normalizeThis(){const t=this.length();return t?(this.x/=t,this.y/=t,this.z/=t):(this.x=1,this.y=0,this.z=0),this}getUnitVector(){const t=new X;return t.setNormalized(this),t}sqrLength(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthXY(){return g(0),0}static sqrDistance(t,e){return s(t.x-e.x)+s(t.y-e.y)+s(t.z-e.z)}static sqrDistanceCoords(t,e,i,n,r,h){return s(t-n)+s(e-r)+s(i-h)}static distance(t,e){return Math.sqrt(X.sqrDistance(t,e))}isEqual(t,e){return void 0===e&&(e=0),Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e&&i(this.z,t.z,e)}static compareByLength(t,e,s,i){return g(0),0}isEqualCoords(t,e,s,i){return g(0),this.x===t&&this.y===e&&this.z===s}isEqualsTols(t,e,s){return g(0),!1}isEqualCoordsTols(t,e,s,i,n){return g(0),!1}static st_isEqual(t,e,s,i){return g(0),!1}equals(t,e){return this.isEqual(t,e)}equalsTols(t,e,s){return g(0),!1}divThis(t){return this.x/=t,this.y/=t,this.z/=t,this}subThis(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}setSub(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}sub(t){return X.construct(this.x-t.x,this.y-t.y,this.z-t.z)}addThis(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}add(t){return this.clone().addThis(t)}setAdd(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}mul(t){return X.construct(this.x*t,this.y*t,this.z*t)}dotProduct(t){return this.x*t.x+this.y*t.y+this.z*t.z}crossProductVector(t){const e=this.y*t.z-t.y*this.z,s=t.x*this.z-this.x*t.z,i=this.x*t.y-t.x*this.y;return new X(e,s,i)}setCrossProductVector(t,e){const s=t.y*e.z-e.y*t.z,i=e.x*t.z-t.x*e.z,n=t.x*e.y-e.x*t.y;return this.x=s,this.y=i,this.z=n,this}setScaled(t,e){return this.x=t*e.x,this.y=t*e.y,this.z=t*e.z,this}scaleThis(t){return this.x*=t,this.y*=t,this.z*=t,this}scaleZThis(t){return this.z*=t,this}setNAN(){return g(0),this}isNAN(){return Number.isNaN(this.x)||Number.isNaN(this.y)||Number.isNaN(this.z)}static getNAN(){return X.construct(Number.NaN,Number.NaN,Number.NaN)}isFinite(){return g(0),!1}isZero(){return 0===this.x&&0===this.y&&0===this.z}norm(t){return g(0),0}sqrDistanceFromCenterToSpheroidSurface(t,e){return g(0),0}distanceFromCenterToSpheroidSurface(t,e){return Math.sqrt(this.sqrDistanceFromCenterToSpheroidSurface(t,e))}static getClosestCoordinate(t,e,s,i=!1){return g(0),0}compare(t){return this.y<t.y?-1:this.y>t.y?1:this.x<t.x?-1:this.x>t.x?1:this.z<t.z?-1:this.z>t.z?1:0}compareXYZ(t){return g(0),0}negateThis(){this.x=-this.x,this.y=-this.y,this.z=-this.z}static averageFast(t,e){return g(0),{}}static average(t,e){return g(0),{}}static size(){return X.dimensions}static lerp(t,e,s){const i=new X;return n(t,e,s,i),i}static slerp(t,e,s){return g(0),{}}static compareVectors(t,e){return g(0),0}static selectRightHandedBasisFromNormal(t,e,s){const i=t.getUnitVector(),n=i.createAPerpendicular(),r=new X;r.setCrossProductVector(i,n),r.normalizeThis(),e.setCoordsPoint3D(n),s.setCoordsPoint3D(r)}createAPerpendicular(){const t=[this.crossProductVector(new X(0,0,1)),this.crossProductVector(new X(1,0,0)),this.crossProductVector(new X(0,1,0))],e=[t[0].sqrLength(),t[1].sqrLength(),t[2].sqrLength()],s=t[e.reduce(((t,s,i)=>e[t]>e[i]?t:i),0)];return s.normalizeThis(),s}calculateAngle(t){return g(0),0}static crossDotSign(t,e,s){return g(0),0}static isBisectorRobust(t,e,s){return g(0),0}static compareZOrder(t,e){return g(0),!1}}X.dimensions=3;class G{static constructEmpty(){return new G(Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN)}constructor(t,e,s,i,n,r){this.m_EnvelopeType=3,this.xmin=t,this.ymin=e,this.zmin=s,this.xmax=i,this.ymax=n,this.zmax=r,this.normalize()}inflate(t){this.inflateCoords(t,t,t)}inflateCoords(t,e,s){g(0)}getEnvelope2D(){return new p(this.xmin,this.ymin,this.xmax,this.ymax)}getEnvelopeZs(){return new r(this.zmin,this.zmax)}setEmptyZ(){this.zmin=Number.NaN,this.zmax=Number.NaN}normalize(){let t=!1;this.xmin<=this.xmax||(this.xmax=h(this.xmin,this.xmin=this.xmax),t=!0),this.ymin<=this.ymax||(this.ymax=h(this.ymin,this.ymin=this.ymax),t=!0),!t||this.xmin<=this.xmax&&this.ymin<=this.ymax?this.zmin<=this.zmax||(this.zmax=h(this.zmin,this.zmin=this.zmax),this.zmin<=this.zmax||this.setEmptyZ()):this.setEmpty()}isEmpty(){return Number.isNaN(this.xmin)||Number.isNaN(this.ymin)||Number.isNaN(this.xmax)||Number.isNaN(this.ymax)}isEmptyZ(){return Number.isNaN(this.zmin)||Number.isNaN(this.zmax)}setEmpty(){this.xmin=Number.NaN,this.ymin=Number.NaN,this.zmin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN,this.zmax=Number.NaN}mergeEnv3D(t){t.isEmpty()||(this.mergeCoords(t.xmin,t.ymin,t.zmin),this.mergeCoords(t.xmax,t.ymax,t.zmax))}mergeNe(t){this.mergeNeCoords(t.x,t.y,t.z)}mergeNeCoords(t,e,s){this.xmin>t?this.xmin=t:this.xmax<t&&(this.xmax=t),this.ymin>e?this.ymin=e:this.ymax<e&&(this.ymax=e),this.zmin>s?this.zmin=s:this.zmax<s&&(this.zmax=s)}mergeCoords(t,e,s){this.isEmpty()?(this.xmin=t,this.xmax=t,this.ymin=e,this.ymax=e,this.zmin=s,this.zmax=s):(this.isEmptyZ()&&(this.zmin=s,this.zmax=s),this.mergeNeCoords(t,e,s))}setCoords(t,e,s,i,n,r){this.xmin=t,this.ymin=e,this.zmin=s,this.xmax=i,this.ymax=n,this.zmax=r,this.normalize()}sqrDistanceEnvelope3DAndPoints(t,e,s,i=1){return g(0),0}sqrMaxDistance(t,e=1){return g(0),0}}const U=-559038737;var Z=z;function Q(t,e,s){switch(t){case 0:return new it(e,s);case 1:return new nt(e,s);case 2:return new st(e,s);case 3:throw new Error("64 bit int attribute stream not implemented");case 4:return new et(e,s);default:f("")}}function j(t,e){const s=Z.getComponentCount(t);return Q(Z.getPersistence(t),e*s,Z.getDefaultValue(t))}function W(t,e){const s=Z.getComponentCount(t);return Q(Z.getPersistence(t),e*s)}function J(t,e){return new st(t,e)}function K(t,e){return new et(t,e)}function $(t,e){return new nt(t,e)}class tt{size(){return this.m_size}checkResize(t,e){t>this.m_size&&this.resize(t,e)}resize(t,e){if((t=Math.trunc(t))===this.m_size)return;const s=!!e||Number.isNaN(e);if(t<this.m_a.length)this.m_a.length>tt.s_resizeMin&&1.25*t<this.m_a.length&&(this.m_a=this.m_a.slice(0,t)),s&&t>this.m_size&&this.m_a.fill(e,this.m_size,t);else if(t>=this.m_a.length){const i=1.25*t,n=new this.m_a.constructor(i);n.set(this.m_a),this.m_a=n,s&&this.m_a.fill(e,this.m_size,t)}this.m_size=t}resizeRounded(t,e){return this.resize(t,e)}reserve(t){}read(t){return this.m_a[t]}readAsDbl(t){return this.read(t)}write(t,e){this.m_a[t]=e}writeAsDbl(t,e){this.write(t,e)}setRange(t,e,s){(e<0||s<0||s+e>this.size())&&f(),this.m_a.fill(t,e,e+s)}add(t){this.resize(this.m_size+1),this.m_a[this.m_size-1]=t}addArray(t,e){const s=this.m_size;void 0===e?(this.resize(this.m_size+t.length),this.m_a.set(t,s)):(this.resize(this.m_size+e),this.m_a.set(t.slice(0,e),s))}equals(t,e,s,i){if(this.getPersistence()!==t.getPersistence())return!1;return rt(this,t,e,s,i)}insertRange(t,e,s,i){const n=this.m_size;this.checkResize(Math.max(0,i)+s),this.m_a.copyWithin(t+s,t,i>=0?i:n),this.m_a.fill(e,t,t+s)}readRange(t,e){return this.m_a.slice(t,t+e)}insertRangeFromStream(t,e,s,i,n,r,h){g(this.getPersistence()===e.getPersistence());const o=e,a=this.m_size;i&&this.checkResize(Math.max(0,h)+i),this.m_a.copyWithin(t+i,t,h>=0?h:a),this.m_a.set(o.readRange(s,i),t),n||this.reverseRange(t,i,r)}writeRange(t,e,s,i,n,r){g(this.getPersistence()===s.getPersistence());const h=s;if((t<0||e<0||i<0)&&f(),h.size()<i+e&&f(),0===e)return;this.size()<e+t&&this.resize(e+t);const o=h.m_a.subarray(i,i+e);ht(this.m_a,t,e,o)}insertAttributes(t,e,s,i){const n=Z.getComponentCount(s);this.m_a.copyWithin(t+n,t,i>=0?i:this.m_size);for(let r=0;r<n;r++)this.m_a[t+r]=e.getAttributeAsDbl(s,r)}insertAttributesFromPoints(t,e,s,i,n){g(Z.getPersistence(i)===this.getPersistence());const r=Z.getComponentCount(i),h=this.m_size;if(this.checkResize(Math.max(0,n)+r*s),this.m_a.copyWithin(t+r*s,t,n>=0?n:h),0===i){const i=new o;for(let n=t,r=0;r<s;r++,n+=2)e[r].queryXY(i),this.m_a[n]=i.x,this.m_a[n+1]=i.y}else if(1===r)for(let o=t,a=0;a<s;a++,o++)this.m_a[o]=e[a].getAttributeAsDbl(i,0);else for(let o=t,a=0;a<s;a++,o+=r)for(let t=0;t<r;t++)this.m_a[o+t]=e[a].getAttributeAsDbl(i,t)}eraseRange(t,e,s){this.m_size<t+e&&f(),this.m_a.copyWithin(t,t+e),this.m_size-=e}reverseRange(t,e,s){if((s<1||e%s!==0)&&f(),this.m_a.subarray(t,t+e).reverse(),s>1)for(let i=t,n=t+e;i<n;i+=s){let t=i,e=i+s-1;for(;t<e;){const s=this.m_a[t];this.m_a[t]=this.m_a[e],this.m_a[e]=s,t++,e--}}}rotate(t,e,s){(e<t||e>s||t>s)&&v("rotate"),e!==t&&e!==s&&(this.reverseRange(t,e-t,1),this.reverseRange(e,s-e,1),this.reverseRange(t,s-t,1))}sort(t,e,s){this.m_a.subarray(t,e).sort(s)}constructor(t){if(t.move)this.m_a=t.move.m_a,this.m_size=t.move.m_size,t.move.m_a=t.move.m_a.slice(0,0),t.move.m_size=0;else if(t.copy)this.m_size=t.copy.m_size,t.maxSize&&(this.m_size=Math.min(t.maxSize,this.m_size)),this.m_a=t.copy.m_a.slice(0,this.m_size);else{const e=Math.max(t.size,tt.s_constructMin);this.m_a=new t.ctor(e),(t.defaultValue||Number.isNaN(t.defaultValue))&&this.m_a.fill(t.defaultValue),this.m_size=t.size}}}tt.s_constructMin=2,tt.s_resizeMin=30;class et extends tt{setBits(t,e){this.m_a[t]|=e}clearBits(t,e){this.m_a[t]&=~e}getPersistence(){return 4}clone(){return new et({ctor:Int8Array,copy:this})}restrictedClone(t){return new et({ctor:Int8Array,copy:this,maxSize:t})}constructor(t,e){super("number"==typeof t?{ctor:Int8Array,size:t,defaultValue:e}:t)}}class st extends tt{getPersistence(){return 2}clone(){return new st({ctor:Int32Array,copy:this})}restrictedClone(t){return new st({ctor:Int32Array,copy:this,maxSize:t})}write(t,e){g(e<=a()),super.write(t,e)}constructor(t,e){super("number"==typeof t?{ctor:Int32Array,size:t,defaultValue:e}:t)}}class it extends tt{getPersistence(){return 0}clone(){return new it({ctor:Float32Array,copy:this})}restrictedClone(t){return new it({ctor:Float32Array,copy:this,maxSize:t})}constructor(t,e){super("number"==typeof t?{ctor:Float32Array,size:t,defaultValue:e}:t)}}class nt extends tt{getPersistence(){return 1}getArray(){return this.m_a}applyTransformation(t,e,s){(1&e||e+2*s>this.size())&&f();const i=0===e?this.m_a:this.m_a.subarray(e);t.transformInterleavedPoints(i,s,i)}readPoint2D(t){const e=this.m_a[t],s=this.m_a[t+1];return new o(e,s)}queryPoint2D(t,e){return e.x=this.m_a[t],e.y=this.m_a[t+1],e}writePoint2D(t,e){this.write(t,e.x),this.write(t+1,e.y)}insert(t,e,s){this.checkResize(s+2),this.m_a.copyWithin(t+2,t,s),this.m_a[t]=e.x,this.m_a[t+1]=e.y}insertRangeFromPoints(t,e,s,i,n,r){const h=this.m_size;if(this.checkResize(Math.max(r,0)+2*i),this.m_a.copyWithin(t+2*i,t,r>=0?r:h),n)for(let o=s,a=t,m=0;m<i;++m,++o){const t=e[o];this.m_a[a++]=t.x,this.m_a[a++]=t.y}else for(let o=s+i-1,a=t,m=0;m<i;++m,--o){const t=e[o];this.m_a[a++]=t.x,this.m_a[a++]=t.y}}queryRange(t,e,s,i,n){if((t<0||e<0)&&f(),!i&&(n<=0||e%n!==0)&&f(),0===e)return;if(1===e)return void(s[0]=this.m_a[t]);const r=this.m_a.subarray(t,t+e);s.set(r)}writeRangeFromArray(t,e,s,i,n){if((t<0||e<0)&&f(),0===e)return;if(1===e)return void(this.m_a[t]=s[0]);let r=s;e<s.length&&(r=s.subarray(0,e)),this.m_a.set(r,t)}clone(){return new nt({ctor:Float64Array,copy:this})}restrictedClone(t){return new nt({ctor:Float64Array,copy:this,maxSize:t})}constructor(t,e){super("number"==typeof t?{ctor:Float64Array,size:t,defaultValue:e}:t)}}function rt(t,e,s,n,r){if(t.getPersistence()!==e.getPersistence())return!1;const h=t.getPersistence()<=1,o=t.size(),a=e.size();if(n>o||n>a)return!1;if(r)if(h){for(let m=s;m<n;m++)if(!i(t.read(m),e.read(m),r))return!1}else for(let i=s;i<n;i++){let s=t.read(i)-e.read(i);if(s<0&&(s=-s),s>r)return!1}else for(let i=s;i<n;i++){const s=t.read(i),n=e.read(i);if(s!==n){if(h&&Number.isNaN(s)&&Number.isNaN(n))continue;return!1}}return!0}function ht(t,e,s,i,n,r){if((e<0||s<0)&&f(),0===s)return;if(1===s)return void(t[e]=i[0]);let h=i;s<i.length&&(h=i.subarray(0,s)),t.set(h,e)}class ot{constructor(){this.m_minValue=-1,this.m_maxValue=-1,this.m_dy=Number.NaN,this.m_buckets=new st(0),this.m_bucketedIndices=new st(0)}static sortEx(t,e,s,i,n=32){if(s-e<=n)return void i.userSort(e,s,t);(new ot).sort(t,e,s,i,n)}sort(t,e,s,i,n=32){if(s-e<=n)return void i.userSort(e,s,t);let r=!0,h=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let m=e;m<s;m++){const e=i.getValue(t.read(m));e<h&&(h=e),e>o&&(o=e)}if(this.reset(s-e,h,o,s-e)){for(let r=e;r<s;r++){const s=t.read(r),n=i.getValue(s),h=this.getBucket(n);this.m_buckets.write(h,this.m_buckets.read(h)+1),this.m_bucketedIndices.write(r-e,s)}let n=this.m_buckets.read(0);this.m_buckets.write(0,0);for(let t=1,e=this.m_buckets.size();t<e;t++){const e=this.m_buckets.read(t);this.m_buckets.write(t,n),n+=e}for(let r=e;r<s;r++){const s=this.m_bucketedIndices.read(r-e),n=i.getValue(s),h=this.getBucket(n),o=this.m_buckets.read(h);t.write(o+e,s),this.m_buckets.write(h,o+1)}r=!1}if(r)return void i.userSort(e,s,t);let a=0;for(let m=0,_=this.m_buckets.size();m<_;m++){const s=a;a=this.m_buckets.read(m),a>s&&i.userSort(e+s,e+a,t)}this.m_buckets.size()>100&&(this.m_buckets.resize(0),this.m_bucketedIndices.resize(0))}reset(t,e,s,i){if(t<2||s===e)return!1;const n=Math.min(ot.c_maxBuckets,t);return this.m_buckets.resize(n),this.m_buckets.setRange(0,0,this.m_buckets.size()),this.m_minValue=e,this.m_maxValue=s,this.m_bucketedIndices.resize(i),this.m_dy=(s-e)/(n-1),!0}getBucket(t){return Math.trunc((t-this.m_minValue)/this.m_dy)}getBucketCount(){return this.m_buckets.size()}}ot.c_maxBuckets=65536;class at{capacity(){return this.capacity_}constructor(t){this.m_buffer=new Int32Array(0),this.m_firstFree=-1,this.m_last=0,this.size_=0,this.capacity_=0,this.stride=t}size(){return this.size_}deleteElement(t){t<this.m_last?(this.m_buffer[t*this.stride]=this.m_firstFree,this.m_firstFree=t):this.m_last--,this.size_--}getField(t,e){return this.m_buffer[t*this.stride+e]}setField(t,e,s){this.m_buffer[t*this.stride+e]=s}elementToIndex(t){return t}newElement(){let t=this.m_firstFree;if(-1===t){if(this.m_last===this.capacity_){let t=0!==this.capacity_?Math.trunc(3*(this.capacity_+1)/2):1;if(t>Number.MAX_SAFE_INTEGER&&(t=Number.MAX_SAFE_INTEGER),t===this.capacity_)throw new Error("index out of bounds");this.grow_(t)}t=this.m_last,this.m_last++}else this.m_firstFree=this.m_buffer[t*this.stride];this.size_++;for(let e=t*this.stride;e<t*this.stride+this.stride;e++)this.m_buffer[e]=-1;return t}newElementPset(t){let e=this.m_firstFree;if(-1===e){if(this.m_last===this.capacity_){let t=0!==this.capacity_?Math.trunc(3*(this.capacity_+1)/2):1;if(t>Number.MAX_SAFE_INTEGER&&(t=Number.MAX_SAFE_INTEGER),t===this.capacity_)throw new Error("index out of bounds");this.grow_(t)}e=this.m_last,this.m_last++}else this.m_firstFree=this.m_buffer[e*this.stride];this.size_++;const s=e*this.stride;for(let i=0;i<t.length;i++)this.m_buffer[s+i]=t[i];return e}deleteAll(t){this.m_firstFree=-1,this.m_last=0,this.size_=0,t&&(this.m_buffer=new Int32Array(0),this.capacity_=0)}setCapacity(t){t>this.capacity_&&this.grow_(t)}swap(t,e){const s=t*this.stride,i=e*this.stride;for(let n=0;n<this.stride;n++){const t=this.m_buffer[i+n];this.m_buffer[i+n]=this.m_buffer[s+n],this.m_buffer[s+n]=t}}swapField(t,e,s){const i=this.m_buffer[this.stride*e+s];this.m_buffer[this.stride*e+s]=this.m_buffer[this.stride*t+s],this.m_buffer[this.stride*t+s]=i}static impossibleIndex2(){return-2}static impossibleIndex3(){return-3}static isValidElement(t){return t>=0}grow_(t){null==this.m_buffer&&(this.m_buffer=new Int32Array(0));const e=this.stride*t,s=new Int32Array(e);s.set(this.m_buffer,0),this.m_buffer=s,this.capacity_=t}}function mt(t,e){return{element:t,box:e.clone()}}class _t{constructor(t,e,s){this.m_extent=new p,this.m_dataExtent=new p,this.m_childExtents=[new p,new p,new p,new p],this.m_elementNodes=new at(4),this.m_data=[],this.m_freeData=[],this.m_root=-1,this.m_height=8,void 0===s&&(s=!1),this.m_quadTreeNodes=new at(s?11:10),this.m_bStoreDuplicates=s,this.reset_(t,e)}reset(t,e){this.m_quadTreeNodes.deleteAll(!1),this.m_elementNodes.deleteAll(!1),this.m_data.length=0,this.m_freeData.length=0,this.reset_(t,e)}insert(t,e){if(-1===this.m_root&&this.createRoot_(),this.m_bStoreDuplicates){const s=this.insertDuplicates_(t,e,0,this.m_extent,this.m_root,!1,-1);return-1!==s&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),s}const s=this.insert_(t,e,0,this.m_extent,this.m_root,!1,-1);return-1!==s&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),s}insertEx(t,e,s){if(-1===this.m_root&&this.createRoot_(),this.m_bStoreDuplicates){const s=this.insertDuplicates_(t,e,0,this.m_extent,this.m_root,!1,-1);return-1!==s&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),s}let i;i=-1===s?this.m_root:this.getQuad_(s);const n=this.getHeight(i),r=this.getExtent(i),h=this.insert_(t,e,n,r,i,!1,-1);return-1!==h&&(this.m_dataExtent.isEmpty()?this.m_dataExtent.setCoords({env2D:e}):this.m_dataExtent.mergeEnvelope2D(e)),h}removeElement(t){g(0)}getElement(t){return this.getElementValue_(this.getData_(t))}getElementAtIndex(t){return g(0),0}getElementExtent(t){const e=this.getData_(t);return this.getBoundingBoxValue_(e).clone()}getElementExtentAtIndex(t){return g(0),{}}getDataExtent(){return this.m_dataExtent.clone()}getQuadTreeExtent(){return g(0),{}}getHeight(t){return this.m_quadTreeNodes.getField(t,6)>>_t.m_heightBitShift}getMaxHeight(){return this.m_height}getExtent(t){const e=new p;if(e.setCoords({env2D:this.m_extent}),t===this.m_root)return e;const s=[];let i=t;do{s.push(this.getQuadrant_(i)),i=this.getParent_(i)}while(i!==this.m_root);const n=s.length;for(let r=0;r<n;r++){const t=s.at(-1);s.pop(),0===t?(e.xmin=.5*(e.xmin+e.xmax),e.ymin=.5*(e.ymin+e.ymax)):1===t?(e.xmax=.5*(e.xmin+e.xmax),e.ymin=.5*(e.ymin+e.ymax)):2===t?(e.xmax=.5*(e.xmin+e.xmax),e.ymax=.5*(e.ymin+e.ymax)):(e.xmin=.5*(e.xmin+e.xmax),e.ymax=.5*(e.ymin+e.ymax))}return e}getQuad(t){return this.getQuad_(t)}getElementCount(){return-1===this.m_root?0:this.getSubTreeElementCount_(this.m_root)}getSubTreeElementCount(t){return this.getSubTreeElementCount_(t)}getContainedSubTreeElementCount(t){return this.m_bStoreDuplicates?this.getContainedSubTreeElementCount_(t):this.getSubTreeElementCount_(t)}getIntersectionCount(t,e,s){if(-1===this.m_root)return 0;const i=new p;i.setCoords({env2D:t}),i.inflateCoords(e,e);const n=[],r=[];n.push(this.m_root),r.push(this.m_extent.clone());const h=d(p,4);let o=0;for(;n.length>0;){let t=!1;const e=n.at(-1),a=r.at(-1);if(n.pop(),r.pop(),i.containsEnvelope(a)){if(o+=this.getSubTreeElementCount(e),s>0&&o>=s)return s}else if(i.isIntersecting(a)){for(let t=this.getFirstElement_(e);-1!==t;t=this.getNextElement_(t)){const e=this.getData_(t);if(this.getBoundingBoxValue_(e).isIntersecting(i)&&(o++,s>0&&o>=s))return s}t=this.getHeight(e)+1<=this.m_height}if(t){_t.setChildExtents_(a,h);for(let t=0;t<4;t++){const s=this.getChild_(e,t);if(-1!==s&&this.getSubTreeElementCount_(s)>0){i.isIntersecting(h[t])&&(n.push(s),r.push(h[t].clone()))}}}}return o}hasData(t,e){return this.getIntersectionCount(t,e,1)>=1}getIterator(t,e){return new lt(this,t,e)}getIteratorForQT(){return new lt(this)}getSortedIterator(t,e){return new ut(this.getIterator(t,e))}getSortedIteratorForQT(){return new ut(this.getIteratorForQT())}visitLeavesNearest(t,e,s,i){g(0)}reset_(t,e){(e<0||e>127)&&f("invalid height"),this.m_height=e,this.m_extent.setCoords({env2D:t}),this.m_dataExtent.setEmpty(),this.m_root=-1}insert_(t,e,s,i,n,r,h){if(!i.containsEnvelope(e))return 0===s?-1:this.insert_(t,e,0,this.m_extent,this.m_root,r,h);if(!r)for(let _=n;-1!==_;_=this.getParent_(_))this.setSubTreeElementCount_(_,this.getSubTreeElementCount_(_)+1);const o=new p;o.setCoords({env2D:i});let a,m=n;for(a=s;a<this.m_height&&this.canPushDown_(m);a++){_t.setChildExtents_(o,this.m_childExtents);let t=!1;for(let s=0;s<4;s++)if(this.m_childExtents[s].containsEnvelope(e)){t=!0;let e=this.getChild_(m,s);-1===e&&(e=this.createChild_(m,s)),this.setSubTreeElementCount_(e,this.getSubTreeElementCount_(e)+1),m=e,o.setCoords({env2D:this.m_childExtents[s]});break}if(!t)break}return this.insertAtQuad_(t,e,a,o,m,r,n,h,-1)}insertDuplicates_(t,e,s,i,n,r,h){if(!r){if(!i.containsEnvelope(e))return-1;this.setSubTreeElementCount_(n,this.getSubTreeElementCount_(n)+1),this.setContainedSubTreeElementCount_(n,this.getContainedSubTreeElementCount_(n)+1)}const o=Math.max(e.width(),e.height());let a=-1;const m=[],_=[],l=[];m.push(n),_.push(i.clone()),l.push(s);const u=d(p,4);for(;m.length>0;){let s=!1;const i=m.at(-1),d=_.at(-1),c=l.at(-1);if(m.pop(),_.pop(),l.pop(),c+1<this.m_height&&this.canPushDown_(i)){o<=Math.max(d.width(),d.height())/2&&(s=!0)}if(s){_t.setChildExtents_(d,u);let t=!1;for(let s=0;s<4;s++)if(t=u[s].containsEnvelope(e),t){let t=this.getChild_(i,s);-1===t&&(t=this.createChild_(i,s)),m.push(t),_.push(u[s].clone()),l.push(c+1),this.setSubTreeElementCount_(t,this.getSubTreeElementCount_(t)+1),this.setContainedSubTreeElementCount_(t,this.getContainedSubTreeElementCount_(t)+1);break}if(!t)for(let s=0;s<4;s++){if(u[s].isIntersecting(e)){let t=this.getChild_(i,s);-1===t&&(t=this.createChild_(i,s)),m.push(t),_.push(u[s].clone()),l.push(c+1),this.setSubTreeElementCount_(t,this.getSubTreeElementCount_(t)+1)}}}else a=this.insertAtQuad_(t,e,c,d,i,r,n,h,a),r=!1}return 0}insertAtQuad_(t,e,s,i,n,r,h,o,a){this.getFirstElement_(n);const m=this.getLastElement_(n);let _=-1;if(r){if(n===h)return o;this.disconnectElementHandle_(o),_=o}else-1===a?(_=this.createElement_(),this.setDataValues_(this.getData_(_),t,e)):_=this.createElementFromDuplicate_(a);return this.setQuad_(_,n),-1!==m?(this.setPrevElement_(_,m),this.setNextElement_(m,_)):this.setFirstElement_(n,_),this.setLastElement_(n,_),this.setLocalElementCount_(n,this.getLocalElementCount_(n)+1),this.canFlush_(n)&&this.flush_(s,i,n),_}static setChildExtents_(t,e){const s=.5*(t.xmin+t.xmax),i=.5*(t.ymin+t.ymax);e[0].setCoords({xmin:s,ymin:i,xmax:t.xmax,ymax:t.ymax}),e[1].setCoords({xmin:t.xmin,ymin:i,xmax:s,ymax:t.ymax}),e[2].setCoords({xmin:t.xmin,ymin:t.ymin,xmax:s,ymax:i}),e[3].setCoords({xmin:s,ymin:t.ymin,xmax:t.xmax,ymax:i})}disconnectElementHandle_(t){const e=this.getQuad_(t),s=this.getFirstElement_(e),i=this.getLastElement_(e),n=this.getPrevElement_(t),r=this.getNextElement_(t);s===t?(-1!==r?this.setPrevElement_(r,-1):this.setLastElement_(e,-1),this.setFirstElement_(e,r)):i===t?(this.setNextElement_(n,-1),this.setLastElement_(e,n)):(this.setPrevElement_(r,n),this.setNextElement_(n,r)),this.setPrevElement_(t,-1),this.setNextElement_(t,-1),this.setLocalElementCount_(e,this.getLocalElementCount_(e)-1)}canFlush_(t){return this.getLocalElementCount_(t)===_t.m_flushingCount&&!this.hasChildren_(t)}flush_(t,e,s){let i;const n=new p;let r=this.getFirstElement_(s),h=-1,o=-1;do{o=this.getData_(r),i=this.getElementValue_(o),n.setCoords({env2D:this.getBoundingBoxValue_(o)}),h=this.getNextElement_(r),this.m_bStoreDuplicates?this.insertDuplicates_(i,n,t,e,s,!0,r):this.insert_(i,n,t,e,s,!0,r),r=h}while(-1!==r)}canPushDown_(t){return this.getLocalElementCount_(t)>=_t.m_flushingCount||this.hasChildren_(t)}hasChildren_(t){return-1!==this.getChild_(t,0)||-1!==this.getChild_(t,1)||-1!==this.getChild_(t,2)||-1!==this.getChild_(t,3)}createChild_(t,e){const s=this.m_quadTreeNodes.newElement();return this.setChild_(t,e,s),this.setSubTreeElementCount_(s,0),this.setLocalElementCount_(s,0),this.setParent_(s,t),this.setHeightAndQuadrant_(s,this.getHeight_(t)+1,e),this.m_bStoreDuplicates&&this.setContainedSubTreeElementCount_(s,0),s}createRoot_(){this.m_root=this.m_quadTreeNodes.newElement(),this.setSubTreeElementCount_(this.m_root,0),this.setLocalElementCount_(this.m_root,0),this.setHeightAndQuadrant_(this.m_root,0,0),this.m_bStoreDuplicates&&this.setContainedSubTreeElementCount_(this.m_root,0)}createElement_(){const t=this.m_elementNodes.newElement();let e;return this.m_freeData.length>0?(e=this.m_freeData.at(-1),this.m_freeData.pop()):(e=this.m_data.length,this.m_data.length=e+1),this.setData_(t,e),t}createElementFromDuplicate_(t){const e=this.m_elementNodes.newElement(),s=this.getData_(t);return this.setData_(e,s),e}freeElementAndBoxNode_(t){g(0)}getChild_(t,e){return this.m_quadTreeNodes.getField(t,e)}setChild_(t,e,s){this.m_quadTreeNodes.setField(t,e,s)}getFirstElement_(t){return this.m_quadTreeNodes.getField(t,4)}setFirstElement_(t,e){this.m_quadTreeNodes.setField(t,4,e)}getLastElement_(t){return this.m_quadTreeNodes.getField(t,5)}setLastElement_(t,e){this.m_quadTreeNodes.setField(t,5,e)}getQuadrant_(t){return this.m_quadTreeNodes.getField(t,6)&_t.m_quadrantMask}getHeight_(t){return this.m_quadTreeNodes.getField(t,6)>>_t.m_heightBitShift}setHeightAndQuadrant_(t,e,s){const i=e<<_t.m_heightBitShift|s;this.m_quadTreeNodes.setField(t,6,i)}getLocalElementCount_(t){return this.m_quadTreeNodes.getField(t,7)}setLocalElementCount_(t,e){this.m_quadTreeNodes.setField(t,7,e)}getSubTreeElementCount_(t){return this.m_quadTreeNodes.getField(t,8)}setSubTreeElementCount_(t,e){this.m_quadTreeNodes.setField(t,8,e)}getParent_(t){return this.m_quadTreeNodes.getField(t,9)}setParent_(t,e){this.m_quadTreeNodes.setField(t,9,e)}getContainedSubTreeElementCount_(t){return this.m_quadTreeNodes.getField(t,10)}setContainedSubTreeElementCount_(t,e){this.m_quadTreeNodes.setField(t,10,e)}getData_(t){return this.m_elementNodes.getField(t,0)}setData_(t,e){this.m_elementNodes.setField(t,0,e)}getPrevElement_(t){return this.m_elementNodes.getField(t,1)}getNextElement_(t){return this.m_elementNodes.getField(t,2)}setPrevElement_(t,e){this.m_elementNodes.setField(t,1,e)}setNextElement_(t,e){this.m_elementNodes.setField(t,2,e)}getQuad_(t){return this.m_elementNodes.getField(t,3)}setQuad_(t,e){this.m_elementNodes.setField(t,3,e)}getElementValue_(t){return this.m_data[t].element}getBoundingBoxValue_(t){return this.m_data[t].box}setDataValues_(t,e,s){this.m_data[t]=mt(e,s)}}_t.m_quadrantMask=3,_t.m_heightBitShift=2,_t.m_flushingCount=5;class lt{constructor(t,e,s){this.m_bLinear=!1,this.m_queryStart=new o,this.m_queryEnd=new o,this.m_queryBox=new p,this.m_tolerance=0,this.m_currentElementHandle=-1,this.m_nextElementHandle=-1,this.m_quadsStack=[],this.m_extentsStack=[],this.m_childExtents=[new p,new p,new p,new p],this.m_quadTree=t,e&&this.resetIterator(e,s)}resetIterator(t,e){if(void 0===e&&(e=0),t instanceof p)return this.m_quadsStack.length=0,this.m_extentsStack.length=0,this.m_currentElementHandle=-1,this.m_queryBox.setCoords({env2D:t}),this.m_queryBox.inflateCoords(e,e),this.m_tolerance=Number.NaN,void(-1!==this.m_quadTree.m_root&&this.m_queryBox.isIntersecting(this.m_quadTree.m_extent)?(this.m_quadsStack.push(this.m_quadTree.m_root),this.m_extentsStack.push(this.m_quadTree.m_extent.clone()),this.m_nextElementHandle=this.m_quadTree.getFirstElement_(this.m_quadTree.m_root),this.m_bLinear=!1):this.m_nextElementHandle=-1);if(this.m_quadsStack.length=0,this.m_extentsStack.length=0,this.m_currentElementHandle=-1,t.queryLooseEnvelope(this.m_queryBox),this.m_queryBox.inflateCoords(e,e),-1!==this.m_quadTree.m_root&&this.m_queryBox.isIntersecting(this.m_quadTree.m_extent)){const s=t.getGeometryType();if(this.m_bLinear=s===y.enumLine,this.m_bLinear){const s=t;this.m_queryStart.assign(s.getStartXY()),this.m_queryEnd.assign(s.getEndXY()),this.m_tolerance=e}else this.m_tolerance=Number.NaN;this.m_quadsStack.push(this.m_quadTree.m_root),this.m_extentsStack.push(this.m_quadTree.m_extent.clone()),this.m_nextElementHandle=this.m_quadTree.getFirstElement_(this.m_quadTree.m_root)}else this.m_nextElementHandle=-1}next(){if(0===this.m_quadsStack.length)return-1;this.m_currentElementHandle=this.m_nextElementHandle;const t=new o,e=new o,s=new p;let i=!1;for(;!i;){for(;-1!==this.m_currentElementHandle;){const n=this.m_quadTree.getData_(this.m_currentElementHandle);if(s.setCoords({env2D:this.m_quadTree.getBoundingBoxValue_(n)}),s.isIntersecting(this.m_queryBox)){if(!this.m_bLinear){i=!0;break}if(t.setCoordsPoint2D(this.m_queryStart),e.setCoordsPoint2D(this.m_queryEnd),s.inflateCoords(this.m_tolerance,this.m_tolerance),s.clipLine(t,e)>0){i=!0;break}}this.m_currentElementHandle=this.m_quadTree.getNextElement_(this.m_currentElementHandle)}if(-1===this.m_currentElementHandle){const s=this.m_quadsStack.at(-1),i=this.m_extentsStack.at(-1);_t.setChildExtents_(i,this.m_childExtents),this.m_quadsStack.pop(),this.m_extentsStack.pop();for(let n=0;n<4;n++){const i=this.m_quadTree.getChild_(s,n);if(-1!==i&&this.m_quadTree.getSubTreeElementCount(i)>0&&this.m_childExtents[n].isIntersecting(this.m_queryBox))if(this.m_bLinear){t.setCoordsPoint2D(this.m_queryStart),e.setCoordsPoint2D(this.m_queryEnd);const s=new p;s.setCoords({env2D:this.m_childExtents[n]}),s.inflateCoords(this.m_tolerance,this.m_tolerance),s.clipLine(t,e)>0&&(this.m_quadsStack.push(i),this.m_extentsStack.push(this.m_childExtents[n].clone()))}else this.m_quadsStack.push(i),this.m_extentsStack.push(this.m_childExtents[n].clone())}if(0===this.m_quadsStack.length)return-1;this.m_currentElementHandle=this.m_quadTree.getFirstElement_(this.m_quadsStack.at(-1))}}return this.m_nextElementHandle=this.m_quadTree.getNextElement_(this.m_currentElementHandle),this.m_currentElementHandle}clone(){return g(0),{}}}class ut{constructor(t){this.m_bucketSort=new ot,this.m_sortedHandles=new st(0),this.m_index=-1,this.m_quadTreeIteratorImpl=t}resetIterator(t,e){this.m_quadTreeIteratorImpl.resetIterator(t,e),this.m_sortedHandles.resize(0),this.m_index=-1}next(){if(-1===this.m_index){let t=-1;for(;-1!==(t=this.m_quadTreeIteratorImpl.next());)this.m_sortedHandles.add(t);const e=this,s={userSort(t,s,i){i.sort(t,s,((t,s)=>e.m_quadTreeIteratorImpl.m_quadTree.getElement(t)-e.m_quadTreeIteratorImpl.m_quadTree.getElement(s)))},getValue:t=>e.m_quadTreeIteratorImpl.m_quadTree.getElement(t)};this.m_bucketSort.sort(this.m_sortedHandles,0,this.m_sortedHandles.size(),s)}return this.m_index===this.m_sortedHandles.size()-1?-1:(this.m_index++,this.m_sortedHandles.read(this.m_index))}clone(){return g(0),{}}}class dt{constructor(t=!1){this.m_bNotifyOnActions=t}onDelete(t){}onSet(t){}onEndSearch(t){}onAddUniqueElementFailed(t){}onDeleteImpl(t,e){this.m_bNotifyOnActions&&this.onDelete(t.getElement(e))}onSetImpl(t,e){this.m_bNotifyOnActions&&this.onSet(t.getElement(e))}onAddUniqueElementFailedImpl(t){this.m_bNotifyOnActions&&this.onAddUniqueElementFailed(t)}onEndSearchImpl(t){this.m_bNotifyOnActions&&this.onEndSearch(t)}}class ct{static st_nullNode(){return-1}constructor(){this.m_defaultTreap=-1,this.m_random=124234251,this.m_comparator=null,this.m_treapData=new at(7),this.m_treapCount=0,this.m_maxDepthEver=0,this.m_bBalancing=!0}setComparator(t){this.m_comparator=t}getComparator(){return this.m_comparator}disableBalancing(){this.m_bBalancing=!1}enableBalancing(){this.m_bBalancing||(g(this.m_treapCount<=1),this.rebalance(-1),this.m_bBalancing=!0)}isAutoBalancing(){return this.m_bBalancing}rebalance(t){if(this.m_bBalancing)return;if(-1===t&&(t=this.m_defaultTreap),0===this.size(t))return;const e=[];for(let s=this.getFirst(t);-1!==s;s=this.getNext(s))e.push(s),this.setParent_(s,-1),this.setRight_(s,-1),this.setLeft_(s,-1);this.setRoot_(-1,t),this.setFirst_(-1,t),this.setLast_(-1,t),this.setSize_(0,t),this.m_bBalancing=!0;for(const s of e)this.addBiggestElement_(s,t);this.m_bBalancing=!1}setCapacity(t){this.m_treapData.setCapacity(t)}createTreap(t){const e=this.m_treapData.newElement();return this.setSize_(0,e),this.setTreapData_(t,e),this.m_treapCount++,e}deleteTreap(t){this.m_treapData.deleteElement(t),this.m_treapCount--}addElement(t,e=-1){return-1===e&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),e=this.m_defaultTreap),this.addElement_(t,0,e)}addUniqueElement(t,e=-1){return-1===e&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),e=this.m_defaultTreap),this.addElement_(t,1,e)}addBiggestElement(t,e=-1){-1===e&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),e=this.m_defaultTreap);const s=this.newNode_(t);return this.addBiggestElement_(s,e),s}addElementAtPosition(t,e,s,i,n,r=-1){if(-1===r&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),r=this.m_defaultTreap),this.getRoot_(r)===ct.st_nullNode()){const t=this.newNode_(s);return this.setRoot_(t,r),this.addToList_(-1,t,r),t}let h,o,a,m,_;if(n?(h=e!==ct.st_nullNode()?this.m_comparator.compare(this,s,e):-1,o=t!==ct.st_nullNode()?this.m_comparator.compare(this,s,t):1):(h=-1,o=1),i&&(0===h||0===o)){this.m_comparator.onAddUniqueElementFailedImpl(s);const i=0===h?e:t;return this.setDuplicateElement_(i,r),-1}_=e!==ct.st_nullNode()&&t!==ct.st_nullNode()?this.m_random>l(this.m_random)>>1:e!==ct.st_nullNode(),_?(m=h,a=e):(m=o,a=t);let u=-1,d=-1,c=!0;for(;;){if(m<0){const t=this.getLeft(a);if(t===ct.st_nullNode()){d=a,u=this.newNode_(s),this.setLeft_(a,u),this.setParent_(u,a);break}a=t}else{const t=this.getRight(a);if(t===ct.st_nullNode()){d=this.getNext(a),u=this.newNode_(s),this.setRight_(a,u),this.setParent_(u,a);break}a=t}c&&(m*=-1,c=!1)}return this.bubbleUp_(u),this.getParent(u)===ct.st_nullNode()&&this.setRoot_(u,r),this.addToList_(d,u,r),u}replaceElementAtPosition(t,e,s,i,n=-1){if(i){const i=this.getNext(t);let r=-1;i!==ct.st_nullNode()&&(r=this.m_comparator.compare(this,e,i));const h=this.getPrev(t);let o=-1;if(h!==ct.st_nullNode()&&(o=this.m_comparator.compare(this,e,h)),s&&(0===r||0===o)){this.m_comparator.onAddUniqueElementFailedImpl(e);const t=0===r?i:h;return n===ct.st_nullNode()&&(this.m_defaultTreap===ct.st_nullNode()&&(this.m_defaultTreap=this.createTreap(-1)),n=this.m_defaultTreap),this.setDuplicateElement_(t,n),-1}}return this.setElement_(t,e),t}getDuplicateElement(t=-1){return-1===t?this.getDuplicateElement_(this.m_defaultTreap):this.getDuplicateElement_(t)}deleteNode(t,e=-1){this.m_comparator&&this.m_comparator.onDeleteImpl(this,t),-1===e&&(e=this.m_defaultTreap),this.m_bBalancing?this.deleteNode_(t,e):this.unbalancedDelete_(t,e)}search(t,e=-1){let s=this.getRoot(e);for(;s!==ct.st_nullNode();){const e=this.m_comparator.compare(this,t,s);if(!e)return s;s=e<0?this.getLeft(s):this.getRight(s)}return this.m_comparator.onEndSearchImpl(t),ct.st_nullNode()}searchLowerBound(t,e=-1){let s=this.getRoot(e),i=-1;for(;s!==ct.st_nullNode();){const e=t.compare(this,s);if(!e)return s;e<0?s=this.getLeft(s):(i=s,s=this.getRight(s))}return i}searchUpperBound(t,e=-1){let s=this.getRoot(e),i=-1;for(;s!==ct.st_nullNode();){const e=t.compare(this,s);if(!e)return s;e<0?(i=s,s=this.getLeft(s)):s=this.getRight(s)}return i}getElement(t){return this.m_treapData.getField(t,3)}getLeft(t){return this.m_treapData.getField(t,0)}getRight(t){return this.m_treapData.getField(t,1)}getParent(t){return this.m_treapData.getField(t,2)}getNext(t){return this.m_treapData.getField(t,6)}getPrev(t){return this.m_treapData.getField(t,5)}getFirst(t=-1){return-1===t?this.getFirst_(this.m_defaultTreap):this.getFirst_(t)}getLast(t=-1){return-1===t?this.getLast_(this.m_defaultTreap):this.getLast_(t)}getTreapData(t=-1){return-1===t?this.getTreapData_(this.m_defaultTreap):this.getTreapData_(t)}setElement(t,e){null!==this.m_comparator&&this.m_comparator.onSetImpl(this,t),this.setElement_(t,e)}getRoot(t=-1){return-1===t?this.getRoot_(this.m_defaultTreap):this.getRoot_(t)}clear(){this.m_treapData.deleteAll(!1),this.m_defaultTreap=ct.st_nullNode(),this.m_treapCount=0,this.m_maxDepthEver=0}addToList_(t,e,s){let i;-1!==t?(i=this.getPrev(t),this.setPrev_(t,e)):i=this.getLast_(s),this.setPrev_(e,i),-1!==i&&this.setNext_(i,e),this.setNext_(e,t),t===this.getFirst_(s)&&this.setFirst_(e,s),-1===t&&this.setLast_(e,s),this.setSize_(this.getSize_(s)+1,s)}size(t=-1){return-1===t?this.getSize_(this.m_defaultTreap):this.getSize_(t)}getMaxDepth(t=-1){return this.getMaxDepthHelper_(this.getRoot(t))}getMaxDepthEver(){return this.m_maxDepthEver}static st_isValidNode(t){return at.isValidElement(t)}dbgCheck_(t){}getPriority_(t){return this.m_treapData.getField(t,4)}bubbleDown_(t){let e=this.getLeft(t),s=this.getRight(t);const i=this.getPriority_(t);for(;e!==ct.st_nullNode()||s!==ct.st_nullNode();){const n=e!==ct.st_nullNode()?this.getPriority_(e):u(),r=s!==ct.st_nullNode()?this.getPriority_(s):u();if(i<=Math.min(n,r))return;n<=r?this.rotateRight_(e):this.rotateLeft_(t),e=this.getLeft(t),s=this.getRight(t)}}bubbleUp_(t){if(!this.m_bBalancing)return;const e=this.getPriority_(t);let s=this.getParent(t);for(;s!==ct.st_nullNode()&&this.getPriority_(s)>e;)this.getLeft(s)===t?this.rotateRight_(t):this.rotateLeft_(s),s=this.getParent(t)}rotateLeft_(t){const e=t,s=this.getRight(t);let i;this.setParent_(s,this.getParent(e)),this.setParent_(e,s),i=this.getLeft(s),this.setRight_(e,i),i!==ct.st_nullNode()&&this.setParent_(i,e),this.setLeft_(s,e),i=this.getParent(s),i!==ct.st_nullNode()&&(this.getLeft(i)===e?this.setLeft_(i,s):this.setRight_(i,s))}rotateRight_(t){const e=this.getParent(t),s=t;let i;this.setParent_(s,this.getParent(e)),this.setParent_(e,s),i=this.getRight(s),this.setLeft_(e,i),i!==ct.st_nullNode()&&this.setParent_(i,e),this.setRight_(s,e),i=this.getParent(s),i!==ct.st_nullNode()&&(this.getLeft(i)===e?this.setLeft_(i,s):this.setRight_(i,s))}setParent_(t,e){this.m_treapData.setField(t,2,e)}setLeft_(t,e){this.m_treapData.setField(t,0,e)}setRight_(t,e){this.m_treapData.setField(t,1,e)}setPriority_(t,e){this.m_treapData.setField(t,4,e)}setPrev_(t,e){this.m_treapData.setField(t,5,e)}setNext_(t,e){this.m_treapData.setField(t,6,e)}setRoot_(t,e){this.m_treapData.setField(e,0,t)}setFirst_(t,e){this.m_treapData.setField(e,1,t)}setLast_(t,e){this.m_treapData.setField(e,2,t)}setDuplicateElement_(t,e){this.m_treapData.setField(e,3,t)}setSize_(t,e){this.m_treapData.setField(e,4,t)}setTreapData_(t,e){this.m_treapData.setField(e,5,t)}getRoot_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,0)}getFirst_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,1)}getLast_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,2)}getDuplicateElement_(t){return-1===t?ct.st_nullNode():this.m_treapData.getField(t,3)}getSize_(t){return-1===t?0:this.m_treapData.getField(t,4)}getTreapData_(t){return this.m_treapData.getField(t,5)}newNode_(t){const e=this.m_treapData.newElement();return this.setPriority_(e,this.generatePriority_()),this.setElement_(e,t),e}freeNode_(t,e){t!==ct.st_nullNode()&&this.m_treapData.deleteElement(t)}generatePriority_(){return this.m_random=l(this.m_random),this.m_random&u()>>1}maxPriority(){return g(0),0}getMaxDepthHelper_(t){return t===ct.st_nullNode()?0:1+Math.max(this.getMaxDepthHelper_(this.getLeft(t)),this.getMaxDepthHelper_(this.getRight(t)))}addElement_(t,e,s){if(this.getRoot(s)===ct.st_nullNode()){const e=this.newNode_(t);return this.setRoot_(e,s),this.addToList_(-1,e,s),this.m_maxDepthEver=Math.max(this.m_maxDepthEver,1),e}let i=this.getRoot_(s),n=-1,r=-1,h=1;for(;;){const o=-1===e?1:this.m_comparator.compare(this,t,i);if(o<0){const e=this.getLeft(i);if(e===ct.st_nullNode()){r=i,n=this.newNode_(t),this.setLeft_(i,n),this.setParent_(n,i);break}i=e}else{if(1===e&&0===o)return this.m_comparator.onAddUniqueElementFailedImpl(t),this.setDuplicateElement_(i,s),-1;const h=this.getRight(i);if(h===ct.st_nullNode()){r=this.getNext(i),n=this.newNode_(t),this.setRight_(i,n),this.setParent_(n,i);break}i=h}h++}return this.bubbleUp_(n),this.getParent(n)===ct.st_nullNode()&&this.setRoot_(n,s),this.addToList_(r,n,s),this.m_maxDepthEver=Math.max(h,this.m_maxDepthEver),n}removeFromList_(t,e){const s=this.getPrev(t),i=this.getNext(t);-1!==s?this.setNext_(s,i):this.setFirst_(i,e),-1!==i?this.setPrev_(i,s):this.setLast_(s,e),this.setSize_(this.getSize_(e)-1,e)}unbalancedDelete_(t,e){this.removeFromList_(t,e);let s=this.getLeft(t),i=this.getRight(t),n=this.getParent(t),r=t;if(-1!==s&&-1!==i){let h;this.m_random=l(this.m_random),h=this.m_random>u()>>1?this.getNext(t):this.getPrev(t);const o=this.getParent(h)===t;this.m_treapData.swapField(t,h,0),this.m_treapData.swapField(t,h,1),this.m_treapData.swapField(t,h,2),-1!==n?this.getLeft(n)===t?this.setLeft_(n,h):this.setRight_(n,h):this.setRoot_(h,e),o?(s===h?(this.setLeft_(h,t),this.setParent_(i,h)):i===h&&(this.setRight_(h,t),this.setParent_(s,h)),this.setParent_(t,h),n=h):(this.setParent_(s,h),this.setParent_(i,h),n=this.getParent(t),r=h),s=this.getLeft(t),i=this.getRight(t),-1!==s&&this.setParent_(s,t),-1!==i&&this.setParent_(i,t)}const h=-1!==s?s:i;-1===n?this.setRoot_(h,e):this.getLeft(n)===r?this.setLeft_(n,h):this.setRight_(n,h),-1!==h&&this.setParent_(h,n),this.freeNode_(t,e)}deleteNode_(t,e){this.setPriority_(t,u());let s=ct.st_nullNode(),i=ct.st_nullNode();const n=this.getRoot_(e),r=n===t;if(r&&(s=this.getLeft(n),i=this.getRight(n),s===ct.st_nullNode()&&i===ct.st_nullNode()))return this.removeFromList_(n,e),this.freeNode_(n,e),void this.setRoot_(ct.st_nullNode(),e);this.bubbleDown_(t);const h=this.getParent(t);h!==ct.st_nullNode()&&(this.getLeft(h)===t?this.setLeft_(h,ct.st_nullNode()):this.setRight_(h,ct.st_nullNode())),this.removeFromList_(t,e),this.freeNode_(t,e),r&&this.setRoot_(s===ct.st_nullNode()||this.getParent(s)!==ct.st_nullNode()?i:s,e)}setElement_(t,e){this.m_treapData.setField(t,3,e)}addBiggestElement_(t,e){if(this.getRoot_(e)===ct.st_nullNode())return this.setRoot_(t,e),void this.addToList_(-1,t,e);const s=this.getLast_(e);this.setRight_(s,t),this.setParent_(t,s),this.bubbleUp_(t),this.getParent(t)===ct.st_nullNode()&&this.setRoot_(t,e),this.addToList_(-1,t,e)}}class pt{constructor(t){this.m_lists=new at(6),this.m_listOfLists=pt.st_nullNode(),void 0===t?(this.m_listNodes=new at(3),this.m_bStoreListIndexWithNode=!1):(this.m_listNodes=new at(t?4:3),this.m_bStoreListIndexWithNode=t)}freeNode_(t){this.m_listNodes.deleteElement(t)}newNode_(){return this.m_listNodes.newElement()}freeList_(t){g(0)}newList_(){return this.m_lists.newElement()}setPrev_(t,e){this.m_listNodes.setField(t,1,e)}setNext_(t,e){this.m_listNodes.setField(t,2,e)}setData_(t,e){g(0)}setList_(t,e){return this.m_listNodes.setField(t,3,e)}setListSize_(t,e){this.m_lists.setField(t,4,e)}setNextList_(t,e){g(0)}setPrevList_(t,e){this.m_lists.setField(t,2,e)}createList(t){const e=this.newList_();return this.m_lists.setField(e,3,this.m_listOfLists),this.m_lists.setField(e,4,0),this.m_lists.setField(e,5,t),this.m_listOfLists!==pt.st_nullNode()&&this.setPrevList_(this.m_listOfLists,e),this.m_listOfLists=e,e}deleteList(t){this.clear(t);const e=this.m_lists.getField(t,2),s=this.m_lists.getField(t,3);return e!==pt.st_nullNode()?this.setNextList_(e,s):this.m_listOfLists=s,s!==pt.st_nullNode()&&this.setPrevList_(s,e),this.freeList_(t),s}reserveLists(t){g(0)}getListData(t){return this.m_lists.getField(t,5)}getList(t){return g(0),0}setListData(t,e){this.m_lists.setField(t,5,e)}addElement(t,e){return this.insertElement(t,-1,e)}insertElement(t,e,s){const i=this.newNode_();let n=-1;e!==pt.st_nullNode()&&(n=this.getPrev(e),this.setPrev_(e,i)),this.setNext_(i,e),n!==pt.st_nullNode()&&this.setNext_(n,i);if(e===this.m_lists.getField(t,0)&&this.m_lists.setField(t,0,i),e===pt.st_nullNode()){const e=this.m_lists.getField(t,1);this.setPrev_(i,e),-1!==e&&this.setNext_(e,i),this.m_lists.setField(t,1,i)}return this.setData(i,s),this.setListSize_(t,this.getListSize(t)+1),this.m_bStoreListIndexWithNode&&this.setList_(i,t),i}deleteElement(t,e){const s=this.getPrev(e),i=this.getNext(e);return s!==pt.st_nullNode()?this.setNext_(s,i):this.m_lists.setField(t,0,i),i!==pt.st_nullNode()?this.setPrev_(i,s):this.m_lists.setField(t,1,s),this.freeNode_(e),this.setListSize_(t,this.getListSize(t)-1),i}reserveNodes(t){this.m_listNodes.setCapacity(t)}getData(t){return this.m_listNodes.getField(t,0)}getElement(t){return this.getData(t)}setData(t,e){this.m_listNodes.setField(t,0,e)}getNext(t){return this.m_listNodes.getField(t,2)}getPrev(t){return this.m_listNodes.getField(t,1)}getFirst(t){return this.m_lists.getField(t,0)}getLast(t){return this.m_lists.getField(t,1)}static st_nullNode(){return-1}clear(t){if(void 0!==t){let e=this.getLast(t);for(;e!==pt.st_nullNode();){const t=e;e=this.getPrev(t),this.freeNode_(t)}return this.m_lists.setField(t,0,-1),this.m_lists.setField(t,1,-1),void this.setListSize_(t,0)}for(let e=this.getFirstList();-1!==e;)e=this.deleteList(e)}isEmpty(t){return g(0),!1}getNodeCount(){return this.m_listNodes.size()}getListCount(){return this.m_lists.size()}getListSize(t){return this.m_lists.getField(t,4)}getFirstList(){return this.m_listOfLists}getNextList(t){return this.m_lists.getField(t,3)}}class gt extends dt{constructor(t){super(),this.m_intervalTree=t}compare(t,e,s){const i=t.getElement(s),n=this.m_intervalTree.getValue_(e),r=this.m_intervalTree.getValue_(i);return n<r?-1:n===r?ft.isLeft_(e)&&ft.isRight_(i)?-1:ft.isLeft_(i)&&ft.isRight_(e)?1:0:1}}class ft{constructor(t){this.m_bEnvelopesRef=!1,this.m_intervals=[],this.m_envelopesRef=null,this.m_intervalNodes=new at(3),this.m_intervalHandles=[],this.m_endIndicesUnique=[],this.m_cCount=-1,this.m_root=-1,this.m_bSortIntervals=!1,this.m_bConstructing=!1,this.m_bConstructionEnded=!1,this.m_bOfflineDynamic=t,this.m_tertiaryNodes=new at(this.m_bOfflineDynamic?5:4),this.m_secondaryTreaps=new ct,this.m_secondaryTreaps.setComparator(new gt(this)),this.m_secondaryLists=new pt}addEnvelopesRef(t){this.reset_(!0,!0),this.m_bEnvelopesRef=!0,this.m_envelopesRef=t,this.m_bConstructing=!1,this.m_bConstructionEnded=!0,this.m_bOfflineDynamic||(this.insertIntervalsStatic_(),this.m_cCount=this.m_envelopesRef.length)}startConstruction(){this.reset_(!0,!1)}addInterval(t){this.m_bConstructing||N(""),this.m_intervals.push(t.clone())}addIntervalCoords(t,e){g(0)}endConstruction(){this.m_bConstructing||N(""),this.m_bConstructing=!1,this.m_bConstructionEnded=!0,this.m_bOfflineDynamic||(this.insertIntervalsStatic_(),this.m_cCount=this.m_intervals.length)}insert(t){if(this.m_bOfflineDynamic&&this.m_bConstructionEnded||N(""),-1===this.m_root){const t=this.m_bEnvelopesRef?this.m_envelopesRef.length:this.m_intervals.length;if(this.m_bSortIntervals){const e=new st(0);this.querySortedEndPointIndices_(e),this.m_endIndicesUnique.length=0,this.querySortedDuplicatesRemoved_(e),this.m_intervalHandles.length=t,this.m_intervalHandles.fill(-1),this.m_bSortIntervals=!1}else this.m_intervalHandles.fill(-1,0,t);this.m_root=this.createRoot_()}const e=this.insertIntervalEnd_(t<<1,this.m_root),s=this.getSecondaryFromInterval_(e),i=this.m_secondaryTreaps.addElement(1+(t<<1),s);this.setRightEnd_(e,i),this.m_intervalHandles[t]=e,this.m_cCount++}remove(t){this.m_bOfflineDynamic&&this.m_bConstructionEnded||N("");const e=this.m_intervalHandles[t];let s;-1===e&&f("the interval does not exist in the interval tree"),this.m_intervalHandles[t]=-1,this.m_cCount--;let i=this.getSecondaryFromInterval_(e),n=-1;n=this.m_secondaryTreaps.getTreapData(i),this.m_secondaryTreaps.deleteNode(this.getLeftEnd_(e),i),this.m_secondaryTreaps.deleteNode(this.getRightEnd_(e),i),s=this.m_secondaryTreaps.size(i),0===s&&(this.m_secondaryTreaps.deleteTreap(i),this.setSecondaryToTertiary_(n,-1)),this.m_intervalNodes.deleteElement(e);let r=this.getPptr_(n),h=this.getLptr_(n),o=this.getRptr_(n);for(;!(s>0||n===this.m_root||-1!==h&&-1!==o);)n===this.getLptr_(r)?-1!==h?(this.setLptr_(r,h),this.setPptr_(h,r),this.setLptr_(n,-1),this.setPptr_(n,-1)):-1!==o?(this.setLptr_(r,o),this.setPptr_(o,r),this.setRptr_(n,-1),this.setPptr_(n,-1)):(this.setLptr_(r,-1),this.setPptr_(n,-1)):-1!==h?(this.setRptr_(r,h),this.setPptr_(h,r),this.setLptr_(n,-1),this.setPptr_(n,-1)):-1!==o?(this.setRptr_(r,o),this.setPptr_(o,r),this.setRptr_(n,-1),this.setPptr_(n,-1)):(this.setRptr_(r,-1),this.setPptr_(n,-1)),this.m_tertiaryNodes.deleteElement(n),n=r,i=this.getSecondaryFromTertiary_(n),s=-1!==i?this.m_secondaryTreaps.size(i):0,h=this.getLptr_(n),o=this.getRptr_(n),r=this.getPptr_(n)}size(){return this.m_cCount}getIteratorQuery(t,e){return t instanceof r?new vt(this,t,e):(g(0),{})}getIterator(){return new vt(this)}querySortedEndPointIndices_(t){const e=this.m_bEnvelopesRef?this.m_envelopesRef.length:this.m_intervals.length;for(let s=0;s<2*e;s++)t.add(s);this.sortEndIndices_(t,0,2*e)}querySortedDuplicatesRemoved_(t){let e=Number.NaN;for(let s=0;s<t.size();s++){const i=t.read(s),n=this.getValue_(i);n!==e&&(this.m_endIndicesUnique.push(i),e=n)}}insertIntervalsStatic_(){const t=this.m_bEnvelopesRef?this.m_envelopesRef.length:this.m_intervals.length,s=new st(0);this.querySortedEndPointIndices_(s),this.m_endIndicesUnique.length=0,this.querySortedDuplicatesRemoved_(s),this.m_intervalNodes.setCapacity(t),this.m_secondaryLists.reserveNodes(2*t);const i=e(t,-1);this.m_root=this.createRoot_();for(let e=0;e<s.size();e++){const t=s.read(e);let n=i[t>>1];if(-1!==n){const e=this.getSecondaryFromInterval_(n);this.setRightEnd_(n,this.m_secondaryLists.addElement(e,t))}else n=this.insertIntervalEnd_(t,this.m_root),i[t>>1]=n}}createRoot_(){const t=this.calculateDiscriminantIndex1_(0,this.m_endIndicesUnique.length-1);return this.createTertiaryNode_(t)}insertIntervalEnd_(t,e){let s=-1,i=e,n=-1,r=-1,h=0,o=this.m_endIndicesUnique.length-1,a=0;const m=t>>1;let _=Number.NaN,l=Number.NaN,u=!0;const d=this.getMin_(m),c=this.getMax_(m);let p=-1;for(;u;){a=h+(o-h>>1),p=this.calculateDiscriminantIndex1_(h,o);const e=this.getDiscriminantFromIndex1_(p);if(c<e){if(-1!==i)if(p===this.getDiscriminantIndex1_(i))s=i,_=e,i=this.getLptr_(i),l=-1!==i?this.getDiscriminant_(i):Number.NaN;else if(l>e){const t=this.createTertiaryNode_(p);e<_?this.setLptr_(s,t):this.setRptr_(s,t),this.setRptr_(t,i),this.m_bOfflineDynamic&&(this.setPptr_(t,s),this.setPptr_(i,t)),s=t,_=e,i=-1,l=Number.NaN}o=a;continue}if(d>e){if(-1!==i)if(p===this.getDiscriminantIndex1_(i))s=i,_=e,i=this.getRptr_(i),l=-1!==i?this.getDiscriminant_(i):Number.NaN;else if(l<e){const t=this.createTertiaryNode_(p);e<_?this.setLptr_(s,t):this.setRptr_(s,t),this.setLptr_(t,i),this.m_bOfflineDynamic&&(this.setPptr_(t,s),this.setPptr_(i,t)),s=t,_=e,i=-1,l=Number.NaN}h=a+1;continue}let m=-1;m=-1===i||p!==this.getDiscriminantIndex1_(i)?this.createTertiaryNode_(p):i,n=this.getSecondaryFromTertiary_(m),-1===n&&(n=this.createSecondary_(m),this.setSecondaryToTertiary_(m,n));const g=this.addEndIndex_(n,t);r=this.createIntervalNode_(),this.setSecondaryToInterval_(r,n),this.setLeftEnd_(r,g),-1!==i&&p===this.getDiscriminantIndex1_(i)||(e<_?this.setLptr_(s,m):this.setRptr_(s,m),this.m_bOfflineDynamic&&this.setPptr_(m,s),-1!==i&&(l<e?this.setLptr_(m,i):this.setRptr_(m,i),this.m_bOfflineDynamic&&this.setPptr_(i,m))),u=!1;break}return r}createTertiaryNode_(t){const e=this.m_tertiaryNodes.newElement();return this.setDiscriminantIndex1_(e,t),e}createSecondary_(t){return this.m_bOfflineDynamic?this.m_secondaryTreaps.createTreap(t):this.m_secondaryLists.createList(t)}createIntervalNode_(){return this.m_intervalNodes.newElement()}reset(){this.m_bOfflineDynamic&&this.m_bConstructionEnded||N(""),this.reset_(!1,this.m_bEnvelopesRef)}reset_(t,e){t?(this.m_bEnvelopesRef=!1,this.m_envelopesRef=null,this.m_bSortIntervals=!0,this.m_bConstructing=!0,this.m_bConstructionEnded=!1,this.m_endIndicesUnique.length=0,e?(this.m_intervals.length=0,this.m_bEnvelopesRef=!0):this.m_intervals.length=0):this.m_bSortIntervals=!1,this.m_bOfflineDynamic?this.m_secondaryTreaps.clear():this.m_secondaryLists.clear(),this.m_intervalNodes.deleteAll(!1),this.m_tertiaryNodes.deleteAll(!1),this.m_root=-1,this.m_cCount=0}getDiscriminant_(t){const e=this.getDiscriminantIndex1_(t);return this.getDiscriminantFromIndex1_(e)}getDiscriminantFromIndex1_(t){if(-1===t)return Number.NaN;if(t>0){const e=t-2,s=this.m_endIndicesUnique[e],i=this.m_endIndicesUnique[e+1];return.5*(this.getValue_(s)+this.getValue_(i))}const e=-t-2,s=this.m_endIndicesUnique[e];return this.getValue_(s)}calculateDiscriminantIndex1_(t,e){let s;if(t<e){s=t+(e-t>>1)+2}else s=-(t+2);return s}setDiscriminantIndex1_(t,e){this.m_tertiaryNodes.setField(t,0,e)}setSecondaryToTertiary_(t,e){this.m_tertiaryNodes.setField(t,1,e)}setLptr_(t,e){this.m_tertiaryNodes.setField(t,2,e)}setRptr_(t,e){this.m_tertiaryNodes.setField(t,3,e)}setPptr_(t,e){this.m_tertiaryNodes.setField(t,4,e)}setSecondaryToInterval_(t,e){this.m_intervalNodes.setField(t,0,e)}addEndIndex_(t,e){let s=-1;return s=this.m_bOfflineDynamic?this.m_secondaryTreaps.addElement(e,t):this.m_secondaryLists.addElement(t,e),s}setLeftEnd_(t,e){this.m_intervalNodes.setField(t,1,e)}setRightEnd_(t,e){this.m_intervalNodes.setField(t,2,e)}getFirst_(t){return this.m_bOfflineDynamic?this.m_secondaryTreaps.getFirst(t):this.m_secondaryLists.getFirst(t)}getLast_(t){return this.m_bOfflineDynamic?this.m_secondaryTreaps.getLast(t):this.m_secondaryLists.getLast(t)}static isLeft_(t){return!(1&t)}static isRight_(t){return!(1&~t)}getDiscriminantIndex1_(t){return this.m_tertiaryNodes.getField(t,0)}getSecondaryFromTertiary_(t){return this.m_tertiaryNodes.getField(t,1)}getLptr_(t){return this.m_tertiaryNodes.getField(t,2)}getRptr_(t){return this.m_tertiaryNodes.getField(t,3)}getPptr_(t){return this.m_tertiaryNodes.getField(t,4)}getSecondaryFromInterval_(t){return this.m_intervalNodes.getField(t,0)}getLeftEnd_(t){return this.m_intervalNodes.getField(t,1)}getRightEnd_(t){return this.m_intervalNodes.getField(t,2)}getMin_(t){return this.m_bEnvelopesRef?this.m_envelopesRef[t].xmin:this.m_intervals[t].vmin}getMax_(t){return this.m_bEnvelopesRef?this.m_envelopesRef[t].xmax:this.m_intervals[t].vmax}sortEndIndices_(t,e,s){const i=this,n={userSort(t,e,s){i.sortEndIndicesHelper_(s,t,e)},getValue:t=>i.getValue_(t)};(new ot).sort(t,e,s,n)}sortEndIndicesHelper_(t,e,s){t.sort(e,s,((t,e)=>{const s=this.getValue_(t),i=this.getValue_(e);return s<i||s===i&&ft.isLeft_(t)&&ft.isRight_(e)?-1:1}))}getValue_(t){if(!this.m_bEnvelopesRef){const e=this.m_intervals[t>>1];return ft.isLeft_(t)?e.vmin:e.vmax}const e=this.m_envelopesRef[t>>1];return ft.isLeft_(t)?e.xmin:e.xmax}}class vt{constructor(t,e,s){this.m_query=r.constructEmpty(),this.m_tertiaryHandle=-1,this.m_nextTertiaryHandle=-1,this.m_forkedHandle=-1,this.m_currentEndHandle=-1,this.m_nextEndHandle=-1,this.m_tertiaryStack=[],this.m_functionIndex=0,this.m_intervalTree=t,this.m_functionStack=new Array(2),this.m_functionStack[0]=this.nullFunc_,this.m_functionStack[1]=this.nullFunc_,void 0!==e&&this.resetIterator(e,s)}nullFunc_(){return b("should not be called"),!1}resetIterator(t,e){if("number"==typeof t){const s=new r;s.setCoords(t,t),this.resetIterator(s,e)}else void 0===e&&(e=0),this.m_query.vmin=t.vmin-e,this.m_query.vmax=t.vmax+e,this.m_tertiaryStack.length=0,this.m_functionIndex=0,this.m_functionStack[0]=this.initialize_}next(){if(this.m_intervalTree.m_bConstructionEnded||N(""),this.m_functionIndex<0)return-1;for(;this.m_fi=this.m_functionStack[this.m_functionIndex],this.m_fi(););return-1!==this.m_currentEndHandle?this.getCurrentEndIndex_()>>1:-1}initialize_(){return this.m_tertiaryHandle=-1,this.m_nextTertiaryHandle=-1,this.m_forkedHandle=-1,this.m_currentEndHandle=-1,this.m_intervalTree.m_tertiaryNodes.size()>0?(this.m_functionStack[0]=this.pIn_,this.m_nextTertiaryHandle=this.m_intervalTree.m_root,!0):(this.m_functionIndex=-1,!1)}pIn_(){if(this.m_tertiaryHandle=this.m_nextTertiaryHandle,-1===this.m_tertiaryHandle)return this.m_functionIndex=-1,this.m_currentEndHandle=-1,!1;const t=this.m_intervalTree.getDiscriminant_(this.m_tertiaryHandle);if(this.m_query.vmax<t){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.left_),!0}if(t<this.m_query.vmin){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getLast_(t),this.m_functionStack[++this.m_functionIndex]=this.right_),!0}this.m_functionStack[this.m_functionIndex]=this.pL_,this.m_forkedHandle=this.m_tertiaryHandle;const e=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==e&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(e),this.m_functionStack[++this.m_functionIndex]=this.all_),!0}pL_(){if(this.m_tertiaryHandle=this.m_nextTertiaryHandle,-1===this.m_tertiaryHandle)return this.m_functionStack[this.m_functionIndex]=this.pR_,this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_forkedHandle),!0;if(this.m_intervalTree.getDiscriminant_(this.m_tertiaryHandle)<this.m_query.vmin){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getLast_(t),this.m_functionStack[++this.m_functionIndex]=this.right_),!0}const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.all_);const e=this.m_intervalTree.getRptr_(this.m_tertiaryHandle);return-1!==e&&this.m_tertiaryStack.push(e),!0}pR_(){if(this.m_tertiaryHandle=this.m_nextTertiaryHandle,-1===this.m_tertiaryHandle)return this.m_functionStack[this.m_functionIndex]=this.pT_,!0;const t=this.m_intervalTree.getDiscriminant_(this.m_tertiaryHandle);if(this.m_query.vmax<t){const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return this.m_nextTertiaryHandle=this.m_intervalTree.getLptr_(this.m_tertiaryHandle),-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.left_),!0}const e=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);this.m_nextTertiaryHandle=this.m_intervalTree.getRptr_(this.m_tertiaryHandle),-1!==e&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(e),this.m_functionStack[++this.m_functionIndex]=this.all_);const s=this.m_intervalTree.getLptr_(this.m_tertiaryHandle);return-1!==s&&this.m_tertiaryStack.push(s),!0}pT_(){if(0===this.m_tertiaryStack.length)return this.m_functionIndex=-1,this.m_currentEndHandle=-1,!1;this.m_tertiaryHandle=this.m_tertiaryStack.at(-1),this.m_tertiaryStack.pop();const t=this.m_intervalTree.getSecondaryFromTertiary_(this.m_tertiaryHandle);return-1!==t&&(this.m_nextEndHandle=this.m_intervalTree.getFirst_(t),this.m_functionStack[++this.m_functionIndex]=this.all_),-1!==this.m_intervalTree.getLptr_(this.m_tertiaryHandle)&&this.m_tertiaryStack.push(this.m_intervalTree.getLptr_(this.m_tertiaryHandle)),-1!==this.m_intervalTree.getRptr_(this.m_tertiaryHandle)&&this.m_tertiaryStack.push(this.m_intervalTree.getRptr_(this.m_tertiaryHandle)),!0}left_(){return this.m_currentEndHandle=this.m_nextEndHandle,-1!==this.m_currentEndHandle&&ft.isLeft_(this.getCurrentEndIndex_())&&this.m_intervalTree.getValue_(this.getCurrentEndIndex_())<=this.m_query.vmax?(this.m_nextEndHandle=this.getNext_(),!1):(this.m_functionIndex--,!0)}right_(){return this.m_currentEndHandle=this.m_nextEndHandle,-1!==this.m_currentEndHandle&&ft.isRight_(this.getCurrentEndIndex_())&&this.m_intervalTree.getValue_(this.getCurrentEndIndex_())>=this.m_query.vmin?(this.m_nextEndHandle=this.getPrev_(),!1):(this.m_functionIndex--,!0)}all_(){return this.m_currentEndHandle=this.m_nextEndHandle,-1!==this.m_currentEndHandle&&ft.isLeft_(this.getCurrentEndIndex_())?(this.m_nextEndHandle=this.getNext_(),!1):(this.m_functionIndex--,!0)}getNext_(){return this.m_intervalTree.m_bOfflineDynamic?this.m_intervalTree.m_secondaryTreaps.getNext(this.m_currentEndHandle):this.m_intervalTree.m_secondaryLists.getNext(this.m_currentEndHandle)}getPrev_(){return this.m_intervalTree.m_bOfflineDynamic?this.m_intervalTree.m_secondaryTreaps.getPrev(this.m_currentEndHandle):this.m_intervalTree.m_secondaryLists.getPrev(this.m_currentEndHandle)}getCurrentEndIndex_(){return this.m_intervalTree.m_bOfflineDynamic?this.m_intervalTree.m_secondaryTreaps.getElement(this.m_currentEndHandle):this.m_intervalTree.m_secondaryLists.getData(this.m_currentEndHandle)}}class yt{constructor(){this.m_tolerance=0,this.m_sweepIndexRed=-1,this.m_sweepIndexBlue=-1,this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_intervalTreeRed=null,this.m_intervalTreeBlue=null,this.m_iteratorRed=null,this.m_iteratorBlue=null,this.m_envelopesRed=[],this.m_envelopesBlue=[],this.m_elementsRed=[],this.m_elementsBlue=[],this.m_sortedEndIndicesRed=new st(0),this.m_sortedEndIndicesBlue=new st(0),this.m_queuedListRed=-1,this.m_queuedListBlue=-1,this.m_queuedEnvelopes=new pt,this.m_queuedIndicesRed=[],this.m_queuedIndicesBlue=[],this.m_bAddRed=!1,this.m_bAddBlue=!1,this.m_bAddRedRed=!1,this.m_bDone=!0,this.m_function=this.nullFunc_,this.reset_()}startConstruction(){this.reset_(),this.m_bAddRedRed=!0,this.m_elementsRed.length=0,this.m_envelopesRed.length=0}addEnvelope(t,e){this.m_bAddRedRed||N(""),this.m_elementsRed.push(t),this.m_envelopesRed.push(new p(e))}endConstruction(){this.m_bAddRedRed||N(""),this.m_bAddRedRed=!1,this.m_envelopesRed.length>0&&(this.m_function=this.initialize_,this.m_bDone=!1)}startRedConstruction(){this.reset_(),this.m_bAddRed=!0,this.m_elementsRed.length=0,this.m_envelopesRed.length=0}addRedEnvelope(t,e){this.m_bAddRed||N(""),this.m_elementsRed.push(t),this.m_envelopesRed.push(e.clone())}endRedConstruction(){this.m_bAddRed||N(""),this.m_bAddRed=!1,this.m_envelopesRed.length>0&&this.m_envelopesBlue.length>0&&(this.m_function===this.nullFunc_||this.m_function===this.initializeBlue_?this.m_function=this.initializeRedBlue_:this.m_function!==this.initializeRedBlue_&&(this.m_function=this.initializeRed_),this.m_bDone=!1)}startBlueConstruction(){this.reset_(),this.m_bAddBlue=!0,this.m_elementsBlue.length=0,this.m_envelopesBlue.length=0}addBlueEnvelope(t,e){this.m_bAddBlue||N(""),this.m_elementsBlue.push(t),this.m_envelopesBlue.push(e.clone())}endBlueConstruction(){this.m_bAddBlue||N(""),this.m_bAddBlue=!1,this.m_envelopesRed.length>0&&this.m_envelopesBlue.length>0&&(this.m_function===this.nullFunc_||this.m_function===this.initializeRed_?this.m_function=this.initializeRedBlue_:this.m_function!==this.initializeRedBlue_&&(this.m_function=this.initializeBlue_),this.m_bDone=!1)}next(){if(this.m_bDone)return!1;for(;this.m_function(););return!this.m_bDone}getHandleA(){return this.m_envelopeHandleA}getHandleB(){return this.m_envelopeHandleB}setTolerance(t){this.m_tolerance=t}getElement(t){return this.m_elementsRed[t]}getRedEnvelope(t){return this.m_envelopesRed[t]}getBlueEnvelope(t){return this.m_envelopesBlue[t]}getRedElement(t){return this.m_elementsRed[t]}getBlueElement(t){return this.m_elementsBlue[t]}isTop_(t){return!(1&~t)}isBottom_(t){return!(1&t)}reset_(){this.m_bAddRed=!1,this.m_bAddBlue=!1,this.m_bAddRedRed=!1,this.m_sweepIndexRed=-1,this.m_sweepIndexBlue=-1,this.m_queuedListRed=-1,this.m_queuedListBlue=-1,this.m_bDone=!0}initialize_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepBruteForce_,!0;this.m_intervalTreeRed||(this.m_intervalTreeRed=new ft(!0)),this.m_intervalTreeRed.addEnvelopesRef(this.m_envelopesRed),null===this.m_iteratorRed&&(this.m_iteratorRed=this.m_intervalTreeRed.getIterator()),this.m_sortedEndIndicesRed.resize(0);for(let t=0;t<2*this.m_envelopesRed.length;t++)this.m_sortedEndIndicesRed.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesRed,0,2*this.m_envelopesRed.length,!0),this.m_sweepIndexRed=2*this.m_envelopesRed.length,this.m_function=this.sweep_,!0}initializeRed_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10||this.m_envelopesBlue.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepRedBlueBruteForce_,!0;this.m_intervalTreeRed||(this.m_intervalTreeRed=new ft(!0)),this.m_intervalTreeRed.addEnvelopesRef(this.m_envelopesRed),null===this.m_iteratorRed&&(this.m_iteratorRed=this.m_intervalTreeRed.getIterator()),this.m_sortedEndIndicesRed.resize(0);for(let t=0;t<2*this.m_envelopesRed.length;t++)this.m_sortedEndIndicesRed.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesRed,0,this.m_sortedEndIndicesRed.size(),!0),this.m_sweepIndexRed=this.m_sortedEndIndicesRed.size(),-1!==this.m_queuedListRed&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListRed),this.m_queuedIndicesRed.length=0,this.m_queuedListRed=-1),this.m_function=this.sweepRedBlue_,this.resetBlue_()}initializeBlue_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10||this.m_envelopesBlue.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepRedBlueBruteForce_,!0;this.m_intervalTreeBlue||(this.m_intervalTreeBlue=new ft(!0)),this.m_intervalTreeBlue.addEnvelopesRef(this.m_envelopesBlue),null==this.m_iteratorBlue&&(this.m_iteratorBlue=this.m_intervalTreeBlue.getIterator()),this.m_sortedEndIndicesBlue.resize(0);for(let t=0;t<2*this.m_envelopesBlue.length;t++)this.m_sortedEndIndicesBlue.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesBlue,0,this.m_sortedEndIndicesBlue.size(),!1),this.m_sweepIndexBlue=this.m_sortedEndIndicesBlue.size(),-1!==this.m_queuedListBlue&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListBlue),this.m_queuedIndicesBlue.length=0,this.m_queuedListBlue=-1),this.m_function=this.sweepRedBlue_,this.resetRed_()}initializeRedBlue_(){if(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_envelopesRed.length<10||this.m_envelopesBlue.length<10)return this.m_sweepIndexRed=this.m_envelopesRed.length,this.m_function=this.sweepRedBlueBruteForce_,!0;this.m_intervalTreeRed||(this.m_intervalTreeRed=new ft(!0)),this.m_intervalTreeBlue||(this.m_intervalTreeBlue=new ft(!0)),this.m_intervalTreeRed.addEnvelopesRef(this.m_envelopesRed),this.m_intervalTreeBlue.addEnvelopesRef(this.m_envelopesBlue),null===this.m_iteratorRed&&(this.m_iteratorRed=this.m_intervalTreeRed.getIterator()),null===this.m_iteratorBlue&&(this.m_iteratorBlue=this.m_intervalTreeBlue.getIterator()),this.m_sortedEndIndicesRed.resize(0),this.m_sortedEndIndicesBlue.resize(0);for(let t=0;t<2*this.m_envelopesRed.length;t++)this.m_sortedEndIndicesRed.add(t);for(let t=0;t<2*this.m_envelopesBlue.length;t++)this.m_sortedEndIndicesBlue.add(t);return this.sortYEndIndices_(this.m_sortedEndIndicesRed,0,this.m_sortedEndIndicesRed.size(),!0),this.sortYEndIndices_(this.m_sortedEndIndicesBlue,0,this.m_sortedEndIndicesBlue.size(),!1),this.m_sweepIndexRed=this.m_sortedEndIndicesRed.size(),this.m_sweepIndexBlue=this.m_sortedEndIndicesBlue.size(),-1!==this.m_queuedListRed&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListRed),this.m_queuedIndicesRed.length=0,this.m_queuedListRed=-1),-1!==this.m_queuedListBlue&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListBlue),this.m_queuedIndicesBlue.length=0,this.m_queuedListBlue=-1),this.m_function=this.sweepRedBlue_,!0}sweep_(){const t=this.m_sortedEndIndicesRed.read(--this.m_sweepIndexRed),e=t>>1;if(this.isBottom_(t))return this.m_intervalTreeRed.remove(e),0!==this.m_sweepIndexRed||(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1);const s=r.construct(this.m_envelopesRed[e].xmin,this.m_envelopesRed[e].xmax);return this.m_iteratorRed.resetIterator(s,this.m_tolerance),this.m_envelopeHandleA=e,this.m_function=this.iterate_,!0}sweepBruteForce_(){return-1===--this.m_sweepIndexRed?(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1):(this.m_envelopeHandleA=this.m_sweepIndexRed,this.m_sweepIndexBlue=this.m_sweepIndexRed,this.m_function=this.iterateBruteForce_,!0)}sweepRedBlueBruteForce_(){return-1===--this.m_sweepIndexRed?(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1):(this.m_envelopeHandleA=this.m_sweepIndexRed,this.m_sweepIndexBlue=this.m_envelopesBlue.length,this.m_function=this.iterateRedBlueBruteForce_,!0)}sweepRedBlue_(){const t=this.m_sortedEndIndicesRed.read(this.m_sweepIndexRed-1),e=this.m_sortedEndIndicesBlue.read(this.m_sweepIndexBlue-1),s=this.getAdjustedValue_(t,!0),i=this.getAdjustedValue_(e,!1);return s>i?this.sweepRed_():s<i?this.sweepBlue_():this.isTop_(t)?this.sweepRed_():this.isTop_(e)?this.sweepBlue_():this.sweepRed_()}sweepRed_(){const t=this.m_sortedEndIndicesRed.read(--this.m_sweepIndexRed),e=t>>1;if(this.isBottom_(t))return-1!==this.m_queuedListRed&&-1!==this.m_queuedIndicesRed[e]?(this.m_queuedEnvelopes.deleteElement(this.m_queuedListRed,this.m_queuedIndicesRed[e]),this.m_queuedIndicesRed[e]=-1):this.m_intervalTreeRed.remove(e),0!==this.m_sweepIndexRed||(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1);if(-1!==this.m_queuedListBlue&&this.m_queuedEnvelopes.getListSize(this.m_queuedListBlue)>0){let t=this.m_queuedEnvelopes.getFirst(this.m_queuedListBlue);for(;-1!==t;){const e=this.m_queuedEnvelopes.getData(t);this.m_intervalTreeBlue.insert(e),this.m_queuedIndicesBlue[e]=-1;const s=this.m_queuedEnvelopes.getNext(t);this.m_queuedEnvelopes.deleteElement(this.m_queuedListBlue,t),t=s}}if(this.m_intervalTreeBlue.size()>0){const t=r.construct(this.m_envelopesRed[e].xmin,this.m_envelopesRed[e].xmax);this.m_iteratorBlue.resetIterator(t,this.m_tolerance),this.m_envelopeHandleA=e,this.m_function=this.iterateBlue_}else-1===this.m_queuedListRed&&(c(this.m_queuedIndicesRed,this.m_envelopesRed.length,-1),this.m_queuedListRed=this.m_queuedEnvelopes.createList(1)),this.m_queuedIndicesRed[e]=this.m_queuedEnvelopes.addElement(this.m_queuedListRed,e),this.m_function=this.sweepRedBlue_;return!0}sweepBlue_(){const t=this.m_sortedEndIndicesBlue.read(--this.m_sweepIndexBlue),e=t>>1;if(this.isBottom_(t))return-1!==this.m_queuedListBlue&&-1!==this.m_queuedIndicesBlue[e]?(this.m_queuedEnvelopes.deleteElement(this.m_queuedListBlue,this.m_queuedIndicesBlue[e]),this.m_queuedIndicesBlue[e]=-1):this.m_intervalTreeBlue.remove(e),0!==this.m_sweepIndexBlue||(this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1,this.m_bDone=!0,!1);if(-1!==this.m_queuedListRed&&this.m_queuedEnvelopes.getListSize(this.m_queuedListRed)>0){let t=this.m_queuedEnvelopes.getFirst(this.m_queuedListRed);for(;-1!==t;){const e=this.m_queuedEnvelopes.getData(t);this.m_intervalTreeRed.insert(e),this.m_queuedIndicesRed[e]=-1;const s=this.m_queuedEnvelopes.getNext(t);this.m_queuedEnvelopes.deleteElement(this.m_queuedListRed,t),t=s}}if(this.m_intervalTreeRed.size()>0){const t=r.construct(this.m_envelopesBlue[e].xmin,this.m_envelopesBlue[e].xmax);this.m_iteratorRed.resetIterator(t,this.m_tolerance),this.m_envelopeHandleB=e,this.m_function=this.iterateRed_}else-1===this.m_queuedListBlue&&(c(this.m_queuedIndicesBlue,this.m_envelopesBlue.length,-1),this.m_queuedListBlue=this.m_queuedEnvelopes.createList(0)),this.m_queuedIndicesBlue[e]=this.m_queuedEnvelopes.addElement(this.m_queuedListBlue,e),this.m_function=this.sweepRedBlue_;return!0}iterate_(){if(this.m_envelopeHandleB=this.m_iteratorRed.next(),-1!==this.m_envelopeHandleB)return!1;const t=this.m_sortedEndIndicesRed.read(this.m_sweepIndexRed)>>1;return this.m_intervalTreeRed.insert(t),this.m_function=this.sweep_,!0}iterateRed_(){if(this.m_envelopeHandleA=this.m_iteratorRed.next(),-1!==this.m_envelopeHandleA)return!1;this.m_envelopeHandleA=-1,this.m_envelopeHandleB=-1;const t=this.m_sortedEndIndicesBlue.read(this.m_sweepIndexBlue)>>1;return this.m_intervalTreeBlue.insert(t),this.m_function=this.sweepRedBlue_,!0}iterateBlue_(){if(this.m_envelopeHandleB=this.m_iteratorBlue.next(),-1!==this.m_envelopeHandleB)return!1;const t=this.m_sortedEndIndicesRed.read(this.m_sweepIndexRed)>>1;return this.m_intervalTreeRed.insert(t),this.m_function=this.sweepRedBlue_,!0}iterateBruteForce_(){if(-1===--this.m_sweepIndexBlue)return this.m_function=this.sweepBruteForce_,!0;const t=this.m_envelopesRed[this.m_sweepIndexRed].clone(),e=this.m_envelopesRed[this.m_sweepIndexBlue];return t.inflateCoords(this.m_tolerance,this.m_tolerance),!t.isIntersecting(e)||(this.m_envelopeHandleB=this.m_sweepIndexBlue,!1)}iterateRedBlueBruteForce_(){if(-1===--this.m_sweepIndexBlue)return this.m_function=this.sweepRedBlueBruteForce_,!0;const t=this.m_envelopesRed[this.m_sweepIndexRed].clone(),e=this.m_envelopesBlue[this.m_sweepIndexBlue];return t.inflateCoords(this.m_tolerance,this.m_tolerance),!t.isIntersecting(e)||(this.m_envelopeHandleB=this.m_sweepIndexBlue,!1)}resetRed_(){return this.m_sweepIndexRed=this.m_sortedEndIndicesRed.size(),this.m_intervalTreeRed.size()>0&&this.m_intervalTreeRed.reset(),-1!==this.m_queuedListRed&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListRed),this.m_queuedIndicesRed.length=0,this.m_queuedListRed=-1),this.m_bDone=!1,!0}resetBlue_(){return this.m_sweepIndexBlue=this.m_sortedEndIndicesBlue.size(),this.m_intervalTreeBlue.size()>0&&this.m_intervalTreeBlue.reset(),-1!==this.m_queuedListBlue&&(this.m_queuedEnvelopes.deleteList(this.m_queuedListBlue),this.m_queuedIndicesBlue.length=0,this.m_queuedListBlue=-1),this.m_bDone=!1,!0}nullFunc_(){return b("should not be called"),!1}sortYEndIndices_(t,e,s,i){const n=this,r={userSort(t,e,s){n.sortYEndIndicesHelper_(s,t,e,i)},getValue:t=>n.getAdjustedValue_(t,i)};(new ot).sort(t,e,s,r)}sortYEndIndicesHelper_(t,e,s,i){t.sort(e,s,((t,e)=>{const s=this.getAdjustedValue_(t,i),n=this.getAdjustedValue_(e,i);return s<n||s===n&&this.isBottom_(t)&&this.isTop_(e)?-1:1}))}getAdjustedValue_(t,e){const s=.5*this.m_tolerance;if(e){const e=this.m_envelopesRed[t>>1];return this.isBottom_(t)?e.ymin-s:e.ymax+s}const i=this.m_envelopesBlue[t>>1];return this.isBottom_(t)?i.ymin-s:i.ymax+s}}var xt=z;class Et{constructor(t,e){this.tolerance=void 0!==t?t:Number.NaN,this.resolution=void 0!==e?e:Number.NaN}add(t){return new Et(this.tolerance+t,this.resolution)}scale(t){return new Et(this.tolerance*t,this.resolution*t)}total(){return this.tolerance+this.resolution}}function bt(t,e,i,n,r){const h=n*n,o=t.sub(e),a=i.sub(e),m=o.sqrLength(),_=a.sqrLength();if(m<=h||_<=h)return!0;const l=s(o.crossProduct(a));if(l<=h*m||l<=h*_){return o.dotProduct(a)>=0}return!1}function Nt(t,e,s){return i=>0===s?(i+t)*e:1*(i-t*e)/e}function Dt(t,e){const s=new p;return t.queryLooseEnvelope(s),s.mergeEnvelope2D(e),s}function It(t,e){const s=p.constructEmpty();t.queryLooseEnvelope(s);const i=p.constructEmpty();return e.queryLooseEnvelope(i),s.mergeEnvelope2D(i),s}function Ct(t,e){return(Number.isFinite(t)||Number.isNaN(t))&&(Number.isFinite(e)||Number.isNaN(e))}function Tt(t,e){return Number.isFinite(t)&&Number.isFinite(e)}function Rt(t,e,s){const i=p.constructEmpty();i.setFromPoints(t,e);return St(0,null,i.calculateToleranceFromEnvelope(),s,!1)}function At(t,e,s){return St(0,t,e.calculateToleranceFromEnvelope(),s,!1)}function qt(t,e,s){return St(1,t,e.calculateToleranceFromEnvelope(),s,!1)}function wt(t,e,s){return qt(t,e.queryInterval(1,0),s)}function Bt(t,e,s){const i=p.constructEmpty();return e.queryEnvelope(i),At(t,i,s)}function zt(t,e,s=!1){return St(0,t,e.calculateToleranceFromEnvelope(),s,!0).total()}function Lt(t,e,s){const i=p.constructEmpty();return e.queryEnvelope(i),zt(t,i,s)}function St(t,e,s,i,n){const r=new Et(0,0);if(null!==e&&(r.tolerance=e.getTolerance(t),(!n||i)&&null!==e)){const s=e.getResolution(t);r.resolution=s,i&&(r.resolution*=2)}i&&(s*=4,r.tolerance*=1.01,r.resolution*=1.01);return r.total()<s?new Et(s,0):r}function Ft(t){return Math.sqrt(2)*(2*t.tolerance+t.resolution)}function Pt(t){return Math.sqrt(2)*(t.tolerance+t.resolution)}function Ht(t){return t>=3}function Vt(t,e){const s=[0];return t.getImpl().getIsSimple(e,s)>=3}function kt(t,e){t.getImpl().setIsSimple(3,e)}function Mt(t,e,n,r){if(s(e.x-t.x)+s(e.y-t.y)<=n*n){const s=t.z,n=e.z;return i(s,n,r)}return!1}function Ot(t){return t>=4}function Yt(t,e){return t===y.enumPolygon?Ht(e):e>=1}function Xt(t,e,s){const i=p.constructEmpty(),n=p.constructEmpty();t.queryLooseEnvelope(i),e.queryLooseEnvelope(n),i.inflateCoords(s,s),n.inflateCoords(s,s);const r=p.constructEmpty();r.setCoords({env2D:i}),r.intersect(n);const h=t.querySegmentIterator(),o=e.querySegmentIterator(),a=p.constructEmpty(),m=p.constructEmpty(),_=new yt;_.setTolerance(s);let l=!1;for(_.startRedConstruction();h.nextPath();)for(;h.hasNextSegment();){h.nextSegment().queryLooseEnvelope(a),a.isIntersecting(r)&&(l=!0,_.addRedEnvelope(h.getStartPointIndex(),a))}if(_.endRedConstruction(),!l)return null;let u=!1;for(_.startBlueConstruction();o.nextPath();)for(;o.hasNextSegment();){o.nextSegment().queryLooseEnvelope(m),m.isIntersecting(r)&&(u=!0,_.addBlueEnvelope(o.getStartPointIndex(),m))}return _.endBlueConstruction(),u?_:null}function Gt(t,e,s,i,n){t.getGeometryType(),e.getGeometryType();const r=p.constructEmpty(),h=p.constructEmpty();t.queryLooseEnvelope(r),e.queryLooseEnvelope(h),r.inflateCoords(s,s),h.inflateCoords(s,s);const o=p.constructEmpty();o.setCoords({env2D:r}),o.intersect(h);const a=new yt;a.setTolerance(s);let m=!1;a.startRedConstruction();for(let l=0,u=t.getPathCount();l<u;l++)t.queryLoosePathEnvelope(l,r),r.isIntersecting(o)&&(m=!0,a.addRedEnvelope(l,r));if(a.endRedConstruction(),!m)return null;let _=!1;a.startBlueConstruction();for(let l=0,u=e.getPathCount();l<u;l++)e.queryLoosePathEnvelope(l,h),h.isIntersecting(o)&&(_=!0,a.addBlueEnvelope(l,h));return a.endBlueConstruction(),_?a:null}function Ut(t,e,s){const i=p.constructEmpty(),n=p.constructEmpty();t.queryLooseEnvelope(i),e.queryEnvelope(n),i.inflateCoords(s,s),n.inflateCoords(s,s);const r=p.constructEmpty();r.setCoords({env2D:i}),r.intersect(n);const h=t.querySegmentIterator(),o=new yt;o.setTolerance(s);let a=!1;for(o.startRedConstruction();h.nextPath();)for(;h.hasNextSegment();){h.nextSegment().queryLooseEnvelope(i),i.isIntersecting(r)&&(a=!0,o.addRedEnvelope(h.getStartPointIndex(),i))}if(o.endRedConstruction(),!a)return null;let m=!1;o.startBlueConstruction();for(let _=0,l=e.getPointCount();_<l;_++){const t=e.getXY(_);r.contains(t)&&(m=!0,o.addBlueEnvelope(_,p.construct(t.x,t.y,t.x,t.y)))}return o.endBlueConstruction(),m?o:null}function Zt(t,e,s){const i=p.constructEmpty(),n=p.constructEmpty();t.queryEnvelope(i),e.queryEnvelope(n),i.inflateCoords(s,s),n.inflateCoords(s,s);const r=p.constructEmpty();r.setCoords({env2D:i}),r.intersect(n);const h=new yt;h.setTolerance(s);let a=!1;h.startRedConstruction();const m=new o;for(let o=0,u=t.getPointCount();o<u;o++)t.queryXY(o,m),r.contains(m)&&(a=!0,h.addRedEnvelope(o,p.construct(m.x,m.y,m.x,m.y)));if(h.endRedConstruction(),!a)return null;let _=!1;h.startBlueConstruction();const l=new o;for(let o=0,u=e.getPointCount();o<u;o++)e.queryXY(o,l),r.contains(l)&&(_=!0,h.addBlueEnvelope(o,p.construct(l.x,l.y,l.x,l.y)));return h.endBlueConstruction(),_?h:null}function Qt(t){const e=new p;return t.queryLooseEnvelope(e),e.inflateCoords(1,1),jt(t,e)}function jt(t,e,s){const i=new p;if(t.queryLooseEnvelope(i),i.isEmpty())return null;t.getGeometryType();const n=new _t(i,8);let r=-1;const h=new p;let o=!1;do{for(let s=0,a=t.getPathCount();s<a;s++)if(t.queryLoosePathEnvelope(s,h),h.isIntersecting(e)){if(r=n.insertEx(s,h,r),-1===r){o&&b("build_quad_tree_for_paths"),i.assign(t.calculateEnvelope2D(!1)),o=!0,n.reset(i,8);break}o=!1}}while(o);return n}function Wt(t,e){if(!e){const e=new p;t.queryLooseEnvelope(e);const s=new _t(e,8);let i=-1;const n=new p,r=t.querySegmentIterator();let h=!1;for(;r.nextPath();)for(;r.hasNextSegment();){const o=r.nextSegment(),a=r.getStartPointIndex();if(o.queryLooseEnvelope(n),i=s.insertEx(a,n,i),-1===i){h&&b(""),e.assign(t.calculateEnvelope2D(!1)),h=!0,s.reset(e,8),r.resetToFirstPath();break}}return s}const s=new p;t.queryLooseEnvelope(s);const i=new _t(s,8);let n=-1;const r=new p,h=t.querySegmentIterator();let o=!1;for(;h.nextPath();)for(;h.hasNextSegment();){const a=h.nextSegment(),m=h.getStartPointIndex();if(a.queryLooseEnvelope(r),r.isIntersecting(e)&&(n=i.insertEx(m,r,n),-1===n)){o&&b(""),s.assign(t.calculateEnvelope2D(!1)),o=!0,i.reset(s,8),h.resetToFirstPath();break}}return i}function Jt(t,e){if(e){const s=new _t(e,8),i=new o,n=new p;let r=!1;for(let h=0;h<t.getPointCount();h++){if(i.setCoordsPoint2D(t.getXY(h)),!e.contains(i))continue;n.setCoords({pt:i});-1!==s.insert(h,n)||(r&&b(""),r=!0,s.reset(t.calculateEnvelope2D(),8),h=-1)}return s}return x("no-extent version not yet impl"),null}function Kt(t,e,s,i,n){let r=!1;const h=n.vmin,o=n.vmax;for(let a=s;a<e;a+=i){const e=t.read(a);e<h?(r=!0,t.write(a,h)):e>o&&(r=!0,t.write(a,o))}return r}function $t(t,e,s,i){if(!t.hasAttribute(s))return!1;const n=t.getGeometryType();if(n===y.enumGeometryCollection){const n=t,r=n.getGeometryCount();let h=0;for(let t=0;t<r;++t){h|=$t(n.getGeometry(t),e,s,i)?1:0}return!!h}if(D(n)){const n=t,r=xt.getPersistence(s),h=xt.getComponentCount(s),o=n.getPointCount();if(1===r){const t=Kt(n.getAttributeStreamRef(s),o*h,i,h,e);return t&&n.notifyModified(),t}if(2===r){const t=Kt(n.getAttributeStreamRef(s),o*h,i,h,e);return t&&n.notifyModified(),t}b("snap_coordinate not implemented")}if(n===y.enumEnvelope){const n=t,r=n.queryInterval(s,i);let h=!1;return r.vmin<e.vmin&&(h=!0,r.vmin=e.vmin),r.vmax>e.vmax&&(h=!0,r.vmax=e.vmax),h&&n.setIntervalEnvelope(s,i,r),h}if(n===y.enumPoint){const n=t;let r=n.getAttributeAsDbl(s,i),h=!1;return r<e.vmin&&(h=!0,r=e.vmin),r>e.vmax&&(h=!0,r=e.vmax),h&&n.setAttributeBasic(s,i,r),h}if(I(n)){const n=t;let r=n.getStartAttributeAsDbl(s,i),h=!1;return r<e.vmin&&(h=!0,r=e.vmin),r>e.vmax&&(h=!0,r=e.vmax),h&&n.setStartAttribute(s,i,r),r=n.getEndAttributeAsDbl(s,i),r<e.vmin&&(h=!0,r=e.vmin),r>e.vmax&&(h=!0,r=e.vmax),h&&n.setEndAttribute(s,i,r),h}b("snap_coordinate not implemented")}var te=z;class ee{constructor(t){if(this.m_description=null,this.x=Number.NaN,this.y=Number.NaN,this.m_attribs=null,t){if(!t.copy)return t.move?(this.m_description=t.move.m_description,t.move.m_description=null,this.m_attribs=t.move.m_attribs,t.move.m_attribs=null,this.x=t.move.x,void(this.y=t.move.y)):t.vd?(this.m_description=t.vd,void(t.attribBuffer?(this.m_attribs=t.attribBuffer,t.initDefaultValues&&this.setDefaultAttributeValues()):this.ensureAttributes())):t.pt?(this.m_description=M(),void this.setXY(t.pt)):void("x"in t&&("z"in t?(this.m_description=O(),this.ensureAttributes(),this.setXYZ(new X(t.x,t.y,t.z))):(this.m_description=M(),this.setXYCoords(t.x,t.y))));t.copy.copyTo(this)}else this.m_description=M()}assignCopy(t){return this.m_attribs=null,t.copyTo(this),this}assignMove(t){return this.m_attribs=null,t.copyTo(this),t.setEmpty(),this}getXY(){return new o(this.x,this.y)}queryXY(t){t.x=this.x,t.y=this.y}setXY(t){this.x=t.x,this.y=t.y}setXYCoords(t,e){this.x=t,this.y=e}getXYZ(){const t=new X;return t.x=this.x,t.y=this.y,t.z=this.getZ(),t}setXYZ(t){this.addAttribute(1),this.x=t.x,this.y=t.y,this.m_attribs[0]=t.z}getX(){return this.x}setX(t){this.x=t}getY(){return this.y}setY(t){this.y=t}getZ(){return this.m_description.hasZ()?this.m_attribs[0]:te.getDefaultValue(1)}setZ(t){this.addAttribute(1),this.m_attribs[0]=t}getM(){return this.getAttributeAsDbl(2,0)}setM(t){this.addAttribute(2),this.m_description.hasZ()?this.m_attribs[1]=t:this.m_attribs[0]=t}getID(){return this.getAttributeAsInt(3,0)}setID(t){this.setAttributeBasic(3,0,t)}isEqualXY(t,e){return void 0===e&&(e=0),Math.abs(t.x-this.x)<=e&&Math.abs(t.y-this.y)<=e}isEqualXYCoords(t,e,s){return void 0===s&&(s=0),Math.abs(t-this.x)<=s&&Math.abs(e-this.y)<=s}getAttributeAsDbl(t,e){if(0===t){if(0===e)return this.x;if(1===e)return this.y;v("")}const s=te.getComponentCount(t);(e<0||e>=s)&&v("");const i=this.m_description.getAttributeIndex(t);return i>=0?this.m_attribs[this.m_description.getPointAttributeOffset(i)-2+e]:te.getDefaultValue(t)}getAttributeAsInt(t,e){return Math.trunc(this.getAttributeAsDbl(t,e))}setAttributeBasic(t,e,s){if(0===t)return void(0===e?this.x=s:1===e?this.y=s:v(""));const i=te.getComponentCount(t);(e<0||e>=i)&&v("");let n=this.m_description.getAttributeIndex(t);n<0&&(this.addAttribute(t),n=this.m_description.getAttributeIndex(t)),this.m_attribs[this.m_description.getPointAttributeOffset(n)-2+e]=s}copyAttributesFrom(t,e){if(this===t)return;const s=t.getDescription();for(let i=e&&s.hasZ()?2:1,n=s.getAttributeCount();i<n;++i){const e=s.getSemantics(i),n=te.getComponentCount(e);for(let s=0;s<n;++s){const i=t.getAttributeAsDbl(e,s);this.setAttributeBasic(e,s,i)}}}getAttributeArray(){return this.m_attribs}getDescription(){return this.m_description}assignVertexDescription(t){this.m_description!==t&&this.assignVertexDescriptionImpl(t)}mergeVertexDescription(t){this.m_description!==t&&(this.m_description.hasAttributesFrom(t)||this.mergeVertexDescriptionImpl(t))}hasAttribute(t){return this.m_description.hasAttribute(t)}addAttribute(t){if(this.m_description.hasAttribute(t))return;const e=V(this.m_description,t);this.assignVertexDescription(e)}dropAttribute(t){if(!this.m_description.hasAttribute(t))return;const e=k(this.m_description,t);this.assignVertexDescription(e)}dropAllAttributes(){const t=M();t!==this.m_description&&this.assignVertexDescription(t)}getGeometryType(){return y.enumPoint}getDimension(){return 0}queryEnvelope(t){if(t instanceof re)return t.setEmpty(),t.assignVertexDescription(this.m_description),void t.merge(this);if(t instanceof G){if(this.isEmpty())return void t.setEmpty();const e=this.getXYZ();return t.xmin=e.x,t.ymin=e.y,t.zmin=e.z,t.xmax=e.x,t.ymax=e.y,void(t.zmax=e.z)}this.isEmpty()?t.setEmpty():(t.xmin=this.x,t.ymin=this.y,t.xmax=this.x,t.ymax=this.y)}queryLooseEnvelope(t){this.queryEnvelope(t)}queryInterval(t,e){const s=new r;if(this.isEmpty())return s.setEmpty(),s;const i=this.getAttributeAsDbl(t,e);return s.vmin=i,s.vmax=i,s}applyTransformation(t){if(!this.isEmpty()){if(1===t.m_TransformationType){const e=this.getXY();return t.transformInPlace(e),void this.setXY(e)}x("3d not impl")}}transformAttribute(t,e,s,i,n){if(this.isEmpty())return;this.addAttribute(t);const r=this.getAttributeAsDbl(t,e),h=Nt(s,i,n);this.setAttributeBasic(t,e,h(r))}createInstance(){return new ee({vd:this.m_description})}copyTo(t){if(this===t)return;t.getGeometryType()!==y.enumPoint&&f();const e=t;e.x=this.x,e.y=this.y,this.m_attribs?(e.assignVertexDescription(this.m_description),e.m_attribs=this.m_attribs.slice()):(e.releaseAttributes(),e.assignVertexDescription(this.m_description))}isEmpty(){return Number.isNaN(this.x)||Number.isNaN(this.y)}setEmpty(){this.m_description||(this.m_description=M(),this.releaseAttributes()),this.x=Number.NaN,this.y=Number.NaN,this.m_attribs&&m(this.m_attribs,this.m_description.getDefaultPointAttributes(),0,2,this.m_description.getTotalComponentCount()-2)}calculateArea2D(){return 0}calculateLength2D(){return 0}calculateLength3D(t){return 0}equals(t,e){if(t===this)return!0;if(t.getGeometryType()!==y.enumPoint)return!1;const s=t;if(this.m_description!==s.m_description)return!1;if(this.isEmpty()!==s.isEmpty())return!1;if(this.isEmpty())return!0;if(void 0===e&&(e=0),Math.abs(this.x-s.x)>e)return!1;if(Math.abs(this.y-s.y)>e)return!1;for(let n=0,r=this.m_description.getTotalComponentCount()-2;n<r;n++)if(!i(this.m_attribs[n],s.m_attribs[n],e))return!1;return!0}getBoundary(){return null}clone(){const t=new ee({vd:this.m_description});return this.copyTo(t),t}swap(t){if(this===t)return;t.getGeometryType()!==y.enumPoint&&f("wrong geometry type");const e=t;e.m_description=h(this.m_description,this.m_description=e.m_description),e.x=h(this.x,this.x=e.x),e.y=h(this.y,this.y=e.y),e.m_attribs=h(this.m_attribs,this.m_attribs=e.m_attribs)}replaceNaNs(t,e){if(this.addAttribute(t),this.isEmpty())return;const s=te.getComponentCount(t);for(let i=0;i<s;i++){const s=this.getAttributeAsDbl(t,i);Number.isNaN(s)&&this.setAttributeBasic(t,i,e)}}lerp(t,e,s){if(t.getDescription()!==e.getDescription()&&f("Point.lerp"),this.assignVertexDescription(t.getDescription()),t.isEmpty()||e.isEmpty())return this.setEmpty(),this;this.ensureAttributes();const i=B();t.queryValues(i,i.length);const n=B();e.queryValues(n,n.length);const r=B();let h=i,o=n;const a=r;let m=0;for(let l=0,u=this.m_description.getAttributeCount();l<u;l++){const t=this.m_description.getSemantics(l),e=te.getInterpolation(t),i=te.getComponentCount(t),n=te.getDefaultValue(t);_(e,h,o,a,m,i,s,n),h=h.slice(i),o=o.slice(i),m+=i}return this.setValues(r,m),this}static lerp(t,e,s,i){i.lerp(t,e,s)}setDefaultAttributeValues(){const t=this.m_description.getTotalComponentCount()-2;t>0&&(this.m_attribs?m(this.m_attribs,this.m_description.getDefaultPointAttributes(),0,2,t):this.m_attribs=this.m_description.getDefaultPointAttributes().slice(2))}static sqrDistance2D(t,e){return o.sqrDistanceCoords(t.x,t.y,e.x,e.y)}getImpl(){return this}mergeVertexDescriptionImpl(t){const e=H(this.getDescription(),t);this.assignVertexDescription(e)}releaseAttributes(){this.m_attribs=null}assignVertexDescriptionImpl(t){this.m_description||(this.m_description=M());const e=S();Y(t,this.m_description,e);let s=null;t.getTotalComponentCount()-2>0&&(s=t.getDefaultPointAttributes().slice(2));for(let i=1,n=t.getAttributeCount();i<n;i++){const n=e[i];if(-1!==n){const e=this.m_description.getPointAttributeOffset(n)-2,r=t.getPointAttributeOffset(i)-2,h=te.getComponentCount(t.getSemantics(i));for(let t=0;t<h;t++)s[r+t]=this.m_attribs[e+t]}}this.m_attribs=s,this.m_description=t}ensureAttributes(){this.m_description.getTotalComponentCount()-2>0&&null===this.m_attribs&&(this.m_attribs=this.m_description.getDefaultPointAttributes().slice(2))}queryValues(t,e){const s=this.m_description.getTotalComponentCount();g(s<=e),t[0]=this.x,t[1]=this.y,m(t,this.m_attribs,2,0,s-2)}copyCommonAttributesTo(t){t.x=this.x,t.y=this.y;const e=t.getDescription();if(e===this.m_description)this.m_attribs&&m(t.m_attribs,this.m_attribs,0,0,this.m_description.getTotalComponentCount()-2);else{let s=0;for(let i=1,n=e.getAttributeCount();i<n;i++){const n=e.getSemantics(i);let r=te.getComponentCount(n);if(this.m_description.hasAttribute(n)){let e=this.m_description.getPointAttributeOffset(this.m_description.getAttributeIndex(n))-2;for(;0!==r;)t.m_attribs[s++]=this.m_attribs[e++],r--}else{const e=te.getDefaultValue(n);for(;0!==r;)t.m_attribs[s++]=e,r--}}}}setValues(t,e){const s=this.m_description.getTotalComponentCount();g(s<=e),this.x=t[0],this.y=t[1],m(this.m_attribs,t,0,2,s-2)}dbgDefaultAttribs(){}}ee.type=y.enumPoint;var se=z;function ie(t,e){return e*(t.getTotalComponentCount()-2)}class ne{constructor(t){if(this.m_attributes=null,t)if(void 0!==t.xmin)this.m_envelope2D=new p(t.xmin,t.ymin,t.xmax,t.ymax);else if(void 0!==t.env2D)this.m_envelope2D=new p(t.env2D);else if(t.move)this.m_envelope2D=new p(t.move.m_envelope2D),this.m_attributes=t.move.m_attributes,t.move.m_attributes=null;else{if(!t.moveEnv)throw new Error("unrecognized EnvelopeData constructor options");{const e=t.moveEnv.accessEnvelopeData();this.m_envelope2D=new p(e.m_envelope2D),this.m_attributes=e.m_attributes,e.m_attributes=null}}else this.m_envelope2D=p.constructEmpty()}ensureAttributes(t){const s=t.getTotalComponentCount()-2;!this.m_attributes&&s&&(this.m_attributes=e(2*s,Number.NaN),this.m_attributes.fill(Number.NaN))}copyTo(t,s){const i=s,n=t.getTotalComponentCount()-2;if(i.m_description!==t&&(i.releaseAttributes_(),i.m_description=t,n&&(i.m_data.m_attributes=e(2*n,Number.NaN))),n){g(this.m_attributes&&i.m_data.m_attributes);const t=2*n;m(i.m_data.m_attributes,this.m_attributes,0,0,t)}i.m_data.m_envelope2D=new p(this.m_envelope2D)}copyToIfNotNull(t,e){e.m_envelope2D=new p(this.m_envelope2D),e.releaseAttributes();t.getTotalComponentCount()-2&&this.m_attributes&&(e.m_attributes=this.m_attributes.slice())}releaseAttributes(){this.m_attributes=null}isEmpty(){return this.m_envelope2D.isEmpty()}transformAttribute(t,e,s,i,n){g(0)}queryInterval(t,e,s,i){if(this.isEmpty())return void i.setEmpty();if(0===e)return void(0===s?this.m_envelope2D.queryIntervalX(i):1===s?this.m_envelope2D.queryIntervalY(i):v(""));const n=se.getComponentCount(e);(s<0||s>=n)&&v("");const r=t.getAttributeIndex(e);if(r>=0)return i.vmin=this.m_attributes[ie(t,0)+t.getPointAttributeOffset(r)-2+s],void(i.vmax=this.m_attributes[ie(t,1)+t.getPointAttributeOffset(r)-2+s]);{const t=se.getDefaultValue(e);return void i.setCoords(t,t)}}queryEnvelope3D(t,e){const s=new r;this.queryInterval(t,1,0,s),e.setCoords(this.m_envelope2D.xmin,this.m_envelope2D.ymin,s.vmin,this.m_envelope2D.xmax,this.m_envelope2D.ymax,s.vmax)}setEmpty(t){this.m_envelope2D.setEmpty();const s=t.getTotalComponentCount()-2;s&&(this.m_attributes?this.dbgAssertSize(s):this.m_attributes=e(2*s,Number.NaN),this.m_attributes.fill(Number.NaN))}dbgAssertSize(t){}}let re=class t{constructor(t){if(this.m_EnvelopeType=4,this.m_description=M(),void 0===t)this.m_data=new ne;else if(void 0!==t.vd)this.m_description=t.vd,this.m_data=new ne,this.ensureAttributes_();else if(t?.env2D)this.m_data=new ne({env2D:t.env2D});else if(void 0!==t.xmin)this.m_data=new ne({xmin:t.xmin,ymin:t.ymin,xmax:t.xmax,ymax:t.ymax});else if(t.copy)this.m_data=new ne,t.copy.copyTo(this);else if(t.move)this.m_description=t.move.m_description,t.move.m_description=null,this.m_data=new ne({move:t.move.m_data});else{if(!t.centerPoint)throw new Error("unrecognized Envelope constructor options");this.m_description=t.centerPoint.getDescription(),this.m_data=new ne,this.ensureAttributes_(),this.setFromPoint(t.centerPoint,t.width,t.height)}}accessEnvelopeData(){return this.m_description=null,this.m_data}assignMove(t){return this===t||(this.m_description=t.m_description,t.m_description=null,this.m_data=new ne({move:t.m_data})),this}assignCopy(t){return this===t||t.copyTo(this),this}transformAttribute(t,e,s,i,n){g(0)}setAttributeBasic(t,e,s){if(this.addAttribute(t),this.m_data.isEmpty())return;const i=this.queryInterval(t,e);i.vmin=s,i.vmax=s,this.setIntervalEnvelope(t,e,i)}mergeVertexDescriptionImpl(t){const e=H(this.getDescription(),t);this.assignVertexDescription(e)}asEnvelope2D(){return new p(this.m_data.m_envelope2D)}assignVertexDescription(t){this.m_description!==t&&this.assignVertexDescriptionImpl(t)}getGeometryType(){return y.enumEnvelope}getDimension(){return 2}getXMin(){return this.m_data.m_envelope2D.xmin}getYMin(){return this.m_data.m_envelope2D.ymin}getXMax(){return this.m_data.m_envelope2D.xmax}getYMax(){return this.m_data.m_envelope2D.ymax}width(){return this.m_data.isEmpty()?Number.NaN:this.m_data.m_envelope2D.width()}height(){return this.m_data.isEmpty()?Number.NaN:this.m_data.m_envelope2D.height()}getCenterXY(){return this.m_data.isEmpty()?new o:this.m_data.m_envelope2D.getCenter()}getCenter(t){if(t.assignVertexDescription(this.m_description),this.m_data.isEmpty())return void t.setEmpty();const e=this.m_description.getAttributeCount();for(let s=1;s<e;s++){const e=this.m_description.getSemantics(s),i=se.getComponentCount(e);for(let s=0;s<i;s++){const i=.5*(this.getAttributeAsDblImpl(0,e,s)+this.getAttributeAsDblImpl(1,e,s));t.setAttributeBasic(e,s,i)}}t.setXY(this.m_data.m_envelope2D.getCenter())}setCoords(t,e,s,i){this.m_data.m_envelope2D.setCoords({xmin:t,ymin:e,xmax:s,ymax:i})}setEnvelope(t){if(t instanceof p)this.m_data.m_envelope2D=new p(t),this.m_data.m_envelope2D.normalize();else{this.addAttribute(1),this.m_data.m_envelope2D=t.getEnvelope2D(),this.m_data.m_envelope2D.normalize();const e=r.constructEmpty();e.setCoords(t.zmin,t.zmax),this.setInterval(1,0,e.vmin,e.vmax)}}merge(e){if(e instanceof p)return e.isValid()||f(""),void this.m_data.m_envelope2D.mergeEnvelope2D(e);if(e instanceof t){if(e.m_data.isEmpty())return;const t=e.getDescription();this.mergeVertexDescription(t),this.m_data.m_envelope2D.mergeEnvelope2D(e.m_data.m_envelope2D);for(let s=1,i=t.getAttributeCount();s<i;s++){const i=t.getSemantics(s),n=se.getComponentCount(i);for(let t=0;t<n;t++){const s=e.queryInterval(i,t),n=this.queryInterval(i,t);n.merge(s),this.setIntervalEnvelope(i,t,n)}}}else if(e instanceof ee){const t=e;if(t.isEmpty())return;const s=t.getDescription();if(this.mergeVertexDescription(s),this.m_data.isEmpty())return void this.setFromPoint(t);this.m_data.m_envelope2D.merge(t.getXY());for(let e=1,i=s.getAttributeCount();e<i;e++){const i=s.getSemantics(e),n=se.getComponentCount(i);for(let e=0;e<n;e++){const s=t.getAttributeAsDbl(i,e),n=this.queryInterval(i,e);n.mergeCoordinate(s),this.setIntervalEnvelope(i,e,n)}}}else x("unrecognized type for envelope.merge")}intersect(t){if(!this.m_data.m_envelope2D.intersect(t.m_data.m_envelope2D))return this.setEmpty(),!1;const e=t.getDescription();this.mergeVertexDescription(e);for(let s=1,i=this.m_description.getAttributeCount();s<i;s++){const e=this.m_description.getSemantics(s),i=se.getComponentCount(e);for(let s=0;s<i;s++){const i=t.queryInterval(e,s),n=this.queryInterval(e,s);n.intersect(i),this.setIntervalEnvelope(e,s,n)}}return!0}intersectCommonAttributes(t){if(!this.m_data.m_envelope2D.intersect(t.m_data.m_envelope2D))return this.setEmpty(),!1;const e=t.getDescription();for(let s=1,i=this.m_description.getAttributeCount();s<i;s++){const i=this.m_description.getSemantics(s);if(!e.hasAttribute(i))continue;const n=se.getComponentCount(i);for(let e=0;e<n;e++){const s=t.queryInterval(i,e),n=this.queryInterval(i,e);n.intersect(s),this.setIntervalEnvelope(i,e,n)}}return!0}move(t,e){this.m_data.m_envelope2D.move(t,e)}centerAt(t,e){this.m_data.m_envelope2D.centerAtCoords(t,e)}centerAtPoint(t){this.m_data.m_envelope2D.centerAt(t)}reaspect(t,e){this.m_data.m_envelope2D.reaspect(t,e)}inflateCoords(t,e){this.m_data.m_envelope2D.inflateCoords(t,e)}containsCoords(t,e){return this.m_data.m_envelope2D.containsCoords(t,e)}contains(t){return this.m_data.m_envelope2D.contains(t)}containsPoint(t){return!t.isEmpty()&&this.m_data.m_envelope2D.contains(t.getXY())}containsEnvelope(t){return this.m_data.m_envelope2D.containsEnvelope(t.m_data.m_envelope2D)}setIntervalEnvelope(t,e,s){if(this.addAttribute(t),this.m_data.isEmpty())return;const i=new r(s);if(i.normalize(),0===t){if(i.isEmpty())return void this.setEmpty();0===e?(this.m_data.m_envelope2D.xmin=i.vmin,this.m_data.m_envelope2D.xmax=i.vmax):1===e?(this.m_data.m_envelope2D.ymin=i.vmin,this.m_data.m_envelope2D.ymax=i.vmax):v("")}else this.setAttributeAsDblImpl(0,t,e,i.vmin),this.setAttributeAsDblImpl(1,t,e,i.vmax)}setInterval(t,e,s,i){this.setIntervalEnvelope(t,e,new r(s,i))}queryInterval(t,e){const s=new r;return this.m_data.queryInterval(this.m_description,t,e,s),s}queryEnvelope(t){2!==t.m_EnvelopeType?3!==t.m_EnvelopeType?4!==t.m_EnvelopeType?x("unrecognized type for queryEnveloper"):this.copyTo(t):this.m_data.queryEnvelope3D(this.m_description,t):t.setCoords({env2D:this.m_data.m_envelope2D})}applyTransformation(t){1!==t.m_TransformationType?g(0):t.transformEnvInPlace(this.m_data.m_envelope2D)}createInstance(){return new t({vd:this.m_description})}copyTo(t){t!==this&&this.m_data.copyTo(this.m_description,t)}isEmpty(){return this.m_data.isEmpty()}setEmpty(){this.m_description||(this.m_description=M()),this.m_data.setEmpty(this.m_description)}calculateArea2D(){return this.m_data.m_envelope2D.getArea()}calculateLength2D(){return this.m_data.m_envelope2D.getLength()}calculateLength3D(t){return g(0),0}equals(t,e){if(t===this)return!0;const s=t;if(this.m_description!==s.m_description)return!1;if(this.m_data.isEmpty()!==s.m_data.isEmpty())return!1;if(this.m_data.isEmpty())return!0;if(void 0===e&&(e=0),Math.abs(this.m_data.m_envelope2D.xmin-s.m_data.m_envelope2D.xmin)>e)return!1;if(Math.abs(this.m_data.m_envelope2D.ymin-s.m_data.m_envelope2D.ymin)>e)return!1;if(Math.abs(this.m_data.m_envelope2D.xmax-s.m_data.m_envelope2D.xmax)>e)return!1;if(Math.abs(this.m_data.m_envelope2D.ymax-s.m_data.m_envelope2D.ymax)>e)return!1;for(let n=0,r=2*(this.m_description.getTotalComponentCount()-2);n<r;n++)if(!i(this.m_data.m_attributes[n],s.m_data.m_attributes[n],e))return!1;return!0}getBoundary(){return x("getBoundary not available in this context. Use the boundary operator with an envelope parameter"),null}clone(){return new t({copy:this})}swap(t){if(this===t)return;t.getGeometryType()!==y.enumEnvelope&&f("wrong geometry type");const e=t;e.m_description=h(this.m_description,this.m_description=e.m_description),e.m_data.m_envelope2D=h(this.m_data.m_envelope2D,this.m_data.m_envelope2D=e.m_data.m_envelope2D),e.m_data.m_attributes=h(this.m_data.m_attributes,this.m_data.m_attributes=e.m_data.m_attributes)}queryCoordinates(t){this.m_data.isEmpty()&&f(""),this.m_data.m_envelope2D.queryCorners(t)}queryCornerByVal(t,e){(t<0||t>3)&&v(""),e.assignVertexDescription(this.m_description);const s=this.getDescription().getAttributeCount();for(let i=1;i<s;i++){const s=this.m_description.getSemantics(i),n=se.getComponentCount(s);for(let i=0;i<n;i++)e.setAttributeBasic(s,i,this.getAttributeAsDblImpl(t%2,s,i))}e.setXY(this.m_data.m_envelope2D.queryCorner(t))}queryCorner(t,e){e.assign(this.m_data.m_envelope2D.queryCorner(t))}getDescription(){return this.m_description}mergeVertexDescription(t){this.m_description!==t&&(this.m_description&&this.m_description.hasAttributesFrom(t)||this.mergeVertexDescriptionImpl(t))}hasAttribute(t){return this.m_description.hasAttribute(t)}addAttribute(t){if(this.m_description.hasAttribute(t))return;const e=V(this.m_description,t);this.assignVertexDescription(e)}dropAttribute(t){if(!this.m_description.hasAttribute(t))return;const e=k(this.m_description,t);this.assignVertexDescription(e)}dropAllAttributes(){const t=M();t!==this.m_description&&this.assignVertexDescription(t)}queryLooseEnvelope(t){this.queryEnvelope(t)}replaceNaNs(t,e){if(this.addAttribute(t),this.m_data.isEmpty())return;const s=se.getComponentCount(t);for(let i=0;i<s;i++){const s=this.queryInterval(t,i);s.isEmpty()&&(s.vmin=e,s.vmax=e,this.setIntervalEnvelope(t,i,s))}}getImpl(){return this}setFromPoint(t,e,s){this.m_data.m_envelope2D.setCoords({center:t.getXY(),width:e??0,height:s??0});const i=t.getDescription();for(let n=1,r=i.getAttributeCount();n<r;n++){const e=i.getSemantics(n),s=se.getComponentCount(e);for(let i=0;i<s;i++){const s=t.getAttributeAsDbl(e,i);this.setInterval(e,i,s,s)}}}assignVertexDescriptionImpl(t){const s=S();Y(t,this.m_description,s);let i=null;const n=t.getTotalComponentCount()-2,r=this.m_description?this.m_description.getTotalComponentCount()-2:0;n>0&&(i=e(2*n,Number.NaN));for(let e=1;e<t.getAttributeCount();e++){const h=s[e];if(-1!==h){const s=t.getPointAttributeOffset(e)-2,o=se.getComponentCount(t.getSemantics(e)),a=this.m_description.getPointAttributeOffset(h)-2;m(i,this.m_data.m_attributes,s,a,o),m(i,this.m_data.m_attributes,n+s,r+a,o)}}this.releaseAttributes_(),this.m_data.m_attributes=i,this.m_description=t}getAttributeAsDblImpl(t,e,s){if(this.m_data.isEmpty()&&E(""),0===e)return t?s?this.m_data.m_envelope2D.ymax:this.m_data.m_envelope2D.xmax:s?this.m_data.m_envelope2D.ymin:this.m_data.m_envelope2D.xmin;s>=se.getComponentCount(e)&&v("");const i=this.m_description.getAttributeIndex(e);return i>=0?this.m_data.m_attributes[ie(this.m_description,t)+this.m_description.getPointAttributeOffset(i)-2+s]:z.getDefaultValue(e)}setAttributeAsDblImpl(t,e,s,i){0===e&&(t?1===s?this.m_data.m_envelope2D.ymax=i:0===s?this.m_data.m_envelope2D.xmax=i:v(""):1===s?this.m_data.m_envelope2D.ymin=i:0===s?this.m_data.m_envelope2D.xmin=i:v(""));const n=se.getComponentCount(e);(s<0||s>=n)&&v(""),this.addAttribute(e);const r=this.m_description.getAttributeIndex(e);this.m_data.m_attributes[ie(this.m_description,t)+this.m_description.getPointAttributeOffset(r)-2+s]=i}releaseAttributes_(){this.m_data.releaseAttributes()}ensureAttributes_(){this.m_data.ensureAttributes(this.m_description)}};re.type=y.enumEnvelope;const he=Object.freeze(Object.defineProperty({__proto__:null,Envelope:re,EnvelopeData:ne},Symbol.toStringTag,{value:"Module"}));export{Ut as $,st as A,ot as B,Et as C,$ as D,re as E,Wt as F,Qt as G,Rt as H,Ct as I,Tt as J,Q as K,Lt as L,Yt as M,pt as N,w as O,ee as P,Pt as Q,wt as R,at as S,ct as T,et as U,z as V,Mt as W,Ht as X,qt as Y,Jt as Z,Xt as _,zt as a,Zt as a0,Gt as a1,yt as a2,dt as a3,bt as a4,$t as a5,U as a6,he as a7,Bt as b,At as c,X as d,Ft as e,Dt as f,It as g,Vt as h,Ot as i,M as j,ne as k,H as l,V as m,G as n,B as o,S as p,Y as q,k as r,kt as s,j as t,W as u,Nt as v,O as w,nt as x,J as y,K as z};
|
package/chunks/Jpg.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{g as e}from"./_commonjsHelpers.js";var n,r={exports:{}};function o(){return n||(n=1,e=r,o=function(){var e=function(){function e(e){this.message="JPEG error: "+e}return e.prototype=new Error,e.prototype.name="JpegError",e.constructor=e,e}();return function(){if(!self||!self.Uint8ClampedArray)return null;var n=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),r=4017,o=799,a=3406,t=2276,i=1567,s=3784,c=5793,f=2896;function l(){this.decodeTransform=null,this.colorTransform=-1}function u(e,n){for(var r,o,a=0,t=[],i=16;i>0&&!e[i-1];)i--;t.push({children:[],index:0});var s,c=t[0];for(r=0;r<i;r++){for(o=0;o<e[r];o++){for((c=t.pop()).children[c.index]=n[a];c.index>0;)c=t.pop();for(c.index++,t.push(c);t.length<=r;)t.push(s={children:[],index:0}),c.children[c.index]=s.children,c=s;a++}r+1<i&&(t.push(s={children:[],index:0}),c.children[c.index]=s.children,c=s)}return t[0].children}function h(e,n,r){return 64*((e.blocksPerLine+1)*n+r)}function v(r,o,a,t,i,s,c,f,l){var u=a.mcusPerLine,v=a.progressive,m=o,d=0,b=0;function k(){if(b>0)return b--,d>>b&1;if(255===(d=r[o++])){var n=r[o++];if(n)throw new e("unexpected marker "+(d<<8|n).toString(16))}return b=7,d>>>7}function g(n){for(var r=n;;){if("number"==typeof(r=r[k()]))return r;if("object"!=typeof r)throw new e("invalid huffman sequence")}}function C(e){for(var n=0;e>0;)n=n<<1|k(),e--;return n}function w(e){if(1===e)return 1===k()?1:-1;var n=C(e);return n>=1<<e-1?n:n+(-1<<e)+1}function x(e,r){var o=g(e.huffmanTableDC),a=0===o?0:w(o);e.blockData[r]=e.pred+=a;for(var t=1;t<64;){var i=g(e.huffmanTableAC),s=15&i,c=i>>4;if(0!==s){var f=n[t+=c];e.blockData[r+f]=w(s),t++}else{if(c<15)break;t+=16}}}function y(e,n){var r=g(e.huffmanTableDC),o=0===r?0:w(r)<<l;e.blockData[n]=e.pred+=o}function D(e,n){e.blockData[n]|=k()<<l}var T=0;function P(e,r){if(T>0)T--;else for(var o=s,a=c;o<=a;){var t=g(e.huffmanTableAC),i=15&t,f=t>>4;if(0!==i){var u=n[o+=f];e.blockData[r+u]=w(i)*(1<<l),o++}else{if(f<15){T=C(f)+(1<<f)-1;break}o+=16}}}var L,A=0;function _(r,o){for(var a,t,i=s,f=c,u=0;i<=f;){var h=n[i];switch(A){case 0:if(u=(t=g(r.huffmanTableAC))>>4,0==(a=15&t))u<15?(T=C(u)+(1<<u),A=4):(u=16,A=1);else{if(1!==a)throw new e("invalid ACn encoding");L=w(a),A=u?2:3}continue;case 1:case 2:r.blockData[o+h]?r.blockData[o+h]+=k()<<l:0==--u&&(A=2===A?3:0);break;case 3:r.blockData[o+h]?r.blockData[o+h]+=k()<<l:(r.blockData[o+h]=L<<l,A=0);break;case 4:r.blockData[o+h]&&(r.blockData[o+h]+=k()<<l)}i++}4===A&&0==--T&&(A=0)}function U(e,n,r,o,a){var t=r%u;n(e,h(e,(r/u|0)*e.v+o,t*e.h+a))}function z(e,n,r){n(e,h(e,r/e.blocksPerLine|0,r%e.blocksPerLine))}var I,M,Y,q,S,H,R=t.length;H=v?0===s?0===f?y:D:0===f?P:_:x;var j,E,J,V,B=0;for(E=1===R?t[0].blocksPerLine*t[0].blocksPerColumn:u*a.mcusPerColumn;B<E;){var N=i?Math.min(E-B,i):E;for(M=0;M<R;M++)t[M].pred=0;if(T=0,1===R)for(I=t[0],S=0;S<N;S++)z(I,H,B),B++;else for(S=0;S<N;S++){for(M=0;M<R;M++)for(J=(I=t[M]).h,V=I.v,Y=0;Y<V;Y++)for(q=0;q<J;q++)U(I,H,B,Y,q);B++}b=0,(j=p(r,o))&&j.invalid&&(console.log("decodeScan - unexpected MCU data, next marker is: "+j.invalid),o=j.offset);var G=j&&j.marker;if(!G||G<=65280)throw new e("marker was not found");if(!(G>=65488&&G<=65495))break;o+=2}return(j=p(r,o))&&j.invalid&&(console.log("decodeScan - unexpected Scan data, next marker is: "+j.invalid),o=j.offset),o-m}function m(n,l,u){var h,v,m,d,p,b,k,g,C,w,x,y,D,T,P,L,A,_=n.quantizationTable,U=n.blockData;if(!_)throw new e("missing required Quantization Table.");for(var z=0;z<64;z+=8)C=U[l+z],w=U[l+z+1],x=U[l+z+2],y=U[l+z+3],D=U[l+z+4],T=U[l+z+5],P=U[l+z+6],L=U[l+z+7],C*=_[z],w|x|y|D|T|P|L?(w*=_[z+1],x*=_[z+2],y*=_[z+3],D*=_[z+4],T*=_[z+5],P*=_[z+6],L*=_[z+7],v=(h=(h=c*C+128>>8)+(v=c*D+128>>8)+1>>1)-v,A=(m=x)*s+(d=P)*i+128>>8,m=m*i-d*s+128>>8,k=(p=(p=f*(w-L)+128>>8)+(k=T<<4)+1>>1)-k,b=(g=(g=f*(w+L)+128>>8)+(b=y<<4)+1>>1)-b,d=(h=h+(d=A)+1>>1)-d,m=(v=v+m+1>>1)-m,A=p*t+g*a+2048>>12,p=p*a-g*t+2048>>12,g=A,A=b*o+k*r+2048>>12,b=b*r-k*o+2048>>12,k=A,u[z]=h+g,u[z+7]=h-g,u[z+1]=v+k,u[z+6]=v-k,u[z+2]=m+b,u[z+5]=m-b,u[z+3]=d+p,u[z+4]=d-p):(A=c*C+512>>10,u[z]=A,u[z+1]=A,u[z+2]=A,u[z+3]=A,u[z+4]=A,u[z+5]=A,u[z+6]=A,u[z+7]=A);for(var I=0;I<8;++I)C=u[I],(w=u[I+8])|(x=u[I+16])|(y=u[I+24])|(D=u[I+32])|(T=u[I+40])|(P=u[I+48])|(L=u[I+56])?(v=(h=4112+((h=c*C+2048>>12)+(v=c*D+2048>>12)+1>>1))-v,A=(m=x)*s+(d=P)*i+2048>>12,m=m*i-d*s+2048>>12,d=A,k=(p=(p=f*(w-L)+2048>>12)+(k=T)+1>>1)-k,b=(g=(g=f*(w+L)+2048>>12)+(b=y)+1>>1)-b,A=p*t+g*a+2048>>12,p=p*a-g*t+2048>>12,g=A,A=b*o+k*r+2048>>12,b=b*r-k*o+2048>>12,C=(C=(h=h+d+1>>1)+g)<16?0:C>=4080?255:C>>4,w=(w=(v=v+m+1>>1)+(k=A))<16?0:w>=4080?255:w>>4,x=(x=(m=v-m)+b)<16?0:x>=4080?255:x>>4,y=(y=(d=h-d)+p)<16?0:y>=4080?255:y>>4,D=(D=d-p)<16?0:D>=4080?255:D>>4,T=(T=m-b)<16?0:T>=4080?255:T>>4,P=(P=v-k)<16?0:P>=4080?255:P>>4,L=(L=h-g)<16?0:L>=4080?255:L>>4,U[l+I]=C,U[l+I+8]=w,U[l+I+16]=x,U[l+I+24]=y,U[l+I+32]=D,U[l+I+40]=T,U[l+I+48]=P,U[l+I+56]=L):(A=(A=c*C+8192>>14)<-2040?0:A>=2024?255:A+2056>>4,U[l+I]=A,U[l+I+8]=A,U[l+I+16]=A,U[l+I+24]=A,U[l+I+32]=A,U[l+I+40]=A,U[l+I+48]=A,U[l+I+56]=A)}function d(e,n){for(var r=n.blocksPerLine,o=n.blocksPerColumn,a=new Int16Array(64),t=0;t<o;t++)for(var i=0;i<r;i++)m(n,h(n,t,i),a);return n.blockData}function p(e,n,r){function o(n){return e[n]<<8|e[n+1]}var a=e.length-1,t=r<n?r:n;if(n>=a)return null;var i=o(n);if(i>=65472&&i<=65534)return{invalid:null,marker:i,offset:n};for(var s=o(t);!(s>=65472&&s<=65534);){if(++t>=a)return null;s=o(t)}return{invalid:i.toString(16),marker:s,offset:t}}return l.prototype={parse:function(r){function o(){var e=r[c]<<8|r[c+1];return c+=2,e}function a(){var e=o(),n=c+e-2,a=p(r,n,c);a&&a.invalid&&(console.log("readDataBlock - incorrect length, next marker is: "+a.invalid),n=a.offset);var t=r.subarray(c,n);return c+=t.length,t}function t(e){for(var n=Math.ceil(e.samplesPerLine/8/e.maxH),r=Math.ceil(e.scanLines/8/e.maxV),o=0;o<e.components.length;o++){R=e.components[o];var a=Math.ceil(Math.ceil(e.samplesPerLine/8)*R.h/e.maxH),t=Math.ceil(Math.ceil(e.scanLines/8)*R.v/e.maxV),i=n*R.h,s=r*R.v*64*(i+1);R.blockData=new Int16Array(s),R.blocksPerLine=a,R.blocksPerColumn=t}e.mcusPerLine=n,e.mcusPerColumn=r}var i,s,c=0,f=null,l=null,h=[],m=[],b=[],k=o();if(65496!==k)throw new e("SOI not found");for(k=o();65497!==k;){var g,C,w;switch(k){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var x=a();65504===k&&74===x[0]&&70===x[1]&&73===x[2]&&70===x[3]&&0===x[4]&&(f={version:{major:x[5],minor:x[6]},densityUnits:x[7],xDensity:x[8]<<8|x[9],yDensity:x[10]<<8|x[11],thumbWidth:x[12],thumbHeight:x[13],thumbData:x.subarray(14,14+3*x[12]*x[13])}),65518===k&&65===x[0]&&100===x[1]&&111===x[2]&&98===x[3]&&101===x[4]&&(l={version:x[5]<<8|x[6],flags0:x[7]<<8|x[8],flags1:x[9]<<8|x[10],transformCode:x[11]});break;case 65499:for(var y=o()+c-2;c<y;){var D=r[c++],T=new Uint16Array(64);if(D>>4){if(D>>4!=1)throw new e("DQT - invalid table spec");for(C=0;C<64;C++)T[n[C]]=o()}else for(C=0;C<64;C++)T[n[C]]=r[c++];h[15&D]=T}break;case 65472:case 65473:case 65474:if(i)throw new e("Only single frame JPEGs supported");o(),(i={}).extended=65473===k,i.progressive=65474===k,i.precision=r[c++],i.scanLines=o(),i.samplesPerLine=o(),i.components=[],i.componentIds={};var P,L=r[c++],A=0,_=0;for(g=0;g<L;g++){P=r[c];var U=r[c+1]>>4,z=15&r[c+1];A<U&&(A=U),_<z&&(_=z);var I=r[c+2];w=i.components.push({h:U,v:z,quantizationId:I,quantizationTable:null}),i.componentIds[P]=w-1,c+=3}i.maxH=A,i.maxV=_,t(i);break;case 65476:var M=o();for(g=2;g<M;){var Y=r[c++],q=new Uint8Array(16),S=0;for(C=0;C<16;C++,c++)S+=q[C]=r[c];var H=new Uint8Array(S);for(C=0;C<S;C++,c++)H[C]=r[c];g+=17+S,(Y>>4?m:b)[15&Y]=u(q,H)}break;case 65501:o(),s=o();break;case 65498:o();var R,j=r[c++],E=[];for(g=0;g<j;g++){var J=i.componentIds[r[c++]];R=i.components[J];var V=r[c++];R.huffmanTableDC=b[V>>4],R.huffmanTableAC=m[15&V],E.push(R)}var B=r[c++],N=r[c++],G=r[c++],O=v(r,c,i,E,s,B,N,G>>4,15&G);c+=O;break;case 65535:255!==r[c]&&c--;break;default:if(255===r[c-3]&&r[c-2]>=192&&r[c-2]<=254){c-=3;break}throw new e("unknown marker "+k.toString(16))}k=o()}for(this.width=i.samplesPerLine,this.height=i.scanLines,this.jfif=f,this.eof=c,this.adobe=l,this.components=[],g=0;g<i.components.length;g++){var Q=h[(R=i.components[g]).quantizationId];Q&&(R.quantizationTable=Q),this.components.push({output:d(i,R),scaleX:R.h/i.maxH,scaleY:R.v/i.maxV,blocksPerLine:R.blocksPerLine,blocksPerColumn:R.blocksPerColumn})}this.numComponents=this.components.length},_getLinearizedBlockData:function(e,n){var r,o,a,t,i,s,c,f,l,u,h,v=this.width/e,m=this.height/n,d=0,p=this.components.length,b=e*n*p,k=new Uint8ClampedArray(b),g=new Uint32Array(e),C=4294967288;for(c=0;c<p;c++){for(o=(r=this.components[c]).scaleX*v,a=r.scaleY*m,d=c,h=r.output,t=r.blocksPerLine+1<<3,i=0;i<e;i++)f=0|i*o,g[i]=(f&C)<<3|7&f;for(s=0;s<n;s++)for(u=t*((f=0|s*a)&C)|(7&f)<<3,i=0;i<e;i++)k[d]=h[u+g[i]],d+=p}var w=this.decodeTransform;if(w)for(c=0;c<b;)for(f=0,l=0;f<p;f++,c++,l+=2)k[c]=(k[c]*w[l]>>8)+w[l+1];return k},_isColorConversionNeeded:function(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this.colorTransform:1===this.colorTransform},_convertYccToRgb:function(e){for(var n,r,o,a=0,t=e.length;a<t;a+=3)n=e[a],r=e[a+1],o=e[a+2],e[a]=n-179.456+1.402*o,e[a+1]=n+135.459-.344*r-.714*o,e[a+2]=n-226.816+1.772*r;return e},_convertYcckToRgb:function(e){for(var n,r,o,a,t=0,i=0,s=e.length;i<s;i+=4)n=e[i],r=e[i+1],o=e[i+2],a=e[i+3],e[t++]=r*(-660635669420364e-19*r+.000437130475926232*o-54080610064599e-18*n+.00048449797120281*a-.154362151871126)-122.67195406894+o*(-.000957964378445773*o+.000817076911346625*n-.00477271405408747*a+1.53380253221734)+n*(.000961250184130688*n-.00266257332283933*a+.48357088451265)+a*(-.000336197177618394*a+.484791561490776),e[t++]=107.268039397724+r*(219927104525741e-19*r-.000640992018297945*o+.000659397001245577*n+.000426105652938837*a-.176491792462875)+o*(-.000778269941513683*o+.00130872261408275*n+.000770482631801132*a-.151051492775562)+n*(.00126935368114843*n-.00265090189010898*a+.25802910206845)+a*(-.000318913117588328*a-.213742400323665),e[t++]=r*(-.000570115196973677*r-263409051004589e-19*o+.0020741088115012*n-.00288260236853442*a+.814272968359295)-20.810012546947+o*(-153496057440975e-19*o-.000132689043961446*n+.000560833691242812*a-.195152027534049)+n*(.00174418132927582*n-.00255243321439347*a+.116935020465145)+a*(-.000343531996510555*a+.24165260232407);return e},_convertYcckToCmyk:function(e){for(var n,r,o,a=0,t=e.length;a<t;a+=4)n=e[a],r=e[a+1],o=e[a+2],e[a]=434.456-n-1.402*o,e[a+1]=119.541-n+.344*r+.714*o,e[a+2]=481.816-n-1.772*r;return e},_convertCmykToRgb:function(e){for(var n,r,o,a,t=0,i=1/255,s=0,c=e.length;s<c;s+=4)n=e[s]*i,r=e[s+1]*i,o=e[s+2]*i,a=e[s+3]*i,e[t++]=255+n*(-4.387332384609988*n+54.48615194189176*r+18.82290502165302*o+212.25662451639585*a-285.2331026137004)+r*(1.7149763477362134*r-5.6096736904047315*o-17.873870861415444*a-5.497006427196366)+o*(-2.5217340131683033*o-21.248923337353073*a+17.5119270841813)-a*(21.86122147463605*a+189.48180835922747),e[t++]=255+n*(8.841041422036149*n+60.118027045597366*r+6.871425592049007*o+31.159100130055922*a-79.2970844816548)+r*(-15.310361306967817*r+17.575251261109482*o+131.35250912493976*a-190.9453302588951)+o*(4.444339102852739*o+9.8632861493405*a-24.86741582555878)-a*(20.737325471181034*a+187.80453709719578),e[t++]=255+n*(.8842522430003296*n+8.078677503112928*r+30.89978309703729*o-.23883238689178934*a-14.183576799673286)+r*(10.49593273432072*r+63.02378494754052*o+50.606957656360734*a-112.23884253719248)+o*(.03296041114873217*o+115.60384449646641*a-193.58209356861505)-a*(22.33816807309886*a+180.12613974708367);return e},getData:function(n,r,o){if(this.numComponents>4)throw new e("Unsupported color mode");var a=this._getLinearizedBlockData(n,r);if(1===this.numComponents&&o){for(var t=a.length,i=new Uint8ClampedArray(3*t),s=0,c=0;c<t;c++){var f=a[c];i[s++]=f,i[s++]=f,i[s++]=f}return i}if(3===this.numComponents&&this._isColorConversionNeeded())return this._convertYccToRgb(a);if(4===this.numComponents){if(this._isColorConversionNeeded())return o?this._convertYcckToRgb(a):this._convertYcckToCmyk(a);if(o)return this._convertCmykToRgb(a)}return a}},l}()},void 0!==(a=o())&&(e.exports=a)),r.exports;var e,o,a}const a=e(o());export{a as J};
|
|
5
|
+
import{g as e}from"./_commonjsHelpers.js";var n,r={exports:{}};function o(){return n||(n=1,e=r,o=function(){var e=function(){function e(e){this.message="JPEG error: "+e}return e.prototype=new Error,e.prototype.name="JpegError",e.constructor=e,e}();return function(){if(!self||!self.Uint8ClampedArray)return null;var n=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),r=4017,o=799,a=3406,t=2276,i=1567,s=3784,c=5793,f=2896;function l(){this.decodeTransform=null,this.colorTransform=-1}function u(e,n){for(var r,o,a=0,t=[],i=16;i>0&&!e[i-1];)i--;t.push({children:[],index:0});var s,c=t[0];for(r=0;r<i;r++){for(o=0;o<e[r];o++){for((c=t.pop()).children[c.index]=n[a];c.index>0;)c=t.pop();for(c.index++,t.push(c);t.length<=r;)t.push(s={children:[],index:0}),c.children[c.index]=s.children,c=s;a++}r+1<i&&(t.push(s={children:[],index:0}),c.children[c.index]=s.children,c=s)}return t[0].children}function h(e,n,r){return 64*((e.blocksPerLine+1)*n+r)}function v(r,o,a,t,i,s,c,f,l){var u=a.mcusPerLine,v=a.progressive,m=o,d=0,b=0;function k(){if(b>0)return b--,d>>b&1;if(255===(d=r[o++])){var n=r[o++];if(n)throw new e("unexpected marker "+(d<<8|n).toString(16))}return b=7,d>>>7}function g(n){for(var r=n;;){if("number"==typeof(r=r[k()]))return r;if("object"!=typeof r)throw new e("invalid huffman sequence")}}function C(e){for(var n=0;e>0;)n=n<<1|k(),e--;return n}function w(e){if(1===e)return 1===k()?1:-1;var n=C(e);return n>=1<<e-1?n:n+(-1<<e)+1}function x(e,r){var o=g(e.huffmanTableDC),a=0===o?0:w(o);e.blockData[r]=e.pred+=a;for(var t=1;t<64;){var i=g(e.huffmanTableAC),s=15&i,c=i>>4;if(0!==s){var f=n[t+=c];e.blockData[r+f]=w(s),t++}else{if(c<15)break;t+=16}}}function y(e,n){var r=g(e.huffmanTableDC),o=0===r?0:w(r)<<l;e.blockData[n]=e.pred+=o}function D(e,n){e.blockData[n]|=k()<<l}var T=0;function P(e,r){if(T>0)T--;else for(var o=s,a=c;o<=a;){var t=g(e.huffmanTableAC),i=15&t,f=t>>4;if(0!==i){var u=n[o+=f];e.blockData[r+u]=w(i)*(1<<l),o++}else{if(f<15){T=C(f)+(1<<f)-1;break}o+=16}}}var L,A=0;function _(r,o){for(var a,t,i=s,f=c,u=0;i<=f;){var h=n[i];switch(A){case 0:if(u=(t=g(r.huffmanTableAC))>>4,0==(a=15&t))u<15?(T=C(u)+(1<<u),A=4):(u=16,A=1);else{if(1!==a)throw new e("invalid ACn encoding");L=w(a),A=u?2:3}continue;case 1:case 2:r.blockData[o+h]?r.blockData[o+h]+=k()<<l:0===--u&&(A=2===A?3:0);break;case 3:r.blockData[o+h]?r.blockData[o+h]+=k()<<l:(r.blockData[o+h]=L<<l,A=0);break;case 4:r.blockData[o+h]&&(r.blockData[o+h]+=k()<<l)}i++}4===A&&0===--T&&(A=0)}function U(e,n,r,o,a){var t=r%u;n(e,h(e,(r/u|0)*e.v+o,t*e.h+a))}function z(e,n,r){n(e,h(e,r/e.blocksPerLine|0,r%e.blocksPerLine))}var I,M,Y,q,S,H,R=t.length;H=v?0===s?0===f?y:D:0===f?P:_:x;var j,E,J,V,B=0;for(E=1===R?t[0].blocksPerLine*t[0].blocksPerColumn:u*a.mcusPerColumn;B<E;){var N=i?Math.min(E-B,i):E;for(M=0;M<R;M++)t[M].pred=0;if(T=0,1===R)for(I=t[0],S=0;S<N;S++)z(I,H,B),B++;else for(S=0;S<N;S++){for(M=0;M<R;M++)for(J=(I=t[M]).h,V=I.v,Y=0;Y<V;Y++)for(q=0;q<J;q++)U(I,H,B,Y,q);B++}b=0,(j=p(r,o))&&j.invalid&&(console.log("decodeScan - unexpected MCU data, next marker is: "+j.invalid),o=j.offset);var G=j&&j.marker;if(!G||G<=65280)throw new e("marker was not found");if(!(G>=65488&&G<=65495))break;o+=2}return(j=p(r,o))&&j.invalid&&(console.log("decodeScan - unexpected Scan data, next marker is: "+j.invalid),o=j.offset),o-m}function m(n,l,u){var h,v,m,d,p,b,k,g,C,w,x,y,D,T,P,L,A,_=n.quantizationTable,U=n.blockData;if(!_)throw new e("missing required Quantization Table.");for(var z=0;z<64;z+=8)C=U[l+z],w=U[l+z+1],x=U[l+z+2],y=U[l+z+3],D=U[l+z+4],T=U[l+z+5],P=U[l+z+6],L=U[l+z+7],C*=_[z],0!==(w|x|y|D|T|P|L)?(w*=_[z+1],x*=_[z+2],y*=_[z+3],D*=_[z+4],T*=_[z+5],P*=_[z+6],L*=_[z+7],v=(h=(h=c*C+128>>8)+(v=c*D+128>>8)+1>>1)-v,A=(m=x)*s+(d=P)*i+128>>8,m=m*i-d*s+128>>8,k=(p=(p=f*(w-L)+128>>8)+(k=T<<4)+1>>1)-k,b=(g=(g=f*(w+L)+128>>8)+(b=y<<4)+1>>1)-b,d=(h=h+(d=A)+1>>1)-d,m=(v=v+m+1>>1)-m,A=p*t+g*a+2048>>12,p=p*a-g*t+2048>>12,g=A,A=b*o+k*r+2048>>12,b=b*r-k*o+2048>>12,k=A,u[z]=h+g,u[z+7]=h-g,u[z+1]=v+k,u[z+6]=v-k,u[z+2]=m+b,u[z+5]=m-b,u[z+3]=d+p,u[z+4]=d-p):(A=c*C+512>>10,u[z]=A,u[z+1]=A,u[z+2]=A,u[z+3]=A,u[z+4]=A,u[z+5]=A,u[z+6]=A,u[z+7]=A);for(var I=0;I<8;++I)C=u[I],0!==((w=u[I+8])|(x=u[I+16])|(y=u[I+24])|(D=u[I+32])|(T=u[I+40])|(P=u[I+48])|(L=u[I+56]))?(v=(h=4112+((h=c*C+2048>>12)+(v=c*D+2048>>12)+1>>1))-v,A=(m=x)*s+(d=P)*i+2048>>12,m=m*i-d*s+2048>>12,d=A,k=(p=(p=f*(w-L)+2048>>12)+(k=T)+1>>1)-k,b=(g=(g=f*(w+L)+2048>>12)+(b=y)+1>>1)-b,A=p*t+g*a+2048>>12,p=p*a-g*t+2048>>12,g=A,A=b*o+k*r+2048>>12,b=b*r-k*o+2048>>12,C=(C=(h=h+d+1>>1)+g)<16?0:C>=4080?255:C>>4,w=(w=(v=v+m+1>>1)+(k=A))<16?0:w>=4080?255:w>>4,x=(x=(m=v-m)+b)<16?0:x>=4080?255:x>>4,y=(y=(d=h-d)+p)<16?0:y>=4080?255:y>>4,D=(D=d-p)<16?0:D>=4080?255:D>>4,T=(T=m-b)<16?0:T>=4080?255:T>>4,P=(P=v-k)<16?0:P>=4080?255:P>>4,L=(L=h-g)<16?0:L>=4080?255:L>>4,U[l+I]=C,U[l+I+8]=w,U[l+I+16]=x,U[l+I+24]=y,U[l+I+32]=D,U[l+I+40]=T,U[l+I+48]=P,U[l+I+56]=L):(A=(A=c*C+8192>>14)<-2040?0:A>=2024?255:A+2056>>4,U[l+I]=A,U[l+I+8]=A,U[l+I+16]=A,U[l+I+24]=A,U[l+I+32]=A,U[l+I+40]=A,U[l+I+48]=A,U[l+I+56]=A)}function d(e,n){for(var r=n.blocksPerLine,o=n.blocksPerColumn,a=new Int16Array(64),t=0;t<o;t++)for(var i=0;i<r;i++)m(n,h(n,t,i),a);return n.blockData}function p(e,n,r){function o(n){return e[n]<<8|e[n+1]}var a=e.length-1,t=r<n?r:n;if(n>=a)return null;var i=o(n);if(i>=65472&&i<=65534)return{invalid:null,marker:i,offset:n};for(var s=o(t);!(s>=65472&&s<=65534);){if(++t>=a)return null;s=o(t)}return{invalid:i.toString(16),marker:s,offset:t}}return l.prototype={parse:function(r){function o(){var e=r[c]<<8|r[c+1];return c+=2,e}function a(){var e=o(),n=c+e-2,a=p(r,n,c);a&&a.invalid&&(console.log("readDataBlock - incorrect length, next marker is: "+a.invalid),n=a.offset);var t=r.subarray(c,n);return c+=t.length,t}function t(e){for(var n=Math.ceil(e.samplesPerLine/8/e.maxH),r=Math.ceil(e.scanLines/8/e.maxV),o=0;o<e.components.length;o++){R=e.components[o];var a=Math.ceil(Math.ceil(e.samplesPerLine/8)*R.h/e.maxH),t=Math.ceil(Math.ceil(e.scanLines/8)*R.v/e.maxV),i=n*R.h,s=r*R.v*64*(i+1);R.blockData=new Int16Array(s),R.blocksPerLine=a,R.blocksPerColumn=t}e.mcusPerLine=n,e.mcusPerColumn=r}var i,s,c=0,f=null,l=null,h=[],m=[],b=[],k=o();if(65496!==k)throw new e("SOI not found");for(k=o();65497!==k;){var g,C,w;switch(k){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var x=a();65504===k&&74===x[0]&&70===x[1]&&73===x[2]&&70===x[3]&&0===x[4]&&(f={version:{major:x[5],minor:x[6]},densityUnits:x[7],xDensity:x[8]<<8|x[9],yDensity:x[10]<<8|x[11],thumbWidth:x[12],thumbHeight:x[13],thumbData:x.subarray(14,14+3*x[12]*x[13])}),65518===k&&65===x[0]&&100===x[1]&&111===x[2]&&98===x[3]&&101===x[4]&&(l={version:x[5]<<8|x[6],flags0:x[7]<<8|x[8],flags1:x[9]<<8|x[10],transformCode:x[11]});break;case 65499:for(var y=o()+c-2;c<y;){var D=r[c++],T=new Uint16Array(64);if(D>>4){if(D>>4!=1)throw new e("DQT - invalid table spec");for(C=0;C<64;C++)T[n[C]]=o()}else for(C=0;C<64;C++)T[n[C]]=r[c++];h[15&D]=T}break;case 65472:case 65473:case 65474:if(i)throw new e("Only single frame JPEGs supported");o(),(i={}).extended=65473===k,i.progressive=65474===k,i.precision=r[c++],i.scanLines=o(),i.samplesPerLine=o(),i.components=[],i.componentIds={};var P,L=r[c++],A=0,_=0;for(g=0;g<L;g++){P=r[c];var U=r[c+1]>>4,z=15&r[c+1];A<U&&(A=U),_<z&&(_=z);var I=r[c+2];w=i.components.push({h:U,v:z,quantizationId:I,quantizationTable:null}),i.componentIds[P]=w-1,c+=3}i.maxH=A,i.maxV=_,t(i);break;case 65476:var M=o();for(g=2;g<M;){var Y=r[c++],q=new Uint8Array(16),S=0;for(C=0;C<16;C++,c++)S+=q[C]=r[c];var H=new Uint8Array(S);for(C=0;C<S;C++,c++)H[C]=r[c];g+=17+S,(Y>>4?m:b)[15&Y]=u(q,H)}break;case 65501:o(),s=o();break;case 65498:o();var R,j=r[c++],E=[];for(g=0;g<j;g++){var J=i.componentIds[r[c++]];R=i.components[J];var V=r[c++];R.huffmanTableDC=b[V>>4],R.huffmanTableAC=m[15&V],E.push(R)}var B=r[c++],N=r[c++],G=r[c++],O=v(r,c,i,E,s,B,N,G>>4,15&G);c+=O;break;case 65535:255!==r[c]&&c--;break;default:if(255===r[c-3]&&r[c-2]>=192&&r[c-2]<=254){c-=3;break}throw new e("unknown marker "+k.toString(16))}k=o()}for(this.width=i.samplesPerLine,this.height=i.scanLines,this.jfif=f,this.eof=c,this.adobe=l,this.components=[],g=0;g<i.components.length;g++){var Q=h[(R=i.components[g]).quantizationId];Q&&(R.quantizationTable=Q),this.components.push({output:d(i,R),scaleX:R.h/i.maxH,scaleY:R.v/i.maxV,blocksPerLine:R.blocksPerLine,blocksPerColumn:R.blocksPerColumn})}this.numComponents=this.components.length},_getLinearizedBlockData:function(e,n){var r,o,a,t,i,s,c,f,l,u,h,v=this.width/e,m=this.height/n,d=0,p=this.components.length,b=e*n*p,k=new Uint8ClampedArray(b),g=new Uint32Array(e),C=4294967288;for(c=0;c<p;c++){for(o=(r=this.components[c]).scaleX*v,a=r.scaleY*m,d=c,h=r.output,t=r.blocksPerLine+1<<3,i=0;i<e;i++)f=0|i*o,g[i]=(f&C)<<3|7&f;for(s=0;s<n;s++)for(u=t*((f=0|s*a)&C)|(7&f)<<3,i=0;i<e;i++)k[d]=h[u+g[i]],d+=p}var w=this.decodeTransform;if(w)for(c=0;c<b;)for(f=0,l=0;f<p;f++,c++,l+=2)k[c]=(k[c]*w[l]>>8)+w[l+1];return k},_isColorConversionNeeded:function(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this.colorTransform:1===this.colorTransform},_convertYccToRgb:function(e){for(var n,r,o,a=0,t=e.length;a<t;a+=3)n=e[a],r=e[a+1],o=e[a+2],e[a]=n-179.456+1.402*o,e[a+1]=n+135.459-.344*r-.714*o,e[a+2]=n-226.816+1.772*r;return e},_convertYcckToRgb:function(e){for(var n,r,o,a,t=0,i=0,s=e.length;i<s;i+=4)n=e[i],r=e[i+1],o=e[i+2],a=e[i+3],e[t++]=r*(-660635669420364e-19*r+.000437130475926232*o-54080610064599e-18*n+.00048449797120281*a-.154362151871126)-122.67195406894+o*(-.000957964378445773*o+.000817076911346625*n-.00477271405408747*a+1.53380253221734)+n*(.000961250184130688*n-.00266257332283933*a+.48357088451265)+a*(-.000336197177618394*a+.484791561490776),e[t++]=107.268039397724+r*(219927104525741e-19*r-.000640992018297945*o+.000659397001245577*n+.000426105652938837*a-.176491792462875)+o*(-.000778269941513683*o+.00130872261408275*n+.000770482631801132*a-.151051492775562)+n*(.00126935368114843*n-.00265090189010898*a+.25802910206845)+a*(-.000318913117588328*a-.213742400323665),e[t++]=r*(-.000570115196973677*r-263409051004589e-19*o+.0020741088115012*n-.00288260236853442*a+.814272968359295)-20.810012546947+o*(-153496057440975e-19*o-.000132689043961446*n+.000560833691242812*a-.195152027534049)+n*(.00174418132927582*n-.00255243321439347*a+.116935020465145)+a*(-.000343531996510555*a+.24165260232407);return e},_convertYcckToCmyk:function(e){for(var n,r,o,a=0,t=e.length;a<t;a+=4)n=e[a],r=e[a+1],o=e[a+2],e[a]=434.456-n-1.402*o,e[a+1]=119.541-n+.344*r+.714*o,e[a+2]=481.816-n-1.772*r;return e},_convertCmykToRgb:function(e){for(var n,r,o,a,t=0,i=1/255,s=0,c=e.length;s<c;s+=4)n=e[s]*i,r=e[s+1]*i,o=e[s+2]*i,a=e[s+3]*i,e[t++]=255+n*(-4.387332384609988*n+54.48615194189176*r+18.82290502165302*o+212.25662451639585*a-285.2331026137004)+r*(1.7149763477362134*r-5.6096736904047315*o-17.873870861415444*a-5.497006427196366)+o*(-2.5217340131683033*o-21.248923337353073*a+17.5119270841813)-a*(21.86122147463605*a+189.48180835922747),e[t++]=255+n*(8.841041422036149*n+60.118027045597366*r+6.871425592049007*o+31.159100130055922*a-79.2970844816548)+r*(-15.310361306967817*r+17.575251261109482*o+131.35250912493976*a-190.9453302588951)+o*(4.444339102852739*o+9.8632861493405*a-24.86741582555878)-a*(20.737325471181034*a+187.80453709719578),e[t++]=255+n*(.8842522430003296*n+8.078677503112928*r+30.89978309703729*o-.23883238689178934*a-14.183576799673286)+r*(10.49593273432072*r+63.02378494754052*o+50.606957656360734*a-112.23884253719248)+o*(.03296041114873217*o+115.60384449646641*a-193.58209356861505)-a*(22.33816807309886*a+180.12613974708367);return e},getData:function(n,r,o){if(this.numComponents>4)throw new e("Unsupported color mode");var a=this._getLinearizedBlockData(n,r);if(1===this.numComponents&&o){for(var t=a.length,i=new Uint8ClampedArray(3*t),s=0,c=0;c<t;c++){var f=a[c];i[s++]=f,i[s++]=f,i[s++]=f}return i}if(3===this.numComponents&&this._isColorConversionNeeded())return this._convertYccToRgb(a);if(4===this.numComponents){if(this._isColorConversionNeeded())return o?this._convertYcckToRgb(a):this._convertYcckToCmyk(a);if(o)return this._convertCmykToRgb(a)}return a}},l}()},void 0!==(a=o())&&(e.exports=a)),r.exports;var e,o,a}const a=e(o());export{a as J};
|