@arcgis/core 4.33.0-next.20250219 → 4.33.0-next.20250220

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.
Files changed (140) hide show
  1. package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
  2. package/applications/ExperienceBuilder/sketchUtils.js +1 -1
  3. package/arcade/treeAnalysis.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/0c3930e40fc9f8a84599.js +2 -0
  6. package/assets/esri/core/workers/chunks/{ccee343fb8c415b59ce3.js.LICENSE.txt → 0c3930e40fc9f8a84599.js.LICENSE.txt} +1 -1
  7. package/assets/esri/core/workers/chunks/333bb93a28209c997d8b.js +314 -0
  8. package/assets/esri/core/workers/chunks/469c50c49447f0d602c0.js +1 -0
  9. package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
  10. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js → 52c13b3c074c9f6dadde.js} +2 -2
  11. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js.LICENSE.txt → 52c13b3c074c9f6dadde.js.LICENSE.txt} +1 -1
  12. package/assets/esri/core/workers/chunks/5693d9ce4472a4c5959f.js.LICENSE.txt +1 -1
  13. package/assets/esri/core/workers/chunks/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
  14. package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
  15. package/assets/esri/core/workers/chunks/68322a63ec92d33701ea.js +1 -0
  16. package/assets/esri/core/workers/chunks/aacebda644be06ad1a61.js +1 -0
  17. package/assets/esri/core/workers/chunks/ac11b2168feee63d2f09.js +1 -0
  18. package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
  19. package/assets/esri/core/workers/chunks/e2df18662cc4d6e47715.js +1 -0
  20. package/assets/esri/themes/base/widgets/_Editor.scss +3 -0
  21. package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +9 -3
  22. package/assets/esri/themes/base/widgets/_Sketch.scss +32 -24
  23. package/assets/esri/themes/dark/main.css +1 -1
  24. package/assets/esri/themes/light/main.css +1 -1
  25. package/assets/esri/themes/light/view.css +1 -1
  26. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  27. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  28. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  29. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  30. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  31. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  32. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  33. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  34. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  35. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  36. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  37. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  38. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  39. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  40. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  41. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  42. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  43. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  65. package/copyright.txt +20 -0
  66. package/interfaces.d.ts +315 -71
  67. package/layers/RouteLayer.js +1 -1
  68. package/layers/support/rasterFunctionUtils.d.ts +11 -0
  69. package/networks/UtilityNetwork.js +1 -1
  70. package/package.json +2 -2
  71. package/rest/route.js +1 -1
  72. package/rest/support/RouteParameters.js +1 -1
  73. package/rest/support/RouteSolveResult.js +1 -1
  74. package/support/revision.js +1 -1
  75. package/symbols/cim/CIMEffects.js +1 -1
  76. package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
  77. package/symbols/cim/effects/EffectBuffer.js +1 -1
  78. package/symbols/cim/effects/EffectDonut.js +1 -1
  79. package/symbols/cim/effects/EffectOffset.js +1 -1
  80. package/views/2d/engine/webgl/TextureManager.js +1 -1
  81. package/views/2d/engine/webgl/Utils.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  84. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  85. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  86. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  87. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  88. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  89. package/views/3d/layers/I3SMeshView3D.js +1 -1
  90. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  91. package/views/3d/layers/graphics/pipeline/Tile.js +1 -1
  92. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  93. package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
  94. package/views/3d/layers/graphics/pipeline/featureData/FeatureDataSubset.js +5 -0
  95. package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
  96. package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
  97. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  98. package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
  99. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  100. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  101. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  102. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  103. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  104. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentBVH.js +1 -1
  105. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +5 -0
  106. package/views/3d/webgl-engine/lib/ComponentUtils.js +1 -1
  107. package/webmap/utils.js +1 -1
  108. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  109. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  110. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  111. package/widgets/BatchAttributeForm.js +1 -1
  112. package/widgets/Directions/DirectionsViewModel.js +1 -1
  113. package/widgets/Directions.js +1 -1
  114. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  115. package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
  116. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  117. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  118. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  119. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  120. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  121. package/widgets/Legend/styles/support/utils.js +1 -1
  122. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  123. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  124. package/widgets/OrientedImageryViewer.js +1 -1
  125. package/widgets/Sketch/SketchViewModel.js +1 -1
  126. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  127. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  128. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  129. package/widgets/Sketch/support/sketchUtils.js +1 -1
  130. package/widgets/Sketch.js +1 -1
  131. package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
  132. package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +0 -1
  133. package/assets/esri/core/workers/chunks/bdc9dec6a359d2e3705c.js +0 -1
  134. package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +0 -1
  135. package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
  136. package/assets/esri/core/workers/chunks/dc68246df91af766593a.js +0 -1
  137. package/assets/esri/core/workers/chunks/e862f1b9ecafc6c92b86.js +0 -314
  138. package/assets/esri/core/workers/chunks/f06231c14c0c0e5525bd.js +0 -1
  139. package/views/3d/layers/graphics/pipeline/featureData/FeatureDataStore.js +0 -5
  140. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +0 -5
