@arcgis/core 4.33.0-next.20250616 → 4.33.0-next.20250618

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 (196) hide show
  1. package/EULA.pdf +0 -0
  2. package/applications/MapViewer/templateUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/089821d58267c16ccf0a.js +1 -0
  5. package/assets/esri/core/workers/chunks/{2ad538440cfb3ab94787.js → 2c0c97acb7714b1e0e01.js} +1 -1
  6. package/assets/esri/core/workers/chunks/490c733be256a1ce25b2.js +1 -0
  7. package/assets/esri/core/workers/chunks/52410198c4b2eccfeadd.js +1 -0
  8. package/assets/esri/core/workers/chunks/5bad1c6b53c1290c1bee.js +1 -0
  9. package/assets/esri/core/workers/chunks/{04e558a970c6a77f243e.js → 5cbaf4ff688aafa6643e.js} +1 -1
  10. package/assets/esri/core/workers/chunks/5e1975ea139ebcee9d9c.js +1 -0
  11. package/assets/esri/core/workers/chunks/5e53c7e29bb6d43d08be.js +1 -0
  12. package/assets/esri/core/workers/chunks/606782a94adcce6975af.js +1 -0
  13. package/assets/esri/core/workers/chunks/616502f99247ff6b00c2.js +1 -0
  14. package/assets/esri/core/workers/chunks/6f8de923519bb16af8ba.js +1 -0
  15. package/assets/esri/core/workers/chunks/764e505f2bafdf5afaf9.js +1 -0
  16. package/assets/esri/core/workers/chunks/77342fa644507f57c41a.js +1 -0
  17. package/assets/esri/core/workers/chunks/8637b9cb30170ac4eae2.js +1 -0
  18. package/assets/esri/core/workers/chunks/8656c145ff0ca2e51ea6.js +1 -0
  19. package/assets/esri/core/workers/chunks/8b4a35e3ed39d8be3394.js +1 -0
  20. package/assets/esri/core/workers/chunks/{4e38fcd99d7d9f984356.js → a1e1fb43463977e4014c.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{8281c9ae86fec895f617.js → a2715eddd71f47b1f951.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{130c848bf6337649052c.js → a3e43fa3cee99f28b272.js} +1 -1
  23. package/assets/esri/core/workers/chunks/a507192771e5f4f82973.js +1 -0
  24. package/assets/esri/core/workers/chunks/ac03f1b2402598b394d5.js +1 -0
  25. package/assets/esri/core/workers/chunks/b63a5067b18b6754a997.js +1 -0
  26. package/assets/esri/core/workers/chunks/c1822b03302c3db71b1f.js +1 -0
  27. package/assets/esri/core/workers/chunks/c872a06e3b5c3fb2ba56.js +1 -0
  28. package/assets/esri/core/workers/chunks/d3bfd0c382c2f39a787b.js +1 -0
  29. package/assets/esri/core/workers/chunks/d568070513f2b98fd9b5.js +1 -0
  30. package/assets/esri/core/workers/chunks/d6df12bed626d56cd6b2.js +1 -0
  31. package/assets/esri/core/workers/chunks/{28fceb79e5888e0109cc.js → d7968726733eee609ec6.js} +1 -1
  32. package/assets/esri/core/workers/chunks/df6d6ac6ebe2fb044a97.js +1 -0
  33. package/assets/esri/core/workers/chunks/ec339075bb4faeec1413.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e02437168d5a55b51831.js → f08b5fce5f9a5afdcc97.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f4442a2b40e44f90b461.js +1 -0
  36. package/assets/esri/themes/base/widgets/_Legend.scss +3 -1
  37. package/assets/esri/themes/dark/main.css +1 -1
  38. package/assets/esri/themes/light/main.css +1 -1
  39. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  40. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  41. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  42. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  43. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  65. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  66. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  67. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  68. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  69. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  70. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  71. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  72. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  73. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  74. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  76. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  77. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  78. package/interfaces.d.ts +114 -49
  79. package/layers/FeatureLayer.js +1 -1
  80. package/layers/OrientedImageryLayer.js +1 -1
  81. package/layers/SubtypeGroupLayer.js +1 -1
  82. package/layers/VideoLayer.js +1 -1
  83. package/layers/graphics/data/QueryEngineResult.js +1 -1
  84. package/layers/mixins/FeatureLayerBase.js +1 -1
  85. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  86. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  87. package/layers/orientedImagery/core/utils.js +1 -1
  88. package/layers/orientedImagery/transformations/updateElevation.js +1 -1
  89. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  90. package/layers/orientedImagery/transformations/utils.js +1 -1
  91. package/layers/support/SubtypeSublayer.js +1 -1
  92. package/layers/support/TitleCreator.js +1 -1
  93. package/layers/support/arcgisLayerUrl.js +1 -1
  94. package/layers/support/arcgisLayers.js +1 -1
  95. package/layers/support/fetchService.js +1 -1
  96. package/layers/support/fieldUtils.js +1 -1
  97. package/layers/support/layerUtils.js +1 -1
  98. package/layers/video/VideoCameraSensorModel.js +1 -1
  99. package/layers/video/VideoController.js +1 -1
  100. package/package.json +1 -1
  101. package/portal/support/layersLoader.js +1 -1
  102. package/portal/support/loadUtils.js +1 -1
  103. package/portal/support/portalLayers.js +1 -1
  104. package/request.js +1 -1
  105. package/rest/knowledgeGraphService.js +1 -1
  106. package/rest/support/DateBinParameters.js +1 -1
  107. package/smartMapping/renderers/size.js +1 -1
  108. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  109. package/support/requestUtils.js +1 -1
  110. package/support/revision.js +1 -1
  111. package/symbols/cim/effects/EffectRadial.js +1 -1
  112. package/symbols/cim/utils.js +1 -1
  113. package/symbols/support/previewCIMSymbol.js +1 -1
  114. package/symbols/support/previewSymbol2D.js +1 -1
  115. package/symbols/support/svgUtils.js +1 -1
  116. package/views/2d/engine/ManagedCanvas.js +1 -1
  117. package/views/2d/engine/ParentChildStage.js +5 -0
  118. package/views/2d/engine/Stage.js +1 -1
  119. package/views/2d/engine/webgl/OverlayContainer.js +1 -1
  120. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  121. package/views/2d/engine/webgl/Painter.js +1 -1
  122. package/views/2d/engine/webgl/VideoScreenRenderer.js +5 -0
  123. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueType.js +1 -1
  124. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js +5 -0
  125. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +5 -0
  126. package/views/2d/layers/MediaLayerView2D.js +1 -1
  127. package/views/2d/layers/TileLayerView2D.js +1 -1
  128. package/views/2d/mapViewDeps.js +1 -1
  129. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  130. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  131. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  132. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  133. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  134. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  135. package/views/3d/layers/I3SMeshView3D.js +1 -1
  136. package/views/3d/support/popupHitTest.js +1 -1
  137. package/views/3d/terrain/OverlayRenderer.js +1 -1
  138. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  139. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  140. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  141. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  142. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  143. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  144. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  145. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  146. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  147. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  148. package/views/VideoView.js +1 -1
  149. package/views/View2D.js +1 -1
  150. package/views/Viewport2DBaseMixin.js +5 -0
  151. package/views/Viewport2DMixin.js +1 -1
  152. package/views/analysis/analysisViewUtils.js +1 -1
  153. package/views/layers/DimensionLayerView.js +1 -1
  154. package/views/layers/LineOfSightLayerView.js +1 -1
  155. package/views/layers/ViewshedLayerView.js +1 -1
  156. package/views/video/VideoOperationalDataView.js +5 -0
  157. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  158. package/widgets/Expand.js +1 -1
  159. package/widgets/FeatureTable/support/templateUtils.js +1 -1
  160. package/widgets/Legend/styles/support/sizeRampUtils.js +1 -1
  161. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  162. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  163. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  164. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  165. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  166. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  167. package/widgets/OrientedImageryViewer.js +1 -1
  168. package/widgets/Print/PrintViewModel.js +1 -1
  169. package/widgets/Print.js +1 -1
  170. package/widgets/VideoPlayer.js +1 -1
  171. package/widgets/support/GridControls.js +1 -1
  172. package/assets/esri/core/workers/chunks/0ed4ec00ef16aa58a33d.js +0 -1
  173. package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +0 -1
  174. package/assets/esri/core/workers/chunks/49a57dc1e6d1048fa949.js +0 -1
  175. package/assets/esri/core/workers/chunks/4b1e6f481e3608486e20.js +0 -1
  176. package/assets/esri/core/workers/chunks/500fb5f615f0c1db1b66.js +0 -1
  177. package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +0 -1
  178. package/assets/esri/core/workers/chunks/5198dc5f8620b47dce79.js +0 -1
  179. package/assets/esri/core/workers/chunks/5e539ce4751bcfa57145.js +0 -1
  180. package/assets/esri/core/workers/chunks/5ef1095842e21090f1f4.js +0 -1
  181. package/assets/esri/core/workers/chunks/7687f1071b1d161d6fc8.js +0 -1
  182. package/assets/esri/core/workers/chunks/7716a9fb380d66ba7292.js +0 -1
  183. package/assets/esri/core/workers/chunks/78a57f5aeb277b84b3da.js +0 -1
  184. package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +0 -1
  185. package/assets/esri/core/workers/chunks/802c6b1a6cb9264b8e4f.js +0 -1
  186. package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +0 -1
  187. package/assets/esri/core/workers/chunks/88b1214c284c2ec7d51b.js +0 -1
  188. package/assets/esri/core/workers/chunks/9dd40566d0730f79e504.js +0 -1
  189. package/assets/esri/core/workers/chunks/a622ed3f182648ab3ff6.js +0 -1
  190. package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +0 -1
  191. package/assets/esri/core/workers/chunks/cfc5e0ec9b0290407383.js +0 -1
  192. package/assets/esri/core/workers/chunks/d2139307f62ea8bf999a.js +0 -1
  193. package/assets/esri/core/workers/chunks/d9cdefb1cd8399ffac20.js +0 -1
  194. package/assets/esri/core/workers/chunks/ddb66fe6fcd0764daa7a.js +0 -1
  195. package/assets/esri/core/workers/chunks/ec49e2849766402ad5c7.js +0 -1
  196. package/assets/esri/core/workers/chunks/f5b426f57f87eb9b2f35.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
- const a="20250616",c="d1c77c5ce56a0aba72a4e57059bca03774cad92b";export{a as buildDate,c as commitHash};
5
+ const a="20250618",c="9124a002af6975d0e0f3cb995003ba86e0022c02";export{a as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{ringsCentroidCursor as e}from"../../../geometry/support/centroid.js";import{defaultCIMValues as i}from"../defaultCIMValues.js";class n{static{this.instance=null}static local(){return null===n.instance&&(n.instance=new n),n.instance}execute(t,e,i,n,r){return new s(t,e,i)}}class s{constructor(t,e,n){this._inputGeometries=t,this._length=(void 0!==e.length?e.length:i.CIMGeometricEffectRadial.length)*n,this._angle=void 0!==e.angle?e.angle*Math.PI/180:i.CIMGeometricEffectRadial.angle,this._lx=Math.cos(this._angle)*this._length,this._ly=Math.sin(this._angle)*this._length}next(){let i=this._inputGeometries.next();for(;i;){if("esriGeometryPoint"===i.geometryType){const e=t.createEmptyOptimizedCIM("esriGeometryPolyline");return i.nextPath()&&i.nextPoint()&&e.pushPath([[i.x,i.y],[i.x+this._lx,i.y+this._ly]]),e}if("esriGeometryPolygon"===i.geometryType){const n=e(i);if(!n)return null;const s=t.createEmptyOptimizedCIM("esriGeometryPolyline");return s.pushPath([[n[0],n[1]],[n[0]+this._lx,n[1]+this._ly]]),s}i=this._inputGeometries.next()}return null}}export{n as EffectRadial};
5
+ import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{ringsCentroidCursor as e}from"../../../geometry/support/centroid.js";import{defaultCIMValues as i}from"../defaultCIMValues.js";class n{static{this.instance=null}static local(){return null===n.instance&&(n.instance=new n),n.instance}execute(t,e,i,n,s){return new r(t,e,i)}}class r{constructor(t,e,n){this._inputGeometries=t,this._length=(void 0!==e.length?e.length:i.CIMGeometricEffectRadial.length)*n,this._angle=void 0!==e.angle?e.angle*Math.PI/180:i.CIMGeometricEffectRadial.angle,this._lx=Math.cos(this._angle)*this._length,this._ly=Math.sin(this._angle)*this._length}next(){let i=this._inputGeometries.next();for(;i;){if("esriGeometryPoint"===i.geometryType||"esriGeometryMultipoint"===i.geometryType){const e=t.createEmptyOptimizedCIM("esriGeometryPolyline");return i.nextPath()&&i.nextPoint()&&e.pushPath([[i.x,i.y],[i.x+this._lx,i.y+this._ly]]),e}if("esriGeometryPolygon"===i.geometryType){const n=e(i);if(!n)return null;const r=t.createEmptyOptimizedCIM("esriGeometryPolyline");return r.pushPath([[n[0],n[1]],[n[0]+this._lx,n[1]+this._ly]]),r}i=this._inputGeometries.next()}return null}}export{n as EffectRadial};
@@ -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{defaultCIMValues as e,defaultCIMColor as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const l=" /-,\n";function i(e){let t=e.length;for(;t--;)if(!l.includes(e.charAt(t)))return!1;return!0}function a(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.slice(n,o);r.push([t,null,i(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const l=t[e.slice(n,o)];l&&r.push([null,l,!1])}n=o+1}}}while(-1!==o);if(n<e.length){const t=e.slice(n);r.push([t,null,i(t)])}return r}function c(e,t,r){let n="",o=null;for(const l of t){const[t,r,i]=l;if(null!=t&&""!==t)i?o=t:(null!=o&&(n+=o,o=null),n+=t);else{const t=e.readAttribute(r);null!=t&&""!==t&&(null!==o&&(n+=o,o=null),n+=t)}}return u(n,r)}function s(e,t,r,n){let o="",l=null;for(const i of t){const[t,n,a]=i;if(null!=t&&""!==t)a?l=t:(null!=l&&(o+=l,l=null),o+=t);else{let t=n;null!=r&&(t=W(n,r));const i=e.attributes[t];null!=i&&""!==i&&(null!=l&&(o+=l,l=null),o+=i)}}return u(o,n)}function u(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function f(e,t,r,n,o,l,i=!0){const a=t/o,c=r/l,s=Math.ceil(a/2),u=Math.ceil(c/2);for(let f=0;f<l;f++)for(let r=0;r<o;r++){const y=4*(r+(i?l-f-1:f)*o);let M=0,m=0,C=0,I=0,p=0,h=0,b=0;const d=(f+.5)*c;for(let n=Math.floor(f*c);n<(f+1)*c;n++){const o=Math.abs(d-(n+.5))/u,l=(r+.5)*a,i=o*o;for(let c=Math.floor(r*a);c<(r+1)*a;c++){let r=Math.abs(l-(c+.5))/s;const o=Math.sqrt(i+r*r);o>=-1&&o<=1&&(M=2*o*o*o-3*o*o+1,M>0&&(r=4*(c+n*t),b+=M*e[r+3],C+=M,e[r+3]<255&&(M=M*e[r+3]/250),I+=M*e[r],p+=M*e[r+1],h+=M*e[r+2],m+=M))}}n[y]=I/m,n[y+1]=p/m,n[y+2]=h/m,n[y+3]=b/C}}function y(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function M(e){return e.data?.symbol??null}function m(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function C(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function I(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function p(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const h=(e,t=0)=>null==e||isNaN(e)?t:e,b=(e,t)=>null!=e?e:t,d=(e,t)=>e??t,k=e=>e.tintColor?y(e.tintColor):[255,255,255,1],S=e=>{if(!e)return!1;for(const t of e)switch(t.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectDonut":case"CIMGeometricEffectOffset":case"CIMGeometricEffectTaperedPolygon":case"CIMGeometricEffectEnclosingPolygon":return!0}return!1};function P(){return import("../../geometry/geometryEngineJSON.js")}function g(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function w(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function L(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function T(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function A(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=A(t);if(null!=e)return e}break;case"CIMTextSymbol":return A(e.symbol);case"CIMSolidFill":return e.color}return null}function G(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=G(e);if(null!=t)return t}break}case"CIMTextSymbol":return G(e.symbol);case"CIMSolidStroke":return e.color}}function N(e){for(const t of e)if(t.enable)switch(t.type){case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return!0}return!1}function x(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=x(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return x(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function v(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":case"Justify":return"center"}}function E(e){switch(e){case"Top":default:return"top";case"Center":return"middle";case"Baseline":return"baseline";case"Bottom":return"bottom"}}function F(e){return(e?Object.keys(e):[]).map((t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"})))}const V=e=>e.includes("data:image/svg+xml");function z(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":return null!=e.symbolLayers&&e.symbolLayers.some((e=>e.effects?.some((e=>"CIMGeometricEffectRadial"===e.type))))?"esriGeometryPolyline":"esriGeometryPoint";case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function O(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function D(e,t,r,n,o,l,i=!0){const{infos:a}=l;let c=1,s=0,u=0,f=0,y=1;for(const{absoluteAnchorPoint:C,offsetX:I,offsetY:p,rotation:h,size:b,frameHeight:d,rotateClockWise:k,scaleSymbolsProportionally:S}of a){y=C?1:c;u=K(I,p,s,y,u),f=$(I,p,s,y,f),d&&(S||i)&&(c*=b/d),s=Q(h,k,s)}const M=K(n,o,s,y,u),m=$(n,o,s,y,f);return{size:e*c,rotation:Q(t,r,s),offsetX:M,offsetY:m}}function R(e){if(null==e)return!1;if(Array.isArray(e))return e.every((e=>R(e)));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function j(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderlinecolor"===n||"tintcolor"===n)return[...t[n]];const o=e[r];if(!o)throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function q(e){return e.split(" ").map((e=>Number(e)))}function B(e){return"string"==typeof e?q(e):e}function H(e){return e?.dashTemplate&&(e.dashTemplate=B(e.dashTemplate)),e}function J(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return J(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return J(e.symbol)}}return"Normal"}function U(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&p(n.markerPlacement)){const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function W(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function X(e){return e.map((e=>({...e,propertyName:O(e.propertyName)})))}function Y(e){const t={};for(const r in e){const n=e[r];t[O(r)]=n}return t}function $(e,t,r,n,o){const l=r*Math.PI/180;if(l){const r=Math.cos(l);return(Math.sin(l)*e+r*t)*n+o}return t*n+o}function K(e,t,r,n,o){const l=r*Math.PI/180;if(l){return(Math.cos(l)*e-Math.sin(l)*t)*n+o}return e*n+o}function Q(e,t,r){return t?r-e:r+e}function Z(e,t,r){const n="Color"===r||"TintColor"===r||"ToColor"===r,o="Rotation"===r||"Angle"===r||"ToRotation"===r;let l=t[O(r)];if(null!=l&&(n?l=[l[0]/255,l[1]/255,l[2]/255,l[3]/255]:o&&(l*=Math.PI/180)),null==l&&(l=j(t.type,r.toLowerCase()),null!=l&&(n?l=[l[0]/255,l[1]/255,l[2]/255,l[3]]:o&&(l*=Math.PI/180))),null!=t.primitiveName){const i=e[t.primitiveName];if(null!=i){const e=i[r];null==e||("string"==typeof e||"number"==typeof e||Array.isArray(e)?(l=e,null!=l&&(n?l=[l[0]/255,l[1]/255,l[2]/255,l[3]/255]:o&&(l*=Math.PI/180))):(l={valueExpressionInfo:e,defaultValue:l},null!=l&&(n?l={type:"Process",op:"ArcadeColor",value:l}:o&&(l={type:"Process",op:"Divide",left:l,right:180/Math.PI}))))}}if(null==l)throw new Error(`Failed to derive a value or an expression for "${r}".`);return l}function _(e,t,r){if(null!=t[O(r)])return!0;if(null!=t.primitiveName){const n=e[t.primitiveName];if(null!=n){if(null!=n[r])return!0}}return!1}function ee(e,t){return Math.max(Math.min((e??t)/100,1),0)}export{u as adjustTextCase,a as analyzeTextParts,D as applyParentTransform,s as assignTextValuesFromFeature,F as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,T as fromCIMFontDecoration,L as fromCIMFontStyle,v as fromCIMHorizontalAlignment,E as fromCIMVerticalAlignment,j as getDefaultCIMValue,d as getEnum,W as getFieldName,A as getFillColor,g as getFontStyle,w as getFontWeight,h as getNumericValue,Z as getProcessParam,ee as getRelativeGradientSize,U as getSize,G as getStrokeColor,x as getStrokeWidth,J as getTextCasing,c as getTextValuesFromFeatureHandle,k as getTintColor,b as getValue,_ as hasProcessParam,N as hasStrokeLayer,P as importGeometryEngine,I as isCIMFill,m as isCIMMarker,p as isCIMMarkerStrokePlacement,C as isCIMStroke,r as isFeatureValueFn,S as isGeometryEngineRequired,V as isSVGImage,R as isValidCIMValue,z as mapCIMSymbolToGeometryType,y as normalizeAlpha,H as normalizeDashEffectTemplate,B as normalizeDashTemplate,X as normalizePrimitiveOverrideProps,q as parseDashTemplate,f as resampleHermite,M as toCIMSymbolJSON,Y as toLowerCaseProps,O as uncapitalize};
5
+ import{defaultCIMValues as e,defaultCIMColor as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const l=" /-,\n";function i(e){let t=e.length;for(;t--;)if(!l.includes(e.charAt(t)))return!1;return!0}function a(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.slice(n,o);r.push([t,null,i(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const l=t[e.slice(n,o)];l&&r.push([null,l,!1])}n=o+1}}}while(-1!==o);if(n<e.length){const t=e.slice(n);r.push([t,null,i(t)])}return r}function c(e,t,r){let n="",o=null;for(const l of t){const[t,r,i]=l;if(null!=t&&""!==t)i?o=t:(null!=o&&(n+=o,o=null),n+=t);else{const t=e.readAttribute(r);null!=t&&""!==t&&(null!==o&&(n+=o,o=null),n+=t)}}return u(n,r)}function s(e,t,r,n){let o="",l=null;for(const i of t){const[t,n,a]=i;if(null!=t&&""!==t)a?l=t:(null!=l&&(o+=l,l=null),o+=t);else{let t=n;null!=r&&(t=W(n,r));const i=e.attributes[t];null!=i&&""!==i&&(null!=l&&(o+=l,l=null),o+=i)}}return u(o,n)}function u(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function f(e,t,r,n,o,l,i=!0){const a=t/o,c=r/l,s=Math.ceil(a/2),u=Math.ceil(c/2);for(let f=0;f<l;f++)for(let r=0;r<o;r++){const M=4*(r+(i?l-f-1:f)*o);let y=0,m=0,C=0,I=0,p=0,h=0,b=0;const d=(f+.5)*c;for(let n=Math.floor(f*c);n<(f+1)*c;n++){const o=Math.abs(d-(n+.5))/u,l=(r+.5)*a,i=o*o;for(let c=Math.floor(r*a);c<(r+1)*a;c++){let r=Math.abs(l-(c+.5))/s;const o=Math.sqrt(i+r*r);o>=-1&&o<=1&&(y=2*o*o*o-3*o*o+1,y>0&&(r=4*(c+n*t),b+=y*e[r+3],C+=y,e[r+3]<255&&(y=y*e[r+3]/250),I+=y*e[r],p+=y*e[r+1],h+=y*e[r+2],m+=y))}}n[M]=I/m,n[M+1]=p/m,n[M+2]=h/m,n[M+3]=b/C}}function M(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function y(e){return e.data?.symbol??null}function m(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function C(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function I(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function p(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const h=(e,t=0)=>null==e||isNaN(e)?t:e,b=(e,t)=>null!=e?e:t,d=(e,t)=>e??t,k=e=>e.tintColor?M(e.tintColor):[255,255,255,1],S=e=>{if(!e)return!1;for(const t of e)switch(t.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectDonut":case"CIMGeometricEffectOffset":case"CIMGeometricEffectTaperedPolygon":case"CIMGeometricEffectEnclosingPolygon":return!0}return!1};function g(){return import("../../geometry/geometryEngineJSON.js")}function P(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function w(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function L(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function T(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function A(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=A(t);if(null!=e)return e}break;case"CIMTextSymbol":return A(e.symbol);case"CIMSolidFill":return e.color}return null}function N(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=N(e);if(null!=t)return t}break}case"CIMTextSymbol":return N(e.symbol);case"CIMSolidStroke":return e.color}}function x(e){for(const t of e)if(t.enable)switch(t.type){case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return!0}return!1}function G(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=G(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return G(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function v(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":case"Justify":return"center"}}function E(e){switch(e){case"Top":default:return"top";case"Center":return"middle";case"Baseline":return"baseline";case"Bottom":return"bottom"}}function F(e){return(e?Object.keys(e):[]).map((t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"})))}const V=e=>e.includes("data:image/svg+xml");function z(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function O(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function D(e,t,r,n,o,l,i=!0){const{infos:a}=l;let c=1,s=0,u=0,f=0,M=1;for(const{absoluteAnchorPoint:C,offsetX:I,offsetY:p,rotation:h,size:b,frameHeight:d,rotateClockWise:k,scaleSymbolsProportionally:S}of a){M=C?1:c;u=K(I,p,s,M,u),f=$(I,p,s,M,f),d&&(S||i)&&(c*=b/d),s=Q(h,k,s)}const y=K(n,o,s,M,u),m=$(n,o,s,M,f);return{size:e*c,rotation:Q(t,r,s),offsetX:y,offsetY:m}}function j(e){if(null==e)return!1;if(Array.isArray(e))return e.every((e=>j(e)));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function q(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderlinecolor"===n||"tintcolor"===n)return[...t[n]];const o=e[r];if(!o)throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function B(e){return e.split(" ").map((e=>Number(e)))}function R(e){return"string"==typeof e?B(e):e}function H(e){return e?.dashTemplate&&(e.dashTemplate=R(e.dashTemplate)),e}function J(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return J(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return J(e.symbol)}}return"Normal"}function U(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&p(n.markerPlacement)){const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function W(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function X(e){return e.map((e=>({...e,propertyName:O(e.propertyName)})))}function Y(e){const t={};for(const r in e){const n=e[r];t[O(r)]=n}return t}function $(e,t,r,n,o){const l=r*Math.PI/180;if(l){const r=Math.cos(l);return(Math.sin(l)*e+r*t)*n+o}return t*n+o}function K(e,t,r,n,o){const l=r*Math.PI/180;if(l){return(Math.cos(l)*e-Math.sin(l)*t)*n+o}return e*n+o}function Q(e,t,r){return t?r-e:r+e}function Z(e,t,r){const n="Color"===r||"TintColor"===r||"ToColor"===r,o="Rotation"===r||"Angle"===r||"ToRotation"===r;let l=t[O(r)];if(null!=l&&(n?l=[l[0]/255,l[1]/255,l[2]/255,l[3]/255]:o&&(l*=Math.PI/180)),null==l&&(l=q(t.type,r.toLowerCase()),null!=l&&(n?l=[l[0]/255,l[1]/255,l[2]/255,l[3]]:o&&(l*=Math.PI/180))),null!=t.primitiveName){const i=e[t.primitiveName];if(null!=i){const e=i[r];null==e||("string"==typeof e||"number"==typeof e||Array.isArray(e)?(l=e,null!=l&&(n?l=[l[0]/255,l[1]/255,l[2]/255,l[3]/255]:o&&(l*=Math.PI/180))):(l={valueExpressionInfo:e,defaultValue:l},null!=l&&(n?l={type:"Process",op:"ArcadeColor",value:l}:o&&(l={type:"Process",op:"Divide",left:l,right:180/Math.PI}))))}}if(null==l)throw new Error(`Failed to derive a value or an expression for "${r}".`);return l}function _(e,t,r){if(null!=t[O(r)])return!0;if(null!=t.primitiveName){const n=e[t.primitiveName];if(null!=n){if(null!=n[r])return!0}}return!1}function ee(e,t){return Math.max(Math.min((e??t)/100,1),0)}export{u as adjustTextCase,a as analyzeTextParts,D as applyParentTransform,s as assignTextValuesFromFeature,F as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,T as fromCIMFontDecoration,L as fromCIMFontStyle,v as fromCIMHorizontalAlignment,E as fromCIMVerticalAlignment,q as getDefaultCIMValue,d as getEnum,W as getFieldName,A as getFillColor,P as getFontStyle,w as getFontWeight,h as getNumericValue,Z as getProcessParam,ee as getRelativeGradientSize,U as getSize,N as getStrokeColor,G as getStrokeWidth,J as getTextCasing,c as getTextValuesFromFeatureHandle,k as getTintColor,b as getValue,_ as hasProcessParam,x as hasStrokeLayer,g as importGeometryEngine,I as isCIMFill,m as isCIMMarker,p as isCIMMarkerStrokePlacement,C as isCIMStroke,r as isFeatureValueFn,S as isGeometryEngineRequired,V as isSVGImage,j as isValidCIMValue,z as mapCIMSymbolToGeometryType,M as normalizeAlpha,H as normalizeDashEffectTemplate,R as normalizeDashTemplate,X as normalizePrimitiveOverrideProps,B as parseDashTemplate,f as resampleHermite,y as toCIMSymbolJSON,Y as toLowerCaseProps,O as uncapitalize};
@@ -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,px2pt as t}from"../../core/screenUtils.js";import{CIMSymbolHelper as i}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as l}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as o}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as r}from"../cim/utils.js";import{SymbolSizeDefaults as n}from"./previewUtils.js";import{renderSymbol as a}from"./renderUtils.js";const s=new l(null),m=t(n.size),h=t(n.maxSize),c=t(n.lineWidth),y=1;async function f(e,t,i){const l=t?.size;let o=null!=l&&"object"==typeof l&&"width"in l?l.width:l,r=null!=l&&"object"==typeof l&&"height"in l?l.height:l;if(!o||!r)if("esriGeometryPolygon"===i)o=r=t.maxSize?Math.min(t.maxSize,m):m;else{const l=await u(e,t,i);l&&(o=l.width,r=l.height),"esriGeometryPolyline"===i&&(o=t.maxSize?Math.min(t.maxSize,c):c),o=null!=o&&isFinite(o)?Math.min(o,h):m,r=null!=r&&isFinite(r)?Math.max(Math.min(r,h),y):m}return"legend"===t.style&&"esriGeometryPolyline"===i&&(o=c),{width:o,height:r}}async function u(e,t={},l){const n=t.cimOptions||t;l??=n.geometryType||r(e?.data?.symbol);const{feature:a,fieldMap:m,viewParams:h}=n,c=await o.resolveSymbolOverrides(e.data,a,null,m,l,null,h);if(!c)return null;(e=e.clone()).data={type:"CIMSymbolReference",symbol:c},e.data.primitiveOverrides=void 0;const y=[];return i.fetchResources(c,s.resourceManager,y),i.fetchFonts(c,s.resourceManager,y),y.length>0&&await Promise.all(y),i.getEnvelope(c,null,s.resourceManager)}async function g(i,l={}){const{node:o,opacity:n,symbolConfig:m}=l,h=null!=m&&"object"==typeof m&&"isSquareFill"in m&&m.isSquareFill,c=l.cimOptions||l,y=c.geometryType||r(i?.data?.symbol),u=await f(i,l,y),{feature:g,fieldMap:d}=c,p=l?.geometry||h||"esriGeometryPolygon"!==y?"preview":"legend";let w=u;const b=u;if(l?.geometry&&("esriGeometryPolygon"===y||"esriGeometryPolyline"===y)){const i=200;if(e(u.width)<i||e(u.height)<i){const e=u.width>u.height?t(i)*u.height/u.width:t(i);w={width:u.width>u.height?t(i):t(i)*u.width/u.height,height:e}}}const M=await s.rasterizeCIMSymbolAsync(i,g,w,p,d,y,null,c.viewParams,c.allowScalingUp,l?.geometry?.toJSON());if(!M)return null;const{width:S,height:v}=M,j=document.createElement("canvas");j.width=S,j.height=v;j.getContext("2d").putImageData(M,0,0);const x=e(b.width),z=e(b.height),P=new Image(x,z);P.src=j.toDataURL(),P.ariaLabel=l.ariaLabel??null,P.alt=l.ariaLabel??"",null!=n&&(P.style.opacity=`${n}`);let C=P;if(null!=l.effectView){const e={shape:{type:"image",x:0,y:0,width:x,height:z,src:P.src},fill:null,stroke:null,offset:[0,0]};C=a([[e]],[x,z],{effectView:l.effectView,ariaLabel:l.ariaLabel})}return o&&C&&o.appendChild(C),C}export{u as getCIMSymbolPreviewSize,g as previewCIMSymbol};
5
+ import{pt2px as e,px2pt as t}from"../../core/screenUtils.js";import{CIMSymbolHelper as i}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as o}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as l}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as r}from"../cim/utils.js";import{SymbolSizeDefaults as n}from"./previewUtils.js";import{renderSymbol as a}from"./renderUtils.js";const s=new o(null),m=t(n.size),h=t(n.maxSize),c=t(n.lineWidth),y=1;async function u(e,t,i){const o=t?.size;let l=null!=o&&"object"==typeof o&&"width"in o?o.width:o,r=null!=o&&"object"==typeof o&&"height"in o?o.height:o;if(!l||!r)if("esriGeometryPolygon"===i)l=r=t.maxSize?Math.min(t.maxSize,m):m;else{const o=await g(e,t,i);o&&(l=o.width,r=o.height),"esriGeometryPolyline"===i&&(l=t.maxSize?Math.min(t.maxSize,c):c),l=null!=l&&isFinite(l)?Math.min(l,h):m,r=null!=r&&isFinite(r)?Math.max(Math.min(r,h),y):m}return"legend"===t.style&&"esriGeometryPolyline"===i&&(l=c),{width:l,height:r}}async function g(e,t={},o){const n=t.cimOptions||t;o??=n.geometryType||r(e?.data?.symbol);const{feature:a,fieldMap:m,viewParams:h}=n,c=await l.resolveSymbolOverrides(e.data,a,null,m,o,null,h);if(!c)return null;(e=e.clone()).data={type:"CIMSymbolReference",symbol:c},e.data.primitiveOverrides=void 0;const y=[];return i.fetchResources(c,s.resourceManager,y),i.fetchFonts(c,s.resourceManager,y),y.length>0&&await Promise.all(y),i.getEnvelope(c,null,s.resourceManager)}async function d(i,o={}){const{node:l,opacity:n,symbolConfig:m}=o,h=null!=m&&"object"==typeof m&&"isSquareFill"in m&&m.isSquareFill,c=o.cimOptions||o,y=c.geometryType||r(i?.data?.symbol),g=await u(i,o,y),{feature:d,fieldMap:f}=c,p=o?.geometry||h||"esriGeometryPolygon"!==y?"preview":"legend";let w=g;const b=g;if(o?.geometry&&("esriGeometryPolygon"===y||"esriGeometryPolyline"===y)){const i=200;if(e(g.width)<i||e(g.height)<i){const e=g.width>g.height?t(i)*g.height/g.width:t(i);w={width:g.width>g.height?t(i):t(i)*g.width/g.height,height:e}}}const M=await s.rasterizeCIMSymbolAsync(i,d,w,p,f,y,null,c.viewParams,c.allowScalingUp,o?.geometry?.toJSON());if(!M)return null;const{width:S,height:v}=M,j=document.createElement("canvas");j.width=S,j.height=v;j.getContext("2d").putImageData(M,0,0);const x=e(b.width),z=e(b.height),P=new Image(x,z);P.src=j.toDataURL(),P.ariaLabel=o.ariaLabel??null,P.alt=o.ariaLabel??"",null!=n&&(P.style.opacity=`${n}`);let C=P;if(null!=o.effectView){const e={shape:{type:"image",x:0,y:0,width:x,height:z,src:P.src},fill:null,stroke:null,offset:[0,0]};C=a([[e]],[x,z],o)}return l&&C&&l.appendChild(C),C}export{g as getCIMSymbolPreviewSize,d as previewCIMSymbol};
@@ -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 t from"../../Color.js";import{getColorLuminance as e}from"../../core/colorUtils.js";import i from"../../core/Error.js";import{loadFont as o}from"../../core/fontUtils.js";import{pt2px as n}from"../../core/screenUtils.js";import{quantizePolygon as a,quantizePolyline as l}from"../../geometry/support/quantizationUtils.js";import{getFill as s,getStroke as r,getDashArray as h,getPatternUrlWithColor as c}from"./gfxUtils.js";import{SymbolSizeDefaults as m,shapes as u,adjustColorBrightness as p}from"./previewUtils.js";import{renderSymbol as d}from"./renderUtils.js";import{backgroundPadding as g}from"./textUtils.js";const f="picture-fill",y="picture-marker",w="simple-fill",x="simple-line",b="simple-marker",v="text",M="Aa",S=m.size,z=m.maxSize,k=m.maxOutlineSize,L=m.lineWidth,C=225,$=document.createElement("canvas");function j(t,e,i){if("polygon"===t.type){const o=t.extent,n=0===o.width?1:o.width,l=0===o.height?1:o.height;t=a({originPosition:"upperLeft",scale:[n/e,l/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.rings.length;e++){const i=t.rings[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):t===i.length-1?(n=`l${e.toString()} ${o.toString()} Z`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}if("polyline"===t.type){const o=t.extent,n=0===o.width?1:o.width,a=0===o.height?1:o.height;t=l({originPosition:"upperLeft",scale:[n/e,a/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.paths.length;e++){const i=t.paths[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}return""}function B(t,e){const i=$.getContext("2d"),o=[];e&&(e.weight&&o.push(e.weight),e.size&&o.push(e.size+"px"),e.family&&o.push(e.family)),i.font=o.join(" ");const{width:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:l,actualBoundingBoxAscent:s,actualBoundingBoxDescent:r}=i.measureText(t);return{width:Math.ceil(Math.max(n,a+l)),height:Math.ceil(s+r),x:Math.floor(a),y:Math.floor((s-r)/2)}}function P(t){const e=t?.size;return{width:null!=e&&"object"==typeof e&&"width"in e?n(e.width):null,height:null!=e&&"object"==typeof e&&"height"in e?n(e.height):null}}async function U(t,e){const i=e.fill,o=t.color;if("pattern"===i?.type&&o&&t.type!==f){const t=await c(i.src,o.toCss(!0));i.src=t,e.fill=i}}async function A(t,e,i,n){if(!("font"in t)||!t.font||"text"!==e.shape.type)return;try{await o(t.font)}catch{}const{width:a,height:l}=P(n);if(!/[\uE600-\uE6FF]/.test(e.shape.text)){const{width:o,height:s,x:r,y:h}=B(e.shape.text,{weight:e.font?.weight,size:e.font?.size,family:e.font?.family});i[0]=a??o,i[1]=l??s,e.shape.x=r,e.shape.y=h;let c="angle"in t?t.angle:null;if(null!=n?.rotation&&(c=(c??0)+n.rotation),c){const t=c*(Math.PI/180),e=Math.abs(Math.sin(t)),o=Math.abs(Math.cos(t));i[1]=i[0]*e+i[1]*o}}}function E(t,e,i,o,a){if(null!=t.haloColor&&null!=t.haloSize){a.masking??=i.map((()=>[]));const l=n(t.haloSize);o[0]+=l,o[1]+=l,i.unshift([{...e,fill:null,stroke:{color:t.haloColor,width:2*l,join:"round",cap:"round"}}]),a.masking.unshift([{shape:{type:"rect",x:0,y:0,width:o[0]+2*g,height:o[1]+2*g},fill:[255,255,255],stroke:null},{...e,fill:[0,0,0,0],stroke:null}])}null==t.backgroundColor&&null==t.borderLineColor||(o[0]+=2*g,o[1]+=2*g,i.unshift([{shape:{type:"rect",x:0,y:0,width:o[0],height:o[1]},fill:t.backgroundColor,stroke:{color:t.borderLineColor,width:n(t.borderLineSize)}}]),a.masking?.unshift([]))}function F(t,e){return t>e?"dark":"light"}function Z(t,e){const i="number"==typeof e?.size?e?.size:null,o=null!=i?n(i):null,a=null!=e?.maxSize?n(e.maxSize):null;let l="angle"in t?t.angle:null;null!=e?.rotation&&(l=(l??0)+e.rotation);const c=s(t);let m=r(t);"dark"!==q(t,245)||e?.ignoreWhiteSymbols||(m={width:.75,...m,color:"#bdc3c7"});let p=null;const d={shape:null,fill:c,stroke:m,offset:[0,0]};m?.width&&(m.width=Math.min(m.width,k));const g=m?.width||0;let C=null!=e?.size&&(null==e?.scale||e?.scale),$=0,U=0,A=!1;switch(t.type){case b:{const i=t.style,{width:s,height:r}=P(e);let h=s===r&&null!=s?s:null!=o?o:Math.min(n(t.size),a||z);if(!0===e?.useMarkerSymbolSize&&null!==s&&null!==r){const e=Math.min(n(t.size),a||z);h=e>s&&e>r?Math.min(s,r):e}switch($=h,U=h,i){case"circle":d.shape={type:"circle",cx:0,cy:0,r:.5*h},C||($+=g,U+=g);break;case"cross":d.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[$,.5*U]},{command:"M",values:[.5*$,0]},{command:"L",values:[.5*$,U]}]};break;case"diamond":d.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[.5*$,0]},{command:"L",values:[$,.5*U]},{command:"L",values:[.5*$,U]},{command:"Z",values:[]}]},C||($+=g,U+=g);break;case"square":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},C||($+=g,U+=g),l&&(A=!0);break;case"triangle":d.shape={type:"path",path:[{command:"M",values:[.5*$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},C||($+=g,U+=g),l&&(A=!0);break;case"x":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,U]},{command:"M",values:[$,0]},{command:"L",values:[0,U]}]},l&&(A=!0);break;case"path":d.shape={type:"path",path:t.path||""},C||($+=g,U+=g),l&&(A=!0),C=!0}break}case x:{const{width:t,height:i}=P(e),n=h(m).reduce(((t,e)=>t+e),0),a=n&&Math.ceil(L/n),l=i??o??g,s=t??(n*a||L);if(C=!0,"polyline"===e?.geometry?.type&&e?.geometry?.extent){$=s,U=i??$;const t=1e3,o=.15*t;p=[$,U],U=p[0]>p[1]?t*p[1]/p[0]:t,$=p[0]>p[1]?t:t*p[0]/p[1],m?.width&&(m.width=m.width*t/(p[1]>p[0]?p[1]:p[0]),m.width>o&&(m.width=o)),d.shape={type:"path",path:j(e.geometry,$,U)}}else $=null!=e?.maxSize?Math.min(s,e.maxSize):s,U=l,m&&(m.width=l),d.shape={type:"path",path:[{command:"M",values:[l/2,U/2]},{command:"L",values:[$-l/2,U/2]}]};break}case f:case w:{const t="object"==typeof e?.symbolConfig&&!!e?.symbolConfig?.isSquareFill,{width:i,height:n}=P(e);$=!t&&i!==n||null==i?null!=o?o:S:i,U=!t&&i!==n||null==n?$:n,C||($+=g,U+=g),C=!0,e?.geometry?.extent&&"polygon"===e?.geometry?.type?(p=[$,U],U=p[0]>p[1]?1e3*p[1]/p[0]:1e3,$=p[0]>p[1]?1e3:1e3*p[0]/p[1],d.shape={type:"path",path:j(e.geometry,$,U)}):d.shape=t?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:u.fill[0];break}case y:{const i=Math.min(n(t.width),a||z),s=Math.min(n(t.height),a||z),{width:r,height:h}=P(e),c=r===h&&null!=r?r:null!=o?o:Math.max(i,s),m=t.width/t.height;$=m<=1?Math.ceil(c*m):c,U=m<=1?c:Math.ceil(c/m),d.shape={type:"image",x:-Math.round($/2),y:-Math.round(U/2),width:$,height:U,src:t.url||""},l&&(A=!0);break}case v:{const i=t,l=e?.overrideText||i.text||M,s=i.font,{width:r,height:h}=P(e),c=null!=h?h:null!=o?o:Math.min(n(s.size),a||z),{width:m,height:u}=B(l,{weight:s.weight,size:c,family:s.family}),p=/[\uE600-\uE6FF]/.test(l);$=r??(p?c:m),U=p?c:u;let g=.5*(p?c:u);p&&(g+=5),d.shape={type:"text",text:l,x:i.xoffset||0,y:i.yoffset||g,align:"middle",alignBaseline:i.verticalAlignment,decoration:s&&s.decoration,rotated:i.rotated,kerning:i.kerning},d.font=s&&{size:c,style:s.style,decoration:s.decoration,weight:s.weight,family:s.family};break}}return{shapeDescriptor:d,size:[$,U],outputSize:p,renderOptions:{node:e?.node,scale:C,opacity:e?.opacity,rotations:[l],useRotationSize:A,effectView:e?.effectView,ariaLabel:e?.ariaLabel}}}async function D(t,e){const{shapeDescriptor:o,size:n,renderOptions:a,outputSize:l}=Z(t,e);if(!o.shape)throw new i("symbolPreview: renderPreviewHTML2D","symbol not supported.");await U(t,o),await A(t,o,n,e);const s=[[o]];if("object"==typeof e?.symbolConfig&&e?.symbolConfig?.applyColorModulation){const t=.6*n[0];s.unshift([{...o,offset:[-t,0],fill:p(o.fill,-.3)}]),s.push([{...o,offset:[t,0],fill:p(o.fill,.3)}]),n[0]+=2*t,a.scale=!1}"text"===t.type&&E(t,o,s,n,a);const r=d(s,n,a);if(l&&r){const t="img"===r.nodeName.toLowerCase()?r:r.firstChild;"svg"===t.nodeName.toLowerCase()&&t.setAttribute("viewBox",`0 0 ${n[0].toString()} ${n[1].toString()}`),t.setAttribute("width",l[0].toString()),t.setAttribute("height",l[1].toString()),l.length>2&&(t.style.setProperty("padding-left",l[2]?.toString()+"px"),t.style.setProperty("padding-right",l[2]?.toString()+"px"),t.style.setProperty("padding-top",l[3]?.toString()+"px"),t.style.setProperty("padding-bottom",l[3]?.toString()+"px"),t.style.setProperty("box-sizing","border-box"))}return r}function q(i,o=C){const n=s(i),a=r(i),l=!n||"type"in n?null:new t(n),h=a?.color?new t(a?.color):null,c=l?F(e(l),o):null,m=h?F(e(h),o):null;return m?c?c===m?c:o>=C?"light":"dark":m:c}export{q as getContrastingBackgroundTheme,Z as getRenderSymbolParameters,D as previewSymbol2D};
5
+ import t from"../../Color.js";import{getColorLuminance as e}from"../../core/colorUtils.js";import i from"../../core/Error.js";import{loadFont as o}from"../../core/fontUtils.js";import{pt2px as n}from"../../core/screenUtils.js";import{quantizePolygon as a,quantizePolyline as l}from"../../geometry/support/quantizationUtils.js";import{getFill as s,getStroke as r,getDashArray as h,getPatternUrlWithColor as c}from"./gfxUtils.js";import{SymbolSizeDefaults as m,shapes as u,adjustColorBrightness as p}from"./previewUtils.js";import{renderSymbol as d}from"./renderUtils.js";import{backgroundPadding as f}from"./textUtils.js";const g="picture-fill",y="picture-marker",w="simple-fill",x="simple-line",b="simple-marker",v="text",M="Aa",S=m.size,z=m.maxSize,k=m.maxOutlineSize,L=m.lineWidth,C=225,$=document.createElement("canvas");function j(t,e,i){if("polygon"===t.type){const o=t.extent,n=0===o.width?1:o.width,l=0===o.height?1:o.height;t=a({originPosition:"upperLeft",scale:[n/e,l/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.rings.length;e++){const i=t.rings[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):t===i.length-1?(n=`l${e.toString()} ${o.toString()} Z`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}if("polyline"===t.type){const o=t.extent,n=0===o.width?1:o.width,a=0===o.height?1:o.height;t=l({originPosition:"upperLeft",scale:[n/e,a/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.paths.length;e++){const i=t.paths[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}return""}function B(t,e){const i=$.getContext("2d"),o=[];e&&(e.weight&&o.push(e.weight),e.size&&o.push(e.size+"px"),e.family&&o.push(e.family)),i.font=o.join(" ");const{width:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:l,actualBoundingBoxAscent:s,actualBoundingBoxDescent:r}=i.measureText(t);return{width:Math.ceil(Math.max(n,a+l)),height:Math.ceil(s+r),x:Math.floor(a),y:Math.floor((s-r)/2)}}function P(t){const e=t?.size;return{width:null!=e&&"object"==typeof e&&"width"in e?n(e.width):null,height:null!=e&&"object"==typeof e&&"height"in e?n(e.height):null}}async function E(t,e){const i=e.fill,o=t.color;if("pattern"===i?.type&&o&&t.type!==g){const t=await c(i.src,o.toCss(!0));i.src=t,e.fill=i}}async function U(t,e,i,n){if(!("font"in t)||!t.font||"text"!==e.shape.type)return;try{await o(t.font)}catch{}const{width:a,height:l}=P(n);if(!/[\uE600-\uE6FF]/.test(e.shape.text)){const{width:o,height:s,x:r,y:h}=B(e.shape.text,{weight:e.font?.weight,size:e.font?.size,family:e.font?.family});i[0]=a??o,i[1]=l??s,e.shape.x=r,e.shape.y=h;let c="angle"in t?t.angle:null;if(null!=n?.rotation&&(c=(c??0)+n.rotation),c){const t=c*(Math.PI/180),e=Math.abs(Math.sin(t)),o=Math.abs(Math.cos(t));i[1]=i[0]*e+i[1]*o}}}function A(t,e,i,o,a){if(null!=t.haloColor&&null!=t.haloSize){a.masking??=i.map((()=>[]));const l=n(t.haloSize);o[0]+=l,o[1]+=l,i.unshift([{...e,fill:null,stroke:{color:t.haloColor,width:2*l,join:"round",cap:"round"}}]),a.masking.unshift([{shape:{type:"rect",x:0,y:0,width:o[0]+2*f,height:o[1]+2*f},fill:[255,255,255],stroke:null},{...e,fill:[0,0,0,0],stroke:null}])}null==t.backgroundColor&&null==t.borderLineColor||(o[0]+=2*f,o[1]+=2*f,i.unshift([{shape:{type:"rect",x:0,y:0,width:o[0],height:o[1]},fill:t.backgroundColor,stroke:{color:t.borderLineColor,width:n(t.borderLineSize)}}]),a.masking?.unshift([]))}function F(t,e){return t>e?"dark":"light"}function Z(t,e){const i="number"==typeof e?.size?e?.size:null,o=null!=i?n(i):null,a=null!=e?.maxSize?n(e.maxSize):null;let l="angle"in t?t.angle:null;null!=e?.rotation&&(l=(l??0)+e.rotation);const c=s(t);let m=r(t);"dark"!==q(t,245)||e?.ignoreWhiteSymbols||(m={width:.75,...m,color:"#bdc3c7"});let p=null;const d={shape:null,fill:c,stroke:m,offset:[0,0]};m?.width&&(m.width=Math.min(m.width,k));const f=m?.width||0;let C=null!=e?.size&&(null==e?.scale||e?.scale),$=0,E=0,U=!1;switch(t.type){case b:{const i=t.style,{width:s,height:r}=P(e);let h=s===r&&null!=s?s:null!=o?o:Math.min(n(t.size),a||z);if(!0===e?.useMarkerSymbolSize&&null!==s&&null!==r){const e=Math.min(n(t.size),a||z);h=e>s&&e>r?Math.min(s,r):e}switch($=h,E=h,i){case"circle":d.shape={type:"circle",cx:0,cy:0,r:.5*h},C||($+=f,E+=f);break;case"cross":d.shape={type:"path",path:[{command:"M",values:[0,.5*E]},{command:"L",values:[$,.5*E]},{command:"M",values:[.5*$,0]},{command:"L",values:[.5*$,E]}]};break;case"diamond":d.shape={type:"path",path:[{command:"M",values:[0,.5*E]},{command:"L",values:[.5*$,0]},{command:"L",values:[$,.5*E]},{command:"L",values:[.5*$,E]},{command:"Z",values:[]}]},C||($+=f,E+=f);break;case"square":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,E]},{command:"L",values:[0,E]},{command:"Z",values:[]}]},C||($+=f,E+=f),l&&(U=!0);break;case"triangle":d.shape={type:"path",path:[{command:"M",values:[.5*$,0]},{command:"L",values:[$,E]},{command:"L",values:[0,E]},{command:"Z",values:[]}]},C||($+=f,E+=f),l&&(U=!0);break;case"x":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,E]},{command:"M",values:[$,0]},{command:"L",values:[0,E]}]},l&&(U=!0);break;case"path":d.shape={type:"path",path:t.path||""},C||($+=f,E+=f),l&&(U=!0),C=!0}break}case x:{const{width:t,height:i}=P(e),n=h(m).reduce(((t,e)=>t+e),0),a=n&&Math.ceil(L/n),l=i??o??f,s=t??(n*a||L);if(C=!0,"polyline"===e?.geometry?.type&&e?.geometry?.extent){$=s,E=i??$;const t=1e3,o=.15*t;p=[$,E],E=p[0]>p[1]?t*p[1]/p[0]:t,$=p[0]>p[1]?t:t*p[0]/p[1],m?.width&&(m.width=m.width*t/(p[1]>p[0]?p[1]:p[0]),m.width>o&&(m.width=o)),d.shape={type:"path",path:j(e.geometry,$,E)}}else $=null!=e?.maxSize?Math.min(s,e.maxSize):s,E=l,m&&(m.width=l),d.shape={type:"path",path:[{command:"M",values:[l/2,E/2]},{command:"L",values:[$-l/2,E/2]}]};break}case g:case w:{const t="object"==typeof e?.symbolConfig&&!!e?.symbolConfig?.isSquareFill,{width:i,height:n}=P(e);$=!t&&i!==n||null==i?null!=o?o:S:i,E=!t&&i!==n||null==n?$:n,C||($+=f,E+=f),C=!0,e?.geometry?.extent&&"polygon"===e?.geometry?.type?(p=[$,E],E=p[0]>p[1]?1e3*p[1]/p[0]:1e3,$=p[0]>p[1]?1e3:1e3*p[0]/p[1],d.shape={type:"path",path:j(e.geometry,$,E)}):d.shape=t?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,E]},{command:"L",values:[0,E]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:u.fill[0];break}case y:{const i=Math.min(n(t.width),a||z),s=Math.min(n(t.height),a||z),{width:r,height:h}=P(e),c=r===h&&null!=r?r:null!=o?o:Math.max(i,s),m=t.width/t.height;$=m<=1?Math.ceil(c*m):c,E=m<=1?c:Math.ceil(c/m),d.shape={type:"image",x:-Math.round($/2),y:-Math.round(E/2),width:$,height:E,src:t.url||""},l&&(U=!0);break}case v:{const i=t,l=e?.overrideText||i.text||M,s=i.font,{width:r,height:h}=P(e),c=null!=h?h:null!=o?o:Math.min(n(s.size),a||z),{width:m,height:u}=B(l,{weight:s.weight,size:c,family:s.family}),p=/[\uE600-\uE6FF]/.test(l);$=r??(p?c:m),E=p?c:u;let f=.5*(p?c:u);p&&(f+=5),d.shape={type:"text",text:l,x:i.xoffset||0,y:i.yoffset||f,align:"middle",alignBaseline:i.verticalAlignment,decoration:s&&s.decoration,rotated:i.rotated,kerning:i.kerning},d.font=s&&{size:c,style:s.style,decoration:s.decoration,weight:s.weight,family:s.family};break}}return{shapeDescriptor:d,size:[$,E],outputSize:p,renderOptions:{node:e?.node,scale:C,opacity:e?.opacity,rotations:[l],useRotationSize:U,effectView:e?.effectView,ariaLabel:e?.ariaLabel,clipBloomEffect:e?.clipBloomEffect}}}async function D(t,e){const{shapeDescriptor:o,size:n,renderOptions:a,outputSize:l}=Z(t,e);if(!o.shape)throw new i("symbolPreview: renderPreviewHTML2D","symbol not supported.");await E(t,o),await U(t,o,n,e);const s=[[o]];if("object"==typeof e?.symbolConfig&&e?.symbolConfig?.applyColorModulation){const t=.6*n[0];s.unshift([{...o,offset:[-t,0],fill:p(o.fill,-.3)}]),s.push([{...o,offset:[t,0],fill:p(o.fill,.3)}]),n[0]+=2*t,a.scale=!1}"text"===t.type&&A(t,o,s,n,a);const r=d(s,n,a);if(l&&r){const t="img"===r.nodeName.toLowerCase()?r:r.firstChild;"svg"===t.nodeName.toLowerCase()&&t.setAttribute("viewBox",`0 0 ${n[0].toString()} ${n[1].toString()}`),t.setAttribute("width",l[0].toString()),t.setAttribute("height",l[1].toString()),l.length>2&&(t.style.setProperty("padding-left",l[2]?.toString()+"px"),t.style.setProperty("padding-right",l[2]?.toString()+"px"),t.style.setProperty("padding-top",l[3]?.toString()+"px"),t.style.setProperty("padding-bottom",l[3]?.toString()+"px"),t.style.setProperty("box-sizing","border-box"))}return r}function q(i,o=C){const n=s(i),a=r(i),l=!n||"type"in n?null:new t(n),h=a?.color?new t(a?.color):null,c=l?F(e(l),o):null,m=h?F(e(h),o):null;return m?c?c===m?c:o>=C?"light":"dark":m:c}export{q as getContrastingBackgroundTheme,Z as getRenderSymbolParameters,D as previewSymbol2D};
@@ -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 t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as r,scale as n,identity as o,translate as a,rotate as s}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as l}from"./gfxUtils.js";import{nextBloomId as h,nextPatternId as f,nextLinearGradientId as c}from"./svgGlobalState.js";import"../../widgets/support/widgetUtils.js";import{tsx as u}from"../../widgets/support/jsxFactory.js";const d="http://www.w3.org/2000/svg",y=has("android"),p=has("chrome")||y&&y>=4?"auto":"optimizeLegibility",g={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},m=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let x={},w={};const k=Math.PI;function b(t,e){const i=t*(k/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map((t=>`${t.command} ${t.values.join(" ")}`)).join(" ").trim()}function M(t,i,r,n,o){if(t){if("circle"===t.type)return u("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return u("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return u("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return u("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return u("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),u("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":p,x:t.x,y:t.y},t.text)}return null}function v(e){if(!e)return{fill:"none",pattern:null,linearGradient:null};if(!("type"in e))return{fill:new t(e).toString(),pattern:null,linearGradient:null};if("pattern"===e.type){const t=`patternId-${f()}`;return{fill:`url(#${t})`,pattern:{id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}},linearGradient:null}}const i=`linearGradientId-${c()}`;return{fill:`url(#${i})`,pattern:null,linearGradient:{id:i,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map((e=>({offset:e.offset,color:e.color&&new t(e.color).toString()})))}}}function S(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=l(e).join(",")||"none")),i}function $(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function A(t){const{pattern:e,linearGradient:i}=t;if(e)return u("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},u("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map(((t,e)=>u("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color})));return u("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function G(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,a=v(e),s=S(n),l="text"===t.type?$(t,o):null,h=M(t,a.fill,s,l);h&&i.push(h)}return u("mask",{id:e,maskUnits:"userSpaceOnUse"},u("g",null,i))}function N(t,e,i){return a(t,o(t),[e,i])}function z(t,e,i,r,a){return n(t,o(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-a*i+a,t}function I(t,e,i,r){const n=e%360*Math.PI/180;s(t,o(t),n);const a=Math.cos(n),l=Math.sin(n),h=t[4],f=t[5];return t[4]=h*a-f*l+r*l-i*a+i,t[5]=f*a+h*l-i*l-r*a+r,t}function B(t,e){x&&"left"in x?(null!=x.left&&x.left>t&&(x.left=t),(null==x.right||x.right<t)&&(x.right=t),(null==x.top||x.top>e)&&(x.top=e),(null==x.bottom||x.bottom<e)&&(x.bottom=e)):x={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)B(e[r],e[r+1]);w.x=e[i-2],w.y=e[i-1];break;case"H":for(r=0;r<i;++r)B(e[r],w.y);w.x=e[i-1];break;case"V":for(r=0;r<i;++r)B(w.x,e[r]);w.y=e[i-1];break;case"m":{let t=0;"x"in w||(B(w.x=e[0],w.y=e[1]),t=2);for(r=t;r<i;r+=2)B(w.x+=e[r],w.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)B(w.x+=e[r],w.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)B(w.x+=e[r],w.y);break;case"v":for(r=0;r<i;++r)B(w.x,w.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)B(w.x+e[r],w.y+e[r+1]),B(w.x+e[r+2],w.y+e[r+3]),B(w.x+=e[r+4],w.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)B(w.x+e[r],w.y+e[r+1]),B(w.x+=e[r+2],w.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)B(e[r+5],e[r+6]);w.x=e[i-2],w.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)B(w.x+=e[r+5],w.y+=e[r+6])}}function F(t,e,i){const r=g[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),U(n)):(n={action:t,args:[]},i.push(n),U(n)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(m),i=[];if(x={},w={},!e)return null;let r="",n=[];const o=e.length;for(let s=0;s<o;++s){const t=e[s],o=parseFloat(t);isNaN(o)?(r&&F(r,n,i),n=[],r=t):n.push(o)}F(r,n,i);const a={x:0,y:0,width:0,height:0};return x&&"left"in x&&(a.x=x.left,a.y=x.top,a.width=x.right-x.left,a.height=x.bottom-x.top),a}function T(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function E(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function L(t,e,n,o,a,s,l,h,f){let c=(l&&s?b(s,e):e)/2,u=(l&&s?b(s,n):n)/2;if(f){const t=f[0],e=f[1];c=(l&&s?b(s,t):t)/2,u=(l&&s?b(s,e):e)/2}const d=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(a&&0!==d&&0!==y){const t=e!==n?e/n:d/y,i=e>n?e:n;let o=1,a=1;isNaN(i)||(t>1?(o=i/d,a=i/t/y):(a=i/y,o=i*t/d)),r(g,g,z(p,o,a,c,u)),m=!0}const x=t.x+(d-o)/2,w=t.y+(y-o)/2;if(r(g,g,N(p,c-x,u-w)),!m&&(d>e||y>n)){const t=d/e>y/n,i=(t?e:n)/(t?d:y);r(g,g,z(p,i,i,x,w))}return h&&r(g,g,N(p,h[0],h[1])),s&&r(g,g,I(p,s,x,w)),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function R(t,e,i){const r=t?.effects.find((t=>"bloom"===t.type));if(!r)return null;const{strength:n,radius:o}=r,a=n>0?o:0,s=(n+a)*e,l=4*n+1;return u("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},u("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*a)*(5**(e/100)*(.4+e/100)),result:"dilate"}),u("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:s/25}),u("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:s/50}),u("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},u("feFuncR",{slope:l,type:"linear"}),u("feFuncG",{slope:l,type:"linear"}),u("feFuncB",{slope:l,type:"linear"})),u("feMerge",null,u("feMergeNode",{in:"intensityBlur"}),u("feMergeNode",{in:"intensityBrightness"}),u("feGaussianBlur",{stdDeviation:n/10})))}function V(t,i,r,n={}){const o=[],a=[],s=h(),l=R(n.effectView,i,s);let f=null;if(l){const t=n.effectView?.effects.find((t=>"bloom"===t.type)),e=(t.strength?t.strength+t.radius/2:0)/3,o=i+i*e,a=r+r*e;f=[Math.max(o,10),Math.max(a,10)]}let c=i,y=r;if(n.useRotationSize)for(let e=0;e<t.length;e++){const t=n.rotations?.[e]??0;c=Math.max(b(t,i),c),y=Math.max(b(t,r),y)}for(let e=0;e<t.length;e++){const s=t[e],l=[],h=[];let d=0,p=0,g=0;for(const t of s){const{shape:e,fill:i,stroke:r,font:a,offset:s}=t;n.ignoreStrokeWidth||"text"===e.type||(d+=r?.width||0);const f=v(i),c=S(r),u="text"===e.type?$(e,a):null;o.push(A(f)),l.push(M(e,f.fill,c,u,n.ariaLabel)),h.push(T(e)),s&&(p+=s[0],g+=s[1])}const m=n.rotations?.[e]??0;n.useRotationSize&&(p+=(c-b(m,i))/2,g+=(y-b(m,r))/2);const x=L(E(h),i,r,d,n.scale??!1,m,n.useRotationSize??!1,[p,g],f);let w=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(G(i,t)),w=`url(#${t})`}a.push(w?u("g",{mask:w},u("g",{transform:x},l)):u("g",{transform:x},l))}l&&(e(f),c=f[0],y=f[1]);const p="display: block;";return u("svg",{"aria-label":n.ariaLabel,focusable:!1,height:y,role:"img",style:p,width:c,xmlns:d},l,u("defs",null,o),l?u("g",{filter:`url(#bloom${s})`},a):a)}export{E as computeBBox,v as generateFillAttributes,S as generateStrokeAttributes,$ as generateTextAttributes,T as getBoundingBox,L as getTransformMatrix,A as renderDef,V as renderSVG,M as renderShape};
5
+ import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as r,scale as n,identity as o,translate as a,rotate as s}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as l}from"./gfxUtils.js";import{nextBloomId as h,nextPatternId as f,nextLinearGradientId as c}from"./svgGlobalState.js";import"../../widgets/support/widgetUtils.js";import{tsx as u}from"../../widgets/support/jsxFactory.js";const d="http://www.w3.org/2000/svg",y=has("android"),p=has("chrome")||y&&y>=4?"auto":"optimizeLegibility",g={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},m=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let x={},w={};const k=Math.PI;function b(t,e){const i=t*(k/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map((t=>`${t.command} ${t.values.join(" ")}`)).join(" ").trim()}function M(t,i,r,n,o){if(t){if("circle"===t.type)return u("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return u("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return u("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return u("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return u("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),u("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":p,x:t.x,y:t.y},t.text)}return null}function v(e){if(!e)return{fill:"none",pattern:null,linearGradient:null};if(!("type"in e))return{fill:new t(e).toString(),pattern:null,linearGradient:null};if("pattern"===e.type){const t=`patternId-${f()}`;return{fill:`url(#${t})`,pattern:{id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}},linearGradient:null}}const i=`linearGradientId-${c()}`;return{fill:`url(#${i})`,pattern:null,linearGradient:{id:i,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map((e=>({offset:e.offset,color:e.color&&new t(e.color).toString()})))}}}function S(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=l(e).join(",")||"none")),i}function $(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function A(t){const{pattern:e,linearGradient:i}=t;if(e)return u("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},u("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map(((t,e)=>u("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color})));return u("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function G(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,a=v(e),s=S(n),l="text"===t.type?$(t,o):null,h=M(t,a.fill,s,l);h&&i.push(h)}return u("mask",{id:e,maskUnits:"userSpaceOnUse"},u("g",null,i))}function N(t,e,i){return a(t,o(t),[e,i])}function z(t,e,i,r,a){return n(t,o(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-a*i+a,t}function B(t,e,i,r){const n=e%360*Math.PI/180;s(t,o(t),n);const a=Math.cos(n),l=Math.sin(n),h=t[4],f=t[5];return t[4]=h*a-f*l+r*l-i*a+i,t[5]=f*a+h*l-i*l-r*a+r,t}function I(t,e){x&&"left"in x?(null!=x.left&&x.left>t&&(x.left=t),(null==x.right||x.right<t)&&(x.right=t),(null==x.top||x.top>e)&&(x.top=e),(null==x.bottom||x.bottom<e)&&(x.bottom=e)):x={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)I(e[r],e[r+1]);w.x=e[i-2],w.y=e[i-1];break;case"H":for(r=0;r<i;++r)I(e[r],w.y);w.x=e[i-1];break;case"V":for(r=0;r<i;++r)I(w.x,e[r]);w.y=e[i-1];break;case"m":{let t=0;"x"in w||(I(w.x=e[0],w.y=e[1]),t=2);for(r=t;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)I(w.x+=e[r],w.y);break;case"v":for(r=0;r<i;++r)I(w.x,w.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)I(w.x+e[r],w.y+e[r+1]),I(w.x+e[r+2],w.y+e[r+3]),I(w.x+=e[r+4],w.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)I(w.x+e[r],w.y+e[r+1]),I(w.x+=e[r+2],w.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)I(e[r+5],e[r+6]);w.x=e[i-2],w.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)I(w.x+=e[r+5],w.y+=e[r+6])}}function F(t,e,i){const r=g[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),U(n)):(n={action:t,args:[]},i.push(n),U(n)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(m),i=[];if(x={},w={},!e)return null;let r="",n=[];const o=e.length;for(let s=0;s<o;++s){const t=e[s],o=parseFloat(t);isNaN(o)?(r&&F(r,n,i),n=[],r=t):n.push(o)}F(r,n,i);const a={x:0,y:0,width:0,height:0};return x&&"left"in x&&(a.x=x.left,a.y=x.top,a.width=x.right-x.left,a.height=x.bottom-x.top),a}function E(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function T(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function L(t,e,n,o,a,s,l,h,f){let c=(l&&s?b(s,e):e)/2,u=(l&&s?b(s,n):n)/2;if(f){const t=f[0],e=f[1];c=(l&&s?b(s,t):t)/2,u=(l&&s?b(s,e):e)/2}const d=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(a&&0!==d&&0!==y){const t=e!==n?e/n:d/y,i=e>n?e:n;let o=1,a=1;isNaN(i)||(t>1?(o=i/d,a=i/t/y):(a=i/y,o=i*t/d)),r(g,g,z(p,o,a,c,u)),m=!0}const x=t.x+(d-o)/2,w=t.y+(y-o)/2;if(r(g,g,N(p,c-x,u-w)),!m&&(d>e||y>n)){const t=d/e>y/n,i=(t?e:n)/(t?d:y);r(g,g,z(p,i,i,x,w))}return h&&r(g,g,N(p,h[0],h[1])),s&&r(g,g,B(p,s,x,w)),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function R(t,e,i){const r=t?.effects.find((t=>"bloom"===t.type));if(!r)return null;const{strength:n,radius:o}=r,a=n>0?o:0,s=(n+a)*e,l=4*n+1;return u("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},u("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*a)*(5**(e/100)*(.4+e/100)),result:"dilate"}),u("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:s/25}),u("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:s/50}),u("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},u("feFuncR",{slope:l,type:"linear"}),u("feFuncG",{slope:l,type:"linear"}),u("feFuncB",{slope:l,type:"linear"})),u("feMerge",null,u("feMergeNode",{in:"intensityBlur"}),u("feMergeNode",{in:"intensityBrightness"}),u("feGaussianBlur",{stdDeviation:n/10})))}function V(t,i,r,n={}){const o=[],a=[],s=h(),l=R(n.effectView,i,s);let f=null;if(l){const t=n.effectView?.effects.find((t=>"bloom"===t.type)),e=n.clipBloomEffect||!t.strength?0:(t.strength+t.radius/2)/3,o=i+i*e,a=r+r*e;f=[Math.max(o,10),Math.max(a,10)]}let c=i,y=r;if(n.useRotationSize)for(let e=0;e<t.length;e++){const t=n.rotations?.[e]??0;c=Math.max(b(t,i),c),y=Math.max(b(t,r),y)}for(let e=0;e<t.length;e++){const s=t[e],l=[],h=[];let d=0,p=0,g=0;for(const t of s){const{shape:e,fill:i,stroke:r,font:a,offset:s}=t;n.ignoreStrokeWidth||"text"===e.type||(d+=r?.width||0);const f=v(i),c=S(r),u="text"===e.type?$(e,a):null;o.push(A(f)),l.push(M(e,f.fill,c,u,n.ariaLabel)),h.push(E(e)),s&&(p+=s[0],g+=s[1])}const m=n.rotations?.[e]??0;n.useRotationSize&&(p+=(c-b(m,i))/2,g+=(y-b(m,r))/2);const x=L(T(h),i,r,d,n.scale??!1,m,n.useRotationSize??!1,[p,g],f);let w=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(G(i,t)),w=`url(#${t})`}a.push(w?u("g",{mask:w},u("g",{transform:x},l)):u("g",{transform:x},l))}l&&(e(f),c=f[0],y=f[1]);const p="display: block;";return u("svg",{"aria-label":n.ariaLabel,focusable:!1,height:y,role:"img",style:p,width:c,xmlns:d},l,u("defs",null,o),l?u("g",{filter:`url(#bloom${s})`},a):a)}export{T as computeBBox,v as generateFillAttributes,S as generateStrokeAttributes,$ as generateTextAttributes,E as getBoundingBox,L as getTransformMatrix,A as renderDef,V as renderSVG,M as renderShape};
@@ -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/Evented.js";import{on as t}from"../../../core/events.js";import{handlesGroup as a}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{identity as r,scale as i,rotate as o,translate as n}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";class c{constructor(s,r={}){this.events=new e,this._hasMajorPerformanceCaveat=!1,this._lastRenderFrameCounter=0,this._canvas=r.canvas??document.createElement("canvas"),this._canvas.setAttribute("style","width: 100%; height:100%; display:block; willChange:transform");const i={failIfMajorPerformanceCaveat:!0,alpha:!0,antialias:!1,depth:!0,stencil:!0,powerPreference:"high-performance"};s.contains(this._canvas)||s.appendChild(this._canvas);let o=this._canvas.getContext("webgl2",i);o||(o=this._canvas.getContext("webgl2",{...i,failIfMajorPerformanceCaveat:!1}),this._hasMajorPerformanceCaveat=!0),this._gl=o,this._handles=a([t(this._canvas,"webglcontextlost",(e=>this.events.emit("webgl-context-lost",e)))])}destroy(){this._canvas.remove(),this._canvas=null,this._handles.remove(),this._gl=null}get gl(){return this._gl}render(e,t){if(this._hasMajorPerformanceCaveat||has("esri-force-performance-mode")){if(++this._lastRenderFrameCounter>=has("esri-performance-mode-frames-between-render")&&(t(),this._lastRenderViewState=e.state.clone(),this._lastRenderFrameCounter=0),this._lastRenderViewState){const[t,a,s,r,i,o]=this._computeViewTransform(this._lastRenderViewState,e.state);this._canvas.style.transform=`matrix(${t}, ${a}, ${s}, ${r}, ${i}, ${o})`}}else t()}resize(e){const t=this._canvas,a=t.style,{state:{size:s},pixelRatio:r}=e,i=s[0],o=s[1],n=Math.round(i*r),h=Math.round(o*r);t.width===n&&t.height===h||(t.width=n,t.height=h),a.width=i+"px",a.height=o+"px"}_computeViewTransform(e,t){const[a,c]=e.center,[l,m]=t.center,[f,d]=e.toScreen([0,0],l,m),[_,v]=e.toScreen([0,0],a,c),p=_-f,g=v-d,w=e.scale/t.scale,u=t.rotation-e.rotation,j=h();return r(j),i(j,j,[w,w]),o(j,j,s(u)),n(j,j,[p,g]),j}}export{c as ManagedCanvas};
5
+ import e from"../../../core/Evented.js";import{on as t}from"../../../core/events.js";import{handlesGroup as a}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{identity as r,scale as n,rotate as i,translate as o}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";class c{constructor(s,r={}){this.events=new e,this._hasMajorPerformanceCaveat=!1,this._lastRenderFrameCounter=0,null!=s?(this._canvas=document.createElement("canvas"),this._canvas.setAttribute("style","width: 100%; height:100%; display:block; willChange:transform"),s.contains(this._canvas)||s.appendChild(this._canvas)):null!=r.canvas&&(this._canvas=r.canvas);const n={failIfMajorPerformanceCaveat:!0,alpha:!0,antialias:!1,depth:!0,stencil:!0,powerPreference:"high-performance"};let i=this._canvas.getContext("webgl2",n);i||(i=this._canvas.getContext("webgl2",{...n,failIfMajorPerformanceCaveat:!1}),this._hasMajorPerformanceCaveat=!0),this._gl=i,this._handles=a([t(this._canvas,"webglcontextlost",(e=>this.events.emit("webgl-context-lost",e)))])}destroy(){this._canvas.remove(),this._canvas=null,this._handles.remove(),this._gl=null}get gl(){return this._gl}get canvas(){return this._canvas}render(e,t){if(this._hasMajorPerformanceCaveat||has("esri-force-performance-mode")){if(++this._lastRenderFrameCounter>=has("esri-performance-mode-frames-between-render")&&(t(),this._lastRenderViewState=e.state.clone(),this._lastRenderFrameCounter=0),this._lastRenderViewState){const[t,a,s,r,n,i]=this._computeViewTransform(this._lastRenderViewState,e.state);this._canvas.style.transform=`matrix(${t}, ${a}, ${s}, ${r}, ${n}, ${i})`}}else t()}resize(e){const t=this._canvas,a=t.style,{state:{size:s},pixelRatio:r}=e,n=s[0],i=s[1],o=Math.round(n*r),h=Math.round(i*r);t.width===o&&t.height===h||(t.width=o,t.height=h),a.width=n+"px",a.height=i+"px"}_computeViewTransform(e,t){const[a,c]=e.center,[l,m]=t.center,[f,_]=e.toScreen([0,0],l,m),[d,v]=e.toScreen([0,0],a,c),p=d-f,g=v-_,u=e.scale/t.scale,w=t.rotation-e.rotation,j=h();return r(j),n(j,j,[u,u]),i(j,j,s(w)),o(j,j,[p,g]),j}}export{c as ManagedCanvas};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import e from"../../../Color.js";import{ManagedCanvas as r}from"./ManagedCanvas.js";import{Stage as s}from"./Stage.js";import n from"./webgl/VideoScreenRenderer.js";class d extends s{constructor(e,s,d){super(null,s={...s,renderFrame:e=>{}},new r(null,{canvas:e})),this._requestRender=d,this.viewIsReady=!1,this.videoScreenRenderer=new n(this,s),this.videoScreenRenderer.visible=!0}requestRender(){this._requestRender()}renderChildren(r){this.videoScreenRenderer.bind(r),r.backgroundColor=e.fromArray([0,0,0,0]),super.renderChildren(r),this.videoScreenRenderer.unbind(r)}}class i extends s{constructor(e,r,s){super(e,r={...r,renderFrame:e=>{this.render(e)}},s),this._childStage=new d(s.canvas,r,(()=>this.requestRender()))}get childStage(){return this._childStage}render(e){this._childStage.viewIsReady?this._childStage.renderFrame(e):this.requestRender(),super.renderFrame(e)}processRender(e){super.processRender(e),this._childStage.viewIsReady&&this._childStage.visible&&this._childStage.videoScreenRenderer.processRender(e)}}export{d as ChildStage,i as ParentStage};
@@ -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{removeMaybe as t}from"../../../core/maybe.js";import{addFrameTask as r}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{CIMAnalyzer as n}from"../../../symbols/cim/cimAnalyzer.js";import{Container as a}from"./Container.js";import{ManagedCanvas as o}from"./ManagedCanvas.js";import{MAX_TILE_RESHUFFLES_PER_FRAME as h}from"./webgl/definitions.js";import{WGLDrawPhase as d}from"./webgl/enums.js";import l from"./webgl/Painter.js";import{ArrayBufferPool as m}from"./webgl/PooledUint32Array.js";import{Profiler as c}from"./webgl/Profiler.js";import{TileReshuffleManager as u}from"./webgl/TileReshuffleManager.js";import{startup as p,shutdown as f}from"./webgl/shaderGraph/techniques/TechniqueRegistry.js";import{MeshWriterRegistry as g}from"./webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{Timeline as _}from"../support/Timeline.js";import{TextureWrapMode as b,SizedPixelFormat as w,SizedDepthStencilFormat as R,PixelFormat as y,PixelType as x}from"../../webgl/enums.js";import{FramebufferObject as P}from"../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as j}from"../../webgl/RenderbufferDescriptor.js";import{RenderingContext as C}from"../../webgl/RenderingContext.js";import{TextureDescriptor as T}from"../../webgl/TextureDescriptor.js";const M=2e3;class O extends a{constructor(t,i){super(),this.meshWriterRegistry=new g,this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this._renderRequested=s(!1),this.stage=this,this._stationary=!0,this._reshuffleManager=new u,this._canvas=new o(t,i),this.context=new C(this._canvas.gl,i.contextOptions??{}),this.painter=new l(this.context,this),this._cimAnalyzer=new n(this.painter.textureManager.resourceManager),has("esri-2d-profiler")&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),t.appendChild(this._debugOutput));const a=()=>this.highlightGradient;this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFadeTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:i.timeline||new _,renderingOptions:i.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new c(this.context,this._debugOutput),dataUploadCounter:0,get highlightGradient(){return a()},reshuffleManager:this._reshuffleManager,backgroundColor:i.backgroundColor},this._taskHandle=r({render:e=>this.renderFrame(e)}),this._taskHandle.pause(),this._lostWebGLContextHandle=this._canvas.events.on("webgl-context-lost",(t=>this.emit("webgl-error",{error:new e("webgl-context-lost",t.statusMessage)}))),this._bufferPool=new m,p()}destroy(){f(this.context),this.removeAllChildren(),this._emptyTrash(),this._taskHandle=t(this._taskHandle),this._lostWebGLContextHandle=t(this._lostWebGLContextHandle),this._canvas.destroy(),this._debugOutput?.parentNode?.removeChild(this._debugOutput),this._bufferPool.destroy(),this.painter.dispose(),this.context.dispose(),this._canvas=null}get textureManager(){return this.painter.textureManager}get backgroundColor(){return this._renderParameters.backgroundColor}set backgroundColor(e){this._renderParameters.backgroundColor=e,this.requestRender()}get bufferPool(){return this._bufferPool}get cimAnalyzer(){return this._cimAnalyzer}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get renderRequested(){return this._renderRequested.value}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=M,this.renderRequested||(this._renderRequested.value=!0,this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this._renderRequested.value=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this.processRender(this._renderParameters),this._emptyTrash()}_createTransforms(){return{displayViewScreenMat3:i()}}renderChildren(e){for(const t of this.children)t.beforeRender(e);this._reshuffleManager.reshuffle(h),this._canvas.render(e,(()=>this._renderChildren(this.children,e)));for(const t of this.children)t.afterRender(e)}_renderChildren(e,t){const r=this.context;this.painter.textureUploadManager.upload(),r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,this.painter.beforeRenderPhases(t,t.backgroundColor,this.state.padding),t.drawPhase=d.MAP;for(const s of e)s.processRender(t);if(this.children.some((e=>e.hasHighlight))){t.drawPhase=d.HIGHLIGHT;for(const r of e)r.processRender(t)}if(this.children.some((e=>e.hasLabels))){t.drawPhase=d.LABEL;for(const r of e)r.processRender(t)}if(has("esri-tiles-debug")){t.drawPhase=d.DEBUG;for(const r of e)r.processRender(t)}this.painter.afterRenderPhases(t),t.profiler.recordEnd("drawLayers"),r.logInfo()}doRender(e){const t=this.context,{state:r,pixelRatio:s}=e;this._canvas.resize(e),t.setViewport(0,0,s*r.size[0],s*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),this.renderChildren(e)}async takeScreenshot(e,t,r,s){const i=Math.round(this.state.size[0]*e.resolutionScale),n=Math.round(this.state.size[1]*e.resolutionScale),a=e.resolutionScale,o=this.context,h=this._state.clone();if(null!=s){const e=h.viewpoint;h.viewpoint.rotation=s,h.viewpoint=e}const d={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:h,pixelRatio:a,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1,backgroundColor:r},l=new T(i,n);l.wrapMode=b.CLAMP_TO_EDGE,l.internalFormat=w.RGBA8,l.isImmutable=!0;const m=new P(o,l,new j(R.DEPTH24_STENCIL8,i,n)),c=o.getBoundFramebufferObject(),u=o.getViewport();o.bindFramebuffer(m),o.setViewport(0,0,i,n),this._renderChildren(t??this.children,d);const p=this._readbackScreenshot(m,{...e.cropArea,y:n-(e.cropArea.y+e.cropArea.height)});o.bindFramebuffer(c),o.setViewport(u.x,u.y,u.width,u.height),this.requestRender();const f=await p;let g;return 1===e.outputScale?g=f:(g=new ImageData(Math.round(f.width*e.outputScale),Math.round(f.height*e.outputScale)),(await import("../../support/screenshotUtils.js")).resampleHermite(f,g,!0)),m.dispose(),g}async _readbackScreenshot(e,t){const r=(await import("../../support/screenshotUtils.js")).createEmptyImageData(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,y.RGBA,x.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}}export{O as Stage,M as extraRenderTime};
5
+ import e from"../../../core/Error.js";import has from"../../../core/has.js";import{removeMaybe as t}from"../../../core/maybe.js";import{addFrameTask as r}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{CIMAnalyzer as a}from"../../../symbols/cim/cimAnalyzer.js";import{Container as n}from"./Container.js";import{MAX_TILE_RESHUFFLES_PER_FRAME as o}from"./webgl/definitions.js";import{WGLDrawPhase as h}from"./webgl/enums.js";import d from"./webgl/Painter.js";import{ArrayBufferPool as l}from"./webgl/PooledUint32Array.js";import{Profiler as m}from"./webgl/Profiler.js";import{TileReshuffleManager as u}from"./webgl/TileReshuffleManager.js";import{startup as c,shutdown as p}from"./webgl/shaderGraph/techniques/TechniqueRegistry.js";import{MeshWriterRegistry as g}from"./webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{Timeline as f}from"../support/Timeline.js";import{TextureWrapMode as _,SizedPixelFormat as b,SizedDepthStencilFormat as w,PixelFormat as R,PixelType as y}from"../../webgl/enums.js";import{FramebufferObject as x}from"../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as C}from"../../webgl/RenderbufferDescriptor.js";import{RenderingContext as P}from"../../webgl/RenderingContext.js";import{TextureDescriptor as j}from"../../webgl/TextureDescriptor.js";const T=2e3;class v extends n{constructor(t,i,n){super(),this.meshWriterRegistry=new g,this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this._renderRequested=s(!1),this.stage=this,this._stationary=!0,this._reshuffleManager=new u,this._managedCanvas=n,this.context=new P(this._managedCanvas.gl,i.contextOptions??{}),this.painter=new d(this.context,this),this._cimAnalyzer=new a(this.painter.textureManager.resourceManager),has("esri-2d-profiler")&&null!=t&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),t.appendChild(this._debugOutput));const o=()=>this.highlightGradient;this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFadeTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:i.timeline||new f,renderingOptions:i.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new m(this.context,this._debugOutput),dataUploadCounter:0,get highlightGradient(){return o()},reshuffleManager:this._reshuffleManager,backgroundColor:i.backgroundColor};let h=e=>this.renderFrame(e);null!=i.renderFrame&&(h=i.renderFrame),this._taskHandle=r({render:e=>h(e)}),this._taskHandle.pause(),this._lostWebGLContextHandle=this._managedCanvas.events.on("webgl-context-lost",(t=>this.emit("webgl-error",{error:new e("webgl-context-lost",t.statusMessage)}))),this._bufferPool=new l,c()}destroy(){p(this.context),this.removeAllChildren(),this._emptyTrash(),this._taskHandle=t(this._taskHandle),this._lostWebGLContextHandle=t(this._lostWebGLContextHandle),this._managedCanvas.destroy(),this._debugOutput?.parentNode?.removeChild(this._debugOutput),this._bufferPool.destroy(),this.painter.dispose(),this.context.dispose(),this._managedCanvas=null}get textureManager(){return this.painter.textureManager}get backgroundColor(){return this._renderParameters.backgroundColor}set backgroundColor(e){this._renderParameters.backgroundColor=e,this.requestRender()}get canvas(){return this._managedCanvas.canvas}get bufferPool(){return this._bufferPool}get cimAnalyzer(){return this._cimAnalyzer}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get renderRequested(){return this._renderRequested.value}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=T,this.renderRequested||(this._renderRequested.value=!0,this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this._renderRequested.value=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this.processRender(this._renderParameters),this._emptyTrash()}_createTransforms(){return{displayViewScreenMat3:i()}}renderChildren(e){for(const t of this.children)t.beforeRender(e);this._reshuffleManager.reshuffle(o),this._managedCanvas.render(e,(()=>this._renderChildren(this.children,e)));for(const t of this.children)t.afterRender(e)}_renderChildren(e,t){const r=this.context;this.painter.textureUploadManager.upload(),r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,this.painter.beforeRenderPhases(t,t.backgroundColor,this.state.padding),t.drawPhase=h.MAP;for(const s of e)s.processRender(t);if(this.children.some((e=>e.hasHighlight))){t.drawPhase=h.HIGHLIGHT;for(const r of e)r.processRender(t)}if(this.children.some((e=>e.hasLabels))){t.drawPhase=h.LABEL;for(const r of e)r.processRender(t)}if(has("esri-tiles-debug")){t.drawPhase=h.DEBUG;for(const r of e)r.processRender(t)}this.painter.afterRenderPhases(t),t.profiler.recordEnd("drawLayers"),r.logInfo()}doRender(e){const t=this.context,{state:r,pixelRatio:s}=e;this._managedCanvas.resize(e),t.setViewport(0,0,s*r.size[0],s*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),this.renderChildren(e)}async takeScreenshot(e,t,r,s){const i=Math.round(this.state.size[0]*e.resolutionScale),a=Math.round(this.state.size[1]*e.resolutionScale),n=e.resolutionScale,o=this.context,h=this._state.clone();if(null!=s){const e=h.viewpoint;h.viewpoint.rotation=s,h.viewpoint=e}const d={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:h,pixelRatio:n,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1,backgroundColor:r},l=new j(i,a);l.wrapMode=_.CLAMP_TO_EDGE,l.internalFormat=b.RGBA8,l.isImmutable=!0;const m=new x(o,l,new C(w.DEPTH24_STENCIL8,i,a)),u=o.getBoundFramebufferObject(),c=o.getViewport();o.bindFramebuffer(m),o.setViewport(0,0,i,a),this._renderChildren(t??this.children,d);const p=this._readbackScreenshot(m,{...e.cropArea,y:a-(e.cropArea.y+e.cropArea.height)});o.bindFramebuffer(u),o.setViewport(c.x,c.y,c.width,c.height),this.requestRender();const g=await p;let f;return 1===e.outputScale?f=g:(f=new ImageData(Math.round(g.width*e.outputScale),Math.round(g.height*e.outputScale)),(await import("../../support/screenshotUtils.js")).resampleHermite(g,f,!0)),m.dispose(),f}async _readbackScreenshot(e,t){const r=(await import("../../support/screenshotUtils.js")).createEmptyImageData(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,R.RGBA,y.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}}export{v as Stage,T as extraRenderTime};
@@ -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{toRadian as t}from"../../../../core/libs/gl-matrix-2/math/common.js";import{identity as e,multiply as r,translate as o,scale as i,rotate as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{normalizeMapX as c}from"../../../../geometry/support/normalizeUtils.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getWorldWidth as m}from"../../viewpointUtils.js";import{WGLDrawPhase as d}from"./enums.js";import p from"./WGLContainer.js";import{OverlayTechnique as f}from"./shaderGraph/techniques/overlay/OverlayTechnique.js";class u extends p{constructor(){super(...arguments),this._viewStateId=-1,this._dvsMat3=a(),this._overlayTechnique=new f}get dvsMat3(){return this._dvsMat3}beforeRender(t){this._updateMatrices(t),this._updateOverlays(t,this.children);for(const e of this.children)e.beforeRender(t)}doRender(t){if(t.drawPhase!==d.MAP||!this.visible)return;super.doRender(t);const e=this._overlayTechnique;for(const r of this.children)r.draw(t,e)}onDetach(){this._overlayTechnique.shutdown()}_updateMatrices(a){const{state:h}=a,{id:m,size:d,pixelRatio:p,resolution:f,rotation:u,viewpoint:v,displayMat3:_}=h;if(this._viewStateId===m)return;const M=t(u),g=p*d[0],y=p*d[1];this._localOrigin=v.targetGeometry.clone();const{x:w,y:x}=this._localOrigin,b=c(w,h.spatialReference);this._localOrigin.x=b,this._localOrigin.y=x;const j=f*g,O=f*y,R=e(this._dvsMat3);r(R,R,_),o(R,R,n(g/2,y/2)),i(R,R,l(g/j,-y/O,1)),s(R,R,-M),this._viewStateId=m}_updateOverlays(e,r){const{state:o}=e,{rotation:i,spatialReference:s,worldScreenWidth:a,size:n,viewpoint:l}=o,c=this._localOrigin;let d,p=0;const f=h(s);if(f&&s.isWrappable){const e=n[0],r=n[1],c=t(i),h=Math.abs(Math.cos(c)),u=Math.abs(Math.sin(c)),v=Math.round(e*h+r*u),[_,M]=f.valid,g=m(s),{x:y,y:w}=l.targetGeometry,x=[y,w],b=[0,0];o.toScreen(b,x);const j=[0,0];let O;O=v>a?.5*a:.5*v;const R=Math.floor((y+.5*g)/g),q=_+R*g,S=M+R*g,G=[b[0]+O,0];o.toMap(j,G),j[0]>S&&(p=g),G[0]=b[0]-O,o.toMap(j,G),j[0]<q&&(p=-g),d={worldWidth:g,xBounds:[_,M]}}for(const t of r)t.updateDrawCoords(c,p,s,d)}}export{u as default};
5
+ import{toRadian as t}from"../../../../core/libs/gl-matrix-2/math/common.js";import{identity as e,multiply as r,translate as o,scale as i,rotate as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{normalizeMapX as c}from"../../../../geometry/support/normalizeUtils.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getWorldWidth as m}from"../../viewpointUtils.js";import{WGLDrawPhase as d}from"./enums.js";import p from"./WGLContainer.js";import{OverlayTechnique as f}from"./shaderGraph/techniques/overlay/OverlayTechnique.js";class u extends p{constructor(){super(...arguments),this._viewStateId=-1,this._dvsMat3=a(),this._overlayTechnique=new f}get dvsMat3(){return this._dvsMat3}beforeRender(t){this._updateMatrices(t),this._updateOverlays(t,this.children);for(const e of this.children)e.beforeRender(t)}doRender(t){if(t.drawPhase!==d.MAP||!this.visible)return;super.doRender(t);const e=this._overlayTechnique;for(const r of this.children)r.draw(t,e)}onDetach(){this._overlayTechnique.shutdown()}_updateMatrices(a){const{state:h}=a,{id:m,size:d,pixelRatio:p,resolution:f,rotation:u,viewpoint:v,displayMat3:_}=h;if(this._viewStateId===m)return;const M=t(u),g=p*d[0],y=p*d[1];this._localOrigin=v.targetGeometry.clone();const{x:w,y:x}=this._localOrigin,b=c(w,h.spatialReference);this._localOrigin.x=b,this._localOrigin.y=x;const j=f*g,O=f*y,R=e(this._dvsMat3);r(R,R,_),o(R,R,n(g/2,y/2)),i(R,R,l(g/j,-y/O,1)),s(R,R,-M),this._viewStateId=m}_updateOverlays(e,r){const{state:o}=e,{rotation:i,spatialReference:s,worldScreenWidth:a,size:n,viewpoint:l}=o,c=this._localOrigin;let d,p=0;const f=h(s);if(f&&s.isWrappable){const e=n[0],r=n[1],c=t(i),h=Math.abs(Math.cos(c)),u=Math.abs(Math.sin(c)),v=Math.round(e*h+r*u),[_,M]=f.valid,g=m(s),{x:y,y:w}=l.targetGeometry,x=[y,w],b=[0,0];o.toScreen(b,x);const j=[0,0];let O;O=v>a?.5*a:.5*v;const R=Math.floor((y+.5*g)/g),q=_+R*g,S=M+R*g,G=[b[0]+O,0];o.toMap(j,G),j[0]>S&&(p=g),G[0]=b[0]-O,o.toMap(j,G),j[0]<q&&(p=-g),d={worldWidth:g,xBounds:[_,M]}}for(const t of r)t.updateDrawCoords(c,p,o,d)}}export{u 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{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as s}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import h from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import{DisplayObject as u}from"../DisplayObject.js";import m from"../../../layers/support/Geometry.js";import{TextureWrapMode as d}from"../../../webgl/enums.js";import{Texture as c}from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends u{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),s))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:s}=e;if(0!==i&&0!==s){if(this.texture)e.paused||this.texture.setData(e);else{const t=new p;t.wrapMode=d.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,t.width=i,t.height=s,this.texture=new c(r,t,e)}e.paused||(this.texture.generateMipmap(),this.requestRender()),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,i){const s=this.element,o=this._getFrameInfo();if(!s||!o)return;this._initializeData(t,o,r);const{controlPoints:n,horizon:a}=o,u=Math.sqrt(n.length),d=u,{x:c,y:p}=t,x=this._vertices,y=n[0],g=n[u-1],P=n[(d-1)*u],w=n[(d-1)*u+u-1],_=l(a?a[0].mapPoint:y.mapPoint,r),v=l(a?a[1].mapPoint:g.mapPoint,r),j=l(P.mapPoint,r),A=l(w.mapPoint,r);this.clipGeometry=a?new m({geometry:h.fromJSON({rings:[[[j.x,j.y],[A.x,A.y],[v.x,v.y],[_.x,_.y],[j.x,j.y]]],spatialReference:r})}):null;for(let h=0;h<n.length;h++){const t=n[h],{sourcePoint:e,mapPoint:i}=t;if(null==e||null==i)continue;const s=l(i,r);x[h*f+0]=s.x-c,x[h*f+1]=s.y-p}let M=e;if(i){const t=Math.min(_.x,v.x,j.x,A.x),e=Math.max(_.x,v.x,j.x,A.x),{worldWidth:r,xBounds:s}=i,[o,n]=s;t<o&&e>o?M=r:e>n&&t<n&&(M=-r)}this.wrapAroundShift=M,this.isWrapAround=0!==M}draw(t,e){this.visible&&(this.isReady&&this._vertices&&this._indices&&this._texCoords?e.render(t,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._texCoords,index:this._indices}):this.requestRender())}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:i}=e,s=Math.sqrt(i.length),o=s,n=new Float32Array(f*i.length),a=new Uint16Array(2*i.length);for(let m=0;m<i.length;m++){const e=i[m],{sourcePoint:s,mapPoint:o}=e;if(null==s||null==o)continue;const h=l(o,r);n[m*f+0]=h.x-t.x,n[m*f+1]=h.y-t.y,a[2*m+0]=s.x,a[2*m+1]=s.y}const h=new Uint16Array(o*s+(o-2)*(s+2));let u=0;for(let l=0;l<o;l++){for(let t=0;t<s;t++)h[u++]=l*s+t,h[u++]=(l+1)*s+t;l<o-2&&(h[u++]=(l+1)*s+(s-1),h[u++]=(l+1)*s)}this._vertices=n,this._texCoords=a,this._indices=h}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,i=e.startY,s=e.endX,n=e.endY;r=[{sourcePoint:o(t,i),mapPoint:new a(e.startLongitude,e.startLatitude)},{sourcePoint:o(s,n),mapPoint:new a(e.endLongitude,e.endLatitude)}]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e),i=Math.max(...t.map((({x:t})=>t))),s=this.element.videoWidth/i;for(let n=0;n<e;n++){const{x:e,y:i,lat:h,lon:l}=t[n];r[n]={sourcePoint:o(e*s,-i*s),mapPoint:new a(l,h)}}return r}}export{x as default};
5
+ import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as s}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import h from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import{DisplayObject as u}from"../DisplayObject.js";import m from"../../../layers/support/Geometry.js";import{TextureWrapMode as d}from"../../../webgl/enums.js";import{Texture as c}from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends u{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),s))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:s}=e;if(0!==i&&0!==s){if(this.texture)e.paused||this.texture.setData(e);else{const t=new p;t.wrapMode=d.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,t.width=i,t.height=s,this.texture=new c(r,t,e)}e.paused||(this.texture.generateMipmap(),this.requestRender()),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,i){const s=this.element,o=this._getFrameInfo();if(!s||!o)return;const{spatialReference:n}=r;this._initializeData(t,o,n);const{controlPoints:a,horizon:u}=o,d=Math.sqrt(a.length),c=d,{x:p,y:x}=t,g=this._vertices,y=a[0],w=a[d-1],P=a[(c-1)*d],_=a[(c-1)*d+d-1],v=l(u?u[0].mapPoint:y.mapPoint,n),j=l(u?u[1].mapPoint:w.mapPoint,n),M=l(P.mapPoint,n),A=l(_.mapPoint,n);this.clipGeometry=u?new m({geometry:h.fromJSON({rings:[[[M.x,M.y],[A.x,A.y],[j.x,j.y],[v.x,v.y],[M.x,M.y]]],spatialReference:n})}):null;for(let h=0;h<a.length;h++){const t=a[h],{sourcePoint:e,mapPoint:r}=t;if(null==e||null==r)continue;const i=l(r,n);g[h*f+0]=i.x-p,g[h*f+1]=i.y-x}let b=e;if(i){const t=Math.min(v.x,j.x,M.x,A.x),e=Math.max(v.x,j.x,M.x,A.x),{worldWidth:r,xBounds:s}=i,[o,n]=s;t<o&&e>o?b=r:e>n&&t<n&&(b=-r)}this.wrapAroundShift=b,this.isWrapAround=0!==b}draw(t,e){if(!this.visible)return;if(!(this.isReady&&this._vertices&&this._indices&&this._texCoords))return void this.requestRender();this.stage||console.warn("OverlayMultipoint: stage is null"),e.render(t,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._texCoords,index:this._indices})}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:i}=e,s=Math.sqrt(i.length),o=s,n=new Float32Array(f*i.length),a=new Uint16Array(2*i.length);for(let m=0;m<i.length;m++){const e=i[m],{sourcePoint:s,mapPoint:o}=e;if(null==s||null==o)continue;const h=l(o,r);n[m*f+0]=h.x-t.x,n[m*f+1]=h.y-t.y,a[2*m+0]=s.x,a[2*m+1]=s.y}const h=new Uint16Array(o*s+(o-2)*(s+2));let u=0;for(let l=0;l<o;l++){for(let t=0;t<s;t++)h[u++]=l*s+t,h[u++]=(l+1)*s+t;l<o-2&&(h[u++]=(l+1)*s+(s-1),h[u++]=(l+1)*s)}this._vertices=n,this._texCoords=a,this._indices=h}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,i=e.startY,s=e.endX,n=e.endY;r=[{sourcePoint:o(t,i),mapPoint:new a(e.startLongitude,e.startLatitude)},{sourcePoint:o(s,n),mapPoint:new a(e.endLongitude,e.endLatitude)}]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e),i=Math.max(...t.map((({x:t})=>t))),s=this.element.videoWidth/i;for(let n=0;n<e;n++){const{x:e,y:i,lat:h,lon:l}=t[n];r[n]={sourcePoint:o(e*s,-i*s),mapPoint:new a(l,h)}}return r}}export{x 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"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{backbufferStencilVisible as n}from"./definitions.js";import{WGLDrawPhase as a}from"./enums.js";import o from"./MaterialManager.js";import h from"./TextureManager.js";import{TextureUploadManager as l}from"./TextureUploadManager.js";import{WorldExtentRenderer as f}from"./WorldExtentClipRenderer.js";import{BlendEffect as c}from"./effects/BlendEffect.js";import{FeatureEffect as d}from"./effects/FeatureEffect.js";import u from"./effects/HighlightEffect.js";import{HittestEffect as p}from"./effects/HittestEffect.js";import{EffectManager as _}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as b}from"./meshing/SimpleMesh.js";import m from"./painter/RenderPass.js";import{TechniqueProgramCache as E}from"./shaderGraph/techniques/TechniqueProgramCache.js";import{TextureSamplingMode as S,TextureWrapMode as g,FramebufferBit as w,CompareFunction as M,BlendFactor as P,SizedDepthStencilFormat as C,BlendOperation as B,Face as N}from"../../../webgl/enums.js";import{FramebufferObject as O}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as R}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as A}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";class F{constructor(e,t){this.context=e,this._currentPipelineStateNeedsUpdate=!1,this._blitRenderer=new i,this._worldExtentRenderer=new f,this._brushCache=new Map,this._lastWidth=null,this._lastHeight=null,this._vtlMaterialManager=new r,this._blendEffect=new c,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new u,hittest:new p,insideEffect:new d("inside"),outsideEffect:new d("outside")},this._programCache=new E,this._shaderState={shader:null,uniforms:null,defines:null,optionalAttributes:null,useComputeBuffer:!1},this.materialManager=new o(e),this.textureManager=new h(t),this.textureUploadManager=new l(t),this._effectsManager=new _,this._quadMesh=b.fromVertexStream(e,[0,0,1,0,0,1,1,1])}dispose(){if(this._programCache.destroy(),this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=e(this._blitRenderer),this._worldExtentRenderer=e(this._worldExtentRenderer),this._quadMesh=t(this._quadMesh),this._brushCache&&(this._brushCache.forEach((e=>e.dispose())),this._brushCache.clear(),this._brushCache=null),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._vtlMaterialManager=e(this._vtlMaterialManager)}clearShaderCache(){this._programCache.destroy(),this._programCache=new E}get blitRenderer(){return this._blitRenderer}get vectorTilesMaterialManager(){return this._vtlMaterialManager}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const r=new T(e,t);r.samplingMode=S.NEAREST,r.wrapMode=g.CLAMP_TO_EDGE,s=new O(this.context,r,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:r}=e;this._worldExtentRenderer.render(e,t,s);const{width:i,height:n}=r.getViewport();if(this.updateFBOs(i,n),this._prevFBO=r.getBoundFramebufferObject(),r.bindFramebuffer(this.getFbos().output),r.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:i,a:n}=t;r.setClearColor(n*e/255,n*s/255,n*i/255,n)}else r.setClearColor(0,0,0,0);r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(w.COLOR|w.DEPTH),r.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(M.EQUAL,n,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,S.NEAREST)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,drawPhase:a,requireFBO:o}=e;if(o||x(a,i,n,s)){const e=r.getBoundFramebufferObject();this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=r.getViewport(),i=this.acquireFbo(t,s);r.bindFramebuffer(i),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(w.COLOR|w.DEPTH),r.setDepthWriteEnabled(!1)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(w.STENCIL)}afterRenderLayer(e,t){const{context:s,blendMode:r,effects:i,requireFBO:n,drawPhase:o}=e;if(n||x(o,r,i,t)){const n=s.getBoundFramebufferObject();null!=i&&i.length>0&&o===a.MAP&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,i,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA),s.setColorMask(!0,!0,!0,!0);const h=null==r||o===a.HIGHLIGHT||o===a.LABEL?"normal":r;this._blendEffect.draw(e,n.colorTexture,S.NEAREST,h,t),this.releaseFbo(n)}}renderObject(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.prepareState(e),a.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map((e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e))));return new m(t,e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r),this._currentPipelineStateNeedsUpdate=!0}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new T(e,t);s.samplingMode=S.NEAREST,s.wrapMode=g.CLAMP_TO_EDGE;const r=new A(C.DEPTH24_STENCIL8,e,t);this._stencilBuf=new R(this.context,r),this._fbos={output:new O(this.context,s,this._stencilBuf),effect0:new O(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:r}=e,i=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingEffect:n,effect:a}of i)r.bindFramebuffer(s),n.draw(e,s,a);this._currentPipelineStateNeedsUpdate=!0}setShader(e){this._shaderState.shader=e.shader,this._shaderState.uniforms=e.uniforms,this._shaderState.defines=e.defines,this._shaderState.optionalAttributes=e.optionalAttributes,this._shaderState.useComputeBuffer=e.useComputeBuffer??!1}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}submitDraw(e,t){const{shader:s,uniforms:r,defines:i,optionalAttributes:n}=this._shaderState,a=e.context,o=t.getAttributePrecisionPackFactors(),h=this._programCache.getProgram(s,o,r,i??{},n??{});return h.setUniforms(r),h.bind(a),this.updatePipelineState(a),this.setStencilRef(a,t),t.draw(e,s.locationInfo),h.cleanupTemporaryTextures(),{vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){this.setShader(t);const{shader:i,uniforms:n,defines:a,optionalAttributes:o}=this._shaderState,h=this._programCache.getProgram(i,{},n,a??{},o??{});if(h.setUniforms(n),h.bind(e),this.updatePipelineState(e),r)for(const l of r)s.bind(e,t.shader.locationInfo,l),s.draw(e);else for(let l=0;l<s.parts.length;l++)s.bind(e,t.shader.locationInfo,l),s.draw(e);s.unbind(e),h.cleanupTemporaryTextures()}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled(!0),e.setBlendEquation(B.ADD),s){case"composite":e.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA);break;case"additive":e.setBlendFunctionSeparate(P.ONE,P.ONE,P.ONE,P.ONE);break;case"custom":{const{blendParameters:s}=t,{dstAlpha:r,dstRGB:i,srcAlpha:n,srcRGB:a}=s;e.setBlendFunctionSeparate(a,i,n,r);break}case"delete":e.setBlendEquation(B.REVERSE_SUBTRACT),e.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{compare:s,mask:r,op:i,ref:n}=t;e.setStencilTestEnabled(!0),"function"!=typeof n&&e.setStencilFunctionSeparate(N.FRONT_AND_BACK,s,n,r),e.setStencilOpSeparate(N.FRONT_AND_BACK,i.fail,i.zFail,i.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i,ref:n}=r;if("function"==typeof n){const r=t.getStencilReference();if(null===r)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(N.FRONT_AND_BACK,s,r,i)}}}}}function x(e,t,s,r){return e!==a.LABEL_ALPHA&&e!==a.LABEL&&e!==a.HIGHLIGHT&&(1!==r||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{F as default};
5
+ import"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{backbufferStencilVisible as n}from"./definitions.js";import{WGLDrawPhase as a}from"./enums.js";import o from"./MaterialManager.js";import l from"./TextureManager.js";import{TextureUploadManager as h}from"./TextureUploadManager.js";import{WorldExtentRenderer as f}from"./WorldExtentClipRenderer.js";import{BlendEffect as c}from"./effects/BlendEffect.js";import{FeatureEffect as d}from"./effects/FeatureEffect.js";import u from"./effects/HighlightEffect.js";import{HittestEffect as p}from"./effects/HittestEffect.js";import{EffectManager as _}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as b}from"./meshing/SimpleMesh.js";import m from"./painter/RenderPass.js";import{TechniqueProgramCache as E}from"./shaderGraph/techniques/TechniqueProgramCache.js";import{TextureSamplingMode as S,TextureWrapMode as g,FramebufferBit as w,CompareFunction as M,BlendFactor as P,SizedDepthStencilFormat as C,BlendOperation as B,Face as N}from"../../../webgl/enums.js";import{FramebufferObject as O}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as R}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as A}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";class F{constructor(e,t){this.context=e,this._currentPipelineStateNeedsUpdate=!1,this._blitRenderer=new i,this._worldExtentRenderer=new f,this._brushCache=new Map,this._lastWidth=null,this._lastHeight=null,this._vtlMaterialManager=new r,this._blendEffect=new c,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new u,hittest:new p,insideEffect:new d("inside"),outsideEffect:new d("outside")},this._programCache=new E,this._shaderState={shader:null,uniforms:null,defines:null,optionalAttributes:null,useComputeBuffer:!1},this.materialManager=new o(e),this.textureManager=new l(t),this.textureUploadManager=new h(t),this._effectsManager=new _,this._quadMesh=b.fromVertexStream(e,[0,0,1,0,0,1,1,1])}dispose(){if(this._programCache.destroy(),this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=e(this._blitRenderer),this._worldExtentRenderer=e(this._worldExtentRenderer),this._quadMesh=t(this._quadMesh),this._brushCache&&(this._brushCache.forEach((e=>e.dispose())),this._brushCache.clear(),this._brushCache=null),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._vtlMaterialManager=e(this._vtlMaterialManager)}clearShaderCache(){this._programCache.destroy(),this._programCache=new E}get blitRenderer(){return this._blitRenderer}get vectorTilesMaterialManager(){return this._vtlMaterialManager}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const r=new T(e,t);r.samplingMode=S.NEAREST,r.wrapMode=g.CLAMP_TO_EDGE,s=new O(this.context,r,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:r}=e;this._worldExtentRenderer.render(e,t,s);const{width:i,height:n}=r.getViewport();if(this.updateFBOs(i,n),this._prevFBO=r.getBoundFramebufferObject(),r.bindFramebuffer(this.getFbos().output),r.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:i,a:n}=t;r.setClearColor(n*e/255,n*s/255,n*i/255,n)}else r.setClearColor(0,0,0,0);r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(w.COLOR|w.DEPTH),r.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(M.EQUAL,n,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,S.NEAREST)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,drawPhase:a,requireFBO:o}=e;if(r.setClearColor(0,0,0,0),o||x(a,i,n,s)){const e=r.getBoundFramebufferObject();this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=r.getViewport(),i=this.acquireFbo(t,s);r.bindFramebuffer(i),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(w.COLOR|w.DEPTH),r.setDepthWriteEnabled(!1)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(w.STENCIL)}afterRenderLayer(e,t){const{context:s,blendMode:r,effects:i,requireFBO:n,drawPhase:o}=e;if(n||x(o,r,i,t)){const n=s.getBoundFramebufferObject();null!=i&&i.length>0&&o===a.MAP&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,i,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA),s.setColorMask(!0,!0,!0,!0);const l=null==r||o===a.HIGHLIGHT||o===a.LABEL?"normal":r;this._blendEffect.draw(e,n.colorTexture,S.NEAREST,l,t),this.releaseFbo(n)}}renderObject(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.prepareState(e),a.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map((e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e))));return new m(t,e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r),this._currentPipelineStateNeedsUpdate=!0}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new T(e,t);s.samplingMode=S.NEAREST,s.wrapMode=g.CLAMP_TO_EDGE;const r=new A(C.DEPTH24_STENCIL8,e,t);this._stencilBuf=new R(this.context,r),this._fbos={output:new O(this.context,s,this._stencilBuf),effect0:new O(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:r}=e,i=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingEffect:n,effect:a}of i)r.bindFramebuffer(s),n.draw(e,s,a);this._currentPipelineStateNeedsUpdate=!0}setShader(e){this._shaderState.shader=e.shader,this._shaderState.uniforms=e.uniforms,this._shaderState.defines=e.defines,this._shaderState.optionalAttributes=e.optionalAttributes,this._shaderState.useComputeBuffer=e.useComputeBuffer??!1}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}submitDraw(e,t){const{shader:s,uniforms:r,defines:i,optionalAttributes:n}=this._shaderState,a=e.context,o=t.getAttributePrecisionPackFactors(),l=this._programCache.getProgram(s,o,r,i??{},n??{});return l.setUniforms(r),l.bind(a),this.updatePipelineState(a),this.setStencilRef(a,t),t.draw(e,s.locationInfo),l.cleanupTemporaryTextures(),{vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){this.setShader(t);const{shader:i,uniforms:n,defines:a,optionalAttributes:o}=this._shaderState,l=this._programCache.getProgram(i,{},n,a??{},o??{});if(l.setUniforms(n),l.bind(e),this.updatePipelineState(e),r)for(const h of r)s.bind(e,t.shader.locationInfo,h),s.draw(e);else for(let h=0;h<s.parts.length;h++)s.bind(e,t.shader.locationInfo,h),s.draw(e);s.unbind(e),l.cleanupTemporaryTextures()}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled(!0),e.setBlendEquation(B.ADD),s){case"composite":e.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA);break;case"additive":e.setBlendFunctionSeparate(P.ONE,P.ONE,P.ONE,P.ONE);break;case"custom":{const{blendParameters:s}=t,{dstAlpha:r,dstRGB:i,srcAlpha:n,srcRGB:a}=s;e.setBlendFunctionSeparate(a,i,n,r);break}case"delete":e.setBlendEquation(B.REVERSE_SUBTRACT),e.setBlendFunctionSeparate(P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{compare:s,mask:r,op:i,ref:n}=t;e.setStencilTestEnabled(!0),"function"!=typeof n&&e.setStencilFunctionSeparate(N.FRONT_AND_BACK,s,n,r),e.setStencilOpSeparate(N.FRONT_AND_BACK,i.fail,i.zFail,i.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i,ref:n}=r;if("function"==typeof n){const r=t.getStencilReference();if(null===r)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(N.FRONT_AND_BACK,s,r,i)}}}}}function x(e,t,s,r){return e!==a.LABEL_ALPHA&&e!==a.LABEL&&e!==a.HIGHLIGHT&&(1!==r||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{F as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{disposeMaybe as e}from"../../../../core/maybe.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import o from"../../../../geometry/Point.js";import{load as s,execute as i}from"../../../../geometry/operators/projectOperator.js";import{DisplayObject as a}from"../DisplayObject.js";import{VideoScreenTechnique as n}from"./shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js";import{TextureSamplingMode as h,TextureWrapMode as d,ColorAttachment0 as c,SizedPixelFormat as u}from"../../../webgl/enums.js";import{FramebufferObject as l}from"../../../webgl/FramebufferObject.js";import{Texture as m}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";class b extends a{constructor(e,t){super(),this._controlPointsOwner=t,this.readbackScreenCoords=r(),this.videoTextureCoords=new Array(36),this.overlayTextureCoords=new Array(36),this._prevFBO=null,this._acquiredFBO=null,this._isBound=!1,this._hasCoordinates=!1,this._geIsLoaded=!1,this._technique=new n,this.visible=!1,this.stage=e;for(let r=0;r<6;r++){const e=r/5;for(let t=0;t<6;t++){const o=t/5;this.videoTextureCoords[6*r+t]={u:o,v:e}}}}getMesh(e){throw new Error("Method not implemented.")}destroy(){e(this._readbackTexture)}bind(e){const{context:t,pixelRatio:r,state:o}=e;if(this._update(o),!this.ready||0===this.readbackScreenCoords[2]||0===this.readbackScreenCoords[3])return this.requestRender(),!1;const{size:s}=o,i=Math.round(r*s[0]),a=Math.round(r*s[1]),n=new x(i,a);return n.samplingMode=h.LINEAR,n.wrapMode=d.CLAMP_TO_EDGE,this._acquiredFBO||(this._acquiredFBO=new l(t,n)),this._acquiredFBO.resize(i,a),t.bindFramebuffer(this._acquiredFBO),this._isBound=!0,!0}unbind(e){if(!this._isBound)return;const{context:t,pixelRatio:r,state:o}=e,{size:s}=o,i=this._acquiredFBO;if(!i.getColorTexture(c))throw new Error("Failed to get color texture from FBO.");const a=this._getReadbackTexture(e),n=this.readbackScreenCoords,h=Math.round(r*n[0]),d=Math.round(r*(s[1]-n[1]))-a.descriptor.height,u=h+a.descriptor.width,l=d+a.descriptor.height,m=Math.max(h,0),x=Math.max(d,0),b=Math.min(u,i.width)-m,f=Math.min(l,i.height)-x;b>0&&f>0&&i.copyToTexture(m,x,b,f,m-h,x-d,a),t.bindFramebuffer(this._prevFBO)}_update(e){const r=this._controlPointsOwner.groundControlPoints(),a=r?.length;if(!a)return;if(s().then((()=>{this._geIsLoaded=!0})),!this._geIsLoaded)return void this.requestRender();const n=new Array(a),h=e.spatialReference;for(let t=0;t<a;t++){const{lat:e,lon:s}=r[t],a=new o(s,e);n[t]=i(a,h)}const d=[];let c=1/0,u=1/0,l=-1/0,m=-1/0;for(const o of n){const r=t();e.toScreen(r,o.x,o.y),d.push({x:r[0],y:r[1]}),c=Math.min(c,r[0]),u=Math.min(u,r[1]),l=Math.max(l,r[0]),m=Math.max(m,r[1])}const x=[c,m],b=[l,u];this.readbackScreenCoords[0]=Math.max(Math.floor(x[0]),0),this.readbackScreenCoords[1]=Math.max(Math.floor(b[1]),0),this.readbackScreenCoords[2]=Math.ceil(b[0]),this.readbackScreenCoords[3]=Math.ceil(x[1]);for(let t=0;t<d.length;t++){const e=d[t],r=(e.x-c)/(l-c),o=(m-e.y)/(m-u);this.overlayTextureCoords[t]={u:r,v:o}}this._hasCoordinates=!0}_createTransforms(){return null}doRender(e){if(!this._readbackTexture||!this._hasCoordinates)return void this.requestRender();const{state:t,pixelRatio:r}=e,{size:o}=t,s=[Math.round(r*o[0]),Math.round(r*o[1])],i=this._readbackTexture.descriptor,a=[i.width,i.height];this._technique.render(e,{texture:this._readbackTexture,textureCoords:this.overlayTextureCoords,opacity:1,screenSize:s,size:a})}_getReadbackTexture(e){const{context:t,pixelRatio:r}=e,o=Math.round(r*Math.abs(this.readbackScreenCoords[2]-this.readbackScreenCoords[0])),s=Math.round(r*Math.abs(this.readbackScreenCoords[3]-this.readbackScreenCoords[1]));if(this._readbackTexture)this._readbackTexture.resize(o,s);else{const e=new x(o,s);e.wrapMode=d.CLAMP_TO_EDGE,e.internalFormat=u.RGBA8,this._readbackTexture=new m(t,e)}return this._readbackTexture}}export{b 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
- var e,t;!function(e){e[e.AnimatedMarker=0]="AnimatedMarker",e[e.AnimatedMarkerShift=1]="AnimatedMarkerShift",e[e.AnimatedFill=2]="AnimatedFill",e[e.AnimatedLine=3]="AnimatedLine",e[e.Blend=4]="Blend",e[e.ComplexFill=5]="ComplexFill",e[e.ComplexOutlineFill=6]="ComplexOutlineFill",e[e.DotDensity=7]="DotDensity",e[e.Fill=8]="Fill",e[e.GradientFill=9]="GradientFill",e[e.GradientStroke=10]="GradientStroke",e[e.Grid=11]="Grid",e[e.Heatmap=12]="Heatmap",e[e.Label=13]="Label",e[e.Line=14]="Line",e[e.Magnifier=15]="Magnifier",e[e.Marker=16]="Marker",e[e.OutlineFill=17]="OutlineFill",e[e.Overlay=18]="Overlay",e[e.PatternFill=19]="PatternFill",e[e.PatternOutlineFill=20]="PatternOutlineFill",e[e.PieChart=21]="PieChart",e[e.Test=22]="Test",e[e.Text=23]="Text",e[e.TexturedLine=24]="TexturedLine",e[e.Bitmap=25]="Bitmap"}(e||(e={})),function(e){e[e.RasterColorizer=0]="RasterColorizer",e[e.RasterProcessor=1]="RasterProcessor",e[e.Aspect=2]="Aspect",e[e.BandArithmetic=3]="BandArithmetic",e[e.ColormapToRGB=4]="ColormapToRGB",e[e.CompositeBand=5]="CompositeBand",e[e.ComputeChange=6]="ComputeChange",e[e.ContrastBrightness=7]="ContrastBrightness",e[e.Convolution=8]="Convolution",e[e.Curvature=9]="Curvature",e[e.ExtractBand=10]="ExtractBand",e[e.Grayscale=11]="Grayscale",e[e.Hillshade=12]="Hillshade",e[e.Local=13]="Local",e[e.Mask=14]="Mask",e[e.NDVI=15]="NDVI",e[e.Remap=16]="Remap",e[e.Reproject=17]="Reproject",e[e.ShadedRelief=18]="ShadedRelief",e[e.Slope=19]="Slope",e[e.Statistics=20]="Statistics",e[e.Stretch=21]="Stretch"}(t||(t={}));export{t as RasterTechniqueType,e as TechniqueType};
5
+ var e,t;!function(e){e[e.AnimatedFill=0]="AnimatedFill",e[e.AnimatedLine=1]="AnimatedLine",e[e.AnimatedMarker=2]="AnimatedMarker",e[e.AnimatedMarkerShift=3]="AnimatedMarkerShift",e[e.Bitmap=4]="Bitmap",e[e.Blend=5]="Blend",e[e.ComplexFill=6]="ComplexFill",e[e.ComplexOutlineFill=7]="ComplexOutlineFill",e[e.DotDensity=8]="DotDensity",e[e.Fill=9]="Fill",e[e.GradientFill=10]="GradientFill",e[e.GradientStroke=11]="GradientStroke",e[e.Grid=12]="Grid",e[e.Heatmap=13]="Heatmap",e[e.Label=14]="Label",e[e.Line=15]="Line",e[e.Magnifier=16]="Magnifier",e[e.Marker=17]="Marker",e[e.OutlineFill=18]="OutlineFill",e[e.Overlay=19]="Overlay",e[e.PatternFill=20]="PatternFill",e[e.PatternOutlineFill=21]="PatternOutlineFill",e[e.PieChart=22]="PieChart",e[e.Test=23]="Test",e[e.Text=24]="Text",e[e.TexturedLine=25]="TexturedLine",e[e.VideoScreen=26]="VideoScreen"}(e||(e={})),function(e){e[e.RasterColorizer=0]="RasterColorizer",e[e.RasterProcessor=1]="RasterProcessor",e[e.Aspect=2]="Aspect",e[e.BandArithmetic=3]="BandArithmetic",e[e.ColormapToRGB=4]="ColormapToRGB",e[e.CompositeBand=5]="CompositeBand",e[e.ComputeChange=6]="ComputeChange",e[e.ContrastBrightness=7]="ContrastBrightness",e[e.Convolution=8]="Convolution",e[e.Curvature=9]="Curvature",e[e.ExtractBand=10]="ExtractBand",e[e.Grayscale=11]="Grayscale",e[e.Hillshade=12]="Hillshade",e[e.Local=13]="Local",e[e.Mask=14]="Mask",e[e.NDVI=15]="NDVI",e[e.Remap=16]="Remap",e[e.Reproject=17]="Reproject",e[e.ShadedRelief=18]="ShadedRelief",e[e.Slope=19]="Slope",e[e.Statistics=20]="Statistics",e[e.Stretch=21]="Stretch"}(t||(t={}));export{t as RasterTechniqueType,e as TechniqueType};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as o,a as t}from"../../../../../../../chunks/tslib.es6.js";import{GraphShaderModule as e,FragmentOutput as r,location as s,uniform as p,input as i,VertexInput as n,UniformGroup as c,FragmentInput as d}from"../../GraphShaderModule.js";import{Vec4 as a,texture2D as l,Vec2 as x,Float as y,Sampler2D as u}from"../../graph/glsl.js";class f extends n{}o([s(0,x)],f.prototype,"position",void 0),o([s(1,x)],f.prototype,"texcoord",void 0),o([s(2,y)],f.prototype,"w",void 0);class g extends d{}class m extends c{}o([p(u)],m.prototype,"texture",void 0),o([p(y)],m.prototype,"opacity",void 0);class h extends e{constructor(){super(...arguments),this.type="VideoScreenShader"}vertex(o){const{position:t,texcoord:e,w:r}=o;return{glPosition:new a(t,0,r),texcoord:e}}fragment(o){const t=new r;return t.fragColor=l(this.config.texture,o.texcoord).multiply(this.config.opacity),t}}o([p(m)],h.prototype,"config",void 0),o([t(0,i(f))],h.prototype,"vertex",null),o([t(0,i(g))],h.prototype,"fragment",null);export{h as VideoScreenShader};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{destroyMaybe as e}from"../../../../../../../core/maybe.js";import{Mesh as t}from"../../../meshing/Mesh.js";import{simplePipelineState as r}from"../../utils.js";import{Technique as s}from"../Technique.js";import{TechniqueType as o}from"../TechniqueType.js";import{VideoScreenShader as i}from"../shaders/VideoScreenShader.js";import{PrimitiveType as n,DataType as m}from"../../../../../../webgl/enums.js";import{VertexElementDescriptor as h}from"../../../../../../webgl/VertexElementDescriptor.js";class u extends s{constructor(){super(...arguments),this.type=o.VideoScreen,this._mesh=null,this.shaders={geometry:new i}}render(e,t){const{context:s,painter:o}=e,{texture:i,textureCoords:n}=t,m=this._getMesh(e),h=2,u=2,a=-1,p=1,c=new Float32Array(180);for(let r=0;r<6;r++){const e=u*r/5;for(let t=0;t<6;t++){const s=h*t/5,{u:o,v:i}=n[6*r+t];c[5*(6*r+t)]=a+s,c[5*(6*r+t)+1]=p-e,c[5*(6*r+t)+2]=o,c[5*(6*r+t)+3]=i,c[5*(6*r+t)+4]=1}}m.vertexBuffers.get("geometry")?.buffer.setData(c);const f={texture:{texture:i,unit:0},opacity:t.opacity},d={shader:this.shaders.geometry,uniforms:{config:f},defines:{},optionalAttributes:null,useComputeBuffer:!1};o.setPipelineState(r),o.submitDrawMeshUntyped(s,d,m)}shutdown(){e(this._mesh)}_getMesh(e){const{context:r}=e,s=new Uint32Array(150);for(let t=0;t<5;t++)for(let e=0;e<5;e++){const r=6*(5*t+e),o=6*(t+1)+e+1,i=o-1,n=o-6,m=o-7;s[r]=o,s[r+1]=i,s[r+2]=n,s[r+3]=i,s[r+4]=m,s[r+5]=n}return this._mesh||(this._mesh=new t(r,{vertex:{geometry:{data:new Float32Array(180),attributes:[new h("position",2,m.FLOAT,0,20),new h("texcoord",2,m.FLOAT,8,20),new h("w",1,m.FLOAT,16,20)]}},index:{index:{data:s}},groups:[{primitive:n.TRIANGLES,index:"index"}],parts:[{group:0,start:0,count:s.length}]})),this._mesh}}export{u as VideoScreenTechnique};
@@ -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"../../../Graphic.js";import t from"../../../core/Collection.js";import i from"../../../core/Error.js";import"../../../core/has.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../core/MapUtils.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as n,syncAndInitial as l,on as m}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../geometry/Extent.js";import{create as h}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as d}from"../../../geometry/support/contains.js";import{extentIntersectsPolygon as f}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as g}from"../../../layers/support/MediaElementView.js";import"../../../renderers/SimpleRenderer.js";import"../../../symbols/SimpleFillSymbol.js";import"../../../core/scheduling.js";import"../../../core/colorUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../symbols/cim/enums.js";import"../../../core/floatRGBA.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../engine/webgl/definitions.js";import"../engine/webgl/animations/instructions.js";import"../../../symbols/Font.js";import"../../../core/mathUtils.js";import"../../../core/ObjectPool.js";import"../../../geometry/support/Axis.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../geometry/support/TileClipper.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/alignmentUtils.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Evented.js";import"../engine/transitions/FadeTransition.js";import"../engine/webgl/enums.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../webgl/enums.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/checkWebGLError.js";import"../engine/webgl/DefaultVertexAttributeLayouts.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/number.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../../webgl/Texture.js";import"../../webgl/FBOAttachmentType.js";import"../engine/vectorTiles/style/StyleDefinition.js";import"../engine/vectorTiles/enums.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/TechniqueType.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../Color.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/shaderGraph/techniques/shaders/constants.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../arcade/ArcadeDate.js";import"../../../intl/locale.js";import"luxon";import"../../../core/sql/UnknownTimeZone.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/renderState.js";import"../../3d/webgl-engine/core/shaderModules/glsl.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../../../chunks/earcut.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtilsCommon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/Ellipsoid.js";import"../../../kernel.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../core/unitUtils.js";import"../../../geometry/ellipsoidUtils.js";import"../../../chunks/pe.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import u from"../tiling/TileQueue.js";import j from"../tiling/TileStrategy.js";import y from"../engine/webgl/Overlay.js";import b from"../engine/webgl/OverlayContainer.js";import{LayerView2DMixin as w}from"./LayerView2D.js";import _ from"../../layers/LayerView.js";import v from"../../layers/MediaLayerView.js";import{TaskPriority as E}from"../../support/Scheduler.js";let G=class extends(w(v(_))){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new Map,this._debugGraphicsView=null,this._interaction=null,this.layer=null,this.elements=new t}initialize(){this.addHandles([n((()=>[this.interactive,this.suspended]),(async()=>{if(this.interactive&&!this._interaction){const{MediaLayerInteraction:e}=await import("./support/MediaLayerInteraction.js");this._interaction=new e({view:this.view,layer:this.layer}),this.selectedElement!==this._interaction.selectedElement&&(this._interaction.selectedElement=this.selectedElement),this.interactionOptions!==this._interaction.options&&(this._interaction.options=this.interactionOptions)}this._interaction&&(this._interaction.enabled=!this.suspended&&this.interactive)}),l),n((()=>this.interactionOptions),(e=>{this._interaction&&(this._interaction.options=e)}),l),n((()=>this.selectedElement),(e=>{this._interaction&&(this._interaction.selectedElement=e)}),l)])}attach(){this.addAttachHandles([m((()=>this.layer.effectiveSource),"refresh",(()=>{this._tileStrategy.refresh((e=>this._updateTile(e))),this.requestUpdate()})),m((()=>this.layer.effectiveSource),"change",(({element:e})=>this._elementUpdateHandler(e)))]),this._overlayContainer=new b,this.container.addChild(this._overlayContainer),this._fetchQueue=new u({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t),scheduler:this.scheduler,priority:E.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new j({cachePolicy:"purge",resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){const i=[],s=e.normalize(),r=[s.x,s.y];for(const{elementView:{normalizedCoords:o,element:n}}of this._elementReferences.values())null!=o&&d(o.rings,r)&&i.push({type:"media",element:n,layer:this.layer,mapPoint:e,sourcePoint:n.toSource(e)});return i.reverse()}canResume(){return null!=this.layer.source&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.refresh((e=>this._updateTile(e)))}_acquireTile(e){const t=new M(e.clone());return this._updateTile(t),t}_updateTile(e){this._updatingHandles.addPromise(this._fetchQueue.push(e.key).then((t=>{const[i,s]=e.setElements(t);this._referenceElements(e,i),this._dereferenceElements(e,s),this.requestUpdate()}),(e=>{o(e)||s.getLogger(this).error(e)})))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){const i=this.layer.effectiveSource;if(null==i)return[];this.view.featuresTilingScheme.getTileBounds(S,e,!0);const s=new c({xmin:S[0],ymin:S[1],xmax:S[2],ymax:S[3],spatialReference:this.view.spatialReference});return i.queryElements(s,t)}_referenceElements(e,t){if(null!=this.layer.source)for(const i of t)this._referenceElement(e,i)}_referenceElement(e,t){r(this._elementReferences,t.uid,(()=>{const e=new g({element:t,spatialReference:this.view.spatialReference}),r=new y(e);return this._overlayContainer.addChild(r),this.elements.add(t),this._updatingHandles.addPromise(t.load().catch((e=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new i("element-load-error","Element cannot be displayed",{element:t,error:e}))}))),{debugGraphic:null,elementView:e,overlay:r,tiles:new Set}})).tiles.add(e)}_dereferenceElements(e,t){for(const i of t)this._dereferenceElement(e,i)}_dereferenceElement(e,t){const i=this._elementReferences.get(t.uid);i.tiles.delete(e),i.tiles.size||(this._overlayContainer.removeChild(i.overlay),i.overlay.destroy(),i.elementView.destroy(),this._elementReferences.delete(t.uid),this.elements.remove(t),this._debugGraphicsView?.graphics.remove(i.debugGraphic))}_elementUpdateHandler(e){let t=this._elementReferences.get(e.uid);if(t){const i=t.elementView.normalizedCoords;if(null==i)return this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.elementView.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),void this._debugGraphicsView?.graphics.remove(t.debugGraphic);const s=[],r=[];for(const e of this._tileStrategy.tiles){const o=T(this.view.featuresTilingScheme,e,i);t.tiles.has(e)?o||r.push(e):o&&s.push(e)}for(const t of s)this._referenceElement(t,e);for(const t of r)this._dereferenceElement(t,e);return t=this._elementReferences.get(e.uid),void(t?.debugGraphic&&(t.debugGraphic.geometry=t.elementView.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:"geometry"})))}const i=new g({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(null!=i)for(const s of this._tileStrategy.tiles){T(this.view.featuresTilingScheme,s,i)&&this._referenceElement(s,e)}}};e([a()],G.prototype,"layer",void 0),e([a({readOnly:!0})],G.prototype,"elements",void 0),G=e([p("esri.views.2d.layers.MediaLayerView2D")],G);const S=h(),q={xmin:0,ymin:0,xmax:0,ymax:0};function T(e,t,i){return e.getTileBounds(S,t.key,!0),q.xmin=S[0],q.ymin=S[1],q.xmax=S[2],q.ymax=S[3],f(q,i)}class M{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){const t=[],i=new Set(this.elements);this.elements=e;for(const s of e)i.has(s)?i.delete(s):t.push(s);return this.isReady=!0,[t,Array.from(i)]}destroy(){}}const C=G;export{C as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../Graphic.js";import t from"../../../core/Collection.js";import i from"../../../core/Error.js";import"../../../core/has.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../core/MapUtils.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as n,syncAndInitial as l,on as m}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../geometry/Extent.js";import{create as h}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as d}from"../../../geometry/support/contains.js";import{extentIntersectsPolygon as g}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as f}from"../../../layers/support/MediaElementView.js";import"../../../renderers/SimpleRenderer.js";import"../../../symbols/SimpleFillSymbol.js";import"../../../core/scheduling.js";import"../../../core/colorUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../symbols/cim/enums.js";import"../../../core/floatRGBA.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../engine/webgl/definitions.js";import"../engine/webgl/animations/instructions.js";import"../../../symbols/Font.js";import"../../../core/mathUtils.js";import"../../../core/ObjectPool.js";import"../../../geometry/support/Axis.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../geometry/support/TileClipper.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/alignmentUtils.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Evented.js";import"../engine/transitions/FadeTransition.js";import"../engine/webgl/enums.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../webgl/enums.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/checkWebGLError.js";import"../engine/webgl/DefaultVertexAttributeLayouts.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/number.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../../webgl/Texture.js";import"../../webgl/FBOAttachmentType.js";import"../engine/vectorTiles/style/StyleDefinition.js";import"../engine/vectorTiles/enums.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/TechniqueType.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../Color.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/shaderGraph/techniques/shaders/constants.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../arcade/ArcadeDate.js";import"../../../intl/locale.js";import"luxon";import"../../../core/sql/UnknownTimeZone.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/renderState.js";import"../../3d/webgl-engine/core/shaderModules/glsl.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../../../chunks/pe.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../../../chunks/earcut.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtilsCommon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/Ellipsoid.js";import"../../../kernel.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../core/unitUtils.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import u from"../tiling/TileQueue.js";import j from"../tiling/TileStrategy.js";import y from"../engine/webgl/Overlay.js";import b from"../engine/webgl/OverlayContainer.js";import{LayerView2DMixin as w}from"./LayerView2D.js";import _ from"../../layers/LayerView.js";import v from"../../layers/MediaLayerView.js";import{TaskPriority as E}from"../../support/Scheduler.js";let G=class extends(w(v(_))){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new Map,this._debugGraphicsView=null,this._interaction=null,this.layer=null,this.elements=new t}initialize(){this.addHandles([n((()=>[this.interactive,this.suspended]),(async()=>{if(this.interactive&&!this._interaction){const{MediaLayerInteraction:e}=await import("./support/MediaLayerInteraction.js");this._interaction=new e({view:this.view,layer:this.layer}),this.selectedElement!==this._interaction.selectedElement&&(this._interaction.selectedElement=this.selectedElement),this.interactionOptions!==this._interaction.options&&(this._interaction.options=this.interactionOptions)}this._interaction&&(this._interaction.enabled=!this.suspended&&this.interactive)}),l),n((()=>this.interactionOptions),(e=>{this._interaction&&(this._interaction.options=e)}),l),n((()=>this.selectedElement),(e=>{this._interaction&&(this._interaction.selectedElement=e)}),l)])}attach(){this.addAttachHandles([m((()=>this.layer.effectiveSource),"refresh",(()=>{this._tileStrategy.refresh((e=>this._updateTile(e))),this.requestUpdate()})),m((()=>this.layer.effectiveSource),"change",(({element:e})=>this._elementUpdateHandler(e)))]),this._overlayContainer=new b,this.container.addChild(this._overlayContainer),this._fetchQueue=new u({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t),scheduler:this.scheduler,priority:E.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new j({cachePolicy:"purge",resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){const i=[],s=e.normalize(),r=[s.x,s.y];for(const{elementView:{normalizedCoords:o,element:n}}of this._elementReferences.values())null!=o&&d(o.rings,r)&&i.push({type:"media",element:n,layer:this.layer,mapPoint:e,sourcePoint:n.toSource(e)});return i.reverse()}canResume(){return null!=this.layer.source&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.refresh((e=>this._updateTile(e)))}_acquireTile(e){const t=new M(e.clone());return this._updateTile(t),t}_updateTile(e){this._updatingHandles.addPromise(this._fetchQueue.push(e.key).then((t=>{const[i,s]=e.setElements(t);this._referenceElements(e,i),this._dereferenceElements(e,s),this.requestUpdate()}),(e=>{o(e)||s.getLogger(this).error(e)})))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){const i=this.layer.effectiveSource;if(null==i)return[];this.view.featuresTilingScheme.getTileBounds(S,e,!0);const s=new c({xmin:S[0],ymin:S[1],xmax:S[2],ymax:S[3],spatialReference:this.view.spatialReference});return i.queryElements(s,t)}_referenceElements(e,t){if(null!=this.layer.source)for(const i of t)this._referenceElement(e,i)}_referenceElement(e,t){r(this._elementReferences,t.uid,(()=>{const e=new f({element:t,spatialReference:this.view.spatialReference}),r=new y(e);return this._overlayContainer.addChild(r),this.elements.add(t),this._updatingHandles.addPromise(t.load().catch((e=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new i("element-load-error","Element cannot be displayed",{element:t,error:e}))}))),{debugGraphic:null,elementView:e,overlay:r,tiles:new Set}})).tiles.add(e)}_dereferenceElements(e,t){for(const i of t)this._dereferenceElement(e,i)}_dereferenceElement(e,t){const i=this._elementReferences.get(t.uid);i.tiles.delete(e),i.tiles.size||(this._overlayContainer.removeChild(i.overlay),i.overlay.destroy(),i.elementView.destroy(),this._elementReferences.delete(t.uid),this.elements.remove(t),this._debugGraphicsView?.graphics.remove(i.debugGraphic))}_elementUpdateHandler(e){let t=this._elementReferences.get(e.uid);if(t){const i=t.elementView.normalizedCoords;if(null==i)return this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.elementView.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),void this._debugGraphicsView?.graphics.remove(t.debugGraphic);const s=[],r=[];for(const e of this._tileStrategy.tiles){const o=T(this.view.featuresTilingScheme,e,i);t.tiles.has(e)?o||r.push(e):o&&s.push(e)}for(const t of s)this._referenceElement(t,e);for(const t of r)this._dereferenceElement(t,e);return t=this._elementReferences.get(e.uid),void(t?.debugGraphic&&(t.debugGraphic.geometry=t.elementView.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:"geometry"})))}const i=new f({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(null!=i)for(const s of this._tileStrategy.tiles){T(this.view.featuresTilingScheme,s,i)&&this._referenceElement(s,e)}}};e([a()],G.prototype,"layer",void 0),e([a({readOnly:!0})],G.prototype,"elements",void 0),G=e([p("esri.views.2d.layers.MediaLayerView2D")],G);const S=h(),q={xmin:0,ymin:0,xmax:0,ymax:0};function T(e,t,i){return e.getTileBounds(S,t.key,!0),q.xmin=S[0],q.ymin=S[1],q.xmax=S[2],q.ymax=S[3],g(q,i)}class M{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){const t=[],i=new Set(this.elements);this.elements=e;for(const s of e)i.has(s)?i.delete(s):t.push(s);return this.isReady=!0,[t,Array.from(i)]}destroy(){}}const C=G;export{C as default};