@arcgis/core 5.1.0-next.77 → 5.1.0-next.78

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 (210) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroup.d.ts +74 -0
  2. package/analysis/ElevationProfile/ElevationProfileGroup.js +2 -0
  3. package/analysis/ElevationProfileAnalysis.d.ts +29 -14
  4. package/analysis/ElevationProfileAnalysis.js +1 -1
  5. package/applications/Components/OrientedImageryViewer/ImageViewer/utils.d.ts +34 -0
  6. package/applications/Components/OrientedImageryViewer/ImageViewer/utils.js +2 -0
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{537fe2522dff1e6ce03b.js → 11ea4be441a26134ce1f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/17acbf40e7c1cb42d9bd.js +1 -0
  10. package/assets/esri/core/workers/chunks/1c7fd0a229a8112b0539.js +596 -0
  11. package/assets/esri/core/workers/chunks/{baeb96aef03d4c566af7.js → 1f53620f82cc7c3daabe.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2387613b855771a3e537.js +1 -0
  13. package/assets/esri/core/workers/chunks/283d39dfb1625b5a74db.js +1 -0
  14. package/assets/esri/core/workers/chunks/{5e1b847b116d21908a54.js → 322c54081b25f1c53661.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{330b47ac0759c3c35cc5.js → 34fe97bcacc0dfc5bce6.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{14eb2cc8e2ad6d8d03fd.js → 3d9fcbe95dd22dbe730e.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{e262c4864dc06c43b380.js → 3df8493b91aa3bce824d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{bf8f603848bad4a7deb4.js → 4ccb56333de0247dcb6f.js} +1 -1
  19. package/assets/esri/core/workers/chunks/5b6f2bfdcdd207d8ae42.js +1 -0
  20. package/assets/esri/core/workers/chunks/{88b480a1d1fb01778798.js → 5ee4b630ad39c21d11db.js} +21 -26
  21. package/assets/esri/core/workers/chunks/{6b66fc32451433129a88.js → 8508f238d99021e87f71.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{bc75ab48f4c7609ef09d.js → 85d3475667c503ec4fc6.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{9d6491f996eeb0c646ed.js → 85d8c7cc7f8decbe975d.js} +1 -1
  24. package/assets/esri/core/workers/chunks/9b9916864b6575c42c8a.js +1 -0
  25. package/assets/esri/core/workers/chunks/{75d5ea0da181f9e7425f.js → a8ca5d8740cc7e39197b.js} +6 -6
  26. package/assets/esri/core/workers/chunks/{8d75f6f27c1c17c33992.js → b7bb7072dbee978f3ca3.js} +1 -1
  27. package/assets/esri/core/workers/chunks/bf7e019437a3b6036300.js +2 -0
  28. package/assets/esri/core/workers/chunks/{99c161fecae710b53b40.js → d304343a781acfa3ff96.js} +1 -1
  29. package/assets/esri/core/workers/chunks/dbb9bb28696ff9536678.js +2 -0
  30. package/assets/esri/core/workers/chunks/{34ea3ed78041437a8fc8.js → f81c6f6ccc201f584970.js} +1 -1
  31. package/assets/esri/themes/base/_core.scss +2 -0
  32. package/assets/esri/themes/base/widgets/_PluginSettingsControls.scss +29 -0
  33. package/assets/esri/themes/dark/main.css +1 -1
  34. package/assets/esri/themes/light/main.css +1 -1
  35. package/assets/esri/themes/light/view.css +1 -1
  36. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  37. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  38. package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
  39. package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
  40. package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
  41. package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
  42. package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
  43. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  44. package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
  45. package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
  46. package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
  47. package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
  48. package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
  49. package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
  50. package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
  51. package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
  52. package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
  53. package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
  54. package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
  55. package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
  56. package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
  57. package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
  58. package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
  59. package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
  60. package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
  61. package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
  62. package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
  63. package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
  64. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
  65. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
  66. package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
  67. package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
  68. package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
  69. package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
  70. package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
  71. package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
  72. package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
  73. package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
  74. package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
  75. package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
  76. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
  77. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
  78. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
  79. package/config.js +1 -1
  80. package/core/types.d.ts +28 -0
  81. package/form/elements/inputs/MultipleChoiceInput.d.ts +2 -2
  82. package/form/elements/inputs/MultipleChoiceInput.js +1 -1
  83. package/geometry/operators/types.d.ts +2 -2
  84. package/interfaces.d.ts +4 -7
  85. package/kernel.js +1 -1
  86. package/layers/ImageryLayer.d.ts +7 -1
  87. package/layers/ImageryLayer.js +1 -1
  88. package/layers/ImageryTileLayer.d.ts +7 -1
  89. package/layers/ImageryTileLayer.js +1 -1
  90. package/layers/WCSLayer.d.ts +7 -1
  91. package/layers/WCSLayer.js +1 -1
  92. package/layers/save/imageryUtils.js +1 -1
  93. package/layers/video/VideoController.js +1 -1
  94. package/networks/UnitIdentifierManager.d.ts +15 -15
  95. package/networks/UnitIdentifierManager.js +1 -1
  96. package/networks/support/jsonTypes.d.ts +125 -13
  97. package/package.json +3 -3
  98. package/popup/Features.d.ts +0 -1
  99. package/popup/Features.js +1 -1
  100. package/rest/networks/unitIdentifiers/reserve.js +2 -0
  101. package/rest/networks/unitIdentifiers/support/ReserveParameters.js +2 -0
  102. package/rest/networks/unitIdentifiers/support/ResizeParameters.js +1 -1
  103. package/rest/networks/unitIdentifiers/support/UnitQueryResult.js +1 -1
  104. package/support/revision.js +1 -1
  105. package/views/2d/analysis/ElevationProfile/ElevationProfileVisualization2D.js +1 -1
  106. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +5 -1
  107. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  108. package/views/2d/engine/webgl/AFeatureTile.js +1 -1
  109. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  110. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  111. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  112. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
  113. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  114. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ShaderHittest.js +1 -1
  115. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  116. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  117. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  118. package/views/2d/layers/BaseLayerView2D.d.ts +3 -3
  119. package/views/2d/layers/BaseLayerViewGL2D.d.ts +3 -3
  120. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  121. package/views/2d/layers/TileLayerView2D.js +1 -1
  122. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  123. package/views/2d/layers/features/FeatureContainer.js +1 -1
  124. package/views/2d/support/clippingUtils.js +1 -1
  125. package/views/2d/support/hitTestUtils.js +1 -1
  126. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
  127. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +5 -1
  128. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  129. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  130. package/views/3d/layers/IntegratedMeshNormals.js +1 -1
  131. package/views/3d/terrain/ElevationData.js +1 -1
  132. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  133. package/views/3d/webgl-engine/collections/Component/Renderable.js +1 -1
  134. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +1 -5
  135. package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +1 -5
  136. package/views/3d/webgl-engine/core/shaderLibrary/util/MixExternalColor.glsl.js +16 -21
  137. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  138. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  139. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  140. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  141. package/views/3d/webgl-engine/shaders/BlackLevelLightSoftCompression.glsl.js +5 -1
  142. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +2 -2
  143. package/views/VideoView.js +1 -1
  144. package/views/View2D.js +1 -1
  145. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  146. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  147. package/views/analysis/ElevationProfile/ElevationProfileIndicatorPointVisualization.js +1 -1
  148. package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +6 -4
  149. package/views/draw/DrawTool.js +1 -1
  150. package/views/draw/plugins/BezierSegmentPlugin.js +1 -1
  151. package/views/draw/plugins/FreehandSegmentPlugin.js +1 -1
  152. package/views/draw/support/PluginContext.js +1 -1
  153. package/views/draw/support/types.d.ts +21 -0
  154. package/views/draw/support/types.js +1 -1
  155. package/views/types.d.ts +2 -2
  156. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  157. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  158. package/widgets/Daylight/DaylightViewModel.js +1 -1
  159. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  160. package/widgets/Editor/components/Settings.js +1 -1
  161. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  162. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  163. package/widgets/ElevationProfile/support/ElevationProfileView.js +1 -1
  164. package/widgets/ElevationProfile/support/ElevationProfileView2D.js +1 -1
  165. package/widgets/ElevationProfile/support/ElevationProfileView3D.js +1 -1
  166. package/widgets/ElevationProfile/support/InputRepresentation2D.js +1 -1
  167. package/widgets/ElevationProfile/support/InputRepresentation3D.js +1 -1
  168. package/widgets/ElevationProfile/support/ProfileLine2D.js +1 -1
  169. package/widgets/ElevationProfile/support/ProfileLines3D.js +1 -1
  170. package/widgets/FeatureForm/FieldInput.js +1 -1
  171. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  172. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  173. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.d.ts +5 -5
  174. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  175. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  176. package/widgets/OrientedImageryViewer/constants.js +1 -1
  177. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  178. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +2 -0
  179. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +2 -0
  180. package/widgets/OrientedImageryViewer/types.d.ts +10 -0
  181. package/widgets/OrientedImageryViewer.d.ts +17 -2
  182. package/widgets/OrientedImageryViewer.js +1 -1
  183. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  184. package/widgets/Sketch/SketchViewModel.js +1 -1
  185. package/widgets/Sketch/support/PluginManager.js +1 -1
  186. package/widgets/Sketch/support/SettingsManager.js +2 -0
  187. package/widgets/Sketch.js +1 -1
  188. package/widgets/Slider/SliderViewModel.d.ts +2 -1
  189. package/widgets/Slider/SliderViewModel.js +1 -1
  190. package/widgets/Slider.js +1 -1
  191. package/widgets/smartMapping/ColorSlider/ColorSliderViewModel.js +1 -1
  192. package/widgets/smartMapping/OpacitySlider/OpacitySliderViewModel.js +1 -1
  193. package/widgets/smartMapping/SizeSlider/SizeSliderViewModel.js +1 -1
  194. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  195. package/widgets/support/PluginSettingsControls.js +2 -0
  196. package/widgets/support/SnappingControls.js +1 -1
  197. package/widgets/support/forms/formUtils.js +1 -1
  198. package/analysis/ElevationProfile/elevationProfileLineTypes.js +0 -2
  199. package/assets/esri/core/workers/chunks/003476e950bd27a2f884.js +0 -596
  200. package/assets/esri/core/workers/chunks/07aca5ecad659d55e795.js +0 -2
  201. package/assets/esri/core/workers/chunks/7540f7df86620f067b5a.js +0 -1
  202. package/assets/esri/core/workers/chunks/76e34f81bb4a7b0e694c.js +0 -1
  203. package/assets/esri/core/workers/chunks/bfe575da727ce7c8d331.js +0 -2
  204. package/assets/esri/core/workers/chunks/cb45e5d4a4ef82cda583.js +0 -1
  205. package/assets/esri/core/workers/chunks/ea59b81299acaf0d85ee.js +0 -1
  206. package/assets/esri/core/workers/chunks/ef0eae13408cbf83a64f.js +0 -1
  207. package/rest/networks/unitIdentifiers/insertGap.js +0 -2
  208. package/rest/networks/unitIdentifiers/support/InsertGapParameters.js +0 -2
  209. /package/assets/esri/core/workers/chunks/{07aca5ecad659d55e795.js.LICENSE.txt → bf7e019437a3b6036300.js.LICENSE.txt} +0 -0
  210. /package/assets/esri/core/workers/chunks/{bfe575da727ce7c8d331.js.LICENSE.txt → dbb9bb28696ff9536678.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{property as l,subclass as n}from"../../core/accessorSupport/decorators.js";let r=class extends e{constructor(t){super(t),this.precision=4,this.thumbsConstrained=!0}set effectiveMax(t){this.setEffectiveMax(t)}set effectiveMin(t){this.setEffectiveMin(t)}set labelFormatFunction(t){this._set("labelFormatFunction",t)}set inputFormatFunction(t){this._set("inputFormatFunction",t)}set inputParseFunction(t){this._set("inputParseFunction",t)}get labels(){const{max:t,min:e,values:i}=this,s=i?.length?i.map((t,e)=>this.getLabelForValue(t,"value",e)):[];return{max:this.getLabelForValue(t,"max"),min:this.getLabelForValue(e,"min"),values:s}}set max(t){this.setMax(t)}set min(t){this.setMin(t)}get state(){const{max:t,min:e}=this;return null!=t&&null!=e&&t>e?"ready":"disabled"}set values(t){const{max:e,min:i}=this,s=this.values;s&&s.length===t?.length&&s.every((e,i)=>e===t[i])||(this._set("values",null),t?.length&&(null!=i&&t.some(t=>t<i)&&(this.min=Math.min(...t)),null!=e&&t.some(t=>t>e)&&(this.max=Math.max(...t))),this._set("values",t))}toPrecision(t){return parseFloat(t.toFixed(this.precision))}defaultLabelFormatFunction(t){const{max:e,min:i,precision:s}=this,l=null!=e&&null!=i&&e-i>10?2:s;return parseFloat(t.toFixed(l)).toString()}defaultInputFormatFunction(t){return t.toString()}defaultInputParseFunction(t){return parseFloat(t)}getBounds(){const{effectiveMax:t,effectiveMin:e,max:i,min:s}=this;return{min:null!=e&&null!=s?Math.max(s,e):s,max:null!=t&&null!=i?Math.min(i,t):i}}getBoundsForValueAtIndex(t){const{thumbsConstrained:e,values:i}=this,{min:s,max:l}=this.getBounds();if(e&&i){const e=t-1,n=t+1;return{min:null!=i[e]?i[e]:s,max:null!=i[n]?i[n]:l}}return{min:s,max:l}}getLabelForValue(t,e,i){return null==t?null:this.labelFormatFunction?this.labelFormatFunction(t,e,i):this.defaultLabelFormatFunction(t)}setMax(t){const{max:e,values:i}=this;if(null==t)return void this._set("max",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'max' is NaN.");const s=this.toPrecision(t);if(e!==s)if(null!=this.min&&s<this.min)this._logError("slider:invalid-value","Supplied value for property 'max' is less than 'min'.");else if(this._set("max",s),i?.length)for(let l=0;l<i.length;l++)s<i[l]&&this.setValue(l,s)}setMin(t){const{min:e,values:i}=this;if(null==t)return void this._set("min",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'min' is NaN.");const s=this.toPrecision(t);if(e!==s)if(null!=this.max&&s>this.max)this._logError("slider:invalid-value","Supplied value for property 'min' is greater than 'max'.");else if(this._set("min",s),i?.length)for(let l=0;l<i.length;l++)s>i[l]&&this.setValue(l,s)}setEffectiveMax(t){if(null==t)return void this._set("effectiveMax",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMax' is NaN.");const e=this.toPrecision(t);this.effectiveMax!==e&&this._set("effectiveMax",this._applyBoundsToValue(e))}setEffectiveMin(t){if(null==t)return void this._set("effectiveMin",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMin' is NaN.");const e=this.toPrecision(t);this.effectiveMin!==e&&this._set("effectiveMin",this._applyBoundsToValue(e))}setValue(t,e){if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is NaN.");const{values:i}=this;if(null==i)return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is null.");const s=i[t],l=this.toPrecision(e);if(s===l)return;const n=[...i];n[t]=l,this._set("values",n)}_applyBoundsToValue(t){const{max:e,min:i}=this;return null!=i&&t<i?i:null!=e&&t>e?e:t}_logError(t,e,l){s.getLogger(this).error(new i(t,e,l))}};t([l()],r.prototype,"effectiveMax",null),t([l()],r.prototype,"effectiveMin",null),t([l()],r.prototype,"labelFormatFunction",null),t([l()],r.prototype,"inputFormatFunction",null),t([l()],r.prototype,"inputParseFunction",null),t([l({readOnly:!0})],r.prototype,"labels",null),t([l()],r.prototype,"max",null),t([l()],r.prototype,"min",null),t([l()],r.prototype,"precision",void 0),t([l({readOnly:!0})],r.prototype,"state",null),t([l()],r.prototype,"thumbsConstrained",void 0),t([l()],r.prototype,"values",null),r=t([n("esri.widgets.Slider.SliderViewModel")],r);const o=r;export{o as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{deprecateUnnecessaryViewModel as i}from"../../core/deprecate.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{property as n,subclass as l}from"../../core/accessorSupport/decorators.js";let o=class extends t{constructor(e){super(e),this.precision=4,this.thumbsConstrained=!0,e?.suppressDeprecationWarning||i(r.getLogger(this),"Slider","arcgis-slider",{version:"5.1"})}normalizeCtorArgs(e){const{suppressDeprecationWarning:t,...i}=e;return i}set effectiveMax(e){this.setEffectiveMax(e)}set effectiveMin(e){this.setEffectiveMin(e)}set labelFormatFunction(e){this._set("labelFormatFunction",e)}set inputFormatFunction(e){this._set("inputFormatFunction",e)}set inputParseFunction(e){this._set("inputParseFunction",e)}get labels(){const{max:e,min:t,values:i}=this,s=i?.length?i.map((e,t)=>this.getLabelForValue(e,"value",t)):[];return{max:this.getLabelForValue(e,"max"),min:this.getLabelForValue(t,"min"),values:s}}set max(e){this.setMax(e)}set min(e){this.setMin(e)}get state(){const{max:e,min:t}=this;return null!=e&&null!=t&&e>t?"ready":"disabled"}set values(e){const{max:t,min:i}=this,s=this.values;s&&s.length===e?.length&&s.every((t,i)=>t===e[i])||(this._set("values",null),e?.length&&(null!=i&&e.some(e=>e<i)&&(this.min=Math.min(...e)),null!=t&&e.some(e=>e>t)&&(this.max=Math.max(...e))),this._set("values",e))}toPrecision(e){return parseFloat(e.toFixed(this.precision))}defaultLabelFormatFunction(e){const{max:t,min:i,precision:s}=this,r=null!=t&&null!=i&&t-i>10?2:s;return parseFloat(e.toFixed(r)).toString()}defaultInputFormatFunction(e){return e.toString()}defaultInputParseFunction(e){return parseFloat(e)}getBounds(){const{effectiveMax:e,effectiveMin:t,max:i,min:s}=this;return{min:null!=t&&null!=s?Math.max(s,t):s,max:null!=e&&null!=i?Math.min(i,e):i}}getBoundsForValueAtIndex(e){const{thumbsConstrained:t,values:i}=this,{min:s,max:r}=this.getBounds();if(t&&i){const t=e-1,n=e+1;return{min:null!=i[t]?i[t]:s,max:null!=i[n]?i[n]:r}}return{min:s,max:r}}getLabelForValue(e,t,i){return null==e?null:this.labelFormatFunction?this.labelFormatFunction(e,t,i):this.defaultLabelFormatFunction(e)}setMax(e){const{max:t,values:i}=this;if(null==e)return void this._set("max",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'max' is NaN.");const s=this.toPrecision(e);if(t!==s)if(null!=this.min&&s<this.min)this._logError("slider:invalid-value","Supplied value for property 'max' is less than 'min'.");else if(this._set("max",s),i?.length)for(let r=0;r<i.length;r++)s<i[r]&&this.setValue(r,s)}setMin(e){const{min:t,values:i}=this;if(null==e)return void this._set("min",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'min' is NaN.");const s=this.toPrecision(e);if(t!==s)if(null!=this.max&&s>this.max)this._logError("slider:invalid-value","Supplied value for property 'min' is greater than 'max'.");else if(this._set("min",s),i?.length)for(let r=0;r<i.length;r++)s>i[r]&&this.setValue(r,s)}setEffectiveMax(e){if(null==e)return void this._set("effectiveMax",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMax' is NaN.");const t=this.toPrecision(e);this.effectiveMax!==t&&this._set("effectiveMax",this._applyBoundsToValue(t))}setEffectiveMin(e){if(null==e)return void this._set("effectiveMin",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMin' is NaN.");const t=this.toPrecision(e);this.effectiveMin!==t&&this._set("effectiveMin",this._applyBoundsToValue(t))}setValue(e,t){if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is NaN.");const{values:i}=this;if(null==i)return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is null.");const s=i[e],r=this.toPrecision(t);if(s===r)return;const n=[...i];n[e]=r,this._set("values",n)}_applyBoundsToValue(e){const{max:t,min:i}=this;return null!=i&&e<i?i:null!=t&&e>t?t:e}_logError(e,t,i){r.getLogger(this).error(new s(e,t,i))}};e([n()],o.prototype,"effectiveMax",null),e([n()],o.prototype,"effectiveMin",null),e([n()],o.prototype,"labelFormatFunction",null),e([n()],o.prototype,"inputFormatFunction",null),e([n()],o.prototype,"inputParseFunction",null),e([n({readOnly:!0})],o.prototype,"labels",null),e([n()],o.prototype,"max",null),e([n()],o.prototype,"min",null),e([n()],o.prototype,"precision",void 0),e([n({readOnly:!0})],o.prototype,"state",null),e([n()],o.prototype,"thumbsConstrained",void 0),e([n()],o.prototype,"values",null),o=e([l("esri.widgets.Slider.SliderViewModel")],o);const a=o;export{a as default};
package/widgets/Slider.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import i from"../core/Collection.js";import{deprecateWidget as n}from"../core/deprecate.js";import s from"../core/Logger.js";import{assertIsSome as o}from"../core/maybe.js";import{property as r,cast as a,subclass as l}from"../core/accessorSupport/decorators.js";import h from"./Widget.js";import{css as u}from"./Slider/css.js";import d from"./Slider/SliderViewModel.js";import{globalCss as c}from"./support/globalCss.js";import{messageBundle as m,tsx as _}from"./support/widget.js";import{onResize as p}from"./support/widgetUtils.js";const v={showInput:"Enter",hideInput1:"Enter",hideInput2:"Escape",hideInput3:"Tab",moveAnchorUp:"ArrowUp",moveAnchorDown:"ArrowDown",moveAnchorLeft:"ArrowLeft",moveAnchorRight:"ArrowRight",moveAnchorToMax:"End",moveAnchorToMin:"Home"},g={labels:!1,rangeLabels:!1};let f=class extends h{constructor(e,t){super(e,t),this._activeLabelInputIndex=null,this._anchorElements=[],this._dragged=!1,this._dragStartInfo=null,this._focusedAnchorIndex=null,this._isMinInputActive=!1,this._isMaxInputActive=!1,this._lastMovedHandleIndex=null,this._positionPrecision=5,this._segmentDragStartInfo=null,this._trackHeight=null,this._trackWidth=null,this._zIndices=[],this._zIndexOffset=3,this.disabled=!1,this.draggableSegmentsEnabled=!0,this.effectiveSegmentElements=new i,this.extraNodes=[],this.inputCreatedFunction=null,this.labelElements=new i,this.labelInputsEnabled=!1,this.maxLabelElement=null,this.messages=null,this.minLabelElement=null,this.rangeLabelInputsEnabled=!1,this.segmentElements=new i,this.snapOnClickEnabled=!0,this.steps=null,this.syncedSegmentsEnabled=!1,this.thumbCreatedFunction=null,this.thumbElements=new i,this.tickElements=new i,this.trackElement=null,this.viewModel=new d,this.visibleElements={...g},e?.suppressDeprecationWarning||n(s.getLogger(this),"Slider","arcgis-slider",{version:"5.0"}),this._onAnchorPointerDown=this._onAnchorPointerDown.bind(this),this._onAnchorPointerMove=this._onAnchorPointerMove.bind(this),this._onAnchorPointerUp=this._onAnchorPointerUp.bind(this),this._onLabelPointerDown=this._onLabelPointerDown.bind(this),this._onLabelPointerUp=this._onLabelPointerUp.bind(this),this._onSegmentPointerDown=this._onSegmentPointerDown.bind(this),this._onSegmentPointerMove=this._onSegmentPointerMove.bind(this),this._onSegmentPointerUp=this._onSegmentPointerUp.bind(this),this._onTrackPointerDown=this._onTrackPointerDown.bind(this),this._onTrackPointerMove=this._onTrackPointerMove.bind(this),this._onTrackPointerUp=this._onTrackPointerUp.bind(this)}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}destroy(){document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove),document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),this.labelElements.removeAll(),this.labelElements.destroy(),this.segmentElements.removeAll(),this.segmentElements.destroy(),this.effectiveSegmentElements.removeAll(),this.effectiveSegmentElements.destroy(),this.thumbElements.removeAll(),this.thumbElements.destroy(),this.tickElements.removeAll(),this.tickElements.destroy()}get _isDisabled(){return this.disabled||"disabled"===this.state}get effectiveMax(){return this.viewModel.effectiveMax}set effectiveMax(e){this.viewModel.effectiveMax=e}get effectiveMin(){return this.viewModel.effectiveMin}set effectiveMin(e){this.viewModel.effectiveMin=e}get inputFormatFunction(){return this.viewModel.inputFormatFunction}set inputFormatFunction(e){this.viewModel.inputFormatFunction=e}get inputParseFunction(){return this.viewModel.inputParseFunction}set inputParseFunction(e){this.viewModel.inputParseFunction=e}get icon(){return"caret-double-horizontal"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelFormatFunction(){return this.viewModel.labelFormatFunction}set labelFormatFunction(e){this.viewModel.labelFormatFunction=e}get labels(){return this.viewModel.labels}set layout(e){["vertical","vertical-reversed","horizontal","horizontal-reversed"].includes(e)||(e="horizontal"),this._set("layout",e)}get max(){return this.viewModel.max}set max(e){this.viewModel.max=e}get min(){return this.viewModel.min}set min(e){this.viewModel.min=e}get precision(){return this.viewModel.precision}set precision(e){this.viewModel.precision=e}get state(){const{_activeLabelInputIndex:e,_isMaxInputActive:t,_isMinInputActive:i,_dragStartInfo:n,_segmentDragStartInfo:s,disabled:o,viewModel:r}=this;return o?"disabled":!(null===e&&!t&&!i)?"editing":null!=n||null!=s?"dragging":r.state}get thumbsConstrained(){return this.viewModel.thumbsConstrained}set thumbsConstrained(e){this.viewModel.thumbsConstrained=e}set tickConfigs(e){this._set("tickConfigs",e),this.scheduleRender()}get values(){return this.viewModel.values}set values(e){this.viewModel.values=e}castVisibleElements(e){return{...g,...e}}render(){const{label:e}=this,t=this.classes(u.base,c.widget,this._isHorizontalLayout()?u.horizontalLayout:u.verticalLayout,this._isReversedLayout()?u.reversed:null,this._isDisabled?c.disabled:null);return this._storeTrackDimensions(),_("div",{afterCreate:this._afterContainerCreate,"aria-label":e,bind:this,class:t,"touch-action":"none"},this._renderContent())}toNextStep(e){this._toStep(e,1)}toPreviousStep(e){this._toStep(e,-1)}getCurrentPosition(){return this._positionFromValue(this.values?.[0]??0)}_renderContent(){const{max:e,min:t}=this;if(!(null==t||null==e||t>=e))return[this._renderMin(),this._renderSliderContainer(),this._renderMax()]}_renderSliderContainer(){return _("div",{bind:this,class:u.contentElement,key:"slider-container"},this._renderTrackElement(),this._renderTicksContainer(),this._renderExtraContentElements())}_renderTrackElement(){return _("div",{afterCreate:this._afterTrackCreate,afterRemoved:this._afterTrackRemoved,bind:this,class:u.trackElement,"touch-action":"none"},this._renderEffectiveSegmentElements(),this._renderSegmentElements(),this._renderAnchorElements())}_renderEffectiveSegmentElements(){if(!this.trackElement||!this.values?.length)return;const e=null!=this.effectiveMax,t=null!=this.effectiveMin;if(!e&&!t)return;const{max:i,min:n,viewModel:s}=this,o=s.getBounds(),r=[];return t&&r.push(this._renderEffectiveSegmentElement(n,o.min,!0)),e&&r.push(this._renderEffectiveSegmentElement(o.max,i,!1)),r}_renderSegmentElements(){if(!this.trackElement||!this.values?.length)return;const e=this.values.length,t=[];for(let i=0;i<=e;i++)t.push(this._renderSegmentElement(i));return t}_renderSegmentElement(e){const{_trackHeight:t,_trackWidth:i,draggableSegmentsEnabled:n,id:s,state:o}=this,r=this.values,a=this._isHorizontalLayout(),l=a?i:t,h=this.viewModel.getBounds(),d=this._positionFromValue(h.max),c=this._positionFromValue(h.min),m=e===r?.length?null:e,p=0===e?null:e-1,v=null!=m,g=null!=p;let f,b;const E=[...r].sort((e,t)=>e-t);this._isReversedLayout()?(f=g?this._positionFromValue(E[p]):c,b=v?this._positionFromValue(E[m]):d):(f=v?this._positionFromValue(E[m]):d,b=g?this._positionFromValue(E[p]):c);const x=this._applyPrecisionToPosition(100*b/l),y=(f-b)/l,P=a?`transform: translate(${x}%, 0px) scale(${y}, 1);`:`transform: translate(0px, ${x}%) scale(1, ${y});`,k=this.classes(u.segmentElement,u.segmentElementIndexPrefix+e,n&&v&&g&&"disabled"!==o?u.segmentElementInteractive:null);return _("div",{afterCreate:this._afterSegmentCreate,afterRemoved:this._afterSegmentRemoved,bind:this,class:k,"data-max-thumb-index":m,"data-min-thumb-index":p,"data-segment-index":e,key:`${s}-segment-${e}`,style:P,"touch-action":"none"})}_renderEffectiveSegmentElement(e,t,i){const{_trackHeight:n,_trackWidth:s,layout:o}=this,r=this._positionFromValue(e),a=this._positionFromValue(t),l=this._isHorizontalLayout(),h=l?s:n,d=this._applyPrecisionToPosition(100*r/h);let c=null;if("horizontal"===o){const e=i?h-a:a,t=r===h?0:d;c=`clip-path: inset(0% ${a===h?0:this._applyPrecisionToPosition(e/h*100)}% 0% ${t}%);`}else{const e=(a-r)/h;c=l?`transform: translate(${d}%, 0px) scale(${e}, 1);`:`transform: translate(0px, ${d}%) scale(1, ${e});`}const m=i?u.effectiveMinSegmentElement:u.effectiveMaxSegmentElement,p=this.classes(u.segmentElement,u.effectiveSegmentElement,m);return _("div",{afterCreate:this._afterEffectiveSegmentCreate,afterRemoved:this._afterEffectiveSegmentRemoved,bind:this,class:p,style:c,"touch-action":"none"})}_renderAnchorElements(){const{trackElement:e,values:t}=this;if(t?.length)return this._zIndices=t.map((e,i)=>{const n=this._positionFromValue(e),s=this._positionToPercent(n),o=(this._isHorizontalLayout()?s>50:s<50)?-1:1;return this._zIndexOffset+(t.length+o*i)}),e&&t&&t.length?t.map((e,t)=>this._renderAnchorElement(e,t)):null}_renderAnchorElement(e,i){const n=this._positionFromValue(e),s=this._valueFromPosition(n);if(null==s||isNaN(s))return;const{_dragStartInfo:o,_lastMovedHandleIndex:r,id:a,layout:l,visibleElements:{labels:h}}=this,d=this.values,c=o?.index===i,m=r===i,p=this.classes(u.anchorElement,u.anchorElementIndexPrefix+i,c?u.movingAnchorElement:null,m?u.lastMovedAnchorElement:null),v=this.labels.values[i],g=this._getStyleForAnchor(e,i,c||m),{min:f,max:b}=this.viewModel.getBoundsForValueAtIndex(i),{disabled:E,messages:x}=this,y=2===d.length?t(0===i?x.rangeMinimum:x.rangeMaximum,{value:e}):v,P=1===d.length?null:0===i?`${a}-handle-${i+1}`:i===d.length-1?`${a}-handle-${i-1}`:`${a}-handle-${i-1} ${a}-handle-${i+1}`;return _("div",{afterCreate:this._afterAnchorCreate,afterRemoved:this._afterAnchorRemoved,afterUpdate:this._afterAnchorUpdate,"aria-controls":P,"aria-label":x.sliderValue,"aria-labelledby":h?`${a}-label-${i}`:null,"aria-orientation":l,"aria-valuemax":b?.toString(),"aria-valuemin":f?.toString(),"aria-valuenow":e.toString(),"aria-valuetext":y,bind:this,class:p,"data-thumb-index":i,"data-value":e,id:`${a}-handle-${i}`,key:`${a}-handle-${i}`,onkeydown:this._onAnchorKeyDown,role:"slider",style:g,tabIndex:E?-1:0,"touch-action":"none"},_("span",{afterCreate:this._afterThumbCreate,afterRemoved:this._afterThumbRemoved,bind:this,class:u.thumbElement,"data-thumb-index":i,"touch-action":"none"}),this.renderThumbLabel(i))}renderThumbLabel(e){const{id:t,labels:i,labelInputsEnabled:n,state:s}=this,o=this.visibleElements.labels,r=i.values[e],a=this.classes(u.labelElement,o?null:c.hidden,n&&"disabled"!==s?u.labelElementInteractive:null);return _("span",{afterCreate:this._afterLabelCreate,afterRemoved:this._afterLabelRemoved,"aria-hidden":(!o).toString(),bind:this,class:a,"data-thumb-index":e,id:`${t}-label-${e}`,key:`${t}-label-${e}`,role:n?"button":void 0,"touch-action":"none"},this._activeLabelInputIndex===e?this._renderValueInput(e):r)}_renderValueInput(e){const{disabled:t,values:i}=this;if(null==i)return;const n=i[e];return _("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.sliderValue,bind:this,class:u.labelInput,"data-input-index":e,"data-input-type":"thumb",key:`value-input-${e}`,onblur:this._onLabelInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:t?-1:0,type:"text",value:this._formatInputValue(n,"value",e)})}_renderMax(){const{_isMaxInputActive:e,labels:t,rangeLabelInputsEnabled:i,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(u.maxElement,{[c.hidden]:!s,[u.maxElementInteractive]:i&&"disabled"!==n,[u.rangeElementActive]:e});return _("div",{afterCreate:this._afterMaxLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMaxLabelClick,onkeydown:this._onMaxLabelKeyDown,role:i?"button":void 0,tabIndex:!this.disabled&&i?0:-1},e?this._renderMaxInput():t.max)}_renderMin(){const{_isMinInputActive:e,labels:t,rangeLabelInputsEnabled:i,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(u.minElement,{[c.hidden]:!s,[u.minElementInteractive]:i&&"disabled"!==n,[u.rangeElementActive]:e});return _("div",{afterCreate:this._afterMinLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMinLabelClick,onkeydown:this._onMinLabelKeyDown,role:i?"button":void 0,tabIndex:!this.disabled&&i?0:-1},e?this._renderMinInput():t.min)}_renderMaxInput(){return _("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.maximumValue,bind:this,class:u.rangeInput,"data-input-type":"max",onblur:this._onMaxInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.max,"max")})}_renderMinInput(){return _("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.minimumValue,bind:this,class:u.rangeInput,"data-input-type":"min",onblur:this._onMinInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.min,"min")})}_renderExtraContentElements(){return _("div",{bind:this,class:u.extraContentElement},this.extraNodes)}_renderTicksContainer(){if(this.tickConfigs&&this.trackElement&&(0!==this._trackHeight||0!==this._trackWidth))return this.tickConfigs.map((e,t)=>_("div",{class:this.classes(u.ticksContainerElement),key:"ticks-container"},this._renderTicks(e,t)))}_renderTicks(e,t){const{mode:n,values:s}=e;if(this.tickElements.at(t)||this.tickElements.add(new i,t),"position"===n){const i=Array.isArray(s)?s:[s];return this._calculateTickPositions(i).map((i,n)=>this._renderTickGroup(e,n,t,i))}if("percent"===n&&Array.isArray(s)){const i=this.min??0,n=(this.max??0)-i,o=s.map(e=>this._applyPrecisionToPosition(e/100*n+i));return this._calculateTickPositions(o).map((i,n)=>this._renderTickGroup(e,n,t,i))}const o=Array.isArray(s)&&s.length?s[0]:isNaN(s)?null:s,r=this._getTickCounts(o,e);return this._calculateEquidistantTickPositions(r).map((i,n)=>this._renderTickGroup(e,n,t,i))}_renderTickGroup(e,t,i,n){const s="position"===e.mode?Array.isArray(e.values)?e.values[t]:e.values:this._valueFromPosition(n);if(null!=s&&!isNaN(s))return _("div",{afterCreate:this._afterTickGroupCreate,afterRemoved:this._afterTickGroupRemoved,bind:this,"data-config":e,"data-position":n,"data-tick-config-index":i,"data-tick-group-index":t,"data-value":s,key:`tick-group-${t}`,onclick:this._onTickGroupClick},this._renderTickLine(e,t,i,s),e.labelsVisible?this._renderTickLabel(e,t,i,s):null)}_renderTickLine(e,t,i,n){return _("div",{afterCreate:this._afterTickLineCreate,"aria-valuenow":n.toString(),bind:this,class:u.tickElement,"data-config":e,"data-tick-config-index":i,"data-tick-group-index":t,"data-value":n,key:`tick-label-${t}`,style:this._getPositionStyleForElement(n)})}_renderTickLabel(e,t,i,n){const s=e.labelFormatFunction?e.labelFormatFunction(n,"tick",t):this.viewModel.getLabelForValue(n,"tick",t);return _("div",{afterCreate:this._afterTickLabelCreate,"aria-label":s,"aria-valuenow":n.toString(),"aria-valuetext":s,bind:this,class:u.tickLabelElement,"data-config":e,"data-tick-config-index":i,"data-tick-group-index":t,"data-value":n,key:`tick-label-${t}`,style:`transform: translate(-50%); ${this._getPositionStyleForElement(n)}`},s)}_afterContainerCreate(e){this.addHandles(p(e,()=>this.scheduleRender()))}_afterTrackCreate(e){this._set("trackElement",e),e.addEventListener("pointerdown",this._onTrackPointerDown),this.scheduleRender()}_afterTrackRemoved(e){e.removeEventListener("pointerdown",this._onTrackPointerDown),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp)}_afterSegmentCreate(e){this.segmentElements.add(e),e.addEventListener("pointerdown",this._onSegmentPointerDown)}_afterSegmentRemoved(e){this.segmentElements.remove(e),e.removeEventListener("pointerdown",this._onSegmentPointerDown)}_afterEffectiveSegmentCreate(e){this.effectiveSegmentElements.add(e)}_afterEffectiveSegmentRemoved(e){this.effectiveSegmentElements.remove(e)}_afterAnchorCreate(e){if(this._anchorElements.push(e),e.addEventListener("pointerdown",this._onAnchorPointerDown),this.thumbCreatedFunction){const t=b(e),i=k(e),n=this.thumbElements.at(t),s=this.labelElements.at(t)||null;this.thumbCreatedFunction(t,i,n,s)}}_afterAnchorUpdate(e){if(null!=this._focusedAnchorIndex){b(e)===this._focusedAnchorIndex&&(e.focus(),this._focusedAnchorIndex=null)}}_afterAnchorRemoved(e){const t=this._anchorElements.indexOf(e,0);t>-1&&this._anchorElements.splice(t,1),e.removeEventListener("pointerdown",this._onAnchorPointerDown)}_afterThumbCreate(e){this.thumbElements.add(e)}_afterThumbRemoved(e){this.thumbElements.remove(e)}_afterLabelCreate(e){this.labelElements.add(e),e.addEventListener("pointerdown",this._onLabelPointerDown),e.addEventListener("pointerup",this._onLabelPointerUp)}_afterLabelRemoved(e){this.labelElements.remove(e),e.removeEventListener("pointerdown",this._onLabelPointerDown),e.removeEventListener("pointerup",this._onLabelPointerUp)}_afterInputCreate(e){if(e.focus(),e.select(),this.inputCreatedFunction){const t=e.getAttribute("data-input-type"),i="thumb"===t?E(e):null;this.inputCreatedFunction(e,t,i)}}_afterTickLineCreate(e){const t=I(e),i=A(e),n=this.tickElements.at(t),s=n.at(i);s?s.tickElement=e:n.add({groupElement:null,tickElement:e,labelElement:null},i)}_afterTickLabelCreate(e){const t=I(e),i=A(e),n=this.tickElements.at(t),s=n.at(i);s?s.labelElement=e:n.add({groupElement:null,labelElement:e,tickElement:null},i)}_afterTickGroupRemoved(e){const t=I(e),i=this.tickElements.items[t],n=i?.find(t=>t.groupElement===e);n&&i.remove(n)}_afterTickGroupCreate(e){const t=L(e);if(t?.tickCreatedFunction){const i=I(e),n=A(e),s=k(e),o=this.tickElements?.at(i)?.at(n);if(o){o.groupElement=e;const i=o.tickElement||null,n=o.labelElement||null;t.tickCreatedFunction(s,i,n)}}}_afterMaxLabelCreate(e){this._set("maxLabelElement",e)}_afterMinLabelCreate(e){this._set("minLabelElement",e)}_onAnchorKeyDown(e){if(this._isDisabled||"editing"===this.state)return;const{key:t,target:i}=e,n=this.values,s=b(i),o=this._anchorElements[s],r=n[s],a=[v.moveAnchorUp,v.moveAnchorDown,v.moveAnchorLeft,v.moveAnchorRight];if(t===v.showInput&&this.labelInputsEnabled)this._activeLabelInputIndex=s;else if(a.includes(t)){e.preventDefault();const{steps:i}=this,n=t===v.moveAnchorUp||t===v.moveAnchorRight?1:-1;if(null!=i)this._toStep(s,this._isReversedLayout()?-1*n:n);else{const{precision:e}=this,t=this._getPositionOfElement(o),i=this._valueFromPosition(t),r=this._isHorizontalLayout()?n:-1*n;let a;a=0===e?this._positionFromValue(i+r):1===e?this._positionFromValue(i+.1*r):t+r,this._toPosition(s,a)}const a=this.values[s];r!==a&&this._emitThumbChangeEvent({index:s,oldValue:r,value:a})}else if(t===v.moveAnchorToMax||t===v.moveAnchorToMin){e.preventDefault();const{min:i,max:n}=this._getAnchorBoundsInPixels(s),o=this._isPositionInverted()?t===v.moveAnchorToMax?i:n:t===v.moveAnchorToMin?i:n;this._toPosition(s,o);const a=this.values[s];r!==a&&this._emitThumbChangeEvent({index:s,oldValue:r,value:a})}}_onAnchorPointerDown(e){if(this._isDisabled)return;const{target:t,clientX:i,clientY:n}=e,s=b(t);null!=s&&(e.preventDefault(),this._anchorElements[s]&&this._anchorElements[s].focus(),this._storeTrackDimensions(),this._dragStartInfo={clientX:i,clientY:n,index:s,position:this._getPositionOfElement(this._anchorElements[s])},document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onAnchorPointerMove(e){if("editing"===this.state||!this._dragStartInfo)return;e.preventDefault();const{values:t,_anchorElements:i,_dragged:n,_dragStartInfo:s,_dragStartInfo:{index:o,position:r}}=this,{clientX:a,clientY:l}=e,h=n?"drag":"start",u=i[o],d=this._getPositionOfElement(u),c=this._applyPrecisionToPosition(this._isHorizontalLayout()?r+a-s.clientX:r+l-s.clientY);if(d===c)return;const m=t[o];this._dragged=!0,this._toPosition(o,c);const _=this.values[o];n?m!==_&&this._emitThumbDragEvent({index:o,state:h,value:_}):this._emitThumbDragEvent({index:o,state:h,value:m})}_onAnchorPointerUp(e){if(document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),!this._dragStartInfo)return;e.preventDefault();const{index:t}=this._dragStartInfo,i=this._dragged,n=this.values[t];this._dragged=!1,this._dragStartInfo=null,this._lastMovedHandleIndex=t,i?this._emitThumbDragEvent({index:t,state:"stop",value:n}):(this.scheduleRender(),"editing"!==this.state&&this._emitThumbClickEvent({index:t,value:n}))}_onTrackPointerDown(e){const{_dragStartInfo:t,snapOnClickEnabled:i,state:n,values:s}=this;if(this._isDisabled||"editing"===n||t)return;if(document.addEventListener("pointermove",this._onTrackPointerMove),document.addEventListener("pointerup",this._onTrackPointerUp),!i||!s?.length)return;const{steps:o}=this,{clientX:r,clientY:a}=e,l=this._getCursorPositionFromEvent(e),h=this._valueFromPosition(l),u=this._getIndexOfNearestValue(h),d=s[u],c=s.some((e,t)=>e===d&&t!==u)&&h>d?s.lastIndexOf(d):u;if(null==c)return;const m=s[c],_=null!=o?this._calculateNearestStepPosition(l):l;this._toPosition(c,_),this._dragged=!0,this._dragStartInfo={clientX:r,clientY:a,index:c,position:_},this._focusedAnchorIndex=c,this._emitThumbDragEvent({index:c,state:"start",value:m});const p=this.values[c];m!==p&&this._emitThumbDragEvent({index:c,state:"drag",value:p}),document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove)}_onTrackPointerMove(e){e.preventDefault(),this._dragged=!0}_onTrackPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp),this.snapOnClickEnabled||(this._dragged=!1),!this._dragged){const t=this._getCursorPositionFromEvent(e),i=this._valueFromPosition(t);this._emitTrackClickEvent({value:i})}}_onSegmentPointerDown(e){e.preventDefault();const t=e.target,i=x(t),n=y(t),s=P(t);if(this._isDisabled||null==n||null==s)return;e.stopPropagation(),this._storeTrackDimensions(),document.addEventListener("pointerup",this._onSegmentPointerUp);const o=this._getAnchorDetails(n),r=this._getAnchorDetails(s);this.syncedSegmentsEnabled?(this.segmentElements.forEach(e=>e.classList.add(u.segmentElementActive)),this._anchorElements.forEach(e=>e.classList.add(u.anchorElementActive))):(this.segmentElements.at(i).classList.add(u.segmentElementActive),this._anchorElements[o.index]?.classList.add(u.anchorElementActive),this._anchorElements[r.index]?.classList.add(u.anchorElementActive)),this._segmentDragStartInfo={cursorPosition:this._getCursorPositionFromEvent(e),index:i,details:this._normalizeSegmentDetails({min:o,max:r})},this.draggableSegmentsEnabled&&(document.addEventListener("pointermove",this._onSegmentPointerMove),this._emitSegmentDragEvent({index:i,state:"start",thumbIndices:[n,s]}))}_onSegmentPointerMove(e){if(!this._segmentDragStartInfo)return;e.preventDefault();const{_trackHeight:t,_trackWidth:i,_segmentDragStartInfo:{index:n,cursorPosition:s,details:{min:o,max:r}}}=this,{index:a,position:l,value:h}=o,{index:u,position:d,value:c}=r;this._dragged=!0;const m=this._getCursorPositionFromEvent(e);if(m===s)return;const _=this._positionToPercent(s),p=this._positionToPercent(m)-_,v=this._positionToPercent(l)+p,g=this._positionToPercent(d)+p,{min:f}=this._getAnchorBoundsAsPercents(a),{max:b}=this._getAnchorBoundsAsPercents(u);let E=!1,x=!1;if(v<f?E=!0:g>b&&(x=!0),E){const{min:e,max:t}=this.viewModel.getBoundsForValueAtIndex(a),i=this._isPositionInverted()?t:e,n=i,s=c+(i-h),o=s-this.values[u];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(o):this._updateAnchorValues([a,u],[n,s]))}if(x){const{min:e,max:t}=this.viewModel.getBoundsForValueAtIndex(u),i=this._isPositionInverted()?e:t,n=i,s=h+(i-c),o=s-this.values[a];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(o):this._updateAnchorValues([a,u],[s,n]))}const y=this._isHorizontalLayout()?i:t,P=g/100*y,k=v/100*y,I=this.values,A=[I[a],I[u]],L=this._getValueForAnchorAtPosition(a,k),M=this._getValueForAnchorAtPosition(u,P);this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(L-A[0]):this._updateAnchorValues([a,u],[L,M]);[this.values[a],this.values[u]].every((e,t)=>e===A[t])||this._emitSegmentDragEvent({index:n,state:"drag",thumbIndices:[a,u]})}_onSegmentPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointerup",this._onSegmentPointerUp),document.removeEventListener("pointermove",this._onSegmentPointerMove),!this._segmentDragStartInfo)return;const{_dragged:t}=this,i=this.min,n=this.max,s=this.values,{index:o,details:{min:{index:r},max:{index:a}}}=this._segmentDragStartInfo;if(this.segmentElements.forEach(e=>e.classList.remove(u.segmentElementActive)),this._anchorElements.forEach(e=>e.classList.remove(u.anchorElementActive)),this.draggableSegmentsEnabled){const e=n-i,t=s[r],l=s[a];this._lastMovedHandleIndex=t===l?t>e/2?r:a:null,this._dragged=!1,this._segmentDragStartInfo=null,this._emitSegmentDragEvent({index:o,state:"stop",thumbIndices:[r,a]})}if(!t){const t=this._getCursorPositionFromEvent(e),i=this._valueFromPosition(t);this._emitSegmentClickEvent({index:o,value:i,thumbIndices:[r,a]})}}_onTickGroupClick(e){const t=e.target;if(L(t)){const e=I(t),i=A(t),n=k(t);this._emitTickClickEvent({configIndex:e,groupIndex:i,value:n})}}_storeTrackDimensions(){if(this.trackElement){const e=this._getDimensions(this.trackElement);this._trackHeight=this._applyPrecisionToPosition(e.height),this._trackWidth=this._applyPrecisionToPosition(e.width)}}_onLabelPointerDown(){this._isDisabled||(this._dragged=!1,document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onLabelPointerMove(){this._isDisabled||(this._dragged=!0)}_onLabelPointerUp(e){if(this._isDisabled)return;const t=b(e.target);this.labelInputsEnabled&&!this._dragged&&null!=t&&(this._activeLabelInputIndex=t),this._dragged=!1,document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove)}_onLabelInputBlur(e){const{_activeLabelInputIndex:t,values:i,viewModel:n}=this,s=e.target.value;if(this._activeLabelInputIndex=null,!s||null==t||null==i)return;const o=this._parseInputValue(s,"value",t),r=i[t],{min:a,max:l}=this.viewModel.getBoundsForValueAtIndex(t);if(o<a||o>l)return;n.setValue(t,o);const h=this.values[t];r!==h&&this._emitThumbChangeEvent({index:t,oldValue:r,value:h})}_onInputKeyDown(e){if(this._isDisabled)return;const{key:t,target:i}=e,{hideInput1:n,hideInput2:s,hideInput3:o}=v,{_activeLabelInputIndex:r,_anchorElements:a}=this,l=i;if(t===n||t===s||t===o){e.stopPropagation();const t=r;l.blur(),null!=t?a[t].focus():l.parentElement?.focus()}}_onMaxLabelClick(){this._isDisabled||(this._emitMaxRangeLabelClickEvent({type:"max-click",value:this.max}),this.rangeLabelInputsEnabled&&(this._isMaxInputActive=!0))}_onMaxLabelKeyDown({key:e}){this._isDisabled||e!==v.showInput||(this._isMaxInputActive=!0)}_onMaxInputBlur(e){const t=e.target.value;if(this._isMaxInputActive=!1,!t)return;const i=this.max,n=this._parseInputValue(t,"max");n<=this.min||(this.viewModel.set("max",n),this.max!==i&&this._emitMaxChangeEvent({oldValue:i,value:this.max}))}_onMinLabelClick(){this._isDisabled||(this._emitMinRangeLabelClickEvent({type:"min-click",value:this.min}),this.rangeLabelInputsEnabled&&(this._isMinInputActive=!0))}_onMinLabelKeyDown({key:e}){this._isDisabled||e!==v.showInput||(this._isMinInputActive=!0)}_onMinInputBlur(e){const t=e.target.value;if(this._isMinInputActive=!1,!t)return;const i=this.min,n=this._parseInputValue(t,"min");n>=this.max||(this.viewModel.set("min",n),this.min!==i&&this._emitMinChangeEvent({oldValue:i,value:this.min}))}_positionFromValue(e){const{_trackHeight:t,_trackWidth:i}=this,n=this.min??0,s=this.max??0,o=s-n;if(0===o||null==e)return 0;const r=this._isHorizontalLayout();let a=r?this._applyPrecisionToPosition(i*(e-n)/o):this._applyPrecisionToPosition(t*(s-e)/o);return this._isReversedLayout()&&(a=r?i-a:t-a),a}_valueFromPosition(e){const{_trackHeight:t,_trackWidth:i,precision:n}=this,s=this.min??0,o=this.max??0,r=o-s;let a=this._isHorizontalLayout()?e*r/i+s:r*(1e3-e/t*1e3)/1e3+s;return this._isReversedLayout()&&(a=o+s-a),parseFloat(a.toFixed(n))}_positionToPercent(e){const{_trackHeight:t,_trackWidth:i}=this,n=100*e/(this._isHorizontalLayout()?i:t);return this._applyPrecisionToPosition(n)}_applyPrecisionToPosition(e){return parseFloat(e.toFixed(this._positionPrecision))}_isPositionInverted(){const{layout:e}=this;return"horizontal-reversed"===e||"vertical"===e}_isHorizontalLayout(){return this.layout.includes("horizontal")}_isReversedLayout(){return this.layout.includes("reversed")}_normalizeSegmentDetails(e){if(this._isPositionInverted()){const{min:t,max:i}=e;return{min:i,max:t}}return e}_parseInputValue(e,t,i){return this.inputParseFunction?this.inputParseFunction(e,t,i):this.viewModel.defaultInputParseFunction(e)}_formatInputValue(e,t,i){return this.inputFormatFunction?this.inputFormatFunction(e,t,i):this.viewModel.defaultInputFormatFunction(e)}_getAnchorDetails(e){const t=this.values,i=[...t].sort((e,t)=>e-t)[e],n=t.indexOf(i);return{index:n,position:this._getPositionOfElement(this._anchorElements[n]),value:i}}_updateAnchorStyle(e,t){const i=this._anchorElements[e];i&&(this._isHorizontalLayout()?i.style.left=`${t}`:i.style.top=`${t}`)}_getStyleForAnchor(e,t,i){const n=this._getPositionStyleForElement(e);if(1===this.values?.length)return`${n}`;const s=this._zIndices[t];return`${n}; z-index: ${i?this._zIndexOffset+s:s}`}_getPositionStyleForElement(e){const t=this._positionFromValue(e),i=this._positionToPercent(t);return`${this._isHorizontalLayout()?"left":"top"}: ${i}%`}_getPositionOfElement(e){const t=this._getDimensions(e.offsetParent),i=this._getDimensions(e);return this._isHorizontalLayout()?this._applyPrecisionToPosition(i.left-t.left):this._applyPrecisionToPosition(i.top-t.top)}_updateAnchorValues(e,t){e.forEach((e,i)=>this._toValue(e,t[i]))}_updateAnchorValuesByDifference(e){const{min:t,max:i,values:n}=this;n?.forEach((n,s)=>this._toValue(s,Math.max(Math.min(n+e,i),t)))}_toValue(e,t){if(null!=this.steps){t=this._getStepValues()[this._getIndexOfNearestStepValue(t)]}this._updateAnchorStyle(e,this._getPositionStyleForElement(t)),this.viewModel.setValue(e,t)}_toPosition(e,t){const i=null!=this.steps?this._getStepValueForAnchorAtPosition(e,t):this._getValueForAnchorAtPosition(e,t);this._updateAnchorStyle(e,this._getPositionStyleForElement(i)),this.viewModel.setValue(e,i)}_getValueForAnchorAtPosition(e,t){const{min:i,max:n}=this._getAnchorBoundsInPixels(e),{min:s,max:o}=this.viewModel.getBoundsForValueAtIndex(e);let r,a,l=null;return this._isPositionInverted()?(r=s,a=o):(r=o,a=s),l=t>n?r:t<i?a:this._valueFromPosition(t),l>o?l=o:l<s&&(l=s),l}_getStepValueForAnchorAtPosition(e,t){const i=this._getStepValues(),n=this._calculateNearestStepPosition(t),s=this._getValueForAnchorAtPosition(e,n);return i[this._getIndexOfNearestStepValue(s)]}_getAnchorBoundsAsPercents(e){const{min:t,max:i}=this._getAnchorBoundsInPixels(e);return{min:this._positionToPercent(t),max:this._positionToPercent(i)}}_getAnchorBoundsInPixels(e){const{_anchorElements:t,_trackHeight:i,_trackWidth:n,effectiveMax:s,effectiveMin:o,thumbsConstrained:r}=this,a=t[e-1],l=t[e+1],h=this._isHorizontalLayout()?n:i;let u,d;return this._isPositionInverted()?(u=null!=o?this._positionFromValue(o):h,d=null!=s?this._positionFromValue(s):0):(u=null!=s?this._positionFromValue(s):h,d=null!=o?this._positionFromValue(o):0),r?this._isPositionInverted()?{max:a?this._getPositionOfElement(a):u,min:l?this._getPositionOfElement(l):d}:{max:l?this._getPositionOfElement(l):u,min:a?this._getPositionOfElement(a):d}:{max:u,min:d}}_getIndexOfNearestValue(e){const t=this.values;return t.indexOf(t.reduce((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t))}_getCursorPositionFromEvent(e){const t=this._getDimensions(this.trackElement);return this._isHorizontalLayout()?this._applyPrecisionToPosition(e.clientX-t.left):this._applyPrecisionToPosition(e.clientY-t.top)}_getStepValues(){const{steps:e}=this;if(Array.isArray(e))return e;const{max:t,min:i}=this;if(null==i||null==t||null==e)return[];const n=Math.ceil((t-i)/e),s=[];for(let o=0;o<=n;o++){const n=i+e*o;s.push(n>t?t:n)}return s}_toStep(e,t){const i=this.values[e],n=this._getStepValues(),s=n.indexOf(i);let o=null;if(s>-1){let i=n[s+t];isNaN(i)&&(i=n[s]);const r=this._positionFromValue(i);o=this._getStepValueForAnchorAtPosition(e,r)}else{o=n[this._getIndexOfNearestStepValue(i)+t]}this.viewModel.setValue(e,o)}_getIndexOfNearestStepValue(e){const{steps:t}=this;if(null==t)return null;const i=this._getStepValues(),n=i.reduce((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t);return i.indexOf(n)}_calculateNearestStepPosition(e){const t=this._valueFromPosition(e),i=this._getIndexOfNearestStepValue(t),n=this._getStepValues();return this._positionFromValue(n[i])}_getTickCounts(e,t){const{mode:i}=t;return"count"===i||"position"===i?e||0:"percent"===i&&100/e||0}_calculateTickPositions(e){return e.map(e=>this._positionFromValue(e))}_calculateEquidistantTickPositions(e){const{_trackWidth:t,_trackHeight:i}=this,n=this._isHorizontalLayout()?t:i,s=n/(e-1),o=[];if(1===e)return[n/2];for(let r=0;r<e;r++){const e=r*s;e<=n&&o.push(e)}return o}_getDimensions(e){return o(e),e.getBoundingClientRect()}_emitTrackClickEvent(e){this.emit("track-click",{...e,type:"track-click"})}_emitTickClickEvent(e){this.emit("tick-click",{...e,type:"tick-click"})}_emitMaxChangeEvent(e){this.emit("max-change",{...e,type:"max-change"})}_emitMinChangeEvent(e){this.emit("min-change",{...e,type:"min-change"})}_emitThumbChangeEvent(e){this.emit("thumb-change",{...e,type:"thumb-change"})}_emitThumbClickEvent(e){this.emit("thumb-click",{...e,type:"thumb-click"})}_emitThumbDragEvent(e){this.emit("thumb-drag",{...e,type:"thumb-drag"})}_emitSegmentClickEvent(e){this.emit("segment-click",{...e,type:"segment-click"})}_emitSegmentDragEvent(e){this.emit("segment-drag",{...e,type:"segment-drag"})}_emitMinRangeLabelClickEvent(e){this.emit("min-click",e)}_emitMaxRangeLabelClickEvent(e){this.emit("max-click",e)}};function b(e){return e?.["data-thumb-index"]}function E(e){return e?.["data-input-index"]}function x(e){return e?.["data-segment-index"]}function y(e){return e?.["data-min-thumb-index"]}function P(e){return e?.["data-max-thumb-index"]}function k(e){return e?.["data-value"]}function I(e){return e?.["data-tick-config-index"]}function A(e){return e?.["data-tick-group-index"]}function L(e){return e?.["data-config"]}e([r()],f.prototype,"_activeLabelInputIndex",void 0),e([r()],f.prototype,"_dragStartInfo",void 0),e([r()],f.prototype,"_isMinInputActive",void 0),e([r()],f.prototype,"_isMaxInputActive",void 0),e([r()],f.prototype,"_segmentDragStartInfo",void 0),e([r({readOnly:!0})],f.prototype,"_isDisabled",null),e([r()],f.prototype,"disabled",void 0),e([r()],f.prototype,"draggableSegmentsEnabled",void 0),e([r()],f.prototype,"effectiveMax",null),e([r()],f.prototype,"effectiveMin",null),e([r({readOnly:!0})],f.prototype,"effectiveSegmentElements",void 0),e([r()],f.prototype,"extraNodes",void 0),e([r()],f.prototype,"inputCreatedFunction",void 0),e([r()],f.prototype,"inputFormatFunction",null),e([r()],f.prototype,"inputParseFunction",null),e([r()],f.prototype,"icon",null),e([r()],f.prototype,"label",null),e([r({readOnly:!0})],f.prototype,"labelElements",void 0),e([r()],f.prototype,"labelInputsEnabled",void 0),e([r()],f.prototype,"labelFormatFunction",null),e([r({readOnly:!0})],f.prototype,"labels",null),e([r({value:"horizontal"})],f.prototype,"layout",null),e([r()],f.prototype,"max",null),e([r({readOnly:!0})],f.prototype,"maxLabelElement",void 0),e([r(),m("esri/widgets/Slider/t9n/Slider")],f.prototype,"messages",void 0),e([r()],f.prototype,"min",null),e([r({readOnly:!0})],f.prototype,"minLabelElement",void 0),e([r()],f.prototype,"precision",null),e([r()],f.prototype,"rangeLabelInputsEnabled",void 0),e([r({readOnly:!0})],f.prototype,"segmentElements",void 0),e([r()],f.prototype,"snapOnClickEnabled",void 0),e([r({readOnly:!0})],f.prototype,"state",null),e([r()],f.prototype,"steps",void 0),e([r()],f.prototype,"syncedSegmentsEnabled",void 0),e([r()],f.prototype,"thumbsConstrained",null),e([r()],f.prototype,"thumbCreatedFunction",void 0),e([r({readOnly:!0})],f.prototype,"thumbElements",void 0),e([r()],f.prototype,"tickConfigs",null),e([r({readOnly:!0})],f.prototype,"tickElements",void 0),e([r({readOnly:!0})],f.prototype,"trackElement",void 0),e([r()],f.prototype,"values",null),e([r({type:d})],f.prototype,"viewModel",void 0),e([r()],f.prototype,"visibleElements",void 0),e([a("visibleElements")],f.prototype,"castVisibleElements",null),f=e([l("esri.widgets.Slider")],f);const M=f;export{M as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import i from"../core/Collection.js";import{deprecateWidget as n}from"../core/deprecate.js";import s from"../core/Logger.js";import{assertIsSome as o}from"../core/maybe.js";import{property as r,cast as a,subclass as l}from"../core/accessorSupport/decorators.js";import h from"./Widget.js";import{css as u}from"./Slider/css.js";import d from"./Slider/SliderViewModel.js";import{globalCss as c}from"./support/globalCss.js";import{messageBundle as m,tsx as _}from"./support/widget.js";import{onResize as p}from"./support/widgetUtils.js";const v={showInput:"Enter",hideInput1:"Enter",hideInput2:"Escape",hideInput3:"Tab",moveAnchorUp:"ArrowUp",moveAnchorDown:"ArrowDown",moveAnchorLeft:"ArrowLeft",moveAnchorRight:"ArrowRight",moveAnchorToMax:"End",moveAnchorToMin:"Home"},g={labels:!1,rangeLabels:!1};let f=class extends h{constructor(e,t){super(e,t),this._activeLabelInputIndex=null,this._anchorElements=[],this._dragged=!1,this._dragStartInfo=null,this._focusedAnchorIndex=null,this._isMinInputActive=!1,this._isMaxInputActive=!1,this._lastMovedHandleIndex=null,this._positionPrecision=5,this._segmentDragStartInfo=null,this._trackHeight=null,this._trackWidth=null,this._zIndices=[],this._zIndexOffset=3,this.disabled=!1,this.draggableSegmentsEnabled=!0,this.effectiveSegmentElements=new i,this.extraNodes=[],this.inputCreatedFunction=null,this.labelElements=new i,this.labelInputsEnabled=!1,this.maxLabelElement=null,this.messages=null,this.minLabelElement=null,this.rangeLabelInputsEnabled=!1,this.segmentElements=new i,this.snapOnClickEnabled=!0,this.steps=null,this.syncedSegmentsEnabled=!1,this.thumbCreatedFunction=null,this.thumbElements=new i,this.tickElements=new i,this.trackElement=null,this.viewModel=new d({suppressDeprecationWarning:!0}),this.visibleElements={...g},e?.suppressDeprecationWarning||n(s.getLogger(this),"Slider","arcgis-slider",{version:"5.0"}),this._onAnchorPointerDown=this._onAnchorPointerDown.bind(this),this._onAnchorPointerMove=this._onAnchorPointerMove.bind(this),this._onAnchorPointerUp=this._onAnchorPointerUp.bind(this),this._onLabelPointerDown=this._onLabelPointerDown.bind(this),this._onLabelPointerUp=this._onLabelPointerUp.bind(this),this._onSegmentPointerDown=this._onSegmentPointerDown.bind(this),this._onSegmentPointerMove=this._onSegmentPointerMove.bind(this),this._onSegmentPointerUp=this._onSegmentPointerUp.bind(this),this._onTrackPointerDown=this._onTrackPointerDown.bind(this),this._onTrackPointerMove=this._onTrackPointerMove.bind(this),this._onTrackPointerUp=this._onTrackPointerUp.bind(this)}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}destroy(){document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove),document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),this.labelElements.removeAll(),this.labelElements.destroy(),this.segmentElements.removeAll(),this.segmentElements.destroy(),this.effectiveSegmentElements.removeAll(),this.effectiveSegmentElements.destroy(),this.thumbElements.removeAll(),this.thumbElements.destroy(),this.tickElements.removeAll(),this.tickElements.destroy()}get _isDisabled(){return this.disabled||"disabled"===this.state}get effectiveMax(){return this.viewModel.effectiveMax}set effectiveMax(e){this.viewModel.effectiveMax=e}get effectiveMin(){return this.viewModel.effectiveMin}set effectiveMin(e){this.viewModel.effectiveMin=e}get inputFormatFunction(){return this.viewModel.inputFormatFunction}set inputFormatFunction(e){this.viewModel.inputFormatFunction=e}get inputParseFunction(){return this.viewModel.inputParseFunction}set inputParseFunction(e){this.viewModel.inputParseFunction=e}get icon(){return"caret-double-horizontal"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelFormatFunction(){return this.viewModel.labelFormatFunction}set labelFormatFunction(e){this.viewModel.labelFormatFunction=e}get labels(){return this.viewModel.labels}set layout(e){["vertical","vertical-reversed","horizontal","horizontal-reversed"].includes(e)||(e="horizontal"),this._set("layout",e)}get max(){return this.viewModel.max}set max(e){this.viewModel.max=e}get min(){return this.viewModel.min}set min(e){this.viewModel.min=e}get precision(){return this.viewModel.precision}set precision(e){this.viewModel.precision=e}get state(){const{_activeLabelInputIndex:e,_isMaxInputActive:t,_isMinInputActive:i,_dragStartInfo:n,_segmentDragStartInfo:s,disabled:o,viewModel:r}=this;return o?"disabled":!(null===e&&!t&&!i)?"editing":null!=n||null!=s?"dragging":r.state}get thumbsConstrained(){return this.viewModel.thumbsConstrained}set thumbsConstrained(e){this.viewModel.thumbsConstrained=e}set tickConfigs(e){this._set("tickConfigs",e),this.scheduleRender()}get values(){return this.viewModel.values}set values(e){this.viewModel.values=e}castVisibleElements(e){return{...g,...e}}render(){const{label:e}=this,t=this.classes(u.base,c.widget,this._isHorizontalLayout()?u.horizontalLayout:u.verticalLayout,this._isReversedLayout()?u.reversed:null,this._isDisabled?c.disabled:null);return this._storeTrackDimensions(),_("div",{afterCreate:this._afterContainerCreate,"aria-label":e,bind:this,class:t,"touch-action":"none"},this._renderContent())}toNextStep(e){this._toStep(e,1)}toPreviousStep(e){this._toStep(e,-1)}getCurrentPosition(){return this._positionFromValue(this.values?.[0]??0)}_renderContent(){const{max:e,min:t}=this;if(!(null==t||null==e||t>=e))return[this._renderMin(),this._renderSliderContainer(),this._renderMax()]}_renderSliderContainer(){return _("div",{bind:this,class:u.contentElement,key:"slider-container"},this._renderTrackElement(),this._renderTicksContainer(),this._renderExtraContentElements())}_renderTrackElement(){return _("div",{afterCreate:this._afterTrackCreate,afterRemoved:this._afterTrackRemoved,bind:this,class:u.trackElement,"touch-action":"none"},this._renderEffectiveSegmentElements(),this._renderSegmentElements(),this._renderAnchorElements())}_renderEffectiveSegmentElements(){if(!this.trackElement||!this.values?.length)return;const e=null!=this.effectiveMax,t=null!=this.effectiveMin;if(!e&&!t)return;const{max:i,min:n,viewModel:s}=this,o=s.getBounds(),r=[];return t&&r.push(this._renderEffectiveSegmentElement(n,o.min,!0)),e&&r.push(this._renderEffectiveSegmentElement(o.max,i,!1)),r}_renderSegmentElements(){if(!this.trackElement||!this.values?.length)return;const e=this.values.length,t=[];for(let i=0;i<=e;i++)t.push(this._renderSegmentElement(i));return t}_renderSegmentElement(e){const{_trackHeight:t,_trackWidth:i,draggableSegmentsEnabled:n,id:s,state:o}=this,r=this.values,a=this._isHorizontalLayout(),l=a?i:t,h=this.viewModel.getBounds(),d=this._positionFromValue(h.max),c=this._positionFromValue(h.min),m=e===r?.length?null:e,p=0===e?null:e-1,v=null!=m,g=null!=p;let f,b;const E=[...r].sort((e,t)=>e-t);this._isReversedLayout()?(f=g?this._positionFromValue(E[p]):c,b=v?this._positionFromValue(E[m]):d):(f=v?this._positionFromValue(E[m]):d,b=g?this._positionFromValue(E[p]):c);const x=this._applyPrecisionToPosition(100*b/l),y=(f-b)/l,P=a?`transform: translate(${x}%, 0px) scale(${y}, 1);`:`transform: translate(0px, ${x}%) scale(1, ${y});`,k=this.classes(u.segmentElement,u.segmentElementIndexPrefix+e,n&&v&&g&&"disabled"!==o?u.segmentElementInteractive:null);return _("div",{afterCreate:this._afterSegmentCreate,afterRemoved:this._afterSegmentRemoved,bind:this,class:k,"data-max-thumb-index":m,"data-min-thumb-index":p,"data-segment-index":e,key:`${s}-segment-${e}`,style:P,"touch-action":"none"})}_renderEffectiveSegmentElement(e,t,i){const{_trackHeight:n,_trackWidth:s,layout:o}=this,r=this._positionFromValue(e),a=this._positionFromValue(t),l=this._isHorizontalLayout(),h=l?s:n,d=this._applyPrecisionToPosition(100*r/h);let c=null;if("horizontal"===o){const e=i?h-a:a,t=r===h?0:d;c=`clip-path: inset(0% ${a===h?0:this._applyPrecisionToPosition(e/h*100)}% 0% ${t}%);`}else{const e=(a-r)/h;c=l?`transform: translate(${d}%, 0px) scale(${e}, 1);`:`transform: translate(0px, ${d}%) scale(1, ${e});`}const m=i?u.effectiveMinSegmentElement:u.effectiveMaxSegmentElement,p=this.classes(u.segmentElement,u.effectiveSegmentElement,m);return _("div",{afterCreate:this._afterEffectiveSegmentCreate,afterRemoved:this._afterEffectiveSegmentRemoved,bind:this,class:p,style:c,"touch-action":"none"})}_renderAnchorElements(){const{trackElement:e,values:t}=this;if(t?.length)return this._zIndices=t.map((e,i)=>{const n=this._positionFromValue(e),s=this._positionToPercent(n),o=(this._isHorizontalLayout()?s>50:s<50)?-1:1;return this._zIndexOffset+(t.length+o*i)}),e&&t&&t.length?t.map((e,t)=>this._renderAnchorElement(e,t)):null}_renderAnchorElement(e,i){const n=this._positionFromValue(e),s=this._valueFromPosition(n);if(null==s||isNaN(s))return;const{_dragStartInfo:o,_lastMovedHandleIndex:r,id:a,layout:l,visibleElements:{labels:h}}=this,d=this.values,c=o?.index===i,m=r===i,p=this.classes(u.anchorElement,u.anchorElementIndexPrefix+i,c?u.movingAnchorElement:null,m?u.lastMovedAnchorElement:null),v=this.labels.values[i],g=this._getStyleForAnchor(e,i,c||m),{min:f,max:b}=this.viewModel.getBoundsForValueAtIndex(i),{disabled:E,messages:x}=this,y=2===d.length?t(0===i?x.rangeMinimum:x.rangeMaximum,{value:e}):v,P=1===d.length?null:0===i?`${a}-handle-${i+1}`:i===d.length-1?`${a}-handle-${i-1}`:`${a}-handle-${i-1} ${a}-handle-${i+1}`;return _("div",{afterCreate:this._afterAnchorCreate,afterRemoved:this._afterAnchorRemoved,afterUpdate:this._afterAnchorUpdate,"aria-controls":P,"aria-label":x.sliderValue,"aria-labelledby":h?`${a}-label-${i}`:null,"aria-orientation":l,"aria-valuemax":b?.toString(),"aria-valuemin":f?.toString(),"aria-valuenow":e.toString(),"aria-valuetext":y,bind:this,class:p,"data-thumb-index":i,"data-value":e,id:`${a}-handle-${i}`,key:`${a}-handle-${i}`,onkeydown:this._onAnchorKeyDown,role:"slider",style:g,tabIndex:E?-1:0,"touch-action":"none"},_("span",{afterCreate:this._afterThumbCreate,afterRemoved:this._afterThumbRemoved,bind:this,class:u.thumbElement,"data-thumb-index":i,"touch-action":"none"}),this.renderThumbLabel(i))}renderThumbLabel(e){const{id:t,labels:i,labelInputsEnabled:n,state:s}=this,o=this.visibleElements.labels,r=i.values[e],a=this.classes(u.labelElement,o?null:c.hidden,n&&"disabled"!==s?u.labelElementInteractive:null);return _("span",{afterCreate:this._afterLabelCreate,afterRemoved:this._afterLabelRemoved,"aria-hidden":(!o).toString(),bind:this,class:a,"data-thumb-index":e,id:`${t}-label-${e}`,key:`${t}-label-${e}`,role:n?"button":void 0,"touch-action":"none"},this._activeLabelInputIndex===e?this._renderValueInput(e):r)}_renderValueInput(e){const{disabled:t,values:i}=this;if(null==i)return;const n=i[e];return _("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.sliderValue,bind:this,class:u.labelInput,"data-input-index":e,"data-input-type":"thumb",key:`value-input-${e}`,onblur:this._onLabelInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:t?-1:0,type:"text",value:this._formatInputValue(n,"value",e)})}_renderMax(){const{_isMaxInputActive:e,labels:t,rangeLabelInputsEnabled:i,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(u.maxElement,{[c.hidden]:!s,[u.maxElementInteractive]:i&&"disabled"!==n,[u.rangeElementActive]:e});return _("div",{afterCreate:this._afterMaxLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMaxLabelClick,onkeydown:this._onMaxLabelKeyDown,role:i?"button":void 0,tabIndex:!this.disabled&&i?0:-1},e?this._renderMaxInput():t.max)}_renderMin(){const{_isMinInputActive:e,labels:t,rangeLabelInputsEnabled:i,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(u.minElement,{[c.hidden]:!s,[u.minElementInteractive]:i&&"disabled"!==n,[u.rangeElementActive]:e});return _("div",{afterCreate:this._afterMinLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMinLabelClick,onkeydown:this._onMinLabelKeyDown,role:i?"button":void 0,tabIndex:!this.disabled&&i?0:-1},e?this._renderMinInput():t.min)}_renderMaxInput(){return _("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.maximumValue,bind:this,class:u.rangeInput,"data-input-type":"max",onblur:this._onMaxInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.max,"max")})}_renderMinInput(){return _("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.minimumValue,bind:this,class:u.rangeInput,"data-input-type":"min",onblur:this._onMinInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.min,"min")})}_renderExtraContentElements(){return _("div",{bind:this,class:u.extraContentElement},this.extraNodes)}_renderTicksContainer(){if(this.tickConfigs&&this.trackElement&&(0!==this._trackHeight||0!==this._trackWidth))return this.tickConfigs.map((e,t)=>_("div",{class:this.classes(u.ticksContainerElement),key:"ticks-container"},this._renderTicks(e,t)))}_renderTicks(e,t){const{mode:n,values:s}=e;if(this.tickElements.at(t)||this.tickElements.add(new i,t),"position"===n){const i=Array.isArray(s)?s:[s];return this._calculateTickPositions(i).map((i,n)=>this._renderTickGroup(e,n,t,i))}if("percent"===n&&Array.isArray(s)){const i=this.min??0,n=(this.max??0)-i,o=s.map(e=>this._applyPrecisionToPosition(e/100*n+i));return this._calculateTickPositions(o).map((i,n)=>this._renderTickGroup(e,n,t,i))}const o=Array.isArray(s)&&s.length?s[0]:isNaN(s)?null:s,r=this._getTickCounts(o,e);return this._calculateEquidistantTickPositions(r).map((i,n)=>this._renderTickGroup(e,n,t,i))}_renderTickGroup(e,t,i,n){const s="position"===e.mode?Array.isArray(e.values)?e.values[t]:e.values:this._valueFromPosition(n);if(null!=s&&!isNaN(s))return _("div",{afterCreate:this._afterTickGroupCreate,afterRemoved:this._afterTickGroupRemoved,bind:this,"data-config":e,"data-position":n,"data-tick-config-index":i,"data-tick-group-index":t,"data-value":s,key:`tick-group-${t}`,onclick:this._onTickGroupClick},this._renderTickLine(e,t,i,s),e.labelsVisible?this._renderTickLabel(e,t,i,s):null)}_renderTickLine(e,t,i,n){return _("div",{afterCreate:this._afterTickLineCreate,"aria-valuenow":n.toString(),bind:this,class:u.tickElement,"data-config":e,"data-tick-config-index":i,"data-tick-group-index":t,"data-value":n,key:`tick-label-${t}`,style:this._getPositionStyleForElement(n)})}_renderTickLabel(e,t,i,n){const s=e.labelFormatFunction?e.labelFormatFunction(n,"tick",t):this.viewModel.getLabelForValue(n,"tick",t);return _("div",{afterCreate:this._afterTickLabelCreate,"aria-label":s,"aria-valuenow":n.toString(),"aria-valuetext":s,bind:this,class:u.tickLabelElement,"data-config":e,"data-tick-config-index":i,"data-tick-group-index":t,"data-value":n,key:`tick-label-${t}`,style:`transform: translate(-50%); ${this._getPositionStyleForElement(n)}`},s)}_afterContainerCreate(e){this.addHandles(p(e,()=>this.scheduleRender()))}_afterTrackCreate(e){this._set("trackElement",e),e.addEventListener("pointerdown",this._onTrackPointerDown),this.scheduleRender()}_afterTrackRemoved(e){e.removeEventListener("pointerdown",this._onTrackPointerDown),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp)}_afterSegmentCreate(e){this.segmentElements.add(e),e.addEventListener("pointerdown",this._onSegmentPointerDown)}_afterSegmentRemoved(e){this.segmentElements.remove(e),e.removeEventListener("pointerdown",this._onSegmentPointerDown)}_afterEffectiveSegmentCreate(e){this.effectiveSegmentElements.add(e)}_afterEffectiveSegmentRemoved(e){this.effectiveSegmentElements.remove(e)}_afterAnchorCreate(e){if(this._anchorElements.push(e),e.addEventListener("pointerdown",this._onAnchorPointerDown),this.thumbCreatedFunction){const t=b(e),i=k(e),n=this.thumbElements.at(t),s=this.labelElements.at(t)||null;this.thumbCreatedFunction(t,i,n,s)}}_afterAnchorUpdate(e){if(null!=this._focusedAnchorIndex){b(e)===this._focusedAnchorIndex&&(e.focus(),this._focusedAnchorIndex=null)}}_afterAnchorRemoved(e){const t=this._anchorElements.indexOf(e,0);t>-1&&this._anchorElements.splice(t,1),e.removeEventListener("pointerdown",this._onAnchorPointerDown)}_afterThumbCreate(e){this.thumbElements.add(e)}_afterThumbRemoved(e){this.thumbElements.remove(e)}_afterLabelCreate(e){this.labelElements.add(e),e.addEventListener("pointerdown",this._onLabelPointerDown),e.addEventListener("pointerup",this._onLabelPointerUp)}_afterLabelRemoved(e){this.labelElements.remove(e),e.removeEventListener("pointerdown",this._onLabelPointerDown),e.removeEventListener("pointerup",this._onLabelPointerUp)}_afterInputCreate(e){if(e.focus(),e.select(),this.inputCreatedFunction){const t=e.getAttribute("data-input-type"),i="thumb"===t?E(e):null;this.inputCreatedFunction(e,t,i)}}_afterTickLineCreate(e){const t=I(e),i=A(e),n=this.tickElements.at(t),s=n.at(i);s?s.tickElement=e:n.add({groupElement:null,tickElement:e,labelElement:null},i)}_afterTickLabelCreate(e){const t=I(e),i=A(e),n=this.tickElements.at(t),s=n.at(i);s?s.labelElement=e:n.add({groupElement:null,labelElement:e,tickElement:null},i)}_afterTickGroupRemoved(e){const t=I(e),i=this.tickElements.items[t],n=i?.find(t=>t.groupElement===e);n&&i.remove(n)}_afterTickGroupCreate(e){const t=L(e);if(t?.tickCreatedFunction){const i=I(e),n=A(e),s=k(e),o=this.tickElements?.at(i)?.at(n);if(o){o.groupElement=e;const i=o.tickElement||null,n=o.labelElement||null;t.tickCreatedFunction(s,i,n)}}}_afterMaxLabelCreate(e){this._set("maxLabelElement",e)}_afterMinLabelCreate(e){this._set("minLabelElement",e)}_onAnchorKeyDown(e){if(this._isDisabled||"editing"===this.state)return;const{key:t,target:i}=e,n=this.values,s=b(i),o=this._anchorElements[s],r=n[s],a=[v.moveAnchorUp,v.moveAnchorDown,v.moveAnchorLeft,v.moveAnchorRight];if(t===v.showInput&&this.labelInputsEnabled)this._activeLabelInputIndex=s;else if(a.includes(t)){e.preventDefault();const{steps:i}=this,n=t===v.moveAnchorUp||t===v.moveAnchorRight?1:-1;if(null!=i)this._toStep(s,this._isReversedLayout()?-1*n:n);else{const{precision:e}=this,t=this._getPositionOfElement(o),i=this._valueFromPosition(t),r=this._isHorizontalLayout()?n:-1*n;let a;a=0===e?this._positionFromValue(i+r):1===e?this._positionFromValue(i+.1*r):t+r,this._toPosition(s,a)}const a=this.values[s];r!==a&&this._emitThumbChangeEvent({index:s,oldValue:r,value:a})}else if(t===v.moveAnchorToMax||t===v.moveAnchorToMin){e.preventDefault();const{min:i,max:n}=this._getAnchorBoundsInPixels(s),o=this._isPositionInverted()?t===v.moveAnchorToMax?i:n:t===v.moveAnchorToMin?i:n;this._toPosition(s,o);const a=this.values[s];r!==a&&this._emitThumbChangeEvent({index:s,oldValue:r,value:a})}}_onAnchorPointerDown(e){if(this._isDisabled)return;const{target:t,clientX:i,clientY:n}=e,s=b(t);null!=s&&(e.preventDefault(),this._anchorElements[s]&&this._anchorElements[s].focus(),this._storeTrackDimensions(),this._dragStartInfo={clientX:i,clientY:n,index:s,position:this._getPositionOfElement(this._anchorElements[s])},document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onAnchorPointerMove(e){if("editing"===this.state||!this._dragStartInfo)return;e.preventDefault();const{values:t,_anchorElements:i,_dragged:n,_dragStartInfo:s,_dragStartInfo:{index:o,position:r}}=this,{clientX:a,clientY:l}=e,h=n?"drag":"start",u=i[o],d=this._getPositionOfElement(u),c=this._applyPrecisionToPosition(this._isHorizontalLayout()?r+a-s.clientX:r+l-s.clientY);if(d===c)return;const m=t[o];this._dragged=!0,this._toPosition(o,c);const _=this.values[o];n?m!==_&&this._emitThumbDragEvent({index:o,state:h,value:_}):this._emitThumbDragEvent({index:o,state:h,value:m})}_onAnchorPointerUp(e){if(document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),!this._dragStartInfo)return;e.preventDefault();const{index:t}=this._dragStartInfo,i=this._dragged,n=this.values[t];this._dragged=!1,this._dragStartInfo=null,this._lastMovedHandleIndex=t,i?this._emitThumbDragEvent({index:t,state:"stop",value:n}):(this.scheduleRender(),"editing"!==this.state&&this._emitThumbClickEvent({index:t,value:n}))}_onTrackPointerDown(e){const{_dragStartInfo:t,snapOnClickEnabled:i,state:n,values:s}=this;if(this._isDisabled||"editing"===n||t)return;if(document.addEventListener("pointermove",this._onTrackPointerMove),document.addEventListener("pointerup",this._onTrackPointerUp),!i||!s?.length)return;const{steps:o}=this,{clientX:r,clientY:a}=e,l=this._getCursorPositionFromEvent(e),h=this._valueFromPosition(l),u=this._getIndexOfNearestValue(h),d=s[u],c=s.some((e,t)=>e===d&&t!==u)&&h>d?s.lastIndexOf(d):u;if(null==c)return;const m=s[c],_=null!=o?this._calculateNearestStepPosition(l):l;this._toPosition(c,_),this._dragged=!0,this._dragStartInfo={clientX:r,clientY:a,index:c,position:_},this._focusedAnchorIndex=c,this._emitThumbDragEvent({index:c,state:"start",value:m});const p=this.values[c];m!==p&&this._emitThumbDragEvent({index:c,state:"drag",value:p}),document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove)}_onTrackPointerMove(e){e.preventDefault(),this._dragged=!0}_onTrackPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp),this.snapOnClickEnabled||(this._dragged=!1),!this._dragged){const t=this._getCursorPositionFromEvent(e),i=this._valueFromPosition(t);this._emitTrackClickEvent({value:i})}}_onSegmentPointerDown(e){e.preventDefault();const t=e.target,i=x(t),n=y(t),s=P(t);if(this._isDisabled||null==n||null==s)return;e.stopPropagation(),this._storeTrackDimensions(),document.addEventListener("pointerup",this._onSegmentPointerUp);const o=this._getAnchorDetails(n),r=this._getAnchorDetails(s);this.syncedSegmentsEnabled?(this.segmentElements.forEach(e=>e.classList.add(u.segmentElementActive)),this._anchorElements.forEach(e=>e.classList.add(u.anchorElementActive))):(this.segmentElements.at(i).classList.add(u.segmentElementActive),this._anchorElements[o.index]?.classList.add(u.anchorElementActive),this._anchorElements[r.index]?.classList.add(u.anchorElementActive)),this._segmentDragStartInfo={cursorPosition:this._getCursorPositionFromEvent(e),index:i,details:this._normalizeSegmentDetails({min:o,max:r})},this.draggableSegmentsEnabled&&(document.addEventListener("pointermove",this._onSegmentPointerMove),this._emitSegmentDragEvent({index:i,state:"start",thumbIndices:[n,s]}))}_onSegmentPointerMove(e){if(!this._segmentDragStartInfo)return;e.preventDefault();const{_trackHeight:t,_trackWidth:i,_segmentDragStartInfo:{index:n,cursorPosition:s,details:{min:o,max:r}}}=this,{index:a,position:l,value:h}=o,{index:u,position:d,value:c}=r;this._dragged=!0;const m=this._getCursorPositionFromEvent(e);if(m===s)return;const _=this._positionToPercent(s),p=this._positionToPercent(m)-_,v=this._positionToPercent(l)+p,g=this._positionToPercent(d)+p,{min:f}=this._getAnchorBoundsAsPercents(a),{max:b}=this._getAnchorBoundsAsPercents(u);let E=!1,x=!1;if(v<f?E=!0:g>b&&(x=!0),E){const{min:e,max:t}=this.viewModel.getBoundsForValueAtIndex(a),i=this._isPositionInverted()?t:e,n=i,s=c+(i-h),o=s-this.values[u];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(o):this._updateAnchorValues([a,u],[n,s]))}if(x){const{min:e,max:t}=this.viewModel.getBoundsForValueAtIndex(u),i=this._isPositionInverted()?e:t,n=i,s=h+(i-c),o=s-this.values[a];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(o):this._updateAnchorValues([a,u],[s,n]))}const y=this._isHorizontalLayout()?i:t,P=g/100*y,k=v/100*y,I=this.values,A=[I[a],I[u]],L=this._getValueForAnchorAtPosition(a,k),M=this._getValueForAnchorAtPosition(u,P);this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(L-A[0]):this._updateAnchorValues([a,u],[L,M]);[this.values[a],this.values[u]].every((e,t)=>e===A[t])||this._emitSegmentDragEvent({index:n,state:"drag",thumbIndices:[a,u]})}_onSegmentPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointerup",this._onSegmentPointerUp),document.removeEventListener("pointermove",this._onSegmentPointerMove),!this._segmentDragStartInfo)return;const{_dragged:t}=this,i=this.min,n=this.max,s=this.values,{index:o,details:{min:{index:r},max:{index:a}}}=this._segmentDragStartInfo;if(this.segmentElements.forEach(e=>e.classList.remove(u.segmentElementActive)),this._anchorElements.forEach(e=>e.classList.remove(u.anchorElementActive)),this.draggableSegmentsEnabled){const e=n-i,t=s[r],l=s[a];this._lastMovedHandleIndex=t===l?t>e/2?r:a:null,this._dragged=!1,this._segmentDragStartInfo=null,this._emitSegmentDragEvent({index:o,state:"stop",thumbIndices:[r,a]})}if(!t){const t=this._getCursorPositionFromEvent(e),i=this._valueFromPosition(t);this._emitSegmentClickEvent({index:o,value:i,thumbIndices:[r,a]})}}_onTickGroupClick(e){const t=e.target;if(L(t)){const e=I(t),i=A(t),n=k(t);this._emitTickClickEvent({configIndex:e,groupIndex:i,value:n})}}_storeTrackDimensions(){if(this.trackElement){const e=this._getDimensions(this.trackElement);this._trackHeight=this._applyPrecisionToPosition(e.height),this._trackWidth=this._applyPrecisionToPosition(e.width)}}_onLabelPointerDown(){this._isDisabled||(this._dragged=!1,document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onLabelPointerMove(){this._isDisabled||(this._dragged=!0)}_onLabelPointerUp(e){if(this._isDisabled)return;const t=b(e.target);this.labelInputsEnabled&&!this._dragged&&null!=t&&(this._activeLabelInputIndex=t),this._dragged=!1,document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove)}_onLabelInputBlur(e){const{_activeLabelInputIndex:t,values:i,viewModel:n}=this,s=e.target.value;if(this._activeLabelInputIndex=null,!s||null==t||null==i)return;const o=this._parseInputValue(s,"value",t),r=i[t],{min:a,max:l}=this.viewModel.getBoundsForValueAtIndex(t);if(o<a||o>l)return;n.setValue(t,o);const h=this.values[t];r!==h&&this._emitThumbChangeEvent({index:t,oldValue:r,value:h})}_onInputKeyDown(e){if(this._isDisabled)return;const{key:t,target:i}=e,{hideInput1:n,hideInput2:s,hideInput3:o}=v,{_activeLabelInputIndex:r,_anchorElements:a}=this,l=i;if(t===n||t===s||t===o){e.stopPropagation();const t=r;l.blur(),null!=t?a[t].focus():l.parentElement?.focus()}}_onMaxLabelClick(){this._isDisabled||(this._emitMaxRangeLabelClickEvent({type:"max-click",value:this.max}),this.rangeLabelInputsEnabled&&(this._isMaxInputActive=!0))}_onMaxLabelKeyDown({key:e}){this._isDisabled||e!==v.showInput||(this._isMaxInputActive=!0)}_onMaxInputBlur(e){const t=e.target.value;if(this._isMaxInputActive=!1,!t)return;const i=this.max,n=this._parseInputValue(t,"max");n<=this.min||(this.viewModel.set("max",n),this.max!==i&&this._emitMaxChangeEvent({oldValue:i,value:this.max}))}_onMinLabelClick(){this._isDisabled||(this._emitMinRangeLabelClickEvent({type:"min-click",value:this.min}),this.rangeLabelInputsEnabled&&(this._isMinInputActive=!0))}_onMinLabelKeyDown({key:e}){this._isDisabled||e!==v.showInput||(this._isMinInputActive=!0)}_onMinInputBlur(e){const t=e.target.value;if(this._isMinInputActive=!1,!t)return;const i=this.min,n=this._parseInputValue(t,"min");n>=this.max||(this.viewModel.set("min",n),this.min!==i&&this._emitMinChangeEvent({oldValue:i,value:this.min}))}_positionFromValue(e){const{_trackHeight:t,_trackWidth:i}=this,n=this.min??0,s=this.max??0,o=s-n;if(0===o||null==e)return 0;const r=this._isHorizontalLayout();let a=r?this._applyPrecisionToPosition(i*(e-n)/o):this._applyPrecisionToPosition(t*(s-e)/o);return this._isReversedLayout()&&(a=r?i-a:t-a),a}_valueFromPosition(e){const{_trackHeight:t,_trackWidth:i,precision:n}=this,s=this.min??0,o=this.max??0,r=o-s;let a=this._isHorizontalLayout()?e*r/i+s:r*(1e3-e/t*1e3)/1e3+s;return this._isReversedLayout()&&(a=o+s-a),parseFloat(a.toFixed(n))}_positionToPercent(e){const{_trackHeight:t,_trackWidth:i}=this,n=100*e/(this._isHorizontalLayout()?i:t);return this._applyPrecisionToPosition(n)}_applyPrecisionToPosition(e){return parseFloat(e.toFixed(this._positionPrecision))}_isPositionInverted(){const{layout:e}=this;return"horizontal-reversed"===e||"vertical"===e}_isHorizontalLayout(){return this.layout.includes("horizontal")}_isReversedLayout(){return this.layout.includes("reversed")}_normalizeSegmentDetails(e){if(this._isPositionInverted()){const{min:t,max:i}=e;return{min:i,max:t}}return e}_parseInputValue(e,t,i){return this.inputParseFunction?this.inputParseFunction(e,t,i):this.viewModel.defaultInputParseFunction(e)}_formatInputValue(e,t,i){return this.inputFormatFunction?this.inputFormatFunction(e,t,i):this.viewModel.defaultInputFormatFunction(e)}_getAnchorDetails(e){const t=this.values,i=[...t].sort((e,t)=>e-t)[e],n=t.indexOf(i);return{index:n,position:this._getPositionOfElement(this._anchorElements[n]),value:i}}_updateAnchorStyle(e,t){const i=this._anchorElements[e];i&&(this._isHorizontalLayout()?i.style.left=`${t}`:i.style.top=`${t}`)}_getStyleForAnchor(e,t,i){const n=this._getPositionStyleForElement(e);if(1===this.values?.length)return`${n}`;const s=this._zIndices[t];return`${n}; z-index: ${i?this._zIndexOffset+s:s}`}_getPositionStyleForElement(e){const t=this._positionFromValue(e),i=this._positionToPercent(t);return`${this._isHorizontalLayout()?"left":"top"}: ${i}%`}_getPositionOfElement(e){const t=this._getDimensions(e.offsetParent),i=this._getDimensions(e);return this._isHorizontalLayout()?this._applyPrecisionToPosition(i.left-t.left):this._applyPrecisionToPosition(i.top-t.top)}_updateAnchorValues(e,t){e.forEach((e,i)=>this._toValue(e,t[i]))}_updateAnchorValuesByDifference(e){const{min:t,max:i,values:n}=this;n?.forEach((n,s)=>this._toValue(s,Math.max(Math.min(n+e,i),t)))}_toValue(e,t){if(null!=this.steps){t=this._getStepValues()[this._getIndexOfNearestStepValue(t)]}this._updateAnchorStyle(e,this._getPositionStyleForElement(t)),this.viewModel.setValue(e,t)}_toPosition(e,t){const i=null!=this.steps?this._getStepValueForAnchorAtPosition(e,t):this._getValueForAnchorAtPosition(e,t);this._updateAnchorStyle(e,this._getPositionStyleForElement(i)),this.viewModel.setValue(e,i)}_getValueForAnchorAtPosition(e,t){const{min:i,max:n}=this._getAnchorBoundsInPixels(e),{min:s,max:o}=this.viewModel.getBoundsForValueAtIndex(e);let r,a,l=null;return this._isPositionInverted()?(r=s,a=o):(r=o,a=s),l=t>n?r:t<i?a:this._valueFromPosition(t),l>o?l=o:l<s&&(l=s),l}_getStepValueForAnchorAtPosition(e,t){const i=this._getStepValues(),n=this._calculateNearestStepPosition(t),s=this._getValueForAnchorAtPosition(e,n);return i[this._getIndexOfNearestStepValue(s)]}_getAnchorBoundsAsPercents(e){const{min:t,max:i}=this._getAnchorBoundsInPixels(e);return{min:this._positionToPercent(t),max:this._positionToPercent(i)}}_getAnchorBoundsInPixels(e){const{_anchorElements:t,_trackHeight:i,_trackWidth:n,effectiveMax:s,effectiveMin:o,thumbsConstrained:r}=this,a=t[e-1],l=t[e+1],h=this._isHorizontalLayout()?n:i;let u,d;return this._isPositionInverted()?(u=null!=o?this._positionFromValue(o):h,d=null!=s?this._positionFromValue(s):0):(u=null!=s?this._positionFromValue(s):h,d=null!=o?this._positionFromValue(o):0),r?this._isPositionInverted()?{max:a?this._getPositionOfElement(a):u,min:l?this._getPositionOfElement(l):d}:{max:l?this._getPositionOfElement(l):u,min:a?this._getPositionOfElement(a):d}:{max:u,min:d}}_getIndexOfNearestValue(e){const t=this.values;return t.indexOf(t.reduce((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t))}_getCursorPositionFromEvent(e){const t=this._getDimensions(this.trackElement);return this._isHorizontalLayout()?this._applyPrecisionToPosition(e.clientX-t.left):this._applyPrecisionToPosition(e.clientY-t.top)}_getStepValues(){const{steps:e}=this;if(Array.isArray(e))return e;const{max:t,min:i}=this;if(null==i||null==t||null==e)return[];const n=Math.ceil((t-i)/e),s=[];for(let o=0;o<=n;o++){const n=i+e*o;s.push(n>t?t:n)}return s}_toStep(e,t){const i=this.values[e],n=this._getStepValues(),s=n.indexOf(i);let o=null;if(s>-1){let i=n[s+t];isNaN(i)&&(i=n[s]);const r=this._positionFromValue(i);o=this._getStepValueForAnchorAtPosition(e,r)}else{o=n[this._getIndexOfNearestStepValue(i)+t]}this.viewModel.setValue(e,o)}_getIndexOfNearestStepValue(e){const{steps:t}=this;if(null==t)return null;const i=this._getStepValues(),n=i.reduce((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t);return i.indexOf(n)}_calculateNearestStepPosition(e){const t=this._valueFromPosition(e),i=this._getIndexOfNearestStepValue(t),n=this._getStepValues();return this._positionFromValue(n[i])}_getTickCounts(e,t){const{mode:i}=t;return"count"===i||"position"===i?e||0:"percent"===i&&100/e||0}_calculateTickPositions(e){return e.map(e=>this._positionFromValue(e))}_calculateEquidistantTickPositions(e){const{_trackWidth:t,_trackHeight:i}=this,n=this._isHorizontalLayout()?t:i,s=n/(e-1),o=[];if(1===e)return[n/2];for(let r=0;r<e;r++){const e=r*s;e<=n&&o.push(e)}return o}_getDimensions(e){return o(e),e.getBoundingClientRect()}_emitTrackClickEvent(e){this.emit("track-click",{...e,type:"track-click"})}_emitTickClickEvent(e){this.emit("tick-click",{...e,type:"tick-click"})}_emitMaxChangeEvent(e){this.emit("max-change",{...e,type:"max-change"})}_emitMinChangeEvent(e){this.emit("min-change",{...e,type:"min-change"})}_emitThumbChangeEvent(e){this.emit("thumb-change",{...e,type:"thumb-change"})}_emitThumbClickEvent(e){this.emit("thumb-click",{...e,type:"thumb-click"})}_emitThumbDragEvent(e){this.emit("thumb-drag",{...e,type:"thumb-drag"})}_emitSegmentClickEvent(e){this.emit("segment-click",{...e,type:"segment-click"})}_emitSegmentDragEvent(e){this.emit("segment-drag",{...e,type:"segment-drag"})}_emitMinRangeLabelClickEvent(e){this.emit("min-click",e)}_emitMaxRangeLabelClickEvent(e){this.emit("max-click",e)}};function b(e){return e?.["data-thumb-index"]}function E(e){return e?.["data-input-index"]}function x(e){return e?.["data-segment-index"]}function y(e){return e?.["data-min-thumb-index"]}function P(e){return e?.["data-max-thumb-index"]}function k(e){return e?.["data-value"]}function I(e){return e?.["data-tick-config-index"]}function A(e){return e?.["data-tick-group-index"]}function L(e){return e?.["data-config"]}e([r()],f.prototype,"_activeLabelInputIndex",void 0),e([r()],f.prototype,"_dragStartInfo",void 0),e([r()],f.prototype,"_isMinInputActive",void 0),e([r()],f.prototype,"_isMaxInputActive",void 0),e([r()],f.prototype,"_segmentDragStartInfo",void 0),e([r({readOnly:!0})],f.prototype,"_isDisabled",null),e([r()],f.prototype,"disabled",void 0),e([r()],f.prototype,"draggableSegmentsEnabled",void 0),e([r()],f.prototype,"effectiveMax",null),e([r()],f.prototype,"effectiveMin",null),e([r({readOnly:!0})],f.prototype,"effectiveSegmentElements",void 0),e([r()],f.prototype,"extraNodes",void 0),e([r()],f.prototype,"inputCreatedFunction",void 0),e([r()],f.prototype,"inputFormatFunction",null),e([r()],f.prototype,"inputParseFunction",null),e([r()],f.prototype,"icon",null),e([r()],f.prototype,"label",null),e([r({readOnly:!0})],f.prototype,"labelElements",void 0),e([r()],f.prototype,"labelInputsEnabled",void 0),e([r()],f.prototype,"labelFormatFunction",null),e([r({readOnly:!0})],f.prototype,"labels",null),e([r({value:"horizontal"})],f.prototype,"layout",null),e([r()],f.prototype,"max",null),e([r({readOnly:!0})],f.prototype,"maxLabelElement",void 0),e([r(),m("esri/widgets/Slider/t9n/Slider")],f.prototype,"messages",void 0),e([r()],f.prototype,"min",null),e([r({readOnly:!0})],f.prototype,"minLabelElement",void 0),e([r()],f.prototype,"precision",null),e([r()],f.prototype,"rangeLabelInputsEnabled",void 0),e([r({readOnly:!0})],f.prototype,"segmentElements",void 0),e([r()],f.prototype,"snapOnClickEnabled",void 0),e([r({readOnly:!0})],f.prototype,"state",null),e([r()],f.prototype,"steps",void 0),e([r()],f.prototype,"syncedSegmentsEnabled",void 0),e([r()],f.prototype,"thumbsConstrained",null),e([r()],f.prototype,"thumbCreatedFunction",void 0),e([r({readOnly:!0})],f.prototype,"thumbElements",void 0),e([r()],f.prototype,"tickConfigs",null),e([r({readOnly:!0})],f.prototype,"tickElements",void 0),e([r({readOnly:!0})],f.prototype,"trackElement",void 0),e([r()],f.prototype,"values",null),e([r({type:d})],f.prototype,"viewModel",void 0),e([r()],f.prototype,"visibleElements",void 0),e([a("visibleElements")],f.prototype,"castVisibleElements",null),f=e([l("esri.widgets.Slider")],f);const M=f;export{M as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import s from"../SmartMappingPrimaryHandleSliderViewModel.js";let t=class extends s{constructor(o){super(o)}set stops(o){super.stops=o}getStopInfo(){const{min:o,max:r,stops:s}=this;return s?.length?s.map(s=>({color:s.color,offset:(r-s.value)/(r-o)})):[]}};t=o([r("esri.widgets.smartMapping.ColorSlider.ColorSliderViewModel")],t);const e=t;export{e as default};
2
+ import{__decorate as o}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import s from"../SmartMappingPrimaryHandleSliderViewModel.js";let e=class extends s{constructor(o){super({...o,suppressDeprecationWarning:!0})}set stops(o){super.stops=o}getStopInfo(){const{min:o,max:r,stops:s}=this;return s?.length?s.map(s=>({color:s.color,offset:(r-s.value)/(r-o)})):[]}};e=o([r("esri.widgets.smartMapping.ColorSlider.ColorSliderViewModel")],e);const t=e;export{t as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import t from"../../../Color.js";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import s from"../SmartMappingSliderViewModel.js";let e=class extends s{constructor(o){super(o)}set stops(o){super.stops=o}getStopInfo(o){const{min:r,max:s,stops:e}=this;if(!e?.length)return[];const i=this._getColorForStops(o)?.toRgb();return e.map(o=>({color:new t(i&&[...i,o.opacity]),offset:(s-o.value)/(s-r)}))}_getColorForStops(o){return o?o instanceof t?o:t.fromString(o):null}};e=o([r("esri.widgets.smartMapping.OpacitySlider.OpacitySliderViewModel")],e);const i=e;export{i as default};
2
+ import{__decorate as o}from"tslib";import t from"../../../Color.js";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import s from"../SmartMappingSliderViewModel.js";let e=class extends s{constructor(o){super({...o,suppressDeprecationWarning:!0})}set stops(o){super.stops=o}getStopInfo(o){const{min:r,max:s,stops:e}=this;if(!e?.length)return[];const p=this._getColorForStops(o)?.toRgb();return e.map(o=>({color:new t(p&&[...p,o.opacity]),offset:(s-o.value)/(s-r)}))}_getColorForStops(o){return o?o instanceof t?o:t.fromString(o):null}};e=o([r("esri.widgets.smartMapping.OpacitySlider.OpacitySliderViewModel")],e);const p=e;export{p as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import a from"../SmartMappingPrimaryHandleSliderViewModel.js";let r=class extends a{constructor(e){super(e),this.persistSizeRangeEnabled=!1}set stops(e){super.stops=e}updateStops(e){const{primaryHandleEnabled:t,persistSizeRangeEnabled:s,stops:a}=this,r=this.getValuesFromStops();if(!r?.length)return;if(e.sort((e,t)=>e.value>t.value?1:-1).forEach(e=>{r[e.index]=e.value}),a.forEach((e,t)=>e.value=r[t]),t&&s){const{stops:e}=this,t=this.getValuesFromStops(),s=e.map(e=>e.size),a=Math.max(...s),r=Math.min(...s),i=Math.max(...t),o=Math.min(...t),p=e[5===e.length?2:1].value,l=Math.abs(i-p),n=Math.abs(o-p),d=l>n?l:n,h=a-r;if(0===d)return;e.forEach(e=>{e.size=Math.abs(e.value-p)/d*h+r})}}};e([t()],r.prototype,"persistSizeRangeEnabled",void 0),r=e([s("esri.widgets.smartMapping.SizeSlider.SizeSliderViewModel")],r);const i=r;export{i as default};
2
+ import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../core/accessorSupport/decorators.js";import a from"../SmartMappingPrimaryHandleSliderViewModel.js";let r=class extends a{constructor(e){super({...e,suppressDeprecationWarning:!0}),this.persistSizeRangeEnabled=!1}set stops(e){super.stops=e}updateStops(e){const{primaryHandleEnabled:s,persistSizeRangeEnabled:t,stops:a}=this,r=this.getValuesFromStops();if(!r?.length)return;if(e.sort((e,s)=>e.value>s.value?1:-1).forEach(e=>{r[e.index]=e.value}),a.forEach((e,s)=>e.value=r[s]),s&&t){const{stops:e}=this,s=this.getValuesFromStops(),t=e.map(e=>e.size),a=Math.max(...t),r=Math.min(...t),i=Math.max(...s),o=Math.min(...s),p=e[5===e.length?2:1].value,n=Math.abs(i-p),l=Math.abs(o-p),d=n>l?n:l,h=a-r;if(0===d)return;e.forEach(e=>{e.size=Math.abs(e.value-p)/d*h+r})}}};e([s()],r.prototype,"persistSizeRangeEnabled",void 0),r=e([t("esri.widgets.smartMapping.SizeSlider.SizeSliderViewModel")],r);const i=r;export{i as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as s,subclass as i}from"../../core/accessorSupport/decorators.js";import e from"../Slider/SliderViewModel.js";import{formatDateLabel as n,formatNumberLabel as o,getStopChanges as a}from"./support/utils.js";let l=class extends e{constructor(t){super(t),this._initialStopValues=[],this._max=null,this._min=null,this.hasTimeData=!1,this.inputFormatFunction=(t,s)=>"max"===s?this.getUnzoomedMax().toString():"min"===s?this.getUnzoomedMin().toString():t.toString(),this.inputParseFunction=null,this.labelFormatFunction=t=>{if(this.hasTimeData)return n(t);const{max:s,min:i,precision:e}=this,a=s-i>10?2:e;return o(parseFloat(t.toFixed(a)))},this.thumbsConstrained=!1,this.zoomingEnabled=!0}set breaks(t){this._set("breaks",t),this.notifyChange("max"),this.notifyChange("min")}set stops(t){if(t?.length){const{max:s,min:i}=this,e=this.getValuesFromStops(t),n={};null!=i&&e.some(t=>t<i)&&(n.min=Math.min(...e)),null!=s&&e.some(t=>t>s)&&(n.max=Math.max(...e)),this.set({...n}),this._initialStopValues=e}else this._initialStopValues=null;this._set("stops",t||null),this.notifyChange("values")}get labels(){const{values:t}=this,s=t&&t.length?t.map((t,s)=>this.getLabelForValue(t,"value",s)):[],i=this.getUnzoomedMax(),e=this.getUnzoomedMin();return{max:this.getLabelForValue(i,"max"),min:this.getLabelForValue(e,"min"),values:s}}get max(){const{breaks:t}=this;return t?.length?t[t.length-1].max:this._get("max")}set max(t){const{zoomOptions:s}=this;if(null!=s?.max){const i=this.values;let e=s.max;if(t<e&&(e=t,s.max=t),i&&i.length)for(let s=0;s<i.length;s++)t<i[s]&&this.setValue(s,t);this._storeZoomMax(e,t)}else this.updateBreakMax(t),this.setMax(t);this.notifyChange("labels")}get min(){const{breaks:t}=this;return t?.length?t[0].min:this._get("min")}set min(t){const{zoomOptions:s}=this;if(null!=s?.min){const i=this.values;let e=s.min;if(t>e&&(e=t,s.min=t),i&&i.length)for(let s=0;s<i.length;s++)t>i[s]&&this.setValue(s,t);this._storeZoomMin(e,t)}else this.updateBreakMin(t),this.setMin(t);this.notifyChange("labels")}get state(){const{max:t,min:s,values:i}=this;return null!=t&&null!=s&&i.length>0?"ready":"disabled"}get values(){const{breaks:t,stops:s}=this;if(!t&&!s)return[];if(t?.length){const s=t.map(t=>t.max);return s.pop(),s}if(s?.length<2)return[];const i=this.getValuesFromStops();return[i[0],i[i.length-1]]}set zoomOptions(t){const{zoomingEnabled:s,zoomOptions:i}=this;if(s){if(i){const s=null!=this._max?this._max:this.max,i=null!=this._min?this._min:this.min;if(t){const{max:e,min:n}=t,o=null!=e,a=null!=n,l=a?t.min:i,h=a?i:null,r=o?t.max:s,m=o?s:null;this._storeZoomMin(l,h),this._storeZoomMax(r,m)}else this.setMax(s),this.setMin(i),this._min=null,this._max=null}else if(t){const{max:s,min:i}=t;null!=i&&this._storeZoomMin(t.min,this.min),null!=s&&this._storeZoomMax(t.max,this.max)}this._set("zoomOptions",t),this.notifyChange("max"),this.notifyChange("min")}}getStopIndexFromValueIndex(t){const{stops:s}=this,i=this.values[t];if(0===t){return i<=this.values[1]?0:s.length-1}if(1===t){return this.values[0]>=i?0:s.length-1}return null}getStopChanges(t,s){const i=this.stops,e=this.getStopIndexFromValueIndex(t),n=this.getValuesFromStops();n[e]=s;const[o,a]=[n[0],n[n.length-1]].sort((t,s)=>t>s?1:-1),l=a-o,h=i.length-1;return n.map((t,s)=>({index:s,value:this.toPrecision(o+s*l/h)}))}setValue(t,s){const{max:i,min:e,values:n}=this,o=n[t];if(isNaN(s)||o===s||s>i||s<e)return;n[t]=this.toPrecision(s),this._set("values",[...n]);const l=n.slice().sort((t,s)=>t>s?1:-1),h=l[0],r=l[l.length-1],m=a(h,r,this._initialStopValues??[]);this.updateStops(m),this.updateBreaks(),this.notifyChange("labels")}getValuesFromStops(t){const s=t||this.stops;return s?.map(t=>t.hasOwnProperty("ratio")?t.ratio:t.value)}updateBreaks(){const{breaks:t,values:s}=this;t?.length&&s.slice().sort((t,s)=>t>s?1:-1).forEach((s,i)=>{t[i].max=s,null!=t[i+1]&&(t[i+1].min=s)})}updateBreakMax(t){const{breaks:s,max:i,min:e}=this;!isNaN(t)&&i!==t&&null!=e&&t>e&&s?.length&&(s[s.length-1].max=t)}updateBreakMin(t){const{breaks:s,max:i,min:e}=this;!isNaN(t)&&e!==t&&null!=i&&t<i&&s?.length&&(s[0].min=t)}updateStops(t){const{stops:s}=this,i=this.getValuesFromStops();if(i?.length){for(const s of t)i[s.index]=s.value;s.forEach((t,s)=>{t.hasOwnProperty("ratio")?t.ratio=i[s]:t.value=i[s]})}}getUnzoomedMax(){return this.zoomOptions&&null!=this._max?this._max:this.max}getUnzoomedMin(){return this.zoomOptions&&null!=this._min?this._min:this.min}_storeZoomMax(t,s){this._max=s,this.setMax(t)}_storeZoomMin(t,s){this._min=s,this.setMin(t)}};t([s()],l.prototype,"breaks",null),t([s()],l.prototype,"stops",null),t([s()],l.prototype,"hasTimeData",void 0),t([s()],l.prototype,"inputFormatFunction",void 0),t([s()],l.prototype,"inputParseFunction",void 0),t([s()],l.prototype,"labelFormatFunction",void 0),t([s({readOnly:!0})],l.prototype,"labels",null),t([s()],l.prototype,"max",null),t([s()],l.prototype,"min",null),t([s({readOnly:!0})],l.prototype,"state",null),t([s()],l.prototype,"thumbsConstrained",void 0),t([s({readOnly:!0})],l.prototype,"values",null),t([s()],l.prototype,"zoomingEnabled",void 0),t([s()],l.prototype,"zoomOptions",null),l=t([i("esri.widgets.smartMapping.SmartMappingSliderViewModel")],l);const h=l;export{h as default};
2
+ import{__decorate as t}from"tslib";import{property as s,subclass as i}from"../../core/accessorSupport/decorators.js";import e from"../Slider/SliderViewModel.js";import{formatDateLabel as n,formatNumberLabel as o,getStopChanges as a}from"./support/utils.js";let l=class extends e{constructor(t){super({...t,suppressDeprecationWarning:!0}),this._initialStopValues=[],this._max=null,this._min=null,this.hasTimeData=!1,this.inputFormatFunction=(t,s)=>"max"===s?this.getUnzoomedMax().toString():"min"===s?this.getUnzoomedMin().toString():t.toString(),this.inputParseFunction=null,this.labelFormatFunction=t=>{if(this.hasTimeData)return n(t);const{max:s,min:i,precision:e}=this,a=s-i>10?2:e;return o(parseFloat(t.toFixed(a)))},this.thumbsConstrained=!1,this.zoomingEnabled=!0}set breaks(t){this._set("breaks",t),this.notifyChange("max"),this.notifyChange("min")}set stops(t){if(t?.length){const{max:s,min:i}=this,e=this.getValuesFromStops(t),n={};null!=i&&e.some(t=>t<i)&&(n.min=Math.min(...e)),null!=s&&e.some(t=>t>s)&&(n.max=Math.max(...e)),this.set({...n}),this._initialStopValues=e}else this._initialStopValues=null;this._set("stops",t||null),this.notifyChange("values")}get labels(){const{values:t}=this,s=t&&t.length?t.map((t,s)=>this.getLabelForValue(t,"value",s)):[],i=this.getUnzoomedMax(),e=this.getUnzoomedMin();return{max:this.getLabelForValue(i,"max"),min:this.getLabelForValue(e,"min"),values:s}}get max(){const{breaks:t}=this;return t?.length?t[t.length-1].max:this._get("max")}set max(t){const{zoomOptions:s}=this;if(null!=s?.max){const i=this.values;let e=s.max;if(t<e&&(e=t,s.max=t),i&&i.length)for(let s=0;s<i.length;s++)t<i[s]&&this.setValue(s,t);this._storeZoomMax(e,t)}else this.updateBreakMax(t),this.setMax(t);this.notifyChange("labels")}get min(){const{breaks:t}=this;return t?.length?t[0].min:this._get("min")}set min(t){const{zoomOptions:s}=this;if(null!=s?.min){const i=this.values;let e=s.min;if(t>e&&(e=t,s.min=t),i&&i.length)for(let s=0;s<i.length;s++)t>i[s]&&this.setValue(s,t);this._storeZoomMin(e,t)}else this.updateBreakMin(t),this.setMin(t);this.notifyChange("labels")}get state(){const{max:t,min:s,values:i}=this;return null!=t&&null!=s&&i.length>0?"ready":"disabled"}get values(){const{breaks:t,stops:s}=this;if(!t&&!s)return[];if(t?.length){const s=t.map(t=>t.max);return s.pop(),s}if(s?.length<2)return[];const i=this.getValuesFromStops();return[i[0],i[i.length-1]]}set zoomOptions(t){const{zoomingEnabled:s,zoomOptions:i}=this;if(s){if(i){const s=null!=this._max?this._max:this.max,i=null!=this._min?this._min:this.min;if(t){const{max:e,min:n}=t,o=null!=e,a=null!=n,l=a?t.min:i,h=a?i:null,r=o?t.max:s,m=o?s:null;this._storeZoomMin(l,h),this._storeZoomMax(r,m)}else this.setMax(s),this.setMin(i),this._min=null,this._max=null}else if(t){const{max:s,min:i}=t;null!=i&&this._storeZoomMin(t.min,this.min),null!=s&&this._storeZoomMax(t.max,this.max)}this._set("zoomOptions",t),this.notifyChange("max"),this.notifyChange("min")}}getStopIndexFromValueIndex(t){const{stops:s}=this,i=this.values[t];if(0===t){return i<=this.values[1]?0:s.length-1}if(1===t){return this.values[0]>=i?0:s.length-1}return null}getStopChanges(t,s){const i=this.stops,e=this.getStopIndexFromValueIndex(t),n=this.getValuesFromStops();n[e]=s;const[o,a]=[n[0],n[n.length-1]].sort((t,s)=>t>s?1:-1),l=a-o,h=i.length-1;return n.map((t,s)=>({index:s,value:this.toPrecision(o+s*l/h)}))}setValue(t,s){const{max:i,min:e,values:n}=this,o=n[t];if(isNaN(s)||o===s||s>i||s<e)return;n[t]=this.toPrecision(s),this._set("values",[...n]);const l=n.slice().sort((t,s)=>t>s?1:-1),h=l[0],r=l[l.length-1],m=a(h,r,this._initialStopValues??[]);this.updateStops(m),this.updateBreaks(),this.notifyChange("labels")}getValuesFromStops(t){const s=t||this.stops;return s?.map(t=>t.hasOwnProperty("ratio")?t.ratio:t.value)}updateBreaks(){const{breaks:t,values:s}=this;t?.length&&s.slice().sort((t,s)=>t>s?1:-1).forEach((s,i)=>{t[i].max=s,null!=t[i+1]&&(t[i+1].min=s)})}updateBreakMax(t){const{breaks:s,max:i,min:e}=this;!isNaN(t)&&i!==t&&null!=e&&t>e&&s?.length&&(s[s.length-1].max=t)}updateBreakMin(t){const{breaks:s,max:i,min:e}=this;!isNaN(t)&&e!==t&&null!=i&&t<i&&s?.length&&(s[0].min=t)}updateStops(t){const{stops:s}=this,i=this.getValuesFromStops();if(i?.length){for(const s of t)i[s.index]=s.value;s.forEach((t,s)=>{t.hasOwnProperty("ratio")?t.ratio=i[s]:t.value=i[s]})}}getUnzoomedMax(){return this.zoomOptions&&null!=this._max?this._max:this.max}getUnzoomedMin(){return this.zoomOptions&&null!=this._min?this._min:this.min}_storeZoomMax(t,s){this._max=s,this.setMax(t)}_storeZoomMin(t,s){this._min=s,this.setMin(t)}};t([s()],l.prototype,"breaks",null),t([s()],l.prototype,"stops",null),t([s()],l.prototype,"hasTimeData",void 0),t([s()],l.prototype,"inputFormatFunction",void 0),t([s()],l.prototype,"inputParseFunction",void 0),t([s()],l.prototype,"labelFormatFunction",void 0),t([s({readOnly:!0})],l.prototype,"labels",null),t([s()],l.prototype,"max",null),t([s()],l.prototype,"min",null),t([s({readOnly:!0})],l.prototype,"state",null),t([s()],l.prototype,"thumbsConstrained",void 0),t([s({readOnly:!0})],l.prototype,"values",null),t([s()],l.prototype,"zoomingEnabled",void 0),t([s()],l.prototype,"zoomOptions",null),l=t([i("esri.widgets.smartMapping.SmartMappingSliderViewModel")],l);const h=l;export{h as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../core/accessorSupport/decorators.js";import s from"../Widget.js";import{SettingsManager as i}from"../Sketch/support/SettingsManager.js";import{loadCalciteComponents as n}from"./componentsUtils.js";import{globalCss as l}from"./globalCss.js";import{loadLabeledSwitchComponents as r,LabeledSwitch as a}from"./LabeledSwitch.js";import{messageBundle as c,tsx as d}from"./widget.js";const p="esri-plugin-settings-controls",g={base:p,block:`${p}__block`,blockContent:`${p}__block-content`,controlRow:`${p}__control-row`};let b=class extends s{constructor(e,t){super(e,t),this._blockExpanded=!1,this.viewModel=null}loadDependencies(){return Promise.all([n({block:()=>import("@esri/calcite-components/dist/components/calcite-block")}),r()])}render(){const e=this.settingsManager.settings,t=this._resolveMessage("settings.toolOptionsHeading");return d("div",{"aria-label":t,class:this.classes(g.base,l.widget)},e.length?d("calcite-block",{class:g.block,collapsible:!0,expanded:this._blockExpanded,heading:t,label:t,onCalciteBlockClose:()=>this._blockExpanded=!1,onCalciteBlockOpen:()=>this._blockExpanded=!0},d("div",{class:g.blockContent},e.map(e=>this._renderSetting(e)))):void 0)}_renderSetting(e){const{definition:t,settingKey:o,value:s}=e;return d("div",{class:g.controlRow,key:String(o)},d(a,{checked:s,hint:t.descriptionLocalizationKey?this._resolveMessage(t.descriptionLocalizationKey):void 0,key:`${String(o)}-toggle`,label:this._resolveMessage(t.titleLocalizationKey),topLayerDisabled:this.topLayerDisabled,onChange:e=>this.settingsManager.setValue(o,e)}))}_resolveMessage(e){const t=e.split(".").reduce((e,t)=>e?.[t],this.messages);return"string"==typeof t?t:e}};e([t({nonNullable:!0,type:i})],b.prototype,"settingsManager",void 0),e([t()],b.prototype,"_blockExpanded",void 0),e([t(),c("esri/widgets/Sketch/t9n/Sketch")],b.prototype,"messages",void 0),b=e([o("esri.widgets.support.PluginSettingsControls")],b);const m=b;export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as l}from"../../core/reactiveUtils.js";import{generateUID as n}from"../../core/uid.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import r from"../../views/interactive/snapping/SnappingOptions.js";import d from"../Widget.js";import{loadCalciteComponents as p}from"./componentsUtils.js";import{globalCss as g}from"./globalCss.js";import{loadLabeledSwitchComponents as c,LabeledSwitch as h}from"./LabeledSwitch.js";import{messageBundle as b,tsx as m}from"./widget.js";import{setFocus as y}from"./widgetUtils.js";import u from"./SnappingControls/SnappingControlsViewModel.js";import{itemTitleMatchesFilter as _}from"./SnappingControls/snappingLayerListUtils.js";import L from"./SnappingControls/VisibleElements.js";const w="esri-snapping-controls",v={base:w,container:`${w}__container`,toggleBlock:`${w}__toggle-block`,layerListBlock:`${w}__layer-list-block`,layerList:`${w}__layer-list`,layerListFilter:`${w}__layer-list__filter`,layerListButton:`${w}__layer-list__button`,layerListItem:`${w}__layer-list__item`,layerListGroup:`${w}__layer-list__group`,nestedContainer:`${w}__nested-container`};let f=class extends d{constructor(e,t){super(e,t),this._defaultViewModel=null,this._layerListFilter=null,this._gridLoadTask=null,this.layerListOpen=!0,this.gridOptionsOpen=!1,this.messages=null,this.messagesCommon=null,this.snappingManager=null,this.visibleElements=new L,this._enableSnappingSwitchChange=e=>{this.snappingOptions.enabled=e},this._featureEnabledSwitchChange=e=>{this.snappingOptions.featureEnabled=e},this._gridEnabledSwitchChange=e=>{this.snappingOptions.gridEnabled=e,e&&this._startLoadGrid()},this._selfEnabledSwitchChange=e=>{this.snappingOptions.selfEnabled=e},this._onToggleLayersButtonClick=e=>{this.viewModel.toggleSnappingForAllLayers(!this.viewModel.allLayersEnabled),y(e.target)},this.viewModel=e?.viewModel??(this._defaultViewModel=new u({snappingOptions:e?.snappingOptions,view:e?.view}))}destroy(){this.viewModel!==this._defaultViewModel&&(this._defaultViewModel=s(this._defaultViewModel))}loadDependencies(){return Promise.all([p({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")}),c()])}initialize(){this.addHandles(l(()=>"2d"===this.view?.type&&!!this.view.grid,e=>{this.visibleElements.gridControls&&(this.snappingOptions.gridEnabled=e)}))}get _openAndReady(){return this.gridOptionsOpen&&this.snappingOptions.gridEnabled&&this.snappingOptions.enabled}get icon(){return"snap-to-point"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){e!==this._get("viewModel")&&(null!=this._defaultViewModel&&this._defaultViewModel===e||(this._defaultViewModel=s(this._defaultViewModel)),this._set("viewModel",e))}render(){const{label:e}=this;return m("div",{"aria-label":e,class:this.classes(v.base,g.widget)},m("div",{class:v.container},this._renderContent()))}_renderContent(){return[this._renderToggles(),this._renderLayerList(),"2d"===this.view?.type&&this.visibleElements.gridControls?this._renderGridOptions():null]}_renderToggles(){const{visibleElements:e,view:i}=this,s=[e.selfEnabledToggle?this._renderSelfEnabledToggle():null,e.featureEnabledToggle?this._renderFeatureEnabledToggle():null,e.gridEnabledToggle&&"2d"===i?.type?this._renderGridEnabledToggle():null].filter(t),l=[e.enabledToggle?this._renderEnabledToggle():null,s.length>0?m("div",{class:v.nestedContainer},s):null].filter(t);return 0===l.length?null:m("calcite-block",{class:v.toggleBlock,expanded:!0,heading:e.header?this.label:"",key:"toggle-block",label:this.label},l)}_renderEnabledToggle(){return m(h,{checked:this.viewModel.snappingOptions.enabled,disabled:this._enabledToggleDisabled,key:`${this.id}__enabled-toggle`,label:this.messages.enableSnapping,topLayerDisabled:this.topLayerDisabled,onChange:this._enableSnappingSwitchChange})}_renderSelfEnabledToggle(){return m(h,{checked:this.viewModel.snappingOptions.selfEnabled,disabled:this._secondaryElementsDisabled,key:`${this.id}__self-enabled-toggle`,label:this.messages.geometryGuides,topLayerDisabled:this.topLayerDisabled,onChange:this._selfEnabledSwitchChange})}_renderFeatureEnabledToggle(){return m(h,{checked:this.viewModel.snappingOptions.featureEnabled,disabled:this._secondaryElementsDisabled,key:`${this.id}__feature-enabled-toggle`,label:this.messages.featureToFeature,topLayerDisabled:this.topLayerDisabled,onChange:this._featureEnabledSwitchChange})}_renderGridEnabledToggle(){return m(h,{checked:this.viewModel.snappingOptions.gridEnabled,disabled:this._secondaryElementsDisabled,key:`${this.id}__grid-enabled-toggle`,label:this.messages.grid,topLayerDisabled:this.topLayerDisabled,onChange:this._gridEnabledSwitchChange})}_renderLayerList(){if(!this.visibleElements.layerList)return null;const{messages:e,viewModel:t}=this,i=t.layerListViewModel.operationalItems.length>9?m("calcite-input",{class:v.layerListFilter,clearable:!0,placeholder:e?.searchLayers,onCalciteInputInput:({currentTarget:{value:e}})=>{this._layerListFilter=""===e?null:new RegExp(e,"i")}}):null,s=this._secondaryElementsDisabled,l=this.layerListOpen&&!s,n=t.layerListViewModel.operationalItems?.find(e=>!!e.children.length);return m("calcite-block",{class:v.layerListBlock,collapsible:!0,disabled:this._secondaryElementsDisabled,expanded:l,heading:e.snappingLayers,key:"list-block",onCalciteBlockToggle:e=>this.layerListOpen=e.currentTarget.expanded},i,this._renderToggleLayersButton(),m("calcite-list",{class:v.layerList,displayMode:n?"nested":"flat",label:e?.snappingLayers,selectionMode:"none"},this._renderLayerListItemCollection(t.layerListViewModel.operationalItems)))}_renderGridOptions(){const{view:e,visibleElements:t,snappingManager:i,snappingOptions:s,_openAndReady:l}=this,{gridEnabled:n,enabled:a}=s;(l||"2d"===e?.type&&e.grid)&&this._startLoadGrid();const o=this._gridLoadTask?.value,r=o&&"2d"===e?.type&&m(o,{snappingManager:i,snappingOptions:s,suppressDeprecationWarning:!0,view:e,visibleElements:t.gridControlsElements});return m("calcite-block",{class:v.layerListBlock,collapsible:!0,disabled:!n||!a,expanded:l,heading:this.messages.gridOptionsHeading,key:"grid-block",onCalciteBlockClose:()=>this.gridOptionsOpen=!1,onCalciteBlockOpen:()=>this.gridOptionsOpen=!0},r??m("calcite-loader",{label:this.messagesCommon.loading,scale:"s",text:this.messagesCommon.loading}))}_startLoadGrid(){!this._gridLoadTask&&this.visibleElements.gridControls&&"2d"===this.view?.type&&(this._gridLoadTask=i(async()=>(await import("./GridControls.js")).default))}_renderLayerListItemCollection(e){const i=this._layerListFilter;return e.map(e=>{switch(i?_(e,i):null){case"children":{const t=e.children.filter(e=>!1!==_(e,i));return this._renderLayerListItemGroup(e,t)}case"self":case null:return this._renderLayerListItemOrGroup(e);case!1:return"self"===_(e.parent,i)?this._renderLayerListItemOrGroup(e):null}}).toArray().filter(t)}_renderToggleLayersButton(){if(!this.visibleElements.layerListToggleLayersButton)return null;const{viewModel:{allLayersEnabled:e},messages:t}=this,i=e?t.disableAllLayers:t.enableAllLayers;return m("calcite-button",{appearance:"transparent",class:v.layerListButton,label:i,name:"layer-toggle",onclick:this._onToggleLayersButtonClick},i)}_renderLayerListItemOrGroup(e){if(e.children.length)return this._renderLayerListItemGroup(e);const{messages:{untitledLayer:t}}=this,i=e.title||t,s=()=>{this.viewModel.toggleSnappingForLayers([e.layer?.id],"enabled"!==e.enabled)};return m("calcite-list-item",{class:v.layerListItem,key:`${this.id}-list-item-${e.uid}`,label:i,onCalciteListItemSelect:e=>{e.stopPropagation(),s()}},m("calcite-checkbox",{checked:"enabled"===e.enabled,slot:"actions-start",onCalciteCheckboxChange:s}))}_renderLayerListItemGroup(e,t){const{messages:i}=this,{children:s,title:l}=e,a=l||i.untitledLayer,o=l&&""!==l?l:n(),r=!!t?.length,d=t??s,p=()=>{this.viewModel.toggleSnappingForLayers(e.childLayerIds,"enabled"!==e.enabled)},g=d?.find(e=>!!e.children.length);return m("calcite-list-item",{class:v.layerListGroup,expanded:r,key:o,label:a,onCalciteListItemSelect:e=>{e.stopPropagation(),p()}},m("calcite-checkbox",{checked:"enabled"===e.enabled,indeterminate:"indeterminate"===e.enabled,slot:"actions-start",onCalciteCheckboxChange:p}),m("calcite-list",{displayMode:g?"nested":"flat",label:i?.snappingLayers,selectionMode:"none"},this._renderLayerListItemCollection(d)))}get _enabledToggleDisabled(){const e=this.snappingOptions;return e.enabledToggled||e.forceDisabled}get _secondaryElementsDisabled(){return this._enabledToggleDisabled||!this.snappingOptions.enabled}};e([a()],f.prototype,"_defaultViewModel",void 0),e([a()],f.prototype,"_layerListFilter",void 0),e([a()],f.prototype,"_gridLoadTask",void 0),e([a()],f.prototype,"_openAndReady",null),e([a()],f.prototype,"label",null),e([a({type:Boolean,nonNullable:!0})],f.prototype,"layerListOpen",void 0),e([a({type:Boolean,nonNullable:!0})],f.prototype,"gridOptionsOpen",void 0),e([a(),b("esri/widgets/support/SnappingControls/t9n/SnappingControls")],f.prototype,"messages",void 0),e([a(),b("esri/t9n/common")],f.prototype,"messagesCommon",void 0),e([a({type:r})],f.prototype,"snappingOptions",null),e([a()],f.prototype,"snappingManager",void 0),e([a()],f.prototype,"view",null),e([a({type:u})],f.prototype,"viewModel",null),e([a({type:L,nonNullable:!0})],f.prototype,"visibleElements",void 0),e([a()],f.prototype,"_enabledToggleDisabled",null),e([a()],f.prototype,"_secondaryElementsDisabled",null),f=e([o("esri.widgets.support.SnappingControls")],f);const C=f;export{C as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as l}from"../../core/reactiveUtils.js";import{generateUID as n}from"../../core/uid.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import r from"../../views/interactive/snapping/SnappingOptions.js";import d from"../Widget.js";import{loadCalciteComponents as p}from"./componentsUtils.js";import{globalCss as g}from"./globalCss.js";import{loadLabeledSwitchComponents as c,LabeledSwitch as h}from"./LabeledSwitch.js";import{messageBundle as b,tsx as y}from"./widget.js";import{setFocus as u}from"./widgetUtils.js";import m from"./SnappingControls/SnappingControlsViewModel.js";import{itemTitleMatchesFilter as _}from"./SnappingControls/snappingLayerListUtils.js";import L from"./SnappingControls/VisibleElements.js";const w="esri-snapping-controls",v={base:w,container:`${w}__container`,toggleBlock:`${w}__toggle-block`,layerListBlock:`${w}__layer-list-block`,layerList:`${w}__layer-list`,layerListFilter:`${w}__layer-list__filter`,layerListButton:`${w}__layer-list__button`,layerListItem:`${w}__layer-list__item`,layerListGroup:`${w}__layer-list__group`,nestedContainer:`${w}__nested-container`};let f=class extends d{constructor(e,t){super(e,t),this._defaultViewModel=null,this._layerListFilter=null,this._gridLoadTask=null,this.layerListOpen=!0,this.gridOptionsOpen=!1,this.messages=null,this.snappingManager=null,this.visibleElements=new L,this._enableSnappingSwitchChange=e=>{this.snappingOptions.enabled=e},this._featureEnabledSwitchChange=e=>{this.snappingOptions.featureEnabled=e},this._gridEnabledSwitchChange=e=>{this.snappingOptions.gridEnabled=e,e&&(this._startLoadGrid(),this.gridOptionsOpen=!0)},this._selfEnabledSwitchChange=e=>{this.snappingOptions.selfEnabled=e},this._onToggleLayersButtonClick=e=>{this.viewModel.toggleSnappingForAllLayers(!this.viewModel.allLayersEnabled),u(e.target)},this.viewModel=e?.viewModel??(this._defaultViewModel=new m({snappingOptions:e?.snappingOptions,view:e?.view}))}destroy(){this.viewModel!==this._defaultViewModel&&(this._defaultViewModel=s(this._defaultViewModel))}loadDependencies(){return Promise.all([p({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox")}),c()])}initialize(){this.addHandles(l(()=>"2d"===this.view?.type&&!!this.view.grid,e=>{this.visibleElements.gridControls&&(this.snappingOptions.gridEnabled=e)}))}get _openAndReady(){return this.gridOptionsOpen&&this.snappingOptions.gridEnabled&&this.snappingOptions.enabled}get icon(){return"snap-to-point"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){e!==this._get("viewModel")&&(null!=this._defaultViewModel&&this._defaultViewModel===e||(this._defaultViewModel=s(this._defaultViewModel)),this._set("viewModel",e))}render(){const{label:e}=this;return y("div",{"aria-label":e,class:this.classes(v.base,g.widget)},y("div",{class:v.container},this._renderContent()))}_renderContent(){return[this._renderToggles(),this._renderLayerList(),"2d"===this.view?.type&&this.visibleElements.gridControls?this._renderGridOptions():null]}_renderToggles(){const{visibleElements:e,view:i}=this,s=[e.selfEnabledToggle?this._renderSelfEnabledToggle():null,e.featureEnabledToggle?this._renderFeatureEnabledToggle():null,e.gridEnabledToggle&&"2d"===i?.type?this._renderGridEnabledToggle():null].filter(t),l=[e.enabledToggle?this._renderEnabledToggle():null,s.length>0?y("div",{class:v.nestedContainer},s):null].filter(t);return 0===l.length?null:y("calcite-block",{class:v.toggleBlock,expanded:!0,heading:e.header?this.label:"",key:"toggle-block",label:this.label},l)}_renderEnabledToggle(){return y(h,{checked:this.viewModel.snappingOptions.enabled,disabled:this._enabledToggleDisabled,key:`${this.id}__enabled-toggle`,label:this.messages.enableSnapping,topLayerDisabled:this.topLayerDisabled,onChange:this._enableSnappingSwitchChange})}_renderSelfEnabledToggle(){return y(h,{checked:this.viewModel.snappingOptions.selfEnabled,disabled:this._secondaryElementsDisabled,key:`${this.id}__self-enabled-toggle`,label:this.messages.geometryGuides,topLayerDisabled:this.topLayerDisabled,onChange:this._selfEnabledSwitchChange})}_renderFeatureEnabledToggle(){return y(h,{checked:this.viewModel.snappingOptions.featureEnabled,disabled:this._secondaryElementsDisabled,key:`${this.id}__feature-enabled-toggle`,label:this.messages.featureToFeature,topLayerDisabled:this.topLayerDisabled,onChange:this._featureEnabledSwitchChange})}_renderGridEnabledToggle(){return y(h,{checked:this.viewModel.snappingOptions.gridEnabled,disabled:this._secondaryElementsDisabled,key:`${this.id}__grid-enabled-toggle`,label:this.messages.grid,topLayerDisabled:this.topLayerDisabled,onChange:this._gridEnabledSwitchChange})}_renderLayerList(){if(!this.visibleElements.layerList)return null;const{messages:e,viewModel:t}=this,i=t.layerListViewModel.operationalItems.length>9?y("calcite-input",{class:v.layerListFilter,clearable:!0,placeholder:e?.searchLayers,onCalciteInputInput:({currentTarget:{value:e}})=>{this._layerListFilter=""===e?null:new RegExp(e,"i")}}):null,s=this._secondaryElementsDisabled,l=this.layerListOpen&&!s,n=t.layerListViewModel.operationalItems?.find(e=>!!e.children.length);return y("calcite-block",{class:v.layerListBlock,collapsible:!0,disabled:this._secondaryElementsDisabled,expanded:l,heading:e.snappingLayers,key:"list-block",onCalciteBlockToggle:e=>this.layerListOpen=e.currentTarget.expanded},i,this._renderToggleLayersButton(),y("calcite-list",{class:v.layerList,displayMode:n?"nested":"flat",label:e?.snappingLayers,selectionMode:"none"},this._renderLayerListItemCollection(t.layerListViewModel.operationalItems)))}_renderGridOptions(){const{view:e,visibleElements:t,snappingManager:i,snappingOptions:s,_openAndReady:l}=this,{gridEnabled:n,enabled:a}=s;(l||"2d"===e?.type&&e.grid)&&this._startLoadGrid();const o=this._gridLoadTask?.value,r=o&&"2d"===e?.type&&y(o,{snappingManager:i,snappingOptions:s,suppressDeprecationWarning:!0,view:e,visibleElements:t.gridControlsElements});return y("calcite-block",{class:v.layerListBlock,collapsible:!0,disabled:!n||!a,expanded:l,heading:this.messages.gridOptionsHeading,key:"grid-block",loading:!!l&&null==r,onCalciteBlockClose:()=>this.gridOptionsOpen=!1,onCalciteBlockOpen:()=>this.gridOptionsOpen=!0},r)}_startLoadGrid(){!this._gridLoadTask&&this.visibleElements.gridControls&&"2d"===this.view?.type&&(this._gridLoadTask=i(async()=>(await import("./GridControls.js")).default))}_renderLayerListItemCollection(e){const i=this._layerListFilter;return e.map(e=>{switch(i?_(e,i):null){case"children":{const t=e.children.filter(e=>!1!==_(e,i));return this._renderLayerListItemGroup(e,t)}case"self":case null:return this._renderLayerListItemOrGroup(e);case!1:return"self"===_(e.parent,i)?this._renderLayerListItemOrGroup(e):null}}).toArray().filter(t)}_renderToggleLayersButton(){if(!this.visibleElements.layerListToggleLayersButton)return null;const{viewModel:{allLayersEnabled:e},messages:t}=this,i=e?t.disableAllLayers:t.enableAllLayers;return y("calcite-button",{appearance:"transparent",class:v.layerListButton,label:i,name:"layer-toggle",onclick:this._onToggleLayersButtonClick},i)}_renderLayerListItemOrGroup(e){if(e.children.length)return this._renderLayerListItemGroup(e);const{messages:{untitledLayer:t}}=this,i=e.title||t,s=()=>{this.viewModel.toggleSnappingForLayers([e.layer?.id],"enabled"!==e.enabled)};return y("calcite-list-item",{class:v.layerListItem,key:`${this.id}-list-item-${e.uid}`,label:i,onCalciteListItemSelect:e=>{e.stopPropagation(),s()}},y("calcite-checkbox",{checked:"enabled"===e.enabled,slot:"actions-start",onCalciteCheckboxChange:s}))}_renderLayerListItemGroup(e,t){const{messages:i}=this,{children:s,title:l}=e,a=l||i.untitledLayer,o=l&&""!==l?l:n(),r=!!t?.length,d=t??s,p=()=>{this.viewModel.toggleSnappingForLayers(e.childLayerIds,"enabled"!==e.enabled)},g=d?.find(e=>!!e.children.length);return y("calcite-list-item",{class:v.layerListGroup,expanded:r,key:o,label:a,onCalciteListItemSelect:e=>{e.stopPropagation(),p()}},y("calcite-checkbox",{checked:"enabled"===e.enabled,indeterminate:"indeterminate"===e.enabled,slot:"actions-start",onCalciteCheckboxChange:p}),y("calcite-list",{displayMode:g?"nested":"flat",label:i?.snappingLayers,selectionMode:"none"},this._renderLayerListItemCollection(d)))}get _enabledToggleDisabled(){const e=this.snappingOptions;return e.enabledToggled||e.forceDisabled}get _secondaryElementsDisabled(){return this._enabledToggleDisabled||!this.snappingOptions.enabled}};e([a()],f.prototype,"_defaultViewModel",void 0),e([a()],f.prototype,"_layerListFilter",void 0),e([a()],f.prototype,"_gridLoadTask",void 0),e([a()],f.prototype,"_openAndReady",null),e([a()],f.prototype,"label",null),e([a({type:Boolean,nonNullable:!0})],f.prototype,"layerListOpen",void 0),e([a({type:Boolean,nonNullable:!0})],f.prototype,"gridOptionsOpen",void 0),e([a(),b("esri/widgets/support/SnappingControls/t9n/SnappingControls")],f.prototype,"messages",void 0),e([a({type:r})],f.prototype,"snappingOptions",null),e([a()],f.prototype,"snappingManager",void 0),e([a()],f.prototype,"view",null),e([a({type:m})],f.prototype,"viewModel",null),e([a({type:L,nonNullable:!0})],f.prototype,"visibleElements",void 0),e([a()],f.prototype,"_enabledToggleDisabled",null),e([a()],f.prototype,"_secondaryElementsDisabled",null),f=e([o("esri.widgets.support.SnappingControls")],f);const E=f;export{E as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isTextInput as t}from"../../../form/support/formUtils.js";import{validateDomainValue as n}from"../../../layers/support/domainUtils.js";import{validateFieldValue as e}from"../../../layers/support/fieldUtils.js";import{dateTimeIsInRange as r}from"../dateUtils.js";const o=(t,n)=>{if(!t)return!0;const{operations:e}=t;switch(n){case"INSERT":return e.supportsAdd;case"UPDATE":case"DELETE":return e.supportsUpdate;default:return!0}};function i(t,o){const{dataType:i,domain:u,field:a,maxLength:s,minLength:l,range:f,required:p}=o;if(null==t)return p?"input-validation-error::cannot-be-empty":null;if("text"===i&&"string"==typeof t){if(l>-1&&t.length<l)return"length-validation-error::too-short";if(s>-1&&t.length>s)return"length-validation-error::too-long"}return"date"!==i||r({type:a.type,range:f,value:t})?u?n(a,t,u):e(a,t):"numeric-range-validation-error::out-of-range"}function u(t,n){return!(!a(t)||!a(n))||t===n}function a(t){return null==t||""===t}function s({dataType:n,field:e,input:r}){const o=-1;if("date"===n)return o;const i=f(e.length);if(!r||!t(r))return i;const u=f(r.maxLength);return u===o?i:i===o?u:Math.min(i,u)}function l({dataType:n,field:e,input:r}){const o=-1;if("date"===n)return o;if(!r||!t(r))return o;const i=f(r.minLength);if(i<0)return o;const u=f(e.length);return u>o&&u<i?o:i}function f(t){return"number"==typeof t&&t>-1?t:-1}const p={type:"number"},c={type:"number",intlOptions:{notation:"scientific"}};function m(t){return t>=1e7||t<=-1e7}function d(t,n){return null!=t.max&&null!=t.min?n.outsideRange:null!=t.max?n.outsideRangeMax:n.outsideRangeMin}const g=t=>t&&!Number.isNaN(t.valueOf());export{o as capabilitiesAllowEditType,g as dateIsValid,f as ensureMinOrMaxLength,s as getMaxLength,l as getMinLength,d as getRangeErrorMessage,a as isEmptyValue,p as numberFormatOptions,c as scientificNumberFormatOptions,m as shouldUseScientificNotation,i as validateFormValue,u as valuesAreEquivalent};
2
+ import{isTextInput as t}from"../../../form/support/formUtils.js";import{validateDomainValue as e}from"../../../layers/support/domainUtils.js";import{validateFieldValue as n}from"../../../layers/support/fieldUtils.js";import{dateTimeIsInRange as r}from"../dateUtils.js";const i=(t,e)=>{if(!t)return!0;const{operations:n}=t;switch(e){case"INSERT":return n.supportsAdd;case"UPDATE":case"DELETE":return n.supportsUpdate;default:return!0}};function o(t,i){const{dataType:o,domain:u,field:l,maxLength:a,minLength:s,multipleChoice:c,range:f,required:m}=i;if(null==t)return m?"input-validation-error::cannot-be-empty":null;if("text"===o&&"string"==typeof t){if(s>-1&&t.length<s)return"length-validation-error::too-short";if(a>-1&&t.length>a)return"length-validation-error::too-long";if(c){const e=g(t,c.choiceDelimiter);if(null!=c.maxSelectedChoices&&e>c.maxSelectedChoices)return"multiple-choice-validation-error::too-many-selected-choices";if(null!=c.minSelectedChoices&&e<c.minSelectedChoices)return"multiple-choice-validation-error::too-few-selected-choices"}}return"date"!==o||r({type:l.type,range:f,value:t})?u?e(l,t,u):n(l,t):"numeric-range-validation-error::out-of-range"}function u(t,e){return!(!l(t)||!l(e))||t===e}function l(t){return null==t||""===t}function a({dataType:e,field:n,input:r}){const i=-1;if("date"===e)return i;const o=c(n.length);if(!r||!t(r))return o;const u=c(r.maxLength);return u===i?o:o===i?u:Math.min(o,u)}function s({dataType:e,field:n,input:r}){const i=-1;if("date"===e)return i;if(!r||!t(r))return i;const o=c(r.minLength);if(o<0)return i;const u=c(n.length);return u>i&&u<o?i:o}function c(t){return"number"==typeof t&&t>-1?t:-1}const f={type:"number"},m={type:"number",intlOptions:{notation:"scientific"}};function p(t){return t>=1e7||t<=-1e7}function d(t,e){return null!=t.max&&null!=t.min?e.outsideRange:null!=t.max?e.outsideRangeMax:e.outsideRangeMin}const h=t=>t&&!Number.isNaN(t.valueOf());function g(t,e){return""===t?0:t.split(e).map(t=>t.trim()).filter(t=>""!==t).length}export{i as capabilitiesAllowEditType,h as dateIsValid,c as ensureMinOrMaxLength,a as getMaxLength,s as getMinLength,d as getRangeErrorMessage,l as isEmptyValue,f as numberFormatOptions,m as scientificNumberFormatOptions,p as shouldUseScientificNotation,o as validateFormValue,u as valuesAreEquivalent};
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"./ElevationProfileLine.js";import o from"./ElevationProfileLineGround.js";import r from"./ElevationProfileLineInput.js";import i from"./ElevationProfileLineQuery.js";import n from"./ElevationProfileLineScene.js";import t from"../../core/Collection.js";const l={base:e,key:"type",typeMap:{ground:o,input:r,query:i,scene:n},errorContext:"elevation-profile-line"},p=t.ofType(l);export{p as ElevationProfileLineCollection};