@@ -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{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import S from"../geometry/Extent.js";import g from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as P}from"../geometry/support/spatialReferenceUtils.js";import N from"./Layer.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as C}from"./support/arcgisLayerUrl.js";import R from"./support/RouteSymbols.js";import D from"../portal/Portal.js";import O from"../portal/PortalItem.js";import{typeKeyword as F}from"../portal/support/portalItemUtils.js";import{read as x}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as T}from"../rest/networkService.js";import{solve as k}from"../rest/route.js";import A from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import U from"../rest/support/PolylineBarrier.js";import q from"../rest/support/RouteInfo.js";import E from"../rest/support/RouteParameters.js";import W from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function z(e){return e.length?e:null}function K(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:K("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:K("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function Y(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function Z(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],n=r.travelMode??t.defaultTravelMode;if(null==n)return void ue().warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:a}=n,u=i.find((({name:e})=>e===l)),p=i.find((({name:e})=>e===a)),c=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,m=u?.units,y=p?.units;if(!m||!y)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const f=r.directionsLanguage??t.directionsLanguage,d=r.accumulateAttributes??t.accumulateAttributeNames??[],h=new Set(i.filter((({name:e})=>e===l||e===a||e===c||null!=e&&d.includes(e))).map((({name:e})=>e))),w=e=>{for(const t in e)h.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[c]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));const{routeInfo:S}=e,{findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P}=r;S.analysisSettings=new W({accumulateAttributes:d,directionsLanguage:f,findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P,travelMode:n}),S.totalDuration=X(S.totalCosts?.[l]??0,m),S.totalDistance=ee(S.totalCosts?.[a]??0,y),S.totalLateDuration=X(S.totalViolations?.[l]??0,m),S.totalWaitDuration=X(S.totalWait?.[l]??0,m),null!=S.totalCosts&&w(S.totalCosts),null!=S.totalViolations&&w(S.totalViolations),null!=S.totalWait&&w(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=X(s.serviceCosts[l]??0,m),s.serviceDistance=ee(s.serviceCosts[a]??0,y),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=X(s.cumulativeCosts[l]??0,m),s.cumulativeDistance=ee(s.cumulativeCosts[a]??0,y),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=X(s.violations[l]??0,m),w(s.violations)),null!=s.wait&&(s.waitDuration=X(s.wait[l]??0,m),w(s.wait))}async function $(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function X(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ee(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function te(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const re=i.ofType(A),oe=i.ofType(G),ie=i.ofType(J),se=i.ofType(M),ne=i.ofType(U),le=i.ofType(V),ae="esri.layers.RouteLayer",ue=()=>n.getLogger(ae);let pe=class extends(_(I(j(L(l(N)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new R,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ie,this.polygonBarriers=new se,this.polylineBarriers=new ne,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new le,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";a(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>A.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new S({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new g({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>U.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>q.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??P;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",C(e,ue())):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},l=this.write(void 0,n);return t.extent=await $(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=O.from(e).clone();r.extent??=await $(this.fullExtent),r.id=null,r.portal??=D.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",F.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,l=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:l}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){const r=e?.stops??this.stops,o=e?.pointBarriers??z(this.pointBarriers),n=e?.polylineBarriers??z(this.polylineBarriers),l=e?.polygonBarriers??z(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||Y(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const a=e?.apiKey,p=this.url,c=await this._getServiceDescription(p,a,t),m=e?.travelMode??c.defaultTravelMode,y=e?.accumulateAttributes??[];null!=m&&(y.push(m.distanceAttributeName),m.timeAttributeName&&y.push(m.timeAttributeName));const f={accumulateAttributes:y,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:l,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!l,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},d=E.from(e??{});let h;d.set(f);try{h=await k(p,d,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const w=this._toRouteLayerSolution(h);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),Z(w,c,d),w}update(e){const{stops:t,directionLines:r,directionPoints:o,pointBarriers:i,polylineBarriers:s,polygonBarriers:n,routeInfo:l}=e;this.set({stops:t,pointBarriers:i,polylineBarriers:s,polygonBarriers:n}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l),null!=l.geometry&&(this.spatialReference=l.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const l=H(e)?e.layers:e.featureCollection?.layers,a=l?.find((e=>e.layerDefinition.name===t));if(null==a)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=a,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??P,d=m&&x(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await T(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||0===e.length)return;if(null==this.defaultSymbols.stops)return;if(e.every((({symbol:e})=>null!=e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const l=e.map((({sequence:e})=>e)).filter((e=>null!=e)),a=Math.min(...l),u=Math.max(...l);for(const p of e)p.sequence!==a?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const t=e.routeResults[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(t);const r=new le(t),o=new se(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),i=new ne(e.polylineBarriers?.map((e=>{const t=U.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),s=new ie(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),n=e.routeResults[0].route?.toJSON(),l=q.fromJSON(n);l.symbol=this.defaultSymbols.routeInfo;const a=new oe(e.routeResults[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{directionLines:new re(e.routeResults[0].directionLines?.features.map((e=>{const t=A.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:a,pointBarriers:s,polygonBarriers:o,polylineBarriers:i,routeInfo:l,stops:r}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",A.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:l,maxScale:a,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>te(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():K(r)}},extent:l.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:a,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",U.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",q.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],pe.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],pe.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],pe.prototype,"_type",void 0),e([y({nonNullable:!0,type:R})],pe.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],pe.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],pe.prototype,"readDirectionLines",null),e([y({readOnly:!0})],pe.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],pe.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],pe.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],pe.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],pe.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],pe.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],pe.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],pe.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],pe.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],pe.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],pe.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(U)})],pe.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],pe.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],pe.prototype,"readRouteInfo",null),e([y({type:B})],pe.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],pe.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],pe.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],pe.prototype,"readStops",null),e([y()],pe.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],pe.prototype,"type",void 0),e([y()],pe.prototype,"url",null),pe=e([d(ae)],pe);const ce=pe;export{ce as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import S from"../geometry/Extent.js";import g from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as P}from"../geometry/support/spatialReferenceUtils.js";import N from"./Layer.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as C}from"./support/arcgisLayerUrl.js";import D from"./support/RouteSymbols.js";import R from"../portal/Portal.js";import O from"../portal/PortalItem.js";import{typeKeyword as k}from"../portal/support/portalItemUtils.js";import{read as F}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as x}from"../rest/networkService.js";import{solve as T}from"../rest/route.js";import A from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import U from"../rest/support/PolylineBarrier.js";import q from"../rest/support/RouteInfo.js";import E from"../rest/support/RouteParameters.js";import W from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function z(e){return e.length?e:null}function K(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:K("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:K("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function Y(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function Z(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],n=r.travelMode??t.defaultTravelMode;if(null==n)return void ue().warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:a}=n,u=i.find((({name:e})=>e===l)),p=i.find((({name:e})=>e===a)),c=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,m=u?.units,y=p?.units;if(!m||!y)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const f=r.directionsLanguage??t.directionsLanguage,d=r.accumulateAttributes??t.accumulateAttributeNames??[],h=new Set(i.filter((({name:e})=>e===l||e===a||e===c||null!=e&&d.includes(e))).map((({name:e})=>e))),w=e=>{for(const t in e)h.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[c]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));const{routeInfo:S}=e,{findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P}=r;S.analysisSettings=new W({accumulateAttributes:d,directionsLanguage:f,findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P,travelMode:n}),S.totalDuration=X(S.totalCosts?.[l]??0,m),S.totalDistance=ee(S.totalCosts?.[a]??0,y),S.totalLateDuration=X(S.totalViolations?.[l]??0,m),S.totalWaitDuration=X(S.totalWait?.[l]??0,m),null!=S.totalCosts&&w(S.totalCosts),null!=S.totalViolations&&w(S.totalViolations),null!=S.totalWait&&w(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=X(s.serviceCosts[l]??0,m),s.serviceDistance=ee(s.serviceCosts[a]??0,y),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=X(s.cumulativeCosts[l]??0,m),s.cumulativeDistance=ee(s.cumulativeCosts[a]??0,y),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=X(s.violations[l]??0,m),w(s.violations)),null!=s.wait&&(s.waitDuration=X(s.wait[l]??0,m),w(s.wait))}async function $(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function X(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ee(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function te(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const re=i.ofType(A),oe=i.ofType(G),ie=i.ofType(J),se=i.ofType(M),ne=i.ofType(U),le=i.ofType(V),ae="esri.layers.RouteLayer",ue=()=>n.getLogger(ae);let pe=class extends(_(I(j(L(l(N)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new D,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ie,this.polygonBarriers=new se,this.polylineBarriers=new ne,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new le,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";a(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>A.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new S({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new g({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>U.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>q.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??P;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",C(e,ue())):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},l=this.write(void 0,n);return t.extent=await $(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=O.from(e).clone();r.extent??=await $(this.fullExtent),r.id=null,r.portal??=R.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",k.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,l=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:l}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){const r=e?.stops??this.stops,o=e?.pointBarriers??z(this.pointBarriers),n=e?.polylineBarriers??z(this.polylineBarriers),l=e?.polygonBarriers??z(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||Y(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const a=e?.apiKey,{checksum:p,url:c}=this,m=await this._getServiceDescription(c,a,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];null!=y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:p,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:l,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!l,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},h=E.from(e??{});let w;h.set(d);try{w=await T(c,h,t)}catch(g){throw u(g)?g:new s("routelayer:failed-route-request","the routing request failed",{error:g})}const S=this._toRouteLayerSolution(w);return this._isOverridden("title")||(this.title=S.routeInfo.name??"Route"),Z(S,m,h),S}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:l,stops:a}=e;this.set({stops:a,checksum:t,pointBarriers:i,polylineBarriers:n,polygonBarriers:s}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l),null!=l.geometry&&(this.spatialReference=l.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const l=H(e)?e.layers:e.featureCollection?.layers,a=l?.find((e=>e.layerDefinition.name===t));if(null==a)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=a,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??P,d=m&&F(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await x(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||0===e.length)return;if(null==this.defaultSymbols.stops)return;if(e.every((({symbol:e})=>null!=e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const l=e.map((({sequence:e})=>e)).filter((e=>null!=e)),a=Math.min(...l),u=Math.max(...l);for(const p of e)p.sequence!==a?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(o);const i=new le(o),s=new se(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),n=new ne(e.polylineBarriers?.map((e=>{const t=U.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),l=new ie(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),a=r[0].route?.toJSON(),u=q.fromJSON(a);u.symbol=this.defaultSymbols.routeInfo;const p=new oe(r[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{checksum:t,directionLines:new re(r[0].directionLines?.features.map((e=>{const t=A.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:p,pointBarriers:l,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",A.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:l,maxScale:a,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>te(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():K(r)}},extent:l.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:a,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",U.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",q.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],pe.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],pe.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],pe.prototype,"_type",void 0),e([y({type:String})],pe.prototype,"checksum",void 0),e([y({nonNullable:!0,type:D})],pe.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],pe.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],pe.prototype,"readDirectionLines",null),e([y({readOnly:!0})],pe.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],pe.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],pe.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],pe.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],pe.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],pe.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],pe.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],pe.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],pe.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],pe.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],pe.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(U)})],pe.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],pe.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],pe.prototype,"readRouteInfo",null),e([y({type:B})],pe.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],pe.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],pe.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],pe.prototype,"readStops",null),e([y()],pe.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],pe.prototype,"type",void 0),e([y()],pe.prototype,"url",null),pe=e([d(ae)],pe);const ce=pe;export{ce as default};
@@ -4,6 +4,7 @@ export const defaultRaster: __esri.rasterFunctionUtils["defaultRaster"];
4
4
  export const abs: __esri.rasterFunctionUtils["abs"];
5
5
  export const acos: __esri.rasterFunctionUtils["acos"];
6
6
  export const acosh: __esri.rasterFunctionUtils["acosh"];
7
+ export const argStatistics: __esri.rasterFunctionUtils["argStatistics"];
7
8
  export const asin: __esri.rasterFunctionUtils["asin"];
8
9
  export const asinh: __esri.rasterFunctionUtils["asinh"];
9
10
  export const aspect: __esri.rasterFunctionUtils["aspect"];
@@ -50,16 +51,20 @@ export const booleanAnd: __esri.rasterFunctionUtils["booleanAnd"];
50
51
  export const booleanNot: __esri.rasterFunctionUtils["booleanNot"];
51
52
  export const booleanOr: __esri.rasterFunctionUtils["booleanOr"];
52
53
  export const booleanXor: __esri.rasterFunctionUtils["booleanXor"];
54
+ export const calculate: __esri.rasterFunctionUtils["calculate"];
53
55
  export const cellStatistics: __esri.rasterFunctionUtils["cellStatistics"];
54
56
  export const clip: __esri.rasterFunctionUtils["clip"];
55
57
  export const colormap: __esri.rasterFunctionUtils["colormap"];
56
58
  export const colormapToRGB: __esri.rasterFunctionUtils["colormapToRGB"];
59
+ export const colorspaceConversion: __esri.rasterFunctionUtils["colorspaceConversion"];
57
60
  export const compositeBand: __esri.rasterFunctionUtils["compositeBand"];
61
+ export const computeChange: __esri.rasterFunctionUtils["computeChange"];
58
62
  export const conditional: __esri.rasterFunctionUtils["conditional"];
59
63
  export const contrastBrightness: __esri.rasterFunctionUtils["contrastBrightness"];
60
64
  export const convolution: __esri.rasterFunctionUtils["convolution"];
61
65
  export const cos: __esri.rasterFunctionUtils["cos"];
62
66
  export const cosh: __esri.rasterFunctionUtils["cosh"];
67
+ export const createColorComposite: __esri.rasterFunctionUtils["createColorComposite"];
63
68
  export const curvature: __esri.rasterFunctionUtils["curvature"];
64
69
  export const divide: __esri.rasterFunctionUtils["divide"];
65
70
  export const equalTo: __esri.rasterFunctionUtils["equalTo"];
@@ -94,6 +99,7 @@ export const shadedRelief: __esri.rasterFunctionUtils["shadedRelief"];
94
99
  export const sin: __esri.rasterFunctionUtils["sin"];
95
100
  export const sinh: __esri.rasterFunctionUtils["sinh"];
96
101
  export const slope: __esri.rasterFunctionUtils["slope"];
102
+ export const spectralConversion: __esri.rasterFunctionUtils["spectralConversion"];
97
103
  export const sqrt: __esri.rasterFunctionUtils["sqrt"];
98
104
  export const square: __esri.rasterFunctionUtils["square"];
99
105
  export const statistics: __esri.rasterFunctionUtils["statistics"];
@@ -105,4 +111,9 @@ export const stretchStandardDeviation: __esri.rasterFunctionUtils["stretchStanda
105
111
  export const table: __esri.rasterFunctionUtils["table"];
106
112
  export const tan: __esri.rasterFunctionUtils["tan"];
107
113
  export const tanh: __esri.rasterFunctionUtils["tanh"];
114
+ export const tasseledCap: __esri.rasterFunctionUtils["tasseledCap"];
115
+ export const threshold: __esri.rasterFunctionUtils["threshold"];
108
116
  export const times: __esri.rasterFunctionUtils["times"];
117
+ export const transposeBits: __esri.rasterFunctionUtils["transposeBits"];
118
+ export const weightedOverlay: __esri.rasterFunctionUtils["weightedOverlay"];
119
+ export const weightedSum: __esri.rasterFunctionUtils["weightedSum"];
@@ -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{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import d from"./support/TerminalConfiguration.js";import m from"./support/TraceJobInfo.js";import{AssociationTypeEnum as c,RuleType as p}from"./support/typeUtils.js";import y from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>d.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?d.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new m({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=(e,t)=>e.fromNetworkSource?.sourceId===t.fromNetworkElement?.networkSourceId&&e.toNetworkSource?.sourceId===t.toNetworkElement?.networkSourceId&&e.fromAssetGroup?.assetGroupCode===t.fromNetworkElement?.assetGroupCode&&e.fromAssetType?.assetTypeCode===t.fromNetworkElement?.assetTypeCode&&e.toAssetGroup?.assetGroupCode===t.toNetworkElement?.assetGroupCode&&e.toAssetType?.assetTypeCode===t.toNetworkElement?.assetTypeCode&&r(e.fromTerminal,t.fromNetworkElement)&&r(e.toTerminal,t.toNetworkElement);if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>s(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>s(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.viaNetworkSource?t.fromNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.viaNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.fromAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.fromAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.viaAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.fromTerminal,e.fromNetworkElement)&&r(t.viaTerminal,e.toNetworkElement)||t.viaNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.toNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.viaAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.toAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.toAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.viaTerminal,e.fromNetworkElement)&&r(t.toTerminal,e.toNetworkElement):s(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:c[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await w(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),w=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),T=s.get("VIATERMINALID"),h=r.attributes[o.name],g=new Date(r.attributes[a.name]),k=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[w.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[T.name]}];let b;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(b||(b={}));const N={ruleType:h,creationDate:g};for(const S of[b.from,b.to,b.via]){if(h!==p.RTEdgeJunctionEdgeConnectivity&&S===b.via)continue;const e=k[S],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(S){case b.from:i="from";break;case b.to:i="to";break;case b.via:i="via"}N[`${i}NetworkSource`]=r,N[`${i}AssetGroup`]=s,N[`${i}AssetType`]=o,N[`${i}Terminal`]=a?.toJSON()}return N}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function w(e){const t=new y({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import d from"./support/TraceJobInfo.js";import{RuleType as c,AssociationTypeEnum as y}from"./support/typeUtils.js";import p from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new d({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=e=>({fromRuleElement:{networkSource:e.fromNetworkSource,assetGroup:e.fromAssetGroup,assetType:e.fromAssetType,terminal:e.fromTerminal},viaRuleElement:e.viaNetworkSource?{networkSource:e.viaNetworkSource,assetGroup:e.viaAssetGroup,assetType:e.viaAssetType,terminal:e.viaTerminal}:void 0,toRuleElement:{networkSource:e.toNetworkSource,assetGroup:e.toAssetGroup,assetType:e.toAssetType,terminal:e.toTerminal}}),o=(e,t,s=!0)=>e.networkSource?.sourceId===t.networkSourceId&&e.assetGroup?.assetGroupCode===t.assetGroupCode&&e.assetType?.assetTypeCode===t.assetTypeCode&&(!s||r(e.terminal,t)),a=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement,!1)&&o(a,t.toNetworkElement,!1)},i=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(a,t.fromNetworkElement)},n=(e,t)=>{const{fromRuleElement:r,toRuleElement:a,viaRuleElement:i}=s(e);return o(r,t.fromNetworkElement)&&o(i,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(i,t.fromNetworkElement)||o(i,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(i,t.toNetworkElement)&&o(a,t.fromNetworkElement)};if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>a(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>a(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.ruleType===c.RTEdgeJunctionEdgeConnectivity?n(t,e):i(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:y[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await h(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),m=s.get("TONETWORKSOURCEID"),d=s.get("TOASSETGROUP"),y=s.get("TOASSETTYPE"),p=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),h=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),w=s.get("VIATERMINALID"),T=r.attributes[o.name],g=new Date(r.attributes[a.name]),b=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[m.name],assetGroupId:r.attributes[d.name],assetTypeId:r.attributes[y.name],terminalId:r.attributes[p.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[h.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[w.name]}];let k;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(k||(k={}));const S={ruleType:T,creationDate:g};for(const N of[k.from,k.to,k.via]){if(T!==c.RTEdgeJunctionEdgeConnectivity&&N===k.via)continue;const e=b[N],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(N){case k.from:i="from";break;case k.to:i="to";break;case k.via:i="via"}S[`${i}NetworkSource`]=r,S[`${i}AssetGroup`]=s,S[`${i}AssetType`]=o,S[`${i}Terminal`]=a?.toJSON()}return S}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function h(e){const t=new p({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.33.0-next.20250219",
3
+ "version": "4.33.0-next.20250220",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
- "@esri/calcite-components": "^3.0.2",
29
+ "@esri/calcite-components": "^3.0.3",
30
30
  "@vaadin/grid": "~24.6.4",
31
31
  "@zip.js/zip.js": "~2.7.57",
32
32
  "luxon": "~3.5.0",
package/rest/route.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 e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as i}from"./networkService.js";import{parseUrl as n}from"./utils.js";import{routeParametersToQueryParameters as u}from"./route/utils.js";import f from"./support/FeatureSet.js";import p from"./support/RouteSolveResult.js";function c(e){return e instanceof f}async function l(f,p,l){const y=[],d=[],g={},h={},R=n(f),{path:v}=R;c(p.stops)&&s(p.stops.features,d,"stops.features",g),c(p.pointBarriers)&&s(p.pointBarriers.features,d,"pointBarriers.features",g),c(p.polylineBarriers)&&s(p.polylineBarriers.features,d,"polylineBarriers.features",g),c(p.polygonBarriers)&&s(p.polygonBarriers.features,d,"polygonBarriers.features",g);const B=await t(d);for(const e in g){const r=g[e];y.push(e),h[e]=B.slice(r[0],r[1])}if(o(h,y)){let e=null;try{e=await a(v,p.apiKey,l)}catch{}e&&!e.hasZ&&i(h,y)}for(const e in h)h[e].forEach(((t,s)=>{r(p,e)[s].geometry=t}));const E={...l,query:{...R.query,...u(p),f:"json"}},T=v.endsWith("/solve")?v:`${v}/solve`,{data:b}=await e(T,E);return m(b)}function m(e){const{barriers:r,directionLines:t,directionPoints:s,directions:o,messages:a,polygonBarriers:i,polylineBarriers:n,routes:u,stops:f,traversedEdges:c,traversedJunctions:l,traversedTurns:m}=e,y=e=>{const r=g.find((r=>r.routeName===e));if(null!=r)return r;const t={routeId:g.length+1,routeName:e};return g.push(t),t},d=e=>{const r=g.find((r=>r.routeId===e));if(null!=r)return r;const t={routeId:e,routeName:null};return g.push(t),t},g=[];u?.features.forEach(((e,r)=>{e.geometry.spatialReference=u.spatialReference??void 0;const t=e.attributes.Name,s=r+1;g.push({routeId:s,routeName:t,route:e})})),o?.forEach((e=>{const{routeName:r}=e;y(r).directions=e}));const h=(f?.features.every((e=>null==e.attributes.RouteName))??!1)&&g.length>0?g[0].routeName:null;return f?.features.forEach((e=>{e.geometry&&(e.geometry.spatialReference??=f.spatialReference??void 0);const r=h??e.attributes.RouteName,t=y(r);t.stops??=[],t.stops.push(e)})),t?.features.forEach((e=>{const r=e.attributes.RouteID,s=d(r),{geometryType:o,spatialReference:a}=t;s.directionLines??={features:[],geometryType:o,spatialReference:a},s.directionLines.features.push(e)})),s?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:o,spatialReference:a}=s;t.directionPoints??={features:[],geometryType:o,spatialReference:a},t.directionPoints.features.push(e)})),c?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:s,spatialReference:o}=c;t.traversedEdges??={features:[],geometryType:s,spatialReference:o},t.traversedEdges.features.push(e)})),l?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:s,spatialReference:o}=l;t.traversedJunctions??={features:[],geometryType:s,spatialReference:o},t.traversedJunctions.features.push(e)})),m?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r);t.traversedTurns??={features:[]},t.traversedTurns.features.push(e)})),p.fromJSON({routeResults:g,barriers:r,polygonBarriers:i,polylineBarriers:n,messages:a})}export{l as solve};
5
+ import e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as u}from"./networkService.js";import{parseUrl as i}from"./utils.js";import{routeParametersToQueryParameters as n}from"./route/utils.js";import c from"./support/FeatureSet.js";import f from"./support/RouteSolveResult.js";function p(e){return e instanceof c}async function l(c,f,l){const y=[],d=[],h={},g={},R=i(c),{path:v}=R;p(f.stops)&&s(f.stops.features,d,"stops.features",h),p(f.pointBarriers)&&s(f.pointBarriers.features,d,"pointBarriers.features",h),p(f.polylineBarriers)&&s(f.polylineBarriers.features,d,"polylineBarriers.features",h),p(f.polygonBarriers)&&s(f.polygonBarriers.features,d,"polygonBarriers.features",h);const B=await t(d);for(const e in h){const r=h[e];y.push(e),g[e]=B.slice(r[0],r[1])}if(o(g,y)){let e=null;try{e=await a(v,f.apiKey,l)}catch{}e&&!e.hasZ&&u(g,y)}for(const e in g)g[e].forEach(((t,s)=>{r(f,e)[s].geometry=t}));const E={...l,query:{...R.query,...n(f),f:"json"}},T=v.endsWith("/solve")?v:`${v}/solve`,{data:b}=await e(T,E);return m(b)}function m(e){const{barriers:r,checksum:t,directionLines:s,directionPoints:o,directions:a,messages:u,polygonBarriers:i,polylineBarriers:n,routes:c,stops:p,traversedEdges:l,traversedJunctions:m,traversedTurns:y}=e,d=e=>{const r=g.find((r=>r.routeName===e));if(null!=r)return r;const t={routeId:g.length+1,routeName:e};return g.push(t),t},h=e=>{const r=g.find((r=>r.routeId===e));if(null!=r)return r;const t={routeId:e,routeName:null};return g.push(t),t},g=[];c?.features.forEach(((e,r)=>{e.geometry.spatialReference=c.spatialReference??void 0;const t=e.attributes.Name,s=r+1;g.push({routeId:s,routeName:t,route:e})})),a?.forEach((e=>{const{routeName:r}=e;d(r).directions=e}));const R=(p?.features.every((e=>null==e.attributes.RouteName))??!1)&&g.length>0?g[0].routeName:null;return p?.features.forEach((e=>{e.geometry&&(e.geometry.spatialReference??=p.spatialReference??void 0);const r=R??e.attributes.RouteName,t=d(r);t.stops??=[],t.stops.push(e)})),s?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:o,spatialReference:a}=s;t.directionLines??={features:[],geometryType:o,spatialReference:a},t.directionLines.features.push(e)})),o?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:a}=o;t.directionPoints??={features:[],geometryType:s,spatialReference:a},t.directionPoints.features.push(e)})),l?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=l;t.traversedEdges??={features:[],geometryType:s,spatialReference:o},t.traversedEdges.features.push(e)})),m?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=m;t.traversedJunctions??={features:[],geometryType:s,spatialReference:o},t.traversedJunctions.features.push(e)})),y?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r);t.traversedTurns??={features:[]},t.traversedTurns.features.push(e)})),f.fromJSON({barriers:r,checksum:t,messages:u,polygonBarriers:i,polylineBarriers:n,routeResults:g})}export{l as solve};
@@ -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{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import m from"./DataLayer.js";import c from"./FeatureSet.js";import{impedanceAttributeNameJsonMap as d,restrictionAttributeNameJsonMap as v,directionsLengthUnitJsonMap as w,directionsOutputTypeJsonMap as j,directionsStyleNameJsonMap as h,durationImpedanceAttributeNameJsonMap as S,lengthUnitJsonMap as B,outputLineJsonMap as f,restrictUTurnJsonMap as b}from"./networkEnums.js";import T from"./NetworkFeatureSet.js";import g from"./NetworkUrl.js";import A from"./TravelMode.js";var N;let P=class extends(e.ClonableMixin(o)){static{N=this}constructor(t){super(t),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(t){return s(N,t)}readAccumulateAttributes(t){return null==t?null:t.map((t=>d.fromJSON(t)))}writeAccumulateAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>d.toJSON(t))))}writePointBarriers(t,e,r){k(t,e,r)}writePolygonBarrier(t,e,r){k(t,e,r)}writePolylineBarrier(t,e,r){k(t,e,r)}readRestrictionAttributes(t){return null==t?null:t.map((t=>v.fromJSON(t)))}writeRestrictionAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>v.toJSON(t))))}readStartTime(t,e){const{startTime:r}=e;return null==r?null:"now"===r?"now":new Date(r)}writeStartTime(t,e){null!=t&&(e.startTime="now"===t?"now":t.getTime())}readStops(t,e){return C(e.stops)}writeStops(t,e,r){k(t,e,r)}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],P.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],P.prototype,"readAccumulateAttributes",null),t([l("accumulateAttributes")],P.prototype,"writeAccumulateAttributes",null),t([i(y)],P.prototype,"apiKey",void 0),t([i({json:{write:!0}})],P.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"directionsLanguage",void 0),t([n(w)],P.prototype,"directionsLengthUnits",void 0),t([n(j)],P.prototype,"directionsOutputType",void 0),t([n(h)],P.prototype,"directionsStyleName",void 0),t([n(S,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],P.prototype,"directionsTimeAttribute",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"findBestSequence",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionM",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionZ",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"ignoreInvalidLocations",void 0),t([n(d,{name:"impedanceAttributeName",ignoreUnknown:!1})],P.prototype,"impedanceAttribute",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"outputGeometryPrecision",void 0),t([n(B)],P.prototype,"outputGeometryPrecisionUnits",void 0),t([n(f)],P.prototype,"outputLines",void 0),t([i({type:a,json:{name:"outSR",write:!0}})],P.prototype,"outSpatialReference",void 0),t([i({json:{write:!0}})],P.prototype,"overrides",void 0),t([i({json:{name:"barriers",write:!0}})],P.prototype,"pointBarriers",void 0),t([l("pointBarriers")],P.prototype,"writePointBarriers",null),t([i({json:{write:!0}})],P.prototype,"polygonBarriers",void 0),t([l("polygonBarriers")],P.prototype,"writePolygonBarrier",null),t([i({json:{write:!0}})],P.prototype,"polylineBarriers",void 0),t([l("polylineBarriers")],P.prototype,"writePolylineBarrier",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveObjectID",void 0),t([i({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],P.prototype,"restrictionAttributes",void 0),t([p("restrictionAttributes")],P.prototype,"readRestrictionAttributes",null),t([l("restrictionAttributes")],P.prototype,"writeRestrictionAttributes",null),t([n(b)],P.prototype,"restrictUTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnDirections",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolygonBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolylineBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnRoutes",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnStops",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedEdges",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedJunctions",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnZ",void 0),t([i({json:{write:!0}})],P.prototype,"startTime",void 0),t([p("startTime")],P.prototype,"readStartTime",null),t([l("startTime")],P.prototype,"writeStartTime",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"startTimeIsUTC",void 0),t([i({json:{write:!0}})],P.prototype,"stops",void 0),t([p("stops")],P.prototype,"readStops",null),t([l("stops")],P.prototype,"writeStops",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"timeWindowsAreUTC",void 0),t([i({type:A,json:{write:!0}})],P.prototype,"travelMode",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useHierarchy",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useTimeWindows",void 0),P=N=t([u("esri.rest.support.RouteParameters")],P);const O=P;function J(t){return t&&"type"in t}function L(t){return t&&"features"in t&&"doNotLocateOnRestrictedElements"in t}function R(t){return t&&"url"in t}function U(t){return t&&"features"in t}function C(t){return J(t)?m.fromJSON(t):R(t)?g.fromJSON(t):L(t)?T.fromJSON(t):U(t)?c.fromJSON(t):null}function k(t,e,o){null!=t&&(e[o]=r.isCollection(t)?{features:t.toArray().map((t=>t.toJSON()))}:t.toJSON())}export{O as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import c from"./DataLayer.js";import m from"./FeatureSet.js";import{impedanceAttributeNameJsonMap as d,restrictionAttributeNameJsonMap as v,directionsLengthUnitJsonMap as w,directionsOutputTypeJsonMap as j,directionsStyleNameJsonMap as h,durationImpedanceAttributeNameJsonMap as S,lengthUnitJsonMap as B,outputLineJsonMap as f,restrictUTurnJsonMap as b}from"./networkEnums.js";import T from"./NetworkFeatureSet.js";import g from"./NetworkUrl.js";import A from"./TravelMode.js";var N;let P=class extends(e.ClonableMixin(o)){static{N=this}constructor(t){super(t),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.checksum=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(t){return s(N,t)}readAccumulateAttributes(t){return null==t?null:t.map((t=>d.fromJSON(t)))}writeAccumulateAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>d.toJSON(t))))}writePointBarriers(t,e,r){k(t,e,r)}writePolygonBarrier(t,e,r){k(t,e,r)}writePolylineBarrier(t,e,r){k(t,e,r)}readRestrictionAttributes(t){return null==t?null:t.map((t=>v.fromJSON(t)))}writeRestrictionAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>v.toJSON(t))))}readStartTime(t,e){const{startTime:r}=e;return null==r?null:"now"===r?"now":new Date(r)}writeStartTime(t,e){null!=t&&(e.startTime="now"===t?"now":t.getTime())}readStops(t,e){return C(e.stops)}writeStops(t,e,r){k(t,e,r)}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],P.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],P.prototype,"readAccumulateAttributes",null),t([l("accumulateAttributes")],P.prototype,"writeAccumulateAttributes",null),t([i(y)],P.prototype,"apiKey",void 0),t([i({json:{write:!0}})],P.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"checksum",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"directionsLanguage",void 0),t([n(w)],P.prototype,"directionsLengthUnits",void 0),t([n(j)],P.prototype,"directionsOutputType",void 0),t([n(h)],P.prototype,"directionsStyleName",void 0),t([n(S,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],P.prototype,"directionsTimeAttribute",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"findBestSequence",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionM",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionZ",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"ignoreInvalidLocations",void 0),t([n(d,{name:"impedanceAttributeName",ignoreUnknown:!1})],P.prototype,"impedanceAttribute",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"outputGeometryPrecision",void 0),t([n(B)],P.prototype,"outputGeometryPrecisionUnits",void 0),t([n(f)],P.prototype,"outputLines",void 0),t([i({type:a,json:{name:"outSR",write:!0}})],P.prototype,"outSpatialReference",void 0),t([i({json:{write:!0}})],P.prototype,"overrides",void 0),t([i({json:{name:"barriers",write:!0}})],P.prototype,"pointBarriers",void 0),t([l("pointBarriers")],P.prototype,"writePointBarriers",null),t([i({json:{write:!0}})],P.prototype,"polygonBarriers",void 0),t([l("polygonBarriers")],P.prototype,"writePolygonBarrier",null),t([i({json:{write:!0}})],P.prototype,"polylineBarriers",void 0),t([l("polylineBarriers")],P.prototype,"writePolylineBarrier",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveObjectID",void 0),t([i({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],P.prototype,"restrictionAttributes",void 0),t([p("restrictionAttributes")],P.prototype,"readRestrictionAttributes",null),t([l("restrictionAttributes")],P.prototype,"writeRestrictionAttributes",null),t([n(b)],P.prototype,"restrictUTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnDirections",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolygonBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolylineBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnRoutes",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnStops",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedEdges",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedJunctions",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnZ",void 0),t([i({json:{write:!0}})],P.prototype,"startTime",void 0),t([p("startTime")],P.prototype,"readStartTime",null),t([l("startTime")],P.prototype,"writeStartTime",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"startTimeIsUTC",void 0),t([i({json:{write:!0}})],P.prototype,"stops",void 0),t([p("stops")],P.prototype,"readStops",null),t([l("stops")],P.prototype,"writeStops",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"timeWindowsAreUTC",void 0),t([i({type:A,json:{write:!0}})],P.prototype,"travelMode",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useHierarchy",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useTimeWindows",void 0),P=N=t([u("esri.rest.support.RouteParameters")],P);const O=P;function J(t){return t&&"type"in t}function L(t){return t&&"features"in t&&"doNotLocateOnRestrictedElements"in t}function R(t){return t&&"url"in t}function U(t){return t&&"features"in t}function C(t){return J(t)?c.fromJSON(t):R(t)?g.fromJSON(t):L(t)?T.fromJSON(t):U(t)?m.fromJSON(t):null}function k(t,e,o){null!=t&&(e[o]=r.isCollection(t)?{features:t.toArray().map((t=>t.toJSON()))}:t.toJSON())}export{O as default};
@@ -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{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import a from"./FeatureSet.js";import l from"./NAMessage.js";import n from"./RouteResult.js";function u(r){return r?a.fromJSON(r).features.filter(e):[]}let m=class extends t{constructor(r){super(r),this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(r,o){return u(o.barriers)}readPolylineBarriers(r){return u(r)}readPolygonBarriers(r){return u(r)}};r([s({type:[l]})],m.prototype,"messages",void 0),r([s({type:[o]})],m.prototype,"pointBarriers",void 0),r([p("pointBarriers",["barriers"])],m.prototype,"readPointBarriers",null),r([s({type:[o]})],m.prototype,"polylineBarriers",void 0),r([p("polylineBarriers")],m.prototype,"readPolylineBarriers",null),r([s({type:[o]})],m.prototype,"polygonBarriers",void 0),r([p("polygonBarriers")],m.prototype,"readPolygonBarriers",null),r([s({type:[n]})],m.prototype,"routeResults",void 0),m=r([i("esri.rest.support.RouteSolveResult")],m);const y=m;export{y as default};
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import l from"./FeatureSet.js";import a from"./NAMessage.js";import u from"./RouteResult.js";function n(r){return r?l.fromJSON(r).features.filter(e):[]}let c=class extends t{constructor(r){super(r),this.checksum=null,this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(r,o){return n(o.barriers)}readPolylineBarriers(r){return n(r)}readPolygonBarriers(r){return n(r)}};r([s({type:String})],c.prototype,"checksum",void 0),r([s({type:[a]})],c.prototype,"messages",void 0),r([s({type:[o]})],c.prototype,"pointBarriers",void 0),r([p("pointBarriers",["barriers"])],c.prototype,"readPointBarriers",null),r([s({type:[o]})],c.prototype,"polylineBarriers",void 0),r([p("polylineBarriers")],c.prototype,"readPolylineBarriers",null),r([s({type:[o]})],c.prototype,"polygonBarriers",void 0),r([p("polygonBarriers")],c.prototype,"readPolygonBarriers",null),r([s({type:[u]})],c.prototype,"routeResults",void 0),c=r([i("esri.rest.support.RouteSolveResult")],c);const m=c;export{m as default};
@@ -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
- const b="20250219",e="9d5b82133681059357ce1a8364fbe83707b244f3";export{b as buildDate,e as commitHash};
5
+ const e="20250220",f="16000f8be9d49cf76f23d68136c3b75b3fe95ea4";export{e as buildDate,f as commitHash};
@@ -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{GeometryCursor as t}from"../../geometry/GeometryCursor.js";import{GeometryType as e,TileClipper as o}from"../../geometry/support/TileClipper.js";const r=512;let n;class s{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function i(s,i){n||(n=new o(0,0,0,1));const y="esriGeometryPolygon"===s.geometryType,m=y?e.Polygon:e.LineString,l=y?3:2;let c,p;for(n.reset(m),n.setPixelMargin(i+1),n.setExtent(r);s.nextPath();)if(!(s.pathSize<l)){for(s.nextPoint(),c=s.x,p=-s.y,n.moveTo(c,p);s.nextPoint();)c=s.x,p=-s.y,n.lineTo(c,p);y&&n.close()}const f=n.result(!1);if(f){const e=t.createEmptyOptimizedCIM(s.geometryType);for(const t of f){e.startPath();for(const o of t)e.pushXY(o.x,-o.y)}return e.reset(),e}return null}export{s as SimpleEffectCursor,i as clipCursorToTileExtent};
5
+ import{GeometryCursor as t}from"../../geometry/GeometryCursor.js";import{GeometryType as e,TileClipper as o}from"../../geometry/support/TileClipper.js";const r=512;let n;class s{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function i(s,i,l){if(!s)return null;n||(n=new o(0,0,0,1));const y=l?-1:1,m="esriGeometryPolygon"===s.geometryType,c=m?e.Polygon:e.LineString,p=m?3:2;let u,f;for(n.reset(c),n.setPixelMargin(i+1),n.setExtent(r);s.nextPath();)if(!(s.pathSize<p)){for(s.nextPoint(),u=s.x,f=y*s.y,n.moveTo(u,f);s.nextPoint();)u=s.x,f=y*s.y,n.lineTo(u,f);m&&n.close()}const g=n.result(!1);if(g){const e=t.createEmptyOptimizedCIM(s.geometryType);for(const t of g){e.startPath();for(const o of t)e.pushXY(o.x,y*o.y)}return e.reset(),e}return null}export{s as SimpleEffectCursor,i as clipCursorToTileExtent};
@@ -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
- class e{static{this.instance=null}static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(e,s,i,n,o){return new t(e,s,i)}}class t{constructor(e,t,s){this._inputGeometries=e,this._angleTolerance=void 0!==t.angleTolerance?t.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let e=this._inputGeometries.next();for(;e;){if("esriGeometryPolygon"===e.geometryType)this._isClosed=!0;else if("esriGeometryPolyline"===e.geometryType)this._isClosed=!1;else{if("esriGeometryEnvelope"!==e.geometryType){e=this._inputGeometries.next();continue}if(this._maxCosAngle)return e;this._isClosed=!0}for(;e.nextPath();)this._processPath(e);return e.reset(),e}return null}_processPath(e){if(e.nextPoint()){const t=e.x,s=e.y;let i=t,n=s,o=e.pathSize,l=0,r=0,a=0,h=0,c=0,_=0;this._isClosed&&++o;for(let u=1;e.nextPoint()||u<o;++u){let x,m;this._isClosed&&u===o-1?(x=t,m=s):(x=e.x,m=e.y);const y=x-i,g=m-n,C=Math.sqrt(y*y+g*g);if(u>1&&C>0&&a>0){(l*y+r*g)/C/a<=this._maxCosAngle&&e.setControlPointAt(u-1)}1===u&&(h=y,c=g,_=C),C>0&&(i=x,n=m,l=y,r=g,a=C)}if(this._isClosed&&a>0&&_>0){(l*h+r*c)/_/a<=this._maxCosAngle&&e.setControlPointAt(0)}}}}export{e as EffectAddControlPoints};
5
+ class e{static{this.instance=null}static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(e,s,n,i){return new t(e,s)}}class t{constructor(e,t){this._inputGeometries=e,this._angleTolerance=void 0!==t.angleTolerance?t.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let e=this._inputGeometries.next();if(!e)return null;for(;e;){if("esriGeometryPolygon"===e.geometryType)this._isClosed=!0;else if("esriGeometryPolyline"===e.geometryType)this._isClosed=!1;else{if("esriGeometryEnvelope"!==e.geometryType){e=this._inputGeometries.next();continue}if(this._maxCosAngle)return e;this._isClosed=!0}for(;e.nextPath();)this._processPath(e);return e.reset(),e}return null}_processPath(e){if(e.nextPoint()){const t=e.x,s=e.y;let n=t,i=s,o=e.pathSize,l=0,r=0,a=0,h=0,c=0,_=0;this._isClosed&&++o;for(let u=1;e.nextPoint()||u<o;++u){let x,m;this._isClosed&&u===o-1?(x=t,m=s):(x=e.x,m=e.y);const y=x-n,g=m-i,C=Math.sqrt(y*y+g*g);if(u>1&&C>0&&a>0){(l*y+r*g)/C/a<=this._maxCosAngle&&e.setControlPointAt(u-1)}1===u&&(h=y,c=g,_=C),C>0&&(n=x,i=m,l=y,r=g,a=C)}if(this._isClosed&&a>0&&_>0){(l*h+r*c)/_/a<=this._maxCosAngle&&e.setControlPointAt(0)}}}}export{e as EffectAddControlPoints};
@@ -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{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as s}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as o}from"../enums.js";class m{static{this.instance=null}static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n,o){return new l(e,t,i,s,r,n,o)}}class l{constructor(e,t,i,s,o,m,l){this._preventClipping=l,this._inputGeometries=e,this._tileKey=s,this._geometryEngine=o,this._curveHelper=new r,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m*i,this._offsetFlattenError=n*i}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._size)return r;if("esriGeometryEnvelope"===r.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(r.geometryType),s=t(r)[0],n=this._curveHelper.offset(s,this._size,o.Rounded,4,this._offsetFlattenError);if(n)return i.pushPath(n),i}else if(this._size<0){const t=r.asJSON();if(Math.min(t.xmax-t.xmin,t.ymax-t.ymin)+2*this._size>0)return e.fromJSONCIM({xmin:t.xmin-this._size,xmax:t.xmax+this._size,ymin:t.ymin-this._size,ymax:t.ymax+this._size})}const n=this._geometryEngine;if(null==n)return null;const m=!this._preventClipping&&this._tileKey?s(r,this._maxInflateSize):r;if(!m)continue;const l=n.buffer(i.WebMercator,m.asJSON(),this._size,1);return l?e.fromJSONCIM(l):null}return null}}export{m as EffectBuffer};
5
+ import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as s}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as o}from"../enums.js";class m{static{this.instance=null}static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n,o){return new l(e,t,i,s,r,n,o)}}class l{constructor(e,t,i,s,o,m,l){this._preventClipping=l,this._inputGeometries=e,this._tileKey=s,this._geometryEngine=o,this._curveHelper=new r,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m*i,this._offsetFlattenError=n*i}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._size)return r;if("esriGeometryEnvelope"===r.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(r.geometryType),s=t(r)[0],n=this._curveHelper.offset(s,this._size,o.Rounded,4,this._offsetFlattenError);if(n)return i.pushPath(n),i}else if(this._size<0){const t=r.asJSON();if(Math.min(t.xmax-t.xmin,t.ymax-t.ymin)+2*this._size>0)return e.fromJSONCIM({xmin:t.xmin-this._size,xmax:t.xmax+this._size,ymin:t.ymin-this._size,ymax:t.ymax+this._size})}const n=this._geometryEngine;if(null==n)return null;const m=!this._preventClipping&&this._tileKey?s(r,this._maxInflateSize,!0):r;if(!m)continue;const l=n.buffer(i.WebMercator,m.asJSON(),this._size,1);return l?e.fromJSONCIM(l):null}return null}}export{m as EffectBuffer};
@@ -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{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as e}from"../CIMEffects.js";import{GeometricEffectDonutMethod as n}from"../enums.js";class s{static{this.instance=null}static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,i,e,n,s,o,h){return new r(t,i,e,n,s,o,h)}}class r{constructor(t,i,e,s,r,o,h){switch(this._preventClipping=h,this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=o*e,this._width=(void 0!==i.width?i.width:2)*e,i.method){case n.Mitered:case n.Bevelled:case n.Rounded:case n.TrueBuffer:case n.Square:}this._option=i.option}next(){let n;for(;n=this._inputGeometries.next();){if("esriGeometryEnvelope"===n.geometryType&&this._width>0){const i=n.asJSON();return Math.min(i.xmax-i.xmin,i.ymax-i.ymin)-2*this._width<0?n:t.fromJSONCIM({paths:[[[i.xmin+this._width,i.ymin+this._width],[i.xmax-this._width,i.ymin+this._width],[i.xmax-this._width,i.ymax-this._width],[i.xmin+this._width,i.ymax-this._width],[i.xmin+this._width,i.ymin+this._width]],[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]})}if("esriGeometryPolygon"===n.geometryType){if(0===this._width)return n.clone();const t=this._geometryEngine;if(null==t)return null;const s=!this._preventClipping&&this._tileKey?e(n,this._maxInflateSize):n.clone();if(!s)continue;const r=t.buffer(i.WebMercator,s.asJSON(),-this._width,1);if(r)for(const i of r.rings)if(i){s.startPath();for(const t of i.reverse())s.pushXY(t[0],s.yFactor*t[1])}return s}}return null}}export{s as EffectDonut};
5
+ import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as e}from"../CIMEffects.js";import{GeometricEffectDonutMethod as n}from"../enums.js";class s{static{this.instance=null}static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,i,e,n,s,o,h){return new r(t,i,e,n,s,o,h)}}class r{constructor(t,i,e,s,r,o,h){switch(this._preventClipping=h,this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=o*e,this._width=(void 0!==i.width?i.width:2)*e,i.method){case n.Mitered:case n.Bevelled:case n.Rounded:case n.TrueBuffer:case n.Square:}this._option=i.option}next(){let n;for(;n=this._inputGeometries.next();){if("esriGeometryEnvelope"===n.geometryType&&this._width>0){const i=n.asJSON();return Math.min(i.xmax-i.xmin,i.ymax-i.ymin)-2*this._width<0?n:t.fromJSONCIM({paths:[[[i.xmin+this._width,i.ymin+this._width],[i.xmax-this._width,i.ymin+this._width],[i.xmax-this._width,i.ymax-this._width],[i.xmin+this._width,i.ymax-this._width],[i.xmin+this._width,i.ymin+this._width]],[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]})}if("esriGeometryPolygon"===n.geometryType){if(0===this._width)return n.clone();const t=this._geometryEngine;if(null==t)return null;const s=!this._preventClipping&&this._tileKey?e(n,this._maxInflateSize,!0):n.clone();if(!s)continue;const r=t.buffer(i.WebMercator,s.asJSON(),-this._width,1);if(r)for(const i of r.rings)if(i){s.startPath();for(const t of i.reverse())s.pushXY(t[0],s.yFactor*t[1])}return s}}return null}}export{s as EffectDonut};
@@ -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{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import s from"../../../geometry/SpatialReference.js";import{isExtent as i}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as o}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as f}from"../enums.js";const m=10;class h{static{this.instance=null}static local(){return null===h.instance&&(h.instance=new h),h.instance}execute(t,e,s,i,o,r,n){return new l(t,e,s,i,o,r,n)}}class l{constructor(t,e,s,i,o,f,h){this._preventClipping=h,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=o,this._curveHelper=new r,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(f*s),m),this._option=e.option,this._offsetFlattenError=n*s}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._offset)return r.clone();if("esriGeometryEnvelope"===r.geometryType){if(this._method===f.Rounded&&this._offset>0){const s=e(r),i=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(i){const e=t.createEmptyOptimizedCIM(r.geometryType);return e.pushPath(i),e}return null}const s=r.asJSON();if(i(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return t.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const n=this._geometryEngine;if(null==n)continue;const m=!this._preventClipping&&this._tileKey?o(r,this._maxInflateSize):r.clone();if(!m)continue;const h=n.offset(s.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{h as EffectOffset};
5
+ import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import s from"../../../geometry/SpatialReference.js";import{isExtent as i}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as o}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as f}from"../enums.js";const m=10;class h{static{this.instance=null}static local(){return null===h.instance&&(h.instance=new h),h.instance}execute(t,e,s,i,o,r,n){return new l(t,e,s,i,o,r,n)}}class l{constructor(t,e,s,i,o,f,h){this._preventClipping=h,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=o,this._curveHelper=new r,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(f*s),m),this._option=e.option,this._offsetFlattenError=n*s}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._offset)return r.clone();if("esriGeometryEnvelope"===r.geometryType){if(this._method===f.Rounded&&this._offset>0){const s=e(r),i=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(i){const e=t.createEmptyOptimizedCIM(r.geometryType);return e.pushPath(i),e}return null}const s=r.asJSON();if(i(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return t.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const n=this._geometryEngine;if(null==n)continue;const m=!this._preventClipping&&this._tileKey?o(r,this._maxInflateSize,!0):r.clone();if(!m)continue;const h=n.offset(s.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{h as EffectOffset};
@@ -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 e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import{MosaicType as M}from"./enums.js";import _ from"./GlyphMosaic.js";import I from"./GlyphSource.js";import w from"./Rect.js";import S from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{charCodes as R,discardUrlIfHasUrlHash as T,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as P}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as x}from"./animations/store/AnimationStore.js";import{TextureSamplingMode as b}from"../../../webgl/enums.js";const j="arial-unicode-ms-regular",v=()=>a.getLogger("esri.views.MapView"),$=(e,t,i)=>v().error(new s(e,t,i)),A=(e,t="")=>v().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class F{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFontsMap=new Map,this._sdfConverter=new S(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!o(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new x,this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new I(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return $("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new w(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return $("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(M.GLYPH,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(M.SPRITE,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?f:y}}:($("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const s=this._bindingInfos[t-1],r=s.page,a="Nearest"===s.samplingMode?b.NEAREST:i?b.LINEAR_MIPMAP_LINEAR:b.LINEAR;switch(s.mosaicType){case M.SPRITE:{const t=[this.sprites.getWidth(r),this.sprites.getHeight(r)],i=this._spriteMosaic.getTexture(e,r);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case M.GLYPH:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,r);return this._glyphMosaic.bind(e,a,r,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return $("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=k.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:s,textString:a}=e,n=r(s),o=this._invalidFontsMap.has(n),[c,h]=i(a),l=R(c);try{const e=o?j:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){A(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFontsMap.set(n,!0);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(j,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(T(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},G(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally((()=>this._ongoingRasterizations.delete(e))),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},G(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=G(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new P(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const r=e.url;if(B(r)||O(r))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)s=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(C(r))if("width"in e&&"height"in e)s.width=h(e.width),s.height=h(e.height);else if("cim"in e){const t=e;s.width=h(t.width??t.scaleX*t.size),s.height=h(t.size)}if(!s.width||!s.height)return null;const n=s.width,o=s.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,s,c);return this._addItemToMosaic(t,l,{type:"static",data:p},G(e),u,!1)}catch($){if(!o($))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${$.message}`);throw $}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function G(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return E(e);default:return!0}}const N=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||N(e)),L=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||L(e)),E=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{F as default};
5
+ import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import{MosaicType as M}from"./enums.js";import _ from"./GlyphMosaic.js";import I from"./GlyphSource.js";import w from"./Rect.js";import S from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{charCodes as R,discardUrlIfHasUrlHash as T,getCIMMarkerPlacementHash as C,isSVGImage as P}from"./Utils.js";import{AnimatableTextureResource as x}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as b}from"./animations/store/AnimationStore.js";import{TextureSamplingMode as j}from"../../../webgl/enums.js";const $="arial-unicode-ms-regular",v=()=>a.getLogger("esri.views.MapView"),k=(e,t,i)=>v().error(new s(e,t,i)),A=(e,t="")=>v().warnOnce(e,t);class F{static fromMosaic(e,t){return new F(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class G{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFontsMap=new Map,this._sdfConverter=new S(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!o(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new b,this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new I(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return k("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new w(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return k("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(M.GLYPH,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(M.SPRITE,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?f:y}}:(k("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const s=this._bindingInfos[t-1],r=s.page,a="Nearest"===s.samplingMode?j.NEAREST:i?j.LINEAR_MIPMAP_LINEAR:j.LINEAR;switch(s.mosaicType){case M.SPRITE:{const t=[this.sprites.getWidth(r),this.sprites.getHeight(r)],i=this._spriteMosaic.getTexture(e,r);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case M.GLYPH:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,r);return this._glyphMosaic.bind(e,a,r,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return k("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=F.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:s,textString:a}=e,n=r(s),o=this._invalidFontsMap.has(n),[c,h]=i(a),l=R(c);try{const e=o?$:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){A(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFontsMap.set(n,!0);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems($,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${C(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(T(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},N(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally((()=>this._ongoingRasterizations.delete(e))),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return k("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},N(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=N(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new x(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const r=e.url;if(L(r)||E(r))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return k("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)s=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(P(r))if("width"in e&&"height"in e)s.width=h(e.width),s.height=h(e.height);else if("cim"in e){const t=e;s.width=h(t.width??t.scaleX*t.size),s.height=h(t.size)}if(!s.width||!s.height)return null;const n=s.width,o=s.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,s,c);return this._addItemToMosaic(t,l,{type:"static",data:p},N(e),u,!1)}catch(k){if(!o(k))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${k.message}`);throw k}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function N(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const B=e=>null!=e&&e.startsWith("data:image/gif"),L=e=>e&&(e.includes(".gif")||B(e)),O=e=>null!=e&&e.startsWith("data:image/png"),E=e=>e&&(e.includes(".png")||O(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{G as default};
@@ -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 e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../webgl/checkWebGLError.js";import{PixelType as r}from"../../../webgl/enums.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/GLObjectType.js";import{getDataTypeBytes as n}from"../../../webgl/getDataTypeBytes.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";import{VertexElementDescriptor as i}from"../../../webgl/VertexElementDescriptor.js";const s=()=>t.getLogger("esri.views.2d.engine.webgl.Utils");function p(t){switch(t){case r.UNSIGNED_BYTE:return 1;case r.UNSIGNED_SHORT_4_4_4_4:return 2;case r.FLOAT:return 4;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function l(t){switch(t){case r.UNSIGNED_BYTE:return Uint8Array;case r.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case r.FLOAT:return Float32Array;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function m(e){const t=new Map;for(const r in e){const o=e[r];let a=0;t.set(r,o.map((e=>{const t=new i(e.name,e.count,e.type,a,0,e.normalized||!1);return a+=e.count*n(e.type),t}))),t.get(r).forEach((e=>e.stride=a))}return t}const u=e=>{const t=new Map;for(const r in e)for(const n of e[r])t.set(n.name,n.location);return t},c=e=>{const t={};return e.forEach(((e,r)=>t[r]=e?.length?e[0].stride:0)),t},g=new Map,f=(e,t)=>{if(!g.has(e)){const r=m(t),n={strides:c(r),bufferLayouts:r,attributes:u(t)};g.set(e,n)}return g.get(e)},d=e=>e.includes("data:image/svg+xml");function h(e){const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}const w=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4));function b(e,t,r){const n=new a(t.width,t.height);return n.dataType=t.dataType,t.depth&&(n.depth=t.depth),t.flipped&&(n.flipped=t.flipped),t.hasMipmap&&(n.hasMipmap=t.hasMipmap),n.internalFormat=t.internalFormat,t.isImmutable&&(n.isImmutable=t.isImmutable),t.isOpaque&&(n.isOpaque=t.isOpaque),t.maxAnisotropy&&(n.maxAnisotropy=t.maxAnisotropy),n.pixelFormat=t.pixelFormat,t.preMultiplyAlpha&&(n.preMultiplyAlpha=t.preMultiplyAlpha),t.samplingMode&&(n.samplingMode=t.samplingMode),t.target&&(n.target=t.target),n.uniform=t.uniform,t.unpackAlignment&&(n.unpackAlignment=t.unpackAlignment),t.wrapMode&&(n.wrapMode=t.wrapMode),new o(e,n,r)}function y(e){return"url"in e&&"urlHash"in e?{...e,url:""}:e}export{h as charCodes,m as createAttributeLayout,f as createProgramDescriptor,b as createTexture,y as discardUrlIfHasUrlHash,l as getPixelArrayCtor,p as getPixelBytes,d as isSVGImage,w as isValidSVG};
5
+ import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../webgl/checkWebGLError.js";import{PixelType as r}from"../../../webgl/enums.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/GLObjectType.js";import{getDataTypeBytes as n}from"../../../webgl/getDataTypeBytes.js";import{Texture as a}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";import{VertexElementDescriptor as o}from"../../../webgl/VertexElementDescriptor.js";const s=()=>t.getLogger("esri.views.2d.engine.webgl.Utils");function l(t){switch(t){case r.UNSIGNED_BYTE:return 1;case r.UNSIGNED_SHORT_4_4_4_4:return 2;case r.FLOAT:return 4;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function p(t){switch(t){case r.UNSIGNED_BYTE:return Uint8Array;case r.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case r.FLOAT:return Float32Array;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function c(e){const t=new Map;for(const r in e){const a=e[r];let i=0;t.set(r,a.map((e=>{const t=new o(e.name,e.count,e.type,i,0,e.normalized||!1);return i+=e.count*n(e.type),t}))),t.get(r).forEach((e=>e.stride=i))}return t}const m=e=>{const t=new Map;for(const r in e)for(const n of e[r])t.set(n.name,n.location);return t},u=e=>{const t={};return e.forEach(((e,r)=>t[r]=e?.length?e[0].stride:0)),t},d=new Map,f=(e,t)=>{if(!d.has(e)){const r=c(t),n={strides:u(r),bufferLayouts:r,attributes:m(t)};d.set(e,n)}return d.get(e)},g=e=>e.includes("data:image/svg+xml");function $(e){const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}const M=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4));function h(e,t,r){const n=new i(t.width,t.height);return n.dataType=t.dataType,t.depth&&(n.depth=t.depth),t.flipped&&(n.flipped=t.flipped),t.hasMipmap&&(n.hasMipmap=t.hasMipmap),n.internalFormat=t.internalFormat,t.isImmutable&&(n.isImmutable=t.isImmutable),t.isOpaque&&(n.isOpaque=t.isOpaque),t.maxAnisotropy&&(n.maxAnisotropy=t.maxAnisotropy),n.pixelFormat=t.pixelFormat,t.preMultiplyAlpha&&(n.preMultiplyAlpha=t.preMultiplyAlpha),t.samplingMode&&(n.samplingMode=t.samplingMode),t.target&&(n.target=t.target),n.uniform=t.uniform,t.unpackAlignment&&(n.unpackAlignment=t.unpackAlignment),t.wrapMode&&(n.wrapMode=t.wrapMode),new a(e,n,r)}function w(e){return"url"in e&&"urlHash"in e?{...e,url:""}:e}function y(e){if(null==e)return"";const{type:t}=e;switch(t){case"CIMMarkerPlacementAlongLineRandomSize":return`${t}-${e.seed}-${e.randomization}`;case"CIMMarkerPlacementAlongLineVariableSize":return`${t}-${e.maxRandomOffset}-${e.numberOfSizes}-${e.seed}-${e.variationMethod}`;case"CIMMarkerPlacementAtExtremities":return`${t}-${e.extremityPlacement}-${e.offsetAlongLine}`;case"CIMMarkerPlacementAtRatioPositions":return`${t}-${e.beginPosition}-${e.endPosition}-${e.flipFirst}-${JSON.stringify(e.positionArray)}`;case"CIMMarkerPlacementAtMeasuredUnits":return`${t}-${e.interval}-${e.skipMarkerRate}-${e.placeAtExtremities}`;case"CIMMarkerPlacementInsidePolygon":return`${t}-${e.stepX}-${e.stepY}-${e.randomness}-${e.gridType}-${e.seed}-${e.shiftOddRows}`;case"CIMMarkerPlacementOnLine":return`${t}-${e.relativeTo}-${e.startPointOffset}`;case"CIMMarkerPlacementOnVertices":return`${t}-${e.placeOnControlPoints}-${e.placeOnEndPoints}-${e.placeOnRegularVertices}`;case"CIMMarkerPlacementPolygonCenter":return`${t}-${e.method}`;default:return`${t}`}}export{$ as charCodes,c as createAttributeLayout,f as createProgramDescriptor,h as createTexture,w as discardUrlIfHasUrlHash,y as getCIMMarkerPlacementHash,p as getPixelArrayCtor,l as getPixelBytes,g as isSVGImage,M as isValidSVG};
@@ -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{WGLDrawPhase as e,FeatureSymbologyDrawOrder as t}from"../../../enums.js";import{FeatureTechnique as s}from"../FeatureTechnique.js";import{getSelectionDefines as r,getFeaturePipelineState as a,resolveDynamicUniforms as i,getFeatureUniforms as o,isHittest as n}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{TextShader as m,TextRenderPassType as p}from"../text/TextShader.js";class d extends s{constructor(){super(...arguments),this.type=u.Label,this.shaders={geometry:new m},this.drawPhase=e.LABEL|e.LABEL_ALPHA|e.HITTEST,this.symbologyPlane=t.TEXT}render(e,t){const{context:s,painter:u}=e,m=r(e),d={...a(e)},h=t.instance.getInput(),l={shader:this.shaders.geometry,uniforms:{...i(e,t.target,h.uniforms),...o(e,t.target),mosaicInfo:u.textureManager.getMosaicInfo(s,t.textureKey)},defines:{...m,textRenderPassType:p.Color,isBackgroundPass:!0,isLabel:!0},optionalAttributes:h.optionalAttributes,useComputeBuffer:n(e)};u.setShader(l),u.setPipelineState(d),u.submitDraw(e,t),u.setShader({...l,defines:{...m,textRenderPassType:p.Halo,isBackgroundPass:!1,isLabel:!0}}),u.setPipelineState(d),u.submitDraw(e,t),u.setShader({...l,defines:{...m,textRenderPassType:p.Color,isBackgroundPass:!1,isLabel:!0}}),u.setPipelineState(d),u.submitDraw(e,t)}}export{d as LabelTechnique};
5
+ import{WGLDrawPhase as e,FeatureSymbologyDrawOrder as t}from"../../../enums.js";import{FeatureTechnique as s}from"../FeatureTechnique.js";import{getSelectionDefines as r,getFeaturePipelineState as a,resolveDynamicUniforms as i,getFeatureUniforms as o,isHittest as n}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{TextShader as m,TextRenderPassType as d}from"../text/TextShader.js";class p extends s{constructor(){super(...arguments),this.type=u.Label,this.shaders={geometry:new m},this.drawPhase=e.LABEL|e.LABEL_ALPHA|e.HITTEST,this.symbologyPlane=t.TEXT}render(e,t){const{context:s,painter:u}=e,m=r(e),p={...a(e)},h=t.instance.getInput(),f={shader:this.shaders.geometry,uniforms:{...i(e,t.target,h.uniforms),...o(e,t.target),mosaicInfo:u.textureManager.getMosaicInfo(s,t.textureKey)},defines:{...m,textRenderPassType:d.Color,isBackgroundPass:!0,isLabel:!0},optionalAttributes:h.optionalAttributes,useComputeBuffer:n(e)};u.setPipelineState(p),u.setShader(f),u.submitDraw(e,t),u.setShader({...f,defines:{...m,textRenderPassType:d.Halo,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,t),u.setShader({...f,defines:{...m,textRenderPassType:d.Color,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,t)}}export{p as LabelTechnique};
@@ -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{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{maxTileCoordValue as n}from"../../../../../../../symbols/cim/constants.js";import{Alignment as c}from"../../../../../../../symbols/cim/enums.js";import{CIMMarkerPlacementHelper as m}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as l}from"../../../definitions.js";import{getMinMaxZoom as d,processColorInput as u,packByteSqrt as p,getBitMask as h}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as f}from"./ComputedMarkerParams.js";import{MarkerConstants as y}from"./markerConstants.js";import{getGeometryEngine as x}from"../mesh/loadGeometryEngine.js";import{MeshWriter as P}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const g=3.14159265359/180,k=128/Math.PI;function b(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function v(e){return b(e*k,256)}function S(e,a,i,n,c=!1){const m=s(),l=c?1:-1;return t(m),(a||i)&&r(m,m,[a,-i]),n&&o(m,m,l*g*-n),m}const _={createComputedParams:e=>f.from(e),optionalAttributes:{zoomRange:{type:M.SHORT,count:2,packPrecisionFactor:l,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=h(y.bitset.isSDF)),t===c.MAP&&(a|=h(y.bitset.isMapAligned)),r&&(a|=h(y.bitset.scaleSymbolsProportionally)),o&&(a|=h(y.bitset.overrideOutlineColor)),s&&(a|=h(y.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const m=S(0,i,n,-e,c),l=-(.5+o)*t,d=-(.5-s)*r,u=[l,d],p=[l+t,d],h=[l,d+r],f=[l+t,d+r];return a(u,u,m),a(p,p,m),a(h,h,m),a(f,f,m),[u,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[p(s,128),p(r,128),p(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>v(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class I extends P{constructor(){super(...arguments),this.vertexSpec=_}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),c=Math.max(this.evaluatedMeshParams.computedHeight,a),m=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,l=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,d=this.evaluatedMeshParams.offsetX+m,u=-this.evaluatedMeshParams.offsetY+l;if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t,r,i,c);else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+d,o+u,i,c),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+d,a+u,i,c),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+d,o+u,i,c),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex(((t,r)=>{e.recordBounds(t+d,r+u,i,c),Math.abs(t)>n||Math.abs(r)>n||this._writeQuad(e,s,t,r)}))}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const c=o??i.fromFeatureSetReaderCIM(r)?.clone();if(!c)return;const l=-1,d=m.getPlacement(c,l,this.evaluatedMeshParams.placement,e(1),t.id,x());if(!d)return;const u=r.getDisplayId();let p=d.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>n||Math.abs(r)>n){p=d.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,u,e,r,o),p=d.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{I as MarkerMeshWriter,_ as MarkerVertexSpec};
5
+ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{Alignment as m}from"../../../../../../../symbols/cim/enums.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as d}from"../../../definitions.js";import{getMinMaxZoom as u,processColorInput as p,packByteSqrt as h,getBitMask as f}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as y}from"./ComputedMarkerParams.js";import{MarkerConstants as x}from"./markerConstants.js";import{getGeometryEngine as M}from"../mesh/loadGeometryEngine.js";import{MeshWriter as P}from"../mesh/MeshWriter.js";import{DataType as g}from"../../../../../../webgl/enums.js";const b=3.14159265359/180,k=128/Math.PI;function v(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function S(e){return v(e*k,256)}function I(e,a,i,n,c=!1){const m=s(),l=c?1:-1;return t(m),(a||i)&&r(m,m,[a,-i]),n&&o(m,m,l*b*-n),m}const _={createComputedParams:e=>y.from(e),optionalAttributes:{zoomRange:{type:g.SHORT,count:2,packPrecisionFactor:d,pack:({scaleInfo:e},{tileInfo:t})=>u(e,t)}},attributes:{pos:{type:g.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:g.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=f(x.bitset.isSDF)),t===m.MAP&&(a|=f(x.bitset.isMapAligned)),r&&(a|=f(x.bitset.scaleSymbolsProportionally)),o&&(a|=f(x.bitset.overrideOutlineColor)),s&&(a|=f(x.bitset.colorLocked)),a}},offset:{type:g.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const m=I(0,i,n,-e,c),l=-(.5+o)*t,d=-(.5-s)*r,u=[l,d],p=[l+t,d],h=[l,d+r],f=[l+t,d+r];return a(u,u,m),a(p,p,m),a(h,h,m),a(f,f,m),[u,p,h,f]}}},textureUV:{type:g.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>p(e)},outlineColor:{type:g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>p(e)},sizing:{type:g.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[h(s,128),h(r,128),h(o,128),0]}},placementAngle:{type:g.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>S(e)},sdfDecodeCoeff:{type:g.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class E extends P{constructor(){super(...arguments),this.vertexSpec=_}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),m=Math.max(this.evaluatedMeshParams.computedHeight,a),l=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,d=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,u=this.evaluatedMeshParams.offsetX+l,p=-this.evaluatedMeshParams.offsetY+d;if(null!=this.evaluatedMeshParams.placement){const o=n(r,100,!1);this._writePlacedMarkers(e,t,o,i,m)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+u,o+p,i,m),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+u,a+p,i,m),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+u,o+p,i,m),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex(((t,r)=>{e.recordBounds(t+u,r+p,i,m),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,s,t,r)}))}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,d=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id,M());if(!d)return;const u=r.getDisplayId();let p=d.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=d.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,u,e,r,o),p=d.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{E as MarkerMeshWriter,_ as MarkerVertexSpec};