@arcgis/core 4.33.0-next.20250519 → 4.33.0-next.20250520

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 (106) hide show
  1. package/applications/Components/QuantityFormatter.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{6fa1a5b7276a037dbd6a.js → 2113da9429f6272339d7.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{9c8224ca29475556e5ea.js → 26d3c9c6215c4076f943.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{151d6354e7bc105b25c0.js → 585c7b485c42555ec554.js} +6 -6
  6. package/assets/esri/core/workers/chunks/62b2d3720693c93a60f2.js +1 -0
  7. package/assets/esri/core/workers/chunks/{9d5eac3bd1526e2b33e3.js → 8fda0a5b247385e68dc0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/a22e5b2874647fe0d31a.js +1 -0
  9. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +1 -1
  10. package/assets/esri/themes/base/widgets/_Legend.scss +0 -4
  11. package/assets/esri/themes/dark/main.css +1 -1
  12. package/assets/esri/themes/light/main.css +1 -1
  13. package/assets/esri/themes/light/view.css +1 -1
  14. package/assets/esri/views/magnifier/overlay.ts.svg +1 -1
  15. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  16. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  17. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  18. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  19. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  20. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  21. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  22. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  23. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  24. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  25. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  26. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  27. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  28. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  29. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  30. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  31. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  32. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  33. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  34. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  35. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  36. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  37. package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
  38. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  39. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  40. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  41. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  42. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  43. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  44. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  45. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  46. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  47. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  48. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  49. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  50. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  51. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  52. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  53. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  54. package/chunks/HUDMaterial.glsl.js +6 -6
  55. package/geometry/operators/densifyOperator.d.ts +1 -0
  56. package/geometry/operators/json/geodesicBufferOperator.js +1 -1
  57. package/interfaces.d.ts +28 -0
  58. package/layers/VideoLayer.js +1 -1
  59. package/layers/video/VideoController.js +1 -1
  60. package/package.json +2 -2
  61. package/rest/knowledgeGraph/GraphUpdateSearchIndexResult.js +5 -0
  62. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  63. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  64. package/rest/knowledgeGraphService.js +1 -1
  65. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  66. package/support/revision.js +1 -1
  67. package/symbols/support/previewCIMSymbol.js +1 -1
  68. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  69. package/views/2d/layers/VideoLayerView2D.js +1 -1
  70. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  71. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  72. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  73. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  74. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  75. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  76. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  77. package/views/VideoView.js +1 -1
  78. package/views/View2D.js +1 -1
  79. package/views/input/recognizers/DoubleTapDrag.js +1 -1
  80. package/views/input/recognizers/ImmediateDoubleClick.js +1 -1
  81. package/views/input/recognizers/PointerClickHoldAndDrag.js +1 -1
  82. package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
  83. package/views/input/recognizers/support.js +1 -1
  84. package/views/magnifier/overlay-svg.js +1 -1
  85. package/views/ui/video/DefaultUIVideo.js +5 -0
  86. package/views/webgl/RenderingContext.js +1 -1
  87. package/views/webgl/checkWebGLError.js +1 -1
  88. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  89. package/widgets/AreaMeasurement3D.js +1 -1
  90. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  91. package/widgets/DirectLineMeasurement3D.js +1 -1
  92. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  93. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  94. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  95. package/widgets/Legend/styles/support/sizeRampUtils.js +1 -1
  96. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  97. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  98. package/widgets/LineOfSight.js +1 -1
  99. package/widgets/Slice/SliceViewModel.js +1 -1
  100. package/widgets/Slice.js +1 -1
  101. package/widgets/VideoPlayer.js +1 -1
  102. package/widgets/support/AnalysisViewModel.js +1 -1
  103. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  104. package/widgets/support/SelectionToolbar.js +1 -1
  105. package/assets/esri/core/workers/chunks/2873cb727c59328074db.js +0 -1
  106. package/assets/esri/core/workers/chunks/a937076d2f8c2b6a5d8a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as e}from"../../core/promiseUtils.js";import{Milliseconds as s}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a}from"./checkWebGLError.js";import{ContextState as r}from"./ContextState.js";import{SpecialDrawBuffers as n,ColorAttachment0 as l,BufferType as h,Face as f,baseTextureUnit as o,FramebufferBit as u,BufferContent as c,FramebufferTarget as _,TextureSamplingMode as d,SyncCondition as b,ResourceType as F,ClientWaitSyncStatus as g,BlendFactor as B,BlendOperation as p,CullMode as m,CompareFunction as E,StencilOperation as R,TextureType as T,PrimitiveType as A}from"./enums.js";import{InstanceCounter as O}from"./InstanceCounter.js";import{Parameters as C}from"./Parameters.js";import{ProgramCache as x}from"./ProgramCache.js";import{StateTracker as U}from"./renderState.js";import{Texture as k}from"./Texture.js";import{getErrorString as w}from"./Util.js";import{WebGLDriverTest as S}from"./WebGLDriverTest.js";import{Capabilities as y}from"./capabilities/Capabilities.js";let v=class{constructor(t,e){this.gl=t,this.instanceCounter=new O,this.programCache=new x(this),this._transformFeedbackRequestInfo=null,this._state=new r,this._numOfDrawCalls=0,this._numOfTriangles=0,this.configure(e)}configure(e){this._capabilities=new y(this.gl,e),this._parameters=new C(this.gl,this._capabilities,e),k.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new r,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new U({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)},setDrawBuffers:t=>{if(t)this.setDrawBuffers(t.buffers);else{const{drawFramebuffer:t}=this._state;null===t?this.setDrawBuffers([n.BACK]):0===t.colorAttachments.length?this.setDrawBuffers([n.NONE]):this.setDrawBuffers([l])}}}),this.enforceState(),t(this._driverTest),this._driverTest=new S(this)}updateOptions(t){this._parameters=new C(this.gl,this._capabilities,t)}dispose(){t(this._driverTest),this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(h.ARRAY_BUFFER),this.unbindBuffer(h.ELEMENT_ARRAY_BUFFER),this.unbindBuffer(h.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(h.PIXEL_PACK_BUFFER),this.unbindBuffer(h.PIXEL_UNPACK_BUFFER),this.unbindBuffer(h.COPY_READ_BUFFER),this.unbindBuffer(h.COPY_WRITE_BUFFER),this._state.textureUnitMap.length=0,i()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=f.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===f.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=f.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(o+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e);if(i?.length!==t.length||!i.every(((e,s)=>e===t[s])))if(t.length>this.parameters.maxDrawBuffers)console.error("Setting more active draw buffers than GL.MAX_DRAW_BUFFERS allows.");else{if(s){if(t.length>1)return void console.error("The default framebuffer can only have one active draw buffer.");if(t[0]!==n.BACK&&t[0]!==n.NONE)return void console.error("The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers.")}s||!t.includes(n.BACK)?(this.gl.drawBuffers(t),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),this._stateTracker.invalidateDrawBuffers()):console.error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTi or GL.NONE as draw buffers.")}}clear(t,e=255){if(t){if(t&u.COLOR){const t=this._state.drawFramebuffer?.colorAttachments;t&&this.setDrawBuffers(t),this.setColorMask(!0,!0,!0,!0)}t&u.DEPTH&&this.setDepthWriteEnabled(!0),t&u.STENCIL&&this.setStencilWriteMask(e),this.gl.clear(t)}}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=u.COLOR}e&&(i|=u.DEPTH),!1===s?s=0:(!0===s&&(s=255),i|=u.STENCIL),i&&this.clear(i,s)}clearBuffer(t,e,s=c.COLOR,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=c.COLOR,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=c.COLOR,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(i()){this._numOfDrawCalls++,this._numOfTriangles+=D(t,s);const e=this._state.textureUnitMap;for(let t=0;t<e.length;t++){const s=e[t];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${t}`)}}this.gl.drawArrays(t,e,s),a(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),a(this.gl)}drawElements(t,e,s,a){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=D(t,e)),this.gl.drawElements(t,e,s,a),i()){const i=w(this);if(i){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.vertexBuffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:a},o=n?.size??0,u=a+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";console.error(`drawElements: ${i}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,r){this.gl.drawElementsInstanced(t,e,s,i,r),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){this._state.program!==t&&(this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null))}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&console.error("Input texture unit is out of range of available units!");const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(this._stateTracker.invalidateDrawBuffers(),null==t)return this.gl.bindFramebuffer(_.FRAMEBUFFER,null),void(this._state.readFramebuffer=this._state.drawFramebuffer=null);t.initializeAndBind(_.FRAMEBUFFER),this._state.readFramebuffer=t,this._state.drawFramebuffer=t}}bindFramebufferSeparate(t,e,s=!1){const i=e===_.READ_FRAMEBUFFER,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._stateTracker.invalidateDrawBuffers(),this._state.drawFramebuffer=t??null))}blitFramebuffer(t,e,s=0,i=0,a=t.width,r=t.height,n=0,l=0,h=e.width,f=e.height,o=u.COLOR,c=d.NEAREST){this.bindFramebufferSeparate(t,_.READ_FRAMEBUFFER,!0),this.bindFramebufferSeparate(e,_.DRAW_FRAMEBUFFER,!0),this.gl.blitFramebuffer(s,i,a,r,n,l,h,f,o,c)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case h.ARRAY_BUFFER:this._state.vertexBuffer=N(this.gl,t,e,this._state.vertexBuffer);break;case h.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=N(this.gl,t,e,this._state.indexBuffer);break;case h.UNIFORM_BUFFER:this._state.uniformBuffer=N(this.gl,t,e,this._state.uniformBuffer);break;case h.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=N(this.gl,t,e,this._state.pixelPackBuffer);break;case h.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=N(this.gl,t,e,this._state.pixelUnpackBuffer);break;case h.COPY_READ_BUFFER:this._state.copyReadBuffer=N(this.gl,t,e,this._state.copyReadBuffer);break;case h.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=N(this.gl,t,e,this._state.copyWriteBuffer);break;case h.TRANSFORM_FEEDBACK_BUFFER:this._state.transformFeedbackBuffer=N(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return console.error("Uniform buffer binding point is out of range!"),null;const s=t===h.UNIFORM_BUFFER?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):console.error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,a){null!=e?(i()&&(a??e.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==a?this.bindBufferRange(h.UNIFORM_BUFFER,t,e.buffer,s,a):this.bindBufferBase(h.UNIFORM_BUFFER,t,e.buffer)):this.bindBufferBase(h.UNIFORM_BUFFER,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(h.UNIFORM_BUFFER,e,null)}}unbindBuffer(t){switch(t){case h.ARRAY_BUFFER:this._state.vertexBuffer=N(this.gl,null,t,this._state.vertexBuffer);break;case h.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=N(this.gl,null,t,this._state.indexBuffer);break;case h.UNIFORM_BUFFER:this._state.uniformBuffer=N(this.gl,null,t,this._state.uniformBuffer);break;case h.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=N(this.gl,null,t,this._state.pixelPackBuffer);break;case h.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=N(this.gl,null,t,this._state.pixelUnpackBuffer);break;case h.COPY_READ_BUFFER:this._state.copyReadBuffer=N(this.gl,null,t,this._state.copyReadBuffer);break;case h.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=N(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t=null){null!=t?this._state.vertexArrayObject!==t&&(t.bind(),this._state.vertexArrayObject=t):this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=s(10)){const{gl:i}=this,a=i.fenceSync(b.SYNC_GPU_COMMANDS_COMPLETE,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(F.Sync,a),i.flush();do{await e(t),r=i.clientWaitSync(a,0,0)}while(r===g.TIMEOUT_EXPIRED);if(this.instanceCounter.decrement(F.Sync,a),i.deleteSync(a),r===g.WAIT_FAILED)throw new Error("Client wait failed")}getBoundFramebufferObject(t=_.FRAMEBUFFER){return t===_.READ_FRAMEBUFFER?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e){const s=this.getBoundFramebufferObject();try{t&&this.bindFramebuffer(t),e()}finally{this.bindFramebuffer(s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(h.ARRAY_BUFFER),this.unbindBuffer(h.ELEMENT_ARRAY_BUFFER),this.unbindBuffer(h.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(h.PIXEL_PACK_BUFFER),this.unbindBuffer(h.PIXEL_UNPACK_BUFFER),this.unbindBuffer(h.COPY_READ_BUFFER),this.unbindBuffer(h.COPY_WRITE_BUFFER);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(B.ONE,B.ZERO),this.setBlendEquation(p.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(f.BACK),this.setFrontFace(m.CCW),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(E.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(E.ALWAYS,0,0),this.setStencilOp(R.KEEP,R.KEEP,R.KEEP),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setDrawBuffers([n.BACK]),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(h.ARRAY_BUFFER,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(h.ELEMENT_ARRAY_BUFFER,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(h.UNIFORM_BUFFER,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(h.UNIFORM_BUFFER,s,i.glName):t.bindBufferRange(h.UNIFORM_BUFFER,s,i.glName,a,r):t.bindBufferBase(h.UNIFORM_BUFFER,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(h.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(h.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(h.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(h.COPY_WRITE_BUFFER,null),t.bindFramebuffer(_.READ_FRAMEBUFFER,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(_.READ_FRAMEBUFFER,this._state.readFramebuffer.glName),t.readBuffer(l)),t.bindFramebuffer(_.DRAW_FRAMEBUFFER,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[n.BACK])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[l])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(o+s),t.bindTexture(T.TEXTURE_2D,null),t.bindTexture(T.TEXTURE_CUBE_MAP,null),t.bindTexture(T.TEXTURE_3D,null),t.bindTexture(T.TEXTURE_2D_ARRAY,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(o+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function N(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function D(t,e){switch(t){case A.POINTS:return 2*e;case A.TRIANGLES:return e/3;case A.TRIANGLE_STRIP:case A.TRIANGLE_FAN:return e-2;default:return 0}}export{v as RenderingContext};
5
+ import has from"../../core/has.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as e}from"../../core/promiseUtils.js";import{Milliseconds as s}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a}from"./checkWebGLError.js";import{ContextState as r}from"./ContextState.js";import{SpecialDrawBuffers as n,ColorAttachment0 as l,BufferType as h,Face as f,baseTextureUnit as o,FramebufferBit as u,BufferContent as c,FramebufferTarget as _,TextureSamplingMode as d,SyncCondition as b,ResourceType as F,ClientWaitSyncStatus as g,BlendFactor as B,BlendOperation as p,CullMode as m,CompareFunction as E,StencilOperation as R,TextureType as T,PrimitiveType as A}from"./enums.js";import{InstanceCounter as O}from"./InstanceCounter.js";import{Parameters as C}from"./Parameters.js";import{ProgramCache as x}from"./ProgramCache.js";import{StateTracker as U}from"./renderState.js";import{Texture as k}from"./Texture.js";import{getErrorString as w}from"./Util.js";import{WebGLDriverTest as S}from"./WebGLDriverTest.js";import{Capabilities as y}from"./capabilities/Capabilities.js";let v=class{constructor(t,e){this.gl=t,this.instanceCounter=new O,this.programCache=new x(this),this._transformFeedbackRequestInfo=null,this._state=new r,this._numOfDrawCalls=0,this._numOfTriangles=0,this.configure(e)}configure(e){this._capabilities=new y(this.gl,e),this._parameters=new C(this.gl,this._capabilities,e),k.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new r,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new U({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)},setDrawBuffers:t=>{if(t)this.setDrawBuffers(t.buffers);else{const{drawFramebuffer:t}=this._state;null===t?this.setDrawBuffers([n.BACK]):0===t.colorAttachments.length?this.setDrawBuffers([n.NONE]):this.setDrawBuffers([l])}}}),this.enforceState(),t(this._driverTest),this._driverTest=new S(this)}updateOptions(t){this._parameters=new C(this.gl,this._capabilities,t)}dispose(){t(this._driverTest),this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(h.ARRAY_BUFFER),this.unbindBuffer(h.ELEMENT_ARRAY_BUFFER),this.unbindBuffer(h.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(h.PIXEL_PACK_BUFFER),this.unbindBuffer(h.PIXEL_UNPACK_BUFFER),this.unbindBuffer(h.COPY_READ_BUFFER),this.unbindBuffer(h.COPY_WRITE_BUFFER),this._state.textureUnitMap.length=0,i()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=f.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===f.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=f.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(o+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e);if(i?.length!==t.length||!i.every(((e,s)=>e===t[s])))if(t.length>this.parameters.maxDrawBuffers)console.error("Setting more active draw buffers than GL.MAX_DRAW_BUFFERS allows.");else{if(s){if(t.length>1)return void console.error("The default framebuffer can only have one active draw buffer.");if(t[0]!==n.BACK&&t[0]!==n.NONE)return void console.error("The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers.")}s||!t.includes(n.BACK)?(this.gl.drawBuffers(t),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),this._stateTracker.invalidateDrawBuffers()):console.error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTi or GL.NONE as draw buffers.")}}clear(t,e=255){if(t){if(t&u.COLOR){const t=this._state.drawFramebuffer?.colorAttachments;t&&this.setDrawBuffers(t),this.setColorMask(!0,!0,!0,!0)}t&u.DEPTH&&this.setDepthWriteEnabled(!0),t&u.STENCIL&&this.setStencilWriteMask(e),this.gl.clear(t)}}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=u.COLOR}e&&(i|=u.DEPTH),!1===s?s=0:(!0===s&&(s=255),i|=u.STENCIL),i&&this.clear(i,s)}clearBuffer(t,e,s=c.COLOR,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=c.COLOR,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=c.COLOR,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=D(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),a(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),a(this.gl)}drawElements(t,e,s,a){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=D(t,e)),this.gl.drawElements(t,e,s,a),i()){const i=w(this);if(i){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.vertexBuffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:a},o=n?.size??0,u=a+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";console.error(`drawElements: ${i}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,r){this.gl.drawElementsInstanced(t,e,s,i,r),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){this._state.program!==t&&(this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null))}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&console.error("Input texture unit is out of range of available units!");const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(this._stateTracker.invalidateDrawBuffers(),null==t)return this.gl.bindFramebuffer(_.FRAMEBUFFER,null),void(this._state.readFramebuffer=this._state.drawFramebuffer=null);t.initializeAndBind(_.FRAMEBUFFER),this._state.readFramebuffer=t,this._state.drawFramebuffer=t}}bindFramebufferSeparate(t,e,s=!1){const i=e===_.READ_FRAMEBUFFER,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._stateTracker.invalidateDrawBuffers(),this._state.drawFramebuffer=t??null))}blitFramebuffer(t,e,s=0,i=0,a=t.width,r=t.height,n=0,l=0,h=e.width,f=e.height,o=u.COLOR,c=d.NEAREST){this.bindFramebufferSeparate(t,_.READ_FRAMEBUFFER,!0),this.bindFramebufferSeparate(e,_.DRAW_FRAMEBUFFER,!0),this.gl.blitFramebuffer(s,i,a,r,n,l,h,f,o,c)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case h.ARRAY_BUFFER:this._state.vertexBuffer=N(this.gl,t,e,this._state.vertexBuffer);break;case h.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=N(this.gl,t,e,this._state.indexBuffer);break;case h.UNIFORM_BUFFER:this._state.uniformBuffer=N(this.gl,t,e,this._state.uniformBuffer);break;case h.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=N(this.gl,t,e,this._state.pixelPackBuffer);break;case h.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=N(this.gl,t,e,this._state.pixelUnpackBuffer);break;case h.COPY_READ_BUFFER:this._state.copyReadBuffer=N(this.gl,t,e,this._state.copyReadBuffer);break;case h.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=N(this.gl,t,e,this._state.copyWriteBuffer);break;case h.TRANSFORM_FEEDBACK_BUFFER:this._state.transformFeedbackBuffer=N(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return console.error("Uniform buffer binding point is out of range!"),null;const s=t===h.UNIFORM_BUFFER?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):console.error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,a){null!=e?(i()&&(a??e.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==a?this.bindBufferRange(h.UNIFORM_BUFFER,t,e.buffer,s,a):this.bindBufferBase(h.UNIFORM_BUFFER,t,e.buffer)):this.bindBufferBase(h.UNIFORM_BUFFER,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(h.UNIFORM_BUFFER,e,null)}}unbindBuffer(t){switch(t){case h.ARRAY_BUFFER:this._state.vertexBuffer=N(this.gl,null,t,this._state.vertexBuffer);break;case h.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=N(this.gl,null,t,this._state.indexBuffer);break;case h.UNIFORM_BUFFER:this._state.uniformBuffer=N(this.gl,null,t,this._state.uniformBuffer);break;case h.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=N(this.gl,null,t,this._state.pixelPackBuffer);break;case h.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=N(this.gl,null,t,this._state.pixelUnpackBuffer);break;case h.COPY_READ_BUFFER:this._state.copyReadBuffer=N(this.gl,null,t,this._state.copyReadBuffer);break;case h.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=N(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t=null){null!=t?this._state.vertexArrayObject!==t&&(t.bind(),this._state.vertexArrayObject=t):this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=s(10)){const{gl:i}=this,a=i.fenceSync(b.SYNC_GPU_COMMANDS_COMPLETE,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(F.Sync,a),i.flush();do{await e(t),r=i.clientWaitSync(a,0,0)}while(r===g.TIMEOUT_EXPIRED);if(this.instanceCounter.decrement(F.Sync,a),i.deleteSync(a),r===g.WAIT_FAILED)throw new Error("Client wait failed")}getBoundFramebufferObject(t=_.FRAMEBUFFER){return t===_.READ_FRAMEBUFFER?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e){const s=this.getBoundFramebufferObject();try{t&&this.bindFramebuffer(t),e()}finally{this.bindFramebuffer(s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(h.ARRAY_BUFFER),this.unbindBuffer(h.ELEMENT_ARRAY_BUFFER),this.unbindBuffer(h.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(h.PIXEL_PACK_BUFFER),this.unbindBuffer(h.PIXEL_UNPACK_BUFFER),this.unbindBuffer(h.COPY_READ_BUFFER),this.unbindBuffer(h.COPY_WRITE_BUFFER);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(B.ONE,B.ZERO),this.setBlendEquation(p.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(f.BACK),this.setFrontFace(m.CCW),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(E.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(E.ALWAYS,0,0),this.setStencilOp(R.KEEP,R.KEEP,R.KEEP),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setDrawBuffers([n.BACK]),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(h.ARRAY_BUFFER,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(h.ELEMENT_ARRAY_BUFFER,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(h.UNIFORM_BUFFER,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(h.UNIFORM_BUFFER,s,i.glName):t.bindBufferRange(h.UNIFORM_BUFFER,s,i.glName,a,r):t.bindBufferBase(h.UNIFORM_BUFFER,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(h.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(h.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(h.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(h.COPY_WRITE_BUFFER,null),t.bindFramebuffer(_.READ_FRAMEBUFFER,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(_.READ_FRAMEBUFFER,this._state.readFramebuffer.glName),t.readBuffer(l)),t.bindFramebuffer(_.DRAW_FRAMEBUFFER,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[n.BACK])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[l])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(o+s),t.bindTexture(T.TEXTURE_2D,null),t.bindTexture(T.TEXTURE_CUBE_MAP,null),t.bindTexture(T.TEXTURE_3D,null),t.bindTexture(T.TEXTURE_2D_ARRAY,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(o+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function N(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function D(t,e){switch(t){case A.POINTS:return 2*e;case A.TRIANGLES:return e/3;case A.TRIANGLE_STRIP:case A.TRIANGLE_FAN:return e-2;default:return 0}}export{v as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import has from"../../core/has.js";import r from"../../core/Logger.js";import{ErrorConstant as o}from"./enums.js";const t=()=>r.getLogger("esri.views.webgl.checkWebGLError");function n(e){switch(e){case o.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case o.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case o.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case o.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case o.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case o.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const a=!!has("enable-feature:webgl-debug");function c(){return a}function u(){return a}function s(r){if(c()){const o=r.getError();if(o){const r=n(o),a=(new Error).stack;t().error(new e("webgl-error","WebGL error occurred",{message:r,stack:a}))}}}export{s as checkWebGLError,n as getErrorMessage,a as hasFeatureFlagWebGLDebug,c as webglDebugEnabled,u as webglValidateShadersEnabled};
5
+ import e from"../../core/Error.js";import has from"../../core/has.js";import r from"../../core/Logger.js";import{ErrorConstant as o}from"./enums.js";const t=()=>r.getLogger("esri.views.webgl.checkWebGLError");function n(e){switch(e){case o.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case o.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case o.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case o.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case o.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case o.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const a=!!has("enable-feature:webgl-debug");function c(){return a}function u(){return a}function s(r,o=c()){if(o){const o=r.getError();if(o){const r=n(o),a=(new Error).stack;t().error(new e("webgl-error","WebGL error occurred",{message:r,stack:a}))}}}export{s as checkWebGLError,n as getErrorMessage,a as hasFeatureFlagWebGLDebug,c as webglDebugEnabled,u as webglValidateShadersEnabled};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/AreaMeasurementAnalysis.js";import{watch as s,syncAndInitial as i}from"../../core/reactiveUtils.js";import{measurementAreaUnits as r}from"../../core/unitUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as l}from"../../properties/defaultUnit.js";import{AnalysisViewModel as a}from"../support/AnalysisViewModel.js";let u=class extends a{constructor(t){super(t),this.analysis=null,this._userUnitOptions=null,this._userUnit=null,this.supportedViewType="3d",this.unsupportedErrorMessage="AreaMeasurement3DViewModel is only supported in 3D views."}initialize(){this.addHandles(s((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:t,unit:e})=>{null!=t&&(t.unit=e)}),i))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){if(null==this.tool||this.disabled||this.tool.destroyed)return null;const{analysisView:t}=this;if(null==t)return null;const{viewData:e,areaLabel:s,perimeterLengthLabel:i}=t,r=e.validMeasurement,n="euclidean"===e.mode,o=0===e.intersectingSegments.size,l=o?r?"available":"unavailable":"invalid";return{mode:n?"euclidean":"geodesic",area:{text:o&&r?s:null,state:l},perimeterLength:{text:o&&r?i:null,state:l}}}get unitOptions(){const t=this._userUnitOptions?.filter((t=>r.includes(t)));return t&&t.length>0?t:r.slice()}set unitOptions(t){this._userUnitOptions=t}get unit(){const t=this._userUnit,e=this.unitOptions;if(t&&e.includes(t))return t;const s=this.defaultUnit;return s&&e.includes(s)?s:e[0]}set unit(t){this._userUnit=t}constructAnalysis(){return new e}};t([n({type:e})],u.prototype,"analysis",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n({readOnly:!0})],u.prototype,"measurement",null),t([n()],u.prototype,"unitOptions",null),t([n()],u.prototype,"_userUnitOptions",void 0),t([n()],u.prototype,"unit",null),t([n()],u.prototype,"_userUnit",void 0),t([n(l)],u.prototype,"defaultUnit",void 0),u=t([o("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel")],u);const p=u;export{p as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/AreaMeasurementAnalysis.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import i from"../../core/Logger.js";import{watch as r,syncAndInitial as n}from"../../core/reactiveUtils.js";import{measurementAreaUnits as o}from"../../core/unitUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as u}from"../../properties/defaultUnit.js";import{AnalysisViewModel as p}from"../support/AnalysisViewModel.js";let d=class extends p{constructor(e){super(e),this.analysis=null,this._userUnitOptions=null,this._userUnit=null,this.supportedViewType="3d",this.unsupportedErrorMessage="AreaMeasurement3DViewModel is only supported in 3D views.",e?.isDefaultViewModel||s(i.getLogger(this),"Area Measurement 3D","area-measurement-3d",{version:"4.33"})}initialize(){this.addHandles(r((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:e,unit:t})=>{null!=e&&(e.unit=t)}),n))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){if(null==this.tool||this.disabled||this.tool.destroyed)return null;const{analysisView:e}=this;if(null==e)return null;const{viewData:t,areaLabel:s,perimeterLengthLabel:i}=e,r=t.validMeasurement,n="euclidean"===t.mode,o=0===t.intersectingSegments.size,a=o?r?"available":"unavailable":"invalid";return{mode:n?"euclidean":"geodesic",area:{text:o&&r?s:null,state:a},perimeterLength:{text:o&&r?i:null,state:a}}}get unitOptions(){const e=this._userUnitOptions?.filter((e=>o.includes(e)));return e&&e.length>0?e:o.slice()}set unitOptions(e){this._userUnitOptions=e}get unit(){const e=this._userUnit,t=this.unitOptions;if(e&&t.includes(e))return e;const s=this.defaultUnit;return s&&t.includes(s)?s:t[0]}set unit(e){this._userUnit=e}constructAnalysis(){return new t}};e([a({type:t})],d.prototype,"analysis",void 0),e([a({readOnly:!0})],d.prototype,"state",null),e([a({readOnly:!0})],d.prototype,"measurement",null),e([a()],d.prototype,"unitOptions",null),e([a()],d.prototype,"_userUnitOptions",void 0),e([a()],d.prototype,"unit",null),e([a()],d.prototype,"_userUnit",void 0),e([a(u)],d.prototype,"defaultUnit",void 0),d=e([l("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel")],d);const m=d;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{ignoreAbortErrors as t}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import r from"./AreaMeasurement3D/AreaMeasurement3DViewModel.js";import{globalCss as n}from"./support/globalCss.js";import{MeasurementWidgetContent as a}from"./support/MeasurementWidgetContent.js";import"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import{tsx as p}from"./support/jsxFactory.js";const u="esri-area-measurement-3d",m={base:u,newMeasurementButton:`${u}__clear-button`};let d=class extends o{constructor(e,t){super(e,t),this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new r}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"measure-area"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}render(){const{messages:e,messagesCommon:s,messagesUnits:i,unit:o,unitOptions:r,viewModel:l}=this,{active:u,measurement:d,state:v,supported:g}=l;return p("div",{"aria-label":this.messages.widgetLabel,class:this.classes(m.base,n.widget,n.panel),key:this,role:"presentation"},this.visible?p(a,{active:u,measurementItems:[{key:"direct",title:i.measures.area,value:c(d?.area)},{key:"perimeter",title:e.perimeterLength,value:c(d?.perimeterLength)}],messages:{...e,notApplicable:s.notApplicable},newMeasurementButtonClass:m.newMeasurementButton,state:v,supported:g,unit:o,unitOptions:r,onNewMeasurementClick:()=>{t(this.viewModel.start())},onUnitChange:e=>{this.unit=e}}):null)}};function c(e){return"available"===e?.state?e.text:null}e([s()],d.prototype,"view",null),e([s()],d.prototype,"visible",null),e([s()],d.prototype,"active",null),e([s({constructOnly:!0,nonNullable:!0})],d.prototype,"analysis",null),e([s()],d.prototype,"icon",null),e([s()],d.prototype,"label",null),e([s(),l("esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D")],d.prototype,"messages",void 0),e([s(),l("esri/t9n/common")],d.prototype,"messagesCommon",void 0),e([s(),l("esri/core/t9n/Units")],d.prototype,"messagesUnits",void 0),e([s()],d.prototype,"uiStrings",void 0),e([s({type:r})],d.prototype,"viewModel",void 0),e([s()],d.prototype,"unitOptions",null),e([s()],d.prototype,"unit",null),d=e([i("esri.widgets.AreaMeasurement3D")],d);const v=d;export{v as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import a from"./AreaMeasurement3D/AreaMeasurement3DViewModel.js";import{globalCss as l}from"./support/globalCss.js";import{MeasurementWidgetContent as p}from"./support/MeasurementWidgetContent.js";import"./support/widgetUtils.js";import{messageBundle as u}from"./support/decorators/messageBundle.js";import{tsx as m}from"./support/jsxFactory.js";const d="esri-area-measurement-3d",c={base:d,newMeasurementButton:`${d}__clear-button`};let v=class extends n{constructor(e,i){super(e,i),this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new a({isDefaultViewModel:!0}),t(s.getLogger(this),"Area Measurement 3D","arcgis-area-measurement-3d",{version:"4.33"})}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"measure-area"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}render(){const{messages:e,messagesCommon:t,messagesUnits:s,unit:o,unitOptions:r,viewModel:n}=this,{active:a,measurement:u,state:d,supported:v}=n;return m("div",{"aria-label":this.messages.widgetLabel,class:this.classes(c.base,l.widget,l.panel),key:this,role:"presentation"},this.visible?m(p,{active:a,measurementItems:[{key:"direct",title:s.measures.area,value:g(u?.area)},{key:"perimeter",title:e.perimeterLength,value:g(u?.perimeterLength)}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:c.newMeasurementButton,state:d,supported:v,unit:o,unitOptions:r,onNewMeasurementClick:()=>{i(this.viewModel.start())},onUnitChange:e=>{this.unit=e}}):null)}};function g(e){return"available"===e?.state?e.text:null}e([o()],v.prototype,"view",null),e([o()],v.prototype,"visible",null),e([o()],v.prototype,"active",null),e([o({constructOnly:!0,nonNullable:!0})],v.prototype,"analysis",null),e([o()],v.prototype,"icon",null),e([o()],v.prototype,"label",null),e([o(),u("esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D")],v.prototype,"messages",void 0),e([o(),u("esri/t9n/common")],v.prototype,"messagesCommon",void 0),e([o(),u("esri/core/t9n/Units")],v.prototype,"messagesUnits",void 0),e([o()],v.prototype,"uiStrings",void 0),e([o({type:a})],v.prototype,"viewModel",void 0),e([o()],v.prototype,"unitOptions",null),e([o()],v.prototype,"unit",null),v=e([r("esri.widgets.AreaMeasurement3D")],v);const w=v;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/DirectLineMeasurementAnalysis.js";import{watch as s,syncAndInitial as i}from"../../core/reactiveUtils.js";import{measurementLengthUnits as r}from"../../core/unitUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as l}from"../../properties/defaultUnit.js";import{AnalysisViewModel as a}from"../support/AnalysisViewModel.js";let u=class extends a{constructor(t){super(t),this.analysis=null,this._userUnitOptions=null,this._userUnit=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views."}initialize(){this.addHandles(s((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:t,unit:e})=>{null!=t&&(t.unit=e)}),i))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){const{tool:t}=this;if(null==t)return null;const e=()=>({text:null,state:"unavailable"}),s=t=>({text:t,state:"available"}),{analysisViewData:i}=t,r=null!=i.result;return{mode:i.result?.mode??"euclidean",directDistance:r&&"euclidean"===i.actualVisualizedMeasurement?s(i.directLabelText):e(),horizontalDistance:r?s(i.horizontalLabelText):e(),verticalDistance:r?s(i.verticalLabelText):e()}}get unitOptions(){const t=this._userUnitOptions?.filter((t=>r.includes(t)));return t&&t.length>0?t:r.slice()}set unitOptions(t){this._userUnitOptions=t}get unit(){const t=this._userUnit,e=this.unitOptions;if(t&&e.includes(t))return t;const s=this.defaultUnit;return s&&e.includes(s)?s:e[0]}set unit(t){this._userUnit=t}constructAnalysis(){return new e}};t([n({type:e})],u.prototype,"analysis",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n({readOnly:!0})],u.prototype,"measurement",null),t([n()],u.prototype,"unitOptions",null),t([n()],u.prototype,"_userUnitOptions",void 0),t([n()],u.prototype,"unit",null),t([n()],u.prototype,"_userUnit",void 0),t([n(l)],u.prototype,"defaultUnit",void 0),u=t([o("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],u);const p=u;export{p as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/DirectLineMeasurementAnalysis.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import i from"../../core/Logger.js";import{watch as r,syncAndInitial as n}from"../../core/reactiveUtils.js";import{measurementLengthUnits as o}from"../../core/unitUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as u}from"../../properties/defaultUnit.js";import{AnalysisViewModel as p}from"../support/AnalysisViewModel.js";let c=class extends p{constructor(t){super(t),this.analysis=null,this._userUnitOptions=null,this._userUnit=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views.",t?.isDefaultViewModel||s(i.getLogger(this),"Directline Measurement 3D","directline-measurement-3d",{version:"4.33"})}initialize(){this.addHandles(r((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:t,unit:e})=>{null!=t&&(t.unit=e)}),n))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){const{tool:t}=this;if(null==t)return null;const e=()=>({text:null,state:"unavailable"}),s=t=>({text:t,state:"available"}),{analysisViewData:i}=t,r=null!=i.result;return{mode:i.result?.mode??"euclidean",directDistance:r&&"euclidean"===i.actualVisualizedMeasurement?s(i.directLabelText):e(),horizontalDistance:r?s(i.horizontalLabelText):e(),verticalDistance:r?s(i.verticalLabelText):e()}}get unitOptions(){const t=this._userUnitOptions?.filter((t=>o.includes(t)));return t&&t.length>0?t:o.slice()}set unitOptions(t){this._userUnitOptions=t}get unit(){const t=this._userUnit,e=this.unitOptions;if(t&&e.includes(t))return t;const s=this.defaultUnit;return s&&e.includes(s)?s:e[0]}set unit(t){this._userUnit=t}constructAnalysis(){return new e}};t([l({type:e})],c.prototype,"analysis",void 0),t([l({readOnly:!0})],c.prototype,"state",null),t([l({readOnly:!0})],c.prototype,"measurement",null),t([l()],c.prototype,"unitOptions",null),t([l()],c.prototype,"_userUnitOptions",void 0),t([l()],c.prototype,"unit",null),t([l()],c.prototype,"_userUnit",void 0),t([l(u)],c.prototype,"defaultUnit",void 0),c=t([a("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],c);const d=c;export{d as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{ignoreAbortErrors as t}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import r from"./DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js";import{globalCss as n}from"./support/globalCss.js";import{MeasurementWidgetContent as l}from"./support/MeasurementWidgetContent.js";import"./support/widgetUtils.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as u}from"./support/jsxFactory.js";const p="esri-direct-line-measurement-3d",m={base:p,newMeasurementButton:`${p}__clear-button`};let c=class extends o{constructor(e,t){super(e,t),this.messages=null,this.messagesCommon=null,this.viewModel=new r}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"measure-line"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}render(){const{messages:e,messagesCommon:s,unit:i,unitOptions:o,viewModel:r}=this,{active:a,measurement:p,state:c,supported:v}=r;return u("div",{"aria-label":this.messages.widgetLabel,class:this.classes(m.base,n.widget,n.panel),key:this,role:"presentation"},this.visible?u(l,{active:a,measurementItems:[{key:"direct",title:e.direct,value:d(p?.directDistance)},{key:"horizontal",title:e.horizontal,value:d(p?.horizontalDistance)},{key:"vertical",title:e.vertical,value:d(p?.verticalDistance)}],messages:{...e,notApplicable:s?.notApplicable},newMeasurementButtonClass:m.newMeasurementButton,state:c,supported:v,unit:i,unitOptions:o,onNewMeasurementClick:()=>{t(this.viewModel.start())},onUnitChange:e=>{this.unit=e}}):null)}};function d(e){return"available"===e?.state?e.text:null}e([s()],c.prototype,"view",null),e([s()],c.prototype,"visible",null),e([s()],c.prototype,"active",null),e([s({constructOnly:!0,nonNullable:!0})],c.prototype,"analysis",null),e([s()],c.prototype,"icon",null),e([s()],c.prototype,"label",null),e([s(),a("esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D")],c.prototype,"messages",void 0),e([s(),a("esri/t9n/common")],c.prototype,"messagesCommon",void 0),e([s()],c.prototype,"uiStrings",void 0),e([s({type:r})],c.prototype,"viewModel",void 0),e([s()],c.prototype,"unitOptions",null),e([s()],c.prototype,"unit",null),c=e([i("esri.widgets.DirectLineMeasurement3D")],c);const v=c;export{v as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import l from"./DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js";import{globalCss as a}from"./support/globalCss.js";import{MeasurementWidgetContent as u}from"./support/MeasurementWidgetContent.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import{tsx as m}from"./support/jsxFactory.js";const c="esri-direct-line-measurement-3d",d={base:c,newMeasurementButton:`${c}__clear-button`};let v=class extends n{constructor(e,i){super(e,i),this.messages=null,this.messagesCommon=null,this.viewModel=new l({isDefaultViewModel:!0}),t(s.getLogger(this),"Directline Measurement 3D","arcgis-directline-measurement-3d",{version:"4.33"})}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"measure-line"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}render(){const{messages:e,messagesCommon:t,unit:s,unitOptions:o,viewModel:r}=this,{active:n,measurement:l,state:p,supported:c}=r;return m("div",{"aria-label":this.messages.widgetLabel,class:this.classes(d.base,a.widget,a.panel),key:this,role:"presentation"},this.visible?m(u,{active:n,measurementItems:[{key:"direct",title:e.direct,value:g(l?.directDistance)},{key:"horizontal",title:e.horizontal,value:g(l?.horizontalDistance)},{key:"vertical",title:e.vertical,value:g(l?.verticalDistance)}],messages:{...e,notApplicable:t?.notApplicable},newMeasurementButtonClass:d.newMeasurementButton,state:p,supported:c,unit:s,unitOptions:o,onNewMeasurementClick:()=>{i(this.viewModel.start())},onUnitChange:e=>{this.unit=e}}):null)}};function g(e){return"available"===e?.state?e.text:null}e([o()],v.prototype,"view",null),e([o()],v.prototype,"visible",null),e([o()],v.prototype,"active",null),e([o({constructOnly:!0,nonNullable:!0})],v.prototype,"analysis",null),e([o()],v.prototype,"icon",null),e([o()],v.prototype,"label",null),e([o(),p("esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D")],v.prototype,"messages",void 0),e([o(),p("esri/t9n/common")],v.prototype,"messagesCommon",void 0),e([o()],v.prototype,"uiStrings",void 0),e([o({type:l})],v.prototype,"viewModel",void 0),e([o()],v.prototype,"unitOptions",null),e([o()],v.prototype,"unit",null),v=e([r("esri.widgets.DirectLineMeasurement3D")],v);const w=v;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as s,lerp as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as a}from"../../../chunks/vec32.js";import i from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projection.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as h,inverseGeodeticSolver as p,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ProfileGenerationError as g,ProfileGenerationErrorCause as w}from"./ProfileGenerationError.js";async function R(e,t,s,o,a,i,h){let p,m,d;const R=e.spatialReference,v=R.isGeographic||R.isWebMercator;let P=0;if(!v){const{execute:t}=await import("../../../geometry/operators/lengthOperator.js");n(h),P=await t(e,{unit:"meters"}),n(h)}const Z=1/r(o);if(v){await c([{source:R,dest:o},{source:R,dest:l.WGS84}],h);const n=T(e);p=f([n],"meters")[0];const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const v=j(n,t,s);({densifiedPath:m,distances:d}=U(v,r,Z)),m=u(m,o)}else{await c([{source:R,dest:o}],h),p=P;const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const l=j(e,t,s);({densifiedPath:m,distances:d}=A(l,r,Z)),n(h),m=u(m,o)}return{densifiedPath:m,pathLength:p*Z,distances:d}}function y(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function j(e,t,n){if(null==t)return Z(e);const r=e.spatialReference,s=t.mode,o=d(t,r);let a=null;switch(n.type){case"2d":a=v(e,s,o);break;case"3d":a=P(e,s,o,n)}return null==a?Z(e):new i({hasZ:!0,hasM:!1,spatialReference:r,paths:x(e.paths,a)})}function v({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function P({spatialReference:e,hasZ:t},n,r,{elevationProvider:s}){const o=(t,n,r,o)=>s?.getElevation(t,n,r,e,o)??0;switch(n){case"on-the-ground":return([e,t])=>[e,t,o(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+r]:([e,t])=>[e,t,r];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+o(e,t,n,"ground")+r]:([e,t])=>[e,t,o(e,t,0,"ground")+r];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+o(e,t,n,"scene")+r]:([e,t])=>[e,t,o(e,t,0,"scene")+r];default:return null}}function Z(e){return e.hasZ?new i({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:x(e.paths,(([e,t])=>[e,t]))}):e}function x(e,t){const n=e.length,r=new Array(n);for(let s=0;s<n;++s){const n=e[s],o=n.length,a=new Array(n.length);r[s]=a;for(let e=0;e<o;++e)a[e]=t(n[e])}return r}function M(e){return S(e)&&e.paths.length>0&&e.paths.every((e=>e.length>=2))}function S(e){return null!=e&&"polyline"===e.type}function b(t,n,s,o,a){const{spatialReference:c,hasZ:u}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:c,metersPerSR:r(c)},f=[],h=[];let p=0;for(let r=0;r<t.paths.length;++r){const i=t.paths[r],c=new Array,u=new Array;let m=0;for(let t=1;t<i.length;++t){const r=i[t-1],f=i[t],h=o(l,r,f);let d;for(d=m;d<h.distance&&!e(d,h.distance);d+=n)c.push(a(h,d)),u.push((p+d)*s);m=d-h.distance,p+=h.distance,c.push(f),u.push(p*s)}f[r]=c,h[r]=u}return{densifiedPath:new i({spatialReference:c,hasZ:u,paths:f}),distances:h}}function A(e,t,n){const{hasZ:r}=e;return b(e,t,n,G,r?E:C)}function U(e,t,n){const{hasZ:r}=e;return b(e,t,n,z,r?k:W)}function z(e,t,n){return e.distance=0,p(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function G(e,t,n){return e.from=t,e.to=n,e.distance=s(n,t)*e.metersPerSR,e}function W({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function k({from:e,to:n,azimuth:r,distance:s,spatialReference:o},a){const i=a/s,c=[0,0,t(e[2],n[2],i)];return m(c,e,r,a,o),c}function C({from:e,to:t,distance:n},r){return o([0,0],e,t,r/n)}function E({from:e,to:t,distance:n},r){return a([0,0,0],e,t,r/n)}function T(e){return h(e.spatialReference)?e:u(e,l.WGS84)}function D(e){return e.paths.reduce(((e,t)=>e+t.length),0)}function I(e,t,n){return D(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce((e=>1+e),0)-1)}export{D as countPoints,R as densifyPath,S as isPolyline,M as isValidInputPath,j as toAbsoluteHeightElevation};
5
+ import{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as s,lerp as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as a}from"../../../chunks/vec32.js";import i from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projection.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as h,inverseGeodeticSolver as p,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ProfileGenerationError as g,ProfileGenerationErrorCause as w}from"./ProfileGenerationError.js";async function R(e,t,s,o,a,i,h){let p,m,d;const R=e.spatialReference,v=R.isGeographic||R.isWebMercator;let P=0;if(!v){const{execute:t}=await import("../../../geometry/operators/lengthOperator.js");n(h),P=t(e,{unit:"meters"}),n(h)}const Z=1/r(o);if(v){await c([{source:R,dest:o},{source:R,dest:l.WGS84}],h);const n=T(e);p=f([n],"meters")[0];const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const v=j(n,t,s);({densifiedPath:m,distances:d}=U(v,r,Z)),m=u(m,o)}else{await c([{source:R,dest:o}],h),p=P;const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const l=j(e,t,s);({densifiedPath:m,distances:d}=A(l,r,Z)),n(h),m=u(m,o)}return{densifiedPath:m,pathLength:p*Z,distances:d}}function y(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function j(e,t,n){if(null==t)return Z(e);const r=e.spatialReference,s=t.mode,o=d(t,r);let a=null;switch(n.type){case"2d":a=v(e,s,o);break;case"3d":a=P(e,s,o,n)}return null==a?Z(e):new i({hasZ:!0,hasM:!1,spatialReference:r,paths:x(e.paths,a)})}function v({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function P({spatialReference:e,hasZ:t},n,r,{elevationProvider:s}){const o=(t,n,r,o)=>s?.getElevation(t,n,r,e,o)??0;switch(n){case"on-the-ground":return([e,t])=>[e,t,o(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+r]:([e,t])=>[e,t,r];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+o(e,t,n,"ground")+r]:([e,t])=>[e,t,o(e,t,0,"ground")+r];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+o(e,t,n,"scene")+r]:([e,t])=>[e,t,o(e,t,0,"scene")+r];default:return null}}function Z(e){return e.hasZ?new i({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:x(e.paths,(([e,t])=>[e,t]))}):e}function x(e,t){const n=e.length,r=new Array(n);for(let s=0;s<n;++s){const n=e[s],o=n.length,a=new Array(n.length);r[s]=a;for(let e=0;e<o;++e)a[e]=t(n[e])}return r}function M(e){return S(e)&&e.paths.length>0&&e.paths.every((e=>e.length>=2))}function S(e){return null!=e&&"polyline"===e.type}function b(t,n,s,o,a){const{spatialReference:c,hasZ:u}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:c,metersPerSR:r(c)},f=[],h=[];let p=0;for(let r=0;r<t.paths.length;++r){const i=t.paths[r],c=new Array,u=new Array;let m=0;for(let t=1;t<i.length;++t){const r=i[t-1],f=i[t],h=o(l,r,f);let d;for(d=m;d<h.distance&&!e(d,h.distance);d+=n)c.push(a(h,d)),u.push((p+d)*s);m=d-h.distance,p+=h.distance,c.push(f),u.push(p*s)}f[r]=c,h[r]=u}return{densifiedPath:new i({spatialReference:c,hasZ:u,paths:f}),distances:h}}function A(e,t,n){const{hasZ:r}=e;return b(e,t,n,G,r?E:C)}function U(e,t,n){const{hasZ:r}=e;return b(e,t,n,z,r?k:W)}function z(e,t,n){return e.distance=0,p(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function G(e,t,n){return e.from=t,e.to=n,e.distance=s(n,t)*e.metersPerSR,e}function W({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function k({from:e,to:n,azimuth:r,distance:s,spatialReference:o},a){const i=a/s,c=[0,0,t(e[2],n[2],i)];return m(c,e,r,a,o),c}function C({from:e,to:t,distance:n},r){return o([0,0],e,t,r/n)}function E({from:e,to:t,distance:n},r){return a([0,0,0],e,t,r/n)}function T(e){return h(e.spatialReference)?e:u(e,l.WGS84)}function D(e){return e.paths.reduce(((e,t)=>e+t.length),0)}function I(e,t,n){return D(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce((e=>1+e),0)-1)}export{D as countPoints,R as densifyPath,S as isPolyline,M as isValidInputPath,j as toAbsoluteHeightElevation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{watch as t,on as r,initial as i}from"../../../core/reactiveUtils.js";import{stripHTML as s}from"../../../core/string.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultHighlightName as a,temporaryHighlightName as n}from"../../../views/support/HighlightDefaults.js";import d from"../../Widget.js";import c from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as p}from"../../support/componentsUtils.js";import u from"../../support/FilterBuilder.js";import{globalCss as h}from"../../support/globalCss.js";import{Heading as m}from"../../support/Heading.js";import _ from"../../support/SelectionToolbar.js";import"../../support/widgetUtils.js";import{messageBundle as f}from"../../support/decorators/messageBundle.js";import{tsx as g}from"../../support/jsxFactory.js";import v from"../../support/SelectionToolbar/VisibleElements.js";import{fetchMessageBundle as y}from"../../../intl/messages.js";import{substitute as b}from"../../../intl/substitute.js";const F="esri-feature-form-utility-network-association-layers",w={base:F,header:`${F}__header`,headingContent:`${F}__heading-content`,featureObserver:`${F}__feature-observer`,filterContainer:`${F}__filter-container`,filterOptionsContainer:`${F}__filter-options-container`,filterOptionsHeader:`${F}__filter-options-header`,listContainer:`${F}__list-container`,spatialSelectContainer:`${F}__spatial-select-container`,spatialSelectToolbar:`${F}__spatial-select-toolbar`,stickySpinnerContainer:`${F}__sticky-loading-container`,loadingContainer:`${F}__loading-container`};let C=class extends d{constructor(e,t){super(e,t),this.headingLevel=5,this.messagesCommon=null,this.messagesEditor=null,this.messagesFeature=null,this.messagesFeatureForm=null,this.messagesFilterBuilder=null,this.viewModel=new c,this.view=null,this._filterBuilder=new u,this._featureFilterText="",this._layerFilterText="",this._observer=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this._observerNode=null,this._selectionToolbar=new _({layerViewPreferenceEnabled:!1,visibleElements:new v({chip:!1,pan:!1,pointTool:!1})}),this._handleSelectionComplete=async e=>{const{highlightHelper:t}=this.viewModel;await this.viewModel.handleSelectionComplete(e),t?.removeAll(),this._featureSpatialGraphics.length>0&&t?.add(this._featureSpatialGraphics)}}initialize(){this._setupSelectionToolbar(),this.addHandles([t((()=>this.viewModel),(()=>this.reset())),t((()=>[this.viewModel.state,this._observerNode]),(()=>this._onObserverChange())),t((()=>this.selectedLayer),(e=>{this._filterBuilder.layer=e,e||(this.filterOptionsVisible=!1,this._featureFilterText="")}))])}loadDependencies(){return p({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),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"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._filterBuilder.destroy(),this._selectionToolbar.destroy()}get filterOptionsVisible(){return this.viewModel.filterOptionsVisible}set filterOptionsVisible(e){this.viewModel.filterOptionsVisible=e}get selectedLayer(){return this.viewModel.selectedLayer}set selectedLayer(e){this.viewModel.selectedLayer=e}get selectedFeature(){return this.viewModel.selectedFeature}set selectedFeature(e){this.viewModel.selectedFeature=e}get filterWhereClause(){return this.viewModel.filterWhereClause}set filterWhereClause(e){this.viewModel.filterWhereClause=e,e||this._filterBuilder.reset()}get _featureSpatialGraphics(){return this.viewModel.featureSpatialItems.toArray().map((e=>e.feature))}get _filteredFeatureItems(){const{_featureFilterText:e}=this,{featureItems:t,featureSpatialItems:r}=this.viewModel;return(r.length?r:t).map((e=>({label:e.label,graphic:e.feature,layer:e.feature.sourceLayer}))).filter((t=>t.label?.toLowerCase().includes(e)??!1))}get _filteredFeatureItemsPage(){const{featurePage:e,featuresPerPage:t}=this.viewModel,r=e*t;return this._filteredFeatureItems.toArray().slice(0,r)}render(){return g("div",{class:this.classes(w.base,h.widget)},this._renderContent())}applyFilterOptions(){const{selectedLayer:e}=this;this.filterOptionsVisible=!1,e&&(this.filterWhereClause=this._filterBuilder.whereClause)}reset(){this.filterWhereClause=null,this._featureFilterText="",this._layerFilterText="",this.filterOptionsVisible=!1,this._filterBuilder.reset()}_setupSelectionToolbar(){const{_selectionToolbar:e}=this;e.defaultRectangleToolOptions={...e.defaultRectangleToolOptions,persistSelection:!1,selectOnComplete:!0},e.defaultLassoToolOptions={...e.defaultLassoToolOptions,persistSelection:!1,selectOnComplete:!0};const s={createTool:"point",mode:"click",toolName:"",icon:"cursor",toolKey:"point",persistSelection:!1,selectOnComplete:!0};y("esri/widgets/Editor/t9n/Editor").then((t=>{e.toolConfigs=[{...s,toolName:t.selectFeature}]})),this.addHandles([t((()=>this.view),(e=>{this.viewModel.reset(),this._selectionToolbar.view="2d"===e?.type?e:null}),i),t((()=>[this.viewModel,this.viewModel.layerItems.length]),(()=>this._selectionToolbar.sources=this.viewModel.layerItems.toArray())),r((()=>this._selectionToolbar),"complete",this._handleSelectionComplete)])}async _onObserverChange(){this._observerNode&&this._observer.unobserve(this._observerNode);const{state:e}=this.viewModel;this._observerNode&&"ready"===e&&this._observer.observe(this._observerNode)}_increaseFeaturePage(){const{featureCount:e,featurePage:t,featureSpatialItems:r,state:i}=this.viewModel;e||r.length||1===t?"ready"===i&&this.viewModel.featurePage++:this.viewModel.featurePage=1}_renderContent(){const{state:e,filterOptionsVisible:t}=this.viewModel;return"loading"===e?this._renderLoading():t?this._renderFilterOptions():[this._renderSelectionToolbar(),this._renderListContent()]}_renderListContent(){return this._selectionToolbar.activeOperation?.processingFinalSelection?this._renderLoading():this.selectedLayer||this.viewModel.featureSpatialItems.length?this._renderFeatures():this._renderLayers()}_renderSelectionToolbar(){const{messagesCommon:e,_selectionToolbar:t}=this,{featureSpatialItems:r,selectedLayer:i}=this.viewModel;if(i||!t.sources?.length)return null;const s=g("div",{class:w.spatialSelectToolbar},t.render()),o=g("calcite-button",{appearance:"transparent",disabled:!r.length,label:e.clear,onclick:()=>this.viewModel.reset()},e.clear);return g("div",{class:w.spatialSelectContainer,key:"spatial-select-toolbar"},s,o)}_renderStickyLoading(){return"querying"===this.viewModel.state?g("div",{class:w.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoading(){return g("div",{class:w.loadingContainer,key:"loading-container"},this._renderLoadingIcon())}_renderLoadingIcon(){return g("calcite-loader",{inline:!0,label:this.messagesCommon.loading})}_renderFilterOptions(){return g("div",{class:w.filterOptionsContainer},g("div",{class:w.filterOptionsHeader},g("span",null,this.messagesFilterBuilder.widgetLabel),g("calcite-button",{appearance:"transparent",onclick:()=>this._filterBuilder.reset()},this.messagesCommon.clear)),this._filterBuilder.render())}_renderLayers(){const e=this.messagesFeatureForm.associations,t=e.availableLayers,r=e.filterLayers;return g("div",null,this._renderHeader({heading:t,placeholder:r,renderFilterOptions:!1,renderTotal:!1}),g("div",{class:w.listContainer},g("calcite-list",{label:e.associatedFeatures},this._renderLayerItems(),this._renderStickyLoading())))}_renderLayerItems(){const{_layerFilterText:e,viewModel:t,messagesCommon:r}=this,{layerItems:i,tableItems:s}=t;return i.concat(s).map((e=>({label:e.title??r.untitled,layer:e}))).filter((t=>t.label?.toLowerCase().includes(e)??!1)).toArray().map((e=>this._renderLayerItem(e)))}_renderLayerItem(e){const{label:t,layer:r}=e;return g("calcite-list-item",{key:`layer-item-${r.id}`,label:s(t),onCalciteListItemSelect:()=>{this.selectedLayer=r,this._filterBuilder.reset()}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderFeatures(){const{selectedLayer:e,viewModel:t}=this,r=t.featureSpatialItems.length>0,i=this.messagesFeatureForm.associations,s=e?.title??this.messagesCommon.untitled,o=i.filterFeatures;return g("div",null,this._renderHeader({heading:s,placeholder:o,renderFilterOptions:!r,renderTotal:!0}),g("div",{class:w.listContainer},g("calcite-list",{label:i.associatedFeatures},this._renderFeatureItems(),this._renderStickyLoading(),this._renderFeatureObserver())))}_renderFeatureItems(){return this._filteredFeatureItemsPage.map((e=>this._renderFeatureItem(e)))}_renderFeatureItem(e){const{viewModel:t}=this,{highlightHelper:r}=t,{label:i,graphic:o}=e,l=t.featureSpatialItems.length>0?()=>r?.update(o,a):void 0,d=t.featureSpatialItems.length>0?()=>r?.update(o,n):void 0;return g("calcite-list-item",{key:`feature-item-${o.uid}`,label:s(i),onmouseenter:l,onmouseleave:d,onCalciteListItemSelect:()=>{this.selectedFeature={feature:o,label:i}}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_onObserverCreate(e){this._observerNode=e}_renderFeatureObserver(){return g("div",{afterCreate:this._onObserverCreate,bind:this,class:w.featureObserver,key:"feature-observer"})}_renderHeader(e){return g("div",{class:w.header,key:"filter"},this._renderHeading(e.heading),this._renderFilter(e.placeholder,e.renderFilterOptions),e.renderTotal?this._renderTotal():null)}_renderHeading(e){return e?g(m,{key:"title",level:this.headingLevel},g("div",{class:w.headingContent},g("calcite-icon",{icon:"layer"}),e)):null}_renderFilter(e,t){const r=!this.selectedLayer&&!this.viewModel.featureSpatialItems.length,i=r?this._layerFilterText:this._featureFilterText;return g("div",{class:w.filterContainer,key:"filter"},g("calcite-input",{icon:"search",placeholder:e,type:"search",value:i,onCalciteInputInput:e=>{r?this._layerFilterText=e.currentTarget.value.trim().toLowerCase():this._featureFilterText=e.currentTarget.value.trim().toLowerCase()}},t?this._renderFilterOptionsAction():null))}_renderFilterOptionsAction(){const e=this.messagesFeatureForm.associations.filterOptions;return g("calcite-action",{appearance:"transparent",icon:"sliders",indicator:!!this._filterBuilder.whereClause,onclick:()=>{this.viewModel.filterOptionsVisible=!this.viewModel.filterOptionsVisible},scale:"s",slot:"action",text:e,title:e})}_renderTotal(){const{messagesFeature:e,viewModel:t}=this,{featureCount:r,featureSpatialItems:i}=t,s=b(e.numberRecords,{number:i.length?i.length:r});return g("div",{key:"total"},s)}};e([o()],C.prototype,"filterOptionsVisible",null),e([o()],C.prototype,"headingLevel",void 0),e([o(),f("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([o(),f("esri/widgets/Editor/t9n/Editor")],C.prototype,"messagesEditor",void 0),e([o(),f("esri/widgets/Feature/t9n/Feature")],C.prototype,"messagesFeature",void 0),e([o(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],C.prototype,"messagesFeatureForm",void 0),e([o(),f("esri/widgets/support/FilterBuilder/t9n/FilterBuilder")],C.prototype,"messagesFilterBuilder",void 0),e([o()],C.prototype,"selectedLayer",null),e([o({type:c})],C.prototype,"viewModel",void 0),e([o()],C.prototype,"selectedFeature",null),e([o()],C.prototype,"filterWhereClause",null),e([o()],C.prototype,"view",void 0),e([o()],C.prototype,"_filterBuilder",void 0),e([o()],C.prototype,"_featureFilterText",void 0),e([o()],C.prototype,"_layerFilterText",void 0),e([o()],C.prototype,"_observer",void 0),e([o()],C.prototype,"_featureSpatialGraphics",null),e([o()],C.prototype,"_filteredFeatureItems",null),e([o()],C.prototype,"_filteredFeatureItemsPage",null),e([o()],C.prototype,"_observerNode",void 0),C=e([l("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationItemList")],C);const L=C;export{L as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{watch as t,on as i,initial as r}from"../../../core/reactiveUtils.js";import{stripHTML as s}from"../../../core/string.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultHighlightName as a,temporaryHighlightName as n}from"../../../views/support/HighlightDefaults.js";import c from"../../Widget.js";import d from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as p}from"../../support/componentsUtils.js";import u from"../../support/FilterBuilder.js";import{globalCss as h}from"../../support/globalCss.js";import{Heading as m}from"../../support/Heading.js";import _ from"../../support/SelectionToolbar.js";import"../../support/widgetUtils.js";import{messageBundle as f}from"../../support/decorators/messageBundle.js";import{tsx as v}from"../../support/jsxFactory.js";import g from"../../support/SelectionToolbar/VisibleElements.js";import{substitute as y}from"../../../intl/substitute.js";const b="esri-feature-form-utility-network-association-layers",F={base:b,header:`${b}__header`,headingContent:`${b}__heading-content`,featureObserver:`${b}__feature-observer`,filterContainer:`${b}__filter-container`,filterOptionsContainer:`${b}__filter-options-container`,filterOptionsHeader:`${b}__filter-options-header`,listContainer:`${b}__list-container`,spatialSelectContainer:`${b}__spatial-select-container`,spatialSelectToolbar:`${b}__spatial-select-toolbar`,stickySpinnerContainer:`${b}__sticky-loading-container`,loadingContainer:`${b}__loading-container`};let w=class extends c{constructor(e,t){super(e,t),this.headingLevel=5,this.messagesCommon=null,this.messagesEditor=null,this.messagesFeature=null,this.messagesFeatureForm=null,this.messagesFilterBuilder=null,this.viewModel=new d,this.view=null,this._filterBuilder=new u,this._featureFilterText="",this._layerFilterText="",this._observer=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this._observerNode=null,this._selectionToolbar=new _({layerViewPreferenceEnabled:!1,visibleElements:new g({chip:!1,pan:!1})}),this._onSelectionComplete=async e=>{const{highlightHelper:t}=this.viewModel;await this.viewModel.onSelectionComplete(e),t?.removeAll(),this._featureSpatialGraphics.length>0&&t?.add(this._featureSpatialGraphics)}}initialize(){this._setupSelectionToolbar(),this.addHandles([t((()=>this.viewModel),(()=>this.reset())),t((()=>[this.viewModel.state,this._observerNode]),(()=>this._onObserverChange())),t((()=>this.selectedLayer),(e=>{this._filterBuilder.layer=e,e||(this.filterOptionsVisible=!1,this._featureFilterText="")}))])}loadDependencies(){return p({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),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"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._filterBuilder.destroy(),this._selectionToolbar.destroy()}get filterOptionsVisible(){return this.viewModel.filterOptionsVisible}set filterOptionsVisible(e){this.viewModel.filterOptionsVisible=e}get isSelecting(){return"active"===this._selectionToolbar.state}get selectedLayer(){return this.viewModel.selectedLayer}set selectedLayer(e){this.viewModel.selectedLayer=e}get selectedFeature(){return this.viewModel.selectedFeature}set selectedFeature(e){this.viewModel.selectedFeature=e}get filterWhereClause(){return this.viewModel.filterWhereClause}set filterWhereClause(e){this.viewModel.filterWhereClause=e,e||this._filterBuilder.reset()}get _featureSpatialGraphics(){return this.viewModel.featureSpatialItems.toArray().map((e=>e.feature))}get _filteredFeatureItems(){const{_featureFilterText:e}=this,{featureItems:t,featureSpatialItems:i}=this.viewModel;return(i.length?i:t).map((e=>({label:e.label,graphic:e.feature,layer:e.feature.sourceLayer}))).filter((t=>t.label?.toLowerCase().includes(e)??!1))}get _filteredFeatureItemsPage(){const{featurePage:e,featuresPerPage:t}=this.viewModel,i=e*t;return this._filteredFeatureItems.toArray().slice(0,i)}render(){return v("div",{class:this.classes(F.base,h.widget)},this._renderContent())}applyFilterOptions(){const{selectedLayer:e}=this;this.filterOptionsVisible=!1,e&&(this.filterWhereClause=this._filterBuilder.whereClause)}cancelSelection(){this._selectionToolbar.cancel()}reset(){this.filterWhereClause=null,this._featureFilterText="",this._layerFilterText="",this.filterOptionsVisible=!1,this._filterBuilder.reset()}startSelection(e){this._selectionToolbar.activateTool(e)}_setupSelectionToolbar(){const{_selectionToolbar:e}=this;e.defaultRectangleToolOptions={...e.defaultRectangleToolOptions,persistSelection:!1},e.defaultLassoToolOptions={...e.defaultLassoToolOptions,persistSelection:!1},e.defaultPointToolOptions={...e.defaultPointToolOptions,persistSelection:!1},this.addHandles([t((()=>this.view),(e=>{this.viewModel.reset(),this._selectionToolbar.view="2d"===e?.type?e:null}),r),t((()=>[this.viewModel,this.viewModel.layerItems.length]),(()=>this._selectionToolbar.sources=this.viewModel.layerItems.toArray())),i((()=>this._selectionToolbar),"before-activate",(e=>this.emit("before-selection",e))),i((()=>this._selectionToolbar),"complete",this._onSelectionComplete)])}async _onObserverChange(){this._observerNode&&this._observer.unobserve(this._observerNode);const{state:e}=this.viewModel;this._observerNode&&"ready"===e&&this._observer.observe(this._observerNode)}_increaseFeaturePage(){const{featureCount:e,featurePage:t,featureSpatialItems:i,state:r}=this.viewModel;e||i.length||1===t?"ready"===r&&this.viewModel.featurePage++:this.viewModel.featurePage=1}_renderContent(){const{state:e,filterOptionsVisible:t}=this.viewModel;return"loading"===e?this._renderLoading():t?this._renderFilterOptions():[this._renderSelectionToolbar(),this._renderListContent()]}_renderListContent(){return this._selectionToolbar.activeOperation?.processingFinalSelection?this._renderLoading():this.selectedLayer||this.viewModel.featureSpatialItems.length?this._renderFeatures():this._renderLayers()}_renderSelectionToolbar(){const{messagesCommon:e,_selectionToolbar:t}=this,{featureSpatialItems:i,selectedLayer:r}=this.viewModel;if(r||!t.sources?.length)return null;const s=v("div",{class:F.spatialSelectToolbar},t.render()),o=v("calcite-button",{appearance:"transparent",disabled:!i.length,label:e.clear,onclick:()=>this.viewModel.reset()},e.clear);return v("div",{class:F.spatialSelectContainer,key:"spatial-select-toolbar"},s,o)}_renderStickyLoading(){return"querying"===this.viewModel.state?v("div",{class:F.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoading(){return v("div",{class:F.loadingContainer,key:"loading-container"},this._renderLoadingIcon())}_renderLoadingIcon(){return v("calcite-loader",{inline:!0,label:this.messagesCommon.loading})}_renderFilterOptions(){return v("div",{class:F.filterOptionsContainer},v("div",{class:F.filterOptionsHeader},v("span",null,this.messagesFilterBuilder.widgetLabel),v("calcite-button",{appearance:"transparent",onclick:()=>this._filterBuilder.reset()},this.messagesCommon.clear)),this._filterBuilder.render())}_renderLayers(){const e=this.messagesFeatureForm.associations,t=e.availableLayers,i=e.filterLayers;return v("div",null,this._renderHeader({heading:t,placeholder:i,renderFilterOptions:!1,renderTotal:!1}),v("div",{class:F.listContainer},v("calcite-list",{label:e.associatedFeatures},this._renderLayerItems(),this._renderStickyLoading())))}_renderLayerItems(){const{_layerFilterText:e,viewModel:t,messagesCommon:i}=this,{layerItems:r,tableItems:s}=t;return r.concat(s).map((e=>({label:e.title??i.untitled,layer:e}))).filter((t=>t.label?.toLowerCase().includes(e)??!1)).toArray().map((e=>this._renderLayerItem(e)))}_renderLayerItem(e){const{label:t,layer:i}=e;return v("calcite-list-item",{key:`layer-item-${i.id}`,label:s(t),onCalciteListItemSelect:()=>{this.selectedLayer=i,this._filterBuilder.reset()}},v("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderFeatures(){const{selectedLayer:e,viewModel:t}=this,i=t.featureSpatialItems.length>0,r=this.messagesFeatureForm.associations,s=i?void 0:e?.title||this.messagesCommon.untitled,o=r.filterFeatures;return v("div",null,this._renderHeader({heading:s,placeholder:o,renderFilterOptions:!i,renderTotal:!0}),v("div",{class:F.listContainer},v("calcite-list",{label:r.associatedFeatures},this._renderFeatureItems(),this._renderStickyLoading(),this._renderFeatureObserver())))}_renderFeatureItems(){return this._filteredFeatureItemsPage.map((e=>this._renderFeatureItem(e)))}_renderFeatureItem(e){const{viewModel:t}=this,{highlightHelper:i}=t,{label:r,graphic:o}=e,l=t.featureSpatialItems.length>0?()=>i?.update(o,a):void 0,c=t.featureSpatialItems.length>0?()=>i?.update(o,n):void 0;return v("calcite-list-item",{key:`feature-item-${o.uid}`,label:s(r),onmouseenter:l,onmouseleave:c,onCalciteListItemSelect:()=>{this.selectedFeature={feature:o,label:r}}},v("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_onObserverCreate(e){this._observerNode=e}_renderFeatureObserver(){return v("div",{afterCreate:this._onObserverCreate,bind:this,class:F.featureObserver,key:"feature-observer"})}_renderHeader(e){return v("div",{class:F.header,key:"filter"},this._renderHeading(e.heading),this._renderFilter(e.placeholder,e.renderFilterOptions),e.renderTotal?this._renderTotal():null)}_renderHeading(e){return e?v(m,{key:"title",level:this.headingLevel},v("div",{class:F.headingContent},v("calcite-icon",{icon:"layer"}),e)):null}_renderFilter(e,t){const i=!this.selectedLayer&&!this.viewModel.featureSpatialItems.length,r=i?this._layerFilterText:this._featureFilterText;return v("div",{class:F.filterContainer,key:"filter"},v("calcite-input",{icon:"search",placeholder:e,type:"search",value:r,onCalciteInputInput:e=>{i?this._layerFilterText=e.currentTarget.value.trim().toLowerCase():this._featureFilterText=e.currentTarget.value.trim().toLowerCase()}},t?this._renderFilterOptionsAction():null))}_renderFilterOptionsAction(){const e=this.messagesFeatureForm.associations.filterOptions;return v("calcite-action",{appearance:"transparent",icon:"sliders",indicator:!!this._filterBuilder.whereClause,onclick:()=>{this.viewModel.filterOptionsVisible=!this.viewModel.filterOptionsVisible},scale:"s",slot:"action",text:e,title:e})}_renderTotal(){const{messagesFeature:e,viewModel:t}=this,{featureCount:i,featureSpatialItems:r}=t,s=y(e.numberRecords,{number:r.length?r.length:i});return v("div",{key:"total"},s)}};e([o()],w.prototype,"filterOptionsVisible",null),e([o()],w.prototype,"headingLevel",void 0),e([o()],w.prototype,"isSelecting",null),e([o(),f("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([o(),f("esri/widgets/Editor/t9n/Editor")],w.prototype,"messagesEditor",void 0),e([o(),f("esri/widgets/Feature/t9n/Feature")],w.prototype,"messagesFeature",void 0),e([o(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],w.prototype,"messagesFeatureForm",void 0),e([o(),f("esri/widgets/support/FilterBuilder/t9n/FilterBuilder")],w.prototype,"messagesFilterBuilder",void 0),e([o()],w.prototype,"selectedLayer",null),e([o({type:d})],w.prototype,"viewModel",void 0),e([o()],w.prototype,"selectedFeature",null),e([o()],w.prototype,"filterWhereClause",null),e([o()],w.prototype,"view",void 0),e([o()],w.prototype,"_filterBuilder",void 0),e([o()],w.prototype,"_featureFilterText",void 0),e([o()],w.prototype,"_layerFilterText",void 0),e([o()],w.prototype,"_observer",void 0),e([o()],w.prototype,"_featureSpatialGraphics",null),e([o()],w.prototype,"_filteredFeatureItems",null),e([o()],w.prototype,"_filteredFeatureItemsPage",null),e([o()],w.prototype,"_observerNode",void 0),w=e([l("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationItemList")],w);const C=w;export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as l,initial as u}from"../../core/reactiveUtils.js";import{sqlAnd as c}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as d}from"../../layers/catalog/catalogUtils.js";import{isSubtypeGroupLayer as g,isKnowledgeGraphLayer as _,isMapImageLayer as m,isSubtypeSublayer as f}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as b}from"../Feature/support/featureUtils.js";import{createAssociation as C}from"../support/UtilityNetworkAssociations/utils/createAssociation.js";import{getFeatureTitle as F}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";const A=100,q="association-key";let w=class extends r{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this.featureSpatialItems=new o,this.highlightHelper=null,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._queryFeaturesTask=null,this._updatingHandlesQueryFeatures=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._featureIsNotSelected=e=>(this.globalIdField?e.attributes?.[this.globalIdField]??null:null)!==this.globalId,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await i(this._queryFeatureCount(e)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,A),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,A),this._queryPageDebounced=n(this._queryPageController,A)}initialize(){this.addHandles([l((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),u),l((()=>[this.selectedLayer,this.filterWhereClause,this.featuresPerPage]),(()=>{this.selectedLayer&&this._setUpFeatures()})),l((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),l((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._queryFeaturesTask=a(this._queryFeaturesTask),this._updatingHandlesQueryFeatures.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapTables(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allTables.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get mapLayers(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allLayers.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get state(){const{canLoadLayers:e,_queryAbortController:t,_queryPageAbortController:r}=this;return e?t||r||this._updatingHandlesQueryFeatures.updating?"querying":this._updatingHandlesSetUp.updating?"loading":"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get("layerItems")||new o}get tableItems(){return this._get("tableItems")||new o}get featureItems(){return this._get("featureItems")||new o}set featurePage(e){const{featuresPerPage:t,featureCount:r,featureSpatialItems:s}=this,o=s.length||r,a=1,i=Math.ceil(o/t)||1;this._set("featurePage",Math.min(Math.max(e,a),i))}get featurePage(){return this._get("featurePage")}get canLoadLayers(){const{map:e,utilityNetwork:t,graphic:r,associationType:s}=this;return!!(e&&t&&r&&s)}get canQuery(){const{utilityNetwork:e,graphic:t,associationType:r,selectedLayer:s}=this;return!!(e&&t&&r&&s)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",e)}get queryWhereClause(){const{_whereClause:e,filterWhereClause:t}=this;return c(e,t)}async handleSelectionComplete(e){const{associationType:t,featureSpatialItems:r,graphic:s,_rulesTable:o}=this,{selection:a}=e;if(r.removeAll(),!(t&&s&&o&&a?.length))return;const i=this._convertTypeToDirection(t.type),n=a.filter(this._featureIsNotSelected),l=o.getFeaturesCanAssociateWith(s,n,i),u=await this._processFeatures(l);r.addMany(u)}reset(){this.highlightHelper?.removeAll(),this.featureSpatialItems.removeAll(),this.featurePage=1}_collectIfValidLayer(e,t){b(e)&&!g(e)&&t.add(e)}_collectIfValidParent(e,t){const r=e=>this._collectIfValidLayer(e,t);d(e)||"catalog-footprint"===e.type||(_(e)?(e.layers?.forEach(r),e.tables?.forEach(r)):m(e)?(e.sublayers?.forEach(r),e.subtables?.forEach(r)):g(e)?e.sublayers?.forEach(r):this._collectIfValidLayer(e,t))}async _queryFeatureCount(e){const{selectedLayer:t,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!t)return;await t.load();const s=t.createQuery();s.returnGeometry=!1,s.where=c(s.where,e);const o=await t.queryFeatureCount(s,{signal:r?.signal});o>0&&this._set("featureCount",o)}async _query(){const{canQuery:e,queryWhereClause:t,_queryAbortController:r,featureItems:s}=this;e&&(this.featurePage=1,s.destroyAll(),this.featureCount&&!this.destroyed&&s.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}async _queryPage(){const{canQuery:e,queryWhereClause:t,featurePage:r,_queryPageAbortController:s,featureCount:o,featureItems:a}=this;e&&(r<2||!o||a.addMany(await this._queryAssociatedFeatures(t,{signal:s?.signal})))}_convertTypeToDirection(e){switch(e){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;const t=await e.getRulesTable();return await(t?.load()),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:e,associationType:t,layerItems:r,tableItems:o,canLoadLayers:i}=this,n=s((async s=>{if(this.selectedLayer=null,r.removeAll(),o.removeAll(),!i)return;const a=this.mapLayers?.toArray(),n=this.mapTables?.toArray();if(!a&&!n)return;if(s.aborted)return;const l=await this.getRulesTable(),u=this._convertTypeToDirection(t.type);if(a?.length){const t=l?.getLayersCanAssociateWith(e,a,u);if(s.aborted)return;r.addMany(t||[])}if(n?.length){const t=l?.getLayersCanAssociateWith(e,n,u);if(s.aborted)return;o.addMany(t||[])}}));this._updatingHandlesSetUp.addPromise(n.promise),this._setUpItemsTask=n}async _setUpFeatures(){a(this._queryFeaturesTask);const{graphic:e,associationType:t,selectedLayer:r,canQuery:o}=this;if(!o)return;const i=s((async s=>{const o=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),i=o?.getFeaturesCanAssociateWithClause(e,r,a);this._whereClause=i,s.aborted||(await this._queryFeatureCountDebounced(this.queryWhereClause),await this._queryDebounced())}));this._updatingHandlesQueryFeatures.addPromise(i.promise),this._queryFeaturesTask=i}_determineFromAndTo(e,t,r){return"from"===r?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){const{utilityNetwork:r}=this,s=f(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer,o=f(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer;if(!(r&&s&&"layerId"in s&&o&&"layerId"in o))return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(s.layerId),i=r.getSourceIdByLayerId(o.layerId);if(!a||!i)return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),l="junction"===r.getSourceTypeById(i);return n&&l?{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"}:l?{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}:{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}}_setUpAssociationHandles(){this.removeHandles(q),this.association&&this.addHandles(l((()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId]),(()=>this.validateAssociation()),u),q)}_setUpAssociation(){const{utilityNetwork:e,graphic:t,selectedFeature:r,associationType:s}=this;if(!(e&&t&&r&&s))return void(this.association=null);const o=this._convertTypeToDirection(s.type);if(o.length>1){const{fromFeature:s,toFeature:o,type:a}=this._determineJunctionEdgeConnectivity(t,r.feature);return this.association=C({fromFeature:s,toFeature:o,utilityNetwork:e,associationType:a}),void this._setUpAssociationHandles()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(t,r.feature,o[0].direction);this.association=C({fromFeature:a,toFeature:i,utilityNetwork:e,associationType:o[0].type}),this._setUpAssociationHandles()}async _processFeatures(e){return Promise.all(e.map((async e=>{const{sourceLayer:t}=e;if(t&&"getFeatureTitle"in t){return{label:await t.getFeatureTitle(e)||F(e),feature:e}}return{label:F(e),feature:e}})))}async _queryAssociatedFeatures(e,t){const{featuresPerPage:r,layer:s,featurePage:o,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:l}=this;if(!n||!s||!i||null==l)return[];const u=((o-1)*r+a)%a,y=r,{historicMoment:h,gdbVersion:p}=i,d=i.createQuery();d.where=c(d.where,e),d.start=u,d.num=y,d.returnGeometry=!1,d.historicMoment=h,d.gdbVersion=p,d.outFields=["*"];const g=await i.queryFeatures(d,{signal:t?.signal});return await this._processFeatures(g.features)}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:e,association:t}=this,r=s((async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};e([y({type:t})],w.prototype,"graphic",void 0),e([y()],w.prototype,"layer",void 0),e([y()],w.prototype,"map",void 0),e([y({readOnly:!0})],w.prototype,"mapTables",null),e([y({readOnly:!0})],w.prototype,"mapLayers",null),e([y()],w.prototype,"utilityNetwork",void 0),e([y()],w.prototype,"associationType",void 0),e([y()],w.prototype,"state",null),e([y({readOnly:!0})],w.prototype,"canAddAssociation",null),e([y({readOnly:!0})],w.prototype,"globalId",null),e([y({readOnly:!0})],w.prototype,"globalIdField",null),e([y()],w.prototype,"featureCount",void 0),e([y({readOnly:!0})],w.prototype,"layerItems",null),e([y({readOnly:!0})],w.prototype,"tableItems",null),e([y({readOnly:!0})],w.prototype,"featureItems",null),e([y()],w.prototype,"featureSpatialItems",void 0),e([y()],w.prototype,"highlightHelper",void 0),e([y()],w.prototype,"_queryAbortController",void 0),e([y()],w.prototype,"_queryPageAbortController",void 0),e([y()],w.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],w.prototype,"featurePage",null),e([y()],w.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],w.prototype,"canLoadLayers",null),e([y({readOnly:!0})],w.prototype,"canQuery",null),e([y({readOnly:!0})],w.prototype,"updating",null),e([y()],w.prototype,"selectedLayer",null),e([y()],w.prototype,"selectedFeature",void 0),e([y()],w.prototype,"association",void 0),e([y()],w.prototype,"filterOptionsVisible",void 0),e([y()],w.prototype,"filterWhereClause",void 0),e([y()],w.prototype,"queryWhereClause",null),e([y()],w.prototype,"_rulesTable",void 0),e([y()],w.prototype,"_canAssociate",void 0),e([y()],w.prototype,"_whereClause",void 0),w=e([h("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],w);export{w as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as l,initial as u}from"../../core/reactiveUtils.js";import{sqlAnd as c}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as d}from"../../layers/catalog/catalogUtils.js";import{isSubtypeGroupLayer as g,isKnowledgeGraphLayer as _,isMapImageLayer as m,isSubtypeSublayer as f}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as b}from"../Feature/support/featureUtils.js";import{createAssociation as C}from"../support/UtilityNetworkAssociations/utils/createAssociation.js";import{getFeatureTitle as F}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";const A=100,q="association-key";let w=class extends r{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this.featureSpatialItems=new o,this.highlightHelper=null,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._queryFeaturesTask=null,this._updatingHandlesQueryFeatures=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._featureIsNotSelected=e=>(this.globalIdField?e.attributes?.[this.globalIdField]??null:null)!==this.globalId,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await i(this._queryFeatureCount(e)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,A),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,A),this._queryPageDebounced=n(this._queryPageController,A)}initialize(){this.addHandles([l((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),u),l((()=>[this.selectedLayer,this.filterWhereClause,this.featuresPerPage]),(()=>{this.selectedLayer&&this._setUpFeatures()})),l((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),l((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._queryFeaturesTask=a(this._queryFeaturesTask),this._updatingHandlesQueryFeatures.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapTables(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allTables.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get mapLayers(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allLayers.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get state(){const{canLoadLayers:e,_queryAbortController:t,_queryPageAbortController:r}=this;return e?t||r||this._updatingHandlesQueryFeatures.updating?"querying":this._updatingHandlesSetUp.updating?"loading":"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get("layerItems")||new o}get tableItems(){return this._get("tableItems")||new o}get featureItems(){return this._get("featureItems")||new o}set featurePage(e){const{featuresPerPage:t,featureCount:r,featureSpatialItems:s}=this,o=s.length||r,a=1,i=Math.ceil(o/t)||1;this._set("featurePage",Math.min(Math.max(e,a),i))}get featurePage(){return this._get("featurePage")}get canLoadLayers(){const{map:e,utilityNetwork:t,graphic:r,associationType:s}=this;return!!(e&&t&&r&&s)}get canQuery(){const{utilityNetwork:e,graphic:t,associationType:r,selectedLayer:s}=this;return!!(e&&t&&r&&s)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",e)}get queryWhereClause(){const{_whereClause:e,filterWhereClause:t}=this;return c(e,t)}async onSelectionComplete(e){const{associationType:t,featureSpatialItems:r,graphic:s,_rulesTable:o}=this,{selection:a}=e;if(r.removeAll(),!(t&&s&&o&&a?.length))return;const i=this._convertTypeToDirection(t.type),n=a.filter(this._featureIsNotSelected),l=o.getFeaturesCanAssociateWith(s,n,i),u=await this._processFeatures(l);r.addMany(u)}reset(){this.highlightHelper?.removeAll(),this.featureSpatialItems.removeAll(),this.featurePage=1}_collectIfValidLayer(e,t){b(e)&&!g(e)&&t.add(e)}_collectIfValidParent(e,t){const r=e=>this._collectIfValidLayer(e,t);d(e)||"catalog-footprint"===e.type||(_(e)?(e.layers?.forEach(r),e.tables?.forEach(r)):m(e)?(e.sublayers?.forEach(r),e.subtables?.forEach(r)):g(e)?e.sublayers?.forEach(r):this._collectIfValidLayer(e,t))}async _queryFeatureCount(e){const{selectedLayer:t,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!t)return;await t.load();const s=t.createQuery();s.returnGeometry=!1,s.where=c(s.where,e);const o=await t.queryFeatureCount(s,{signal:r?.signal});o>0&&this._set("featureCount",o)}async _query(){const{canQuery:e,queryWhereClause:t,_queryAbortController:r,featureItems:s}=this;e&&(this.featurePage=1,s.destroyAll(),this.featureCount&&!this.destroyed&&s.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}async _queryPage(){const{canQuery:e,queryWhereClause:t,featurePage:r,_queryPageAbortController:s,featureCount:o,featureItems:a}=this;e&&(r<2||!o||a.addMany(await this._queryAssociatedFeatures(t,{signal:s?.signal})))}_convertTypeToDirection(e){switch(e){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;const t=await e.getRulesTable();return await(t?.load()),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:e,associationType:t,layerItems:r,tableItems:o,canLoadLayers:i}=this,n=s((async s=>{if(this.selectedLayer=null,r.removeAll(),o.removeAll(),!i)return;const a=this.mapLayers?.toArray(),n=this.mapTables?.toArray();if(!a&&!n)return;if(s.aborted)return;const l=await this.getRulesTable(),u=this._convertTypeToDirection(t.type);if(a?.length){const t=l?.getLayersCanAssociateWith(e,a,u);if(s.aborted)return;r.addMany(t||[])}if(n?.length){const t=l?.getLayersCanAssociateWith(e,n,u);if(s.aborted)return;o.addMany(t||[])}}));this._updatingHandlesSetUp.addPromise(n.promise),this._setUpItemsTask=n}async _setUpFeatures(){a(this._queryFeaturesTask);const{graphic:e,associationType:t,selectedLayer:r,canQuery:o}=this;if(!o)return;const i=s((async s=>{const o=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),i=o?.getFeaturesCanAssociateWithClause(e,r,a);this._whereClause=i,s.aborted||(await this._queryFeatureCountDebounced(this.queryWhereClause),await this._queryDebounced())}));this._updatingHandlesQueryFeatures.addPromise(i.promise),this._queryFeaturesTask=i}_determineFromAndTo(e,t,r){return"from"===r?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){const{utilityNetwork:r}=this,s=f(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer,o=f(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer;if(!(r&&s&&"layerId"in s&&o&&"layerId"in o))return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(s.layerId),i=r.getSourceIdByLayerId(o.layerId);if(!a||!i)return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),l="junction"===r.getSourceTypeById(i);return n&&l?{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"}:l?{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}:{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}}_setUpAssociationHandles(){this.removeHandles(q),this.association&&this.addHandles(l((()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId]),(()=>this.validateAssociation()),u),q)}_setUpAssociation(){const{utilityNetwork:e,graphic:t,selectedFeature:r,associationType:s}=this;if(!(e&&t&&r&&s))return void(this.association=null);const o=this._convertTypeToDirection(s.type);if(o.length>1){const{fromFeature:s,toFeature:o,type:a}=this._determineJunctionEdgeConnectivity(t,r.feature);return this.association=C({fromFeature:s,toFeature:o,utilityNetwork:e,associationType:a}),void this._setUpAssociationHandles()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(t,r.feature,o[0].direction);this.association=C({fromFeature:a,toFeature:i,utilityNetwork:e,associationType:o[0].type}),this._setUpAssociationHandles()}async _processFeatures(e){return Promise.all(e.map((async e=>{const{sourceLayer:t}=e;if(t&&"getFeatureTitle"in t){return{label:await t.getFeatureTitle(e)||F(e),feature:e}}return{label:F(e),feature:e}})))}async _queryAssociatedFeatures(e,t){const{featuresPerPage:r,layer:s,featurePage:o,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:l}=this;if(!n||!s||!i||null==l)return[];const u=((o-1)*r+a)%a,y=r,{historicMoment:h,gdbVersion:p}=i,d=i.createQuery();d.where=c(d.where,e),d.start=u,d.num=y,d.returnGeometry=!1,d.historicMoment=h,d.gdbVersion=p,d.outFields=["*"];const g=await i.queryFeatures(d,{signal:t?.signal});return await this._processFeatures(g.features)}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:e,association:t}=this,r=s((async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};e([y({type:t})],w.prototype,"graphic",void 0),e([y()],w.prototype,"layer",void 0),e([y()],w.prototype,"map",void 0),e([y({readOnly:!0})],w.prototype,"mapTables",null),e([y({readOnly:!0})],w.prototype,"mapLayers",null),e([y()],w.prototype,"utilityNetwork",void 0),e([y()],w.prototype,"associationType",void 0),e([y()],w.prototype,"state",null),e([y({readOnly:!0})],w.prototype,"canAddAssociation",null),e([y({readOnly:!0})],w.prototype,"globalId",null),e([y({readOnly:!0})],w.prototype,"globalIdField",null),e([y()],w.prototype,"featureCount",void 0),e([y({readOnly:!0})],w.prototype,"layerItems",null),e([y({readOnly:!0})],w.prototype,"tableItems",null),e([y({readOnly:!0})],w.prototype,"featureItems",null),e([y()],w.prototype,"featureSpatialItems",void 0),e([y()],w.prototype,"highlightHelper",void 0),e([y()],w.prototype,"_queryAbortController",void 0),e([y()],w.prototype,"_queryPageAbortController",void 0),e([y()],w.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],w.prototype,"featurePage",null),e([y()],w.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],w.prototype,"canLoadLayers",null),e([y({readOnly:!0})],w.prototype,"canQuery",null),e([y({readOnly:!0})],w.prototype,"updating",null),e([y()],w.prototype,"selectedLayer",null),e([y()],w.prototype,"selectedFeature",void 0),e([y()],w.prototype,"association",void 0),e([y()],w.prototype,"filterOptionsVisible",void 0),e([y()],w.prototype,"filterWhereClause",void 0),e([y()],w.prototype,"queryWhereClause",null),e([y()],w.prototype,"_rulesTable",void 0),e([y()],w.prototype,"_canAssociate",void 0),e([y()],w.prototype,"_whereClause",void 0),w=e([h("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],w);export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../core/screenUtils.js";import{isWidthAndHeight as i}from"./utils.js";import{attachToNode as t}from"../../support/styleUtils.js";import"../../../support/widgetUtils.js";import{tsx as s}from"../../../support/jsxFactory.js";const n="#ddd",o=window.devicePixelRatio,a="esri-spike-ramp",p={spikeRampContainer:`${a}__container`,spikeRampPreviewContainer:`${a}__preview-container`,spikeRampPreview:`${a}__preview`,spikeRampSymbolPreview:`${a}__symbol-preview`,spikeRampLines:`${a}__lines`,spikeRampLabelsContainer:`${a}__labels-container`,spikeRampLabel:`${a}__label`};function r(e){return 5!==e.infos.length?null:s("div",{class:p.spikeRampContainer},s("div",{class:p.spikeRampPreviewContainer},l(e),m(e)),d(e))}function l(e){const[i,n,o]=h(e).map((({preview:e})=>{if(!e)return null;const i=e.cloneNode(!0);return i.classList.add(p.spikeRampSymbolPreview),i}));return i&&n&&o?s("div",{class:p.spikeRampPreview},s("div",{afterCreate:t,bind:o}),s("div",{afterCreate:t,bind:n}),s("div",{afterCreate:t,bind:i})):null}function m(a){const[{width:r,height:l},{width:m},{width:d,height:c}]=h(a).map((({size:t})=>i(t)?{width:e(t.width),height:e(t.height)}:{width:0,height:0})),v=10,b=r+m+d+3*v,u=l,w=document.createElement("canvas");w.width=(b+v)*o,w.height=u*o,w.style.width=w.width/o+"px",w.style.height=w.height/o+"px";const k=w.getContext("2d");k.beginPath();const f=b-(r/2+v),R=4,g=b,_=4;k.moveTo(f*o,R*o),k.lineTo(g*o,_*o);const y=b/2,C=(l-c)/2,L=b,x=(l-c)/2;k.moveTo(y*o,C*o),k.lineTo(L*o,x*o);const P=d/2,$=u-c,j=b,T=u-c;return k.moveTo(P*o,$*o),k.lineTo(j*o,T*o),k.strokeStyle=n,k.lineWidth=.5*o,k.stroke(),s("div",{afterCreate:t,bind:w,class:p.spikeRampLines})}function d(t){const[{label:n,height:o},{label:a},{label:r,height:l}]=h(t).map((({label:t,size:s})=>({label:t,height:i(s)?e(s.height):0}))),m=o-l,d={position:"absolute",top:"0"},c={position:"absolute",top:m/2+"px"},v={position:"absolute",top:`${m}px`};return s("div",{class:p.spikeRampLabelsContainer},s("div",{class:p.spikeRampLabel,styles:d},n),s("div",{class:p.spikeRampLabel,styles:c},a),s("div",{class:p.spikeRampLabel,styles:v},r))}function h(e){return e.infos.filter(((e,i)=>i%2==0))}export{r as renderSpikeRamp};
5
+ import{pt2px as e}from"../../../../core/screenUtils.js";import{isWidthAndHeight as i}from"./utils.js";import{attachToNode as t}from"../../support/styleUtils.js";import"../../../support/widgetUtils.js";import{tsx as s}from"../../../support/jsxFactory.js";const n="#ddd",o=window.devicePixelRatio,a="esri-spike-ramp",p={spikeRampContainer:`${a}__container`,spikeRampPreviewContainer:`${a}__preview-container`,spikeRampPreview:`${a}__preview`,spikeRampSymbolPreview:`${a}__symbol-preview`,spikeRampLines:`${a}__lines`,spikeRampLabelsContainer:`${a}__labels-container`,spikeRampLabel:`${a}__label`};function r(e){return 5!==e.infos.length?null:s("div",{class:p.spikeRampContainer},s("div",{class:p.spikeRampPreviewContainer},l(e),m(e)),d(e))}function l(e){const[i,n,o]=h(e).map((({preview:e})=>{if(!e)return null;const i=e.cloneNode(!0);return i.classList.add(p.spikeRampSymbolPreview),i}));return i&&n&&o?s("div",{class:p.spikeRampPreview},s("div",{afterCreate:t,bind:o}),s("div",{afterCreate:t,bind:n}),s("div",{afterCreate:t,bind:i})):null}function m(a){const[{width:r,height:l},{width:m},{width:d,height:c}]=h(a).map((({size:t})=>i(t)?{width:e(t.width),height:e(t.height)}:{width:0,height:0})),v=10,b=r+m+d+3*v,u=l,w=document.createElement("canvas");w.width=(b+v)*o,w.height=u*o,w.style.width=w.width/o+"px",w.style.height=w.height/o+"px";const k=w.getContext("2d");k.beginPath();const f=b-(r/2+v),R=0,g=b,_=0;k.moveTo(f*o,R*o),k.lineTo(g*o,_*o);const y=b/2,C=(l-c)/2,L=b,x=(l-c)/2;k.moveTo(y*o,C*o),k.lineTo(L*o,x*o);const P=d/2,$=u-c,j=b,T=u-c;return k.moveTo(P*o,$*o),k.lineTo(j*o,T*o),k.strokeStyle=n,k.lineWidth=.5*o,k.stroke(),s("div",{afterCreate:t,bind:w,class:p.spikeRampLines})}function d(t){const[{label:n,height:o},{label:a},{label:r,height:l}]=h(t).map((({label:t,size:s})=>({label:t,height:i(s)?e(s.height):0}))),m=o-l,d={position:"absolute",top:"0"},c={position:"absolute",top:m/2+"px"},v={position:"absolute",top:`${m}px`};return s("div",{class:p.spikeRampLabelsContainer},s("div",{class:p.spikeRampLabel,styles:d},n),s("div",{class:p.spikeRampLabel,styles:c},a),s("div",{class:p.spikeRampLabel,styles:v},r))}function h(e){return e.infos.filter(((e,i)=>i%2==0))}export{r as renderSpikeRamp};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Color.js";import{getColorLuminance as t}from"../../../core/colorUtils.js";import{round as l,numDigits as i,percentChange as o}from"../../../renderers/support/numberUtils.js";import{updateReferenceSizeSymbol as s}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import{getSpikeSymbolBaseWidth as n,updateSpikeSymbol as r}from"../../../smartMapping/renderers/support/spikeUtils.js";import a from"../../../symbols/SimpleLineSymbol.js";import u from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as c}from"../../../symbols/support/cimSymbolUtils.js";import{isSymbol3D as m}from"../../../symbols/support/typeUtils.js";import{isVolumetricSymbol as p,getSymbolOutlineSize as f}from"../../../symbols/support/utils.js";import{getAuthoringInfoVisualVariableByTheme as y,getSymbolForFlowRenderer as b,createStopLabel as h}from"./utils.js";import"../../support/widgetUtils.js";import{isDarkMode as d}from"../../../support/modeUtils.js";const g=30,w=12,S=24,v=10,z=[255,255,255],k=[200,200,200],j=[128,128,128],V=20,x=5;function I(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function U(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function M(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function C(e){return"esri.symbols.TextSymbol"===e.declaredClass}function L(e,t){const l=e.length-1;return e.map(((e,i)=>h(e,i,l,t)))}async function D(e,t,i,o,s,r,a){const u=t.legendOptions,c=u?.customValues,m=a||await E(e,i),b=t.stops,h=!!m,d=!!c,g=null!=t.minSize&&null!=t.maxSize,w=b&&b.length>1,z=!!t.target;if(!h||!d&&!(g||w&&!z))return;const k=p(m);let j=!1,V=null,x=null;V=k&&!w?l([t.minDataValue,t.maxDataValue]):c??await O(t,m,o,s?.type);const I=e?.authoringInfo,U="univariate-color-size"===I?.type,M=U&&"above-and-below"===I?.univariateTheme,C=!!y(e,"reference-size"),D=!!y(e,"spike");if(!V&&w&&(V=b.map((e=>e.value)),j=b.some((e=>!!e.label)),"flow"===e.type&&(V=l(V)),j&&(x=b.map((e=>e.label)))),k&&null!=V&&V?.length>2&&!M&&(V=[V[0],V[V.length-1]]),!V)return null;U&&5!==V?.length&&(V=A({minSize:V[0],maxSize:V[V.length-1]}));const q=k?T(e,V):null,B=f(m),P=j?null:L(V,r);return(await Promise.all(V.map((async(l,i)=>{let r=k?q[i]:await J(t,m,l,o,s?.type),a=r;C&&(r*=S/t.maxSize||1,a=S),D&&"cim"===m.type&&(a={width:n(m)??v,height:r});return{value:l,symbol:K(m,r,e,i),label:j?x[i]:P[i],size:a,outlineSize:B}})))).reverse()}function T(e,t){const l=e?.authoringInfo,i="univariate-color-size"===l?.type;let o=[w,g];if(i){const e=t[0],l=t[t.length-1],i=w,s=g;o=t.map((t=>i+(t-e)/(l-e)*(s-i)))}return i&&"below"===l?.univariateTheme&&o.reverse(),o}function q(t,l,i,o){const n="class-breaks"===t.type,r=n?t.classBreakInfos?.[0]?.symbol?.clone():t.uniqueValueInfos?.[0]?.symbol?.clone();return r&&"type"in r&&"cim"===r.type?(s(r,{color:o??(n?null:new e(k)),innerDotSize:l*(S/i)||1,outerRingSize:S}),r):null}function B(e,t){const l=e.classBreakInfos,i=l.length,o=i<2||!(t>=2)?l[0].symbol.clone():l[i-1].symbol.clone(),s=e.visualVariables?.some((e=>"color"===e.type));return s&&(o.type.includes("3d")?R(o):H(o)),o}async function E(l,i){if("flow"===l.type)return b(l,i);if("pie-chart"===l.type)return new u({color:null,outline:l.outline?.width?l.outline:new a});let o=null,n=null;if("simple"===l.type)o=l.symbol;else if("class-breaks"===l.type){const e=l.classBreakInfos;o=e&&e[0]&&e[0].symbol,n=e.length>1}else if("unique-value"===l.type){const e=l.uniqueValueInfos;o=e?.[0]?.symbol,n=null!=e&&e.length>1}if(!o||P(o))return null;if(o=o.clone(),i||n)if(o.type.includes("3d"))R(o);else if(y(l,"reference-size")&&"cim"===o.type)s(o,{color:i??("class-breaks"!==l.type?new e(k):null)});else if(y(l,"spike")&&"cim"===o.type){const s=new e(k);let n,a=i??void 0;if(a){const e=t(a),l=d();if(!l&&e>225||l&&e<25){const e="CIMPointSymbol"===o.data.symbol?.type?o.data.symbol.symbolLayers:null,t=e?.some((e=>"CIMSolidFill"===e?.type));t?a=s:n=s}}else a="class-breaks"!==l.type?s:void 0;r(o,{color:a,strokeColor:n})}else H(o);return o}function P(e){return m(e)?e.symbolLayers?.some((e=>"fill"===e?.type))??!1:e?.type.includes("fill")??!1}function R(e){"line-3d"===e.type?e.symbolLayers.forEach((e=>{e.material={color:j}})):e.symbolLayers.forEach((e=>{"icon"!==e.type||e.resource?.href?e.material={color:k}:(e.material={color:z},e.outline={color:j,size:1.5})}))}function H(t){const l=d();if("cim"===t.type)c(t,new e(k));else if(t.type.includes("line"))t.color=j;else if(t.color=l?j:z,"simple-marker"===t.type)if(t.outline){const e=t.outline?.color?.toHex();"#ffffff"===e&&(t.outline.color=j)}else t.outline={color:j,width:1.5}}async function O(e,t,i,o){const s=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSizeRangeAtScale(e,i,o),n=s&&A(s);if(!s||!n)return;let r=n.map((t=>F(t,e,s)));r=l(r);for(let l=1;l<r.length-1;l++){const s=await G(e,t,r[l],r[l-1],i,o);s&&(r[l]=s[0],n[l]=s[1])}return r}function A(e){const t=e.minSize,l=e.maxSize,i=x,o=(l-t)/(i-1),s=[];for(let n=0;n<i;n++)s.push(t+o*n);return s}function F(e,t,l){const i=l.minSize,o=l.maxSize,s=t.minDataValue,n=t.maxDataValue;let r;if(e<=i)r=s;else if(e>=o)r=n;else{r=(e-i)/(o-i)*(n-s)+s}return r}async function G(e,t,s,n,r,a){const u=await J(e,t,s,r,a),c=await J(e,t,n,r,a),m=i(s),p=m.fractional,f=V;let y=m.integer,b=null,h=null;s>0&&s<1&&(b=10**p,y=i(s*=b).integer);for(let i=y-1;i>=0;i--){const n=10**i;let m=Math.floor(s/n)*n,p=Math.ceil(s/n)*n;null!=b&&(m/=b,p/=b);let y=(m+p)/2;[,y]=l([m,y,p],{indexes:[1]});const d=await J(e,t,m,r,a),g=await J(e,t,p,r,a),w=await J(e,t,y,r,a),S=o(u,d,c,null),v=o(u,g,c,null),z=o(u,w,c,null);let k=S.previous<=f,j=v.previous<=f;if(k&&j&&(S.previous<=v.previous?(k=!0,j=!1):(j=!0,k=!1)),k?h=[m,d]:j?h=[p,g]:z.previous<=f&&(h=[y,w]),h)break}return h}async function J(e,t,l,i,o){const{getSize:s}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return s(e,l,{scale:i,view:o,shape:"simple-marker"===t.type?t.style:null})}function K(e,t,l,i){"univariate-color-size"===l?.authoringInfo?.type&&"above-and-below"===l?.authoringInfo?.univariateTheme&&"class-breaks"===l.type&&(e=B(l,i));const o=e.clone();if(m(o))p(o)||o.symbolLayers.forEach((e=>{"fill"!==e.type&&(e.size=t)}));else if(I(o))o.size=t;else if(U(o)){const e=o.width,l=o.height;o.height=t,o.width=t*(e/l)}else M(o)?o.width=t:C(o)?o.font&&(o.font.size=t):"cim"===o.type&&y(l,"reference-size")?s(o,{innerDotSize:t,outerRingSize:S}):"cim"===o.type&&y(l,"spike")&&r(o,{defaultHeight:t,primitiveOverrides:null});return o}export{D as getRampStops,q as getReferenceSizeSymbol,g as realWorldMaxSize,w as realWorldMinSize};
5
+ import e from"../../../Color.js";import{getColorLuminance as t}from"../../../core/colorUtils.js";import{round as l,numDigits as i,percentChange as o}from"../../../renderers/support/numberUtils.js";import{updateReferenceSizeSymbol as s}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import{updateSpikeSymbol as n}from"../../../smartMapping/renderers/support/spikeUtils.js";import r from"../../../symbols/SimpleLineSymbol.js";import a from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as u}from"../../../symbols/support/cimSymbolUtils.js";import{getCIMSymbolPreviewSize as c}from"../../../symbols/support/previewCIMSymbol.js";import{isSymbol3D as m}from"../../../symbols/support/typeUtils.js";import{isVolumetricSymbol as p,getSymbolOutlineSize as f}from"../../../symbols/support/utils.js";import{getAuthoringInfoVisualVariableByTheme as y,getSymbolForFlowRenderer as b,createStopLabel as d}from"./utils.js";import"../../support/widgetUtils.js";import{isDarkMode as h}from"../../../support/modeUtils.js";const w=30,S=12,g=24,v=[255,255,255],z=[200,200,200],k=[128,128,128],j=20,I=5;function V(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function x(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function M(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function U(e){return"esri.symbols.TextSymbol"===e.declaredClass}function C(e,t){const l=e.length-1;return e.map(((e,i)=>d(e,i,l,t)))}async function L(e,t,i,o,s,n,r){const a=t.legendOptions,u=a?.customValues,m=r||await B(e,i),b=t.stops,d=!!m,h=!!u,w=null!=t.minSize&&null!=t.maxSize,S=b&&b.length>1,v=!!t.target;if(!d||!h&&!(w||S&&!v))return;const z=p(m);let k=!1,j=null,I=null;j=z&&!S?l([t.minDataValue,t.maxDataValue]):u??await H(t,m,o,s?.type);const V=e?.authoringInfo,x="univariate-color-size"===V?.type,M=x&&"above-and-below"===V?.univariateTheme,U=!!y(e,"reference-size"),L=!!y(e,"spike");if(!j&&S&&(j=b.map((e=>e.value)),k=b.some((e=>!!e.label)),"flow"===e.type&&(j=l(j)),k&&(I=b.map((e=>e.label)))),z&&null!=j&&j?.length>2&&!M&&(j=[j[0],j[j.length-1]]),!j)return null;x&&5!==j?.length&&(j=O({minSize:j[0],maxSize:j[j.length-1]}));const T=z?D(e,j):null,q=f(m),E=k?null:C(j,n),P=await Promise.all(j.map((async(l,i)=>{let n=z?T[i]:await G(t,m,l,o,s?.type),r=n;const a=J(m,n,e,i);U&&(n*=g/t.maxSize||1,r=g),L&&"cim"===a.type&&(r=await c(a));return{value:l,symbol:a,label:k?I[i]:E[i],size:r,outlineSize:q}})));return P.reverse()}function D(e,t){const l=e?.authoringInfo,i="univariate-color-size"===l?.type;let o=[S,w];if(i){const e=t[0],l=t[t.length-1],i=S,s=w;o=t.map((t=>i+(t-e)/(l-e)*(s-i)))}return i&&"below"===l?.univariateTheme&&o.reverse(),o}function T(t,l,i,o){const n="class-breaks"===t.type,r=n?t.classBreakInfos?.[0]?.symbol?.clone():t.uniqueValueInfos?.[0]?.symbol?.clone();return r&&"type"in r&&"cim"===r.type?(s(r,{color:o??(n?null:new e(z)),innerDotSize:l*(g/i)||1,outerRingSize:g}),r):null}function q(e,t){const l=e.classBreakInfos,i=l.length,o=i<2||!(t>=2)?l[0].symbol.clone():l[i-1].symbol.clone(),s=e.visualVariables?.some((e=>"color"===e.type));return s&&(o.type.includes("3d")?P(o):R(o)),o}async function B(l,i){if("flow"===l.type)return b(l,i);if("pie-chart"===l.type)return new a({color:null,outline:l.outline?.width?l.outline:new r});let o=null,u=null;if("simple"===l.type)o=l.symbol;else if("class-breaks"===l.type){const e=l.classBreakInfos;o=e&&e[0]&&e[0].symbol,u=e.length>1}else if("unique-value"===l.type){const e=l.uniqueValueInfos;o=e?.[0]?.symbol,u=null!=e&&e.length>1}if(!o||E(o))return null;if(o=o.clone(),i||u)if(o.type.includes("3d"))P(o);else if(y(l,"reference-size")&&"cim"===o.type)s(o,{color:i??("class-breaks"!==l.type?new e(z):null)});else if(y(l,"spike")&&"cim"===o.type){const s=new e(z);let r,a=i??void 0;if(a){const e=t(a),l=h();if(!l&&e>225||l&&e<25){const e="CIMPointSymbol"===o.data.symbol?.type?o.data.symbol.symbolLayers:null,t=e?.some((e=>"CIMSolidFill"===e?.type));t?a=s:r=s}}else a="class-breaks"!==l.type?s:void 0;n(o,{color:a,strokeColor:r})}else R(o);return o}function E(e){return m(e)?e.symbolLayers?.some((e=>"fill"===e?.type))??!1:e?.type.includes("fill")??!1}function P(e){"line-3d"===e.type?e.symbolLayers.forEach((e=>{e.material={color:k}})):e.symbolLayers.forEach((e=>{"icon"!==e.type||e.resource?.href?e.material={color:z}:(e.material={color:v},e.outline={color:k,size:1.5})}))}function R(t){const l=h();if("cim"===t.type)u(t,new e(z));else if(t.type.includes("line"))t.color=k;else if(t.color=l?k:v,"simple-marker"===t.type)if(t.outline){const e=t.outline?.color?.toHex();"#ffffff"===e&&(t.outline.color=k)}else t.outline={color:k,width:1.5}}async function H(e,t,i,o){const s=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSizeRangeAtScale(e,i,o),n=s&&O(s);if(!s||!n)return;let r=n.map((t=>A(t,e,s)));r=l(r);for(let l=1;l<r.length-1;l++){const s=await F(e,t,r[l],r[l-1],i,o);s&&(r[l]=s[0],n[l]=s[1])}return r}function O(e){const t=e.minSize,l=e.maxSize,i=I,o=(l-t)/(i-1),s=[];for(let n=0;n<i;n++)s.push(t+o*n);return s}function A(e,t,l){const i=l.minSize,o=l.maxSize,s=t.minDataValue,n=t.maxDataValue;let r;if(e<=i)r=s;else if(e>=o)r=n;else{r=(e-i)/(o-i)*(n-s)+s}return r}async function F(e,t,s,n,r,a){const u=await G(e,t,s,r,a),c=await G(e,t,n,r,a),m=i(s),p=m.fractional,f=j;let y=m.integer,b=null,d=null;s>0&&s<1&&(b=10**p,y=i(s*=b).integer);for(let i=y-1;i>=0;i--){const n=10**i;let m=Math.floor(s/n)*n,p=Math.ceil(s/n)*n;null!=b&&(m/=b,p/=b);let y=(m+p)/2;[,y]=l([m,y,p],{indexes:[1]});const h=await G(e,t,m,r,a),w=await G(e,t,p,r,a),S=await G(e,t,y,r,a),g=o(u,h,c,null),v=o(u,w,c,null),z=o(u,S,c,null);let k=g.previous<=f,j=v.previous<=f;if(k&&j&&(g.previous<=v.previous?(k=!0,j=!1):(j=!0,k=!1)),k?d=[m,h]:j?d=[p,w]:z.previous<=f&&(d=[y,S]),d)break}return d}async function G(e,t,l,i,o){const{getSize:s}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return s(e,l,{scale:i,view:o,shape:"simple-marker"===t.type?t.style:null})}function J(e,t,l,i){"univariate-color-size"===l?.authoringInfo?.type&&"above-and-below"===l?.authoringInfo?.univariateTheme&&"class-breaks"===l.type&&(e=q(l,i));const o=e.clone();if(m(o))p(o)||o.symbolLayers.forEach((e=>{"fill"!==e.type&&(e.size=t)}));else if(V(o))o.size=t;else if(x(o)){const e=o.width,l=o.height;o.height=t,o.width=t*(e/l)}else M(o)?o.width=t:U(o)?o.font&&(o.font.size=t):"cim"===o.type&&y(l,"reference-size")?s(o,{innerDotSize:t,outerRingSize:g}):"cim"===o.type&&y(l,"spike")&&n(o,{defaultHeight:t,primitiveOverrides:null});return o}export{L as getRampStops,T as getReferenceSizeSymbol,w as realWorldMaxSize,S as realWorldMinSize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import o from"../../analysis/LineOfSightAnalysisTarget.js";import i from"../../core/Collection.js";import{castForReferenceSetter as n,referenceSetter as r}from"../../core/collectionUtils.js";import{handlesGroup as a}from"../../core/handleUtils.js";import"../../core/has.js";import{watch as l,syncAndInitial as c,sync as d}from"../../core/reactiveUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{getEffectiveElevationInfo as y,getConvertedElevation as m,absoluteHeightElevationInfo as v}from"../../support/elevationInfoUtils.js";import T from"./LineOfSightTarget.js";import{AnalysisViewModel as u}from"../support/AnalysisViewModel.js";const f=i.ofType(T);let w=class extends u{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this.addHandles([this.targets.on("after-add",(e=>this._onViewModelTargetAdded(e.item))),this.targets.on("after-remove",(e=>this._onViewModelTargetRemoved(e.item))),l((()=>this.analysis),(e=>this._onAnalysisChange(e)),c)])}destroy(){this._analysisTargetsToConnection.forEach((e=>e.remove()))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get observer(){const{observer:e}=this.analysis;return null==e?.position?null:this._convertAnalysisPointToAbsoluteHeight(e.position,e.elevationInfo)}set observer(e){let t=null;e&&(t=e.clone(),t.hasZ||(t.z=0)),this.analysis.observer=new s({position:t})}get targets(){return this._get("targets")||new f}set targets(e){this._set("targets",r(e,this.targets,f))}continue(){null!=this.tool&&this.tool.continue()}stop(){null!=this.tool&&this.tool.stop()}get testInfo(){}constructAnalysis(){return new t}async onConnectToAnalysisView(e){this.addHandles([e.on("result-changed",(e=>{const t=this._analysisTargetsToConnection.get(e.target);t&&(null!=e.result?(t.viewModelTarget.intersectedGraphic=e.result.intersectedGraphic,t.viewModelTarget.intersectedLocation=e.result.intersectedLocation,t.viewModelTarget.visible=e.result.visible):(t.viewModelTarget.intersectedGraphic=null,t.viewModelTarget.intersectedLocation=null,t.viewModelTarget.visible=void 0))}))],"view")}onDisconnectFromAnalysisView(){this.removeHandles("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const t=new o({position:e.location});this._connectViewModelWithAnalysisTarget(e,t),this.analysis.targets.add(t)}_onViewModelTargetRemoved(e){const t=this._vmTargetsToConnection.get(e);t&&(t.remove(),this.analysis.targets.remove(t.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const{position:t}=e,s=new T({location:t?this._convertAnalysisPointToAbsoluteHeight(t,e.elevationInfo):null});this._connectViewModelWithAnalysisTarget(s,e),this.targets.add(s)}_onAnalysisTargetRemoved(e){const t=this._analysisTargetsToConnection.get(e);t&&(t.remove(),this.targets.remove(t.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,t){let s=!1;const o=a([l((()=>({position:t.position,elevationInfo:t.elevationInfo})),(({position:t,elevationInfo:o})=>{s||(s=!0,e.location=t?this._convertAnalysisPointToAbsoluteHeight(t,o):null,s=!1)}),d),l((()=>e.location),(e=>{if(!s){s=!0;let o=null;e&&(o=e.clone(),o.hasZ||(o.z=0)),t.position=o,t.elevationInfo=null,s=!1}}),d)]),i={analysisTarget:t,viewModelTarget:e,remove:()=>{o.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(t)}};this._vmTargetsToConnection.set(e,i),this._analysisTargetsToConnection.set(t,i)}_onAnalysisChange(e){const t="analysis";this.removeHandles(t),this.addHandles([this.analysis.targets.on("after-add",(e=>this._onAnalysisTargetAdded(e.item))),this.analysis.targets.on("after-remove",(e=>this._onAnalysisTargetRemoved(e.item)))],t),this.targets.removeAll(),e.targets.forEach((e=>{this._onAnalysisTargetAdded(e)}))}_convertAnalysisPointToAbsoluteHeight(e,t){const s=e.clone();if(null!=this.view){const o=y(e.hasZ,t);s.z=m(this.view,e,o,v)}return s}};e([h({type:t})],w.prototype,"analysis",void 0),e([h({readOnly:!0})],w.prototype,"state",null),e([h({type:p})],w.prototype,"observer",null),e([h({type:f,cast:n,nonNullable:!0})],w.prototype,"targets",null),w=e([g("esri.widgets.LineOfSight.LineOfSightViewModel")],w);const _=w;export{_ as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import o from"../../analysis/LineOfSightAnalysisTarget.js";import i from"../../core/Collection.js";import{castForReferenceSetter as n,referenceSetter as r}from"../../core/collectionUtils.js";import{deprecateUnnecessaryViewModel as a}from"../../core/deprecate.js";import{handlesGroup as l}from"../../core/handleUtils.js";import"../../core/has.js";import c from"../../core/Logger.js";import{watch as d,syncAndInitial as g,sync as h}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../geometry/Point.js";import{getEffectiveElevationInfo as v,getConvertedElevation as T,absoluteHeightElevationInfo as u}from"../../support/elevationInfoUtils.js";import f from"./LineOfSightTarget.js";import{AnalysisViewModel as w}from"../support/AnalysisViewModel.js";const _=i.ofType(f);let A=class extends w{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map,e?.isDefaultViewModel||a(c.getLogger(this),"Line Of Sight","line-of-sight",{version:"4.33"})}initialize(){this.addHandles([this.targets.on("after-add",(e=>this._onViewModelTargetAdded(e.item))),this.targets.on("after-remove",(e=>this._onViewModelTargetRemoved(e.item))),d((()=>this.analysis),(e=>this._onAnalysisChange(e)),g)])}destroy(){this._analysisTargetsToConnection.forEach((e=>e.remove()))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get observer(){const{observer:e}=this.analysis;return null==e?.position?null:this._convertAnalysisPointToAbsoluteHeight(e.position,e.elevationInfo)}set observer(e){let t=null;e&&(t=e.clone(),t.hasZ||(t.z=0)),this.analysis.observer=new s({position:t})}get targets(){return this._get("targets")||new _}set targets(e){this._set("targets",r(e,this.targets,_))}continue(){null!=this.tool&&this.tool.continue()}stop(){null!=this.tool&&this.tool.stop()}get testInfo(){}constructAnalysis(){return new t}async onConnectToAnalysisView(e){this.addHandles([e.on("result-changed",(e=>{const t=this._analysisTargetsToConnection.get(e.target);t&&(null!=e.result?(t.viewModelTarget.intersectedGraphic=e.result.intersectedGraphic,t.viewModelTarget.intersectedLocation=e.result.intersectedLocation,t.viewModelTarget.visible=e.result.visible):(t.viewModelTarget.intersectedGraphic=null,t.viewModelTarget.intersectedLocation=null,t.viewModelTarget.visible=void 0))}))],"view")}onDisconnectFromAnalysisView(){this.removeHandles("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const t=new o({position:e.location});this._connectViewModelWithAnalysisTarget(e,t),this.analysis.targets.add(t)}_onViewModelTargetRemoved(e){const t=this._vmTargetsToConnection.get(e);t&&(t.remove(),this.analysis.targets.remove(t.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const{position:t}=e,s=new f({location:t?this._convertAnalysisPointToAbsoluteHeight(t,e.elevationInfo):null});this._connectViewModelWithAnalysisTarget(s,e),this.targets.add(s)}_onAnalysisTargetRemoved(e){const t=this._analysisTargetsToConnection.get(e);t&&(t.remove(),this.targets.remove(t.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,t){let s=!1;const o=l([d((()=>({position:t.position,elevationInfo:t.elevationInfo})),(({position:t,elevationInfo:o})=>{s||(s=!0,e.location=t?this._convertAnalysisPointToAbsoluteHeight(t,o):null,s=!1)}),h),d((()=>e.location),(e=>{if(!s){s=!0;let o=null;e&&(o=e.clone(),o.hasZ||(o.z=0)),t.position=o,t.elevationInfo=null,s=!1}}),h)]),i={analysisTarget:t,viewModelTarget:e,remove:()=>{o.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(t)}};this._vmTargetsToConnection.set(e,i),this._analysisTargetsToConnection.set(t,i)}_onAnalysisChange(e){const t="analysis";this.removeHandles(t),this.addHandles([this.analysis.targets.on("after-add",(e=>this._onAnalysisTargetAdded(e.item))),this.analysis.targets.on("after-remove",(e=>this._onAnalysisTargetRemoved(e.item)))],t),this.targets.removeAll(),e.targets.forEach((e=>{this._onAnalysisTargetAdded(e)}))}_convertAnalysisPointToAbsoluteHeight(e,t){const s=e.clone();if(null!=this.view){const o=v(e.hasZ,t);s.z=T(this.view,e,o,u)}return s}};e([p({type:t})],A.prototype,"analysis",void 0),e([p({readOnly:!0})],A.prototype,"state",null),e([p({type:y})],A.prototype,"observer",null),e([p({type:_,cast:n,nonNullable:!0})],A.prototype,"targets",null),A=e([m("esri.widgets.LineOfSight.LineOfSightViewModel")],A);const M=A;export{M as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../core/has.js";import{ignoreAbortErrors as t}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import o from"./LineOfSight/LineOfSightViewModel.js";import{loadCalciteComponents as r}from"./support/componentsUtils.js";import{globalCss as l}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as d}from"./support/jsxFactory.js";const u="esri-line-of-sight",p={base:u,actions:`${u}__actions`,container:`${u}__container`,error:`${u}__error`,hint:`${u}__hint`,hintText:`${u}__hint-text`,newAnalysisButton:`${u}__new-analysis-button`},c={newAnalysisButton:`${u}__new-button`,doneButton:`${u}__done-button`};let h=class extends n{constructor(e,s){super(e,s),this.messages=null,this.viewModel=new o,this._onNewAnalysis=()=>{t(this.viewModel.start())},this._onDone=()=>{this.viewModel.stop()},this._onContinue=()=>{this.viewModel.continue()}}loadDependencies(){return r({button:()=>import("@esri/calcite-components/dist/components/calcite-button")})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"line-of-sight"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){return d("div",{class:this.classes(p.base,l.widget,l.panel),role:"presentation"},this._renderContainerNode())}_renderContainerNode(){if(!this.visible)return null;if(!this.viewModel.supported)return this._renderUnsupportedMessage();let e=null;const t=[this._renderNewAnalysisButton()];return"creating"===this.viewModel.state?(e=this._renderHint(),t.unshift(this._renderDoneButton())):"created"===this.viewModel.state&&this.viewModel.targets.length>0&&t.unshift(this._renderContinueButton()),d("div",{class:p.container},e,d("div",{class:p.actions},t))}_renderUnsupportedMessage(){return d("div",{class:p.error,key:"esri-line-of-sight__unsupported"},d("p",null,this.messages.unsupported))}_renderHint(){return d("div",{class:p.hint,key:"esri-line-of-sight__hint"},d("p",{class:p.hintText},this.messages.hint))}_renderNewAnalysisButton(){return this._renderButton({className:p.newAnalysisButton,id:c.newAnalysisButton,label:this.messages.newAnalysis,onClick:this._onNewAnalysis,primary:!0})}_renderDoneButton(){return this._renderButton({id:c.doneButton,label:this.messages.done,onClick:this._onDone,primary:!1})}_renderContinueButton(){return this._renderButton({id:c.newAnalysisButton,label:this.messages.continueAnalysis,onClick:this._onContinue,primary:!1})}_renderButton({className:e,id:t,label:s,onClick:i,primary:n}){const o="disabled"===this.viewModel.state;return d("calcite-button",{appearance:n?"solid":"outline-fill",class:e,"data-id":t,disabled:o,key:t,onclick:i},s)}get test(){}};e([s()],h.prototype,"active",null),e([s({constructOnly:!0,nonNullable:!0})],h.prototype,"analysis",null),e([s()],h.prototype,"icon",null),e([s()],h.prototype,"label",null),e([s(),a("esri/widgets/LineOfSight/t9n/LineOfSight")],h.prototype,"messages",void 0),e([s()],h.prototype,"view",null),e([s({type:o})],h.prototype,"viewModel",void 0),e([s()],h.prototype,"visible",null),h=e([i("esri.widgets.LineOfSight")],h);const m=h;export{m as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{deprecateWidget as t}from"../core/deprecate.js";import"../core/has.js";import s from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import l from"./LineOfSight/LineOfSightViewModel.js";import{loadCalciteComponents as a}from"./support/componentsUtils.js";import{globalCss as d}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as u}from"./support/decorators/messageBundle.js";import{tsx as p}from"./support/jsxFactory.js";const c="esri-line-of-sight",h={base:c,actions:`${c}__actions`,container:`${c}__container`,error:`${c}__error`,hint:`${c}__hint`,hintText:`${c}__hint-text`,newAnalysisButton:`${c}__new-analysis-button`},m={newAnalysisButton:`${c}__new-button`,doneButton:`${c}__done-button`};let g=class extends r{constructor(e,n){super(e,n),this.messages=null,this.viewModel=new l({isDefaultViewModel:!0}),this._onNewAnalysis=()=>{i(this.viewModel.start())},this._onDone=()=>{this.viewModel.stop()},this._onContinue=()=>{this.viewModel.continue()},t(s.getLogger(this),"Line Of Sight","arcgis-line-of-sight",{version:"4.33"})}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button")})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"line-of-sight"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){return p("div",{class:this.classes(h.base,d.widget,d.panel),role:"presentation"},this._renderContainerNode())}_renderContainerNode(){if(!this.visible)return null;if(!this.viewModel.supported)return this._renderUnsupportedMessage();let e=null;const t=[this._renderNewAnalysisButton()];return"creating"===this.viewModel.state?(e=this._renderHint(),t.unshift(this._renderDoneButton())):"created"===this.viewModel.state&&this.viewModel.targets.length>0&&t.unshift(this._renderContinueButton()),p("div",{class:h.container},e,p("div",{class:h.actions},t))}_renderUnsupportedMessage(){return p("div",{class:h.error,key:"esri-line-of-sight__unsupported"},p("p",null,this.messages.unsupported))}_renderHint(){return p("div",{class:h.hint,key:"esri-line-of-sight__hint"},p("p",{class:h.hintText},this.messages.hint))}_renderNewAnalysisButton(){return this._renderButton({className:h.newAnalysisButton,id:m.newAnalysisButton,label:this.messages.newAnalysis,onClick:this._onNewAnalysis,primary:!0})}_renderDoneButton(){return this._renderButton({id:m.doneButton,label:this.messages.done,onClick:this._onDone,primary:!1})}_renderContinueButton(){return this._renderButton({id:m.newAnalysisButton,label:this.messages.continueAnalysis,onClick:this._onContinue,primary:!1})}_renderButton({className:e,id:t,label:s,onClick:i,primary:n}){const o="disabled"===this.viewModel.state;return p("calcite-button",{appearance:n?"solid":"outline-fill",class:e,"data-id":t,disabled:o,key:t,onclick:i},s)}get test(){}};e([n()],g.prototype,"active",null),e([n({constructOnly:!0,nonNullable:!0})],g.prototype,"analysis",null),e([n()],g.prototype,"icon",null),e([n()],g.prototype,"label",null),e([n(),u("esri/widgets/LineOfSight/t9n/LineOfSight")],g.prototype,"messages",void 0),e([n()],g.prototype,"view",null),e([n({type:l})],g.prototype,"viewModel",void 0),e([n()],g.prototype,"visible",null),g=e([o("esri.widgets.LineOfSight")],g);const _=g;export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../analysis/SliceAnalysis.js";import t from"../../core/Collection.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{AnalysisViewModel as l}from"../support/AnalysisViewModel.js";const a=new Set;let i=class extends l{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="SliceViewModel is only supported in 3D views.",a.add(this)}destroy(){a.delete(this)}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get shape(){return this.analysis.shape}set shape(e){this.analysis.shape=e}get tiltEnabled(){return this.analysis.tiltEnabled}set tiltEnabled(e){this.analysis.tiltEnabled=e}get mode(){return this.tool?.mode??"none"}get excludedLayers(){return this.analysis.excludedLayers}set excludedLayers(e){this.analysis.excludedLayers=t.isCollection(e)?e:new t(e)}get excludeGroundSurface(){return this.analysis.excludeGroundSurface}set excludeGroundSurface(e){this.analysis.excludeGroundSurface=e}async start(){await super.start(),a.forEach((e=>{e.view===this.view&&e!==this&&e.clear()})),null!=this.analysisView&&(this.analysisView.active=!0)}enterExcludeLayerMode(){this.tool?.start("exclude")}exitExcludeLayerMode(){this.tool?.stop()}onConnectToAnalysisView(e){e.active=!0}constructAnalysis(){return new s}};e([o({type:s})],i.prototype,"analysis",void 0),e([o({readOnly:!0})],i.prototype,"state",null),e([o()],i.prototype,"shape",null),e([o()],i.prototype,"tiltEnabled",null),e([o()],i.prototype,"mode",null),e([o()],i.prototype,"excludedLayers",null),e([o({nonNullable:!0})],i.prototype,"excludeGroundSurface",null),i=e([r("esri.widgets.Slice.SliceViewModel")],i);const n=i;export{n as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../analysis/SliceAnalysis.js";import t from"../../core/Collection.js";import{deprecateUnnecessaryViewModel as o}from"../../core/deprecate.js";import r from"../../core/Logger.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{AnalysisViewModel as a}from"../support/AnalysisViewModel.js";const n=new Set;let d=class extends a{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="SliceViewModel is only supported in 3D views.",e?.isDefaultViewModel||o(r.getLogger(this),"Slice","slice",{version:"4.33"}),n.add(this)}destroy(){n.delete(this)}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get shape(){return this.analysis.shape}set shape(e){this.analysis.shape=e}get tiltEnabled(){return this.analysis.tiltEnabled}set tiltEnabled(e){this.analysis.tiltEnabled=e}get mode(){return this.tool?.mode??"none"}get excludedLayers(){return this.analysis.excludedLayers}set excludedLayers(e){this.analysis.excludedLayers=t.isCollection(e)?e:new t(e)}get excludeGroundSurface(){return this.analysis.excludeGroundSurface}set excludeGroundSurface(e){this.analysis.excludeGroundSurface=e}async start(){await super.start(),n.forEach((e=>{e.view===this.view&&e!==this&&e.clear()})),null!=this.analysisView&&(this.analysisView.active=!0)}enterExcludeLayerMode(){this.tool?.start("exclude")}exitExcludeLayerMode(){this.tool?.stop()}onConnectToAnalysisView(e){e.active=!0}constructAnalysis(){return new s}};e([l({type:s})],d.prototype,"analysis",void 0),e([l({readOnly:!0})],d.prototype,"state",null),e([l()],d.prototype,"shape",null),e([l()],d.prototype,"tiltEnabled",null),e([l()],d.prototype,"mode",null),e([l()],d.prototype,"excludedLayers",null),e([l({nonNullable:!0})],d.prototype,"excludeGroundSurface",null),d=e([i("esri.widgets.Slice.SliceViewModel")],d);const c=d;export{c as default};