@arcgis/core 4.30.0-next.20240213 → 4.30.0-next.20240214

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 (116) hide show
  1. package/TimeExtent.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/051c00021039f20ad935.js +1 -0
  4. package/assets/esri/core/workers/chunks/08ba549f9c4afc42a21c.js +1 -0
  5. package/assets/esri/core/workers/chunks/{a384f29cb3256401962a.js → 1629a8c2085dce59cd1b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/18512caeeb03b9759ab1.js +1 -0
  7. package/assets/esri/core/workers/chunks/{cc1c958aad790a44048b.js → 1ca28af7c516d8283bb0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/1f8a0fb32b96e50f5909.js +1 -0
  9. package/assets/esri/core/workers/chunks/25f7e92cb4934c4930be.js +1 -0
  10. package/assets/esri/core/workers/chunks/2649166d1a462c7f8338.js +1 -0
  11. package/assets/esri/core/workers/chunks/51e4f771bfe352967c97.js +1 -0
  12. package/assets/esri/core/workers/chunks/5467bacd2771e6b1cdfa.js +1 -0
  13. package/assets/esri/core/workers/chunks/5638d95e600ff271c5b1.js +1 -0
  14. package/assets/esri/core/workers/chunks/58f088b08e12c5435dbc.js +1 -0
  15. package/assets/esri/core/workers/chunks/5aef1e898618f8dda2c9.js +1 -0
  16. package/assets/esri/core/workers/chunks/656ec8a14df0e4b68433.js +1 -0
  17. package/assets/esri/core/workers/chunks/66f21348fb68c83b9dc3.js +1108 -0
  18. package/assets/esri/core/workers/chunks/{eb2d6f1ee63b40ae0736.js → 774b655498289b1b36bb.js} +1 -1
  19. package/assets/esri/core/workers/chunks/9310f1de92d9b82dc803.js +1 -0
  20. package/assets/esri/core/workers/chunks/{f03d62ab7806b68d0b62.js → 9fbf61675e2a5374f754.js} +1 -1
  21. package/assets/esri/core/workers/chunks/a0b017a34cafd08ce945.js +1 -0
  22. package/assets/esri/core/workers/chunks/a28711db61c1df2d7bac.js +1 -0
  23. package/assets/esri/core/workers/chunks/aa9b46bcb75c96731de3.js +1 -0
  24. package/assets/esri/core/workers/chunks/c83da4659646ce3f5b50.js +1 -0
  25. package/assets/esri/core/workers/chunks/{05ebb9cec0e1826b283f.js → cafcc53175f9d4c5de2f.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{1c6914ded7db720f7bf7.js → daf6eab5dd198ca9a67b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/e03edeaf3af46495449e.js +1 -0
  28. package/assets/esri/core/workers/chunks/e0c9f29eedfa71554445.js +1 -0
  29. package/assets/esri/core/workers/chunks/e123017c670f22266768.js +1 -0
  30. package/assets/esri/core/workers/chunks/eba3a6f0a66b51b8ec12.js +1 -0
  31. package/assets/esri/core/workers/chunks/ebb294c82207f3ff9f04.js +1 -0
  32. package/assets/esri/core/workers/chunks/{e4da908079417cc2f495.js → ee0c77889059815a31b2.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f36e55302b45e2936a5b.js +1 -0
  34. package/assets/esri/core/workers/chunks/f85e67d4a18603ccaaed.js +1 -0
  35. package/assets/esri/core/workers/chunks/f90bbebd2dc07a77ce09.js +1 -0
  36. package/chunks/vec32.js +1 -1
  37. package/interfaces.d.ts +131 -66
  38. package/layers/WFSLayer.js +1 -1
  39. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  40. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  41. package/layers/mixins/ArcGISImageService.js +1 -1
  42. package/package.json +1 -1
  43. package/portal/Portal.js +1 -1
  44. package/portal/PortalGroup.js +1 -1
  45. package/portal/PortalUser.js +1 -1
  46. package/portal/support/geometryServiceUtils.js +1 -1
  47. package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
  48. package/rest/networks/support/Association.js +1 -1
  49. package/rest/places.js +1 -1
  50. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  51. package/rest/support/ImageSampleParameters.js +1 -1
  52. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  53. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  54. package/support/elevationInfoUtils.js +1 -1
  55. package/support/revision.js +1 -1
  56. package/symbols/cim/cimAnalyzer.js +1 -1
  57. package/symbols/cim/defaultCIMValues.js +1 -1
  58. package/symbols/cim/utils.js +1 -1
  59. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  60. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  61. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  62. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  63. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  64. package/views/3d/layers/SceneLayerView3D.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  67. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  68. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  69. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  70. package/views/3d/terrain/OverlayRenderer.js +1 -1
  71. package/views/3d/webgl/RenderNode.js +1 -1
  72. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  73. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  74. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +9 -7
  75. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceConstants.js +5 -0
  76. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +8 -8
  77. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  78. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  79. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  80. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  81. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  82. package/views/draw/drawSurfaces.js +1 -1
  83. package/views/layers/ImageryTileLayerView.js +1 -1
  84. package/webdoc/support/webdocLoadUtils.js +1 -1
  85. package/webdoc/support/webdocSaveUtils.js +1 -1
  86. package/widgets/Editor.js +1 -1
  87. package/widgets/FeatureForm.js +1 -1
  88. package/widgets/Print/PrintViewModel.js +1 -1
  89. package/widgets/Search/support/locatorUtils.js +1 -1
  90. package/widgets/Sketch/SketchViewModel.js +1 -1
  91. package/assets/esri/core/workers/chunks/00b9e92f8df245a83921.js +0 -1
  92. package/assets/esri/core/workers/chunks/02ee044597c89c86b934.js +0 -1
  93. package/assets/esri/core/workers/chunks/143ccb14c9e915dd1412.js +0 -1
  94. package/assets/esri/core/workers/chunks/24649b410b757599a549.js +0 -1
  95. package/assets/esri/core/workers/chunks/2519b207894132d5ea91.js +0 -1
  96. package/assets/esri/core/workers/chunks/30f9b2a3417cbcfeecca.js +0 -1
  97. package/assets/esri/core/workers/chunks/42ab9c282bb267c3db03.js +0 -1
  98. package/assets/esri/core/workers/chunks/49afeac45250b15b5f36.js +0 -1
  99. package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +0 -1
  100. package/assets/esri/core/workers/chunks/50cdc59426ba859027e2.js +0 -1
  101. package/assets/esri/core/workers/chunks/58c5861d060c808813a1.js +0 -1
  102. package/assets/esri/core/workers/chunks/5dbb3ef6fdd25ac632ad.js +0 -1
  103. package/assets/esri/core/workers/chunks/61c4bb58ef9f2d99c75e.js +0 -1
  104. package/assets/esri/core/workers/chunks/6e50220f8e2d392e2855.js +0 -1
  105. package/assets/esri/core/workers/chunks/6fd8047741a0df006ddd.js +0 -1
  106. package/assets/esri/core/workers/chunks/7709248f59520aee6f51.js +0 -1
  107. package/assets/esri/core/workers/chunks/8852a64918caf80fc414.js +0 -1
  108. package/assets/esri/core/workers/chunks/94dfb80ab23dda92918b.js +0 -1
  109. package/assets/esri/core/workers/chunks/9ebbc75ba5c623a322aa.js +0 -1
  110. package/assets/esri/core/workers/chunks/a74c59cf5d1c4e63a4e1.js +0 -1
  111. package/assets/esri/core/workers/chunks/be562536212360943388.js +0 -1
  112. package/assets/esri/core/workers/chunks/d06d36815c2121484a13.js +0 -1
  113. package/assets/esri/core/workers/chunks/d5f06a7b0ea7951c8dd0.js +0 -1
  114. package/assets/esri/core/workers/chunks/de6d54df7ae32694fd70.js +0 -1
  115. package/assets/esri/core/workers/chunks/f13c4b9692dad5802a32.js +0 -1106
  116. package/assets/esri/core/workers/chunks/f1e8f7d1a98b9e207b1b.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.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{css as p}from"./FeatureForm/css.js";import{isGroupInput as c,isFieldInput as u,isRelationshipInput as m,isInputInGroupInput as h,isFieldElementWithInputType as v,getErrorMessageForFieldInput as _,getIconForFeature as g,isNumberFieldInput as b}from"./FeatureForm/featureFormUtils.js";import C from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{isString as y}from"./support/dataUtils.js";import{getLabelForDateFieldValue as F,getIntlOptionsForField as w,numberingSystem as R,prepareISOFieldValueForDateComponents as O,prepareUnixFieldValueForDateComponents as k,normalizeTimeOnlyString as I,getISOFieldValueFromDateComponents as M,getUnixFieldValueFromDateComponents as D}from"./support/dateUtils.js";import{globalCss as x}from"./support/globalCss.js";import{Heading as V,incrementHeadingLevel as N}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as L}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as j}from"./support/jsxFactory.js";import{substitute as E}from"../intl/substitute.js";const U="data-field-name";let S=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new C,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._inputsWithChanges.clear(),this._dateComponentMap.clear(),this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return f({block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return i(o.getLogger(this),"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(o.getLogger(this),"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return j("div",{class:this.classes(p.base,x.widget,x.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return j("form",{class:p.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&j(V,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&j("p",{class:p.description,key:"description"},e.formDescription);return j("div",{class:p.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>c(e)?this._renderGroup(e,t):u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:j("div",{class:this.classes(p.description),id:t},e)}_renderGroup(e,t){const{disabled:i,formTemplate:o,headingLevel:n}=this,{description:a,inputs:s,label:r,open:l}=e,d=s.filter((e=>e.visible)),c=this.viewModel.findField(this._focusedFieldName),h=c?.group===e,v=`${this.id}_group_${t}`,_="sequential"===this.groupDisplay;return j("calcite-block",{class:this.classes(p.group,_?p.groupSequential:null,h?p.groupActive:null,i?p.inputDisabled:null),collapsible:!0,"data-group":e,description:a||void 0,disabled:i,heading:`${r}`,headingLevel:o?.title?N(n):n,id:v,key:v,open:l,onCalciteBlockToggle:({target:t})=>this._onGroupToggle(t,e)},d.map((e=>u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,o="forward"===e?i:i.slice().reverse();let n;if(!t||m(t))n=0;else if(c(t)){const e=t.inputs.find(u);n=e?o.indexOf(e):0}else{let i;if(h(t)&&!t.group.open){const o=t.group.inputs.filter(u);i="forward"===e?o[o.length-1]:o[0]}else i=t;n=o.indexOf(i)+1}for(let a=n;a<o.length;a++){const e=o[a];if(e.visible&&u(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:n,required:a}=e,s={"aria-label":a?E(this.messages.requiredFieldLabel,{name:o}):o,class:p.label,key:`${n.id}-${i.uid}-${e.name}`},r=[j("div",{class:p.labelTextContent,key:"labelTextContainer"},o,a?j("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?j("label",{...s},r):j("calcite-label",{...s},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:n}=e,a=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(n,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),a):this._renderComboBoxComponent(e,t,a):this._renderSwitchComponent(e,a)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,a):"number"===t?this._renderNumberComponent(e,a):this._renderStringComponent(e,a)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?j("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)}):j("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.target)}):j("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return j("calcite-input-number",{...t,integer:l(e.field),loading:e.updating,type:"number",onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,F(i,t.value,{timeZone:this.timeZone,...w(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:n}=e,{class:a,key:s,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return j("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:a,"data-date-part":"date","data-field-name":t[U],key:`${s}-date-input`,max:y(l)?l:void 0,min:y(d)?d:void 0,numberingSystem:R,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=n?`${n}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,key:a,readOnly:s}=t;return j("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"time","data-field-name":t[U],key:`${a}-time-input`,numberingSystem:R,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:n,valid:a,value:s}=e,{class:r,key:l,readOnly:d}=t,{rawMax:c,rawMin:u}=o,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!a,numberingSystem:R,overlayPositioning:"fixed",readOnly:d,[U]:i,onfocus:this._onComponentFocus},h=O(c,n),v=O(u,n),_=O(s,n);return j("div",{class:p.dateInputContainer,key:`${l}-date-time-container`},j("calcite-input-date-picker",{...m,class:r,"data-date-part":"date",key:`${l}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:_.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),j("calcite-input-time-picker",{...m,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:_.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}),e.includeTimeOffset?j("calcite-input-time-zone",{...m,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:_.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:n,value:a}=e,{class:s,key:r,max:l,min:d,readOnly:c}=t,{timeZone:u}=this,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:R,overlayPositioning:"fixed",readOnly:c,[U]:o,onfocus:this._onComponentFocus},h=k(a,u),v=k(l,u),_=k(d,u);return j("div",{class:p.dateInputContainer,key:`${r}-date-time-container`},j("calcite-input-date-picker",{...m,class:s,"data-date-part":"date",key:`${r}-date-input`,max:v?.date??void 0,min:_?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:h.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),i?j("calcite-input-time-picker",{...m,class:s,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:h.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return j("calcite-input",{...i,class:this.classes(p.fieldInput,p.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:n}=e,{messages:a,messagesTemplates:s,viewModel:r,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>j("calcite-combobox-item",{key:`#${t}`,selected:o===t,textLabel:e,value:`${t}`}))))),[p,c]=d;this.viewModel.fieldsWithInvalidCodedValue.has(e)&&c.unshift(j("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e.value}`,value:`${e.value}`}));const u=c.length>0?[j("calcite-combobox-item-group",{key:"recommended",label:a.recommended},p),j("calcite-combobox-item-group",{key:"other",label:s.other},c)]:p,m="INSERT"===r.arcadeEditType,h=l.has(n),v=null==o&&(!m||h);e.showNoValueOptionEnabled&&u.unshift(j("calcite-combobox-item",{key:"empty-option",selected:v,textLabel:e.showNoValueLabel||a.empty,value:""}));const _=m&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return j("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:_,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({target:e})=>{v&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)}},u)}_renderRadioButtonComponents(e,t,i){const{name:o,value:n}=e,a=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===n,props:i})));if(e.showNoValueOptionEnabled){const t="",s=e.showNoValueLabel||this.messages.empty,r=n===t||null===n;a.unshift(this._renderRadioButtonComponent({key:"empty-option",label:s,name:o,value:t,selected:r,props:i}))}return j("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:p.inputRadioGroup,"data-field-name":i[U],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},a)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!v(e.element,"switch")&&i===e.element.input.onValue;return j("calcite-switch",{...t,checked:o,class:p.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:n,props:a}){return j("calcite-label",{class:p.inputRadioLabel,key:e,layout:"inline"},j("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:o,class:p.inputRadio,disabled:a.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),n)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?_(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?j("calcite-input-message",{icon:!0,status:"invalid"},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{relatedRecordCallbacks:n}=this;if(!o||!n?.showAllRelatedRecords)return;const a=this.messages;return j("calcite-list-item",{description:E(a.totalCount,{count:t}),label:a.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},j("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:n,relatedRecordCallbacks:a}=this;if(t&&a?.addRelatedRecord&&o)return j("calcite-button",{alignment:"center",appearance:"outline-fill",class:p.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>this._onAddRelatedRecordsClick(i,o),round:!0,scale:"s",width:"half"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:n}=e,{feature:a,relatedRecordCallbacks:s}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),s?.editRelatedRecord&&a&&s.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,p=r?()=>r.remove(i):void 0;return j("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:n,onclick:l,onmouseenter:d,onmouseleave:p,value:n},j("calcite-icon",{icon:g(i),scale:"m",slot:"content-start"}),j("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,n=o?null:this._renderDescriptionOrEmpty(e.description),a=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return j("calcite-label",{class:this.classes(p.label,p.relatedRecordsLabel),key:`relationship-${i}-container`},j("div",null,this._renderRelatedRecordsHeaderContainer(e),n,a),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return j("div",{class:p.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},j("span",null,e.label),t?j("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return j("calcite-list",{class:p.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,n=this.viewModel.findField(o),a=e.layer?.fieldsIndex.get(o),s=n?.label||a?.alias||o,r=E(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:s});return j("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},j("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return j("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},j("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return j("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:p.listObserver,key:"feature-observer"})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:n,maxLength:a,minLength:s,name:r,range:{max:l,min:d},required:c,valid:u,value:m}=e,h=this._inputsWithChanges.has(r),v=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(p.fieldInput,v?p.inputDisabled:null,h&&!u?p.inputInvalid:null),key:r,label:n,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:a>-1?a:void 0,minLength:s>-1?s:void 0,placeholder:o??void 0,readOnly:v,required:c,value:null==m?"":`${m}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[U]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(U))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value){const t=e.value,i=new ResizeObserver((()=>{e.value=void 0,e.value=t,i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);b(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,h(i)&&(i.group.open=!0),e.setFocus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null,this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:n,range:a}=i,s=this._dateComponentMap.get(n);if(!s)return;let r=this.viewModel.getValue(n),l=null;"date-only"===o?l=e.value:"time-only"===o?(r=I(r),l=I(e.value)):l="timestamp-offset"===o?null!=e.value?M({dateComponent:s.date,timeComponent:s.time,timeZoneComponent:s.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?D({oldValue:r,dateComponent:s.date,timeComponent:s.time,timeZone:t,max:a.max,min:a.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(n,l):this._updateFieldValue(n,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&h(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return v(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:o.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}};e([s()],S.prototype,"_listObserverNode",void 0),e([s()],S.prototype,"_relatedRecordsEnabled",null),e([s()],S.prototype,"disabled",null),e([s()],S.prototype,"feature",null),e([s()],S.prototype,"formTemplate",null),e([s()],S.prototype,"groupDisplay",void 0),e([s()],S.prototype,"headingLevel",void 0),e([s()],S.prototype,"label",null),e([s()],S.prototype,"layer",null),e([s()],S.prototype,"map",null),e([s(),L("esri/widgets/FeatureForm/t9n/FeatureForm")],S.prototype,"messages",void 0),e([s(),L("esri/t9n/common")],S.prototype,"messagesCommon",void 0),e([s(),L("esri/widgets/Feature/t9n/Feature")],S.prototype,"messagesFeature",void 0),e([s(),L("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],S.prototype,"messagesTemplates",void 0),e([s()],S.prototype,"relatedRecordCallbacks",null),e([s()],S.prototype,"relationshipId",null),e([s()],S.prototype,"spatialReference",null),e([s()],S.prototype,"strict",null),e([s()],S.prototype,"timeZone",null),e([s()],S.prototype,"view",null),e([s(),T(["value-change","submit"])],S.prototype,"viewModel",void 0),S=e([r("esri.widgets.FeatureForm")],S);const $=S;export{$ as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{css as c}from"./FeatureForm/css.js";import{isGroupInput as p,isFieldInput as m,isRelationshipInput as u,isInputInGroupInput as h,isFieldElementWithInputType as v,getErrorMessageForFieldInput as b,getIconForFeature as _,isNumberFieldInput as C}from"./FeatureForm/featureFormUtils.js";import g from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{isString as y}from"./support/dataUtils.js";import{getLabelForDateFieldValue as F,getIntlOptionsForField as R,numberingSystem as w,prepareISOFieldValueForDateComponents as O,prepareUnixFieldValueForDateComponents as k,normalizeTimeOnlyString as x,getISOFieldValueFromDateComponents as I,getUnixFieldValueFromDateComponents as M}from"./support/dateUtils.js";import{globalCss as D}from"./support/globalCss.js";import{Heading as V,incrementHeadingLevel as N}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as L}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as j}from"./support/jsxFactory.js";import{substitute as E}from"../intl/substitute.js";const S="data-field-name";let U=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new g,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._activeCombobox=null,this._activeComboboxClosedByWorkaround=!1,this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),this._onComboboxOpen=this._onComboboxOpen.bind(this),this._onComboboxClose=this._onComboboxClose.bind(this),this.onScroll=this.onScroll.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._inputsWithChanges.clear(),this._dateComponentMap.clear(),this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return f({block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return i(o.getLogger(this),"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(o.getLogger(this),"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return j("div",{class:this.classes(c.base,D.widget,D.panel),onscroll:this.onScroll},"ready"===e?this._renderForm():null)}_renderForm(){return j("form",{class:c.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&j(V,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&j("p",{class:c.description,key:"description"},e.formDescription);return j("div",{class:c.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>p(e)?this._renderGroup(e,t):m(e)?this._renderLabeledField(e):u(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:j("div",{class:this.classes(c.description),id:t},e)}_renderGroup(e,t){const{disabled:i,formTemplate:o,headingLevel:n}=this,{description:a,inputs:s,label:r,open:l}=e,d=s.filter((e=>e.visible)),p=this.viewModel.findField(this._focusedFieldName),h=p?.group===e,v=`${this.id}_group_${t}`,b="sequential"===this.groupDisplay;return j("calcite-block",{class:this.classes(c.group,b?c.groupSequential:null,h?c.groupActive:null,i?c.inputDisabled:null),collapsible:!0,"data-group":e,description:a||void 0,disabled:i,heading:`${r}`,headingLevel:o?.title?N(n):n,id:v,key:v,open:l,onCalciteBlockToggle:({target:t})=>this._onGroupToggle(t,e)},d.map((e=>m(e)?this._renderLabeledField(e):u(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,o="forward"===e?i:i.slice().reverse();let n;if(!t||u(t))n=0;else if(p(t)){const e=t.inputs.find(m);n=e?o.indexOf(e):0}else{let i;if(h(t)&&!t.group.open){const o=t.group.inputs.filter(m);i="forward"===e?o[o.length-1]:o[0]}else i=t;n=o.indexOf(i)+1}for(let a=n;a<o.length;a++){const e=o[a];if(e.visible&&m(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:n,required:a}=e,s={"aria-label":a?E(this.messages.requiredFieldLabel,{name:o}):o,class:c.label,key:`${n.id}-${i.uid}-${e.name}`},r=[j("div",{class:c.labelTextContent,key:"labelTextContainer"},o,a?j("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?j("label",{...s},r):j("calcite-label",{...s},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:n}=e,a=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(n,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),a):this._renderComboBoxComponent(e,t,a):this._renderSwitchComponent(e,a)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,a):"number"===t?this._renderNumberComponent(e,a):this._renderStringComponent(e,a)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?j("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)}):j("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.target)}):j("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return j("calcite-input-number",{...t,integer:l(e.field),loading:e.updating,type:"number",onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,F(i,t.value,{timeZone:this.timeZone,...R(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:n}=e,{class:a,key:s,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return j("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:a,"data-date-part":"date","data-field-name":t[S],key:`${s}-date-input`,max:y(l)?l:void 0,min:y(d)?d:void 0,numberingSystem:w,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=n?`${n}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,key:a,readOnly:s}=t;return j("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"time","data-field-name":t[S],key:`${a}-time-input`,numberingSystem:w,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:n,valid:a,value:s}=e,{class:r,key:l,readOnly:d}=t,{rawMax:p,rawMin:m}=o,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!a,numberingSystem:w,overlayPositioning:"fixed",readOnly:d,[S]:i,onfocus:this._onComponentFocus},h=O(p,n),v=O(m,n),b=O(s,n);return j("div",{class:c.dateInputContainer,key:`${l}-date-time-container`},j("calcite-input-date-picker",{...u,class:r,"data-date-part":"date",key:`${l}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:b.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),j("calcite-input-time-picker",{...u,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:b.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}),e.includeTimeOffset?j("calcite-input-time-zone",{...u,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:b.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:n,value:a}=e,{class:s,key:r,max:l,min:d,readOnly:p}=t,{timeZone:m}=this,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:w,overlayPositioning:"fixed",readOnly:p,[S]:o,onfocus:this._onComponentFocus},h=k(a,m),v=k(l,m),b=k(d,m);return j("div",{class:c.dateInputContainer,key:`${r}-date-time-container`},j("calcite-input-date-picker",{...u,class:s,"data-date-part":"date",key:`${r}-date-input`,max:v?.date??void 0,min:b?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:h.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),i?j("calcite-input-time-picker",{...u,class:s,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:h.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return j("calcite-input",{...i,class:this.classes(c.fieldInput,c.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:n}=e,{messages:a,messagesTemplates:s,viewModel:r,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>j("calcite-combobox-item",{key:`#${t}`,selected:o===t,textLabel:e,value:`${t}`}))))),[c,p]=d;this.viewModel.fieldsWithInvalidCodedValue.has(e)&&p.unshift(j("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e.value}`,value:`${e.value}`}));const m=p.length>0?[j("calcite-combobox-item-group",{key:"recommended",label:a.recommended},c),j("calcite-combobox-item-group",{key:"other",label:s.other},p)]:c,u="INSERT"===r.arcadeEditType,h=l.has(n),v=null==o&&(!u||h);e.showNoValueOptionEnabled&&m.unshift(j("calcite-combobox-item",{key:"empty-option",selected:v,textLabel:e.showNoValueLabel||a.empty,value:""}));const b=u&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return j("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:b,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxBeforeOpen:this._onComboboxOpen,onCalciteComboboxChange:({target:e})=>{v&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)},onCalciteComboboxClose:this._onComboboxClose},m)}_renderRadioButtonComponents(e,t,i){const{name:o,value:n}=e,a=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===n,props:i})));if(e.showNoValueOptionEnabled){const t="",s=e.showNoValueLabel||this.messages.empty,r=n===t||null===n;a.unshift(this._renderRadioButtonComponent({key:"empty-option",label:s,name:o,value:t,selected:r,props:i}))}return j("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:c.inputRadioGroup,"data-field-name":i[S],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},a)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!v(e.element,"switch")&&i===e.element.input.onValue;return j("calcite-switch",{...t,checked:o,class:c.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:n,props:a}){return j("calcite-label",{class:c.inputRadioLabel,key:e,layout:"inline"},j("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:o,class:c.inputRadio,disabled:a.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),n)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?b(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?j("calcite-input-message",{icon:!0,status:"invalid"},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{relatedRecordCallbacks:n}=this;if(!o||!n?.showAllRelatedRecords)return;const a=this.messages;return j("calcite-list-item",{description:E(a.totalCount,{count:t}),label:a.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},j("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:n,relatedRecordCallbacks:a}=this;if(t&&a?.addRelatedRecord&&o)return j("calcite-button",{alignment:"center",appearance:"outline-fill",class:c.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>this._onAddRelatedRecordsClick(i,o),round:!0,scale:"s",width:"half"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:n}=e,{feature:a,relatedRecordCallbacks:s}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),s?.editRelatedRecord&&a&&s.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,c=r?()=>r.remove(i):void 0;return j("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:n,onclick:l,onmouseenter:d,onmouseleave:c,value:n},j("calcite-icon",{icon:_(i),scale:"m",slot:"content-start"}),j("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,n=o?null:this._renderDescriptionOrEmpty(e.description),a=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return j("calcite-label",{class:this.classes(c.label,c.relatedRecordsLabel),key:`relationship-${i}-container`},j("div",null,this._renderRelatedRecordsHeaderContainer(e),n,a),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return j("div",{class:c.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},j("span",null,e.label),t?j("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return j("calcite-list",{class:c.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,n=this.viewModel.findField(o),a=e.layer?.fieldsIndex.get(o),s=n?.label||a?.alias||o,r=E(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:s});return j("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},j("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return j("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},j("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return j("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:c.listObserver,key:"feature-observer"})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:n,maxLength:a,minLength:s,name:r,range:{max:l,min:d},required:p,valid:m,value:u}=e,h=this._inputsWithChanges.has(r),v=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":m?"false":"true",class:this.classes(c.fieldInput,v?c.inputDisabled:null,h&&!m?c.inputInvalid:null),key:r,label:n,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:a>-1?a:void 0,minLength:s>-1?s:void 0,placeholder:o??void 0,readOnly:v,required:p,value:null==u?"":`${u}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[S]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(S))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value){const t=e.value,i=new ResizeObserver((()=>{e.value=void 0,e.value=t,i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);C(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,h(i)&&(i.group.open=!0),e.setFocus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null,this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:n,range:a}=i,s=this._dateComponentMap.get(n);if(!s)return;let r=this.viewModel.getValue(n),l=null;"date-only"===o?l=e.value:"time-only"===o?(r=x(r),l=x(e.value)):l="timestamp-offset"===o?null!=e.value?I({dateComponent:s.date,timeComponent:s.time,timeZoneComponent:s.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?M({oldValue:r,dateComponent:s.date,timeComponent:s.time,timeZone:t,max:a.max,min:a.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(n,l):this._updateFieldValue(n,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&h(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return v(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:o.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}_onComboboxClose(e){this._activeComboboxClosedByWorkaround||this._activeCombobox!==e.target||(this._activeCombobox=null)}_onComboboxOpen(e){this._activeComboboxClosedByWorkaround=!1,this._activeCombobox=e.target}onScroll(e){if(this._activeCombobox){const t=this._activeCombobox.getBoundingClientRect(),i=e.target.getBoundingClientRect();t.bottom>i.bottom?(this._activeComboboxClosedByWorkaround=!0,this._activeCombobox.open=!1):(this._activeComboboxClosedByWorkaround&&(this._activeCombobox.open=!0,this._activeComboboxClosedByWorkaround=!1),this._activeCombobox.reposition())}}};e([s()],U.prototype,"_listObserverNode",void 0),e([s()],U.prototype,"_relatedRecordsEnabled",null),e([s()],U.prototype,"disabled",null),e([s()],U.prototype,"feature",null),e([s()],U.prototype,"formTemplate",null),e([s()],U.prototype,"groupDisplay",void 0),e([s()],U.prototype,"headingLevel",void 0),e([s()],U.prototype,"label",null),e([s()],U.prototype,"layer",null),e([s()],U.prototype,"map",null),e([s(),L("esri/widgets/FeatureForm/t9n/FeatureForm")],U.prototype,"messages",void 0),e([s(),L("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([s(),L("esri/widgets/Feature/t9n/Feature")],U.prototype,"messagesFeature",void 0),e([s(),L("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],U.prototype,"messagesTemplates",void 0),e([s()],U.prototype,"relatedRecordCallbacks",null),e([s()],U.prototype,"relationshipId",null),e([s()],U.prototype,"spatialReference",null),e([s()],U.prototype,"strict",null),e([s()],U.prototype,"timeZone",null),e([s()],U.prototype,"view",null),e([s(),T(["value-change","submit"])],U.prototype,"viewModel",void 0),U=e([r("esri.widgets.FeatureForm")],U);const $=U;export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../request.js";import{isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import s from"../../core/Error.js";import{clone as i}from"../../core/lang.js";import a from"../../core/Loadable.js";import{isAbortError as l}from"../../core/promiseUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as u}from"../../intl/date.js";import{getLanguage as c}from"../../intl/locale.js";import f from"../../portal/Portal.js";import d from"../../portal/PortalQueryParams.js";import{execute as y}from"../../rest/geoprocessor/execute.js";import"../../rest/geoprocessor/GPOptions.js";import"../../config.js";import"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtilsCommon.js";import"../../geometry/support/spatialReferenceUtils.js";import"../../geometry/SpatialReference.js";import"../../geometry/support/Ellipsoid.js";import"../../geometry.js";import"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import"../../kernel.js";import"../../core/urlUtils.js";import"../../layers/support/Field.js";import"../../layers/support/MapImage.js";import"../../rest/support/DataFile.js";import"../../rest/support/FeatureSet.js";import"../../rest/support/LinearUnit.js";import"../../rest/support/ParameterValue.js";import"../../rest/support/RasterData.js";import"../../rest/support/JobInfo.js";import{execute as h}from"../../rest/print.js";import{fromJSON as v}from"../../rest/support/fileFormat.js";import{fromJSON as T}from"../../rest/support/layoutTemplate.js";import w from"../../rest/support/PrintParameters.js";import j from"../../rest/support/PrintTemplate.js";import g from"./CustomTemplate.js";const P=o.ofType(g);function S(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find((t=>e in t))){const{customTextElements:e}=t.layoutOptions;let r=m(Date.now(),u("short-date"));"ar"===c()&&(r="‏"+r),e.push({date:r})}}let x=class extends a{constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this.allowedFormats="all",this.allowedLayouts="all",this.defaultTemplates=new P,this.error=null,this.extraParameters=null,this.includeDefaultTemplates=!0,this.portal=f.getDefault(),this.printServiceUrl=null,this.printTimeout=12e4,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null}destroy(){this.view=null}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=i(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach((e=>{const r=t[e];if(r){const t=this.templateCustomTextElements?.[e];r.forEach((e=>{const[r]=Object.entries(e)[0];t?.forEach((t=>{const[o,s]=Object.entries(t)[0];r===o&&(e[r]=s)}))}))}})),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async load(t){return this.addResolvingPromise(this._loadResources(t).catch((t=>this.error=t))),this}async getLayoutTemplateInfo(t,e){const{id:r}=t,o={Layout_Item_ID:JSON.stringify({id:r})},{results:s}=await y(this._printServiceLayoutsUrl,o,null,e),i=s[0].value[0],a=i.layoutOptions.mapSurroundInfos.find((({type:t})=>"CIMMarkerNorthArrow"===t));return a&&(this.templateToNorthArrowInfo[r]=a),i}async print(t){const{view:e,extraParameters:r,updateDelay:o}=this;if(!e)throw new s("print:view-required","view is not set");S(t);const i=new w({view:e,template:t,extraParameters:r,updateDelay:o});try{return await h(this.effectivePrintServiceUrl,i,{timeout:this.printTimeout})}catch(a){throw new s("print:export-error","An error occurred while exporting the web map.",{error:a})}}toPrintTemplate({attributionEnabled:t,author:e,copyright:r,customTextElements:o,dpi:s,forceFeatureAttributes:i,format:a,height:l,includeTables:n,layout:p,layoutItem:m,legendEnabled:u,northArrowEnabled:c,scale:f,scaleEnabled:d,title:y,width:h}){const v=new j({attributionVisible:t,forceFeatureAttributes:i,format:a,includeTables:n,layout:p,layoutItem:m,layoutOptions:{authorText:e||"",copyrightText:r||"",customTextElements:o,titleText:y||""},outScale:f??0,scalePreserved:d});h&&(v.exportOptions.width=h),l&&(v.exportOptions.height=l),s&&(v.exportOptions.dpi=s),!u&&v.layoutOptions&&(v.layoutOptions.legendLayers=[]);const T=this.templateToNorthArrowInfo[m?.id??p];if(T){!(T.visible===c)&&v.layoutOptions&&(v.layoutOptions.elementOverrides={[T.name]:{visible:c}})}return v}async _loadResources(t){let e=[];if(!this.printServiceUrl){if(this.destroyed)return;try{await this.portal.load(t)}catch(a){throw new s("print:could-not-load-portal","Cannot load print resource information from portal",{error:a,url:this.effectivePrintServiceUrl})}const r=this.portal.helperServices?.printTask;r&&(this._set("effectivePrintServiceUrl",r.url),e=r.templates?.map((t=>g.fromJSON(t)))??[])}this.defaultTemplates.addMany(e);const r=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!r?.includes("gpserver"))throw new s("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl});const[o,i]=await Promise.all([this._getPrintServiceLayouts(t),this._getPrintServiceTemplates(t)]);if(this._processPrintServiceLayouts(o),this._processPrintServiceTemplates(i),!this.printServiceUrl){const e=await this._getPortalCustomTemplates(t);this.defaultTemplates.addMany(e)}}async _getPortalCustomTemplates(t){const{layoutGroupQuery:e}=this.portal;if(!e)return[];const r=new d({query:e,disableExtraQuery:!0}),o=await this.portal.queryGroups(r,t);if(!o.total)return[];const s=o.results[0],i=new d({num:100,query:"type:Layout"}),a=(await s.queryItems(i,t)).results;return a.length?a.map((t=>new g({label:t.title,layoutItem:t}))):[]}_processPrintServiceTemplates(t){this._set("templatesInfo",t)}async _getPrintServiceLayouts(t){let e=[];const r=async e=>{this._printServiceLayoutsUrl=this.effectivePrintServiceUrl.replace(/(\/GPServer\/).+/i,`$1${encodeURI(e)}`);return(await y(this._printServiceLayoutsUrl,null,null,t)).results[0].value};try{e=await r("Get Layout Templates Info Task")}catch{}if(!e||e.length<1)try{e=await r("Get Layout Templates Info")}catch{}return e}_processPrintServiceLayouts(t){const e={},r={};t.forEach((({layoutTemplate:t,layoutOptions:{customTextElements:o,mapSurroundInfos:s}})=>{const i=T(t);e[i]=o,s&&(r[i]=s.find((({type:t})=>"CIMMarkerNorthArrow"===t)))})),this._serviceTemplateCustomTextElements=Object.freeze(e),this.templateToNorthArrowInfo=r}async _getPrintServiceTemplates(t){let r;try{({data:r}=await e(this.effectivePrintServiceUrl,{...t,query:{f:"json"},timeout:this.printTimeout}))}catch(n){throw l(n)?n:new s("print:unavailable-service-info","Can't fetch templates info from service",{error:n})}const{parameters:o}=r,i=o.find((({name:t})=>"Format"===t)),a=o.find((({name:t})=>"Layout_Template"===t));return{format:this._getFormat(i),layout:this._getLayout(a)}}_getFormat(t){const e="all"===this.allowedFormats?t.choiceList:t.choiceList.filter((t=>this.allowedFormats.includes(v(t)))),o=(e.length?e:t.choiceList).map(v).filter(r),s=v(t.defaultValue),i=o.includes(s)?s:o[0];return{choiceList:o,defaultValue:i}}_getLayout(t){const e=t.choiceList.filter((t=>"map_only"!==t.toLowerCase())),o="all"===this.allowedLayouts?e:e.filter((t=>this.allowedLayouts.includes(T(t)))),s=(o.length?o:e).map(T).filter(r),i=T(t.defaultValue),a=s.includes(i)?i:s.find((t=>/(?=.*letter)(?=.*landscape)/i.test(t)))??s.find((t=>/(?=.*a4)(?=.*landscape)/i.test(t)))??s[0];return{choiceList:s,defaultValue:a}}};t([n()],x.prototype,"_serviceTemplateCustomTextElements",void 0),t([n()],x.prototype,"allowedFormats",void 0),t([n()],x.prototype,"allowedLayouts",void 0),t([n({type:P})],x.prototype,"defaultTemplates",void 0),t([n()],x.prototype,"error",void 0),t([n()],x.prototype,"extraParameters",void 0),t([n()],x.prototype,"includeDefaultTemplates",void 0),t([n({readOnly:!0})],x.prototype,"effectivePrintServiceUrl",null),t([n()],x.prototype,"effectiveTemplateCustomTextElements",null),t([n({type:f})],x.prototype,"portal",void 0),t([n()],x.prototype,"printServiceUrl",void 0),t([n()],x.prototype,"printTimeout",void 0),t([n({readOnly:!0})],x.prototype,"state",null),t([n({readOnly:!0})],x.prototype,"templatesInfo",void 0),t([n()],x.prototype,"updateDelay",void 0),t([n()],x.prototype,"view",void 0),t([n()],x.prototype,"templateCustomTextElements",void 0),t([n()],x.prototype,"templateToNorthArrowInfo",void 0),x=t([p("esri.widgets.Print.PrintViewModel")],x);const L=x;export{L as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{id as e}from"../../kernel.js";import r from"../../request.js";import{isSome as o}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{clone as a}from"../../core/lang.js";import l from"../../core/Loadable.js";import{isAbortError as n}from"../../core/promiseUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as u,convertDateFormatToIntlOptions as c}from"../../intl/date.js";import{getLanguage as f}from"../../intl/locale.js";import d from"../../portal/Portal.js";import y from"../../portal/PortalQueryParams.js";import{execute as h}from"../../rest/geoprocessor/execute.js";import"../../rest/geoprocessor/GPOptions.js";import"../../config.js";import"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtilsCommon.js";import"../../geometry/support/spatialReferenceUtils.js";import"../../geometry/SpatialReference.js";import"../../geometry/support/Ellipsoid.js";import"../../geometry.js";import"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import"../../core/urlUtils.js";import"../../layers/support/Field.js";import"../../layers/support/MapImage.js";import"../../rest/support/DataFile.js";import"../../rest/support/FeatureSet.js";import"../../rest/support/LinearUnit.js";import"../../rest/support/ParameterValue.js";import"../../rest/support/RasterData.js";import"../../rest/support/JobInfo.js";import{execute as v}from"../../rest/print.js";import{fromJSON as T}from"../../rest/support/fileFormat.js";import{fromJSON as w}from"../../rest/support/layoutTemplate.js";import g from"../../rest/support/PrintParameters.js";import j from"../../rest/support/PrintTemplate.js";import P from"./CustomTemplate.js";const S=s.ofType(P);function x(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find((t=>e in t))){const{customTextElements:e}=t.layoutOptions;let r=u(Date.now(),c("short-date"));"ar"===f()&&(r="‏"+r),e.push({date:r})}}let L=class extends l{constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this.allowedFormats="all",this.allowedLayouts="all",this.defaultTemplates=new S,this.error=null,this.extraParameters=null,this.includeDefaultTemplates=!0,this.portal=d.getDefault(),this.printServiceUrl=null,this.printTimeout=12e4,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null}destroy(){this.view=null}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=a(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach((e=>{const r=t[e];if(r){const t=this.templateCustomTextElements?.[e];r.forEach((e=>{const[r]=Object.entries(e)[0];t?.forEach((t=>{const[o,s]=Object.entries(t)[0];r===o&&(e[r]=s)}))}))}})),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async load(t){return this.addResolvingPromise(this._loadResources(t).catch((t=>this.error=t))),this}async getLayoutTemplateInfo(t,r){const{id:o}=t;"public"!==t.access&&e&&await e.getCredential(this._printServiceLayoutsUrl);const s={Layout_Item_ID:JSON.stringify({id:o})},{results:i}=await h(this._printServiceLayoutsUrl,s,null,r),a=i[0].value[0],l=a.layoutOptions.mapSurroundInfos.find((({type:t})=>"CIMMarkerNorthArrow"===t));return l&&(this.templateToNorthArrowInfo[o]=l),a}async print(t){const{view:e,extraParameters:r,updateDelay:o}=this;if(!e)throw new i("print:view-required","view is not set");x(t);const s=new g({view:e,template:t,extraParameters:r,updateDelay:o});try{return await v(this.effectivePrintServiceUrl,s,{timeout:this.printTimeout})}catch(a){throw new i("print:export-error","An error occurred while exporting the web map.",{error:a})}}toPrintTemplate({attributionEnabled:t,author:e,copyright:r,customTextElements:o,dpi:s,forceFeatureAttributes:i,format:a,height:l,includeTables:n,layout:p,layoutItem:m,legendEnabled:u,northArrowEnabled:c,scale:f,scaleEnabled:d,title:y,width:h}){const v=new j({attributionVisible:t,forceFeatureAttributes:i,format:a,includeTables:n,layout:p,layoutItem:m,layoutOptions:{authorText:e||"",copyrightText:r||"",customTextElements:o,titleText:y||""},outScale:f??0,scalePreserved:d});h&&(v.exportOptions.width=h),l&&(v.exportOptions.height=l),s&&(v.exportOptions.dpi=s),!u&&v.layoutOptions&&(v.layoutOptions.legendLayers=[]);const T=this.templateToNorthArrowInfo[m?.id??p];if(T){!(T.visible===c)&&v.layoutOptions&&(v.layoutOptions.elementOverrides={[T.name]:{visible:c}})}return v}async _loadResources(t){let e=[];if(!this.printServiceUrl){if(this.destroyed)return;try{await this.portal.load(t)}catch(a){throw new i("print:could-not-load-portal","Cannot load print resource information from portal",{error:a,url:this.effectivePrintServiceUrl})}const r=this.portal.helperServices?.printTask;r&&(this._set("effectivePrintServiceUrl",r.url),e=r.templates?.map((t=>P.fromJSON(t)))??[])}this.defaultTemplates.addMany(e);const r=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!r?.includes("gpserver"))throw new i("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl});const[o,s]=await Promise.all([this._getPrintServiceLayouts(t),this._getPrintServiceTemplates(t)]);if(this._processPrintServiceLayouts(o),this._processPrintServiceTemplates(s),!this.printServiceUrl){const e=await this._getPortalCustomTemplates(t);this.defaultTemplates.addMany(e)}}async _getPortalCustomTemplates(t){const{layoutGroupQuery:e}=this.portal;if(!e)return[];const r=new y({query:e,disableExtraQuery:!0}),o=await this.portal.queryGroups(r,t);if(!o.total)return[];const s=o.results[0],i=new y({num:100,query:"type:Layout"}),a=(await s.queryItems(i,t)).results;return a.length?a.map((t=>new P({label:t.title,layoutItem:t}))):[]}_processPrintServiceTemplates(t){this._set("templatesInfo",t)}async _getPrintServiceLayouts(t){let e=[];const r=async e=>{this._printServiceLayoutsUrl=this.effectivePrintServiceUrl.replace(/(\/GPServer\/).+/i,`$1${encodeURI(e)}`);return(await h(this._printServiceLayoutsUrl,null,null,t)).results[0].value};try{e=await r("Get Layout Templates Info Task")}catch{}if(!e||e.length<1)try{e=await r("Get Layout Templates Info")}catch{}return e}_processPrintServiceLayouts(t){const e={},r={};t.forEach((({layoutTemplate:t,layoutOptions:{customTextElements:o,mapSurroundInfos:s}})=>{const i=w(t);e[i]=o,s&&(r[i]=s.find((({type:t})=>"CIMMarkerNorthArrow"===t)))})),this._serviceTemplateCustomTextElements=Object.freeze(e),this.templateToNorthArrowInfo=r}async _getPrintServiceTemplates(t){let e;try{({data:e}=await r(this.effectivePrintServiceUrl,{...t,query:{f:"json"},timeout:this.printTimeout}))}catch(l){throw n(l)?l:new i("print:unavailable-service-info","Can't fetch templates info from service",{error:l})}const{parameters:o}=e,s=o.find((({name:t})=>"Format"===t)),a=o.find((({name:t})=>"Layout_Template"===t));return{format:this._getFormat(s),layout:this._getLayout(a)}}_getFormat(t){const e="all"===this.allowedFormats?t.choiceList:t.choiceList.filter((t=>this.allowedFormats.includes(T(t)))),r=(e.length?e:t.choiceList).map(T).filter(o),s=T(t.defaultValue),i=r.includes(s)?s:r[0];return{choiceList:r,defaultValue:i}}_getLayout(t){const e=t.choiceList.filter((t=>"map_only"!==t.toLowerCase())),r="all"===this.allowedLayouts?e:e.filter((t=>this.allowedLayouts.includes(w(t)))),s=(r.length?r:e).map(w).filter(o),i=w(t.defaultValue),a=s.includes(i)?i:s.find((t=>/(?=.*letter)(?=.*landscape)/i.test(t)))??s.find((t=>/(?=.*a4)(?=.*landscape)/i.test(t)))??s[0];return{choiceList:s,defaultValue:a}}};t([p()],L.prototype,"_serviceTemplateCustomTextElements",void 0),t([p()],L.prototype,"allowedFormats",void 0),t([p()],L.prototype,"allowedLayouts",void 0),t([p({type:S})],L.prototype,"defaultTemplates",void 0),t([p()],L.prototype,"error",void 0),t([p()],L.prototype,"extraParameters",void 0),t([p()],L.prototype,"includeDefaultTemplates",void 0),t([p({readOnly:!0})],L.prototype,"effectivePrintServiceUrl",null),t([p()],L.prototype,"effectiveTemplateCustomTextElements",null),t([p({type:d})],L.prototype,"portal",void 0),t([p()],L.prototype,"printServiceUrl",void 0),t([p()],L.prototype,"printTimeout",void 0),t([p({readOnly:!0})],L.prototype,"state",null),t([p({readOnly:!0})],L.prototype,"templatesInfo",void 0),t([p()],L.prototype,"updateDelay",void 0),t([p()],L.prototype,"view",void 0),t([p()],L.prototype,"templateCustomTextElements",void 0),t([p()],L.prototype,"templateToNorthArrowInfo",void 0),L=t([m("esri.widgets.Print.PrintViewModel")],L);const _=L;export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import t from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as r}from"../../../geometry/support/geometryUtils.js";import{addressToLocations as n}from"../../../rest/locator/addressToLocations.js";import{locationToAddress as s}from"../../../rest/locator/locationToAddress.js";import{suggestLocations as i}from"../../../rest/locator/suggestLocations.js";import c from"../../../rest/support/AddressToLocationsParameters.js";import a from"../../../rest/support/LocationToAddressParameters.js";import u from"../../../rest/support/SuggestLocationsParameters.js";const l="Single Line Input",d=3e5;function m(e,t){return e.location?S(e,t):h(e,t)}function f(e,t){if(t.localSearchDisabled)return null;const o=e?.scale;return"number"==typeof o&&o<=d?e?.extent?.center:null}async function p(e,t){const{source:o,spatialReference:r,view:n,suggestTerm:s,maxSuggestions:c,sourceIndex:a}=e,l=new u,{apiKey:d,url:m}=o,p=w(o,n),g=t?.signal;if(!m)return null;d&&(l.apiKey=d),o.categories&&(l.categories=o.categories),r&&(l.outSpatialReference=r);const y=f(n,o);y&&(l.location=y);if(!s.trim())return null;const{prefix:x="",suffix:v=""}=o,S=`${x}${s}${v}`;return l.text=S,p&&(l.searchExtent=p),l.maxSuggestions=c,o.countryCode&&(l.countryCode=o.countryCode),i(m,l,{signal:g}).then((e=>I(e,a)))}function g(e){return!!e&&/(?:geocode\-api\.arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(e)}function y(e){return!!e&&/(?:\/servers\/[\da-z\.-]+\/rest\/services\/world\/geocodeserver).*/i.test(e)}function x(e){return!!e&&/(?:arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(e)}const v="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer";async function S(e,t){const{source:o,spatialReference:r,location:n,sourceIndex:i,view:c}=e,{apiKey:u,url:l,zoomScale:d,defaultZoomScale:m}=o;if(null==l)return[];const f=c?.scale,p=t?.signal,g=new a;g.location=n,u&&(g.apiKey=u),r&&(g.outSpatialReference=r);try{return K([await s(l,g,{signal:p})],{sourceIndex:i,scale:f,view:c,zoomScale:d,defaultZoomScale:m})}catch(y){return[]}}function w(e,t){const{filter:r,withinViewEnabled:n}=e,s=t?.scale,i=t?.extent,c=r?.geometry;return(c?o(c,t??void 0,s):void 0)||(n&&i?i:void 0)}async function h(e,t){const{source:o,suggestResult:r,spatialReference:s,view:i,maxResults:a,sourceIndex:u}=e,d=o?.zoomScale,m=o?.defaultZoomScale,p=r.text?.trim();if(!p)return null;const g=!r.key&&o.prefix?o.prefix:"",y=!r.key&&o.suffix?o.suffix:"",x=`${g}${r.text}${y}`,v=new c,{apiKey:S,url:h}=o,j=i?.scale,I=w(o,i),$=t?.signal;if(S&&(v.apiKey=S),!h)return null;o.categories&&(v.categories=o.categories),o.locationType&&(v.locationType=o.locationType),s&&(v.outSpatialReference=s);const L=f(i,o);L&&(v.location=L),v.maxLocations=a,I&&(v.searchExtent=I),o.countryCode&&(v.countryCode=o.countryCode);const{key:R}=r,T=`${R}`;return R&&(v.magicKey=T),v.address={},v.address[o.singleLineFieldName||l]=x,o.outFields&&(v.outFields=o.outFields),n(h,v,{signal:$}).then((e=>K(e,{key:T,scale:j,sourceIndex:u,view:i,zoomScale:d,defaultZoomScale:m})))}function j(e,t){return{text:e.text,key:e.magicKey,sourceIndex:t}}function I(e,t){return e.map((e=>j(e,t)))}function $(n,s){const{key:i,scale:c,sourceIndex:a,view:u,zoomScale:l,defaultZoomScale:d}=s,{attributes:m,extent:f,location:p,address:g}=n,y=new e({geometry:p,attributes:m}),x=f||p,v=x?o(x,u??void 0,c??void 0):void 0,S=v?"number"==typeof l?r(v,u??void 0,l):"number"==typeof d&&"point"===x?.type?r(v,u??void 0,d):v:null,w=p?`${p.x},${p.y}`:"",h=g||w,j=y.clone();return null!=S&&(j.geometry=t.fromExtent(S)),{extent:S,feature:y,target:j,key:i,name:h,sourceIndex:a}}function K(e,t){return e.filter(Boolean).map((e=>$(e,t)))}export{f as getLocation,m as getResults,p as getSuggestions,x as isArcGISWorldGeocoder,g as isMeteredArcGISWorldGeocoder,y as isProxiedArcGISWorldGeocoder,v as meteredArcGISLocatorUrl};
5
+ import e from"../../../Graphic.js";import t from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as r}from"../../../geometry/support/geometryUtils.js";import{addressToLocations as n}from"../../../rest/locator/addressToLocations.js";import{locationToAddress as s}from"../../../rest/locator/locationToAddress.js";import{suggestLocations as i}from"../../../rest/locator/suggestLocations.js";import c from"../../../rest/support/AddressToLocationsParameters.js";import a from"../../../rest/support/LocationToAddressParameters.js";import u from"../../../rest/support/SuggestLocationsParameters.js";const l="Single Line Input",d=3e5;function m(e,t){return e.location?S(e,t):h(e,t)}function f(e,t){if(t.localSearchDisabled)return null;const o=e?.scale;return"number"==typeof o&&o<=d?e?.extent?.center:null}async function p(e,t){const{source:o,spatialReference:r,view:n,suggestTerm:s,maxSuggestions:c,sourceIndex:a}=e,l=new u,{apiKey:d,url:m}=o,p=w(o,n),g=t?.signal;if(!m)return null;d&&(l.apiKey=d),o.categories&&(l.categories=o.categories),r&&(l.outSpatialReference=r);const y=f(n,o);y&&(l.location=y);if(!s.trim())return null;const{prefix:x="",suffix:v=""}=o,S=`${x}${s}${v}`;return l.text=S,p&&(l.searchExtent=p),l.maxSuggestions=c,o.countryCode&&(l.countryCode=o.countryCode),i(m,l,{signal:g}).then((e=>I(e,a)))}function g(e){return!!e&&/(?:geocode\-api\.arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(e)}function y(e){return!!e&&/(?:\/servers\/[\da-z\.-]+\/rest\/services\/world\/geocodeserver).*/i.test(e)}function x(e){return!!e&&/(?:arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(e)}const v="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer";async function S(e,t){const{source:o,spatialReference:r,location:n,sourceIndex:i,view:c}=e,{apiKey:u,url:l,zoomScale:d,defaultZoomScale:m}=o;if(null==l)return[];const f=c?.scale,p=t?.signal,g=new a({location:n});u&&(g.apiKey=u),r&&(g.outSpatialReference=r);try{return K([await s(l,g,{signal:p})],{sourceIndex:i,scale:f,view:c,zoomScale:d,defaultZoomScale:m})}catch(y){return[]}}function w(e,t){const{filter:r,withinViewEnabled:n}=e,s=t?.scale,i=t?.extent,c=r?.geometry;return(c?o(c,t??void 0,s):void 0)||(n&&i?i:void 0)}async function h(e,t){const{source:o,suggestResult:r,spatialReference:s,view:i,maxResults:a,sourceIndex:u}=e,d=o?.zoomScale,m=o?.defaultZoomScale,p=r.text?.trim();if(!p)return null;const g=!r.key&&o.prefix?o.prefix:"",y=!r.key&&o.suffix?o.suffix:"",x=`${g}${r.text}${y}`,v=new c,{apiKey:S,url:h}=o,j=i?.scale,I=w(o,i),$=t?.signal;if(S&&(v.apiKey=S),!h)return null;o.categories&&(v.categories=o.categories),o.locationType&&(v.locationType=o.locationType),s&&(v.outSpatialReference=s);const L=f(i,o);L&&(v.location=L),v.maxLocations=a,I&&(v.searchExtent=I),o.countryCode&&(v.countryCode=o.countryCode);const{key:R}=r,T=`${R}`;return R&&(v.magicKey=T),v.address={},v.address[o.singleLineFieldName||l]=x,o.outFields&&(v.outFields=o.outFields),n(h,v,{signal:$}).then((e=>K(e,{key:T,scale:j,sourceIndex:u,view:i,zoomScale:d,defaultZoomScale:m})))}function j(e,t){return{text:e.text,key:e.magicKey,sourceIndex:t}}function I(e,t){return e.map((e=>j(e,t)))}function $(n,s){const{key:i,scale:c,sourceIndex:a,view:u,zoomScale:l,defaultZoomScale:d}=s,{attributes:m,extent:f,location:p,address:g}=n,y=new e({geometry:p,attributes:m}),x=f||p,v=x?o(x,u??void 0,c??void 0):void 0,S=v?"number"==typeof l?r(v,u??void 0,l):"number"==typeof d&&"point"===x?.type?r(v,u??void 0,d):v:null,w=p?`${p.x},${p.y}`:"",h=g||w,j=y.clone();return null!=S&&(j.geometry=t.fromExtent(S)),{extent:S,feature:y,target:j,key:i,name:h,sourceIndex:a}}function K(e,t){return e.filter(Boolean).map((e=>$(e,t)))}export{f as getLocation,m as getResults,p as getSuggestions,x as isArcGISWorldGeocoder,g as isMeteredArcGISWorldGeocoder,y as isProxiedArcGISWorldGeocoder,v as meteredArcGISLocatorUrl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{symbolTypes as t}from"../../symbols.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import r from"../../core/Logger.js";import{destroyMaybe as s,abortMaybe as n}from"../../core/maybe.js";import{createAbortError as p,whenOrAbort as l}from"../../core/promiseUtils.js";import{on as h,watch as c,when as d,whenOnce as u,syncAndInitial as y}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as v}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as f,isLoaded as _,load as w,project as G}from"../../geometry/projection.js";import{geometryToCoordinates as b}from"../../geometry/support/coordsUtils.js";import{equals as O}from"../../geometry/support/spatialReferenceUtils.js";import T from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as E}from"../../layers/support/layerUtils.js";import{SupportedGraphicResult as S,isSupportedGraphicResultMessage as A}from"../../views/3d/interactive/editingTools/isSupportedGraphicUtils.js";import{isSupportedGraphic as k}from"../../views/3d/interactive/editingTools/moveGraphic/isSupportedGraphic.js";import{isSupportedGraphic as M}from"../../views/3d/interactive/editingTools/reshapeGraphic/isSupportedGraphic.js";import{isSupportedGraphic as C}from"../../views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js";import{addUniqueLayer as H}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as R}from"../../views/input/InputManager.js";import{sketchKeys as D}from"../../views/interactive/keybindings.js";import I from"../../views/interactive/sketch/SketchLabelOptions.js";import U from"../../views/interactive/sketch/SketchOptions.js";import x from"../../views/interactive/sketch/SketchTooltipOptions.js";import P from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as j}from"../../views/interactive/snapping/SnappingManager.js";import L from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as F}from"../../views/interactive/snapping/snappingUtils.js";import{findFirstGraphicHit as V}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as K}from"../../views/support/screenUtils.js";import{CreateOperationHandle as W,UpdateOperationHandle as Z}from"./support/OperationHandle.js";import q from"../../symbols/SimpleMarkerSymbol.js";import z from"../../symbols/SimpleFillSymbol.js";import N from"../../symbols/SimpleLineSymbol.js";import B from"../../symbols/MeshSymbol3D.js";import $ from"../../symbols/FillSymbol3DLayer.js";const Y={defaultZ:0},J={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0},tool:"transform"};let Q=class extends a.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._defaultSnappingManager=null,this._internalGraphicsLayer=new T({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new q({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new z({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new N({color:[130,130,130,1],width:2}),this.meshSymbol=new B({symbolLayers:new o([new $])}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.vertexSymbol=new q({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new U,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalPopupEnabled=null,this.defaultCreateOptions=Y,this.defaultUpdateOptions=J,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new L}initialize(){this.addHandles([h((()=>this.view?.map?.layers),"change",(e=>{e.removed.includes(this.layer)&&this.cancel()})),h((()=>this.layer?.graphics),"change",(e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())})),c((()=>this.layer?.elevationInfo??null),(e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)}),y),c((()=>this.view),(e=>{this._defaultSnappingManager=s(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new j({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))}),y),c((()=>this.view?.spatialReference),((e,t)=>{e&&t&&!e.equals(t)&&this.cancel()}))]),F(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this.snappingManager=s(this.snappingManager),this._set("view",null),this.emit("destroy")}get _defaultUpdateTool(){return"3d"===this.view?.type?"move":"transform"}get updating(){return this._numUpdating>0||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...Y,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...J,...e,reshapeOptions:{...J.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...J.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=s(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new j({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&(t.cursor=null),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(d((()=>e.ready),(t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)}),y),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=n(this._moduleLoaderAbortController),this._viewReadyAbortController=n(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map((e=>e.clone())).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),p();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");H(o,this._internalGraphicsLayer);const a=await this._setupCreateOperation(e,t);if(null==a||this.destroyed)return void o.map.remove(this._internalGraphicsLayer);const r=()=>{if(a===this._operationHandle){const t=this.createGraphic,o=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map&&this.view.map.remove(this._internalGraphicsLayer),a.cancelled||null==t||i.add(t),this.emit("create",{graphic:t,state:o?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};a.on("complete",r),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),p();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some((e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0))))return;const s=await this._setupUpdateOperation(r,t);this.destroyed||null==s||se(s)||(H(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||O(o.geometry.spatialReference,t.spatialReference)||(f(o.geometry.spatialReference,t.spatialReference)||_()||await w(),o.geometry=G(o.geometry,t.spatialReference));this._endAsyncOperation()}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!(!this._operationHandle||!this._operationHandle.canUndo())}canRedo(){return!(!this._operationHandle||!this._operationHandle.canRedo())}toggleUpdateTool(){this._operationHandle&&this._operationHandle.toggleTool&&this._operationHandle.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const i=await t.hitTest(e,{exclude:o});return V(i.results)}const o=[t.map.ground];t.map.allLayers.forEach((e=>{E(e.type)&&o.push(e)}));const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?v(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",(async t=>{const o="active"===this.state&&"create"===this._operationHandle?.type;if("disabled"===this.state||o||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const i=await t.async((()=>this._getFirstHit(K(t))));let a=null;if(null!=i){const o=i.graphic;this.updateGraphics.includes(o)||o.layer===this.layer?(t.stopPropagation(),a=o):"2d"!==e.type||this._isComponentGraphic(o)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==a||this.updateGraphics.includes(a)||await this.update([a],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()}),R.WIDGET)]}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h="rectangle"===e||"circle"===e?"hybrid":"click",c=l??"rectangle"!==e,d={centered:"rectangle"!==e&&!("circle"===e&&!c),cursor:i,defaultZ:a,forceUniformSize:c,graphicProperties:n,geometryToPlace:s,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:r,mode:p??h,snappingManager:this.snappingManager,snapToScene:!1,view:t};return"2d"===t.type?this._makeDrawGraphicTool2D(d):this._makeDrawGraphicTool3D(d)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return se(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:te(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(t)||this.destroyed)return null;const{elevationInfo:o}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:o,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,a=e.centered,r=[t.on("key-down",(t=>{if(t.key===D.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===D.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==D.vertexAdd||t.repeat)t.key===D.undo?(t.stopPropagation(),s.undo()):t.key===D.redo?(t.stopPropagation(),s.redo()):t.key!==D.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===D.center&&(t.repeat||(e.centered=!a,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}}),R.WIDGET),t.on("key-up",(t=>{t.key===D.pan?e.enabled=!0:t.key!==D.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===D.center&&(e.centered=a,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())}),R.WIDGET),e.on("vertex-add",(t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("cursor-update",(t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})})),e.on("vertex-remove",(t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("complete",(e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?s&&s.cancel():s&&s.complete()})),c((()=>this._getGraphicSymbolFromTool(e.geometryType)),(t=>{e.graphicSymbol=t}))],s=new W({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{r.forEach((e=>e.remove())),r.length=0,t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return s}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={tool:this._defaultUpdateTool,...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let r=a.tool;for(const s of e)o.remove(s),o.add(s);if("3d"===i.type){if(0===e.length)return null;switch(r){case"move":return this._setupMove3DOperation(e,a,i,r);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=M(e[0]);return t===S.SUPPORTED?this._setupReshape3DOperation(e[0],a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${A(t)}).`),null)}case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(r){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=M(e[0]);return t===S.SUPPORTED?this._setupTransformOrReshape2DOperation(e,r,a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${A(t)}).`),null)}case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(r="reshape")}return this._setupTransformOrReshape2DOperation(e,r,a,i)}}async _setupMove3DOperation(e,t,o,i,a=!1){for(const l of e){const e=k(l);if(e!==S.SUPPORTED)return this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${A(e)}).`),null}const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(r))return r;const s=new r.module.GraphicMoveTool({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(s),s.graphics.addMany(e),a||this.updateGraphics.addMany(e);const n=[],p=new Z({activeComponent:s,tool:i,type:"update",onEnd:()=>{n.forEach((e=>e.remove())),n.length=0,o.tools?.remove(s),s.destroyed||s.destroy()},undo:()=>{oe(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ie(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e),s.graphics.push(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);p.history.undo.forEach((e=>e.updates.splice(t,1))),p.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?s.graphics.remove(e):p.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0);if(M(e)!==S.SUPPORTED)return;p.onEnd(),p.destroy();const a=await this._setupReshape3DOperation(e,t,o,!0);se(a)||this._setUpdateOperationHandle(a,t)}});return n.push(...this._getHandlesForComponent(p,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(p,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)}),R.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&C(e[0])===S.SUPPORTED){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(n))return n;const p=new n.module.GraphicTransformTool({graphic:e,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(p),this.updateGraphics.add(e);const l=[],h=new Z({activeComponent:p,tool:i,type:"update",onEnd:()=>{l.forEach((e=>e.remove())),l.length=0,o.tools?.remove(p),p.destroyed||p.destroy()},undo:()=>{oe(h,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ie(h,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),h.onEnd(),h.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),h.complete()},toggleTool:()=>{}});return l.push(...this._getHandlesForComponent(h,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(h,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(h,e)}),R.WIDGET)),h}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,l=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(l))return l;const h=this.view?.inputManager?.isModifierKeyDown(D.constraint),c=new l.module.ExtentTransformTool({graphic:e,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!h,sketchOptions:this.sketchOptions});o.tools.add(c),i||this.updateGraphics.add(e);const d=[],u=new Z({activeComponent:c,tool:a,type:"update",onEnd:()=>{d.forEach((e=>e.remove())),d.length=0,o.tools?.remove(c),c.destroyed||c.destroy()},canUndo:()=>c.canUndo,undo:()=>{c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>c.canRedo,redo:()=>{c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),u.onEnd(),u.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),u.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const e=this.updateGraphics.at(0);if(M(e)!==S.SUPPORTED)return;u.onEnd(),u.destroy();const i=await this._setupReshape3DOperation(e,t,o,!0);se(i)||this._setUpdateOperationHandle(i,t)}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(u,e,t)),R.WIDGET),o.on("key-down",(e=>this._getCommonUpdateOperationKeyDownHandlers(u,e)),R.WIDGET),o.on("key-down",(e=>{e.key!==D.constraint||e.repeat||(c.preserveAspectRatio=!c.preserveAspectRatio,e.stopPropagation())}),R.WIDGET),o.on("key-up",(e=>{e.key===D.constraint&&(c.preserveAspectRatio=!c.preserveAspectRatio,e.stopPropagation())}),R.WIDGET)),u}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a=await this._getGraphicMover(e,t,o);if(se(a))return a;const r=new Z({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._displayDefaultCursor(),p.forEach((e=>e.remove())),n.forEach((e=>e.remove())),p=[],n=[],a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();oe(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ie(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updateSpatialReference(e),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1,n=[o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==D.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET),o.on("key-up",(e=>{e.key===D.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(r))return r;const s=t.reshapeOptions,n=new r.module.GraphicReshapeTool({view:o,graphic:e,enableZVertex:t.enableZ&&"move"===s?.vertexOperation,enableZShape:t.enableZ&&"move"===s?.shapeOperation,enableMoveGraphic:"move"===s?.shapeOperation||"move-xy"===s?.shapeOperation,enableMidpoints:"split"===s?.edgeOperation,enableEdgeOffset:"offset"===s?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(n),i||this.updateGraphics.add(e);const p=[],l=new Z({activeComponent:n,tool:a,type:"update",onEnd:()=>{p.forEach((e=>e.remove())),p.length=0,o.tools?.remove(n),n.destroyed||n.destroy()},canUndo:()=>n.canUndo,undo:()=>{n.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>n.canRedo,redo:()=>{n.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),l.onEnd(),l.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),l.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;l.onEnd(),l.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);se(e)||this._setUpdateOperationHandle(e,t)}});return p.push(...this._getHandlesForComponent(l,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(l,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(l,e)}),R.WIDGET)),l}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(se(a))return a;const r=new Z({activeComponent:a,type:"update",onEnd:()=>{n.forEach((e=>e.remove())),s.forEach((e=>e.remove())),n=[],s=[],r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{oe(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ie(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(se(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)r.complete();else{const e=o[0].geometry;1!==o.length||null==e||"point"!==e.type&&"multipoint"!==e.type?r.activeComponent.graphics=o:r.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let a=null;"transform"===r.tool?a=await this._getReshape([e],o,i):"reshape"===r.tool&&(a=await this._getBox([e],o,i)),se(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(n.forEach((e=>e.remove())),n=this._getHandlesForComponent(r,o)))}});let s=[i.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,o)),R.WIDGET),i.on("key-down",(e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===D.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET),i.on("key-up",(e=>{if(e.key===D.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET)],n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return se(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(se(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(D.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const i="split"===t.reshapeOptions?.edgeOperation,a="move"===t.reshapeOptions?.shapeOperation,r=!!t.highlightOptions?.enabled,s=await this._requireModule(import("../../views/draw/support/Reshape.js"));return se(s)?s:new s.module.default({enableMidpoints:i,enableMovement:a,graphic:e[0],highlightsEnabled:r,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map((e=>b(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map((e=>b(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",(({graphic:t,viewEvent:o})=>{o.native?.shiftKey&&(o.stopPropagation(),e.removeFromSelection(t))})),o.on("graphic-move-start",(t=>e.addToHistory(re(t.allGraphics))))];case"box":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(re(t.graphics)))),o.on("rotate-start",(t=>e.addToHistory(re(t.graphics)))),o.on("scale-start",(t=>e.addToHistory(re(t.graphics))))];case"reshape":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(re([t.mover])))),o.on("reshape-start",(t=>e.addToHistory(re([t.graphic])))),o.on("vertex-add",(t=>e.addToHistory(re([t.oldGraphic])))),o.on("vertex-remove",(t=>e.addToHistory(re([t.oldGraphic]))))];case"move-3d":return[o.on("graphic-move-start",(t=>{e.addToHistory(re(t.allGraphics)),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:t.allGraphics.length>0?t.allGraphics[0]:null,type:"move-start"},type:"update"})})),o.on("graphic-move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move"},type:"update"})})),o.on("graphic-move-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move-stop"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"transform-3d":return[o.on("record-undo",(({record:t})=>{e.addToHistory({updates:[t]})})),o.on("graphic-translate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})})),o.on("graphic-translate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})})),o.on("graphic-rotate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-start"},type:"update"})})),o.on("graphic-rotate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})})),o.on("graphic-scale-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})})),o.on("graphic-scale-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})})),o.on("graphic-translate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})})),o.on("graphic-rotate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate"},type:"update"})})),o.on("graphic-scale",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"reshape-3d":return[o.on("reshape",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-add",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-remove",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=K(t),a=await t.async((()=>this._getFirstHit(i)));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some((e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0))))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===D.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===D.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===D.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&D.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&"reshape-3d"!==t.type&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=s(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_displayPointerCursor(){this.view?.container&&"pointer"!==this.view.cursor&&(this.view.cursor="pointer")}_displayGrabbingCursor(){this.view?.container&&"grabbing"!==this.view.cursor&&(this.view.cursor="grabbing")}_displayDefaultCursor(){this.view?.container&&null!==this.view.cursor&&(this.view.cursor=null)}_logError(e,t,o){r.getLogger(this).error(new i(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){return{operationHandle:this._operationHandle,snappingManager:this.snappingManager,defaultUpdateOptions:J}}wait(){return u((()=>!this.updating))}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(n(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await l(u((()=>e?.ready)),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",ee("view"))}_logMissingLayer(){this._logError(X,ee("layer"))}};e([m()],Q.prototype,"_defaultSnappingManager",void 0),e([m()],Q.prototype,"updating",null),e([m()],Q.prototype,"_operationHandle",void 0),e([m({readOnly:!0})],Q.prototype,"activeTool",null),e([m()],Q.prototype,"activeFillSymbol",void 0),e([m()],Q.prototype,"activeLineSymbol",void 0),e([m()],Q.prototype,"activeVertexSymbol",void 0),e([m()],Q.prototype,"allowDeleteKey",void 0),e([m({readOnly:!0})],Q.prototype,"createGraphic",null),e([m()],Q.prototype,"defaultCreateOptions",null),e([m()],Q.prototype,"defaultUpdateOptions",null),e([m({type:I,nonNullable:!0})],Q.prototype,"labelOptions",null),e([m()],Q.prototype,"layer",void 0),e([m({types:t})],Q.prototype,"pointSymbol",void 0),e([m({types:t})],Q.prototype,"polygonSymbol",void 0),e([m({types:t})],Q.prototype,"polylineSymbol",void 0),e([m()],Q.prototype,"meshSymbol",void 0),e([m({type:L,nonNullable:!0})],Q.prototype,"snappingOptions",null),e([m()],Q.prototype,"snappingManager",null),e([m({readOnly:!0})],Q.prototype,"state",null),e([m({type:x,nonNullable:!0})],Q.prototype,"tooltipOptions",null),e([m({readOnly:!0})],Q.prototype,"updateGraphics",void 0),e([m()],Q.prototype,"updateOnGraphicClick",void 0),e([m({type:P,nonNullable:!0})],Q.prototype,"valueOptions",null),e([m({types:t})],Q.prototype,"vertexSymbol",void 0),e([m({value:null})],Q.prototype,"view",null),e([m({constructOnly:!0,type:U})],Q.prototype,"sketchOptions",void 0),Q=e([g("esri.widgets.Sketch.SketchViewModel")],Q);const X="sketch:missing-property",ee=e=>`Property '${e}' is missing on SketchViewModel.`;function te(e){return"polygon"===e||"rectangle"===e||"circle"===e}function oe(e,t){ae("undo",e.history.undo,e.history.redo,t)}function ie(e,t){ae("redo",e.history.redo,e.history.undo,t)}function ae(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach(((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))})),o.push({updates:s})}function re(e){return{updates:e.map((e=>({geometry:e.geometry})))}}function se(e){return"requireError"in e&&"aborted"===e.requireError}const ne=Q;export{ne as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{symbolTypes as t}from"../../symbols.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import r from"../../core/Logger.js";import{destroyMaybe as s,abortMaybe as n}from"../../core/maybe.js";import{createAbortError as p,whenOrAbort as l}from"../../core/promiseUtils.js";import{on as h,watch as c,when as d,whenOnce as u,syncAndInitial as y}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as v}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as f,isLoaded as _,load as w,project as G}from"../../geometry/projection.js";import{geometryToCoordinates as b}from"../../geometry/support/coordsUtils.js";import{equals as O}from"../../geometry/support/spatialReferenceUtils.js";import T from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as E}from"../../layers/support/layerUtils.js";import{SupportedGraphicResult as S,isSupportedGraphicResultMessage as A}from"../../views/3d/interactive/editingTools/isSupportedGraphicUtils.js";import{isSupportedGraphic as k}from"../../views/3d/interactive/editingTools/moveGraphic/isSupportedGraphic.js";import{isSupportedGraphic as M}from"../../views/3d/interactive/editingTools/reshapeGraphic/isSupportedGraphic.js";import{isSupportedGraphic as C}from"../../views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js";import{addUniqueLayer as H}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as R}from"../../views/input/InputManager.js";import{sketchKeys as D}from"../../views/interactive/keybindings.js";import I from"../../views/interactive/sketch/SketchLabelOptions.js";import U from"../../views/interactive/sketch/SketchOptions.js";import x from"../../views/interactive/sketch/SketchTooltipOptions.js";import P from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as j}from"../../views/interactive/snapping/SnappingManager.js";import L from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as F}from"../../views/interactive/snapping/snappingUtils.js";import{findFirstGraphicHit as V}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as K}from"../../views/support/screenUtils.js";import{CreateOperationHandle as W,UpdateOperationHandle as Z}from"./support/OperationHandle.js";import q from"../../symbols/SimpleMarkerSymbol.js";import z from"../../symbols/SimpleFillSymbol.js";import N from"../../symbols/SimpleLineSymbol.js";import B from"../../symbols/MeshSymbol3D.js";import $ from"../../symbols/FillSymbol3DLayer.js";const Y={defaultZ:0},J={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0},tool:"transform"};let Q=class extends a.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._defaultSnappingManager=null,this._internalGraphicsLayer=new T({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new q({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new z({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new N({color:[130,130,130,1],width:2}),this.meshSymbol=new B({symbolLayers:new o([new $])}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.vertexSymbol=new q({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new U,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalPopupEnabled=null,this.defaultCreateOptions=Y,this.defaultUpdateOptions=J,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new L}initialize(){this.addHandles([h((()=>this.view?.map?.layers),"change",(e=>{e.removed.includes(this.layer)&&this.cancel()})),h((()=>this.layer?.graphics),"change",(e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())})),c((()=>this.layer?.elevationInfo??null),(e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)}),y),c((()=>this.view),(e=>{this._defaultSnappingManager=s(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new j({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))}),y),c((()=>this.view?.spatialReference),((e,t)=>{e&&t&&!e.equals(t)&&this.cancel()}))]),F(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=s(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this.emit("destroy")}get _defaultUpdateTool(){return"3d"===this.view?.type?"move":"transform"}get updating(){return this._numUpdating>0||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...Y,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...J,...e,reshapeOptions:{...J.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...J.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=s(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new j({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&(t.cursor=null),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(d((()=>e.ready),(t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)}),y),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=n(this._moduleLoaderAbortController),this._viewReadyAbortController=n(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map((e=>e.clone())).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),p();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");H(o,this._internalGraphicsLayer);const a=await this._setupCreateOperation(e,t);if(null==a||this.destroyed)return void o.map.remove(this._internalGraphicsLayer);const r=()=>{if(a===this._operationHandle){const t=this.createGraphic,o=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map&&this.view.map.remove(this._internalGraphicsLayer),a.cancelled||null==t||i.add(t),this.emit("create",{graphic:t,state:o?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};a.on("complete",r),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),p();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some((e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0))))return;const s=await this._setupUpdateOperation(r,t);this.destroyed||null==s||se(s)||(H(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||O(o.geometry.spatialReference,t.spatialReference)||(f(o.geometry.spatialReference,t.spatialReference)||_()||await w(),o.geometry=G(o.geometry,t.spatialReference));this._endAsyncOperation()}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!(!this._operationHandle||!this._operationHandle.canUndo())}canRedo(){return!(!this._operationHandle||!this._operationHandle.canRedo())}toggleUpdateTool(){this._operationHandle&&this._operationHandle.toggleTool&&this._operationHandle.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const i=await t.hitTest(e,{exclude:o});return V(i.results)}const o=[t.map.ground];t.map.allLayers.forEach((e=>{E(e.type)&&o.push(e)}));const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?v(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",(async t=>{const o="active"===this.state&&"create"===this._operationHandle?.type;if("disabled"===this.state||o||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const i=await t.async((()=>this._getFirstHit(K(t))));let a=null;if(null!=i){const o=i.graphic;this.updateGraphics.includes(o)||o.layer===this.layer?(t.stopPropagation(),a=o):"2d"!==e.type||this._isComponentGraphic(o)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==a||this.updateGraphics.includes(a)||await this.update([a],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()}),R.WIDGET)]}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h="rectangle"===e||"circle"===e?"hybrid":"click",c=l??"rectangle"!==e,d={centered:"rectangle"!==e&&!("circle"===e&&!c),cursor:i,defaultZ:a,forceUniformSize:c,graphicProperties:n,geometryToPlace:s,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:r,mode:p??h,snappingManager:this.snappingManager,snapToScene:!1,view:t};return"2d"===t.type?this._makeDrawGraphicTool2D(d):this._makeDrawGraphicTool3D(d)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return se(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:te(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(t)||this.destroyed)return null;const{elevationInfo:o}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:o,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,a=e.centered,r=[t.on("key-down",(t=>{if(t.key===D.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===D.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==D.vertexAdd||t.repeat)t.key===D.undo?(t.stopPropagation(),s.undo()):t.key===D.redo?(t.stopPropagation(),s.redo()):t.key!==D.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===D.center&&(t.repeat||(e.centered=!a,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}}),R.WIDGET),t.on("key-up",(t=>{t.key===D.pan?e.enabled=!0:t.key!==D.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===D.center&&(e.centered=a,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())}),R.WIDGET),e.on("vertex-add",(t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("cursor-update",(t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})})),e.on("vertex-remove",(t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("complete",(e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?s&&s.cancel():s&&s.complete()})),c((()=>this._getGraphicSymbolFromTool(e.geometryType)),(t=>{e.graphicSymbol=t}))],s=new W({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{r.forEach((e=>e.remove())),r.length=0,t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return s}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={tool:this._defaultUpdateTool,...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let r=a.tool;for(const s of e)o.remove(s),o.add(s);if("3d"===i.type){if(0===e.length)return null;switch(r){case"move":return this._setupMove3DOperation(e,a,i,r);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=M(e[0]);return t===S.SUPPORTED?this._setupReshape3DOperation(e[0],a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${A(t)}).`),null)}case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(r){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=M(e[0]);return t===S.SUPPORTED?this._setupTransformOrReshape2DOperation(e,r,a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${A(t)}).`),null)}case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(r="reshape")}return this._setupTransformOrReshape2DOperation(e,r,a,i)}}async _setupMove3DOperation(e,t,o,i,a=!1){for(const l of e){const e=k(l);if(e!==S.SUPPORTED)return this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${A(e)}).`),null}const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(r))return r;const s=new r.module.GraphicMoveTool({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(s),s.graphics.addMany(e),a||this.updateGraphics.addMany(e);const n=[],p=new Z({activeComponent:s,tool:i,type:"update",onEnd:()=>{n.forEach((e=>e.remove())),n.length=0,o.tools?.remove(s),s.destroyed||s.destroy()},undo:()=>{oe(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ie(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e),s.graphics.push(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);p.history.undo.forEach((e=>e.updates.splice(t,1))),p.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?s.graphics.remove(e):p.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0);if(M(e)!==S.SUPPORTED)return;p.onEnd(),p.destroy();const a=await this._setupReshape3DOperation(e,t,o,!0);se(a)||this._setUpdateOperationHandle(a,t)}});return n.push(...this._getHandlesForComponent(p,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(p,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)}),R.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&C(e[0])===S.SUPPORTED){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(n))return n;const p=new n.module.GraphicTransformTool({graphic:e,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(p),this.updateGraphics.add(e);const l=[],h=new Z({activeComponent:p,tool:i,type:"update",onEnd:()=>{l.forEach((e=>e.remove())),l.length=0,o.tools?.remove(p),p.destroyed||p.destroy()},undo:()=>{oe(h,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ie(h,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),h.onEnd(),h.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),h.complete()},toggleTool:()=>{}});return l.push(...this._getHandlesForComponent(h,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(h,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(h,e)}),R.WIDGET)),h}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,l=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(l))return l;const h=this.view?.inputManager?.isModifierKeyDown(D.constraint),c=new l.module.ExtentTransformTool({graphic:e,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!h,sketchOptions:this.sketchOptions});o.tools.add(c),i||this.updateGraphics.add(e);const d=[],u=new Z({activeComponent:c,tool:a,type:"update",onEnd:()=>{d.forEach((e=>e.remove())),d.length=0,o.tools?.remove(c),c.destroyed||c.destroy()},canUndo:()=>c.canUndo,undo:()=>{c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>c.canRedo,redo:()=>{c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),u.onEnd(),u.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),u.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const e=this.updateGraphics.at(0);if(M(e)!==S.SUPPORTED)return;u.onEnd(),u.destroy();const i=await this._setupReshape3DOperation(e,t,o,!0);se(i)||this._setUpdateOperationHandle(i,t)}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(u,e,t)),R.WIDGET),o.on("key-down",(e=>this._getCommonUpdateOperationKeyDownHandlers(u,e)),R.WIDGET),o.on("key-down",(e=>{e.key!==D.constraint||e.repeat||(c.preserveAspectRatio=!c.preserveAspectRatio,e.stopPropagation())}),R.WIDGET),o.on("key-up",(e=>{e.key===D.constraint&&(c.preserveAspectRatio=!c.preserveAspectRatio,e.stopPropagation())}),R.WIDGET)),u}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a=await this._getGraphicMover(e,t,o);if(se(a))return a;const r=new Z({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._displayDefaultCursor(),p.forEach((e=>e.remove())),n.forEach((e=>e.remove())),p=[],n=[],a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();oe(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ie(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updateSpatialReference(e),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1,n=[o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==D.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET),o.on("key-up",(e=>{e.key===D.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(se(r))return r;const s=t.reshapeOptions,n=new r.module.GraphicReshapeTool({view:o,graphic:e,enableZVertex:t.enableZ&&"move"===s?.vertexOperation,enableZShape:t.enableZ&&"move"===s?.shapeOperation,enableMoveGraphic:"move"===s?.shapeOperation||"move-xy"===s?.shapeOperation,enableMidpoints:"split"===s?.edgeOperation,enableEdgeOffset:"offset"===s?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(n),i||this.updateGraphics.add(e);const p=[],l=new Z({activeComponent:n,tool:a,type:"update",onEnd:()=>{p.forEach((e=>e.remove())),p.length=0,o.tools?.remove(n),n.destroyed||n.destroy()},canUndo:()=>n.canUndo,undo:()=>{n.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>n.canRedo,redo:()=>{n.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),l.onEnd(),l.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);se(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),l.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;l.onEnd(),l.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);se(e)||this._setUpdateOperationHandle(e,t)}});return p.push(...this._getHandlesForComponent(l,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(l,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(l,e)}),R.WIDGET)),l}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(se(a))return a;const r=new Z({activeComponent:a,type:"update",onEnd:()=>{n.forEach((e=>e.remove())),s.forEach((e=>e.remove())),n=[],s=[],r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{oe(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ie(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(se(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)r.complete();else{const e=o[0].geometry;1!==o.length||null==e||"point"!==e.type&&"multipoint"!==e.type?r.activeComponent.graphics=o:r.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let a=null;"transform"===r.tool?a=await this._getReshape([e],o,i):"reshape"===r.tool&&(a=await this._getBox([e],o,i)),se(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(n.forEach((e=>e.remove())),n=this._getHandlesForComponent(r,o)))}});let s=[i.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,o)),R.WIDGET),i.on("key-down",(e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===D.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET),i.on("key-up",(e=>{if(e.key===D.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET)],n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return se(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(se(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(D.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const i="split"===t.reshapeOptions?.edgeOperation,a="move"===t.reshapeOptions?.shapeOperation,r=!!t.highlightOptions?.enabled,s=await this._requireModule(import("../../views/draw/support/Reshape.js"));return se(s)?s:new s.module.default({enableMidpoints:i,enableMovement:a,graphic:e[0],highlightsEnabled:r,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map((e=>b(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map((e=>b(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",(({graphic:t,viewEvent:o})=>{o.native?.shiftKey&&(o.stopPropagation(),e.removeFromSelection(t))})),o.on("graphic-move-start",(t=>e.addToHistory(re(t.allGraphics))))];case"box":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(re(t.graphics)))),o.on("rotate-start",(t=>e.addToHistory(re(t.graphics)))),o.on("scale-start",(t=>e.addToHistory(re(t.graphics))))];case"reshape":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(re([t.mover])))),o.on("reshape-start",(t=>e.addToHistory(re([t.graphic])))),o.on("vertex-add",(t=>e.addToHistory(re([t.oldGraphic])))),o.on("vertex-remove",(t=>e.addToHistory(re([t.oldGraphic]))))];case"move-3d":return[o.on("graphic-move-start",(t=>{e.addToHistory(re(t.allGraphics)),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:t.allGraphics.length>0?t.allGraphics[0]:null,type:"move-start"},type:"update"})})),o.on("graphic-move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move"},type:"update"})})),o.on("graphic-move-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move-stop"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"transform-3d":return[o.on("record-undo",(({record:t})=>{e.addToHistory({updates:[t]})})),o.on("graphic-translate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})})),o.on("graphic-translate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})})),o.on("graphic-rotate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-start"},type:"update"})})),o.on("graphic-rotate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})})),o.on("graphic-scale-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})})),o.on("graphic-scale-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})})),o.on("graphic-translate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})})),o.on("graphic-rotate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate"},type:"update"})})),o.on("graphic-scale",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"reshape-3d":return[o.on("reshape",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-add",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-remove",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=K(t),a=await t.async((()=>this._getFirstHit(i)));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some((e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0))))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===D.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===D.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===D.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&D.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&"reshape-3d"!==t.type&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=s(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_displayPointerCursor(){this.view?.container&&"pointer"!==this.view.cursor&&(this.view.cursor="pointer")}_displayGrabbingCursor(){this.view?.container&&"grabbing"!==this.view.cursor&&(this.view.cursor="grabbing")}_displayDefaultCursor(){this.view?.container&&null!==this.view.cursor&&(this.view.cursor=null)}_logError(e,t,o){r.getLogger(this).error(new i(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){return{operationHandle:this._operationHandle,snappingManager:this.snappingManager,defaultUpdateOptions:J}}wait(){return u((()=>!this.updating))}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(n(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await l(u((()=>e?.ready)),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",ee("view"))}_logMissingLayer(){this._logError(X,ee("layer"))}};e([m()],Q.prototype,"_defaultSnappingManager",void 0),e([m()],Q.prototype,"updating",null),e([m()],Q.prototype,"_operationHandle",void 0),e([m({readOnly:!0})],Q.prototype,"activeTool",null),e([m()],Q.prototype,"activeFillSymbol",void 0),e([m()],Q.prototype,"activeLineSymbol",void 0),e([m()],Q.prototype,"activeVertexSymbol",void 0),e([m()],Q.prototype,"allowDeleteKey",void 0),e([m({readOnly:!0})],Q.prototype,"createGraphic",null),e([m()],Q.prototype,"defaultCreateOptions",null),e([m()],Q.prototype,"defaultUpdateOptions",null),e([m({type:I,nonNullable:!0})],Q.prototype,"labelOptions",null),e([m()],Q.prototype,"layer",void 0),e([m({types:t})],Q.prototype,"pointSymbol",void 0),e([m({types:t})],Q.prototype,"polygonSymbol",void 0),e([m({types:t})],Q.prototype,"polylineSymbol",void 0),e([m()],Q.prototype,"meshSymbol",void 0),e([m({type:L,nonNullable:!0})],Q.prototype,"snappingOptions",null),e([m()],Q.prototype,"snappingManager",null),e([m({readOnly:!0})],Q.prototype,"state",null),e([m({type:x,nonNullable:!0})],Q.prototype,"tooltipOptions",null),e([m({readOnly:!0})],Q.prototype,"updateGraphics",void 0),e([m()],Q.prototype,"updateOnGraphicClick",void 0),e([m({type:P,nonNullable:!0})],Q.prototype,"valueOptions",null),e([m({types:t})],Q.prototype,"vertexSymbol",void 0),e([m({value:null})],Q.prototype,"view",null),e([m({constructOnly:!0,type:U})],Q.prototype,"sketchOptions",void 0),Q=e([g("esri.widgets.Sketch.SketchViewModel")],Q);const X="sketch:missing-property",ee=e=>`Property '${e}' is missing on SketchViewModel.`;function te(e){return"polygon"===e||"rectangle"===e||"circle"===e}function oe(e,t){ae("undo",e.history.undo,e.history.redo,t)}function ie(e,t){ae("redo",e.history.redo,e.history.undo,t)}function ae(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach(((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))})),o.push({updates:s})}function re(e){return{updates:e.map((e=>({geometry:e.geometry})))}}function se(e){return"requireError"in e&&"aborted"===e.requireError}const ne=Q;export{ne as default};