// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built require({cache:{"esri/views/interactive/sketch/SketchValueOptions":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../support/angularMeasurementUtils".split(" "),function(a,b,c,m,k,w,g,E){b=class extends b{constructor(F){super(F);this.directionMode="relative";this.relativeDirectionIsBilateral=!1}get effectiveDirectionMode(){switch(this.directionMode){case "relative":return this.relativeDirectionIsBilateral? E.DirectionMode.RelativeBilateral:E.DirectionMode.Relative;case "absolute":return E.DirectionMode.Absolute}}};a.__decorate([c.property({type:String,nonNullable:!0})],b.prototype,"directionMode",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"relativeDirectionIsBilateral",void 0);a.__decorate([c.property()],b.prototype,"effectiveDirectionMode",null);return b=a.__decorate([g.subclass("esri.views.interactive.sketch.SketchValueOptions")],b)})},"esri/views/support/angularMeasurementUtils":function(){define("exports ../../core/Cyclical ../../core/quantityUtils ../../core/unitUtils ../../core/libs/gl-matrix-2/math/vec2 ../../core/libs/gl-matrix-2/factories/vec2f64 ../../chunks/vec32 ../../core/libs/gl-matrix-2/factories/vec3f64 ../../geometry/projection/projectVectorToVector ../../geometry/support/geodesicUtils ../../geometry/support/spatialReferenceUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y){function l(d,v){if(null!=d&&null!=v)return d=f(d,v),null!=d?c.createAngle(d,"radians","geographic"):void 0}function r(d,v,O){if(d&&v&&O&&(d=f(d,v),v=f(v,O),null!=d&&null!=v))return c.createAngle(v-d,"radians","geographic")}function q(d,v){if(null!=d)switch(v){case a.DirectionMode.Absolute:return h(d);case a.DirectionMode.Relative:return d=u(d),d=I.normalize(d,0,!0),-180===d&&(d=180),c.createAngle(d,"degrees","geographic");case a.DirectionMode.RelativeBilateral:return d= u(d),d=Math.abs(I.normalize(d,0,!0)),c.createAngle(d,"degrees","geographic")}}function h(d){d=u(d);d=J.normalize(d,0,!0);return c.createAngle(d,"degrees","geographic")}function u(d){if(null!=d)return c.convertRotationType(m.convertUnit(d.value,d.unit,"degrees"),d.rotationType,"geographic")}a.DirectionMode=void 0;(function(d){d.Absolute="absolute";d.Relative="relative";d.RelativeBilateral="relative-bilateral"})(a.DirectionMode||(a.DirectionMode={}));const f=(()=>{const d=E.create(),v=E.create();return(O, t)=>{g.set(d,O.x,O.y,O.z??0);g.set(v,t.x,t.y,t.z??0);return z(d,v,O.spatialReference,t.spatialReference)}})(),z=(()=>{const d=w.create(),v=E.create(),O=E.create();return(t,H,P,K)=>{if(!g.exactEquals(t,H)){var D=p.geodesicCompatibleSpatialReference(P),A=p.geodesicCompatibleSpatialReference(K);if(D&&A&&y.equals(D,A)&&F.projectVectorToVector(t,P,v,D)&&F.projectVectorToVector(H,K,O,A))return{azimuth:t}=p.inverseGeodeticSolver(x,v,O,D),null!=t?m.convertUnit(t,"degrees","radians"):void 0;d[0]=H[0]-t[0]; d[1]=H[1]-t[1];t=k.angle(w.UNIT_Y,d);0>d[0]&&(t=N-t);return t}}})(),B=(()=>{const d=E.create();return(v,O,t,H,P,K="geodesic")=>{g.copy(d,O);P=u(P);if("geodesic"===K&&(K=p.geodesicCompatibleSpatialReference(t))&&F.projectVectorToVector(d,t,d,K))return p.directGeodeticSolver(v,d,P,H,K),v[2]=O[2],F.projectVectorToVector(v,K,v,t)?!0:!1;t=c.convertRotationType(P,"geographic","arithmetic");t=m.convertUnit(t,"degrees","radians");g.set(v,O[0]+H*Math.cos(t),O[1]+H*Math.sin(t),O[2]);return!0}})(),x=new p.InverseGeodeticSolverResult, N=2*Math.PI,J=b.cyclicalDegrees,I=new b.Cyclical(-180,180);a.convertAngle=function(d,v,O){let t=m.convertUnit(d.value,d.unit,"degrees");t=c.convertRotationType(t,d.rotationType,O);t=m.convertUnit(t,"degrees",v);return c.createAngle(t,v,O)};a.directionBetweenPoints=l;a.directionForVertices=function(d,v,O,t=a.DirectionMode.Absolute){if(v&&O)switch(t){case a.DirectionMode.Absolute:return l(v,O);case a.DirectionMode.Relative:return q(r(d,v,O),a.DirectionMode.Relative);case a.DirectionMode.RelativeBilateral:return q(r(d, v,O),a.DirectionMode.RelativeBilateral)}};a.getDegreesArithmetic=function(d){if(null!=d)return c.convertRotationType(m.convertUnit(d.value,d.unit,"degrees"),d.rotationType,"arithmetic")};a.getDegreesGeographic=u;a.getNormalizedDirection=q;a.getNormalizedGeographicOrientation=h;a.pointFromDistanceAlongAzimuth=B;a.radiansGeographicBetweenVec=z;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/core/quantityUtils":function(){define(["exports","./unitUtils"],function(a,b){function c(q, h){return{type:b.unitType(h),value:q,unit:h}}function m(q,h){return{type:b.unitType(h),value:q,unit:h}}function k(q,h){return{type:b.unitType(h),value:q,unit:h}}function w(q,h,u="arithmetic"){return{type:b.unitType(h),value:q,unit:h,rotationType:u}}function g(q,h){const u=E(q,h);return"angle"===q.type?w(u,h,q.rotationType):c(u,h)}function E(q,h){return b.convertUnit(q.value,q.unit,h)}const F=m(0,"meters"),p=k(0,"square-meters"),y=w(0,"radians"),l=w(0,"degrees"),r=w(0,"degrees","geographic");a.convertRotationType= function(q,h,u){if(h===u)return q;switch(u){case "arithmetic":case "geographic":return-q+90}};a.createAngle=w;a.createArea=k;a.createLength=m;a.createQuantity=c;a.createScalar=function(q){return{value:q}};a.isBaseUnit=function(q){return b.isBaseUnit(q.unit)};a.max=function(q,h){return null==q?h:null==h?q:q.value>b.convertUnit(h.value,h.unit,q.unit)?q:h};a.min=function(q,h){return null==q?h:null==h?q:q.valueT?Math.PI:Math.acos(T)}function M(L){return"vec2("+L[0]+", "+L[1]+")"}function C(L,S){return L[0]===S[0]&&L[1]===S[1]}function e(L,S){const T=L[0];L=L[1];const ea=S[0];S=S[1];const V=b.getEpsilon();return Math.abs(T-ea)<=V*Math.max(1,Math.abs(T),Math.abs(ea))&&Math.abs(L-S)<=V*Math.max(1,Math.abs(L),Math.abs(S))}function n(L,S,T,ea,V){let ca=S[0]-T[0];T=S[1]-T[1];V=(ea[0]*ca+ea[1]*T)*(V-1);ca=ea[0]*V;T=ea[1]*V;L[0]=S[0]+ca;L[1]= S[1]+T;return L}const G=Object.freeze(Object.defineProperty({__proto__:null,add:k,angle:A,ceil:F,copy:c,cross:d,dist:u,distance:u,div:E,divide:E,dot:I,equals:e,exactEquals:C,floor:p,inverse:N,len:z,length:z,lerp:v,max:l,min:y,mul:g,multiply:g,negate:x,normalize:J,projectAndScale:n,random:O,rotate:D,round:r,scale:q,scaleAndAdd:h,set:m,sqrDist:f,sqrLen:B,squaredDistance:f,squaredLength:B,str:M,sub:w,subtract:w,transformMat2:t,transformMat2d:H,transformMat3:P,transformMat4:K},Symbol.toStringTag,{value:"Module"})); a.add=k;a.angle=A;a.ceil=F;a.copy=c;a.cross=d;a.dist=u;a.distance=u;a.div=E;a.divide=E;a.dot=I;a.equals=e;a.exactEquals=C;a.floor=p;a.inverse=N;a.len=z;a.length=z;a.lerp=v;a.max=l;a.min=y;a.mul=g;a.multiply=g;a.negate=x;a.normalize=J;a.projectAndScale=n;a.random=O;a.rotate=D;a.round=r;a.scale=q;a.scaleAndAdd=h;a.set=m;a.sqrDist=f;a.sqrLen=B;a.squaredDistance=f;a.squaredLength=B;a.str=M;a.sub=w;a.subtract=w;a.transformMat2=t;a.transformMat2d=H;a.transformMat3=P;a.transformMat4=K;a.vec2=G;Object.defineProperty(a, Symbol.toStringTag,{value:"Module"})})},"esri/core/libs/gl-matrix-2/factories/vec2f64":function(){define(["exports"],function(a){function b(){return[0,0]}function c(u){return[u[0],u[1]]}function m(u,f){return[u,f]}function k(u,f=[0,0]){const z=Math.min(2,u.length);for(let B=0;BE.length)return!1;g.x=E[0];g.y=E[1];g.z=E[2];g.spatialReference=F;return m.projectPointToVector(g,p,y,l)}const g=k.makeDehydratedPoint(0,0,0,c.WGS84);a.projectVectorToVector=w;a.projectVectorToVectorAsync=async function(E,F,p,y,l,r){await b.initializeProjection(F,y,null,r);return w(E,F,p,y,l)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/geometry/projection/projectPointToVector":function(){define(["exports", "../../core/libs/gl-matrix-2/factories/vec3f64","../projection","./projectBuffer"],function(a,b,c,m){function k(g,E,F,p){if(c.canProjectWithoutEngine(g.spatialReference,F))return w[0]=g.x,w[1]=g.y,w[2]=g.z??p??0,m.projectBuffer(w,g.spatialReference,0,E,F,0,1);g=c.tryProjectWithZConversion(g,F);if(!g)return!1;E[0]=g?.x;E[1]=g?.y;E[2]=g?.z??p??0;return!0}const w=b.create();a.projectPointToVector=k;a.projectPointToVectorAsync=async function(g,E,F,p,y){await c.initializeProjection(g.spatialReference, F,null,y);return k(g,E,F,p)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/layers/graphics/dehydratedPoint":function(){define(["exports"],function(a){a.makeDehydratedPoint=function(b,c,m,k){return{x:b,y:c,z:m,hasZ:null!=m,hasM:!1,spatialReference:k,type:"point"}};a.setDehydratedPoint=function(b,c,m,k,w){b.x=c;b.y=m;b.z=k;b.hasZ=null!=k;b.spatialReference=w};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/geometry/support/geodesicUtils":function(){define("exports ../../geometry ../../core/Error ../../core/unitUtils ./geodesicConstants ./spatialReferenceUtils ../Polyline ../Polygon ../Point ../SpatialReference".split(" "), function(a,b,c,m,k,w,g,E,F,p){function y(x){if(!x)return null;if(w.isGeographic(x)&&x.wkid){var N=k.spheroids[x.wkid];if(N)return N}if(x=x.wkt2||x.wkt)if((x=k.wktSpheroidRegex.exec(x))&&2===x.length?(N=x[1].split(","),!N||3>N.length?x=null:(x=parseFloat(N[1]),N=parseFloat(N[2]),x=isNaN(x)||isNaN(N)?null:{a:x,f:0===N?0:1/N})):x=null,x)return x;return null}function l(x){x=y(x);if(null!=x&&"b"in x&&"eSq"in x&&"radius"in x)return x;const N=x.a*(1-x.f);return Object.assign(x,{b:N,eSq:1-(N/x.a)**2,radius:(2* x.a+N)/3,densificationRatio:1E4/((2*x.a+N)/3)})}function r(x){return null!=x&&0>x?x+360:x}function q(x,N,J){const {a:I,eSq:d}=l(J);J=Math.sqrt(d);const v=Math.sin(N[1]*k.toRadians);N=I*N[0]*k.toRadians;J=0!h(v.spatialReference)))throw new c("geodesic-areas:invalid-spatial-reference","the input geometries spatial reference is not supported");const J=[];for(var I=0;I< x.length;I++){var d=x[I];const {radius:v,densificationRatio:O}=l(d.spatialReference);J.push(u(d,v*O))}x=[];I=[0,0];d=[0,0];for(let v=0;v!h(d.spatialReference)))throw new c("geodesic-lengths:invalid-spatial-reference", "the input geometries spatial reference is not supported");const J=[];for(let d=0;dJ||360this.viewModel?.attachmentInfos,"change",()=>this.scheduleRender()),m.on(()=>this.viewModel?.fileInfos,"change",()=>this.scheduleRender()),m.watch(()=>this.viewModel?.mode,()=>this._modeChanged(),m.initial)])}loadDependencies(){return q.loadCalciteComponents({icon:()=>new Promise((J,I)=>a(["../chunks/calcite-icon"],J,I))})}get capabilities(){return this.viewModel.capabilities}set capabilities(J){this.viewModel.capabilities= J}get effectiveDisplayType(){const {displayType:J}=this;return J&&"auto"!==J?J:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(J){this.viewModel.graphic=J}get icon(){return"attachment"}set icon(J){this._overrideIfSome("icon",J)}get label(){return this.messages?.widgetLabel??""}set label(J){this._overrideIfSome("label",J)}castVisibleElements(J){return{...x,...J}}addAttachment(){const {_addAttachmentForm:J,viewModel:I}=this;this._set("submitting", !0);this._set("error",null);return I.addAttachment(J).then(d=>{this._set("submitting",!1);this._set("error",null);I.mode="view";return d}).catch(d=>{this._set("submitting",!1);this._set("error",new c("attachments:add-attachment",this.messages.addErrorMessage,d));throw d;})}deleteAttachment(J){const {viewModel:I}=this;this._set("submitting",!0);this._set("error",null);return I.deleteAttachment(J).then(d=>{this._set("submitting",!1);this._set("error",null);I.mode="view";return d}).catch(d=>{this._set("submitting", !1);this._set("error",new c("attachments:delete-attachment",this.messages.deleteErrorMessage,d));throw d;})}updateAttachment(){const {viewModel:J}=this,{_updateAttachmentForm:I}=this;this._set("submitting",!0);this._set("error",null);return J.updateAttachment(I).then(d=>{this._set("submitting",!1);this._set("error",null);J.mode="view";return d}).catch(d=>{this._set("submitting",!1);this._set("error",new c("attachments:update-attachment",this.messages.updateErrorMessage,d));throw d;})}addFile(){const J= this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);this.viewModel.mode="view";return J}updateFile(){const {viewModel:J}=this,I=J.updateFile(this.selectedFile,this._updateAttachmentForm,J.activeFileInfo);J.mode="view";return I}deleteFile(J){J=this.viewModel.deleteFile(J||this.viewModel.activeFileInfo?.file);this.viewModel.mode="view";return J}render(){const {submitting:J,viewModel:I}=this,{state:d}=I;return B.tsx("div",{class:this.classes("esri-attachments",h.globalCss.widget)},J?this._renderProgressBar(): null,"loading"===d?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const {error:J,visibleElements:I}=this;return J&&I.errorMessage?B.tsx("div",{class:"esri-attachments__error-message",key:"error-message"},J.message):null}_renderAttachments(){const {activeFileInfo:J,mode:I,activeAttachmentInfo:d}=this.viewModel;return"add"===I?this._renderAddForm():"edit"===I?this._renderDetailsForm(d||J):this._renderAttachmentContainer()}_renderLoading(){return B.tsx("div", {class:"esri-attachments__loader-container",key:"loader"},B.tsx("div",{class:"esri-attachments__loader"}))}_renderProgressBar(){return this.visibleElements.progressBar?B.tsx("div",{class:"esri-attachments__progress-bar",key:"progress-bar"}):null}_renderAddForm(){const {submitting:J,selectedFile:I}=this;var d=J||!I,v=this.visibleElements.cancelAddButton?B.tsx("button",{bind:this,class:this.classes(h.globalCss.button,h.globalCss.buttonTertiary,h.globalCss.buttonSmall,h.globalCss.buttonHalf,J&&h.globalCss.buttonDisabled), disabled:J,onclick:this._cancelForm,type:"button"},this.messages.cancel):null;d=this.visibleElements.addSubmitButton?B.tsx("button",{class:this.classes(h.globalCss.button,h.globalCss.buttonSecondary,h.globalCss.buttonSmall,h.globalCss.buttonHalf,{[h.globalCss.buttonDisabled]:d}),disabled:d,type:"submit"},this.messages.add):null;const O=I?B.tsx("span",{class:"esri-attachments__file-name",key:"file-name"},I.name):null;v=B.tsx("form",{afterCreate:f.storeNode,afterRemoved:f.discardNode,bind:this,"data-node-ref":"_addAttachmentForm", onsubmit:this._submitAddAttachment},B.tsx("fieldset",{class:"esri-attachments__file-fieldset"},O,B.tsx("label",{class:this.classes("esri-attachments__file-label",h.globalCss.button,h.globalCss.buttonSecondary)},I?this.messages.changeFile:this.messages.selectFile,B.tsx("input",{bind:this,class:"esri-attachments__file-input",name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),d,v);return B.tsx("div",{class:"esri-attachments__form-node",key:"add-form-container"},v)}_renderDetailsForm(J){const {visibleElements:I, viewModel:d,selectedFile:v,submitting:O}=this;var {capabilities:t}=d,H=O||!v;let P;if(v){var K=v.type;P=v.name;var D=v.size}else if(J&&"file"in J)K=J.file.type,P=J.file.name,D=J.file.size;else if(J&&"contentType"in J){K=J.contentType;P=J.name;D=J.size;var A=J.url}var M=t.editing&&t.operations?.delete&&I.deleteButton?B.tsx("button",{bind:this,class:this.classes(h.globalCss.button,h.globalCss.buttonSmall,h.globalCss.buttonTertiary,"esri-attachments__delete-button",{[h.globalCss.buttonDisabled]:O}), disabled:O,key:"delete-button",onclick:e=>this._submitDeleteAttachment(e,J),type:"button"},this.messages.delete):void 0;H=t.editing&&t.operations?.update&&I.updateButton?B.tsx("button",{class:this.classes(h.globalCss.button,h.globalCss.buttonSmall,h.globalCss.buttonThird,{[h.globalCss.buttonDisabled]:H}),disabled:H,key:"update-button",type:"submit"},this.messages.update):void 0;const C=this.visibleElements.cancelUpdateButton?B.tsx("button",{bind:this,class:this.classes(h.globalCss.button,h.globalCss.buttonSmall, h.globalCss.buttonTertiary,h.globalCss.buttonThird,{[h.globalCss.buttonDisabled]:O}),disabled:O,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0;t=t.editing&&t.operations?.update?B.tsx("fieldset",{class:"esri-attachments__file-fieldset",key:"file"},B.tsx("span",{class:"esri-attachments__file-name",key:"file-name"},P),B.tsx("label",{class:this.classes("esri-attachments__file-label",h.globalCss.button,h.globalCss.buttonSecondary)},this.messages.changeFile,B.tsx("input", {bind:this,class:"esri-attachments__file-input",name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0;D=B.tsx("fieldset",{class:"esri-attachments__metadata-fieldset",key:"size"},B.tsx("label",null,k.formatFileSize(this.messagesUnits,D??0)));K=B.tsx("fieldset",{class:"esri-attachments__metadata-fieldset",key:"content-type"},B.tsx("label",null,K));A=null!=A?B.tsx("a",{class:"esri-attachments__item-link",href:A,rel:"noreferrer",target:"_blank"},this._renderImageMask(J,400),B.tsx("div", {class:"esri-attachments__item-link-overlay"},B.tsx("span",{class:"esri-attachments__item-link-overlay-icon"},B.tsx("calcite-icon",{icon:"launch"})))):this._renderImageMask(J,400);M=B.tsx("form",{afterCreate:f.storeNode,afterRemoved:f.discardNode,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:e=>this._submitUpdateAttachment(e,J)},B.tsx("div",{class:"esri-attachments__metadata"},D,K),t,B.tsx("div",{class:"esri-attachments__actions"},M,C,H));return B.tsx("div",{class:"esri-attachments__form-node", key:"edit-form-container"},A,M)}_renderImageMask(J,I){return J?"file"in J?this._renderGenericImageMask(J.file.name,J.file.type):this._renderImageMaskForAttachment(J,I):null}_renderGenericImageMask(J,I){var {supportsResizeAttachments:d}=this.viewModel;I=r.getIconPath(I);d={["esri-attachments__image--resizable"]:d};return B.tsx("div",{class:this.classes("esri-attachments__item-mask--icon","esri-attachments__item-mask"),key:I},B.tsx("img",{alt:J,class:this.classes(d,"esri-attachments__image"),src:I, title:J}))}_renderImageMaskForAttachment(J,I){var {supportsResizeAttachments:d}=this.viewModel;if(!J)return null;const {contentType:v,name:O,url:t}=J;if(!d||!r.isSupportedImage(v))return this._renderGenericImageMask(O,v);J=(J=this._getCSSTransform(J))?{transform:J,"image-orientation":"none"}:{};I=`${t}${t?.includes("?")?"\x26":"?"}w=${I}`;d={["esri-attachments__image--resizable"]:d};return B.tsx("div",{class:this.classes("esri-attachments__item-mask"),key:I},B.tsx("img",{alt:O,class:this.classes(d, "esri-attachments__image"),src:I,styles:J,title:O}))}_renderFile(J){const {file:I}=J;return B.tsx("li",{class:"esri-attachments__item",key:I},B.tsx("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:"esri-attachments__item-button",key:"details-button",onclick:()=>this._startEditFile(J),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(J),B.tsx("label",{class:"esri-attachments__label"},B.tsx("span",{class:"esri-attachments__filename"},I.name||this.messages.noTitle), B.tsx("span",{"aria-hidden":"true",class:this.classes("esri-attachments__item-chevron-icon",f.isRTL(this.container)?u.legacyIcon.left:u.legacyIcon.right)}))))}_renderAttachmentInfo({attachmentInfo:J,displayType:I}){const {viewModel:d,effectiveDisplayType:v}=this,{capabilities:O,supportsResizeAttachments:t}=d,{contentType:H,name:P,url:K}=J;I=this._renderImageMask(J,"list"===I?48:400);var D=O.editing?B.tsx("span",{"aria-hidden":"true",class:this.classes("esri-attachments__item-chevron-icon",f.isRTL(this.container)? u.legacyIcon.left:u.legacyIcon.right)}):null;D="preview"===v&&t&&r.isSupportedImage(H)?null:B.tsx("label",{class:"esri-attachments__label"},B.tsx("span",{class:"esri-attachments__filename"},P||this.messages.noTitle),D);I=[I,D];I=O.editing?B.tsx("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:"esri-attachments__item-button","data-attachment-info-id":J.id,key:"details-button",onclick:()=>this._startEditAttachment(J),title:this.messages.attachmentDetails,type:"button"},I):B.tsx("a", {class:"esri-attachments__item-button",href:K??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},I);return B.tsx("li",{class:"esri-attachments__item",key:J},I)}_renderAttachmentContainer(){const {effectiveDisplayType:J,viewModel:I,visibleElements:d}=this,{attachmentInfos:v,capabilities:O,fileInfos:t}=I;var H=!!v?.length;const P=!!t?.length,K={["esri-attachments__container--list"]:"preview"!==J,["esri-attachments__container--preview"]:"preview"===J},D=O.editing&&O.operations?.add&&d.addButton? B.tsx("button",{bind:this,class:this.classes(h.globalCss.button,h.globalCss.buttonTertiary,"esri-attachments__add-attachment-button"),onclick:()=>this._startAddAttachment(),type:"button"},B.tsx("span",{"aria-hidden":"true",class:this.classes("esri-attachments__item-add-icon",u.legacyIcon.plus)}),this.messages.add):void 0,A=H?B.tsx("ul",{class:"esri-attachments__items",key:"attachments-list"},v.toArray().map(C=>this._renderAttachmentInfo({attachmentInfo:C,displayType:J}))):void 0,M=P?B.tsx("ul",{class:"esri-attachments__items", key:"file-list"},t.toArray().map(C=>this._renderFile(C))):void 0;H=P||H?void 0:B.tsx("div",{class:h.globalCss.empty},this.messages.noAttachments);return B.tsx("div",{class:this.classes("esri-attachments__container",K),key:"attachments-container"},A,M,H,D)}_modeChanged(){this._set("error",null);this._set("selectedFile",null)}_handleFileInputChange(J){J=J.target.files?.item(0);this._set("selectedFile",J)}_submitDeleteAttachment(J,I){J.preventDefault();I&&("file"in I?this.deleteFile(I.file):I&&this.deleteAttachment(I))}_submitAddAttachment(J){J.preventDefault(); this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(J,I){J.preventDefault();I&&"file"in I?this.updateFile():this.updateAttachment()}_startEditAttachment(J){const {viewModel:I}=this;I.activeFileInfo=null;I.activeAttachmentInfo=J;I.mode="edit"}_startEditFile(J){const {viewModel:I}=this;I.activeAttachmentInfo=null;I.activeFileInfo=J;I.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(J){J.preventDefault();this.viewModel.mode="view"}_getCSSTransform(J){({orientationInfo:J}= J);return!this._supportsImageOrientation&&J?[J.rotation?`rotate(${J.rotation}deg)`:"",J.mirrored?"scaleX(-1)":""].join(" "):""}};b.__decorate([w.property()],E.prototype,"capabilities",null);b.__decorate([w.property()],E.prototype,"displayType",void 0);b.__decorate([w.property({readOnly:!0})],E.prototype,"effectiveDisplayType",null);b.__decorate([w.property()],E.prototype,"graphic",null);b.__decorate([w.property()],E.prototype,"icon",null);b.__decorate([w.property()],E.prototype,"label",null);b.__decorate([w.property(), z.messageBundle("esri/widgets/Attachments/t9n/Attachments")],E.prototype,"messages",void 0);b.__decorate([w.property(),z.messageBundle("esri/core/t9n/Units")],E.prototype,"messagesUnits",void 0);b.__decorate([w.property({readOnly:!0})],E.prototype,"selectedFile",void 0);b.__decorate([w.property({readOnly:!0})],E.prototype,"submitting",void 0);b.__decorate([w.property({readOnly:!0})],E.prototype,"error",void 0);b.__decorate([w.property({type:l})],E.prototype,"viewModel",void 0);b.__decorate([w.property()], E.prototype,"visibleElements",void 0);b.__decorate([g.cast("visibleElements")],E.prototype,"castVisibleElements",null);return E=b.__decorate([p.subclass("esri.widgets.Attachments")],E)})},"esri/core/unitFormatUtils":function(){define("exports ./ByteSizeUnit ./Cyclical ./mathUtils ./quantityUtils ./string ./unitUtils ../intl/number".split(" "),function(a,b,c,m,k,w,g,E){function F(h,u,f){return h.units[u][f]}function p(h,u,f,z=2,B="abbr"){return`${E.formatNumber(u,{minimumFractionDigits:z,maximumFractionDigits:z, signDisplay:0this.graphic,()=>this._graphicChanged(),w.initial))}destroy(){this.graphic=this._attachmentLayer= null}castCapabilities(f){return{...h,...f}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){var {graphic:f}=this;if(!f)return!1;f=f.layer||f.sourceLayer;return f?.loaded&&"capabilities"in f&&f.capabilities&&"operations"in f.capabilities&&"supportsResizeAttachments"in f.capabilities.operations&&f.capabilities.operations.supportsResizeAttachments||!1}async getAttachments(){const {_attachmentLayer:f,attachmentInfos:z}=this;if(!f|| "function"!==typeof f.queryAttachments)throw new k("invalid-layer","getAttachments(): A valid layer is required.");const B=this._getObjectId();var x=new r({objectIds:[B],returnMetadata:!0});const N=[];this._getAttachmentsPromise=x=f.queryAttachments(x).then(J=>J[B]||N).catch(()=>N);this.notifyChange("state");x=await x;z.destroyAll();x.length&&z.addMany(x);this._getAttachmentsPromise=null;this.notifyChange("state");return x}async addAttachment(f,z=this.graphic){const {_attachmentLayer:B,attachmentInfos:x, capabilities:N}=this;if(!z)throw new k("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:z});if(!f)throw new k("invalid-attachment","addAttachment(): An attachment is required.",{attachment:f});if(!N.operations?.add)throw new k("invalid-capabilities","addAttachment(): add capabilities are required.");if(!B||"function"!==typeof B.addAttachment)throw new k("invalid-layer","addAttachment(): A valid layer is required.");f=await B.addAttachment(z,f).then(J=>this._queryAttachment(J.objectId, z));x.add(f);return f}async deleteAttachment(f){const {_attachmentLayer:z,attachmentInfos:B,graphic:x,capabilities:N}=this;if(!f)throw new k("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:f});if(!N.operations?.delete)throw new k("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!z||"function"!==typeof z.deleteAttachments)throw new k("invalid-layer","deleteAttachment(): A valid layer is required.");if(!x)throw new k("invalid-graphic", "deleteAttachment(): A graphic is required.");const J=await z.deleteAttachments(x,[f.id]).then(()=>f);B.remove(J);J.destroy();return J}async updateAttachment(f,z=this.activeAttachmentInfo){const {_attachmentLayer:B,attachmentInfos:x,graphic:N,capabilities:J}=this;if(!f)throw new k("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:f});if(!z)throw new k("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:z});if(!J.operations?.update)throw new k("invalid-capabilities", "updateAttachment(): Update capabilities are required.");const I=x.indexOf(z);if(!B||"function"!==typeof B.updateAttachment)throw new k("invalid-layer","updateAttachment(): A valid layer is required.");if(!N)throw new k("invalid-graphic","updateAttachment(): A graphic is required.");f=await B.updateAttachment(N,z.id,f).then(d=>this._queryAttachment(d.objectId));x.splice(I,1,f);return f}async commitFiles(){await Promise.all(this.fileInfos.items.map(f=>this.addAttachment(f.form)));this.fileInfos.removeAll(); return this.getAttachments()}addFile(f,z){if(!f||!z)return null;f={file:f,form:z};this.fileInfos.add(f);return f}updateFile(f,z,B=this.activeFileInfo){if(!f||!z||!B)return null;B=this.fileInfos.indexOf(B);-1B.file===f);return z?(this.fileInfos.remove(z),z):null}async _queryAttachment(f,z){const {_attachmentLayer:B}=this;if(!f||!B?.queryAttachments)throw new k("invalid-attachment-id", "Could not query attachment.");const x=this._getObjectId(z);f=new r({objectIds:[x],attachmentsWhere:`AttachmentId=${f}`,returnMetadata:!0});return B.queryAttachments(f).then(N=>N[x][0])}_getObjectId(f=this.graphic){return f?.getObjectId()??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>{}))}_setAttachmentLayer(){var {graphic:f}=this;this._attachmentLayer=(f=q.getSourceLayer(f))?"scene"===f.type&&null!=f.associatedLayer?f.associatedLayer:f:null}};a.__decorate([g.property()], c.prototype,"capabilities",void 0);a.__decorate([E.cast("capabilities")],c.prototype,"castCapabilities",null);a.__decorate([g.property()],c.prototype,"activeAttachmentInfo",void 0);a.__decorate([g.property()],c.prototype,"activeFileInfo",void 0);a.__decorate([g.property({readOnly:!0,type:u})],c.prototype,"attachmentInfos",void 0);a.__decorate([g.property()],c.prototype,"fileInfos",void 0);a.__decorate([g.property({type:b})],c.prototype,"graphic",void 0);a.__decorate([g.property()],c.prototype,"mode", void 0);a.__decorate([g.property({readOnly:!0})],c.prototype,"state",null);a.__decorate([g.property()],c.prototype,"filesEnabled",void 0);a.__decorate([g.property({readOnly:!0})],c.prototype,"supportsResizeAttachments",null);return c=a.__decorate([y.subclass("esri.widgets.Attachments.AttachmentsViewModel")],c)})},"esri/rest/query/support/AttachmentInfo":function(){define("../../../chunks/tslib.es6 ../../../core/JSONSupport ../../../core/accessorSupport/decorators/property ../../../core/accessorSupport/ensureType ../../../core/RandomLCG ../../../core/has ../../../core/accessorSupport/decorators/subclass ../../../layers/support/exifUtils".split(" "), function(a,b,c,m,k,w,g,E){var F;const p={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};b=F=class extends b.JSONSupport{constructor(y){super(y);this.url=this.size=this.parentObjectId=this.parentGlobalId=this.name=this.keywords=this.globalId=this.id=this.exifInfo=this.contentType=null}get orientationInfo(){var {exifInfo:y}= this;y=E.getExifValue({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:y});return p[y]||null}clone(){return new F({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};a.__decorate([c.property({type:String})],b.prototype,"contentType",void 0);a.__decorate([c.property()],b.prototype,"exifInfo",void 0);a.__decorate([c.property({readOnly:!0})], b.prototype,"orientationInfo",null);a.__decorate([c.property({type:m.Integer})],b.prototype,"id",void 0);a.__decorate([c.property({type:String})],b.prototype,"globalId",void 0);a.__decorate([c.property({type:String})],b.prototype,"keywords",void 0);a.__decorate([c.property({type:String})],b.prototype,"name",void 0);a.__decorate([c.property({json:{read:!1}})],b.prototype,"parentGlobalId",void 0);a.__decorate([c.property({json:{read:!1}})],b.prototype,"parentObjectId",void 0);a.__decorate([c.property({type:m.Integer})], b.prototype,"size",void 0);a.__decorate([c.property({json:{read:!1}})],b.prototype,"url",void 0);return b=F=a.__decorate([g.subclass("esri.rest.query.support.AttachmentInfo")],b)})},"esri/layers/support/exifUtils":function(){define(["exports"],function(a){function b(c){const {tagName:m,tags:k}=c;return k&&m?k.find(w=>w.name===m)?.value||null:null}a.getExifValue=function(c){const {exifInfo:m,exifName:k,tagName:w}=c;return m&&k&&w?(c=m.find(g=>g.name===k))?b({tagName:w,tags:c.tags}):null:null};Object.defineProperty(a, Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Feature/support/featureUtils":function(){define("exports ../../../core/Logger ../../../core/string ../../../intl/date ../../../intl/number ../../../layers/support/fieldUtils ../../../layers/support/layerUtils ../../../smartMapping/support/utils ../../../support/arcadeOnDemand ../../../time/timeZoneUtils".split(" "),function(a,b,c,m,k,w,g,E,F,p){function y(Q){return Q?T.test(Q):!1}function l(Q,U){if(U&&y(U)&&Q){var ba=U.replace(T,"").toLowerCase(); return Q.find(({name:ia})=>ia.toLowerCase()===ba)}}function r(Q,U){return(U=q(U,Q))?U.name:Q}function q(Q,U){return Q&&"function"===typeof Q.getField&&U?Q.getField(U)??null:null}function h({formattedAttributes:Q,template:U,fieldInfoMap:ba}){return`${c.replace(c.replace(U,ia=>`{${ba.get(ia.toLowerCase())?.fieldName||ia}}`),Q).replaceAll(G,"")}`.trim()}function u(Q,U,ba=!1){const ia=U[Q];"string"===typeof ia&&(ba=(ba?encodeURIComponent(ia):ia).replaceAll(S,"%27"),U[Q]=ba)}function f(Q,U=!1){const ba= {...Q};Object.keys(ba).forEach(ia=>u(ia,ba,U));return ba}function z(Q,U){return Q.replaceAll(L,(ba,ia,ka)=>(ba=q(U,ka))?`{${ba.name}}`:ia)}function B(Q,U,ba){return(Q=z(Q,ba))?Q.replaceAll(ca,(ia,ka,R)=>{ka=`${ka||R}`.trim();return c.replace(ia,f(U,ka&&"{"!==ka[0]||!1))}):Q}function x(Q){return null!=Q&&"object"===typeof Q&&"fieldsIndex"in Q&&"geometryType"in Q&&"getField"in Q&&"load"in Q&&"loaded"in Q&&"objectIdField"in Q&&"spatialReference"in Q&&"type"in Q&&("feature"===Q.type||"scene"===Q.type|| "sublayer"===Q.type)&&"when"in Q}function N(Q){return null!=Q&&"object"===typeof Q&&"createQuery"in Q&&"queryFeatureCount"in Q&&"queryObjectIds"in Q&&"queryRelatedFeatures"in Q&&"queryRelatedFeaturesCount"in Q&&"relationships"in Q}function J(Q){return x(Q)&&N(Q)}function I(Q,U){const {fieldInfos:ba,fieldName:ia,preventPlacesFormatting:ka,layer:R,timeZone:X}=U;U=v(ba,ia);var da=q(R,ia);if(U&&!w.isRasterPixelValueField(ia)){da=da?.type;const fa=U.format?.dateFormat;if("date"===da||"date-only"===da|| "time-only"===da||"timestamp-offset"===da||fa)return E.formatAnyDate(Q,{format:fa,fieldType:da,timeZoneOptions:{layerTimeZone:R&&"preferredTimeZone"in R?R.preferredTimeZone:null,viewTimeZone:X,datesInUnknownTimezone:R&&"datesInUnknownTimezone"in R?!!R.datesInUnknownTimezone:!1}})}U=U?.format;if("string"===typeof Q&&w.isRasterPixelValueField(ia)&&U)return Q=Q.trim(),/\d{2}-\d{2}/.test(Q)?Q:Q.includes(",")?d(Q,",",", ",U):Q.includes(";")?d(Q,";","; ",U):Q.includes(" ")?d(Q," "," ",U):k.formatNumber(Number(Q), k.convertNumberFormatToIntlOptions(U));"string"!==typeof Q||!U||null!=U.dateFormat||null==U.places&&null==U.digitSeparator||(da=Number(Q),isNaN(da)||(Q=da));return"string"===typeof Q||null==Q||null==U?H(Q):ka?k.formatNumber(Q,{...k.convertNumberFormatToIntlOptions(U),minimumFractionDigits:0,maximumFractionDigits:20}):k.formatNumber(Q,k.convertNumberFormatToIntlOptions(U))}function d(Q,U,ba,ia){return Q.trim().split(U).map(ka=>k.formatNumber(Number(ka),k.convertNumberFormatToIntlOptions(ia))).join(ba)} function v(Q,U){if(Q?.length&&U)return Q.find(ba=>ba.fieldName?.toLowerCase()===U.toLowerCase())}function O({fieldName:Q,graphic:U,layer:ba}){if(A(Q)||!ba||"function"!==typeof ba.getFeatureType)return null;const {typeIdField:ia}=ba;return ia&&Q===ia?(Q=ba.getFeatureType(U))?Q.name:null:null}function t({fieldName:Q,value:U,graphic:ba,layer:ia}){return A(Q)||!ia||"function"!==typeof ia.getFieldDomain?null:(Q=ba&&ia.getFieldDomain(Q,{feature:ba}))&&"coded-value"===Q.type?Q.getName(U):null}function H(Q){return"string"=== typeof Q?Q.replaceAll(ea,'\x3cbr class\x3d"esri-text-new-line" /\x3e'):Q}function P(Q){const {value:U,fieldName:ba,fieldInfos:ia,fieldInfoMap:ka,layer:R,graphic:X,timeZone:da}=Q;return null==U?"":(Q=t({fieldName:ba,value:U,graphic:X,layer:R}))||(Q=O({fieldName:ba,graphic:X,layer:R}))?Q:ka.get(ba.toLowerCase())?I(U,{fieldInfos:ia||Array.from(ka.values()),fieldName:ba,layer:R,timeZone:da}):(Q=R?.fieldsIndex?.get(ba))&&(E.isAnyDateField(Q)||w.isTimeOnlyField(Q))?E.formatAnyDate(U,{fieldType:Q.type,timeZoneOptions:{layerTimeZone:R&& "preferredTimeZone"in R?R.preferredTimeZone:null,viewTimeZone:da,datesInUnknownTimezone:R&&"datesInUnknownTimezone"in R?!!R.datesInUnknownTimezone:!1}}):H(U)}async function K(Q,U){const {layer:ba,graphic:ia,outFields:ka,objectIds:R,returnGeometry:X,spatialReference:da}=Q;Q=R[0];if("number"!==typeof Q&&"string"!==typeof Q)return U={layer:ba,graphic:ia,objectId:Q,requiredFields:ka},b.getLogger("esri.widgets.Feature.support.featureUtils").warn("Could not query required fields for the specified feature. The feature's ID is invalid.", U),null;if(!g.getEffectiveLayerCapabilities(ba)?.operations?.supportsQuery)return U={layer:ba,graphic:ia,requiredFields:ka,returnGeometry:X},b.getLogger("esri.widgets.Feature.support.featureUtils").warn("The specified layer cannot be queried. The following fields will not be available.",U),null;Q=ba.createQuery();Q.objectIds=R;Q.outFields=ka?.length?ka:[ba.objectIdField];Q.returnGeometry=!!X;Q.returnZ=!!X;Q.returnM=!!X;Q.outSpatialReference=da;return(await ba.queryFeatures(Q,U)).features[0]}async function D(Q){if(!Q.expressionInfos?.length)return!1; var U=await F.loadArcade();({arcadeUtils:{hasGeometryFunctions:U}}=U);return U(Q)}function A(Q=""){return Q?Q.includes("relationships/"):!1}function M({attributes:Q,graphic:U,relatedInfo:ba,fieldInfos:ia,fieldInfoMap:ka,layer:R,timeZone:X}){Q&&U&&ba&&Object.keys(U.attributes).forEach(da=>{var fa=(fa={layerId:ba.relation.id.toString(),fieldName:da},`${"relationships/"}${fa.layerId}/${fa.fieldName}`);Q[fa]=P({fieldName:fa,fieldInfos:ia,fieldInfoMap:ka,layer:R,value:U.attributes[da],graphic:U,timeZone:X})})} function C({attributes:Q,relatedInfo:U,fieldInfoMap:ba,fieldInfos:ia,layer:ka,timeZone:R}){Q&&U&&(U.relatedFeatures?.forEach(X=>M({attributes:Q,graphic:X,relatedInfo:U,fieldInfoMap:ba,fieldInfos:ia,layer:ka,timeZone:R})),U.relatedStatsFeatures?.forEach(X=>M({attributes:Q,graphic:X,relatedInfo:U,fieldInfoMap:ba,fieldInfos:ia,layer:ka,timeZone:R})))}function e(Q,U){return Q?.allTables.find(ba=>"feature"===ba.type&&ba.layerId===U.id&&ba.url===U.layer?.url)}function n({map:Q,relationship:U,relationship:{relatedTableId:ba}, relatedLayer:ia,layers:ka}){if(!ka)return null;for(const R of ka)if("map-image"===R.type){if(ka=n({layers:R.sublayers,map:Q,relatedLayer:ia,relationship:U})||n({layers:R.subtables,map:Q,relatedLayer:ia,relationship:U}))return ka}else if(J(R))if("sublayer"===ia.type){if(R!==ia&&R.id===ba)return R.isTable?e(Q,R):R}else{ka="scene"===ia.type&&ia.associatedLayer?ia.associatedLayer.url:ia.url;if(!ka)break;if("sublayer"===R.type){if(R!==ia&&R.layer?.url===ka&&R.id===ba)return R.isTable?e(Q,R):R}else if(R!== ia&&R.url===ka&&R.layerId===ba)return R}return null}const G=/href=(""|'')/gi,L=/(\{([^{\r\n]+)\})/g,S=/'/g,T=/^\s*expression\//i,ea=/(\n)/gi,V=/[\u00A0-\u9999<>&]/gim,ca=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,ja=/^(?:mailto:|tel:)/,W=m.convertDateFormatToIntlOptions("short-date-short-time"),Z=Q=>{if(!Q)return!1;Q=Q.toUpperCase();return Q.includes("CURRENT_TIMESTAMP")||Q.includes("CURRENT_DATE")||Q.includes("CURRENT_TIME")},ha=({layer:Q,method:U,query:ba,definitionExpression:ia})=>{Q.capabilities?.query?.supportsCacheHint&& "attachments"!==U&&(Q=null!=ba.where?ba.where:null,U=null!=ba.geometry?ba.geometry:null,Z(ia)||Z(Q)||"extent"===U?.type||"tile"===ba.resultType||(ba.cacheHint=!0))};a.applyTextFormattingHTML=H;a.createFieldInfoMap=function(Q,U){const ba=new Map;if(!Q)return ba;for(const ia of Q)ia.fieldName&&(Q=r(ia.fieldName,U),ia.fieldName=Q,ba.set(Q.toLowerCase(),ia));return ba};a.findRelatedLayer=function(Q,U,ba){return Q&&U&&ba?"sublayer"===U.type?n({layers:U.layer?.sublayers,map:Q,relatedLayer:U,relationship:ba})|| n({layers:U.layer?.subtables,map:Q,relatedLayer:U,relationship:ba}):n({layers:Q.allLayers,map:Q,relatedLayer:U,relationship:ba})||n({layers:Q.allTables,map:Q,relatedLayer:U,relationship:ba}):null};a.fixTokens=z;a.formatAttributes=function({fieldInfos:Q,attributes:U,layer:ba,graphic:ia,fieldInfoMap:ka,relatedInfos:R,timeZone:X}){const da={};R?.forEach(fa=>C({attributes:da,relatedInfo:fa,fieldInfoMap:ka,fieldInfos:Q,layer:ba,timeZone:X}));U&&Object.keys(U).forEach(fa=>{da[fa]=P({fieldName:fa,fieldInfos:Q, fieldInfoMap:ka,layer:ba,value:U[fa],graphic:ia,timeZone:X})});return da};a.formatEditInfo=function(Q,U,ba,ia){const {creatorField:ka,creationDateField:R,editorField:X,editDateField:da}=Q;if(U){Q=p.getTimeZoneFormattingOptions(ia&&"preferredTimeZone"in ia?ia.preferredTimeZone:null,ia&&"datesInUnknownTimezone"in ia?!!ia.datesInUnknownTimezone:!1,ba,W,"date");Q={...W,...Q};ba=U[da];if("number"===typeof ba)return U=U[X],{type:"edit",date:m.formatDate(ba,Q),user:U};ba=U[R];return"number"===typeof ba? (U=U[ka],{type:"create",date:m.formatDate(ba,Q),user:U}):null}};a.formatValueToFieldInfo=I;a.getAllFieldInfos=function(Q){const U=[];if(!Q)return U;const {fieldInfos:ba,content:ia}=Q;ba&&U.push(...ba);if(!ia||!Array.isArray(ia))return U;ia.forEach(ka=>{"fields"===ka.type&&(ka=ka?.fieldInfos)&&U.push(...ka)});return U};a.getFieldInfo=v;a.getFieldInfoLabel=function(Q,U){return(U=l(U,Q?.fieldName))?U.title||null:Q?Q.label||Q.fieldName:null};a.getFixedFieldName=r;a.getFixedFieldNames=function(Q,U){return Q&& Q.map(ba=>r(ba,U))};a.getHighlightKeyForFeature=function(Q){const U=Q.getObjectId();return null!=U?`oid:${U}`:`uid:${Q.uid}`};a.getSourceLayer=function(Q){if(null!=Q)return(Q.sourceLayer||Q.layer)??void 0};a.graphicCallback=async function({type:Q,value:U,event:ba}){try{return"function"===typeof U?U(ba):U}catch(ia){b.getLogger("esri.widgets.Feature.support.featureUtils").error("error",`An error occurred when calling the "${Q}" function`,{error:ia,graphic:ba.graphic,value:U})}};a.htmlEntities=function(Q){return Q.replaceAll(V, U=>`&#${U.charCodeAt(0)};`)};a.isExpressionField=y;a.isFeatureSupportedLayer=x;a.isGraphicForRelatableFeatureSupportedLayer=function(Q){return!!Q&&"object"===typeof Q&&"sourceLayer"in Q&&J(Q.sourceLayer)};a.isRelatableFeatureSupportedLayer=J;a.isRelatableLayer=N;a.isRelatedField=A;a.preLayerQueryCallback=({query:Q,layer:U,method:ba})=>{ha({layer:U,method:ba,query:Q,definitionExpression:`${U.definitionExpression} ${U.serviceDefinitionExpression??""}`})};a.preRequestCallback=({queryPayload:Q,layer:U, method:ba})=>{ha({layer:U,method:ba,query:Q,definitionExpression:`${U.definitionExpression} ${U.serviceDefinitionExpression??""}`})};a.querySourceLayer=K;a.queryUpdatedFeature=async function({graphic:Q,popupTemplate:U,layer:ba,spatialReference:ia},ka){if(ba&&U&&("function"===typeof ba.load&&await ba.load(ka),Q.attributes)){var R=ba.objectIdField,X=Q.attributes[R];if(null!=X){X=[X];var da=await U.getRequiredFields(ba.fieldsIndex),fa=w.featureHasFields(da,Q);R=fa?[]:da.includes(R)?da:[...da,R];U=U.returnGeometry|| await D(U);if(!fa||U)if(ba=await K({layer:ba,graphic:Q,outFields:R,objectIds:X,returnGeometry:U,spatialReference:ia},ka))ba.geometry&&(Q.geometry=ba.geometry),ba.attributes&&(Q.attributes={...Q.attributes,...ba.attributes})}}};a.shouldOpenInNewTab=function(Q=""){if(Q)return!ja.test(Q.trim().toLowerCase())};a.substituteAttributes=h;a.substituteFieldsInLinksAndAttributes=function({attributes:Q,globalAttributes:U,layer:ba,text:ia,expressionAttributes:ka,fieldInfoMap:R}){return ia?h({formattedAttributes:U, template:B(ia,{...U,...ka,...Q},ba),fieldInfoMap:R}):""};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/smartMapping/support/utils":function(){define("exports ../../intl/date ../../layers/support/fieldUtils ../../support/arcadeOnDemand ../../support/basemapUtils ../../time/timeZoneUtils".split(" "),function(a,b,c,m,k,w){function g(q){return String(q).padStart(2,"0")}function E(q,h,u){if("date"===h||"number"===h){"number"===h&&(q=new Date(q));h=u?q.getFullYear():q.getUTCFullYear(); const f=g((u?q.getMonth():q.getUTCMonth())+1),z=g(u?q.getDate():q.getUTCDate()),B=g(u?q.getHours():q.getUTCHours()),x=g(u?q.getMinutes():q.getUTCMinutes());q=g(u?q.getSeconds():q.getUTCSeconds());q=`TIMESTAMP'${h}-${f}-${z} ${B}:${x}:${q}'`}return q}function F(q,h){if(h instanceof Date)return"date";if("number"===typeof h)return"number";if("string"===typeof h&&(q=q.getField(h),"\x3cnow\x3e"!==h.toLowerCase()&&c.isDateField(q)))return"field"}const p={light:"streets gray topo terrain oceans osm gray-vector streets-vector topo-vector streets-relief-vector streets-navigation-vector topo-3d navigation-3d streets-3d osm-3d gray-3d arcgis-light-gray arcgis-navigation arcgis-streets arcgis-streets-relief arcgis-topographic arcgis-oceans osm-standard osm-standard-relief osm-streets osm-streets-relief osm-light-gray arcgis-terrain arcgis-charted-territory arcgis-community arcgis-colored-pencil arcgis-modern-antique arcgis-midcentury arcgis-newspaper arcgis-hillshade-light".split(" "), dark:"satellite hybrid dark-gray dark-gray-vector streets-night-vector navigation-dark-3d streets-dark-3d dark-gray-3d arcgis-imagery arcgis-imagery-standard arcgis-dark-gray arcgis-navigation-night arcgis-streets-night osm-dark-gray arcgis-nova arcgis-hillshade-dark".split(" ")},y={years:365,months:30,days:1,hours:1/24,minutes:1/1440,seconds:1/86400,milliseconds:1/864E5},l=new Set(["integer","small-integer"]);let r=null;a.castIntegerFieldToFloat=function(q){return`cast(${q} as float)`};a.dateTypes= ["date","date-only","timestamp-offset"];a.defaultBasemapGroups=p;a.fieldDelimiter=",";a.formatAnyDate=function(q,h){const {format:u,timeZoneOptions:f,fieldType:z}=h??{};let B;f&&({timeZone:x,timeZoneName:B}=w.getTimeZoneFormattingOptions(f.layerTimeZone,f.datesInUnknownTimezone,f.viewTimeZone,b.convertDateFormatToIntlOptions(u||"short-date-short-time"),z));if("string"===typeof q&&isNaN(Date.parse("time-only"===z?`1970-01-01T${q}Z`:q)))return q;switch(z){case "date-only":var x=b.convertDateFormatToIntlOptions(u|| "short-date");return"string"===typeof q?b.formatDateOnly(q,{...x}):b.formatDate(q,{...x,timeZone:w.utc});case "time-only":return x=b.convertDateFormatToIntlOptions(u||"short-time"),"string"===typeof q?b.formatTimeOnly(q,x):b.formatDate(q,{...x,timeZone:w.utc});case "timestamp-offset":if(!x&&"string"===typeof q&&(new Date(q)).toISOString()!==q)return q;x=(h=u||f?b.convertDateFormatToIntlOptions(u||"short-date-short-time"):void 0)?{...h,timeZone:x,timeZoneName:B}:void 0;return"string"===typeof q?b.formatTimestamp(q, x):b.formatDate(q,x);default:return h=u||f?b.convertDateFormatToIntlOptions(u||"short-date-short-time"):void 0,b.formatDate("string"===typeof q?new Date(q):q,h?{...h,timeZone:x,timeZoneName:B}:void 0)}};a.getBasemapGroup=function(q,h=p){for(const u in h)if(h[u].includes(q))return u};a.getBasemapId=function(q,h,u=!0){let f=null;q&&("string"===typeof q?h.includes(q)&&(f=q):f=k.getWellKnownBasemapId(q));return u?f||"gray":f};a.getDateDiffSQL=function(q,h,u,f){const {hasQueryEngine:z}=q;u=E(u,F(q,u), z);q=E(h,F(q,h),z);q=`(${u} - ${q})`;f=y[f];h="/";1>f&&(f=1/f,h="*");return{sqlExpression:1===f?q:`(${q} ${h} ${f})`,sqlWhere:null}};a.getDateType=F;a.getFieldsList=async function(q){const {field:h,field2:u,field3:f,normalizationField:z,valueExpression:B}=q;q=[];B&&(r||({arcadeUtils:q}=await m.loadArcade(),r=q),q=r.extractFieldNames(B));h&&q.push(h);u&&q.push(u);f&&q.push(f);z&&q.push(z);return q};a.getNormalizationType=function(q){let h=q.normalizationType;h||(q.normalizationField?h="field":null!= q.normalizationTotal&&(h="percent-of-total"));return h??void 0};a.isAnyDateField=function(q){return c.isDateField(q)||c.isDateOnlyField(q)||c.isTimestampOffsetField(q)};a.isIntegerField=function(q,h){q=h&&q.getField(h);return!!q&&l.has(q.type)};a.unitValueInDays=y;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Attachments/support/attachmentUtils":function(){define(["exports","../../../assets"],function(a,b){a.getIconPath=function(c){const m=b.getAssetUrl("esri/themes/base/images/files/"); return c?"text/plain"===c?`${m}text-32.svg`:"application/pdf"===c?`${m}pdf-32.svg`:"text/csv"===c?`${m}csv-32.svg`:"application/gpx+xml"===c?`${m}gpx-32.svg`:"application/x-dwf"===c?`${m}cad-32.svg`:"application/postscript"===c||"application/json"===c||"text/xml"===c||"model/vrml"===c?`${m}code-32.svg`:"application/x-zip-compressed"===c||"application/x-7z-compressed"===c||"application/x-gzip"===c||"application/x-tar"===c||"application/x-gtar"===c||"application/x-bzip2"===c||"application/gzip"===c|| "application/x-compress"===c||"application/x-apple-diskimage"===c||"application/x-rar-compressed"===c||"application/zip"===c?`${m}zip-32.svg`:c.includes("image/")?`${m}image-32.svg`:c.includes("audio/")?`${m}sound-32.svg`:c.includes("video/")?`${m}video-32.svg`:c.includes("msexcel")||c.includes("ms-excel")||c.includes("spreadsheetml")?`${m}excel-32.svg`:c.includes("msword")||c.includes("ms-word")||c.includes("wordprocessingml")?`${m}word-32.svg`:c.includes("powerpoint")||c.includes("presentationml")? `${m}report-32.svg`:`${m}generic-32.svg`:`${m}generic-32.svg`};a.isSupportedImage=function(c){c=c.toLowerCase();return"image/bmp"===c||"image/emf"===c||"image/exif"===c||"image/gif"===c||"image/x-icon"===c||"image/jpeg"===c||"image/png"===c||"image/tiff"===c||"image/x-wmf"===c};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/globalCss":function(){define(["exports"],function(a){a.globalCss={anchor:"esri-widget__anchor",anchorDisabled:"esri-widget__anchor--disabled", button:"esri-button",buttonDisabled:"esri-button--disabled",buttonHalf:"esri-button--half",buttonSecondary:"esri-button--secondary",buttonSmall:"esri-button--small",buttonTertiary:"esri-button--tertiary",buttonThird:"esri-button--third",disabled:"esri-disabled",empty:"esri-widget__content--empty",emptyIllustration:"esri-widget__content-illustration--empty",heading:"esri-widget__heading",hidden:"esri-hidden",input:"esri-input",interactive:"esri-interactive",loader:"esri-widget__loader",loaderAnimation:"esri-widget__loader-animation", loaderText:"esri-widget__loader-text",menu:"esri-menu",menuHeader:"esri-menu__header",menuItem:"esri-menu__list-item",menuItemActive:"esri-menu__list-item--active",menuItemFocus:"esri-menu__list-item--focus",menuList:"esri-menu__list",panel:"esri-widget--panel",panelHeightOnly:"esri-widget--panel-height-only",primaryTick:"primary-tick",primaryTickAmPm:"primary-tick__ampm",primaryTickLabel:"primary-tick__label",rotating:"esri-rotating",secondaryTick:"secondary-tick",select:"esri-select",table:"esri-widget__table", widget:"esri-widget",widgetButton:"esri-widget--button",widgetButtonActive:"esri-widget--button-active",widgetDisabled:"esri-widget--disabled"};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/legacyIcon":function(){define(["exports"],function(a){a.legacyIcon={checkMark:"esri-icon-check-mark",close:"esri-icon-close",collapse:"esri-icon-collapse",down:"esri-icon-down",downArrow:"esri-icon-down-arrow",dragHorizontal:"esri-icon-drag-horizontal",dragVertical:"esri-icon-drag-vertical", duplicate:"esri-icon-duplicate",expand:"esri-icon-expand",fontFallbackText:"esri-icon-font-fallback-text",forward:"esri-icon-forward",handleVertical:"esri-icon-handle-vertical",icon:"esri-icon",left:"esri-icon-left",loadingIndicator:"esri-icon-loading-indicator",locateCircled:"esri-icon-locate-circled",minus:"esri-icon-minus",noticeTriangle:"esri-icon-notice-triangle",pause:"esri-icon-pause",play:"esri-icon-play",plus:"esri-icon-plus",radioChecked:"esri-icon-radio-checked",radioUnchecked:"esri-icon-radio-unchecked", refresh:"esri-icon-refresh",reverse:"esri-icon-reverse",right:"esri-icon-right",search:"esri-icon-search",swap:"esri-icon-swap",table:"esri-icon-table",trash:"esri-icon-trash",up:"esri-icon-up",upArrow:"esri-icon-up-arrow",upDownArrows:"esri-icon-up-down-arrows",urbanModel:"esri-icon-urban-model",zoomInMagnifyingGlass:"esri-icon-zoom-in-magnifying-glass",zoomToObject:"esri-icon-zoom-to-object"};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureForm":function(){define("require ../chunks/tslib.es6 ../intl ../core/arrayUtils ../core/has ../core/Logger ../core/promiseUtils ../core/reactiveUtils ../core/accessorSupport/decorators/property ../core/accessorSupport/decorators/subclass ../layers/support/fieldUtils ./Widget ./Editor/components/Prompt ./FeatureForm/css ./FeatureForm/featureFormUtils ./FeatureForm/FeatureFormViewModel ../chunks/componentsUtils ./support/dataUtils ./support/dateUtils ./support/globalCss ./support/Heading ./support/widgetUtils ./support/decorators/messageBundle ./support/decorators/vmEvent ./support/jsxFactory ../intl/substitute".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O){c=class extends l{constructor(t,H){super(t,H);this._attemptFocusOnNextRender=!1;this._dateComponentMap=new Map;this._inputsWithChanges=new Set;this._listObserverNode=this._pendingSubtypeChoice=this._focusedFieldName=null;this._listObserver=new IntersectionObserver(P=>{P.length&&P[0].isIntersecting&&this._incrementRelatedRecordPage()},{root:window.document});this._prompt=null;this.groupDisplay="all";this.headingLevel=2;this.messagesTemplates= this.messagesFeature=this.messagesCommon=this.messages=null;this.viewModel=new u;this._onShowAllRelatedRecordsClick=P=>{const {feature:K,relatedRecordCallbacks:D}=this;K&&D?.showAllRelatedRecords&&D.showAllRelatedRecords({parentFeature:K,relationshipId:P})};this._onAddRelatedRecordsClick=(P,K)=>{const {feature:D,relatedRecordCallbacks:A}=this;D&&A?.addRelatedRecord&&A.addRelatedRecord({parentFeature:D,relatedLayer:K,relationshipId:P})};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([E.watch(()=>this.feature,()=>{this._inputsWithChanges.clear();this._dateComponentMap.clear();E.whenOnce(()=>!this.viewModel.updating).then(()=>{const t=this._getFocusableInput("forward");this._syncGroupInputStates();this._focusedFieldName=t?.name||null;this._attemptFocusOnNextRender=!0})}),E.watch(()=>this.groupDisplay,()=>this._syncGroupInputStates()), this.on("submit",t=>{if(0this._inputsWithChanges.add(P));this._focusedFieldName=H;this._attemptFocusOnNextRender=!0;this.scheduleRender()}}),E.watch(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange())])}loadDependencies(){return f.loadCalciteComponents({block:()=>new Promise((t,H)=>a(["../chunks/calcite-block"],t,H)),button:()=>new Promise((t,H)=>a(["../chunks/calcite-button"],t,H)),combobox:()=> new Promise((t,H)=>a(["../chunks/calcite-combobox"],t,H)),"combobox-item":()=>new Promise((t,H)=>a(["../chunks/calcite-combobox-item"],t,H)),"combobox-item-group":()=>new Promise((t,H)=>a(["../chunks/calcite-combobox-item-group"],t,H)),icon:()=>new Promise((t,H)=>a(["../chunks/calcite-icon"],t,H)),input:()=>new Promise((t,H)=>a(["../chunks/calcite-input"],t,H)),"input-date-picker":()=>new Promise((t,H)=>a(["../chunks/calcite-input-date-picker"],t,H)),"input-message":()=>new Promise((t,H)=>a(["../chunks/calcite-input-message"], t,H)),"input-number":()=>new Promise((t,H)=>a(["../chunks/calcite-input-number"],t,H)),"input-time-picker":()=>new Promise((t,H)=>a(["../chunks/calcite-input-time-picker"],t,H)),"input-time-zone":()=>new Promise((t,H)=>a(["../chunks/calcite-input-time-zone"],t,H)),label:()=>new Promise((t,H)=>a(["../chunks/calcite-label"],t,H)),list:()=>new Promise((t,H)=>a(["../chunks/calcite-list"],t,H)),"list-item":()=>new Promise((t,H)=>a(["../chunks/calcite-list-item"],t,H)),loader:()=>new Promise((t,H)=>a(["../chunks/calcite-loader"], t,H)),notice:()=>new Promise((t,H)=>a(["../chunks/calcite-notice"],t,H)),"radio-button":()=>new Promise((t,H)=>a(["../chunks/calcite-radio-button"],t,H)),"radio-button-group":()=>new Promise((t,H)=>a(["../chunks/calcite-radio-button-group"],t,H)),switch:()=>new Promise((t,H)=>a(["../chunks/calcite-switch"],t,H)),"text-area":()=>new Promise((t,H)=>a(["../chunks/calcite-text-area"],t,H))})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const t= this.relatedRecordCallbacks;return!(!t||!(t.addRelatedRecord||t.editRelatedRecord||t.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(t){this.viewModel.disabled=t}get feature(){return this.viewModel.feature}set feature(t){this.viewModel.feature=t}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(t){this.viewModel.formTemplate=t}get icon(){return"form-field"}set icon(t){this._overrideIfSome("icon",t)}get label(){return this.messages?.widgetLabel?? ""}set label(t){this._overrideIfSome("label",t)}get layer(){return this.viewModel.layer}set layer(t){this.viewModel.layer=t}get map(){return this.viewModel.map}set map(t){this.viewModel.map=t}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(t){this.viewModel.relatedRecordCallbacks=t}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(t){this.viewModel.relationshipId=t}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(t){this.viewModel.spatialReference= t}get strict(){return this.viewModel.strict}set strict(t){this.viewModel.strict=t}get timeZone(){return this.viewModel.timeZone}set timeZone(t){this.viewModel.timeZone=t}get showPrompt(){return t=>{this._prompt?.cancel?.();this._prompt=t}}set showPrompt(t){this._overrideIfSome("showPrompt",t)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(t){this._overrideIfSome("clearPrompt",t)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const {state:t}= this.viewModel;return v.tsx("div",{class:this.classes(q.css.base,x.globalCss.widget,x.globalCss.panel)},"ready"===t?this._renderForm():null)}_renderForm(){return v.tsx("div",null,v.tsx("form",{class:q.css.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent()),this._prompt?v.tsx(r.Prompt,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderHeader(){var t=this.viewModel;if(t.formHeaderVisible){var H=null!=t.formTitle&&v.tsx(N.Heading, {key:"title",level:this.headingLevel},t.formTitle);t=null!=t.formDescription&&v.tsx("p",{class:q.css.description,key:"description"},t.formDescription);return v.tsx("div",{class:q.css.formHeader},H,t)}}_renderContent(){const {viewModel:t}=this;return t.activeRelationshipInput?this._renderRelationshipInput(t.activeRelationshipInput):t.inputs.filter(m.isSome).filter(H=>H.visible).map(H=>this._renderInput(H))}_renderInput(t){if(h.isGroupInput(t))return this._renderGroup(t);if(h.isFieldInput(t))return this._renderLabeledField(t); if(h.isRelationshipInput(t))return this._renderRelationshipInput(t);if(h.isTextElementInput(t))return this._renderTextElementInput(t)}_renderDescriptionOrEmpty(t,H){return null==t?null:v.tsx("div",{class:this.classes(q.css.description),id:H},t)}_renderGroup(t){const {disabled:H,formTemplate:P,headingLevel:K}=this,{description:D,id:A,inputs:M,label:C,open:e}=t,n=M.filter(L=>L.visible),G=this.viewModel.findField(this._focusedFieldName);return v.tsx("calcite-block",{class:this.classes(q.css.group,"sequential"=== this.groupDisplay?q.css.groupSequential:null,G?.group===t?q.css.groupActive:null,H?q.css.inputDisabled:null),collapsible:!0,"data-group":t,description:D||void 0,disabled:H,heading:`${C}`,headingLevel:P?.title?N.incrementHeadingLevel(K):K,id:A,key:A,open:e,onCalciteBlockToggle:({target:L})=>this._onGroupToggle(L,t)},n.map(L=>this._renderInput(L)))}_getFocusableInput(t,H){const P=h.flattenInputs(this.viewModel.inputs);"backward"===t&&P.reverse();H?h.isGroupInput(H)?t=(t=H.inputs.find(K=>K.visible))? P.indexOf(t):0:(h.isInputInGroupInput(H)&&!H.group.open?(H=H.group.inputs.filter(h.isFieldInput),t="forward"===t?H[H.length-1]:H[0]):t=H,t=P.indexOf(t)+1):t=0;for(;tthis._saveValueFromComponent(P.target)}): v.tsx("calcite-text-area",{...H,resize:"vertical",onCalciteTextAreaInput:P=>this._saveValueFromComponent(P.target)}):v.tsx("calcite-input",{...H,loading:t.updating,type:"text",onCalciteInputInput:P=>this._saveValueFromComponent(P.target)})}_renderNumberComponent(t,H){return v.tsx("calcite-input-number",{...H,integer:y.isIntegerField(t.field),loading:t.updating,type:"number",onCalciteInputNumberInput:P=>this._saveValueFromComponent(P.target)})}_renderDateComponents(t,H){const {field:P}=t;switch(P.type){case "date":return this._renderDateFieldComponents(t, H);case "date-only":return this._renderDateOnlyFieldComponent(t,H);case "time-only":return this._renderTimeOnlyFieldComponent(t,H);case "timestamp-offset":return this._renderTimestampOffsetFieldComponents(t,H);default:return this._renderReadOnlyComponent(t,B.getLabelForDateFieldValue(P,H.value,{timeZone:this.timeZone,...B.getIntlOptionsForField(P)}))}}_renderDateOnlyFieldComponent(t,H){const {range:P,valid:K,value:D}=t,{class:A,key:M,readOnly:C}=H,{rawMax:e,rawMin:n}=P;return v.tsx("calcite-input-date-picker", {afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!K,class:A,"data-date-part":"date","data-field-name":H["data-field-name"],key:`${M}-date-input`,max:z.isString(e)?e:void 0,min:z.isString(n)?n:void 0,numberingSystem:B.numberingSystem,onblur:G=>{this._focusedFieldName=null;this._saveValueFromDateComponent(G.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:C,value:null!=D?`${D}`:void 0,onCalciteInputDatePickerChange:G=> this._saveValueFromDateComponent(G.target)})}_renderTimeOnlyFieldComponent(t,H){const {valid:P,value:K}=t,{class:D,key:A,readOnly:M}=H;return v.tsx("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!P,class:D,"data-date-part":"time","data-field-name":H["data-field-name"],key:`${A}-time-input`,numberingSystem:B.numberingSystem,onblur:C=>{this._focusedFieldName=null;this._saveValueFromDateComponent(C.target)},onfocus:this._onComponentFocus, overlayPositioning:"fixed",readOnly:M,step:t.timeStep,value:null!=K?`${K}`:void 0,onCalciteInputTimePickerChange:C=>this._saveValueFromDateComponent(C.target)})}_renderTimestampOffsetFieldComponents(t,H){const {name:P,range:K,timeZone:D,valid:A,value:M}=t,{class:C,key:e,readOnly:n}=H,{rawMax:G,rawMin:L}=K;H={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!A,numberingSystem:B.numberingSystem,overlayPositioning:"fixed",readOnly:n,["data-field-name"]:P, onfocus:this._onComponentFocus};const S=B.prepareISOFieldValueForDateComponents(G,D),T=B.prepareISOFieldValueForDateComponents(L,D),ea=B.prepareISOFieldValueForDateComponents(M,D);return v.tsx("div",{class:q.css.dateInputContainer,key:`${e}-date-time-container`},v.tsx("calcite-input-date-picker",{...H,class:C,"data-date-part":"date",key:`${e}-date-input`,max:S?.date??void 0,min:T?.date??void 0,onblur:V=>{this._focusedFieldName=null;this._saveValueFromDateComponent(V.target)},value:ea.date??void 0, onCalciteInputDatePickerChange:V=>this._saveValueFromDateComponent(V.target)}),v.tsx("calcite-input-time-picker",{...H,class:C,"data-date-part":"time",key:`${e}-time-input`,onblur:V=>{this._focusedFieldName=null;this._saveValueFromDateComponent(V.target)},step:t.timeStep,value:ea.time??void 0,onCalciteInputTimePickerChange:V=>this._saveValueFromDateComponent(V.target)}),t.includeTimeOffset?v.tsx("calcite-input-time-zone",{...H,class:C,"data-date-part":"timeZone",disabled:n,key:`${e}-timezone-input`, onblur:V=>{this._focusedFieldName=null;this._saveValueFromDateComponent(V.target)},value:ea.timeZoneOffset??"0",onCalciteInputTimeZoneChange:V=>this._saveValueFromDateComponent(V.target)}):null)}_renderDateFieldComponents(t,H){const {includeTime:P,name:K,valid:D,value:A}=t,{class:M,key:C,max:e,min:n,readOnly:G}=H;var {timeZone:L}=this;t={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!D,numberingSystem:B.numberingSystem,overlayPositioning:"fixed", readOnly:G,["data-field-name"]:K,onfocus:this._onComponentFocus};H=B.prepareUnixFieldValueForDateComponents(A,L);const S=B.prepareUnixFieldValueForDateComponents(e,L);L=B.prepareUnixFieldValueForDateComponents(n,L);return v.tsx("div",{class:q.css.dateInputContainer,key:`${C}-date-time-container`},v.tsx("calcite-input-date-picker",{...t,class:M,"data-date-part":"date",key:`${C}-date-input`,max:S?.date??void 0,min:L?.date??void 0,onblur:T=>{this._focusedFieldName=null;this._saveValueFromDateComponent(T.target)}, value:H.date??void 0,onCalciteInputDatePickerChange:T=>this._saveValueFromDateComponent(T.target)}),P?v.tsx("calcite-input-time-picker",{...t,class:M,"data-date-part":"time",key:`${C}-time-input`,onblur:T=>{this._focusedFieldName=null;this._saveValueFromDateComponent(T.target)},step:1,value:H.time??void 0,onCalciteInputTimePickerChange:T=>this._saveValueFromDateComponent(T.target)}):null)}_renderReadOnlyComponent(t,H){t=this.getCommonInputProps(t);return v.tsx("calcite-input",{...t,class:this.classes(q.css.fieldInput, q.css.inputDisabled),readOnly:!0,type:"text",value:null!=H?`${H}`:t.value})}_renderComboBoxComponent(t,H,P){const {value:K,name:D}=t,{viewModel:A,_inputsWithChanges:M}=this,C="INSERT"===A.arcadeEditType,e=M.has(D),n=null==K&&(!C||e);return v.tsx("calcite-combobox",{...P,allowCustomValues:!1,clearDisabled:!0,disabled:P.readOnly,onblur:C&&t.showNoValueOptionEnabled&&!e?()=>{}:P.onblur,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({target:G})=>{n&&0===G.selectedItems.length? this._ignoreDeselectionOfNoValueOption(G):t.isSubtypeField&&0===G.selectedItems.length?G.value=`${t.value}`:this._saveValueFromComponent(G)}},this.renderComboboxOptionsList(t,H))}renderComboboxOptionsList(t,H){const {value:P,name:K}=t,{messages:D,messagesTemplates:A,viewModel:M,_inputsWithChanges:C}=this,[e,n,G]=H.map(T=>T.map(({name:ea,value:V})=>v.tsx("calcite-combobox-item",{key:`#${V}`,selected:P===V,textLabel:ea,value:`${V}`})));H=[];0this._renderRadioButtonComponent({key:A,label:A,name:K,value:M,selected:M===D,props:P}));t.showNoValueOptionEnabled&&H.unshift(this._renderRadioButtonComponent({key:"empty-option",label:t.showNoValueLabel||this.messages.empty,name:K,value:"",selected:""===D||null===D,props:P}));return v.tsx("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:q.css.inputRadioGroup, "data-field-name":P["data-field-name"],key:`${P.key}-radio-group`,layout:"vertical",name:P.key,required:P.required},H)}_renderSwitchComponent(t,H){const {value:P}=t;t=h.isFieldElementWithInputType(t.element,"switch")?P===t.element.input.onValue:!1;return v.tsx("calcite-switch",{...H,checked:t,class:q.css.inputSwitch,disabled:H.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:K=>this._saveValueFromComponent(K.target)})}_renderRadioButtonComponent({key:t,name:H,value:P,selected:K, label:D,props:A}){return v.tsx("calcite-label",{class:q.css.inputRadioLabel,key:t,layout:"inline"},v.tsx("calcite-radio-button",{...A,afterCreate:void 0,afterUpdate:void 0,checked:K,class:q.css.inputRadio,disabled:A.readOnly,name:H,onblur:()=>{this._focusedFieldName=null},value:P,onCalciteRadioButtonChange:({target:M})=>{M.checked&&this._saveValueFromComponent(M)}}),D)}_renderAuxiliaryText(t){const H=t.name,P=this._inputsWithChanges.has(H)&&!t.valid?h.getErrorMessageForFieldInput(t,this.messages, this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(H)?this.messages.validationErrors.valuesIncompatible:null!=t.valueExpressionExecutor&&t.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=P?v.tsx("calcite-input-message",{icon:!0,status:"invalid"},P):this._inputsWithChanges.has(H)&&t.valueIsOutOfDomain?v.tsx("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(t.description)}_renderShowAllRelatedRecordsListItem(t){const {featureCount:H, relationshipId:P,showAllActionVisible:K}=t;({relatedRecordCallbacks:t}=this);if(K&&t?.showAllRelatedRecords)return t=this.messages,v.tsx("calcite-list-item",{description:O.substitute(t.totalCount,{count:H}),label:t.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(P)},v.tsx("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(t){const {canAddRelatedFeature:H,relationshipId:P,relatedLayer:K}=t,{messages:D,relatedRecordCallbacks:A}= this;if(H&&A?.addRelatedRecord&&K)return v.tsx("calcite-button",{alignment:"center",appearance:"outline-fill",class:q.css.centeredButton,disabled:t.updating||!t.originHasValidKey,iconStart:"plus",key:`${P}-add-button`,onclick:()=>{!t.updating&&t.originHasValidKey&&this._onAddRelatedRecordsClick(P,K)},round:!0,scale:"s",width:"half"},t.relatedLayerIsTable?D.addRecord:D.addFeature)}_renderRelatedRecordListItem(t,H){const {feature:P,description:K,title:D}=t,{feature:A,relatedRecordCallbacks:M}=this, {highlightHelper:C}=this.viewModel;return v.tsx("calcite-list-item",{bind:this,description:K,key:`${H}-${P.uid}`,label:D,onclick:()=>{C?.removeAll();M?.editRelatedRecord&&A&&M.editRelatedRecord({parentFeature:A,relationshipId:H,relatedFeature:P})},onmouseenter:C?()=>C.add(P):void 0,onmouseleave:C?()=>C.remove(P):void 0,value:D},v.tsx("calcite-icon",{icon:h.getIconForFeature(P),slot:"content-start"}),v.tsx("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(t){if(this._relatedRecordsEnabled&& t.editable){var {featureCount:H,relationshipId:P,showAllEnabled:K}=t,D=K?null:this._renderDescriptionOrEmpty(t.description),A=0this._renderRelatedRecordListItem(P,H)),this._renderShowAllRelatedRecordsListItem(t), this._renderObserverNode())}_renderNoValidOriginKeyNotice(t){var {messages:H}=this;H=t.relatedLayerIsTable?H.noOriginKeyRecord:H.noOriginKeyFeature;const P=t.relationship?.keyField,K=this.viewModel.findField(P),D=t.layer?.fieldsIndex.get(P);t=O.substitute(H,{relatedLayerName:t.relatedLayer?.title,originKeyField:K?.label||D?.alias||P});return v.tsx("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},v.tsx("div",{slot:"message"},t))}_renderNoRelatedRecordsNotice(){return v.tsx("calcite-notice", {icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},v.tsx("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return v.tsx("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:q.css.listObserver,key:"feature-observer"})}_renderTextElementInput(t){return v.tsx("div",{class:q.css.textElement,innerHTML:t.text,key:t.id})}getCommonInputProps(t){var {disabled:H}= this;const {editable:P,hint:K,label:D,maxLength:A,minLength:M,name:C,range:{max:e,min:n},required:G,valid:L,value:S}=t;t=this._inputsWithChanges.has(C);H=!P||H;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":L?"false":"true",class:this.classes(q.css.fieldInput,H?q.css.inputDisabled:null),status:t&&!L?"invalid":"idle",key:C,label:D,max:null!=e?e:void 0,min:null!=n?n:void 0,maxLength:-1{t.value=void 0;switch(H.field.type){case "date":t.value= B.prepareUnixFieldValueForDateComponents(H.value,this.timeZone).date??"";break;case "timestamp-offset":t.value=B.prepareISOFieldValueForDateComponents(H.value,this.timeZone).date??"";break;default:t.value=`${H.value}`}D.unobserve(t)});D.observe(t)}if(null!=K)switch(P){case "date":K.date=t;break;case "time":K.time=t;break;case "timeZone":K.timeZone=t}else this._dateComponentMap.set(H.name,{[P]:t});this._afterDateComponentCreateOrUpdate(t)}_afterDateComponentCreateOrUpdate(t){this._afterComponentCreateOrUpdate(t)}_afterComponentCreate(t){const H= this._getFieldInputFromHTMLElement(t);h.isNumberFieldInput(H)&&null!=t.value&&"setNumberValue"in t&&t.setNumberValue({committing:!1,value:t.value,origin:"direct"});this._afterComponentCreateOrUpdate(t)}_afterRadioGroupCreateOrUpdate(t){var H=t.selectedItem;t=t.querySelector("calcite-radio-button");(H=H||t)&&this._afterComponentCreateOrUpdate(H)}_afterComponentCreateOrUpdate(t){var {viewModel:H}=this;const P=this._getFieldInputFromHTMLElement(t);H=H.findField(this._focusedFieldName);this._attemptFocusOnNextRender&& H===P&&(this._attemptFocusOnNextRender=!1,h.isInputInGroupInput(P)&&(P.group.open=!0),t.setFocus())}_onComponentFocus(t){this._focusedFieldName=this._getFieldInputFromHTMLElement(t.target).name}_onComponentBlur(t){t=t.target;this._focusedFieldName=null;this._saveValueFromComponent(t)}_saveValueFromDateComponent(t){const {timeZone:H}=this;var P=this._getFieldInputFromHTMLElement(t);const K=P.field.type,{name:D,range:A}=P;if(P=this._dateComponentMap.get(D)){var M=this.viewModel.getValue(D),C=null;"date-only"=== K?C=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===K?(M=B.normalizeTimeOnlyString(M),C=B.normalizeTimeOnlyString(t.value)):C="timestamp-offset"===K?null!=t.value?B.getISOFieldValueFromDateComponents({dateComponent:P.date,timeComponent:P.time,timeZoneComponent:P.timeZone,oldValue:M,defaultTimeZone:H}):null:null!=t.value?B.getUnixFieldValueFromDateComponents({oldValue:M,dateComponent:P.date,timeComponent:P.time,timeZone:H,max:A.max,min:A.min}):null;null!==C&&t.value?M!==C&&this._updateFieldValue(D, C):this._updateFieldValue(D,null)}}_saveValueFromComponent(t){const H=this._getFieldInputFromHTMLElement(t);t=this._parseValue(t);const P=H.value;H.isSubtypeField&&h.subtypeChangeShouldPrompt(this.layer,P,t)?this._pendingSubtypeChoice||t===P||(this._pendingSubtypeChoice=this._handleSubtypeChoice(H,t)):this._updateFieldValue(H.name,t)}async _handleSubtypeChoice(t,H){const {value:P,name:K}=t,{layer:D,messages:A,viewModel:M,messagesCommon:C}=this;this._updateFieldValue(K,H);if(D&&"subtypes"in D&&D.subtypes?.length){var e= D.subtypes.find(T=>T.code===H),n=D.subtypes.find(T=>T.code===P)?.name??`${P}`;if(e){M.hasPendingSubtypeChoice=!0;var G=g.createResolver(),L="update-fields",S=[{label:A.subtypes.useDefaultValuesOption,value:"update-fields"},{label:A.subtypes.keepCurrentValuesOption,value:"keep-existing"}];n={context:"info",title:A.subtypes.changeWarningTitle,message:O.substitute(A.subtypes.changeWarning,{originalType:n,newType:e.name}),radios:S,defaultRadioSelection:"update-fields",onRadioSelection:T=>L=T,actions:{primary:{label:C.apply, action:()=>G.resolve(L),type:"positive"},secondary:{label:C.cancel,type:"neutral",action:()=>G.resolve("undo")}},cancel:()=>G.reject()};try{switch(this.showPrompt(n),await G.promise){case "update-fields":M.applySubtypeDefaults(e);this._validateContingenciesForNonNullFields();break;case "keep-existing":this._validateContingenciesForNonNullFields();break;case "undo":this._updateFieldValue(t.name,P)}}finally{M.hasPendingSubtypeChoice=!1,this.clearPrompt(),this._pendingSubtypeChoice=null}}}}_onComponentKeyDown({key:t, target:H}){H=this._getFieldInputFromHTMLElement(H);"Enter"===t&&h.isInputInGroupInput(H)&&!H.group.open&&(H.group.open=!0)}_updateFieldValue(t,H){const P=this.viewModel.getValue(t);this.viewModel.setValue(t,H);this._inputsWithChanges.add(t);P!==H&&this.viewModel.fieldsWithContingentValues.has(t)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const t=Object.fromEntries(Object.entries(this.getValues()).filter(([,H])=>null!=H));this.viewModel.validateContingencyConstraints(t)}_parseValue(t){const H= this._getFieldInputFromHTMLElement(t),P=t.value;return h.isFieldElementWithInputType(H.element,"switch")?t.checked?H.element.input.onValue:H.element.input.offValue:null==P||""===P?null:"number"===H.dataType?"-0"===P||"-0."===P||"-0,"===P?P:parseFloat(P):"date"===H.field.type?parseFloat(P):P}_ignoreDeselectionOfNoValueOption(t){const {firstChild:H,selectedItems:P}=t;0===P.length&&H&&"selected"in H?H.selected=!0:w.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(t, H){t.open?(H.open=!0,this._focusedFieldName=this._getFocusableInput("forward",H)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach(P=>{P!==H&&(P.open=!1)})):H.open=!1;this.scheduleRender()}_onFormSubmit(t){t.preventDefault()}_onFormKeyDown(t){"Enter"===t.key&&this.viewModel.submit()}_afterListObserverCreated(t){this.viewModel.activeRelationshipInput&&(this._listObserverNode=t)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&& this._listObserver.unobserve(this._listObserverNode);const t=this.viewModel.activeRelationshipInput;t&&this._listObserverNode&&t.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){this.viewModel.activeRelationshipInput?.incrementPage()}_syncGroupInputStates(){if("sequential"===this.groupDisplay){var t=this.viewModel.allGroupInputs;if(t.length){var H=t.filter(P=>P.open);0===H.length?t[0].open=!0:1P.open=!1)}}}get test(){return{inputsWithChanges:this._inputsWithChanges}}}; b.__decorate([F.property()],c.prototype,"_listObserverNode",void 0);b.__decorate([F.property()],c.prototype,"_relatedRecordsEnabled",null);b.__decorate([F.property()],c.prototype,"_prompt",void 0);b.__decorate([F.property()],c.prototype,"disabled",null);b.__decorate([F.property()],c.prototype,"feature",null);b.__decorate([F.property()],c.prototype,"formTemplate",null);b.__decorate([F.property()],c.prototype,"groupDisplay",void 0);b.__decorate([F.property()],c.prototype,"headingLevel",void 0);b.__decorate([F.property()], c.prototype,"icon",null);b.__decorate([F.property()],c.prototype,"label",null);b.__decorate([F.property()],c.prototype,"layer",null);b.__decorate([F.property()],c.prototype,"map",null);b.__decorate([F.property(),I.messageBundle("esri/widgets/FeatureForm/t9n/FeatureForm")],c.prototype,"messages",void 0);b.__decorate([F.property(),I.messageBundle("esri/t9n/common")],c.prototype,"messagesCommon",void 0);b.__decorate([F.property(),I.messageBundle("esri/widgets/Feature/t9n/Feature")],c.prototype,"messagesFeature", void 0);b.__decorate([F.property(),I.messageBundle("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],c.prototype,"messagesTemplates",void 0);b.__decorate([F.property()],c.prototype,"relatedRecordCallbacks",null);b.__decorate([F.property()],c.prototype,"relationshipId",null);b.__decorate([F.property()],c.prototype,"spatialReference",null);b.__decorate([F.property()],c.prototype,"strict",null);b.__decorate([F.property()],c.prototype,"timeZone",null);b.__decorate([F.property()],c.prototype,"showPrompt", null);b.__decorate([F.property()],c.prototype,"clearPrompt",null);b.__decorate([F.property(),d.vmEvent(["value-change","submit"])],c.prototype,"viewModel",void 0);b.__decorate([F.property()],c.prototype,"test",null);return c=b.__decorate([p.subclass("esri.widgets.FeatureForm")],c)})},"esri/widgets/Editor/components/Prompt":function(){define("require exports ../icons ../../../chunks/componentsUtils ../../support/Heading ../../support/widgetUtils ../../support/jsxFactory".split(" "),function(a,b,c, m,k,w,g){function E({radios:y,onRadioSelection:l,defaultRadioSelection:r}){return y?.length?g.tsx("calcite-radio-button-group",{name:"PromptChoiceList"},y.map(q=>g.tsx("calcite-label",{layout:"inline"},g.tsx("calcite-radio-button",{checked:q.value===r,value:q.value,onCalciteRadioButtonChange:()=>l?.(q.value)}),q.label))):void 0}function F(y){requestAnimationFrame(()=>y.setFocus())}const p={base:"esri-editor__prompt",header:"esri-editor__prompt__header",heading:"esri-editor__prompt__header__heading", message:"esri-editor__prompt__message",divider:"esri-editor__prompt__divider",actions:"esri-editor__prompt__actions"};b.Prompt=function({actions:y,context:l,headingLevel:r,message:q,title:h,...u}){const {primary:f,secondary:z}=y;switch(l){case "danger":var B="danger";break;case "info":B="brand";break;default:B="neutral"}y=g.tsx("calcite-button",{afterCreate:F,appearance:"solid","data-testid":"primary-prompt-button",key:"prompt-primary-button",kind:B,onclick:f.action,width:z?"half":"full"},f.label); B=z&&g.tsx("calcite-button",{appearance:"outline","data-testid":"secondary-prompt-button",key:"prompt-secondary-button",kind:B,onclick:z.action,width:"half"},z.label);return g.tsx("calcite-scrim",{"data-testid":"prompt",key:"prompt"},g.tsx("div",{class:`${p.base}--${l}`},g.tsx("div",{class:p.header},g.tsx("calcite-icon",{icon:c.warningIcon}),g.tsx(k.Heading,{class:p.heading,level:r},h)),g.tsx("div",{class:p.message},q),E(u)??g.tsx("div",{class:p.divider}),g.tsx("div",{class:p.actions},B,y)))};b.css= p;b.loadPromptComponents=()=>m.loadCalciteComponents({button:()=>new Promise((y,l)=>a(["../../../chunks/calcite-button"],y,l)),icon:()=>new Promise((y,l)=>a(["../../../chunks/calcite-icon"],y,l)),scrim:()=>new Promise((y,l)=>a(["../../../chunks/calcite-scrim"],y,l)),label:()=>new Promise((y,l)=>a(["../../../chunks/calcite-label"],y,l)),"radio-button":()=>new Promise((y,l)=>a(["../../../chunks/calcite-radio-button"],y,l)),"radio-button-group":()=>new Promise((y,l)=>a(["../../../chunks/calcite-radio-button-group"], y,l))});Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/icons":function(){define(["exports"],function(a){a.warningIcon="exclamation-mark-triangle";Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/Heading":function(){define(["exports","../../core/mathUtils","./globalCss","./widgetUtils","./jsxFactory"],function(a,b,c,m,k){a.Heading=function({level:w,class:g,...E},F){w=b.clamp(Math.ceil(w),1,6);return k.tsx(`h${w}`,{...E,"aria-level":String(w), class:m.classes(c.globalCss.heading,g),role:"heading"},F)};a.incrementHeadingLevel=function(w,g=1){return b.clamp(Math.ceil(w+g),1,6)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureForm/css":function(){define(["exports"],function(a){a.css={base:"esri-feature-form",form:"esri-feature-form__form",formHeader:"esri-feature-form__form-header",label:"esri-feature-form__label",labelTextContent:"esri-feature-form__label-text-content",fieldInput:"esri-feature-form__input", inputRadio:"esri-feature-form__input--radio",inputRadioGroup:"esri-feature-form__input--radio-group",inputRadioLabel:"esri-feature-form__input--radio-label",inputDisabled:"esri-feature-form__input--disabled",inputSwitch:"esri-feature-form__input--switch",centeredButton:"esri-feature-form__centered-button",description:"esri-feature-form__description-text",listObserver:"esri-feature-form__list-observer",relatedRecordsHeader:"esri-feature-form__related-records_header",relatedRecordsLabel:"esri-feature-form__related-records_label", relatedRecordsList:"esri-feature-form__related-records_list",dateInputContainer:"esri-feature-form__date-input-container",textElement:"esri-feature-form__text-element",group:"esri-feature-form__group",groupSequential:"esri-feature-form__group--sequential",groupActive:"esri-feature-form__group--active"};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureForm/featureFormUtils":function(){define("exports ../../intl ../../core/arrayUtils ../../core/compilerUtils ../../core/lang ../../core/Logger ../../core/string ../../form/support/formUtils ../../layers/support/domainUtils ../../layers/support/fieldUtils ../../smartMapping/support/utils ../support/dateUtils ../../intl/substitute".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r){function q(d){const {fields:v,values:O}=d,t=d.timeZone??void 0;d=v.map((H,P)=>{let K=O[P];H.domain&&"coded-value"===H.domain.type&&(P=H.domain.codedValues.find(D=>D.code===K),P?.name&&(K=P.name));if(y.isAnyDateField(H)||p.isTimeOnlyField(H))K=l.getLabelForDateFieldValue(H,K,{timeZone:t,...l.getIntlOptionsForField(H)});return[H.name,K]});return Object.fromEntries(d)}function h(d,v){return g.replace(g.replace(d,O=>`{${O.toLowerCase()}}`),Object.fromEntries(Object.entries(v).map(([O, t])=>[O.toLowerCase(),t])))}function u(d){return 1E7<=d||-1E7>=d}function f(d,{validationErrors:v}){return null!=d.max&&null!=d.min?v.outsideRange:null!=d.max?v.outsideRangeMax:v.outsideRangeMin}const z=d=>"field"===d?.type,B=d=>"relationship"===d?.type,x=d=>d.reduce((v,O)=>"group"===O?.type?[...v,...O.inputs]:[...v,O],[]),N=(d,v)=>null!=d&&d.input?.type===v;a.LengthValidationError=void 0;(function(d){d.TOO_SHORT="length-validation-error::too-short";d.TOO_LONG="length-validation-error::too-long"})(a.LengthValidationError|| (a.LengthValidationError={}));const J={type:"number"},I={type:"number",intlOptions:{notation:"scientific"}};a.capabilitiesAllowEditType=(d,v)=>{if(!d)return!0;({operations:d}=d);switch(v){case "INSERT":return d.supportsAdd;case "UPDATE":case "DELETE":return d.supportsUpdate;default:return!0}};a.extractExpressionNameFromString=function(d){const [v,O]=d.split("expression/");return""===v&&O?O:(w.getLogger("esri.widgets.FeatureForm/featureFormUtils").error("extractExpressionNameFromString:invalid-input", `The string ${d} is not a valid expression reference of the form '${"expression/"}/expressionName'`),"")};a.flattenFieldInputs=d=>x(d).filter(z);a.flattenInputs=x;a.flattenRelationshipInputs=d=>x(d).filter(B);a.formTemplateHasInvalidFields=function(d,v){return(v=v??("formTemplate"in d&&d.formTemplate))?(v.elements?.filter(E.isFieldElement)??[]).some(({fieldName:O})=>!d.fieldsIndex.get(O)):!1};a.getComputedAttributes=q;a.getErrorMessageForFieldInput=(d,v,O)=>{const {dataType:t,error:H,minLength:P, value:K,required:D}=d,A=v?.validationErrors;if(!A||!H)return null;if(D&&null===K)return A.cannotBeNull;if(H===F.DomainValidationError.VALUE_OUT_OF_RANGE||H===p.NumericRangeValidationError.OUT_OF_RANGE){const {field:M,range:C}=d;d={type:"date",intlOptions:{timeZone:"date"===M.type&&O?O:void 0,...l.getIntlOptionsForField(M)}};v=f(C,v);return r.substitute(v,C,{format:{max:"date"===t?d:null!=C.max&&u(C.max)?I:J,min:"date"===t?d:null!=C.min&&u(C.min)?I:J}})}return H===F.DomainValidationError.INVALID_CODED_VALUE? A.invalidCodedValue:H===p.TypeValidationError.INVALID_TYPE?A.invalidType:H===a.LengthValidationError.TOO_SHORT?r.substitute(A.tooShort,{min:P}):null};a.getFieldsInTitleAndDesc=d=>{const v=[];if(d.formTemplate){const {description:O,title:t}=d.formTemplate;d.fields?.forEach(H=>{const P=t&&g.templateHasKey(t,H.name),K=O&&g.templateHasKey(O,H.name);(P||K)&&v.push(H.name)})}return v};a.getIconForFeature=d=>{if(d){var v=d.layer;v=v&&"geometryType"in v?v.geometryType:void 0;d=d.geometry?.type;return"polyline"=== d||"polyline"===v?"line":"mesh"===d||"mesh"===v||"multipatch"===v?"cube":"multipoint"===d||"multipoint"===v?"point":d||v||"table"}};a.getNormalizedFeatureTypeInfo=d=>{const v={typeFieldName:null,types:[]};if(!d)return v;"subtype-sublayer"===d.type?(v.typeFieldName=d.parent?.subtypeField,v.types=d.parent?.subtypes??[]):"subtype-group"===d.type||"feature"===d.type&&d.subtypes?.length?(v.typeFieldName=d.subtypeField,v.types=d.subtypes??[]):"types"in d&&d.types&&(v.typeFieldName=d.typeIdField,v.types= d.types.map(({id:O,name:t,domains:H})=>({code:O,name:t,domains:H})));null!=v.typeFieldName&&(v.typeFieldName=d.getField(v.typeFieldName)?.name??v.typeFieldName);return v};a.isExpressionReference=function(d){return d.startsWith("expression/")};a.isFieldElementWithInputType=N;a.isFieldElementWithShowNoValueOptionInput=d=>null!=d&&(N(d,"combo-box")||N(d,"radio-buttons"));a.isFieldElementWithTextInput=d=>null!=d&&(N(d,"text-box")||N(d,"text-area"));a.isFieldInput=z;a.isGroupInput=d=>"group"===d?.type; a.isInputInGroupInput=d=>"group"!==d?.type&&null!=d.group;a.isLegacyFieldMapsExpressionReference=function(d){return d.startsWith("expr/")};a.isNumberFieldInput=({domain:d,inputType:v="text-box",dataType:O})=>"number"===O&&"text-box"===v&&(!d||"coded-value"!==d.type);a.isRelationshipInput=B;a.isTemplateItemGroup=d=>"items"in d;a.isTextElementInput=d=>"text"===d.type;a.parseFormTemplateString=function(d){const {attributes:v,fieldsIndex:O,label:t,timeZone:H}=d;if(!v||"object"!==typeof v)return t;var P= Object.keys(v).filter(K=>g.templateHasKey(t,K));d=P.map(K=>v[K]);P=P.map(K=>O.get(K)).filter(c.isSome);return h(t,q({values:d,fields:P,timeZone:H}))};a.prependExpressionPrefix=function(d){return`${"expression/"}${d}`};a.prependFieldPrefix=function(d){return`${"field/"}${d}`};a.substituteFieldTemplatesInString=h;a.subtypeChangeShouldPrompt=function(d,v,O){if(!(d&&"subtypes"in d))return!1;const t=d.subtypes?.find(H=>H.code===O);if(!t)return!1;d=d.subtypes?.find(H=>H.code===v);return k.equalsShallow(t.defaultValues, d?.defaultValues)?!1:Object.values(t.defaultValues).some(H=>null!=H)};a.valueIsInvalidSwitchValue=function(d,v){return null==d||v.onValue!==d&&v.offValue!==d};a.valueIsValidContingentValue=function(d,v){switch(v.objectType){case "any":return!0;case "null":return null==d;case "code":return d===v.codedValue?.code;case "range":return null!=d&&null!=v.minValue&&null!=v.maxValue&&+d>=v.minValue&&+d<=v.maxValue;default:return m.neverReached(v.objectType),!1}};Object.defineProperty(a,Symbol.toStringTag, {value:"Module"})})},"esri/widgets/FeatureForm/FeatureFormViewModel":function(){define("../../chunks/tslib.es6 ../../Graphic ../../core/compilerUtils ../../core/Evented ../../core/Logger ../../core/maybe ../../core/Promise ../../core/reactiveUtils ../../core/string ../../core/accessorSupport/decorators/property ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../core/support/UpdatingHandles ../../form/FormTemplate ../../form/support/formUtils ../../layers/support/ContingentValue ../../layers/support/editableLayers ../../layers/support/LayerContingentValuesCache ../../time/timeZoneUtils ./featureFormUtils ./FieldInput ./FormExpressionArcadeExecutor ./FormExpressionsManager ./GroupInput ./RelationshipInput ./TextElementInput".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O){function t(D){if("field"===D.type||"group"===D.type||"relationship"===D.type||"text"===D.type)return!0;k.getLogger("esri.widgets.FeatureForm.FeatureFormViewModel").warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${D.label} has unsupported type '${D.type}'`);return!1}function H(D,A,M=null){const {feature:C,layer:e,timeZone:n}=A;return new O.TextElementInput({element:D, feature:C,group:M,layer:e,timeZone:n})}const P=new b({attributes:{}}),K={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"]};b=class extends g.EsriPromiseMixin(m.EventedAccessor){constructor(D){super(D);this._expressionExecutorsInUse=new Set;this._expressionExecutorLookup=new Map;this._contingentValuesCache=this._expressionsManager=null;this._featureClone= P.clone();this._initialFeature=P.clone();this._timeZone=null;this._updatingHandles=new r.UpdatingHandles;this.arcadeEditType="NA";this.contingencyConstraintViolations=new Map;this.disabled=!1;this.highlightHelper=null;this.inputs=[];this.relatedRecordCallbacks=this.map=null;this.hasPendingSubtypeChoice=this.strict=!1}initialize(){const D=E.watch(()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType],async([C,e])=>{null!=C&&(e?this._updatingHandles.addPromise(this._updateInputs()): C.load().catch(()=>{}))},{equals:([C,e,n,G,L,S],[T,ea,V,ca,ja,W])=>C===T&&e===ea&&n===V&&G===ca&&L===ja&&S===W,initial:!0}),A=E.watch(()=>this._arcadeContextInfo,C=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=C,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally(()=>this._afterExpressionsEvaluated())))}),M=E.watch(()=>this.layer,C=>{(C="subtype-sublayer"===C?.type?C.parent:"feature"===C?.type?C:null)&&this.addResolvingPromise(z.createLoadedLayerContingentValuesCache(C).then(e=> {this._contingentValuesCache=e;this.notifyChange("fieldsWithContingentValues")}))},{initial:!0});this.addHandles([D,A,M])}destroy(){this.layer=this.feature=null;this._contingentValuesCache=w.destroyMaybe(this._contingentValuesCache);this.highlightHelper?.removeAll();this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map(D=>[D.name,D]))}get activeRelationshipInput(){return this.allRelationshipInputs.find(D=>D.relationshipId===this.relationshipId)}get _arcadeContextInfo(){const {_initialFeature:D, arcadeEditType:A,layer:M,map:C,spatialReference:e,timeZone:n}=this;return{layer:f.isEditableLayer(M)?M:null,originalFeature:D,editType:A,map:C,spatialReference:e,timeZone:n}}get allFieldInputs(){return x.flattenFieldInputs(this.inputs)}get allGroupInputs(){return this.inputs.filter(x.isGroupInput)}get allRelationshipInputs(){return x.flattenRelationshipInputs(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map(D=>[D.name,D]))}get feature(){return this._get("feature")}set feature(D){const A= this._get("feature");this._featureClone=D?D.clone():P.clone();this._initialFeature=this._featureClone.clone();this._expressionsManager&&(this._expressionsManager.feature=this._featureClone);D?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach(M=>M.feature=D)):(this.inputs.forEach(M=>M.destroy()),this.inputs.length=0);A!==D&&(this.hasPendingSubtypeChoice=!1);this.contingencyConstraintViolations.clear();this._set("feature",D)}get fieldsWithContingentValues(){if(null== this._contingentValuesCache)return new Set;const D=this._contingentValuesCache.fieldGroups.flatMap(A=>A.fields);return new Set(D)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(D){void 0===D?this._clearOverride("formTemplate"):this._override("formTemplate",D)}get formDescription(){const {formTemplate:D,layer:A}=this;return D?.description&&A?x.parseFormTemplateString({label:D.description,attributes:this.getValues(),fieldsIndex:A.fieldsIndex, timeZone:this.timeZone}):null}get formTitle(){const {formTemplate:D,layer:A}=this;return D?.title&&A?x.parseFormTemplateString({label:D.title,attributes:this.getValues(),fieldsIndex:A.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const {activeRelationshipInput:D,formDescription:A,formTitle:M}=this;return!(D||!A&&!M)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer: null}set layer(D){this._override("layer",D)}get relationshipId(){return this._get("relationshipId")}set relationshipId(D){var A=this.allRelationshipInputs;null!=D&&D===this.relationshipId||A.forEach(M=>M.showAllEnabled=!1);null!=D&&(A=A.find(M=>M.relationshipId===D))&&(A.showAllEnabled=!0);this._set("relationshipId",D)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(D){this._override("spatialReference",D)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return this.valid? !0:this.allFieldInputs.filter(D=>!D.valid).every(({submittable:D})=>D)}get timeZone(){var {layer:D}=this;if(D&&"datesInUnknownTimezone"in D&&D.datesInUnknownTimezone)return B.utc;D=D&&"preferredTimeZone"in D&&D.preferredTimeZone;return this._timeZone===B.unknown?D||B.utc:this._timeZone||B.system}set timeZone(D){this._timeZone=D}get updating(){return this._updatingHandles.updating}get valid(){const D=this.allFieldInputs;return 0A)}findField(D){return this.allFieldInputs.find(A=> A.name===D)}getFieldValueOptionsForField(D,A){const M=this.findField(D);if(!M)return[[],[],[]];var C="coded-value"===M.domain?.type?M.domain.codedValues.map(({name:n,code:G})=>({name:n,value:G})):[];const e=null==M.value||C.some(n=>n.value===M.value)?[]:[{name:`${M.value}`,value:M.value}];D=this.fieldsWithContingentValues.has(D)?this._getContingentValueOptionsForField(D,A):[];if(0G.value));C=C.filter(G=>!n.has(G.value));return[D,C,e]}return[C,[],e]}getValue(D){D= this.layer?.getField(D);if(null!=D)return this._featureClone.getAttribute(D.name)??null}setValue(D,A){const {_featureClone:M,strict:C}=this,e=this.findField(D);A=""===A?null:A;e&&M.getAttribute(D)!==A&&(e.value=A,!C||e.valid)&&(this._afterValueChange(e),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([e.name]).finally(()=>this._afterExpressionsEvaluated())))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(D){this._initialFeature= D}submit(){var D=this.allFieldInputs;const A=new Set(D.filter(C=>C.valid).map(({name:C})=>C));D=D.filter(C=>!C.valid).map(({name:C})=>C);const M=this.getValues();if(0this._afterExpressionsEvaluated()))}applySubtypeDefaults(D){({defaultValues:D}=D);var {allFieldInputs:A}= this;for(const {name:M}of A)A=D[M],null!=A&&this.setValue(M,A)}_emitChangeEvent({name:D,valid:A,value:M}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:D,value:M,valid:A})}async _updateInputs(){this._stopExpressions();const {_featureClone:D,_initialFeature:A,arcadeEditType:M,formTemplate:C,inputs:e,layer:n,timeZone:G}=this;if(n){var L={arcadeEditType:M,feature:D,initialFeature:A,layer:n,timeZone:G},S=e.slice();this.inputs=C?.elements&&0!S.updating);this._assignExpressionExecutors(S,L,n);if(G)if(A.delete(L),x.isGroupInput(S)){const {feature:T, timeZone:ea}=C;S.set({feature:T,timeZone:ea})}else x.isRelationshipInput(S)?(G=this.relationshipId===L.relationshipId,S.set(C),S.set({map:this.map,showAllEnabled:G})):S.set(C);h.isGroupElement(L)&&(G=L.elements.filter(T=>t(T)),S.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:A,updatedElements:G,sharedInitializationProperties:C,group:S,newExpressionExecutorPromises:n}))}}return D}_updateInputsUsingLayerFields(D,A,M){if(!Array.isArray(A))return k.getLogger("esri.widgets.FeatureForm.FeatureFormViewModel").warn(this.declaredClass, "No attribute fields found."),[];const C=new Map;for(var e of D)if(x.isGroupInput(e)){for(const n of e.inputs)n.destroy();e.inputs.length=0;e.destroy()}else x.isRelationshipInput(e)?e.destroy():x.isFieldInput(e)&&(null!==e.element?e.destroy():C.set(e.field,e));D=[];for(const n of A)A=M.feature?.getAttribute(n.name)??null,e=C.get(n)??new N({field:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden}),D.push(e.set({...M,value:A})),C.delete(n);for(const [n,G]of C.entries())C.delete(n), G.destroy();return D}_resetFieldInputValues(D){for(const A of this.allFieldInputs)A.value=D.getAttribute(A.name)}_makeInputFromElement(D,A,M){if(h.isGroupElement(D)){const {feature:C,layer:e}=A;return new d({element:D,inputs:[],feature:C,layer:e})}return h.isFieldElement(D)?this._makeFieldInputFromElement(D,A,M):h.isRelationshipElement(D)?this._makeRelationshipInputFromElement(D,A,M):h.isTextElement(D)?H(D,A):c.neverReached()}_makeFieldInputFromElement(D,A,M){const {arcadeEditType:C,feature:e,initialFeature:n, layer:G,timeZone:L}=A;({fieldName:A}=D);return(A=A&&this._layerFieldsByName.get(A))?new N({arcadeEditType:C,element:D,field:A,value:e?.getAttribute(D.fieldName)??null,feature:e,initialFeature:n,layer:G,group:M,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:L}):null}_makeRelationshipInputFromElement(D,A,M=null){const {map:C}=this,{feature:e,layer:n,timeZone:G}=A,L=new v({element:D,feature:e,group:M,layer:n,map:C,timeZone:G});L.addHandles(E.on(()=>L.relatedLayer, "edits",()=>this._expressionsManager?.evaluateAsyncExpressions()));return L}_assignExpressionExecutors(D,A,M){var C=K[A.type];const e=[];for(const n of C){const G=`${n}Executor`;D[G]?this._useExecutor(D[G]):(C=A[n],null!=C&&""!==C&&(C=this._expressionInfosLookup.get(C)?.expression??C,e.push(this._getOrCreateExecutorForExpression(C,M).then(L=>{D[G]=this._useExecutor(L)}))))}x.isTextElementInput(D)&&e.push(...this._assignTextElementExpressionExecutors(D,M));return e}_assignTextElementExpressionExecutors(D, A){const {_expressionInfosLookup:M}=this,C=[];for(const e of D.expressionsUsed){const n=M.get(e);null==n?k.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${e}'`):C.push(this._getOrCreateExecutorForExpression(n.expression,A).then(G=>D.setExpressionExecutor(e,this._useExecutor(G))))}for(const e of D.fieldsUsed)C.push(this._getOrCreateExecutorForExpression(`return $feature['${e}'];`,A).then(n=>D.setFieldExecutor(e,this._useExecutor(n))));return C}async _getOrCreateExecutorForExpression(D, A){const {_expressionExecutorLookup:M}=this;if(M.has(D))return M.get(D);if(A.has(D))return A.get(D);const C=J.createFormExpressionArcadeExecutor(D,this.layer);A.set(D,C);A=await C;M.set(D,A);return A}_createExpressionsManager(D){const {_arcadeContextInfo:A,_featureClone:M,allFieldInputs:C,formTemplate:e}=this;this._expressionsManager=new I.FormExpressionsManager({executors:D,feature:M,arcadeContextInfo:A,fieldInputs:C,preserveFieldValuesWhenHidden:!0===e?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0!== this._expressionExecutorsInUse.size){var D=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(D);await this._expressionsManager.evaluateAll().finally(()=>this._afterExpressionsEvaluated())}}_stopExpressions(){this._expressionsManager=w.destroyMaybe(this._expressionsManager);this._expressionExecutorsInUse.clear()}_useExecutor(D){this._expressionExecutorsInUse.add(D);return D}_afterValueChange(D){const {name:A,value:M}=D,{_featureClone:C,formTemplate:e,layer:n}=this;if(n){var G= C.getAttribute(A);C.setAttribute(A,M);var {typeFieldName:L,types:S}=x.getNormalizedFeatureTypeInfo(n);if((D.isSubtypeField||A===L)&&M!==G){"subtype-sublayer"===n.type&&(G=n.parent?.findSublayerForFeature(C),C.sourceLayer=this.feature.sourceLayer=G);G=new Set;for(var T of S)if(T.domains&&"object"===typeof T.domains)for(const ea of Object.keys(T.domains))G.add(ea);for(const ea of G)(T=this.findField(ea))&&T.notifyChange("domain");this.notifyChange("joinedContingentValues")}if(null!=e){const {description:ea, title:V}=e;V&&F.templateHasKey(V,A)&&this.notifyChange("formTitle");ea&&F.templateHasKey(ea,A)&&this.notifyChange("formDescription")}this._emitChangeEvent(D)}}_afterExpressionsEvaluated(){const {_featureClone:D}=this;for(const A of this.allFieldInputs)A.value!==D.getAttribute(A.name)&&this._afterValueChange(A)}_joinContingentValues(){var D=this._contingentValuesCache;if(null==D)return[];var {typeFieldName:A}=x.getNormalizedFeatureTypeInfo(this.layer);A=A?this.getValue(A):null;const M=[];for(var C of D.fieldGroups){const {contingencies:L, fields:S,name:T}=C;D=[];for(var e of L)e.isRetired||(null==e.subtype||e.subtype.code===A)&&D.push({values:e.values});0this._joinFieldGroupContingencies(L));e=G.flatMap(L=>L.contingencies);return[...C,...e]}_generateJoinPlan(D){var A=new Map,M=[],C=new Set;for(var e of D)for(const S of e.fields)if(A.has(S)){const T=A.get(S),ea=e,V=[T.name,ea.name].sort().join("|");C.has(V)||(M.push([T,ea]),C.add(V), A.set(S,ea))}else A.set(S,e);A=new Set(M.flat());D=new Set(D);for(var n of A)D.delete(n);n=new Map;A=new Map;for(var G of new Set(M.flat()))C=Symbol(G.name),n.set(C,new Set([G])),A.set(G,C);for(const [S,T]of M)if(M=A.get(S),G=A.get(T),M!==G){C=n.get(M);e=n.get(G);for(var L of e)C.add(L),A.set(L,M);n.delete(G)}L=[...n.values()].map(S=>[...S]);M=[...D];return[L,M]}_joinFieldGroupContingencies(D){const A=D.slice();var M=A.shift(),C=A.shift();D=this._generateJoinKey(M.fields,C.fields);let e=new Set([...M.fields, ...C.fields]),n=new Map;for(var G of M.contingencies)[M]=this._hashContingency(G,D.codedValueFields,!0),n.has(M)?n.get(M)?.push(G):n.set(M,[G]);for(;0e)return null;C.values[n]=new u({objectType:"range",minValue:M,maxValue:e})}}return C}_findMatchingContingenciesContainingAny(D,A,M){return A.filter(C=>M.every(e=>{const n=C.values[e];e=D.values[e];return"any"===n.objectType||"any"===e.objectType||n.codedValue?.code===e.codedValue?.code}))}_findMatchingContingenciesWithAnyHashMask(D,A){A=RegExp(`${A}$`);const M=[];for(const [C,e]of D){if("#JSAPI_CONTINGENT_VALUE_ANY_HASH"===C)break;A.test(C)&&M.push(...e)}return M}_generateJoinKey(D, A){D=Array.isArray(D)?new Set(D):D;var M=Array.isArray(A)?new Set(A):A;A=D.size!A.values.hasOwnProperty(C)||x.valueIsValidContingentValue(e,A.values[C]))}_getContingentValueOptionsForField(D,A){var M=this.joinedContingentValues.slice();const C=new Map;A={code:"",name:A??"No value"};for(const e of M)if(M=e.values[D],"code"===M?.objectType||"null"===M?.objectType){const {code:n,name:G}=M.codedValue&&"null"!==M.objectType?M.codedValue:A;!C.has(n)&&this._contingencyIsValid(D,e)&&C.set(n,{name:G,value:n})}return[...C.values()]}_hashContingency(D,A,M=!1){if(1>A.length)return["#JSAPI_CONTINGENT_VALUE_EMPTY_HASH", !1];const C=[];let e=!1;for(const n of A)if(A=D.values[n],"any"===A.objectType){if(M)return["#JSAPI_CONTINGENT_VALUE_ANY_HASH",!0];e=!0;C.push(`${n}:.*`)}else"null"===A.objectType?C.push(`${n}:${"#JSAPI_CONTINGENT_VALUE_NULL_HASH"}`):C.push(`${n}:${A.codedValue?.code}`);return[C.sort().join("\x26"),e]}_compareObjectTypes(D,A){return{leftIsNull:"null"===D,rightIsNull:"null"===A,bothAreNull:"null"===D&&"null"===A,leftIsAny:"any"===D,rightIsAny:"any"===A,bothAreAny:"any"===D&&"any"===A,leftIsRange:"range"=== D,rightIsRange:"range"===A}}};a.__decorate([p.property()],b.prototype,"_expressionInfosLookup",null);a.__decorate([p.property()],b.prototype,"_featureClone",void 0);a.__decorate([p.property()],b.prototype,"_timeZone",void 0);a.__decorate([p.property()],b.prototype,"activeRelationshipInput",null);a.__decorate([p.property()],b.prototype,"_arcadeContextInfo",null);a.__decorate([p.property()],b.prototype,"allFieldInputs",null);a.__decorate([p.property()],b.prototype,"allGroupInputs",null);a.__decorate([p.property()], b.prototype,"allRelationshipInputs",null);a.__decorate([p.property()],b.prototype,"_layerFieldsByName",null);a.__decorate([p.property()],b.prototype,"arcadeEditType",void 0);a.__decorate([p.property()],b.prototype,"contingencyConstraintViolations",void 0);a.__decorate([p.property()],b.prototype,"disabled",void 0);a.__decorate([p.property()],b.prototype,"feature",null);a.__decorate([p.property()],b.prototype,"fieldsWithContingentValues",null);a.__decorate([p.property({type:q})],b.prototype,"formTemplate", null);a.__decorate([p.property()],b.prototype,"formDescription",null);a.__decorate([p.property()],b.prototype,"formTitle",null);a.__decorate([p.property()],b.prototype,"formHeaderVisible",null);a.__decorate([p.property()],b.prototype,"highlightHelper",void 0);a.__decorate([p.property()],b.prototype,"inputs",void 0);a.__decorate([p.property()],b.prototype,"joinedContingentValues",null);a.__decorate([p.property()],b.prototype,"layer",null);a.__decorate([p.property()],b.prototype,"map",void 0);a.__decorate([p.property()], b.prototype,"relatedRecordCallbacks",void 0);a.__decorate([p.property()],b.prototype,"relationshipId",null);a.__decorate([p.property()],b.prototype,"spatialReference",null);a.__decorate([p.property()],b.prototype,"state",null);a.__decorate([p.property()],b.prototype,"strict",void 0);a.__decorate([p.property()],b.prototype,"submittable",null);a.__decorate([p.property()],b.prototype,"timeZone",null);a.__decorate([p.property()],b.prototype,"updating",null);a.__decorate([p.property()],b.prototype,"valid", null);a.__decorate([p.property()],b.prototype,"hasPendingSubtypeChoice",void 0);a.__decorate([p.property()],b.prototype,"getValues",null);a.__decorate([p.property()],b.prototype,"submit",null);return b=a.__decorate([l.subclass("esri.widgets.FeatureForm.FeatureFormViewModel")],b)})},"esri/layers/support/ContingentValue":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.codedValue=this.minValue=this.maxValue=null}};a.__decorate([c.property()],b.prototype,"objectType",void 0);a.__decorate([c.property()],b.prototype,"maxValue",void 0);a.__decorate([c.property()],b.prototype,"minValue",void 0);a.__decorate([c.property()],b.prototype,"codedValue",void 0);return b=a.__decorate([g.subclass("esri.layers.support.ContingentValue")],b)})},"esri/layers/support/LayerContingentValuesCache":function(){define("../../chunks/tslib.es6 ../../request ../../core/arrayUtils ../../core/JSONSupport ../../core/Loadable ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/accessorSupport/decorators/subclass ./arcgisLayerUrl ./Contingency ./ContingencyConstraintViolation ./ContingentValue ./ContingentValuesResult ./FieldGroup ./fieldUtils ./Subtype ../../widgets/FeatureForm/featureFormUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z){function B(K){switch(K.objectType){case "any":return"@any@";case "null":return"@null@";case "code":return K.codedValue.name+K.codedValue.code.toString();case "range":return K.minValue.toString()+"-"+K.maxValue.toString()}}function x(K){K.sort((C,e)=>"null"===C.objectType?-1:"null"===e.objectType?1:C.minValue-e.minValue);let D,A;const M=[];for(const C of K)"null"===C.objectType?M.push(C):null==D||null==A?(D=C.minValue,A=C.maxValue):A{if(M.objectType===C.objectType)switch(M.objectType){case "any":case "null":return!0;case "code":return M.codedValue.code===C.codedValue.code&&M.codedValue.name===C.codedValue.name}return!1})&&A.push(M);return A}function J(K,D){if(0===K.length||0===D.length)return[];if("any"===K[0].objectType)return D; if("any"===D[0].objectType)return K;var A="range"===D[0].objectType||"range"===D[1]?.objectType;if("range"===K[0].objectType||"range"===K[1]?.objectType||A){A=[];let M=0;for(const C of K)for(;Me.maxValue))if(C.minValue===e.maxValue)A.push(new r({objectType:"range",minValue:C.minValue,maxValue:e.maxValue}));else{K=C.minValue>e.minValue?C.minValue:e.minValue;if(C.maxValueM.data.fieldGroups?? [])}async function d(K,D,A){return b(`${K}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([D]),f:"json"},...A}).then(M=>M.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function v(K,D){return b(K,{responseType:"json",query:{f:"json"},...D}).then(A=>A.data)}async function O(K,D,A){return b(`${K}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([D]),f:"json"},...A}).then(M=>M.data.contingentValueSets?.[0])}async function t(K,D,A){return b(`${K}/${D}/contingentValues`, {responseType:"json",query:{f:"json"},...A}).then(M=>M.data)}function H(K,D){return(K=K.domains)?([,K]=Object.entries(K).find(([A])=>A.trim().toLowerCase()===D.trim().toLowerCase())||[],K||null):null}var P;m=P=class extends m.JSONSupportMixin(k){constructor(K){super(K);this.request=b;this.fieldGroupDefinitions=this.fieldGroups=null}initialize(){}get subtypeFieldName(){return z.getNormalizedFeatureTypeInfo(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(K){await K.load(); if(void 0===K.layerId)return null;var D=K.sourceJSON.hasContingentValuesDefinition;if(D)return(new P({layer:K})).load();if(void 0===D){D=p.parse(K.url);if(null==D)return null;D=D.url.path;if((await v(D)).supportsQueryDataElements&&(D=await d(D,K.layerId.toString())))return D=D.map(A=>({name:A.name,isEditingRestrictive:A.isEditingRestrictive,fields:A.fieldNames.names.map(M=>K.fieldsIndex.normalizeFieldName(M))})),(new P({layer:K,fieldGroupDefinitions:D})).load()}return null}async load(K){const D=this.layer.load(K).then(()=> this._initializeContingentValues(this.fieldGroupDefinitions,K));this.addResolvingPromise(D);return this}validateContingencyConstraints(K,D){const A=Object.keys(K),M=[],C=[];for(const n of this.fieldGroups){const G=n.isEditingRestrictive?"error":"warning";if(D&&!n.fields.some(T=>D.includes(T)))continue;if(!n.fields.every(T=>A.includes(T))){C.push(new l({fieldGroup:n,type:G}));continue}let L=!1;const S=K[this.subtypeFieldName];var e=n.contingencies.filter(T=>!T.isRetired&&T.subtype?T.subtype.code=== S:!0);if(0!==e.length){for(const T of e){e=!0;for(const ea in T.values){const V=T.values[ea];if("any"!==V.objectType)if("null"===V.objectType){if(null!=K[ea]){e=!1;break}}else if("code"===V.objectType){if(K[ea]!==V.codedValue.code){e=!1;break}}else if("range"===V.objectType){const ca=K[ea];if(caV.maxValue){e=!1;break}}}if(e){L=!0;break}}L||M.push(new l({fieldGroup:n,type:G}))}}return{invalid:M,incomplete:C}}getContingentValues(K,D,A=!1){const M=K[this.subtypeFieldName],C=void 0!== M&&null!==M,e={};let n=[];const G=this.fieldGroups.filter(S=>S.fields.includes(D));n.push(new r({objectType:"any"}));for(const S of G){let T=[];var L=S.contingencies.filter(ca=>!ca.isRetired&&(ca.subtype&&C?ca.subtype.code===M:!0));let ea=!1;const V={};for(const ca of L){let ja;L=!0;for(const W in ca.values){const Z=ca.values[W];if(D===W)ja=Z,ea=ea||"range"===Z.objectType;else if(void 0!==K[W]&&"any"!==Z.objectType)if("null"===Z.objectType)null!==K[W]&&(L=!1);else if("code"===Z.objectType)K[W]!== Z.codedValue.code&&(L=!1);else if("range"===Z.objectType){const ha=K[W];if(haZ.maxValue)L=!1}}if(ja&&L){if("any"===ja.objectType){T.length=0;T.push(ja);break}L=B(ja);V[L]||T.push(ja);V[L]=!0}}ea&&(T=x(T));e[S.name]=T;n=A?J(n,T):[]}1===G.length&&A&&(n=[]);return new q({contingentValuesAllGroups:n,contingentValuesByFieldGroup:e})}async _initializeContingentValues(K,D){K=K??await this._fetchFieldGroupDefs(D);this.fieldGroups=0===K.length?[]:await this._fetchContingentValues(K,D)}async _fetchFieldGroupDefs(K){if(void 0=== this.layer.layerId)return[];const D=this.layer.sourceJSON,A=this.layer.layerId.toString(),M=p.parse(this.layer.url).url.path;return D.hasContingentValuesDefinition?(await I(M,A,K)).map(C=>({name:C.name,isEditingRestrictive:C.restrictive,fields:C.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))})):void 0!==D.hasContingentValuesDefinition?[]:v(M,K).then(async C=>C.supportsQueryDataElements?(await d(M,A,K)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(n=> this.layer.fieldsIndex.normalizeFieldName(n))})):[])}async _fetchContingentValues(K,D){if(void 0===this.layer.layerId)return[];const A=this.layer.sourceJSON,M=this.layer.layerId.toString(),C=p.parse(this.layer.url).url.path;if(A.hasContingentValuesDefinition)return D=await t(C,M,D),this._constructFieldGroupsAGOL(K,D);D=await O(C,M,D);return this._constructFieldGroupsEnterprise(K,D)}_constructFieldGroupsAGOL(K,D){return K.map(A=>{const M=D.contingentValuesDefinition.fieldGroups.find(C=>C.name===A.name); if(M){let C=[];C=D.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(A,D,M.subTypes):this._parseAGOLFieldGroup(A,D,M.contingentValues);return new h({name:A.name,isEditingRestrictive:A.isEditingRestrictive,fields:A.fields,contingencies:C})}return null}).filter(c.isSome)}_parseAGOLFieldGroupSubtype(K,D,A){let M=[];A?.forEach(C=>{const e=this._getSubtypeAGOL(C.name);M=M.concat(this._parseAGOLFieldGroup(K,D,C.contingentValues,e))});return M}_parseAGOLFieldGroup(K,D,A,M=null){const C= [];for(const e of A??[])A=this._parseAGOLContingency(e,K,D,M),C.push(A);return C}_parseAGOLContingency(K,D,A,M){const C=K.id,e=K.retired?1===K.retired:!1,n={};for(let L=0,S=0;Lca.domain===V?.name))&&(ea=G.entries[ea]);G=V?.codedValues.find(ca=>ca.code===ea);G=new r({codedValue:G,objectType:"code"}); n[T]=G}else"Range"===G?(G=K.values[S],S++,G=new r({minValue:G.range[0],maxValue:G.range[1],objectType:"range"}),n[T]=G):"Any"===G?(G=new r({objectType:"any"}),n[T]=G):(G=new r({objectType:"null"}),n[T]=G)}return new y({id:C,isRetired:e,subtype:M,values:n})}_constructFieldGroupsEnterprise(K,D){const A=D.fieldGroups;return K.map(M=>{var C=A.find(e=>e.name===M.name);return C?(C=C.contingencies.map(e=>{const n=e.id,G=e.isRetired||!1,L=this._getSubtypeEnterprise(e.subtypeCode),S={};for(let ea=0;eaW.code===ca);T=new r({codedValue:T,objectType:"code"});S[V]=T}else"object"===typeof ca?(T=new r({minValue:ca.minValue,maxValue:ca.maxValue,objectType:"range"}),S[V]=T):ca?(T=new r({objectType:"any"}),S[V]=T):(T=new r({objectType:"null"}), S[V]=T)}return new y({id:n,isRetired:G,subtype:L,values:S})}),new h({name:M.name,isEditingRestrictive:M.isEditingRestrictive,fields:M.fields,contingencies:C})):null}).filter(c.isSome)}_getSubtypeEnterprise(K){var D=this.layer.sourceJSON;let A;D.subtypes&&(D=D.subtypes.find(M=>M.code===K),A=f.fromJSON(D));return A||null}_getSubtypeAGOL(K){var D=this.layer.sourceJSON;let A;D.subtypes&&(D=D.subtypes.find(M=>M.name===K),A=f.fromJSON(D));return A||null}_getDomain(K,D){K=K?H(K,D):this.layer.getFieldDomain(D); return"inherited"===K?.type?this.layer.getFieldDomain(D):K}};a.__decorate([w.property({constructOnly:!0})],m.prototype,"layer",void 0);a.__decorate([w.property({constructOnly:!0})],m.prototype,"request",void 0);a.__decorate([w.property({type:[h]})],m.prototype,"fieldGroups",void 0);a.__decorate([w.property({constructOnly:!0})],m.prototype,"fieldGroupDefinitions",void 0);a.__decorate([w.property()],m.prototype,"subtypeFieldName",null);return m=P=a.__decorate([F.subclass("esri.layers.support.LayerContingentValuesCache")], m)})},"esri/layers/support/Contingency":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.isRetired=!1}};a.__decorate([c.property()],b.prototype,"id",void 0);a.__decorate([c.property()],b.prototype,"isRetired",void 0);a.__decorate([c.property()],b.prototype, "subtype",void 0);a.__decorate([c.property()],b.prototype,"values",void 0);return b=a.__decorate([g.subclass("esri.layers.support.Contingency")],b)})},"esri/layers/support/ContingencyConstraintViolation":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E)}};a.__decorate([c.property()], b.prototype,"fieldGroup",void 0);a.__decorate([c.property()],b.prototype,"type",void 0);return b=a.__decorate([g.subclass("esri.layers.support.ContingencyConstraintViolation")],b)})},"esri/layers/support/ContingentValuesResult":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E)}}; a.__decorate([c.property()],b.prototype,"contingentValuesAllGroups",void 0);a.__decorate([c.property()],b.prototype,"contingentValuesByFieldGroup",void 0);return b=a.__decorate([g.subclass("esri.layers.support.ContingentValuesResult")],b)})},"esri/layers/support/FieldGroup":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),function(a, b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.fields=null;this.isEditingRestrictive=!1}};a.__decorate([c.property()],b.prototype,"name",void 0);a.__decorate([c.property()],b.prototype,"fields",void 0);a.__decorate([c.property()],b.prototype,"isEditingRestrictive",void 0);a.__decorate([c.property()],b.prototype,"contingencies",void 0);return b=a.__decorate([g.subclass("esri.layers.support.FieldGroup")],b)})},"esri/widgets/FeatureForm/FieldInput":function(){define("../../chunks/tslib.es6 ../../core/Error ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../layers/support/CodedValue ../../layers/support/CodedValueDomain ../../layers/support/Domain ../../layers/support/InheritedDomain ../../layers/support/RangeDomain ../../layers/support/domainUtils ../../layers/support/fieldUtils ../../smartMapping/support/utils ../Feature/support/featureUtils ./EditableInput ./featureFormUtils ../support/dataUtils ../support/dateUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N){var J;(function(I){I.Text="text";I.Number="number";I.Date="date";I.Unsupported="unsupported"})(J||={});k=class extends z{constructor(I){super(I);this.error=this._storedValue=null;this.preservesValueWhenHidden=!0;this.requiredExpressionExecutor=this.group=this.field=null;this.type="field";this._fieldInputWasVisibleDuringLifetime=!1;this.valueExpressionExecutor=null}initialize(){this.addHandles(c.watch(()=>this.feature,()=>this._fieldInputWasVisibleDuringLifetime= !1,c.sync))}get _dateFormRange(){const {element:I,field:d}=this;if("date"!==this.dataType)return{};const v=I?.domain?q.getDomainRange(d,I.domain):null;if(!I?.input)return v??{};var O=I.input,{type:t}=O;let H={};if("date-picker"===t||"time-picker"===t||"datetimeoffset-picker"===t)H=q.dateTimeFieldValuesToNumericRange(d,O.max,O.min);if("datetime-picker"===t){const {max:D,min:A}=O;H={max:null!=D&&D&&!Number.isNaN(D.valueOf())?D.getTime():null,min:null!=A&&A&&!Number.isNaN(A.valueOf())?A.getTime():null}}const {max:P, min:K}=H;if(v){const {max:D,min:A}=v;O=x.isNumber(D)&&(null==P||null!=P&&DK);return{max:O?D:P??null,min:t?A:K??null,rawMax:O?v.rawMax:H?.rawMax??null,rawMin:t?v.rawMin:H?.rawMin??null}}return{min:K,max:P,rawMax:H?.rawMax??null,rawMin:H?.rawMin??null}}get _dateRange(){const {_dateFormRange:I,field:d}=this;if("date"!==this.dataType)return{};var v=q.getDomainRange(d);if(!v)return I;const {max:O,min:t,rawMax:H,rawMin:P}=I;if("date"===d.type){const {max:K,min:D}= v;return{max:x.isNumber(O)&&(null===K||null!=K&&OD)?t:D??null}}if("date-only"===d.type||"time-only"===d.type||"timestamp-offset"===d.type){const {max:K,min:D,rawMax:A,rawMin:M}=v;v=x.isNumber(O)&&H&&(null==K||OD);return{max:v?O:K,min:C?t:D,rawMax:v?H:A,rawMin:v?P:M}}return{max:null,min:null}}get _configAllowsEdits(){const {element:I,layer:d,name:v}=this;return null!=I?I.editableExpression?!!this.evaluatedEditableExpression: !1!==I.editable:d?.userHasUpdateItemPrivileges?!0:(d&&"popupTemplate"in d?d?.popupTemplate?.fieldInfos?.find(({fieldName:O})=>O===v):null)?.isEditable??!0}get _layerAndFieldAllowEdits(){return this.layerAllowsEdits&&this.field?.editable}get _isVisibleByDefault(){const {field:I,layer:d}=this;return!!I?.visible&&h.isFieldVisibleByDefault(I,d)}get _isEditTrackingField(){return h.getLowerCaseEditTrackingFields(this.layer).includes(this.name?.toLowerCase())}get _shouldUseValueExpression(){return this._layerAndFieldAllowEdits&& !this._configAllowsEdits&&null!=this.valueExpressionExecutor}get isSubtypeField(){const {layer:I}=this;if(I&&"subtypeField"in I){const {subtypeField:d,fieldsIndex:v}=I;return(v.get(d)?.name??d)===this.name}return!1}get valueIsOutOfDomain(){const {domain:I,value:d,field:v}=this;return I&&null!=d?null!==q.validateDomainValue(v,d,I):!1}get dataType(){const {field:I}=this;return h.isNumericField(I)?J.Number:h.isStringField(I)?J.Text:u.isAnyDateField(I)||h.isTimeOnlyField(I)?J.Date:J.Unsupported}get dateDataType(){if(this.dataType=== J.Date)return"date"!==this.field.type?"string":"number"}get description(){const {element:I,feature:d,layer:v,timeZone:O}=this,t=I?.description;return null!=v&&null!=t?B.parseFormTemplateString({label:t,attributes:d.attributes,fieldsIndex:v.fieldsIndex,timeZone:O}):t}get domain(){var {layer:I}=this;const {typeFieldName:d,types:v}=B.getNormalizedFeatureTypeInfo(I);if(this.isSubtypeField&&"subtypes"in I&&I.subtypes)return new p({name:"__internal-type-based-coded-value-domain__",codedValues:I.subtypes.map(({code:t, name:H})=>new F.CodedValue({code:t,name:H}))});if(d===this.name&&null==this.field.domain)return new p({name:"__internal-type-based-coded-value-domain__",codedValues:v.map(({code:t,name:H})=>new F.CodedValue({code:t,name:H}))});var {feature:O}=this;I=I?.getFieldDomain(this.name,{feature:O});O=this.element?.domain;return null!=O&&this._isDomainCompatible(O)?O:I}get editable(){return this._layerAndFieldAllowEdits?this.evaluatedEditableExpression??this._configAllowsEdits:!1}get evaluatedRequiredExpression(){const {requiredExpressionExecutor:I}= this;return null!=I?!!I.lastEvaluatedValue:null}get evaluatedValueExpression(){const {valueExpressionExecutor:I}=this;return null!=I?I.lastEvaluatedValue:null}get hint(){return this.element?.hint}get includeDate(){return!(this.dataType!==J.Date||"time-only"===this.field.type)}get includeTime(){const {element:I,field:d}=this;if(this.dataType!==J.Date)return!1;if("time-only"===d.type)return!0;if("date-only"===d.type)return!1;const v="datetime-picker"===I?.input?.type?I.input.includeTime:void 0;return void 0=== v||v}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const I=this.element?.input;return I?"datetimeoffset-picker"===I.type&&I.includeTimeOffset:!0}set initialFeature(I){this._set("initialFeature",I);this.notifyChange("valid")}get inputType(){return this.element?.input?.type}get hasInvalidSwitchValue(){var {element:I}=this;I=B.isFieldElementWithInputType(I,"switch")?I.input:null;return!I||B.valueIsInvalidSwitchValue(this.value,I)}get isRelationshipKeyField(){const {field:I, layer:d}=this;return f.isRelatableFeatureSupportedLayer(d)&&!!d.relationships?.some(v=>v.keyField===I.name)}get label(){const {element:I,feature:d,field:v,layer:O,timeZone:t}=this;return null!=O&&null!=I?.label?B.parseFormTemplateString({label:I.label,attributes:d.attributes,fieldsIndex:O.fieldsIndex,timeZone:t}):I?.label||v.alias||v.name}get maxLength(){if(this.dataType===J.Date)return-1;const {field:I,element:d}=this,v=I?.length??-1,O=B.isFieldElementWithTextInput(d)?d.input.maxLength:NaN;return null!= O&&!isNaN(O)&&-1<=O&&(-1===v||O<=v)?O:v}get minLength(){if(this.dataType===J.Date)return-1;const {field:I,element:d}=this,v=I?.length??-1,O=B.isFieldElementWithTextInput(d)?d.input.minLength:NaN;return null!=O&&!isNaN(O)&&-1<=O&&(-1===v||O<=v)?O:-1}get name(){return this.field?.name}get range(){const {domain:I,element:d,field:v}=this;if("date"===this.dataType)return this._dateRange;var O=q.getDomainRange(v,I)||h.getFieldRange(v,I);const t=O?.max===Number.MAX_VALUE?null:O?.max??null;O=O?.min===-Number.MAX_VALUE? null:O?.min??null;if(!d?.domain||"range"!==d.domain.type)return{max:t,min:O};const {max:H,min:P}=q.getDomainRange(v)||{};return{max:null!=H&&(null===t||null!=t&&HO)?P:O}}get required(){const {editable:I,evaluatedRequiredExpression:d,field:v,visible:O,isSubtypeField:t}=this;return I?!1===v?.nullable||t?!0:O&&!1!==this.group?.visible&&null!=d?d:!1:!1}set required(I){this._overrideIfSome("required",I)}get showNoValueOptionEnabled(){const {element:I}=this;return this.required? !1:B.isFieldElementWithShowNoValueOptionInput(I)?I.input.showNoValueOption:!0}get showNoValueLabel(){const {element:I}=this;return B.isFieldElementWithShowNoValueOptionInput(I)?I.input.noValueOptionLabel:null}get submittable(){const {field:I,required:d,valid:v,value:O}=this;return d&&null==O?!1:v?!0:this.initialFeature.getAttribute(I.name)===O}get timeResolution(){const I=this.element?.input;if(I&&("datetimeoffset-picker"===I.type||"time-picker"===I.type))return I.timeResolution??"minutes"}get timeStep(){return null!= this.timeResolution?N.timeResolutionToStepMap.get(this.timeResolution):void 0}get updating(){const {editableExpressionExecutor:I,valueExpressionExecutor:d,visibilityExpressionExecutor:v,preservesValueWhenHidden:O}=this;return null!=d&&d.updating||null!=I&&I.updating||!1===O&&null!=v&&v.updating}get valid(){const I=this.editable?this._validate():null;this._set("error",I);return null===I}get value(){this._fieldInputWasVisibleDuringLifetime=this._fieldInputWasVisibleDuringLifetime||this.visible&&!1!== this.group?.visible;if(!1===this.preservesValueWhenHidden&&this._fieldInputWasVisibleDuringLifetime&&(!1===this.visibilityExpressionExecutor?.lastEvaluatedValue||!1===this.group?.visibilityExpressionExecutor?.lastEvaluatedValue))return null!==this._storedValue&&this.set("_storedValue",null),null;if(this._shouldUseValueExpression){const I=this.evaluatedValueExpression;return this.dataType===J.Date?this._arcadeOutputToDateFieldValue(I):null!=I&&"object"===typeof I?I.toString():I}return this._storedValue}set value(I){this.notifyChange("evaluatedVisibilityExpression"); this.set("_storedValue",I)}get visible(){return this._isEditTrackingField?!1:null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element?!0:this._isVisibleByDefault}_arcadeOutputToDateFieldValue(I){const d=this.field.type;try{if("object"===typeof I){if(null!==I){if(N.isArcadeDate(I))return N.arcadeDateToFieldValue(I,d);if("getTime"in I&&"function"===typeof I.getTime&&"date"===d)return parseInt(I.getTime(),10);if("date-only"===d||"time-only"===d||"timestamp-offset"=== d)return I.toString()}}else{if("string"===typeof I)return"date"===d?parseInt(I,10):I;if("number"===typeof I&&"date"===d)return I}throw new b("feature-form:invalid-date-value");}catch{return"date"===d?NaN:""}}_isDomainCompatible(I){const {field:d}=this;if("coded-value"===I?.type){const v=typeof I.codedValues[0].code;if("string"===v&&h.isStringField(d)||"number"===v&&h.isNumericField(d))return!0}return"range"===I?.type&&h.isNumericField(d)||u.isAnyDateField(d)||h.isTimeOnlyField(d)?!0:!1}_validate(){const {dataType:I, domain:d,field:v,initialFeature:O,minLength:t,range:H,required:P,valid:K,value:D,maxLength:A}=this,M=P&&null==D,C=void 0!==K;if(!M&&O.getAttribute(v.name)===D&&C)return null;if(M)return h.TypeValidationError.INVALID_TYPE;if("text"===I&&"string"===typeof D){if(-1A)return B.LengthValidationError.TOO_LONG}return"date"!==I||null==D||N.dateTimeIsInRange({type:v.type,range:H,value:D})?d?null!==D||P?q.validateDomainValue(v,D):null: h.validateFieldValue(v,D):h.NumericRangeValidationError.OUT_OF_RANGE}};a.__decorate([m.property()],k.prototype,"_dateFormRange",null);a.__decorate([m.property()],k.prototype,"_dateRange",null);a.__decorate([m.property()],k.prototype,"_storedValue",void 0);a.__decorate([m.property()],k.prototype,"_configAllowsEdits",null);a.__decorate([m.property()],k.prototype,"_layerAndFieldAllowEdits",null);a.__decorate([m.property()],k.prototype,"_isVisibleByDefault",null);a.__decorate([m.property()],k.prototype, "_isEditTrackingField",null);a.__decorate([m.property()],k.prototype,"_shouldUseValueExpression",null);a.__decorate([m.property()],k.prototype,"isSubtypeField",null);a.__decorate([m.property()],k.prototype,"valueIsOutOfDomain",null);a.__decorate([m.property()],k.prototype,"dataType",null);a.__decorate([m.property()],k.prototype,"dateDataType",null);a.__decorate([m.property()],k.prototype,"description",null);a.__decorate([m.property()],k.prototype,"domain",null);a.__decorate([m.property()],k.prototype, "editable",null);a.__decorate([m.property({readOnly:!0})],k.prototype,"error",void 0);a.__decorate([m.property({constructOnly:!0})],k.prototype,"preservesValueWhenHidden",void 0);a.__decorate([m.property()],k.prototype,"evaluatedRequiredExpression",null);a.__decorate([m.property()],k.prototype,"evaluatedValueExpression",null);a.__decorate([m.property()],k.prototype,"field",void 0);a.__decorate([m.property()],k.prototype,"group",void 0);a.__decorate([m.property({readOnly:!0})],k.prototype,"hint",null); a.__decorate([m.property()],k.prototype,"includeDate",null);a.__decorate([m.property()],k.prototype,"includeTime",null);a.__decorate([m.property()],k.prototype,"includeTimeOffset",null);a.__decorate([m.property()],k.prototype,"initialFeature",null);a.__decorate([m.property({readOnly:!0})],k.prototype,"inputType",null);a.__decorate([m.property()],k.prototype,"hasInvalidSwitchValue",null);a.__decorate([m.property()],k.prototype,"isRelationshipKeyField",null);a.__decorate([m.property()],k.prototype, "label",null);a.__decorate([m.property()],k.prototype,"maxLength",null);a.__decorate([m.property()],k.prototype,"minLength",null);a.__decorate([m.property({readOnly:!0})],k.prototype,"name",null);a.__decorate([m.property()],k.prototype,"range",null);a.__decorate([m.property()],k.prototype,"required",null);a.__decorate([m.property()],k.prototype,"requiredExpressionExecutor",void 0);a.__decorate([m.property()],k.prototype,"showNoValueOptionEnabled",null);a.__decorate([m.property()],k.prototype,"submittable", null);a.__decorate([m.property()],k.prototype,"timeResolution",null);a.__decorate([m.property()],k.prototype,"timeStep",null);a.__decorate([m.property({readOnly:!0})],k.prototype,"type",void 0);a.__decorate([m.property()],k.prototype,"updating",null);a.__decorate([m.property()],k.prototype,"valid",null);a.__decorate([m.property({value:null})],k.prototype,"value",null);a.__decorate([m.property()],k.prototype,"valueExpressionExecutor",void 0);a.__decorate([m.property()],k.prototype,"visible",null); return k=a.__decorate([E.subclass("esri.widgets.FeatureForm.FieldInput")],k)})},"esri/widgets/FeatureForm/EditableInput":function(){define("../../chunks/tslib.es6 ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../layers/support/layerUtils ./featureFormUtils ./InputBase".split(" "),function(a,b,c,m,k,w,g,E,F){c=class extends F{constructor(p){super(p);this.arcadeEditType="NA";this.editableExpressionExecutor= null}get editable(){return this.layerAllowsEdits?this.evaluatedEditableExpression??!0:!1}get evaluatedEditableExpression(){const {editableExpressionExecutor:p}=this;return null!=p?!!p.lastEvaluatedValue:null}get layerAllowsEdits(){var {layer:p}=this;if(!p)return!1;var y=g.getEffectiveLayerCapabilities(p);p=y?.operations.supportsEditing;y=E.capabilitiesAllowEditType(y,this.arcadeEditType);return!(!p||!y)}};a.__decorate([b.property()],c.prototype,"arcadeEditType",void 0);a.__decorate([b.property()], c.prototype,"editable",null);a.__decorate([b.property()],c.prototype,"editableExpressionExecutor",void 0);a.__decorate([b.property()],c.prototype,"evaluatedEditableExpression",null);a.__decorate([b.property()],c.prototype,"layerAllowsEdits",null);return c=a.__decorate([w.subclass("esri.widgets.FeatureForm.EditableInput")],c)})},"esri/widgets/FeatureForm/InputBase":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.visibilityExpressionExecutor=this.type=this.timeZone=this.layer=this.feature=this.element=null}get description(){return this.element?.description}get evaluatedVisibilityExpression(){const {visibilityExpressionExecutor:E}=this;return null!=E?!!E.lastEvaluatedValue:null}get label(){return this.element?.label}get updating(){return!1}get visible(){return null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!= this.element}};a.__decorate([c.property({readOnly:!0})],b.prototype,"description",null);a.__decorate([c.property({constructOnly:!0})],b.prototype,"element",void 0);a.__decorate([c.property()],b.prototype,"evaluatedVisibilityExpression",null);a.__decorate([c.property()],b.prototype,"feature",void 0);a.__decorate([c.property()],b.prototype,"label",null);a.__decorate([c.property()],b.prototype,"layer",void 0);a.__decorate([c.property()],b.prototype,"timeZone",void 0);a.__decorate([c.property()],b.prototype, "type",void 0);a.__decorate([c.property()],b.prototype,"updating",null);a.__decorate([c.property()],b.prototype,"visible",null);a.__decorate([c.property()],b.prototype,"visibilityExpressionExecutor",void 0);return b=a.__decorate([g.subclass("esri.widgets.FeatureForm.InputBase")],b)})},"esri/widgets/FeatureForm/FormExpressionArcadeExecutor":function(){define("exports ../../chunks/tslib.es6 ../../arcade ../../core/Accessor ../../core/promiseUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../core/support/UpdatingHandles ../../layers/support/fieldUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l){g=Symbol("FormExpressionArcadeExecutor");a.FormExpressionArcadeExecutor=class extends m{constructor(q){super(q);this[r]=!0;this._lastEvaluatedValue=null;this._abortController=new AbortController;this._stale=!1;this._updatingTracking=new y.UpdatingHandles;this._executeAsyncDebounced=k.debounce(async(h,u,f)=>{h=await this.executor.executeAsync(h,{...u,abortSignal:f});if(f.aborted)return this._lastEvaluatedValue;this._lastEvaluatedValue=h;this._stale=!1;return h})}get isAsync(){return this.executor.isAsync}get fieldsUsed(){return this.executor.fieldsUsed}get syntaxTree(){return this.executor.syntaxTree}get updating(){return this._updatingTracking.updating}get stale(){return this._stale}get geometryUsed(){return this.executor.geometryUsed}get variablesUsed(){return this.executor.variablesUsed}get lastEvaluatedValue(){return this._lastEvaluatedValue}abort(){this._abortController.abort()}execute(q, h){this._abortController=new AbortController;return this._lastEvaluatedValue=q=this.executor.execute(q,{...h,abortSignal:this._abortController.signal})}async executeAsync(q,h){this._abortController=new AbortController;return this._updatingTracking.addPromise(this._executeAsyncDebounced(q,h??{},this._abortController.signal))}markStale(){this._stale=!0}reset(){this.abort();this._lastEvaluatedValue=null;this._stale=!1}};var r=g;b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"_lastEvaluatedValue", void 0);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"_stale",void 0);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"_updatingTracking",void 0);b.__decorate([w.property({constructOnly:!0})],a.FormExpressionArcadeExecutor.prototype,"executor",void 0);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"isAsync",null);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"fieldsUsed",null);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype, "syntaxTree",null);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"updating",null);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"stale",null);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"geometryUsed",null);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"variablesUsed",null);b.__decorate([w.property()],a.FormExpressionArcadeExecutor.prototype,"lastEvaluatedValue",null);a.FormExpressionArcadeExecutor=b.__decorate([p.subclass("esri.widgets.FeatureForm.FormExpressionArcadeExecutor")], a.FormExpressionArcadeExecutor);a.createFormExpressionArcadeExecutor=async(q,h)=>{const u=c.createArcadeProfile("form-calculation");q=await c.createArcadeExecutor(q,u,{});h?.fieldsIndex&&(q.fieldsUsed=l.fixFields(h.fieldsIndex,q.fieldsUsed));return new a.FormExpressionArcadeExecutor({executor:q})};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/arcade":function(){define("exports ./Graphic ./arcade/ArcadeDate ./arcade/ImmutableArray ./core/Error ./core/lang ./core/sql/DateOnly ./core/sql/TimeOnly ./layers/FeatureLayer ./portal/Portal ./rest/support/FeatureSet ./support/arcadeOnDemand".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l){function r(v,O,t,H={}){O=O.elementType;const P="array"===O.type?[{name:"value",type:O.type,elementType:O.elementType}]:"dictionary"===O.type?[{name:"value",type:O.type,properties:O.properties}]:[{name:"value",type:O.type}];return new m(v.map(K=>{const D={};f(D,P,{value:K},t,H);return D.value}))}function q(v,O,t={}){v=v instanceof y?new F({source:v.features,geometryType:v.geometryType,fields:v.fields,spatialReference:v.spatialReference}):v;return O.constructFeatureSet(v, t.spatialReference,null,!0,t.lruCache,t.interceptor)}function h(v,O,t={}){const {spatialReference:H,interceptor:P,lruCache:K}=t;return"string"===typeof v?O.createFeatureSetCollectionFromService(v,H,K,P):O.createFeatureSetCollectionFromMap(v,H,K,P)}function u(v,O,t,H={}){const P={};f(P,O.properties,v,t,H);return new N.Dictionary(P)}function f(v,O,t,H,P={}){const K={};for(const D of Object.keys(t))K[D.toLowerCase()]=t[D];for(const D of O)if(O=D.name.toLowerCase(),P.variablesPreProcessed)v[O]=K[O];else switch(D.type){case "array":t= K[O];v[O]=null==t?null:r(t,D,H,P);break;case "feature":t=K[O];v[O]=null==t?null:N.Feature.createFromGraphic(t,P?.timeZone);break;case "featureSet":t=K[O];v[O]=null==t?null:H?q(t,H,P):null;break;case "featureSetCollection":t=K[O];v[O]=null==t?null:H?h(t,H,P):null;break;case "dictionary":t=K[O];v[O]=null==t?null:u(t,D,H,P);break;case "date":t=K[O];v[O]=t?t instanceof c.ArcadeDate?t:P?.timeZone?c.ArcadeDate.dateJSAndZoneToArcadeDate(t,P?.timeZone):c.ArcadeDate.dateJSToArcadeDate(t):null;break;case "dateOnly":t= K[O];v[O]=t?t instanceof g.DateOnly?t:g.DateOnly.fromReader(t):null;break;case "time":t=K[O];v[O]=t?t instanceof E.TimeOnly?t:E.TimeOnly.fromReader(t):null;break;case "knowledgeGraph":case "geometry":case "boolean":case "text":case "number":v[O]=K[O]}}function z(v,O){for(const t of v)O.push(t),"dictionary"===t.type&&z(t.properties,O);return O}function B(v,O,t,H,P){const {spatialReference:K,interceptor:D,lruCache:A,console:M,abortSignal:C,timeZone:e,services:n={portal:p.getDefault()}}=t;P={vars:{}, spatialReference:K,interceptor:D,timeZone:e,lrucache:A,useAsync:P,services:n,console:M,abortSignal:C};if(!O)return P;f(P.vars,v.variables,O,H,t);return P}function x(v,O){switch(O.getArcadeType(v)){case "date":return v.toJSDate();case "time":return v.toString();case "dateOnly":return v.toString();case "feature":var t="geometry"in v?v.geometry():null;v="readAttributes"in v?v.readAttributes():v.attributes;return new b({geometry:t,attributes:v});case "dictionary":t=v.attributes;const H={};for(const P of Object.keys(t))H[P]= x(v.field(P),O);return H;case "array":return("toArray"in v?v.toArray():v).map(P=>x(P,O))}return v}let N=null;const J={variables:[{name:"$feature",type:"feature"},{name:"$layer",type:"featureSet"},{name:"$datastore",type:"featureSetCollection"},{name:"$map",type:"featureSetCollection"},{name:"$userInput",type:"geometry"},{name:"$graph",type:"knowledgeGraph"}]},I={variables:[{name:"$feature",type:"feature"},{name:"$aggregatedFeatures",type:"featureSet"}]},d=new Map([["aggregate-field",{variables:[{name:"$feature", type:"feature"}]}],["form-constraint",{variables:[{name:"$feature",type:"feature"}]}],["feature-z",{variables:[{name:"$feature",type:"feature"}]}],["field-calculation",{variables:[{name:"$feature",type:"feature"},{name:"$datastore",type:"featureSetCollection"}]}],["form-calculation",{variables:[{name:"$feature",type:"feature"},{name:"$originalFeature",type:"feature"},{name:"$layer",type:"featureSet"},{name:"$featureSet",type:"featureSet"},{name:"$datastore",type:"featureSetCollection"},{name:"$map", type:"featureSetCollection"},{name:"$editContext",type:"dictionary",properties:[{name:"editType",type:"text"}]}]}],["labeling",{variables:[{name:"$feature",type:"feature"}]}],["popup",J],["popup-element",J],["feature-reduction-popup",I],["feature-reduction-popup-element",I],["visualization",{variables:[{name:"$feature",type:"feature"},{name:"$view",type:"dictionary",properties:[{name:"scale",type:"number"}]}]}]]);a.createArcadeExecutor=async function(v,O,t={}){N||=await l.loadArcade();const {arcade:H, arcadeUtils:P}=N,{loadScriptDependencies:K,referencesMember:D,scriptIsAsync:A}=H;var M=z(O.variables,[]),C=M.filter(V=>"featureSet"===V.type||"featureSetCollection"===V.type).map(V=>V.name.toLowerCase());const e=H.parseScript(v,C);if(!e)throw new k("arcade:invalid-script","Unable to create SyntaxTree");v=P.extractFieldNames(e);const n=H.scriptTouchesGeometry(e);M=M.map(V=>V.name.toLowerCase()).filter(V=>D(e,V));const G=A(e,C);await K(e,G,C);C={vars:{},spatialReference:null,useAsync:G};for(const V of M)C.vars[V]= "any";const {lruCache:L}=t,S=H.compileScript(e,C),T=H.featureSetUtils(),{services:ea}=t;return{execute:(V,ca={})=>{if(G)throw new k("arcade:invalid-execution-mode","Cannot execute the script in synchronous mode");V=S(B(O,V,{lruCache:L,...ca},T,G));return ca.rawOutput?V:x(V,P)},executeAsync:async(V,ca={})=>{V=await S(B(O,V,{lruCache:L,services:ea,...ca},T,G));return ca.rawOutput?V:x(V,P)},isAsync:G,variablesUsed:M,fieldsUsed:v,geometryUsed:n,syntaxTree:e}};a.createArcadeProfile=function(v){var O=d.get(v); if(!O)throw O=Array.from(d.keys()).map(t=>`'${t}'`).join(", "),new k("createArcadeProfile:invalid-profile-name",`Invalid profile name '${v}'. You must specify one of the following values: ${O}`);return w.clone(O)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/ArcadeDate":function(){define(["exports","../core/string","../core/sql/UnknownTimeZone","../chunks/datetime"],function(a,b,c,m){function k(p,y,l){return pl?p-l:0}function w(p,y=!0){if(p instanceof m.Zone)return p; if("system"===p.toLowerCase())return"system";if("utc"===p.toLowerCase())return"UTC";if("unknown"===p.toLowerCase())return c.UnknownTimeZone.instance;if(/^[+-]?[0-9]{1,2}([:][0-9]{2})?$/.test(p)){const l=m.FixedOffsetZone.parseSpecifier("UTC"+(p.startsWith("+")||p.startsWith("-")?"":"+")+p);if(l)return l}p=m.IANAZone.create(p);if(!p.isValid){if(y)throw new E(a.ArcadeDateErrorCodes.TimeZoneNotRecognized);return null}return p}a.ArcadeDateErrorCodes=void 0;(a.ArcadeDateErrorCodes||(a.ArcadeDateErrorCodes= {})).TimeZoneNotRecognized="TimeZoneNotRecognized";const g={[a.ArcadeDateErrorCodes.TimeZoneNotRecognized]:"Timezone identifier has not been recognized."};class E extends Error{constructor(p,y){super(b.replace(g[p],y));this.declaredRootClass="esri.arcade.arcadedate.dateerror";Error.captureStackTrace&&Error.captureStackTrace(this,E)}}class F{constructor(p){this._date=p;this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(p=0,y=1,l=1,r=0,q=0,h=0,u=0,f){if(isNaN(p)||isNaN(y)||isNaN(l)||isNaN(r)|| isNaN(q)||isNaN(h)||isNaN(u))return null;const z=m.DateTime.local(p,y).daysInMonth;p=m.DateTime.fromObject({day:1>l?1:l>z?z:l,year:p,month:1>y?1:12r?0:23q?0:59h?0:59u?0:999this.hour&&0<=this.minute&&60>this.minute&&0<=this.second&&60>this.second&&0<=this.millisecond&&1E3>this.millisecond}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2, "0")}:${this.second.toString().padStart(2,"0")}`+(0g?null:new w(Math.floor(g/36E5%24),Math.floor(g/6E4%60),Math.floor(g/1E3%60),Math.floor(g%1E3))}static fromDateJS(g){return new w(g.getHours(),g.getMinutes(),g.getSeconds(),g.getMilliseconds())}static fromDateTime(g){return new w(g.hour,g.minute,g.second,g.millisecond)}static fromSqlTimeStampOffset(g){return this.fromDateTime(g.toDateTime())}static fromString(g,E=null){if(""===g||null===g)return null;const F=[];if(E)(E=k(E))&&F.push(E);else if(null=== E||""===E)F.push("HH:mm:ss"),F.push("HH:mm:ss.SSS"),F.push("hh:mm:ss a"),F.push("hh:mm:ss.SSS a"),F.push("HH:mm"),F.push("hh:mm a"),F.push("H:mm"),F.push("h:mm a"),F.push("H:mm:ss"),F.push("h:mm:ss a"),F.push("H:mm:ss.SSS"),F.push("h:mm:ss.SSS a");for(const p of F)if(E=m.DateTime.fromFormat(g,p),E.isValid)return new w(E.hour,E.minute,E.second,E.millisecond);return null}plus(g,E){switch(g){case "days":case "years":case "months":return this.clone();case "hours":case "minutes":case "seconds":case "milliseconds":return w.fromDateTime(this.toUTCDateTime().plus({[g]:E}))}return null}toUTCDateTime(){return m.DateTime.utc(1970, 1,1,this.hour,this.minute,this.second,this.millisecond)}difference(g,E){switch(E.toLowerCase()){case "days":case "day":case "d":return this.toUTCDateTime().diff(g.toUTCDateTime(),"days").days;case "months":case "month":return this.toUTCDateTime().diff(g.toUTCDateTime(),"months").months;case "minutes":case "minute":case "m":return"M"===E?this.toUTCDateTime().diff(g.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(g.toUTCDateTime(),"minutes").minutes;case "seconds":case "second":case "s":return this.toUTCDateTime().diff(g.toUTCDateTime(), "seconds").seconds;case "milliseconds":case "millisecond":case "ms":return this.toUTCDateTime().diff(g.toUTCDateTime(),"milliseconds").milliseconds;case "hours":case "hour":case "h":return this.toUTCDateTime().diff(g.toUTCDateTime(),"hours").hours;case "years":case "year":case "y":return this.toUTCDateTime().diff(g.toUTCDateTime(),"years").years;default:return this.toUTCDateTime().diff(g.toUTCDateTime(),"milliseconds").milliseconds}}}a.TimeOnly=w;a.standardizeTimeFormat=k;Object.defineProperty(a, Symbol.toStringTag,{value:"Module"})})},"esri/arcade/kernel":function(){define(["exports","../geometry/Extent"],function(a,b){a.cloneGeometry=function(c){if(null==c)return null;const m=c.clone();void 0!==c.cache._geVersion&&(m.cache._geVersion=c.cache._geVersion);return m};a.convertLinearUnitsToCode=function(c){if(null==c)return null;if("number"===typeof c)return c;c=c.toLowerCase();c=c.replaceAll(/\s/g,"");c=c.replaceAll("-","");switch(c){case "meters":case "meter":case "m":case "squaremeters":case "squaremeter":return 9001; case "miles":case "mile":case "squaremile":case "squaremiles":return 9093;case "kilometers":case "kilometer":case "squarekilometers":case "squarekilometer":case "km":return 9036;case "yard":case "yd":case "yards":case "squareyards":case "squareyard":return 9096;case "feet":case "ft":case "foot":case "squarefeet":case "squarefoot":return 9002;case "nmi":case "nauticalmile":case "nauticalmiles":case "squarenauticalmile":case "squarenauticalmiles":return 9030}return null};a.convertSquareUnitsToCode= function(c){if(null==c)return null;if("number"===typeof c)return c;c=c.toLowerCase();c=c.replaceAll(/\s/g,"");c=c.replaceAll("-","");switch(c){case "meters":case "meter":case "m":case "squaremeters":case "squaremeter":return 109404;case "miles":case "mile":case "squaremile":case "squaremiles":return 109439;case "kilometers":case "kilometer":case "squarekilometers":case "squarekilometer":case "km":return 109414;case "acres":case "acre":case "ac":return 109402;case "hectares":case "hectare":case "ha":return 109401; case "yard":case "yd":case "yards":case "squareyards":case "squareyard":return 109442;case "feet":case "ft":case "foot":case "squarefeet":case "squarefoot":return 109405;case "nmi":case "nauticalmile":case "nauticalmiles":case "squarenauticalmile":case "squarenauticalmiles":return 109409}return null};a.isInteger=function(c){return"number"===typeof c&&isFinite(c)&&Math.floor(c)===c};a.sameGeomType=function(c,m){return c===m||"point"===c&&"esriGeometryPoint"===m||"polyline"===c&&"esriGeometryPolyline"=== m||"polygon"===c&&"esriGeometryPolygon"===m||"extent"===c&&"esriGeometryEnvelope"===m||"multipoint"===c&&"esriGeometryMultipoint"===m||"point"===m&&"esriGeometryPoint"===c||"polyline"===m&&"esriGeometryPolyline"===c||"polygon"===m&&"esriGeometryPolygon"===c||"extent"===m&&"esriGeometryEnvelope"===c||"multipoint"===m&&"esriGeometryMultipoint"===c?!0:!1};a.shapeExtent=function(c){if(null==c)return null;switch(c.type){case "polygon":case "multipoint":case "polyline":return c.extent;case "point":return new b({xmin:c.x, ymin:c.y,xmax:c.x,ymax:c.y,spatialReference:c.spatialReference});case "extent":return c}return null};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureForm/FormExpressionsManager":function(){define("exports ../../chunks/tslib.es6 ../../core/Accessor ../../core/has ../../core/Logger ../../core/MapUtils ../../core/promiseUtils ../../core/accessorSupport/decorators/property ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),function(a,b, c,m,k,w,g,E,F,p){a.FormExpressionsManager=class extends c{constructor(r){super(r);this._fieldReferencesLookup=new Map;this._fieldsAffectedLookup=new Map;this.preserveFieldValuesWhenHidden=!0;this._latestFieldValues={...r.feature.attributes}}initialize(){this._dependencyGraph=this._buildDependencyGraph()}destroy(){this.resetExecutors()}get _asyncExecutors(){return this.executors.filter(r=>r.isAsync)}get _baseContext(){const {editType:r,layer:q,map:h,originalFeature:u,spatialReference:f,timeZone:z}= this.arcadeContextInfo,B="scene"===q?.type&&null!=q.associatedLayer?q.associatedLayer:q;return[{$originalfeature:u,$editcontext:{editType:r},$layer:B,$featureset:B,$datastore:q?.url,$map:h},{rawOutput:!0,spatialReference:f??void 0,timeZone:z}]}set feature(r){this._latestFieldValues={...r?.attributes};this._set("feature",r)}evaluateAll(){return this._evaluate(this.executors)}evaluateAsyncExpressions(){return this._evaluate(this._asyncExecutors)}evaluateExpressions(r){return this._evaluate(r)}evaluateInvalidated(r){const {_fieldReferencesLookup:q, _latestFieldValues:h,feature:u}=this,f=new Set;for(const z of r)if(h[z]=u.getAttribute(z),q.has(z))for(const B of q.get(z))f.add(B);return this._evaluate([...f])}async evaluateInvalidatedByGeometry(){if(this._fieldReferencesLookup.has("#JSAPI_FORM_EXPRESSIONS_MANAGER_GEOMETRY"))return this._evaluate([...this._fieldReferencesLookup.get("#JSAPI_FORM_EXPRESSIONS_MANAGER_GEOMETRY")])}resetExecutors(){for(const r of this.executors)r.reset()}_buildDependencyGraph(){const {_fieldReferencesLookup:r,_fieldsAffectedLookup:q, executors:h,preserveFieldValuesWhenHidden:u}=this,f=new Map(this.fieldInputs.map(x=>[x.name,x])),z=!1===u,B=new Map(h.map(x=>[x,[]]));for(const x of h){for(const N of x.fieldsUsed){w.getOrCreateMapValue(r,N,()=>new Set).add(x);const J=f.get(N);[J?.valueExpressionExecutor,J?.editableExpressionExecutor,z?J?.group?.visibilityExpressionExecutor:null,z?J?.visibilityExpressionExecutor:null].filter(I=>null!=I&&I!==x).forEach(I=>{B.get(I).push(x);w.getOrCreateMapValue(q,I,()=>new Set).add(J)})}x.geometryUsed&& w.getOrCreateMapValue(r,"#JSAPI_FORM_EXPRESSIONS_MANAGER_GEOMETRY",()=>new Set).add(x)}return B}async _evaluate(r){const q=new Map,{_dependencyGraph:h,_fieldsAffectedLookup:u,_latestFieldValues:f}=this;for(const z of r)y(z,q,h);for(const [z,{resolver:B,dependencyPromises:x}]of q)Promise.all(x).then(async()=>{const [N,J]=this._makeContext(f);return z.executeAsync(N,J)}).then(()=>{if(u.has(z))for(const N of u.get(z))this._latestFieldValues[N.name]=N.value;B.resolve()},N=>{!N||g.isAbortError(N)||l(N)|| z.markStale();B.reject(N)});r=(await Promise.allSettled(Array.from(q.values(),({resolver:z})=>z.promise))).filter(z=>"rejected"===z.status&&!(g.isAbortError(z.reason)||l(z.reason)));if(0{if(!q.has(r)){var u=g.createResolver();q.set(r,{resolver:u,dependencyPromises:[]});r.abort();r=h.get(r);for(const f of r)y(f,q,h),q.get(f).dependencyPromises.push(u.promise)}},l=r=>r&&"object"===typeof r&&"message"in r&&"Cancelled"===r.message;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})}, "esri/widgets/FeatureForm/GroupInput":function(){define("../../chunks/tslib.es6 ../../core/deprecate ../../core/Logger ../../core/reactiveUtils ../../core/uid ../../core/accessorSupport/decorators/property ../../core/has ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./featureFormUtils ./InputBase".split(" "),function(a,b,c,m,k,w,g,E,F,p,y){g=class extends y{constructor(l){super(l);this._expressionTrackingHandles=new Map;this.id=k.generateUID().toString();this.type="group"}initialize(){this.addHandles([m.watch(()=> [this.visible,this.inputs],([l])=>{const {inputs:r}=this;l=l?void 0:!1;for(const q of r)p.isFieldInput(q)&&(q.required=l)},{initial:!0,equals:(l,r)=>r[0]===l[0]&&r[1]===l[1]})])}destroy(){for(const l of this._expressionTrackingHandles.values())l.remove()}get initialState(){return this.element.initialState||"expanded"}get inputs(){return this._get("inputs")}set inputs(l){this.removeAllHandles();l&&this.addHandles(l.map(r=>m.watch(()=>r.visible,()=>this._dirtyEvaluatedVisibilityExpression())));this._set("inputs", l)}get label(){return this.element.label}set label(l){const {element:r}=this;r&&(r.label=l)}get open(){return"expanded"===this.initialState}set open(l){this._override("open",l)}get state(){b.deprecatedProperty(c.getLogger(this),"state",{replacement:"open",version:"4.28",warnOnce:!0});return this.open?"expanded":"collapsed"}set state(l){b.deprecatedProperty(c.getLogger(this),"state",{replacement:"open",version:"4.28",warnOnce:!0});this.open="expanded"===l}get visible(){return!1!==this.evaluatedVisibilityExpression&& this.inputs&&this.inputs.some(l=>l.visible)}_dirtyEvaluatedVisibilityExpression(){const {element:l}=this;l.visibilityExpression&&this.notifyChange("evaluatedVisibilityExpression")}};a.__decorate([w.property()],g.prototype,"id",void 0);a.__decorate([w.property()],g.prototype,"initialState",null);a.__decorate([w.property()],g.prototype,"inputs",null);a.__decorate([w.property()],g.prototype,"label",null);a.__decorate([w.property()],g.prototype,"open",null);a.__decorate([w.property()],g.prototype,"type", void 0);a.__decorate([w.property()],g.prototype,"visible",null);return g=a.__decorate([F.subclass("esri.widgets.FeatureForm.GroupInput")],g)})},"esri/widgets/FeatureForm/RelationshipInput":function(){define("../../chunks/tslib.es6 ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../layers/support/layerUtils ../Feature/FeatureRelationship/FeatureRelationshipViewModel ../Feature/support/featureUtils ./EditableInput ./featureFormUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l){m=class extends y{constructor(r){super(r);this.group=this._relationshipVM=null;this.type="relationship";this.addHandles([b.watch(()=>({feature:this.feature,element:this.element,layer:this.layer}),q=>this._createRelationshipVM(q),b.initial),b.on(()=>this.relatedLayer,"edits",()=>this._relationshipVM?.refresh())])}destroy(){this._relationshipVM?.destroy()}get canAddRelatedFeature(){const {editable:r,featureCount:q,relationship:h}=this;if(!h||!this.loaded||!this.relatedLayerAllowsAdds)return!1; const {cardinality:u,role:f}=h;return"one-to-one"===u&&0{let x=void 0;if(h){var N=B.getAttribute(h);const J=f.fieldsIndex.get(h);J&&(N=l.getComputedAttributes({values:[N],fields:[J],timeZone:q??void 0})[h],null!=N&&(x=N.toString()))}N=z?l.parseFormTemplateString({label:z,attributes:B.attributes,fieldsIndex:f.fieldsIndex,timeZone:q}):void 0;return{feature:B,description:x,title:N}}).toArray()}get relatedLayer(){return this._relationshipVM?.relatedLayer}get relatedLayerIsTable(){return!!this.relatedLayer?.isTable}get relatedLayerAllowsAdds(){const {relatedLayer:r}= this;return r&&this.relatedLayerAllowsEdits?!!E.getEffectiveLayerCapabilities(r)?.operations?.supportsAdd:!1}get relatedLayerAllowsEdits(){const {relatedLayer:r}=this;return r?!!E.getEffectiveLayerCapabilities(r)?.operations?.supportsEditing:!1}get showAllEnabled(){return this._get("showAllEnabled")}set showAllEnabled(r){this._relationshipVM?.set("showAllEnabled",r);this._set("showAllEnabled",r)}get showAllActionVisible(){return!this.showAllEnabled&&0this.displayCount}get visible(){var {relationship:r}= this;if(!r)return!1;({cardinality:r}=r);return"many-to-many"===r?!1:null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element}get updating(){return"loading"===this._relationshipVM?.state||"querying"===this._relationshipVM?.state}incrementPage(){this._relationshipVM&&this._relationshipVM.featurePage++}getRelatedFeatureByObjectId(r){return this._relationshipVM?.getRelatedFeatureByObjectId(r)}_createRelationshipVM(r){const {feature:q,element:h,layer:u}=r;this._relationshipVM?.destroy(); if(q&&h&&u){var {displayCount:f,map:z,orderByFields:B,relationshipId:x,showAllEnabled:N}=this;p.isRelatableFeatureSupportedLayer(u)&&(this._relationshipVM=new F({graphic:q,displayCount:f,layer:u,map:z,orderByFields:B,relationshipId:x,showAllEnabled:N}))}}};a.__decorate([c.property()],m.prototype,"_relationshipVM",void 0);a.__decorate([c.property()],m.prototype,"canAddRelatedFeature",null);a.__decorate([c.property()],m.prototype,"displayCount",null);a.__decorate([c.property()],m.prototype,"displayType", null);a.__decorate([c.property()],m.prototype,"editable",null);a.__decorate([c.property()],m.prototype,"featureCount",null);a.__decorate([c.property()],m.prototype,"group",void 0);a.__decorate([c.property()],m.prototype,"loaded",null);a.__decorate([c.property()],m.prototype,"map",null);a.__decorate([c.property()],m.prototype,"orderByFields",null);a.__decorate([c.property()],m.prototype,"originHasValidKey",null);a.__decorate([c.property()],m.prototype,"relationship",null);a.__decorate([c.property()], m.prototype,"relationshipId",null);a.__decorate([c.property()],m.prototype,"relatedFeatureInfos",null);a.__decorate([c.property()],m.prototype,"relatedLayer",null);a.__decorate([c.property()],m.prototype,"relatedLayerIsTable",null);a.__decorate([c.property()],m.prototype,"relatedLayerAllowsAdds",null);a.__decorate([c.property()],m.prototype,"relatedLayerAllowsEdits",null);a.__decorate([c.property()],m.prototype,"showAllEnabled",null);a.__decorate([c.property()],m.prototype,"showAllActionVisible", null);a.__decorate([c.property({readOnly:!0})],m.prototype,"type",void 0);a.__decorate([c.property()],m.prototype,"visible",null);a.__decorate([c.property()],m.prototype,"updating",null);return m=a.__decorate([g.subclass("esri.widgets.FeatureForm.RelationshipInput")],m)})},"esri/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel":function(){define("../../../chunks/tslib.es6 ../../../Graphic ../../../core/Accessor ../../../core/arrayUtils ../../../core/Clonable ../../../core/Collection ../../../core/Identifiable ../../../core/promiseUtils ../../../core/reactiveUtils ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/accessorSupport/decorators/subclass ../../../rest/support/RelationshipQuery ../support/featureUtils ../../FeatureForm/featureFormUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u){c=class extends k.ClonableMixin(g.IdentifiableMixin(c)){constructor(f){super(f);this._loaded=!1;this._queryFeatureCountAbortController=this._queryPageAbortController=this._queryAbortController=null;this.featuresPerPage=10;this.orderByFields=this.map=this.layer=this.graphic=this.description=null;this.featureCount=0;this.relationshipId=null;this.showAllEnabled=!1;this.title=null;this._cancelQuery=()=>{const {_queryAbortController:z}=this;z&&z.abort();this._queryAbortController= null};this._cancelQueryFeatureCount=()=>{const {_queryFeatureCountAbortController:z}=this;z&&z.abort();this._queryFeatureCountAbortController=null};this._cancelQueryPage=()=>{const {_queryPageAbortController:z}=this;z&&z.abort();this._queryPageAbortController=null};this._queryController=async()=>{this._cancelQuery();const z=new AbortController;this._queryAbortController=z;await E.ignoreAbortErrors(this._query());this._queryAbortController===z&&(this._queryAbortController=null)};this._queryFeatureCountController= async()=>{this._loaded=!1;this._cancelQueryFeatureCount();const z=new AbortController;this._queryFeatureCountAbortController=z;await E.ignoreAbortErrors(this._queryFeatureCount());this._queryFeatureCountAbortController===z&&(this._queryFeatureCountAbortController=null);this._loaded=!0};this._queryPageController=async()=>{const z=new AbortController;this._queryPageAbortController=z;await E.ignoreAbortErrors(this._queryPage());this._queryPageAbortController===z&&(this._queryPageAbortController=null)}; this._queryDebounced=E.debounce(this._queryController,100);this._queryFeatureCountDebounced=E.debounce(this._queryFeatureCountController,100);this._queryPageDebounced=E.debounce(this._queryPageController,100);this._query=async()=>{const {_queryAbortController:z,relatedFeatures:B}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,B.destroyAll(),this.destroyed||B.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:z?.signal}))))};this.addHandles([F.watch(()=> [this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount],()=>this._queryDebounced(),F.initial),F.watch(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced()),F.watch(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery],()=>this._queryFeatureCountDebounced())])}destroy(){this._destroyRelatedFeatureViewModels();this.relatedFeatures.destroyAll(); this._cancelQuery();this._cancelQueryFeatureCount();this._cancelQueryPage()}set featurePage(f){const {featuresPerPage:z,featureCount:B}=this;this._set("featurePage",Math.min(Math.max(f,1),Math.ceil(B/z)||1))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const {orderByFields:f,relatedLayer:z}=this;return f&&z?.loaded?f.map(B=>{const x=B.clone();x.field=h.getFixedFieldName(B.field,z);return x}):f??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&& null!=this.relationshipId&&"number"===typeof this.objectId}get canQuery(){const f=this.layer?.capabilities?.queryRelated;return!!this.relatedLayer&&!!this.relationship&&null!=this.relationshipId&&null!=this.objectId&&!!f?.supportsCount&&!!f?.supportsPagination}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(f){this._set("displayCount",Math.min(Math.max(f,0),10))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&& this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new w}get relatedLayer(){const {layer:f,map:z,relationship:B}=this;return f?.loaded&&z&&B?h.findRelatedLayer(z,f,B)??null:null}get relationship(){const {relationshipId:f,layer:z}=this;return null!=f?z?.relationships?.find(({id:B})=>B===f)??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new w}get state(){const {_queryAbortController:f, _queryFeatureCountAbortController:z,_queryPageAbortController:B,canQuery:x,_loaded:N,canLoad:J}=this;return z||J&&!N?"loading":f||B?"querying":x?"ready":"disabled"}getRelatedFeatureByObjectId(f){return this.relatedFeatures.find(z=>z.getObjectId()===f)}refresh(){this._queryFeatureCountDebounced()}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.destroyAll()}async _queryFeatureCount(){const {layer:f,relatedLayer:z,relationshipId:B,objectId:x,_queryFeatureCountAbortController:N,canQuery:J, supportsCacheHint:I}=this;await f?.load();await z?.load();if(J&&f&&z&&null!=x){var d=z.createQuery(),{historicMoment:v,gdbVersion:O}=f;d=new q({cacheHint:I,gdbVersion:O,historicMoment:v,relationshipId:B,returnGeometry:!1,objectIds:[x],where:d.where??void 0});d=await f.queryRelatedFeaturesCount(d,{signal:N?.signal});this._set("featureCount",d[x]||0)}else this._set("featureCount",0)}_sliceFeatures(f){const {showAllEnabled:z,displayCount:B}=this;return z?f:B?f.slice(0,B):[]}async _queryPage(){const {relatedFeatures:f, featurePage:z,showAllEnabled:B,_queryPageAbortController:x,featureCount:N}=this;!B||2>z||!N||f.addMany(await this._queryRelatedFeatures({signal:x?.signal}))}async _queryRelatedFeatures(f){const {orderByFieldsFixedCasing:z,showAllEnabled:B,featuresPerPage:x,displayCount:N,layer:J,relationshipId:I,featurePage:d,featureCount:v,relatedLayer:O,supportsCacheHint:t}=this,{canQuery:H,objectId:P}=this;if(!H||!J||!O||null==P)return[];var K=B?((d-1)*x+v)%v:0;const D=B?x:N;var A=O.objectIdField;A=[...z.map(G=> G.field),...u.getFieldsInTitleAndDesc(O),A].filter(m.isSome);const M=z.map(G=>`${G.field} ${G.order}`),C=O.createQuery(),{historicMoment:e,gdbVersion:n}=J;K=new q({orderByFields:M,start:K,num:D,outFields:A,cacheHint:t,historicMoment:e,gdbVersion:n,relationshipId:I,returnGeometry:!1,objectIds:[P],where:C.where??void 0});f=(await J.queryRelatedFeatures(K,{signal:f?.signal}))[P]?.features||[];f.forEach(G=>{G.sourceLayer=O;G.layer=O});return f}};a.__decorate([p.property()],c.prototype,"_loaded",void 0); a.__decorate([p.property()],c.prototype,"_queryAbortController",void 0);a.__decorate([p.property()],c.prototype,"_queryPageAbortController",void 0);a.__decorate([p.property()],c.prototype,"_queryFeatureCountAbortController",void 0);a.__decorate([p.property({value:1})],c.prototype,"featurePage",null);a.__decorate([p.property()],c.prototype,"featuresPerPage",void 0);a.__decorate([p.property({readOnly:!0})],c.prototype,"orderByFieldsFixedCasing",null);a.__decorate([p.property({readOnly:!0})],c.prototype, "supportsCacheHint",null);a.__decorate([p.property({readOnly:!0})],c.prototype,"canLoad",null);a.__decorate([p.property({readOnly:!0})],c.prototype,"canQuery",null);a.__decorate([p.property()],c.prototype,"description",void 0);a.__decorate([p.property({readOnly:!0})],c.prototype,"itemDescriptionFieldName",null);a.__decorate([p.property({value:3})],c.prototype,"displayCount",null);a.__decorate([p.property({type:b})],c.prototype,"graphic",void 0);a.__decorate([p.property()],c.prototype,"layer",void 0); a.__decorate([p.property()],c.prototype,"map",void 0);a.__decorate([p.property({readOnly:!0})],c.prototype,"objectId",null);a.__decorate([p.property({readOnly:!0})],c.prototype,"objectIdField",null);a.__decorate([p.property()],c.prototype,"orderByFields",void 0);a.__decorate([p.property({readOnly:!0})],c.prototype,"relatedFeatures",null);a.__decorate([p.property({readOnly:!0})],c.prototype,"relatedLayer",null);a.__decorate([p.property({readOnly:!0})],c.prototype,"relationship",null);a.__decorate([p.property()], c.prototype,"featureCount",void 0);a.__decorate([p.property({readOnly:!0})],c.prototype,"relatedFeatureViewModels",null);a.__decorate([p.property()],c.prototype,"relationshipId",void 0);a.__decorate([p.property()],c.prototype,"showAllEnabled",void 0);a.__decorate([p.property()],c.prototype,"state",null);a.__decorate([p.property()],c.prototype,"title",void 0);return c=a.__decorate([r.subclass("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],c)})},"esri/widgets/FeatureForm/TextElementInput":function(){define("exports ../../chunks/tslib.es6 ../../core/Collection ../../core/ReactiveMap ../../core/ReactiveSet ../../core/uid ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../core/support/UpdatingHandles ../../layers/support/fieldUtils ./featureFormUtils ./InputBase ./support/textManipulationUtils ../support/widgetUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f){function z(x){var N=[...x.matchAll(/{[^{]+?}/g)];let J=0;const I=[],d=[];for(const v of N)N=v[0],I.push(x.slice(J,v.index)),d.push(N),J=v.index+N.length;I.push(x.slice(J));return{literals:I,templates:d}}function B(x,N){return N.reduce((J,I,d)=>J.concat(x.at(d),I),"").concat(x.at(-1))}a.TextElementInput=class extends h{constructor(x){super(x);this.group=null;this.id=`TextElementInput-${w.generateUID()}`;this.type="text";this._expressionReferences=new m;this._expressionsUsed= new k;this._fieldsUsed=new k;this._literalParts=new c;this._templateParts=new c;this._updatingHandles=new l.UpdatingHandles}initialize(){const {rawText:x}=this;x?"markdown"===this.textFormat?this._updatingHandles.addPromise(u.compileTextElementMarkdownToHTML(x).then(N=>this._initializeTextParts(N))):this._initializeTextParts(x):this._literalParts.push("")}get expressionsUsed(){return Array.from(this._expressionsUsed)}get fieldsIndex(){return this.layer.fieldsIndex}set fieldsIndex(x){this._overrideIfSome("fieldsIndex", x)}get fieldsUsed(){return Array.from(this._fieldsUsed)}get rawText(){return this.element.text}get text(){const x=this._templateParts.map(N=>`${this._expressionReferences.get(N)?.lastEvaluatedValue??""}`);return f.renderingSanitizer.sanitize(B(this._literalParts,x))}get textFormat(){return this.element.textFormat}get updating(){return this._updatingHandles.updating||Array.from(this._expressionReferences.values()).some(x=>x?.updating)}setExpressionExecutor(x,N){this._expressionReferences.set(q.prependExpressionPrefix(x), N)}setFieldExecutor(x,N){this._expressionReferences.set(q.prependFieldPrefix(x),N)}_initializeTextParts(x){const {fieldsIndex:N}=this,{literals:J,templates:I}=z(x);x=[];const d=[];for(let O=0;Om.call(k,w,g,this),k)}has(m){a.trackAccess(this._observable); return this._set.has(m)}keys(){a.trackAccess(this._observable);return this._set.keys()}values(){a.trackAccess(this._observable);return this._set.values()}[Symbol.iterator](){a.trackAccess(this._observable);return this._set[Symbol.iterator]()}get [Symbol.toStringTag](){return this._set[Symbol.toStringTag]}}return c})},"esri/widgets/FeatureForm/support/textManipulationUtils":function(){define(["require","exports"],function(a,b){async function c(){const {Marked:w}=await new Promise((F,p)=>a(["../../../chunks/marked.esm"], F,p)),g=()=>"",E={};for(const F of k)E[F]=g;m=new w({renderer:{del:F=>`${F}`,link:(F,p,y)=>`${y??""}`,...E}})}let m;const k="blockquote html hr checkbox table tablerow tablecell image".split(" ");b.compileTextElementMarkdownToHTML=async function(w){m||await c();return m.parse(w)};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureTemplates":function(){define("require ../chunks/tslib.es6 ../core/reactiveUtils ../core/accessorSupport/decorators/property ../core/has ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ../layers/support/layerUtils ./Widget ./FeatureForm/featureFormUtils ./FeatureTemplates/FeatureTemplatesViewModel ./FeatureTemplates/ItemList ./FeatureTemplates/TemplateItem ./FeatureTemplates/VisibleElements ../chunks/componentsUtils ./support/globalCss ./support/widgetUtils ./support/decorators/messageBundle ./support/decorators/vmEvent ./support/jsxFactory".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N){function J(I){return I.id}k=class extends p{constructor(I,d){super(I,d);this.enableListScroll=!0;this.filterText="";this.headingLevel=4;this.messagesCommon=this.messages=null;this.selectionMode="none";this.viewModel=new l;this.visibleElements=new h;this.renderCustomItem=v=>null;this.renderCustomGroupContent=v=>null;this.renderItemLabel=()=>null;this.renderItemDescription=()=>null;this.renderItemContent=v=>null;this.renderItemContentEnd=v=>null;this._iconIntersectionObserver= new IntersectionObserver((v,O)=>{v.forEach(async t=>{if(t.isIntersecting){const K=t.target;if(K?.["data-has-icon"])O.unobserve(K);else{var {layer:H,template:P}=K?.["data-item"];K&&(K["data-has-icon"]=!0);t=await q.fetchThumbnail(H,P).catch(()=>{K&&(K["data-has-icon"]=!1);return null});null!=t&&K.appendChild(t)}}})});this._renderItemIcon=v=>F.isTable(v.layer)?N.tsx("span",{"data-has-icon":!0,"data-item":v,key:"icon"},N.tsx("calcite-icon",{icon:"table"})):N.tsx("span",{afterCreate:this._afterItemCreateOrUpdate, afterRemoved:this._afterItemRemoved,afterUpdate:this._afterItemCreateOrUpdate,"data-has-icon":!1,"data-item":v,key:"icon"});this._afterItemCreateOrUpdate=v=>{this._iconIntersectionObserver?.observe(v)};this._afterItemRemoved=v=>{this._iconIntersectionObserver?.unobserve(v)}}initialize(){const I=({label:d})=>!this.filterText||!!d?.toLowerCase().includes(this.filterText.toLowerCase());this.addHandles(c.watch(()=>this.viewModel,(d,v)=>{d&&!d.filterFunction&&(this.filterFunction=I);v&&v!==d&&v.filterFunction=== I&&(v.filterFunction=null)},c.initial))}destroy(){this._iconIntersectionObserver?.disconnect();this._iconIntersectionObserver=null}loadDependencies(){return u.loadCalciteComponents({icon:()=>new Promise((I,d)=>a(["../chunks/calcite-icon"],I,d)),loader:()=>new Promise((I,d)=>a(["../chunks/calcite-loader"],I,d)),input:()=>new Promise((I,d)=>a(["../chunks/calcite-input"],I,d)),list:()=>new Promise((I,d)=>a(["../chunks/calcite-list"],I,d)),"list-item":()=>new Promise((I,d)=>a(["../chunks/calcite-list-item"], I,d)),notice:()=>new Promise((I,d)=>a(["../chunks/calcite-notice"],I,d))})}get disabled(){return this.viewModel.disabled}set disabled(I){this.viewModel.disabled=I}get filterFunction(){return this.viewModel.filterFunction}set filterFunction(I){this.viewModel.filterFunction=I}get groupBy(){return this.viewModel.groupBy}set groupBy(I){this.viewModel.groupBy=I}get icon(){return"list-rectangle"}set icon(I){this._overrideIfSome("icon",I)}get label(){return this.messages?.widgetLabel??""}set label(I){this._overrideIfSome("label", I)}get layers(){return this.viewModel.layers}set layers(I){this.viewModel.layers=I}get selectedItem(){return this.viewModel.selectedItem}select(I,d){return this.viewModel.select(I,d)}render(){const {disabled:I,enableListScroll:d,filterText:v,headingLevel:O,messages:t,viewModel:{items:H,numberOfFeatureTemplates:P,selectedItem:K,state:D}}=this,A=this.visibleElements.filter&&1C.label===l.nullGroupBy.label);M&&(M.label=t.other)}return N.tsx("div", {"aria-label":t.widgetLabel,class:this.classes("esri-feature-templates",f.globalCss.widget)},"loading"===D?N.tsx("calcite-loader",{key:"loader",label:this.messagesCommon.loading,type:"indeterminate"}):"ready"===D?N.tsx(r.ItemList,{disabled:I,enableListScroll:d,filterEnabled:A,filterText:v,headingLevel:O,id:this.id,identify:J,items:H,messages:{filterPlaceholder:t.filterPlaceholder,noItems:t.noItems,noMatches:t.noMatches},renderCustomGroupContent:this.renderCustomGroupContent,renderCustomItem:this.renderCustomItem, renderIcon:this._renderItemIcon,renderItemContent:this.renderItemContent,renderItemContentEnd:this.renderItemContentEnd,renderItemDescription:this.renderItemDescription,renderItemLabel:this.renderItemLabel,selectedItem:K??void 0,selectionMode:this.selectionMode??void 0,onFilterChange:M=>{this.filterText=M;this.viewModel.refresh()},onItemSelect:M=>!y.isTemplateItemGroup(M)&&this.viewModel.select(M)}):null)}};b.__decorate([m.property()],k.prototype,"disabled",null);b.__decorate([m.property()],k.prototype, "enableListScroll",void 0);b.__decorate([m.property()],k.prototype,"filterFunction",null);b.__decorate([m.property()],k.prototype,"filterText",void 0);b.__decorate([m.property()],k.prototype,"groupBy",null);b.__decorate([m.property()],k.prototype,"headingLevel",void 0);b.__decorate([m.property()],k.prototype,"icon",null);b.__decorate([m.property()],k.prototype,"label",null);b.__decorate([m.property()],k.prototype,"layers",null);b.__decorate([m.property(),B.messageBundle("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")], k.prototype,"messages",void 0);b.__decorate([m.property(),B.messageBundle("esri/t9n/common")],k.prototype,"messagesCommon",void 0);b.__decorate([m.property({readOnly:!0})],k.prototype,"selectedItem",null);b.__decorate([m.property()],k.prototype,"selectionMode",void 0);b.__decorate([m.property(),x.vmEvent("select")],k.prototype,"viewModel",void 0);b.__decorate([m.property({type:h,nonNullable:!0})],k.prototype,"visibleElements",void 0);b.__decorate([m.property()],k.prototype,"renderCustomItem",void 0); b.__decorate([m.property()],k.prototype,"renderCustomGroupContent",void 0);b.__decorate([m.property()],k.prototype,"renderItemLabel",void 0);b.__decorate([m.property()],k.prototype,"renderItemDescription",void 0);b.__decorate([m.property()],k.prototype,"renderItemContent",void 0);b.__decorate([m.property()],k.prototype,"renderItemContentEnd",void 0);return k=b.__decorate([E.subclass("esri.widgets.FeatureTemplates")],k)})},"esri/widgets/FeatureTemplates/FeatureTemplatesViewModel":function(){define("../../chunks/tslib.es6 ../../core/Evented ../../core/ObjectPool ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../layers/support/layerUtils ./TemplateItem ./TemplateItemGroup ../support/templateUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r){var q;const h=({layer:f})=>({key:f,label:f.title??""}),u=({layer:f})=>({key:f.geometryType,label:f.geometryType??""});b=q=class extends b.EventedAccessor{constructor(f){super(f);this._groupPool=new c(l);this._itemPool=new c(y);this.disabled=!1;this.selectedItem=this.filterFunction=this.disabledItemFunction=null}initialize(){this._get("groupBy")||(this.groupBy="layer")}get _featureTemplatesByLayer(){if(!this.layers)return new Map;const f=new Map;for(const z of this.layers)if("subtype-group"=== z.type)for(const B of z.sublayers)f.set(B,r.getAllTemplatesForLayer(B));else f.set(z,r.getAllTemplatesForLayer(z));return f}set groupBy(f){this._set("groupBy",f);if("function"===typeof f)this._groupByFunction=z=>this._ensureGroupByObject(f(z));else switch(f){case "layer":this._groupByFunction=h;break;case "geometry":this._groupByFunction=u;break;default:this._groupByFunction=null}}set layers(f){this.removeHandles("layers");if(f){const z=()=>this.notifyChange("state");this.addHandles(f.map(B=>m.when(()=> B.loadStatus,z)),"layers")}this._set("layers",f)}get layers(){return this._get("layers")}get state(){const {layers:f}=this;return f&&0!==f.length?f.some(z=>"loading"===z.loadStatus||"not-loaded"===z.loadStatus)?"loading":"ready":"disabled"}get numberOfFeatureTemplates(){return Array.from(this._featureTemplatesByLayer.values()).reduce((f,z)=>f+z.length,0)}get items(){if(0===this.numberOfFeatureTemplates)return this._releasePreviousItems(),[];var f=this._featureTemplatesByLayer,z=[],B=null!=this.filterFunction? this.filterFunction:q._nullFilterFunction;for(const [J,I]of f)if(J.loaded||"subtype-sublayer"===J.type&&J.parent?.loaded)if(f=p.getEffectiveLayerCapabilities(J)?.operations,f?.supportsEditing&&f?.supportsAdd)for(var x of I)z.push({layer:J,template:x,matchesFilter:B({label:x.name})});if(null==this._groupByFunction)return B=z.filter(({matchesFilter:J})=>J).map(({template:J,layer:I})=>this._createItem(J,I)),this._releasePreviousItems(),B;x=new Map;for(var N of z){const {template:J,layer:I}=N;z=this._groupByFunction({template:J, layer:I});const {key:d,label:v}=null!=z.key?z:q.nullGroupBy;x.has(d)||x.set(d,{label:v,templateItemInfos:[]});x.get(d)?.templateItemInfos.push(N)}N=[];for(const J of x.values()){const {label:I,templateItemInfos:d}=J;z=d.filter(({matchesFilter:v})=>v);z=B({label:I})?d:0this._createItem(v,O)),N.push(this._createGroup(I,z)))}if(1===N.length&&N[0].label===q.nullGroupBy.label)return this._releasePreviousItems(),N[0].items;this._releasePreviousItems(); return N}refresh(){this.notifyChange("items")}select(f,{emit:z=!0}={}){const B=this.selectedItem;f=f?.clone()||null;this._set("selectedItem",f);z&&this.emit("select",{item:f,oldItem:B,template:f?.template??null})}_createItem(f,z){const B=this._itemPool.acquire(),x=this.disabledItemFunction?.({template:f,layer:z})??!1;B.set({disabled:x,layer:z,template:f});return B}_createGroup(f,z){const B=this._groupPool.acquire();B.set("label",f);B.items=z;return B}_releasePreviousItems(){this._destroyItems(this._get("items"))}_destroyItems(f){f&& (f[0]instanceof y?f.forEach(z=>this._destroyItem(z)):f.forEach(z=>this._destroyGroup(z)))}_destroyGroup(f){f.items.forEach(z=>this._destroyItem(z));f.items.length=0;this._groupPool.release(f)}_destroyItem(f){f.layer=null;f.template=null;this._itemPool.release(f)}_ensureGroupByObject(f){return"string"===typeof f?{key:f,label:f}:f}};b.nullGroupBy={key:Symbol(),label:"Other\u200b"};b._nullFilterFunction=f=>!0;a.__decorate([k.property()],b.prototype,"_featureTemplatesByLayer",null);a.__decorate([k.property()], b.prototype,"_groupByFunction",void 0);a.__decorate([k.property()],b.prototype,"disabled",void 0);a.__decorate([k.property()],b.prototype,"disabledItemFunction",void 0);a.__decorate([k.property()],b.prototype,"filterFunction",void 0);a.__decorate([k.property()],b.prototype,"groupBy",null);a.__decorate([k.property()],b.prototype,"layers",null);a.__decorate([k.property()],b.prototype,"state",null);a.__decorate([k.property({readOnly:!0})],b.prototype,"numberOfFeatureTemplates",null);a.__decorate([k.property({readOnly:!0})], b.prototype,"items",null);a.__decorate([k.property({readOnly:!0})],b.prototype,"selectedItem",void 0);return b=q=a.__decorate([F.subclass("esri.widgets.FeatureTemplates.FeatureTemplatesViewModel")],b)})},"esri/widgets/FeatureTemplates/TemplateItem":function(){define("require ../../chunks/tslib.es6 ../../Graphic ../../core/Accessor ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../symbols/support/symbolUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y){async function l(u,f){var {renderer:z}=u;return z&&(f=new c({attributes:f.prototype.attributes}),z=await z.getSymbolAsync(f))?z:r(u)}async function r(u){({geometryType:u}=u);return(u="point"===u||"multipoint"===u?await new Promise((f,z)=>a(["../../symbols/SimpleMarkerSymbol"],B=>f(q(B)),z)):"polyline"===u?await new Promise((f,z)=>a(["../../symbols/SimpleLineSymbol"],B=>f(q(B)),z)):"polygon"===u||"mesh"===u||"multipatch"===u?await new Promise((f,z)=>a(["../../symbols/SimpleFillSymbol"], B=>f(q(B)),z)):null)?new u.default:null}const q=u=>Object.freeze(Object.defineProperty({__proto__:null,default:u},Symbol.toStringTag,{value:"Module"}));var h;m=h=class extends m{constructor(u){super(u);this._activeFetchInfo={id:null,request:null};this.disabled=!1;this.thumbnail=this.template=this.layer=null}initialize(){this.addHandles(k.watch(()=>{const {layer:u}=this;return[u&&"renderer"in u?u.renderer:null,this.template]},()=>{this._activeFetchInfo.id=null;this._activeFetchInfo.request=null;this._set("thumbnail", null)},k.initial))}get description(){return this.template?.description}set description(u){this.template&&(this.template.description=u)}get label(){return this.template?.name}set label(u){this.template&&(this.template.name=u)}get id(){return`${this.label??""}\u2013${this.layer?.id}`}get supportsUpload(){return"scene"===this.layer?.type}clone(){const u=null!=this.thumbnail?this.thumbnail.cloneNode(!0):null,f=new h({layer:this.layer,template:this.template});f._set("thumbnail",u);return f}static async fetchThumbnail(u, f){const z=await l(u,f);if(null==z)return null;const B={maxSize:36};"dictionary"===u.renderer?.type&&(B.fieldMap=u.renderer.fieldMap??void 0,B.feature={attributes:f.prototype.attributes??{}});return await y.renderPreviewHTML(z,B)}};b.__decorate([w.property()],m.prototype,"description",null);b.__decorate([w.property()],m.prototype,"disabled",void 0);b.__decorate([w.property()],m.prototype,"label",null);b.__decorate([w.property()],m.prototype,"layer",void 0);b.__decorate([w.property()],m.prototype, "template",void 0);b.__decorate([w.property({readOnly:!0})],m.prototype,"thumbnail",void 0);b.__decorate([w.property()],m.prototype,"id",null);b.__decorate([w.property()],m.prototype,"supportsUpload",null);return m=h=b.__decorate([p.subclass("esri.widgets.FeatureTemplates.TemplateItem")],m)})},"esri/symbols/support/symbolUtils":function(){define("require exports ../../core/has ../../support/arcadeOnDemand ./gfxUtils ./previewUtils ./renderUtils ./utils ../../widgets/Legend/styles/support/relationshipUtils ../../widgets/Legend/support/relationshipRampUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p){function y(f,z){if(z&&(f.style.filter=E.getCSSFilterFromEffectList(z),z=z.effects))for(const B of z)if("drop-shadow"===B?.type){0>B.offsetX?f.style.marginLeft=`${Math.abs(B.offsetX)}px`:f.style.marginRight=`${B.offsetX}px`;break}}async function l(f,z){switch(f.type){case "web-style":var {previewWebStyleSymbol:B}=await new Promise((x,N)=>a(["./previewWebStyleSymbol"],x,N));return B(f,l,z);case "label-3d":case "line-3d":case "mesh-3d":case "point-3d":case "polygon-3d":return{previewSymbol3D:B}= await new Promise((x,N)=>a(["./previewSymbol3D"],x,N)),B(f,z);case "simple-marker":case "simple-line":case "simple-fill":case "picture-marker":case "picture-fill":case "text":return{previewSymbol2D:B}=await new Promise((x,N)=>a(["./previewSymbol2D"],x,N)),B(f,z);case "cim":return{previewCIMSymbol:B}=await new Promise((x,N)=>a(["./previewCIMSymbol"],x,N)),B(f,z)}}function r(f){return f&&"opacity"in f?f.opacity*r(f.parent):1}function q(f){if(f)return"renderer"in f?f.renderer:void 0}let h=null;const u= [255,255,255];b.getDisplayedColor=async function(f,z){if(f){var {layer:B,sourceLayer:x}=f,N=r(B??x);if(null!=f.symbol&&(null==z||!0!==z.ignoreGraphicSymbol))return f="web-style"===f.symbol.type?await E.fetchWebStyleSymbol(f.symbol,z):f.symbol.clone(),E.getColorFromSymbol(f,N);var J=z?.renderer??q(B)??q(x),I=J&&"getSymbolAsync"in J?await J.getSymbolAsync(f,z):void 0;if(I){I="web-style"===I.type?await E.fetchWebStyleSymbol(I,z):I.clone();I=E.getColorFromSymbol(I,N);if(!(J&&"visualVariables"in J)||"visualVariables"in J&&!J.visualVariables||"visualVariables"in J&&!J.visualVariables?.length)return I;"arcadeRequiredForVisualVariables"in J&&J.arcadeRequiredForVisualVariables&&null==z?.arcade&&(z={...z},z.arcade=await m.loadArcade());var {getColor:d,getOpacity:v}=await new Promise((H,P)=>a(["../../renderers/visualVariables/support/visualVariableUtils"],H,P)),O=[],t=[];for(const H of J.visualVariables)switch(H.type){case "color":O.push(H);break;case "opacity":t.push(H)}J=(J=0a(["../../renderers/visualVariables/support/visualVariableUtils"], D,A)),O=[],t=[],H=[],P=[];for(var K of N.visualVariables)switch(K.type){case "color":O.push(K);break;case "opacity":t.push(K);break;case "rotation":P.push(K);break;case "size":K.target||H.push(K)}K=(K=!!O.length&&O[O.length-1])?J(K,f,z):null;t=(t=!!t.length&&t[t.length-1])?I(t,f,z):null;null!=B&&(t=null!=t?t*B:B);E.applyColorToSymbol(x,K,t);H.length&&(B=d(H,f,z),await E.applySizesToSymbol(x,B));for(const D of P)E.applyRotationToSymbol(x,v(D,f,z),D.axis);return x}}};b.getLegendLabel=async function(f, z,B){if(f){var {layer:x,sourceLayer:N}=f,J=B?.renderer??q(x)??q(N);if(!J)return null;if("visualVariables"in J&&J.visualVariables?.length){const {getRampStops:d}=await new Promise((H,P)=>a(["../../widgets/Legend/support/colorRampUtils"],H,P)),{getRampStops:v}=await new Promise((H,P)=>a(["../../widgets/Legend/support/sizeRampUtils"],H,P)),{getDateFormatOptions:O}=await new Promise((H,P)=>a(["../../widgets/Legend/support/utils"],H,P));let t=null;for(const H of J.visualVariables){var I=z?O(x,H,z.timeZone): null;let P=null;switch(H.type){case "color":P=await d(H,null,I);break;case "opacity":P=await d(H);break;case "size":H.target||(P=await v(J,H,null,B?.scale||z?.scale,z,I))}if(P?.length&&(I=P.find((K,D)=>{const A=f.attributes[H.field];return 0===D?A>=K.value:D===P?.length-1?A<=K.value:K.value===A}))){t=I.label;break}}if(t)return t}switch(J.type){case "class-breaks":return z="getClassBreakInfo"in J?await J.getClassBreakInfo(f,B):null,z?.label??(z&&1P.addColorStop(A*K,D.toString()));O.fillStyle=P;O.fillRect(0,0,d,v)}else{d=B?d/f.length:d;v=B?v:v/f.length;t=J=0;for(const P of f)O.fillStyle=P.toString(),O.fillRect(J,t,d,v),J=B?J+d:0,t=B?0:t+v}f=document.createElement("div");f.style.width=`${x}px`;f.style.height=`${N}px`;y(f,z?.effectList);f.appendChild(I);return f};b.renderDotDensityPreviewHTML=function(f,z,B){const {backgroundColor:x,outline:N,dotSize:J}=f;var I=B?.swatchSize||w.SymbolSizeDefaults.size; const d=Math.round(I*I/Math.max(J,.5)**2*.8),v=window.devicePixelRatio;f=document.createElement("canvas");const O=I*v;f.width=O;f.height=O;f.style.width=`${f.width/v}px`;f.style.height=`${f.height/v}px`;const t=f.getContext("2d");x&&(t.fillStyle=x.toCss(!0),t.fillRect(0,0,O,O),t.fill());t.fillStyle=z?.toCss(!0)??"";if(h&&h.length/2===d)for(z=0;z<2*d;z+=2)t.fillRect(h[z],h[z+1],J*v,J*v),t.fill();else for(h=[],z=0;z<2*d;z+=2){const H=Math.floor(Math.random()*(O-0+1)),P=Math.floor(Math.random()*(O-0+ 1));h.push(H,P);t.fillRect(H,P,J*v,J*v);t.fill()}N&&(N.color&&(t.strokeStyle=N.color.toCss(!0)),t.lineWidth=N.width,t.strokeRect(0,0,O,O));I=new Image(I,I);I.src=f.toDataURL();I.ariaLabel=B?.ariaLabel??null;I.alt=B?.ariaLabel??"";return I};b.renderPieChartPreviewHTML=function(f,z={}){const B=z.radius||40;var x=2*Math.PI*B,N=f.length;const J=x/N,I=[],d=k.getStroke(z.outline);null!=d?.width&&(d.width*=2);(d||z.backgroundColor)&&I.push({shape:{type:"circle",cx:B,cy:B,r:B},fill:z.backgroundColor,stroke:d, offset:[0,0]});const v=z.values,O=v&&v.length===N&&100===v.reduce((H,P)=>H+P,0),t=[0];for(let H=0;HF.renderRelationshipRamp(J,z.id||"relationship",{opacity:z.opacity||1,effectList:z.effectList,ariaLabel:z.ariaLabel}));return f};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/symbols/support/gfxUtils":function(){define("exports ../../assets ../../Color ../../request ../../core/LRUCache ../../core/screenUtils ./cimSymbolUtils".split(" "),function(a,b,c,m,k,w,g){function E(r){if(!r)return null; let q=null;switch(r.type){case "simple-fill":case "picture-fill":case "simple-marker":q=E(r.outline);break;case "simple-line":const h=w.pt2px(r.width);null!=r.style&&"none"!==r.style&&0!==h&&(q={color:r.color,style:l(r.style),width:h,cap:r.cap,join:"miter"===r.join?w.pt2px(r.miterLimit):r.join},q.dashArray=F(q).join(",")||"none");break;default:q=null}return q}function F(r){if(!r?.style)return[];const {dashArray:q,style:h,width:u}=r;if("string"===typeof q&&"none"!==q)return q.split(",").map(B=>Number(B)); const f=u??0,z=p.has(h)?p.get(h).map(B=>B*f):[];if("butt"!==r.cap)for(const [B,x]of z.entries())z[B]=1===B%2?x+f:Math.max(x-f,1);return z}const p=new Map([["dash",[4,3]],["dashdot",[4,3,1,3]],["dot",[1,3]],["longdash",[8,3]],["longdashdot",[8,3,1,3]],["longdashdotdot",[8,3,1,3,1,3]],["shortdash",[4,1]],["shortdashdot",[4,1,1,1]],["shortdashdotdot",[4,1,1,1,1,1]],["shortdot",[1,1]],["solid",[]]]),y=new k.LRUCache(1E3),l=(()=>{const r={};return q=>{if(r[q])return r[q];const h=q.replaceAll("-","");return r[q]= h}})();c=new c([128,128,128]);a.defaultThematicColor=c;a.dekebabifyLineStyle=l;a.getDashArray=F;a.getFill=function(r){const q=r.style;let h=null;if(r)switch(r.type){case "simple-marker":"cross"!==q&&"x"!==q&&(h=r.color);break;case "simple-fill":q&&"solid"!==q?"none"!==q&&(h={type:"pattern",x:0,y:0,src:b.getAssetUrl(`esri/symbols/patterns/${q}.png`),width:5,height:5}):h=r.color;break;case "picture-fill":h={type:"pattern",src:r.url,width:w.pt2px(r.width)*r.xscale,height:w.pt2px(r.height)*r.yscale,x:w.pt2px(r.xoffset), y:w.pt2px(r.yoffset)};break;case "text":h=r.color;break;case "cim":h=g.getCIMSymbolColor(r)}return h};a.getPatternUrlWithColor=function(r,q){const h=r+"-"+q;return void 0!==y.get(h)?Promise.resolve(y.get(h)):m(r,{responseType:"image"}).then(u=>{u=u.data;const f=u.naturalWidth,z=u.naturalHeight,B=document.createElement("canvas");B.width=f;B.height=z;const x=B.getContext("2d");x.fillStyle=q;x.fillRect(0,0,f,z);x.globalCompositeOperation="destination-in";x.drawImage(u,0,0);u=B.toDataURL();y.put(h,u); return u})};a.getStroke=E;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/symbols/support/cimSymbolUtils":function(){define(["exports","../../Color","../cim/utils"],function(a,b,c){function m(l){l=c.toCIMSymbolJSON(l);if("CIMTextSymbol"===l?.type)return l.height??0;let r=0;if(l?.symbolLayers)for(const q of l.symbolLayers)c.isCIMMarker(q)&&null!=q.size&&q.size>r?r=q.size:c.isCIMStroke(q)&&null!=q.width&&q.width>r?r=q.width:c.isCIMFill(q);return r}function k(l,r,q,h){if(l)if("CIMTextSymbol"=== l.type)null!=l.height&&(l.height*=r);else{if(q&&l.effects)for(const u of l.effects)E(u,r);if(l.symbolLayers)for(const u of l.symbolLayers)switch(u.type){case "CIMPictureMarker":case "CIMVectorMarker":w(u,r,h);break;case "CIMPictureStroke":case "CIMSolidStroke":!h?.preserveOutlineWidth&&u.width&&(u.width*=r);break;case "CIMPictureFill":u.height&&(u.height*=r);u.offsetX&&(u.offsetX*=r);u.offsetY&&(u.offsetY*=r);break;case "CIMHatchFill":k(u.lineSymbol,r,!0,{...h,preserveOutlineWidth:!1}),u.offsetX&& (u.offsetX*=r),u.offsetY&&(u.offsetY*=r),u.separation&&(u.separation*=r)}}}function w(l,r,q){if(l&&(l.markerPlacement&&g(l.markerPlacement,r),l.offsetX&&(l.offsetX*=r),l.offsetY&&(l.offsetY*=r),l.anchorPoint&&"Absolute"===l.anchorPointUnits&&(l.anchorPoint={x:l.anchorPoint.x*r,y:l.anchorPoint.y*r}),l.size=null!=l.size?l.size*r:0,"CIMVectorMarker"===l.type&&l.markerGraphics))for(const h of l.markerGraphics)l.scaleSymbolsProportionally||k(h.symbol,r,!0,q)}function g(l,r){c.isCIMMarkerStrokePlacement(l)&& l.offset&&(l.offset*=r);switch(l.type){case "CIMMarkerPlacementAlongLineRandomSize":case "CIMMarkerPlacementAlongLineSameSize":l.customEndingOffset&&(l.customEndingOffset*=r);l.offsetAlongLine&&(l.offsetAlongLine*=r);if(l.placementTemplate&&l.placementTemplate.length){var q=l.placementTemplate.map(h=>h*r);l.placementTemplate=q}break;case "CIMMarkerPlacementAlongLineVariableSize":l.maxRandomOffset&&(l.maxRandomOffset*=r);l.placementTemplate&&l.placementTemplate.length&&(q=l.placementTemplate.map(h=> h*r),l.placementTemplate=q);break;case "CIMMarkerPlacementOnLine":l.startPointOffset&&(l.startPointOffset*=r);break;case "CIMMarkerPlacementAtExtremities":l.offsetAlongLine&&(l.offsetAlongLine*=r);break;case "CIMMarkerPlacementAtRatioPositions":l.beginPosition&&(l.beginPosition*=r);l.endPosition&&(l.endPosition*=r);break;case "CIMMarkerPlacementPolygonCenter":l.offsetX&&(l.offsetX*=r);l.offsetY&&(l.offsetY*=r);break;case "CIMMarkerPlacementInsidePolygon":l.offsetX&&(l.offsetX*=r),l.offsetY&&(l.offsetY*= r),l.stepX&&(l.stepX*=r),l.stepY&&(l.stepY*=r)}}function E(l,r){switch(l.type){case "CIMGeometricEffectArrow":case "CIMGeometricEffectDonut":l.width&&(l.width*=r);break;case "CIMGeometricEffectBuffer":l.size&&(l.size*=r);break;case "CIMGeometricEffectCut":l.beginCut&&(l.beginCut*=r);l.endCut&&(l.endCut*=r);l.middleCut&&(l.middleCut*=r);break;case "CIMGeometricEffectDashes":l.customEndingOffset&&(l.customEndingOffset*=r);l.offsetAlongLine&&(l.offsetAlongLine*=r);if(l.dashTemplate&&l.dashTemplate.length){const q= l.dashTemplate.map(h=>h*r);l.dashTemplate=q}break;case "CIMGeometricEffectExtension":case "CIMGeometricEffectJog":case "CIMGeometricEffectRadial":l.length&&(l.length*=r);break;case "CIMGeometricEffectMove":l.offsetX&&(l.offsetX*=r);l.offsetY&&(l.offsetY*=r);break;case "CIMGeometricEffectOffset":case "CIMGeometricEffectOffsetTangent":l.offset&&(l.offset*=r);break;case "CIMGeometricEffectRegularPolygon":l.radius&&(l.radius*=r);break;case "CIMGeometricEffectTaperedPolygon":l.fromWidth&&(l.fromWidth*= r);l.length&&(l.length*=r);l.toWidth&&(l.toWidth*=r);break;case "CIMGeometricEffectWave":l.amplitude&&(l.amplitude*=r),l.period&&(l.period*=r)}}function F(l,r){if(l){var q="CIMTextSymbol"===l.type?l.symbol:l;l="CIMPolygonSymbol"===l.type;if(q?.symbolLayers)for(const h of q.symbolLayers)if(!(h.colorLocked||l&&(c.isCIMStroke(h)||c.isCIMMarker(h)&&h.markerPlacement&&c.isCIMMarkerStrokePlacement(h.markerPlacement))))switch(h.type){case "CIMPictureMarker":case "CIMPictureStroke":case "CIMPictureFill":h.tintColor&& p(r,h.tintColor);break;case "CIMVectorMarker":h.markerGraphics?.forEach(u=>{F(u.symbol,r)});break;case "CIMSolidStroke":case "CIMSolidFill":p(r,h.color);break;case "CIMHatchFill":F(h.lineSymbol,r)}}}function p(l,r){for(const q of l)if(q.join(".")===r.join("."))return;l.push(r)}function y(l,r,q){if(l){var h="CIMTextSymbol"===l.type?l.symbol:l;l="CIMPolygonSymbol"===h?.type;if(h?.symbolLayers)for(const u of h.symbolLayers)if(!u.colorLocked){if(l)if(q){if({layersToColor:h}=q,(c.isCIMStroke(u)||c.isCIMMarker(u)&& u.markerPlacement&&c.isCIMMarkerStrokePlacement(u.markerPlacement))&&"fill"===h||c.isCIMFill(u)&&"outline"===h)continue}else if(c.isCIMStroke(u)||c.isCIMMarker(u)&&u.markerPlacement&&c.isCIMMarkerStrokePlacement(u.markerPlacement))continue;h=r.toArray();switch(u.type){case "CIMPictureMarker":case "CIMPictureStroke":case "CIMPictureFill":u.tintColor=h;break;case "CIMVectorMarker":u.markerGraphics?.forEach(f=>{y(f.symbol,r,q)});break;case "CIMSolidStroke":case "CIMSolidFill":u.color=h;break;case "CIMHatchFill":y(u.lineSymbol, r,q)}}}}a.applyCIMSymbolColor=function(l,r,q){r instanceof b||(r=new b(r));(l=c.toCIMSymbolJSON(l))&&y(l,r,q)};a.applyCIMSymbolRotation=function(l,r,q=!1){l=c.toCIMSymbolJSON(l);q&&(r=360-r);if("CIMTextSymbol"===l?.type)l.angle=r;else if("CIMPointSymbol"===l?.type&&l.symbolLayers){q=r-(l.angle||0);for(const h of l.symbolLayers)if(c.isCIMMarker(h)){let u=h.rotation||0;u=h.rotateClockwise?u-q:u+q;h.rotation=u}l.angle=r}};a.getCIMSymbolColor=function(l){l=c.toCIMSymbolJSON(l);const r=[];F(l,r);return r.length? new b(c.normalizeAlpha(r[0])):null};a.getCIMSymbolRotation=function(l,r=!1){l=c.toCIMSymbolJSON(l);return"CIMTextSymbol"===l?.type||"CIMPointSymbol"===l?.type?(l=l.angle,null!=l&&r?360-l:l??0):0};a.getCIMSymbolSize=m;a.getCIMSymbolType=function(l){l=c.toCIMSymbolJSON(l);if(!l)return null;switch(l.type){case "CIMPointSymbol":return"CIMPointSymbol";case "CIMLineSymbol":return"CIMLineSymbol";case "CIMPolygonSymbol":return"CIMPolygonSymbol";case "CIMTextSymbol":return"CIMTextSymbol";case "CIMMeshSymbol":return"CIMMeshSymbol"; default:return null}};a.scaleCIMMarker=w;a.scaleCIMSymbol=k;a.scaleCIMSymbolTo=function(l,r,q){if(l){var h=c.toCIMSymbolJSON(l);l=m(l);if(0===l){if(h)if("CIMTextSymbol"===h.type)h.height=r;else if(h.symbolLayers)for(const u of h.symbolLayers)switch(u.type){case "CIMPictureMarker":case "CIMVectorMarker":u.size=r;break;case "CIMPictureStroke":case "CIMSolidStroke":u.width=r}}else k(h,r/l,!1,q)}};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/symbols/support/previewUtils":function(){define(["exports", "../../Color"],function(a,b){function c(m,k){return Math.round(Math.min(Math.max(m+191.25*k,0),255))}a.SymbolSizeDefaults=void 0;(function(m){m[m.size=22]="size";m[m.lineWidth=50]="lineWidth";m[m.maxSize=120]="maxSize";m[m.maxOutlineSize=80]="maxOutlineSize";m[m.tallSymbolWidth=20]="tallSymbolWidth"})(a.SymbolSizeDefaults||(a.SymbolSizeDefaults={}));a.adjustColorBrightness=function(m,k){if(null==m)return new b;if("type"in m&&("linear"===m.type||"pattern"===m.type))return m;m=new b(m);return new b([c(m.r, k),c(m.g,k),c(m.b,k),m.a])};a.adjustColorComponentBrightness=c;a.getConeShapes=function(m,k){let w=k?a.SymbolSizeDefaults.tallSymbolWidth:m;k=k?4:6;w=w<=a.SymbolSizeDefaults.size?w-.5*k:w-k;k=.15*w;const g=w;m-=k;return[{type:"ellipse",cx:.5*w,cy:m,rx:.5*w,ry:k},{type:"path",path:[{command:"M",values:[.5*g,0]},{command:"L",values:[g,m]},{command:"L",values:[0,m]},{command:"Z",values:[]}]}]};a.getCubeShapes=function(m,k){let w=k?a.SymbolSizeDefaults.tallSymbolWidth:m;var g=k?4:6;g=w=w<=a.SymbolSizeDefaults.size? w-.5*g:w-g;k=k?.35*w:.5*w;return[{type:"path",path:[{command:"M",values:[.5*g,0]},{command:"L",values:[g,.5*k]},{command:"L",values:[.5*g,k]},{command:"L",values:[0,.5*k]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[0,.5*k]},{command:"L",values:[.5*g,k]},{command:"L",values:[.5*g,m]},{command:"L",values:[0,m-.5*k]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[.5*g,k]},{command:"L",values:[.5*g,m]},{command:"L",values:[g,m-.5*k]},{command:"L",values:[g,.5* k]},{command:"Z",values:[]}]}]};a.getCylinderShapes=function(m,k){var w=k?a.SymbolSizeDefaults.tallSymbolWidth:m;k=k?4:6;w=w<=a.SymbolSizeDefaults.size?w-.5*k:w-k;k=.5*w;const g=.15*w;m-=g;return[{type:"ellipse",cx:.5*w,cy:m,rx:k,ry:g},{type:"path",path:[{command:"M",values:[0,g]},{command:"L",values:[0,m]},{command:"L",values:[w,m]},{command:"L",values:[w,g]},{command:"Z",values:[]}]},{type:"ellipse",cx:.5*w,cy:g,rx:k,ry:g}]};a.getDiamondShapes=function(m){var k=m;k=km?E*=.75:1{f=f.data;const z=f.width,B= f.height,x=z/B;let N=h;u&&(N=Math.min(N,Math.max(z,B)));return{image:f,width:1>=x?Math.ceil(N*x):N,height:1>=x?N:Math.ceil(N/x)}}):Promise.reject(new k("renderUtils: imageDataSize","href not provided."))}const r=E.createProjector();a.renderOnce=y;a.renderSymbol=function(q,h,u){const f=Math.ceil(h[0]),z=Math.ceil(h[1]);if(!q.some(B=>!!B.length))return null;h=u?.node||document.createElement("div");null!=u.opacity&&(h.style.opacity=u.opacity.toString());null!=u.effectView&&(h.style.filter=p.getCSSFilterFromEffectList(u.effectView)); y(h,()=>F.renderSVG(q,f,z,u));return h};a.tintImageWithColor=function(q,h,u,f,z){return l(q,h,z).then(B=>{const x=B.width??h,N=B.height??h;var J;if(J=B.image)J=u&&"ignore"!==f?"multiply"===f&&255===u.r&&255===u.g&&255===u.b&&1===u.a?!1:!0:!1;if(J){var I=B.image.width,d=B.image.height;w("edge")&&/\.svg$/i.test(q)&&(--I,--d);J=Math.ceil(x);var v=Math.ceil(N);var O=document.createElement("canvas");O.width=J;O.height=v;O.style.width=J+"px";O.style.height=v+"px";O=O.getContext("2d");O.clearRect(0,0,J, v);J=O;J.drawImage(B.image,0,0,I,d,0,0,x,N);v=J.getImageData(0,0,x,N);O=[u.r/255,u.g/255,u.b/255,u.a];const H=m.toHSV(u);for(let P=0;P({url:q,width:h,height:h}))};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/symbols/support/svgUtils":function(){define("exports ../../Color ../../core/has ../../core/maybe ../../core/libs/gl-matrix-2/factories/mat2df32 ../../core/libs/gl-matrix-2/math/mat2d ./gfxUtils ../../widgets/support/widgetUtils ../../widgets/support/jsxFactory".split(" "),function(a,b,c,m,k,w,g,E,F){function p(e, n){e*=M/180;return Math.abs(n*Math.sin(e))+Math.abs(n*Math.cos(e))}function y(e){return e.map(n=>`${n.command} ${n.values.join(" ")}`).join(" ").trim()}function l(e,n,G,L,S){if(e){if("circle"===e.type)return F.tsx("circle",{cx:e.cx,cy:e.cy,fill:n,"fill-rule":"evenodd",r:e.r,stroke:G.color,"stroke-dasharray":G.dashArray,"stroke-dashoffset":G.dashOffset,"stroke-linecap":G.cap,"stroke-linejoin":G.join,"stroke-miterlimit":"4","stroke-width":G.width});if("ellipse"===e.type)return F.tsx("ellipse",{cx:e.cx, cy:e.cy,fill:n,"fill-rule":"evenodd",rx:e.rx,ry:e.ry,stroke:G.color,"stroke-dasharray":G.dashArray,"stroke-linecap":G.cap,"stroke-linejoin":G.join,"stroke-miterlimit":"4","stroke-width":G.width});if("rect"===e.type)return F.tsx("rect",{fill:n,"fill-rule":"evenodd",height:e.height,stroke:G.color,"stroke-dasharray":G.dashArray,"stroke-linecap":G.cap,"stroke-linejoin":G.join,"stroke-miterlimit":"4","stroke-width":G.width,width:e.width,x:e.x,y:e.y});if("image"===e.type)return F.tsx("image",{alt:S||"image", height:e.height,href:e.src,preserveAspectRatio:"none",width:e.width,x:e.x,y:e.y});if("path"===e.type)return e="string"!==typeof e.path?y(e.path):e.path,F.tsx("path",{d:e,fill:n,"fill-rule":"evenodd",stroke:G.color,"stroke-dasharray":G.dashArray,"stroke-linecap":G.cap,"stroke-linejoin":G.join,"stroke-miterlimit":"4","stroke-width":G.width});if("text"===e.type)return m.assertIsSome(L),F.tsx("text",{"dominant-baseline":L.dominantBaseline,fill:n,"fill-rule":"evenodd","font-family":L.font.family,"font-size":L.font.size, "font-style":L.font.style,"font-variant":L.font.variant,"font-weight":L.font.weight,kerning:L.kerning,rotate:L.rotate,stroke:G.color,"stroke-dasharray":G.dashArray,"stroke-linecap":G.cap,"stroke-linejoin":G.join,"stroke-miterlimit":"4","stroke-width":G.width,"text-anchor":L.align,"text-decoration":L.decoration,"text-rendering":H,x:e.x,y:e.y},e.text)}return null}function r(e){const n={fill:"none",pattern:null,linearGradient:null};if(e)if("type"in e&&"pattern"===e.type){var G=`patternId-${++O}`;n.fill= `url(#${G})`;n.pattern={id:G,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}}}else"type"in e&&"linear"===e.type?(G=`linearGradientId-${++t}`,n.fill=`url(#${G})`,n.linearGradient={id:G,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map(L=>({offset:L.offset,color:L.color&&(new b(L.color)).toString()}))}):e&&(e=new b(e),n.fill=e.toString());return n}function q(e){const n={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};e&&(null!= e.width&&(n.width=e.width),e.cap&&(n.cap=e.cap),e.join&&(n.join=e.join.toString()),e.color&&(n.color=(new b(e.color)).toString()),e.dashArray&&(n.dashArray=e.dashArray),e.dashoffset&&(n.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(n.dashArray=g.getDashArray(e).join(",")||"none"));return n}function h(e,n){const G={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(e){const L=e.alignBaseline;G.align=e.align;G.dominantBaseline= "baseline"===L?"auto":"top"===L?"text-top":"bottom"===L?"hanging":L;G.decoration=e.decoration;G.kerning=e.kerning?"auto":"0";G.rotate=e.rotated?"90":"0";m.assertIsSome(n);G.font.style=n.style||"normal";G.font.variant=n.variant||"normal";G.font.weight=n.weight||"normal";G.font.size=n.size&&n.size.toString()||"10pt";G.font.family=n.family||"serif"}return G}function u(e){const {pattern:n,linearGradient:G}=e;return n?F.tsx("pattern",{height:n.height,id:n.id,patternUnits:"userSpaceOnUse",width:n.width, x:n.x,y:n.y},F.tsx("image",{height:n.image.height,href:n.image.href,width:n.image.width,x:n.image.x,y:n.image.y})):G?(e=G.stops.map((L,S)=>F.tsx("stop",{key:`${S}-stop`,offset:L.offset,"stop-color":L.color})),F.tsx("linearGradient",{gradientUnits:"userSpaceOnUse",id:G.id,x1:G.x1,x2:G.x2,y1:G.y1,y2:G.y2},e)):null}function f(e,n){if(!e||0===e.length)return null;const G=[];for(const L of e){const {shape:S,fill:T,stroke:ea,font:V}=L;e=r(T);const ca=q(ea),ja="text"===S.type?h(S,V):null;(e=l(S,e.fill,ca, ja))&&G.push(e)}return F.tsx("mask",{id:n,maskUnits:"userSpaceOnUse"},F.tsx("g",null,G))}function z(e,n,G,L,S){w.scale(e,w.identity(e),[n,G]);e[4]=e[4]*n-L*n+L;e[5]=e[5]*G-S*G+S;return e}function B(e,n){if(D&&"left"in D){null!=D.left&&D.left>e&&(D.left=e);if(null==D.right||D.rightn)D.top=n;if(null==D.bottom||D.bottom=L&&(e={action:e,args:n.slice(0,n.length-n.length%L)},G.push(e),x(e)):(e={action:e,args:[]},G.push(e),x(e)))}function J(e){const n={x:0,y:0,width:0,height:0};if("circle"===e.type)n.x=e.cx- e.r,n.y=e.cy-e.r,n.width=2*e.r,n.height=2*e.r;else if("ellipse"===e.type)n.x=e.cx-e.rx,n.y=e.cy-e.ry,n.width=2*e.rx,n.height=2*e.ry;else if("image"===e.type||"rect"===e.type)n.x=e.x,n.y=e.y,n.width=e.width,n.height=e.height;else if("path"===e.type){{const S=("string"!==typeof e.path?y(e.path):e.path).match(K),T=[];D={};A={};if(S){e="";var G=[],L=S.length;for(let ea=0;eaG?n:G;let U=1,ba=1;isNaN(Q)||(1n||ha>G)&&(ja=Z/n>ha/G,n=(ja?n:G)/(ja?Z:ha),w.multiply(ea, ea,z(ca,n,n,S,e)));T&&(n=w.multiply,G=T%360*Math.PI/180,w.rotate(ca,w.identity(ca),G),T=Math.cos(G),G=Math.sin(G),Z=ca[4],ha=ca[5],ca[4]=Z*T-ha*G+e*G-S*T+S,ca[5]=ha*T+Z*G-S*G-e*T+e,n.call(w,ea,ea,ca));V&&(T=w.multiply,n=V[0],V=V[1],V=w.translate(ca,w.identity(ca),[n,V]),T.call(w,ea,ea,V));return`matrix(${ea[0]},${ea[1]},${ea[2]},${ea[3]},${ea[4]},${ea[5]})`}function v(e,n,G){e=e?.effects.find(V=>"bloom"===V.type);if(!e)return null;const {strength:L,radius:S}=e;e=0"bloom"===Q.type),ca=(ca.strength?ca.strength+ca.radius/2:0)/3,ca=[Math.max(n+n*ca,10),Math.max(G+G*ca,10)]);for(let Q=0;Q{"object"===O.type&&O.resource?.href||(v="water"===O.type?O.color:O.material?O.material.color: null)});return v?new c(v):null}function q(d,v){if(null==v||null==d)return d;d=d.toRgba();d[3]*=v;return new c(d)}function h(d,v,O){if(d=d.symbolLayers){var t=H=>{v=v??H??(null!=O?I:null);return q(v,O)};d.forEach(H=>{if("object"!==H.type||!H.resource?.href||v)if("water"===H.type)H.color=t(H.color);else{const P=t(null!=H.material?H.material.color:null);null==H.material?H.material=new l.Symbol3DMaterial({color:P}):H.material.color=P;null!=O&&"outline"in H&&null!=H.outline?.color&&(H.outline.color=q(H.outline.color, O))}})}}async function u(d,v){(d=d.symbolLayers)&&await k.forEach(d,async O=>f(O,v))}async function f(d,v){switch(d.type){case "extrude":d.size="number"===typeof v[2]?v[2]:0;break;case "icon":case "line":case "text":v=z(v);null!=v&&(d.size=v);break;case "path":const O=x(v,E.ONES,[d.width,void 0,d.height]);d.width=J(v[0],d.width,1,O);d.height=J(v[2],d.height,1,O);break;case "object":await B(d,v)}}function z(d){for(const v of d)if("number"===typeof v)return v;return null}async function B(d,v){const {resourceSize:O, symbolSize:t}=await N(d),H=x(v,O,t);d.width=J(v[0],t[0],O[0],H);d.depth=J(v[1],t[1],O[1],H);d.height=J(v[2],t[2],O[2],H)}function x(d,v,O){for(let t=0;3>t;t++){const H=d[t];switch(H){case "symbol-value":return d=O[t],null!=d?d/v[t]:1;case "proportional":break;default:if(H&&v[t])return H/v[t]}}return 1}async function N(d){var {computeObjectLayerResourceSize:v}=await new Promise((D,A)=>a(["./symbolLayerUtils"],D,A));v=await v(d,10);const {width:O,height:t,depth:H}=d;d=[O,H,t];let P=1;for(var K=0;3> K;K++){const D=d[K];if(null!=D){P=D/v[K];break}}for(K=0;3>K;K++)null==d[K]&&(d[K]=v[K]*P);return{resourceSize:v,symbolSize:d}}function J(d,v,O,t){switch(d){case "proportional":return O*t;case "symbol-value":return null!=v?v:O;default:return d}}const I=new c("white");b.applyColorToSymbol=function(d,v,O){if(d&&(v||null!=O))if(v&&=new c(v),m.isSymbol3D(d))h(d,v,O);else if(m.isSymbol2D(d)){if(v=v??d.color)d.color=q(v,O);null!=O&&"outline"in d&&d.outline?.color&&(d.outline.color=q(d.outline.color,O))}}; b.applyOpacityToColor=q;b.applyRotationToSymbol=function(d,v,O){d&&null!=v&&(m.isSymbol3D(d)?(d=d.symbolLayers)&&d.forEach(t=>{if(t&&"object"===t.type)switch(O){case "tilt":t.tilt=(t.tilt??0)+v;break;case "roll":t.roll=(t.roll??0)+v;break;default:t.heading=(t.heading??0)+v}}):!m.isSymbol2D(d)||"simple-marker"!==d.type&&"picture-marker"!==d.type&&"text"!==d.type||(d.angle+=v))};b.applySizesToSymbol=async function(d,v){if(d&&v){if(m.isSymbol3D(d))return u(d,v);if(m.isSymbol2D(d)&&(v=z(v),null!=v))switch(d.type){case "simple-marker":d.size= v;break;case "picture-marker":const O=d.width/d.height;1"bloom"!==v.type).map(v=>v.toJSON());return F.effectFunctionsFromJSON(d)};b.getColorFromSymbol=function(d,v){if(!d)return null;let O=null; m.isSymbol3D(d)?O=r(d):m.isSymbol2D(d)&&(O="cim"===d.type?p.getCIMSymbolColor(d):d.color?new c(d.color):null);return O?q(O,v):null};b.getIconHref=function(d){return d.resource?.href??""};b.getSymbolOutlineSize=function(d){return d?m.isSymbol3D(d)?(d=(d=d.symbolLayers?.at(-1))&&"outline"in d?d?.outline?.size:void 0,null!=d?d:0):g.px2pt(y.getStroke(d)?.width):0};b.isVolumetricSymbol=function(d){if(null==d||!("symbolLayers"in d)||null==d.symbolLayers)return!1;switch(d.type){case "point-3d":return d.symbolLayers.some(v=> "object"===v.type);case "line-3d":return d.symbolLayers.some(v=>"path"===v.type);case "polygon-3d":return d.symbolLayers.some(v=>"object"===v.type||"extrude"===v.type);default:return!1}};b.symbolHasExtrudeSymbolLayer=function(d){return null!=d&&"polygon-3d"===d.type&&d.symbolLayers.some(v=>"extrude"===v.type)};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Legend/styles/support/relationshipUtils":function(){define(["exports","../../../../symbols/support/svgUtils","../../../../symbols/support/utils", "../../../support/widgetUtils","../../../support/jsxFactory"],function(a,b,c,m,k){function w(F,p,y){const l=`${y}_arrowStart`;y=`${y}_arrowEnd`;F="left"===F;const r={markerStart:null,markerEnd:null};switch(p){case "HL":F?r.markerStart=`url(#${y})`:r.markerEnd=`url(#${l})`;break;case "LL":r.markerStart=`url(#${y})`;break;case "LH":F?r.markerEnd=`url(#${l})`:r.markerStart=`url(#${y})`;break;default:r.markerEnd=`url(#${l})`}return r}function g(F,p,y={}){const {focus:l,numClasses:r,colors:q,rotation:h}= F,{opacity:u,effectList:f,ariaLabel:z}=y;F=y.size??60;y=!!l;const B=Math.sqrt(F**2+F**2)+(y?0:5),x=[],N=[];var J=[],I=(F||75)/r;for(var d=0;d{h[u.value]={label:u.label,fill:k(u.symbol)}});p=[];for(let u=0;unull))&&"thumbnail"in n&&n.thumbnail?.url?n.thumbnail.url:G}function f(n,G=1){const L=n.a;n=c.toHSV(n);const {r:S,g:T,b:ea}=c.toRGB({h:n.h,s:n.s/G,v:100-(100-n.v)/G});return[S,T,ea,L]}function z(n){return"water"===n.type?null==n.color?null:n.color:null==n.material?.color? null:n.material.color}function B(n,G=0){var L=z(n);if(!L){if("fill"===n.type)return null;G=y.adjustColorComponentBrightness(E.defaultThematicColor.r,G);return[G,G,G,100]}n=L.toRgba();for(L=0;3>L;L++)n[L]=y.adjustColorComponentBrightness(n[L],G);return n}async function x(n,G){n=n.style;return"none"===n?null:{type:"pattern",x:0,y:0,src:await E.getPatternUrlWithColor(b.getAssetUrl(`esri/symbols/patterns/${n}.png`),G.toCss(!0)),width:5,height:5}}function N(n){return n.outline?h(n):{color:"rgba(0, 0, 0, 1)", width:1.5}}function J(n,G){n=z(n);if(!n)return null;let L;L="rgba("+(y.adjustColorComponentBrightness(n.r,G)+",");L+=y.adjustColorComponentBrightness(n.g,G)+",";L+=y.adjustColorComponentBrightness(n.b,G)+",";return L+n.a+");"}function I(n,G){G=J(n,G);if(!G)return{};if("pattern"in n&&null!=n.pattern&&"style"===n.pattern.type&&"none"===n.pattern.style)return null;const L=Math.min(n.size?g.pt2px(n.size):.75,M);return{color:G,width:L,style:"pattern"in n&&null!=n.pattern&&"style"===n.pattern.type?E.dekebabifyLineStyle(n.pattern.style): null,cap:"cap"in n?n.cap:null,join:"join"in n?"miter"===n.join?g.pt2px(2):n.join:null}}function d(n,G,L){L=null!=L?.75*L:0;return{type:"linear",x1:L?.25*L:0,y1:L?.5*L:0,x2:L||4,y2:L?.5*L:4,colors:[{color:n,offset:0},{color:G,offset:1}]}}function v(n){const G=n.depth,L=n.height;n=n.width;return 0!==n&&0!==G&&0!==L&&n===G&&null!=n&&null!=L&&n{if("icon"===Q.type||"object"===Q.type){var U="icon"===Q.type?Q.size&&g.pt2px(Q.size):0,ba=L||U?Math.ceil(Math.min(L||U,S|| A)):D;if(Q?.resource?.href){var ia=u(n,Q).then(ka=>{const R=Q?.material?.color;var X="icon"===Q.type?"multiply":"tint";return l.tintImageWithColor(ka,ba,R,X,T)}).then(ka=>{const R=ka.width,X=ka.height;ca=Math.max(ca,R);ja=Math.max(ja,X);return[{shape:{type:"image",x:0,y:0,width:R,height:X,src:ka.url},fill:null,stroke:null}]});V.push(ia)}else ia=ba,"icon"===Q.type&&Z&&L&&(ia=U/Z*ba),U="tall"===G?.symbolConfig||G?.symbolConfig?.isTall||("object"===Q.type?v(Q):!1),ca=Math.max(ca,U?e:ia),ja=Math.max(ja, ia),V.push(Promise.resolve(O(Q,ia,U)))}});const ha=[];(await Promise.allSettled(V)).forEach(Q=>{"fulfilled"===Q.status?ha.push(Q.value):Q.reason&&w.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",Q.reason)});return l.renderSymbol(ha,[ca,ja],{node:G?.node,scale:!1,opacity:G?.opacity,ariaLabel:G?.ariaLabel})}function P(n,G){const L=n.symbolLayers,S=[];n=r.isVolumetricSymbol(n);const T=t(G),ea=(G?.maxSize?g.pt2px(G.maxSize):null)||M;let V=0,ca=0,ja;L.forEach((W, Z)=>{if(W&&("line"===W.type||"path"===W.type)){var ha=[];switch(W.type){case "line":var Q=I(W,0);if(null==Q)break;var U=Q?.width||0;0===Z&&(ja=U);W=Math.min(T||U,ea);Z=0===Z?W:T?U/ja*W:W;U=Z>C/2?2*Z:C;ca=Math.max(ca,Z);V=Math.max(V,U);Q.width=Z;ha.push({shape:{type:"path",path:[{command:"M",values:[0,.5*ca]},{command:"L",values:[V,.5*ca]}]},stroke:Q});break;case "path":Q=Math.min(T||D,ea);Z=B(W,0);U=B(W,-.2);var ba=J(W,-.4);ba=ba?{color:ba,width:1}:{};if("quad"===W.profile){const ia=W.width;W=W.height; W=y.getPathSymbolShapes(ia&&W?ia/W:1,0===W,0===ia);ba={...ba,join:"bevel"};ha.push({shape:W[0],fill:U,stroke:ba},{shape:W[1],fill:U,stroke:ba},{shape:W[2],fill:Z,stroke:ba})}else ha.push({shape:y.shapes.pathSymbol3DLayer[0],fill:U,stroke:ba},{shape:y.shapes.pathSymbol3DLayer[1],fill:Z,stroke:ba});V=ca=Math.max(ca,Q)}S.push(ha)}});return Promise.resolve(l.renderSymbol(S,[V,ca],{node:G?.node,scale:n,opacity:G?.opacity,ariaLabel:G?.ariaLabel}))}async function K(n,G){const L="mesh-3d"===n.type;n=n.symbolLayers; var S=t(G);const T=G?.maxSize?g.pt2px(G.maxSize):null;S=S||D;const ea=[];let V=0,ca=0;var ja=!1;for(let U=0;Uf.name===h)}function r(h,u,f,z,B,x){const N=null!=f?.portal?f.portal:w.getDefault(),J={portal:N,url:k.urlToObject(h.baseUrl), origin:"portal-item"},I=l(u,h.data);if(!I)return Promise.reject(new m("symbolstyleutils:symbol-name-not-found",`The symbol name '${u}' could not be found`,{symbolName:u}));B=g.fromJSON(B(I,z),J);let d=I.thumbnail?.href??null;const v=I.thumbnail?.imageData;c.isDevEnvironment()&&(B=c.adjustStaticAGOUrl(B)??"",d=c.adjustStaticAGOUrl(d));const O={portal:N,url:k.urlToObject(k.removeFile(B)),origin:"portal-item"};return p.requestJSON(B,x).then(t=>{t="cimRef"===z?p.makeCIMSymbolRef(t.data):t.data;if((t= E.fromJSON(t,O))&&b.isSymbol3D(t)){if(d){const H=g.fromJSON(d,J);t.thumbnail=new y.Thumbnail({url:H})}else v&&(t.thumbnail=new y.Thumbnail({url:`data:image/png;base64,${v}`}));h.styleUrl?t.styleOrigin=new F({portal:f.portal,styleUrl:h.styleUrl,name:u}):h.styleName&&(t.styleOrigin=new F({portal:f.portal,styleName:h.styleName,name:u}))}return t})}function q(h,u,f){const z=p.Style2DUrlTemplate.replaceAll(/\{SymbolName\}/gi,h),B=null!=u.portal?u.portal:w.getDefault();return p.requestJSON(z,f).then(x=> {x=p.makeCIMSymbolRef(x.data);return E.fromJSON(x,{portal:B,url:k.urlToObject(k.removeFile(z)),origin:"portal-item"})})}a.fetchSymbolFromStyle=r;a.getStyleItemFromStyle=l;a.resolveWebStyleSymbol=function(h,u,f,z){const B=h.name;return null==B?Promise.reject(new m("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference")):h.styleName&&"Esri2DPointSymbolsStyle"===h.styleName?q(B,u,z):p.fetchStyle(h,u,z).then(x=>r(x,B,u,f,p.symbolUrlFromStyleItem,z))};Object.defineProperty(a, Symbol.toStringTag,{value:"Module"})})},"esri/core/devEnvironmentUtils":function(){define(["exports"],function(a){const b=/^devext\.arcgis\.com$/,c=/^qaext\.arcgis\.com$/,m=/^[\w-]*\.mapsdevext\.arcgis\.com$/,k=/^[\w-]*\.mapsqa\.arcgis\.com$/,w=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local\.esri\.com$/,b,c,/^jsapps\.esri\.com$/,m,k];a.adjustStaticAGOUrl=function(g,E){return g?(E=E||globalThis.location.hostname)?null!=E.match(b)||null!=E.match(m)?g.replace("static.arcgis.com","staticdev.arcgis.com"):null!=E.match(c)|| null!=E.match(k)?g.replace("static.arcgis.com","staticqa.arcgis.com"):g:g:g};a.devHostnames=w;a.isDevEnvironment=function(g){g=g||globalThis.location.hostname;return w.some(E=>null!=g?.match(E))};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureTemplates/TemplateItemGroup":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/Identifiable ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g,E){b=class extends c.IdentifiableMixin(b){constructor(F){super(F);this.label=this.items=null}get id(){return this.label}findByTemplate(F){return this.items.find(p=>p.template===F)}};a.__decorate([m.property()],b.prototype,"items",void 0);a.__decorate([m.property()],b.prototype,"label",void 0);a.__decorate([m.property()],b.prototype,"id",null);return b=a.__decorate([E.subclass("esri.widgets.FeatureTemplates.TemplateItemGroup")],b)})},"esri/widgets/support/templateUtils":function(){define(["exports"], function(a){a.getAllTemplatesForLayer=b=>{if(null==b||"object"!==typeof b)return[];const c="templates"in b&&Array.isArray(b.templates)?b.templates:[];b="types"in b&&Array.isArray(b.types)?b.types.flatMap(m=>m.templates):[];return[...c,...b]};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureTemplates/ItemList":function(){define(["exports","../support/Heading","../support/widgetUtils","../support/jsxFactory"],function(a,b,c,m){function k(p){const {headingLevel:y, items:l,...r}=p;return 0===l.length?m.tsx("div",{class:F.noMatchesMessage,key:"no-matches"},p.messages.noMatches):m.tsx("div",{class:c.classes({[F.scroller]:!0,[F.scrollerEnabled]:!!p.enableListScroll}),key:"item-container"},l.map(q=>q.items?E({...r,group:q,headingLevel:y}):g({...r,grouped:!0,item:q})))}function w(p){const {disabled:y,messages:l,filterText:r,enableListScroll:q}=p;return m.tsx("div",{class:q?void 0:F.filterContainerSticky,key:"filter"},m.tsx("calcite-input",{disabled:y,placeholder:l.filterPlaceholder, type:"search",value:r,onCalciteInputInput:h=>{h=h.currentTarget;p.onFilterChange&&p.onFilterChange(h.value)}}))}function g(p){const {disabled:y,grouped:l,identify:r,item:q,onItemMouseEnter:h,onItemMouseLeave:u,onItemSelect:f,renderIcon:z,renderCustomItem:B,renderItemContent:x,renderItemContentEnd:N,renderItemLabel:J,renderItemDescription:I,selectedItem:d}=p,v=q?`${r?.(q)||q.id}__${q.label}`:"";var O=d?`${r?.(d)||d.id}__${d.label}`:"";const t=v===O;if(p=B?.(p))return p;p=x?.(q);O=N?.(q);const H=!(!q.disabled&& !y);return m.tsx("calcite-list-item",{afterUpdate:P=>{P.selected=t},"aria-level":l?"2":"",class:c.classes({[F.item]:!0,[F.itemDisabled]:H}),"data-item":q,description:p?void 0:I?.(q)??void 0,disabled:H,key:v,label:p?void 0:J?.(q)??q.label??void 0,onmouseenter:P=>h?.(P.currentTarget["data-item"]),onmouseleave:P=>u?.(P.currentTarget["data-item"]),selected:t,tabIndex:H?-1:0,onCalciteListItemSelect:P=>{P.preventDefault();f?.(P.currentTarget["data-item"])}},m.tsx("div",{class:F.itemIcon,key:"content-start", slot:"content-start"},z?.(q)),p?m.tsx("div",{key:"content",slot:"content"},p):null,O?m.tsx("div",{class:F.itemContentEnd,key:"content-end",slot:"content-end"},O):null)}function E(p){const {disabled:y,group:l,headingLevel:r=4,selectionMode:q="none",renderCustomGroupContent:h,...u}=p;p=h?.(p);return m.tsx("div",{class:F.group,key:l.label??void 0},m.tsx(b.Heading,{class:F.groupHeader,level:r},l.label),p||m.tsx("calcite-list",{disabled:y,selectionAppearance:"border",selectionMode:q},l.items.map(f=>g({...u, disabled:y,item:f,grouped:!0}))))}const F={base:"esri-item-list",filterContainerSticky:"esri-item-list__filter-container--sticky",group:"esri-item-list__group",groupHeader:"esri-item-list__group__header",item:"esri-item-list__list-item",itemDisabled:"esri-item-list__list-item--disabled",itemIcon:"esri-item-list__list-item-icon",itemContentEnd:"esri-item-list__list-item-content-end",noMatchesMessage:"esri-item-list__no-matches-message",scroller:"esri-item-list__scroller",scrollerEnabled:"esri-item-list__scroller--enabled"}; a.ItemList=function(p){const {disabled:y,filterText:l="",id:r,messages:q,onFilterChange:h,...u}=p;return m.tsx("div",{key:r},p.filterEnabled??!0?w({disabled:y,filterText:l,id:r,messages:q,onFilterChange:h}):null,k({...u,disabled:y,enableListScroll:p.enableListScroll??!0,filterText:l,messages:q}))};a.renderGroup=E;a.renderItem=g;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/FeatureTemplates/VisibleElements":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.filter=!0}};a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"filter",void 0);return b=a.__decorate([g.subclass("esri.widgets.FeatureTemplates.VisibleElements")],b)})},"esri/widgets/Spinner":function(){define("../chunks/tslib.es6 ../core/promiseUtils ../core/reactiveUtils ../core/accessorSupport/decorators/property ../core/has ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ./Widget ./Spinner/SpinnerViewModel ./support/widgetUtils ./support/jsxFactory".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l){k=class extends F{constructor(r,q){super(r,q);this._animationDelay=500;this._animationPromise=null;this.viewModel=new p}initialize(){this.addHandles(c.watch(()=>this.visible,r=>this._visibleChange(r)))}destroy(){this._animationPromise=null}get location(){return this.viewModel.location}set location(r){this.viewModel.location=r}get view(){return this.viewModel.view}set view(r){this.viewModel.view=r}get visible(){return this.viewModel.visible}set visible(r){this.viewModel.visible= r}show(r){const {location:q,promise:h}=r??{};q&&(this.viewModel.location=q);this.visible=!0;r=()=>this.hide();h&&h.catch(()=>{}).then(r)}hide(){this.visible=!1}render(){var {visible:r}=this,{screenLocation:q}=this.viewModel;q=!!q;r={["esri-spinner--start"]:r&&q,["esri-spinner--finish"]:!r&&q};q=this._getPositionStyles();return l.tsx("div",{class:this.classes("esri-spinner",r),styles:q})}_visibleChange(r){if(r)this.viewModel.screenLocationEnabled=!0;else{var q=b.after(this._animationDelay);this._animationPromise= q;q.catch(()=>{}).then(()=>{this._animationPromise===q&&(this.viewModel.screenLocationEnabled=!1,this._animationPromise=null)})}}_getPositionStyles(){const {screenLocation:r,view:q}=this.viewModel;if(null==q||null==r)return{};const {padding:h}=q;return{left:`${r.x-h.left}px`,top:`${r.y-h.top}px`}}};a.__decorate([m.property()],k.prototype,"location",null);a.__decorate([m.property()],k.prototype,"view",null);a.__decorate([m.property({type:p})],k.prototype,"viewModel",void 0);a.__decorate([m.property()], k.prototype,"visible",null);return k=a.__decorate([E.subclass("esri.widgets.Spinner")],k)})},"esri/widgets/Spinner/SpinnerViewModel":function(){define("../../chunks/tslib.es6 ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../support/AnchorElementViewModel".split(" "),function(a,b,c,m,k,w,g){c=class extends g{constructor(E){super(E);this.visible=!1}};a.__decorate([b.property()],c.prototype,"visible", void 0);return c=a.__decorate([w.subclass("esri.widgets.Spinner.SpinnerViewModel")],c)})},"esri/widgets/support/AnchorElementViewModel":function(){define("../../chunks/tslib.es6 ../../core/Evented ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../geometry/projection".split(" "),function(a,b,c,m,k,w,g,E,F){b=class extends b.EventedAccessor{constructor(p){super(p);this.location= null;this.screenLocationEnabled=!1;this.view=null;this.addHandles([c.when(()=>{const y=this.screenLocationEnabled?this.view:null;return y?[y.size,"3d"===y.type?y.camera:y.viewpoint]:null},()=>this.notifyChange("screenLocation")),c.watch(()=>this.screenLocation,(y,l)=>{null!=y&&null!=l&&this.emit("view-change")})])}destroy(){this.view=null}get screenLocation(){const {location:p,view:y,screenLocationEnabled:l}=this;var r=y?.spatialReference;r=r?F.projectOrLoad(p,r).geometry:null;return l&&r&&y?.ready? y.toScreen(r):null}};a.__decorate([m.property()],b.prototype,"location",void 0);a.__decorate([m.property()],b.prototype,"screenLocation",null);a.__decorate([m.property()],b.prototype,"screenLocationEnabled",void 0);a.__decorate([m.property()],b.prototype,"view",void 0);return b=a.__decorate([E.subclass("esri.widgets.support.AnchorElementViewModel")],b)})},"esri/widgets/Editor/css":function(){define(["exports"],function(a){a.css={base:"esri-editor",helpMessage:"esri-editor__help-message",updateActions:"esri-editor__update-actions", updateActionsList:"esri-editor__update-actions-list",featureTemplatesContainer:"esri-editor__feature-templates-container",templateItemContentEnd:"esri-editor__template-item-content-end"};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/EditorViewModel":function(){define("../../chunks/tslib.es6 ../../core/asyncUtils ../../core/Collection ../../core/deprecate ../../core/Error ../../core/Evented ../../core/handleUtils ../../core/Logger ../../core/maybe ../../core/promiseUtils ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../core/support/UpdatingHandles ../../layers/GraphicsLayer ../../layers/support/editableLayers ../../layers/support/layerUtils ../../portal/support/urlUtils ../../views/interactive/sketch/SketchOptions ../../views/interactive/snapping/SnappingManager ../../views/interactive/snapping/SnappingOptions ../Attachments/AttachmentsViewModel ./CreateFeaturesWorkflow ./UpdateWorkflow ./workflowUtils ./support/EditorItem ../FeatureTemplates/FeatureTemplatesViewModel ../Sketch/SketchViewModel ../Spinner/SpinnerViewModel".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O,t,H,P,K,D){function A(e,n,G){E.getLogger("esri.widgets.Editor.EditorViewModel").error(new k(e,n,G))}function M(e,n){return e?.find(G=>G.layer===n)}const C=["create-features","update"];w=class extends w.EventedAccessor{constructor(e){super(e);this._sketchEventListenerHandle=null;this._sketchGraphicsLayer=new f({listMode:"hide",internal:!0});this._updateItemsTask=this._snappingManager=null;this._updatingHandles=new u.UpdatingHandles;this._featureTemplatesViewModelLocked= !1;this.activeWorkflow=null;this._activityQueue=new c;this.editorItems=new c;this.failures=[];this.hideTemplatesForInactiveLayers=!1;this.attachmentsViewModel=new d({capabilities:{editing:!0}});this.featureTemplatesViewModel=new P({disabledItemFunction:({layer:n})=>this._itemIsSuspended(n)});this.layerInfos=null;this.ownSketchViewModel=new K({layer:this._sketchGraphicsLayer});this.sketchOptions=new N;this.snappingOptions=new I({attributeRulesEnabled:!0});this.spinnerViewModel=new D;this.pageStack= [];this.showDiscardEditsPrompt=()=>Promise.resolve(!0);this._candidateCommitted=!1;this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))};this.saveWorkflow=async()=>{const {featureFormViewModel:n}=this;if(n){n.submit();if(!n.submittable||n.hasPendingSubtypeChoice)return;const G=n.getValues();if(0{const L=this.activeWorkflow;this._candidateCommitted||"update"!==L?.type||(L.data.rootFeature=n,G&&(L.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([y.watch(()=>{var e=this.view;const n=e?.map?.editableLayers;e=e?.allLayerViews?.filter(G=>!!n?.includes(G.layer));return[n,e,this.layerInfos,this.allowedWorkflows]},()=>this._updateEditorItems(),y.syncAndInitial),y.watch(()=>this.hideTemplatesForInactiveLayers,()=>this.syncFeatureTemplates()),y.on(()=> this.activeWorkflow,"cancel",()=>this.emit("workflow-cancel")),y.on(()=>this.activeWorkflow,"commit",()=>this.emit("workflow-commit")),y.on(()=>this.activeWorkflow,"complete",()=>{this.emit("workflow-commit");this._set("activeWorkflow",null)}),y.when(()=>this.view?.map,e=>e.add(this._sketchGraphicsLayer),y.initial),y.on(()=>this.editorItems,"change",()=>this._afterEditorItemsChange()),y.watch(()=>[this.canCreate,this.canUpdateVisible],()=>this._afterEditorItemsChange()),y.watch(()=>this.page,(e,n)=> {n=[...this.pageStack];if(-1===n.indexOf(e))n.push(e);else for(;n.length&&n.at(-1)!==e;)n.pop();this.pageStack=n},y.syncAndInitial),y.when(()=>"awaiting-update-feature-candidate"===this.state,()=>this._candidateCommitted=!1),y.on(()=>this.featureTemplatesViewModel,"select",async({item:e,oldItem:n})=>{var {activeWorkflow:G}=this;if(G){if("update"===G.type&&"awaiting-feature-creation-info"===G.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{this.featureTemplatesViewModel.select(n, {emit:!1});return}}if(e){G={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(n,{emit:!1}),this.startCreateFeaturesWorkflow(G);this.startCreateFeaturesWorkflowAtFeatureCreation(G)}}),y.on(()=>this.view,"key-down",e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())}),y.on(()=>this.sketchViewModel,["create","delete","update"],e=>{const {activeWorkflow:n}=this,G="update"===n?.type,L=`sketch-${e.type}`; this.emit(L,{type:L,detail:e,layer:G?n.activeWorkflow?.layer:n?.layer,parentLayer:G?n?.activeWorkflow?.parentLayer:void 0})},y.sync),y.watch(()=>this.view,e=>{this._snappingManager=F.destroyMaybe(this._snappingManager);e&&(this._snappingManager=new J.SnappingManager({view:e,options:this.snappingOptions}))},y.syncAndInitial),y.watch(()=>this.snappingOptions,e=>{this._snappingManager&&(this._snappingManager.options=e)},y.syncAndInitial)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then(()=> {this.view?.map?.remove(this._sketchGraphicsLayer);this.view=null});this._updateItemsTask=F.abortMaybe(this._updateItemsTask);this._updatingHandles.destroy();this._sketchEventListenerHandle=F.removeMaybe(this._sketchEventListenerHandle)}get allowedWorkflows(){return this._get("allowedWorkflows")}set allowedWorkflows(e){m.deprecatedProperty(E.getLogger(this),"allowedWorkflows",{replacement:"Editor.visibleElements",version:"4.29",warnOnce:!0});e&&0!==e.length||(e=[...C]);this._set("allowedWorkflows", e)}get canCreate(){return this.editorItems.some(e=>e.supportsCreateFeaturesWorkflow)}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some(e=>e.supportsUpdateWorkflow)}get canUpdateVisible(){return this.editorItems.some(e=>e.supportsUpdateWorkflow&&e.visible)}get featureTemplatesLayers(){const e=new c;for(const n of this.editorItems){const G=this.hideTemplatesForInactiveLayers&&!n.visible;!n.supportsCreateFeaturesWorkflow||n.isTable||G||e.push(n.layer)}return e}get editableItems(){m.deprecatedProperty(E.getLogger(this), "editableItems",{replacement:"editorItems",version:"4.29",warnOnce:!0});return this.editorItems.map(e=>{const {capabilities:n,disabled:G,hasInvalidFormTemplate:L,layer:S}=e;e=[];const T=n.create,ea=n.update,V=n.delete;T.enabled&&e.push("create");ea.enabled&&e.push("update");V.enabled&&e.push("delete");return{layer:S,supports:e,suspended:G,attributeUpdatesEnabled:ea.attributes,geometryUpdatesEnabled:ea.geometry,attachmentsOnCreateEnabled:T.attachments.enabled,attachmentsOnUpdateEnabled:ea.attachments.enabled, hasInvalidFormTemplate:L,hasAttachments:n.attachments.enabled}})}get featureFormViewModel(){const {activeWorkflow:e}=this;return"update"===e?.type?e.activeFeatureFormViewModel:"create-features"===e?.type?e.featureFormViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get sketchViewModel(){const {activeWorkflow:e}=this;return"update"===e?.type?e.activeSketchViewModel:"create-features"===e?.type?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled"; var e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";({activeWorkflow:e}=this);return e?.stepId?"update"===e.type&&e.activeWorkflow?.stepId?e.activeWorkflow.stepId:e.stepId:"ready"}get syncing(){return 0 !this.updating);if(!this.canCreate)throw new k("editing:unsupported-workflow","Creating features is unsupported or disabled.");const G=this._createUpdatingResolver();try{await this._cancelWorkflow();const L=this._createCreateFeaturesWorkflow(e,n);this._set("activeWorkflow",L);await L.start()}catch(L){this._logErrorAndCancelWorkflow(L)}finally{G.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await y.whenOnce(()=>!this.updating);const n=this._createUpdatingResolver();try{({initialFeature:e}= e);const G=e.sourceLayer=e.layer,L=G?this.findEditorItemForLayer(G):void 0;if(!L?.supportsCreateFeaturesWorkflow)throw new k("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const S=this._createCreateFeaturesWorkflow({initialFeature:e,layer:L.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",S);await S.start()}catch(G){this._logErrorAndCancelWorkflow(G)}finally{n.resolve()}}async startUpdateWorkflowAtFeatureSelection(){await y.whenOnce(()=> !this.updating);if(this.canUpdate){var e=this._createUpdatingResolver();try{await this._cancelWorkflow();const n=this._createUpdateWorkflow();this._set("activeWorkflow",n);await n.start()}catch(n){this._logErrorAndCancelWorkflow(n)}finally{e.resolve()}}else A("editing:unsupported-workflow","Update workflow is unsupported or disabled.")}async startUpdateWorkflowAtMultipleFeatureSelection(e){await y.whenOnce(()=>!this.updating);if(this.canUpdate){var n=this._createUpdatingResolver();try{await this._cancelWorkflow(); const G=this._createUpdateWorkflow("awaiting-update-feature-candidate");G.data.candidates=e;this._set("activeWorkflow",G);await G.start()}catch(G){this._logErrorAndCancelWorkflow(G)}finally{n.resolve()}}else A("editing:unsupported-workflow","Update workflow is unsupported or disabled.")}async startUpdateWorkflowAtFeatureEdit(e){await y.whenOnce(()=>!this.updating);if(this.canUpdate){var n=this._createUpdatingResolver();try{await this._cancelWorkflow();const G=this._createUpdateWorkflow("editing-existing-feature"); G.data.rootFeature=e;this._set("activeWorkflow",G);await G.start()}catch(G){this._logErrorAndCancelWorkflow(G)}finally{n.resolve()}}else A("editing:unsupported-workflow","Update workflow is unsupported or disabled.")}async deleteFeatureFromWorkflow(){const {activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveFeature():A("editing:unsupported-workflow","Deleting requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}findEditorItemForLayer(e){return this.editorItems.find(n=> n.layer===e)}itemHasInvalidFormTemplate(e){return null!=e&&!0===this.findEditorItemForLayer(e.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelLocked||(this.featureTemplatesViewModel.layers=this.featureTemplatesLayers.toArray())}async toggleUpdateWorkflow(){!this.canUpdate||this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection())}lockFeatureTemplatesViewModel(){this._featureTemplatesViewModelLocked= !0;return g.makeHandle(()=>{this._featureTemplatesViewModelLocked=!1;this.syncFeatureTemplates()})}async _getEditorItemCandidates(e){const {view:n}=this;if(!n?.map)return[];var {map:G}=n;const L=G.editableLayers.toArray()??[];G=G.allTables.toArray().filter(B.isFeatureLayer)??[];await Promise.allSettled([...L.map(S=>"subtype-group"===S.type?S.loadAll():Promise.resolve()),...G.map(S=>S.load())]);p.throwIfAborted(e);return[...L.reverse(),...G.reverse()].filter(S=>z.isEditableLayer(S)&&("mesh"!==S.geometryType|| "3d"===n.type)).flatMap(S=>"subtype-group"===S.type?S.sublayers.toArray():S)}_drainEditorItems(){this.editorItems.drain(e=>e.destroy())}async _updateEditorItems(){F.abortMaybe(this._updateItemsTask);const {view:e}=this,n=b.createTask(async G=>{if(e?.map&&e?.allLayerViews){var L=await this._getEditorItemCandidates(G);if(L.length){var S=[],T=[],ea=[],{layerInfos:V}=this;for(const ca of L){L=M(V,ca);const ja=await t.whenEditorLayerView(e,ca).catch(()=>null);(L?S:ja?T:ea).push(new H({layer:ca,layerInfo:L, layerView:ja}))}V?.length&&S.sort((ca,ja)=>{const W=V.findIndex(({layer:ha})=>ha===ca.layer),Z=V.findIndex(({layer:ha})=>ha===ja.layer);return W-Z});S=[...S,...T,...ea];G.aborted||(this._drainEditorItems(),this.editorItems.addMany(S))}else this._drainEditorItems()}});this._updatingHandles.addPromise(n.promise);this._updateItemsTask=n}_afterEditorItemsChange(){const {activeWorkflow:e}=this;this.syncFeatureTemplates();if(e){var {stepId:n}=e;"create-features"===e.type?"awaiting-feature-creation-info"!== n||this.canCreate||this._cancelWorkflow():"update"===e.type&&("awaiting-feature-to-update"===n&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===n&&!e.hasUpdatableCandidates)&&this._cancelWorkflow()}}async _cancelWorkflow(e){const n=this.activeWorkflow;n?e&&!1===e.force?(await n.cancel(e),this._set("activeWorkflow",null)):(this.emit("workflow-cancel"),this._set("activeWorkflow",null),await n.cancel(e)):e?.warnIfNoWorkflow&&A("editing:no-active-workflow","There is no active workflow to cancel.")}_createCreateFeaturesWorkflow(e, n){return v.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:n,applyEditsCallback:(G,L,S)=>this._applyEdits(G,L,S),addAttachmentsCallback:(G,L)=>this._addAttachments(G,L)})}_createUpdateWorkflow(e){return O.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,applyEditsCallback:(n,G,L)=>this._applyEdits(n,G,L),addAttachmentsCallback:(n,G)=>this._addAttachments(n,G)})}_addAttachments(e, n){n=n.map(G=>this._addAttachment(e,G.feature,G.attachment))??[];return Promise.all(n)}async _addAttachment(e,n,G){let L=null;if(!("addAttachment"in e)||null==e.capabilities?.attachment)throw new k("editor:attachments-not-supported","Adding attachments is not supported for this layer type");await this._queueOperation(async()=>L=await e.addAttachment?.(n,G).catch(S=>{throw S?.error||S;})??null);return L}async _applyEdits(e,n,G){let L=null;const S=e.url?await B.getOwningPortalUrl(e.url):null,T={returnServiceEditsOption:S&& x.parseKnownArcGISOnlineDomain(S)||RegExp("/hosted/","i").test(e.url)?void 0:"original-and-current-features",...G};await this._queueOperation(async()=>{const {view:ea}=this;if(!ea)return null;const V=await t.whenEditorLayerView(ea,e).catch(()=>null);L=await e.applyEdits(n,T);V&&await y.whenOnce(()=>!V.updating);return L});return L}_queueOperation(e){this._activityQueue.push(e);const n=(G,L)=>{G=L.indexOf(G);-1{if(null!=G&&"error"in G&&null!=G.error)throw G.error; if(null!=G&&"addFeatureResults"in G){const {addFeatureResults:L,deleteFeatureResults:S,updateFeatureResults:T}=G,ea=L.find(V=>!!V.error)||T.find(V=>!!V.error)||S.find(V=>!!V.error);if(ea)throw ea.error;}return G}).catch(G=>{A("editing:operation-error","An error occurred.",{error:G});const L={error:G,retry:()=>{n(L,this.failures);return this._queueOperation(e)},cancel:()=>{n(L,this.failures)}};this._set("failures",[...this.failures,L])}).then(()=>{n(e,this._activityQueue)})}_createUpdatingResolver(){const e= p.createResolver();this._updatingHandles.addPromise(e.promise);return e}_logErrorAndCancelWorkflow(e){const {name:n,message:G,details:L}=e;A(n??"editing:workflow-start-failed",G??void 0,L??e);this._cancelWorkflow({force:!0})}_itemIsSuspended(e){e=this.findEditorItemForLayer(e);return null!=e&&(!e.visible||e.disabled)}};a.__decorate([l.property({readOnly:!0})],w.prototype,"activeWorkflow",void 0);a.__decorate([l.property({readOnly:!0})],w.prototype,"_activityQueue",void 0);a.__decorate([l.property({value:[...C]})], w.prototype,"allowedWorkflows",null);a.__decorate([l.property({readOnly:!0})],w.prototype,"canCreate",null);a.__decorate([l.property()],w.prototype,"canCreateVisible",null);a.__decorate([l.property({readOnly:!0})],w.prototype,"canUpdate",null);a.__decorate([l.property()],w.prototype,"canUpdateVisible",null);a.__decorate([l.property()],w.prototype,"featureTemplatesLayers",null);a.__decorate([l.property()],w.prototype,"editableItems",null);a.__decorate([l.property()],w.prototype,"editorItems",void 0); a.__decorate([l.property({readOnly:!0})],w.prototype,"failures",void 0);a.__decorate([l.property()],w.prototype,"hideTemplatesForInactiveLayers",void 0);a.__decorate([l.property()],w.prototype,"attachmentsViewModel",void 0);a.__decorate([l.property()],w.prototype,"featureFormViewModel",null);a.__decorate([l.property()],w.prototype,"featureTemplatesViewModel",void 0);a.__decorate([l.property()],w.prototype,"labelOptions",null);a.__decorate([l.property()],w.prototype,"layerInfos",void 0);a.__decorate([l.property()], w.prototype,"ownSketchViewModel",void 0);a.__decorate([l.property()],w.prototype,"sketchOptions",void 0);a.__decorate([l.property()],w.prototype,"sketchViewModel",null);a.__decorate([l.property({type:I,nonNullable:!0})],w.prototype,"snappingOptions",void 0);a.__decorate([l.property()],w.prototype,"spinnerViewModel",void 0);a.__decorate([l.property()],w.prototype,"state",null);a.__decorate([l.property({readOnly:!0})],w.prototype,"syncing",null);a.__decorate([l.property()],w.prototype,"updating",null); a.__decorate([l.property()],w.prototype,"tooltipOptions",null);a.__decorate([l.property()],w.prototype,"valueOptions",null);a.__decorate([l.property()],w.prototype,"view",null);a.__decorate([l.property()],w.prototype,"pageStack",void 0);a.__decorate([l.property()],w.prototype,"showDiscardEditsPrompt",void 0);a.__decorate([l.property()],w.prototype,"_candidateCommitted",void 0);a.__decorate([l.property()],w.prototype,"page",null);a.__decorate([l.property()],w.prototype,"featureFormDisabled",null); a.__decorate([l.property()],w.prototype,"canGoBack",null);a.__decorate([l.property()],w.prototype,"shouldShowDeleteButton",null);a.__decorate([l.property()],w.prototype,"hasPendingEdits",null);return w=a.__decorate([h.subclass("esri.widgets.Editor.EditorViewModel")],w)})},"esri/layers/GraphicsLayer":function(){define("../chunks/tslib.es6 ../core/accessorSupport/decorators/property ../core/has ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ../core/support/OwningCollection ./Layer ./mixins/BlendLayer ./mixins/ScaleRangeLayer ../support/GraphicsCollection ../symbols/support/ElevationInfo".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l){c=class extends F.BlendLayer(p.ScaleRangeLayer(E)){constructor(r){super(r);this.elevationInfo=null;this.graphics=new y.GraphicsCollection;this.screenSizePerspectiveEnabled=!0;this.type="graphics";this.internal=!1}destroy(){this.removeAll();this.graphics.destroy()}add(r){this.graphics.add(r);return this}addMany(r){this.graphics.addMany(r);return this}removeAll(){this.graphics.removeAll();return this}remove(r){this.graphics.remove(r)}removeMany(r){this.graphics.removeMany(r)}on(r, q){return super.on(r,q)}graphicChanged(r){this.emit("graphic-update",r)}};a.__decorate([b.property({type:l})],c.prototype,"elevationInfo",void 0);a.__decorate([b.property(g.owningCollectionProperty(y.GraphicsCollection,"graphics"))],c.prototype,"graphics",void 0);a.__decorate([b.property({type:["show","hide"]})],c.prototype,"listMode",void 0);a.__decorate([b.property()],c.prototype,"screenSizePerspectiveEnabled",void 0);a.__decorate([b.property({readOnly:!0})],c.prototype,"type",void 0);a.__decorate([b.property({constructOnly:!0})], c.prototype,"internal",void 0);return c=a.__decorate([w.subclass("esri.layers.GraphicsLayer")],c)})},"esri/views/interactive/sketch/SketchOptions":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ./SketchLabelOptions ./SketchTooltipOptions ./SketchValueOptions".split(" "),function(a,b,c,m,k,w,g,E,F,p){b=class extends b{constructor(y){super(y); this.labels=new E;this.tooltips=new F;this.values=new p}};a.__decorate([c.property({nonNullable:!0,type:E})],b.prototype,"labels",void 0);a.__decorate([c.property({nonNullable:!0,type:F})],b.prototype,"tooltips",void 0);a.__decorate([c.property({nonNullable:!0,type:p})],b.prototype,"values",void 0);return b=a.__decorate([g.subclass("esri.views.interactive.sketch.SketchOptions")],b)})},"esri/views/interactive/sketch/SketchLabelOptions":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.enabled=!1}};a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"enabled",void 0);return b=a.__decorate([g.subclass("esri.views.interactive.sketch.SketchLabelOptions")],b)})},"esri/views/interactive/sketch/SketchTooltipOptions":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ./SketchTooltipElevationOptions ./SketchTooltipVisibleElements".split(" "), function(a,b,c,m,k,w,g,E,F){b=class extends b{constructor(p){super(p);this.forceEnabled=this.enabled=!1;this.helpMessageIcon=this.helpMessage=null;this.inputEnabled=!0;this.elevation=new E.SketchTooltipElevationOptions;this.visibleElements=new F;this.visualVariables=null;this.xyMode="auto"}get effectiveEnabled(){return this.forceEnabled||this.enabled}};a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"enabled",void 0);a.__decorate([c.property()],b.prototype,"forceEnabled",void 0); a.__decorate([c.property()],b.prototype,"effectiveEnabled",null);a.__decorate([c.property()],b.prototype,"helpMessage",void 0);a.__decorate([c.property()],b.prototype,"helpMessageIcon",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"inputEnabled",void 0);a.__decorate([c.property({type:E.SketchTooltipElevationOptions,nonNullable:!0})],b.prototype,"elevation",void 0);a.__decorate([c.property({type:F,nonNullable:!0})],b.prototype,"visibleElements",void 0);a.__decorate([c.property()], b.prototype,"visualVariables",void 0);a.__decorate([c.property()],b.prototype,"xyMode",void 0);return b=a.__decorate([g.subclass("esri.views.interactive.sketch.SketchTooltipOptions")],b)})},"esri/views/interactive/sketch/SketchTooltipElevationOptions":function(){define("exports ../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g,E){a.SketchTooltipElevationOptions=class extends c{constructor(F){super(F);this.mode="absolute-height"}toJSON(){return{mode:this.mode}}};b.__decorate([m.property({type:String,nonNullable:!0})],a.SketchTooltipElevationOptions.prototype,"mode",void 0);a.SketchTooltipElevationOptions=b.__decorate([E.subclass("esri.views.interactive.sketch.SketchTooltipElevationOptions")],a.SketchTooltipElevationOptions);Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/sketch/SketchTooltipVisibleElements":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.header=this.elevation=this.distance=this.direction=this.coordinates=this.area=!0;this.helpMessage=!1;this.totalLength=this.size=this.scale=this.rotation=this.radius=this.orientation=!0}};a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"area",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"coordinates",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype, "direction",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"distance",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"elevation",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"header",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"helpMessage",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"orientation",void 0);a.__decorate([c.property({type:Boolean, nonNullable:!0})],b.prototype,"radius",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"rotation",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"scale",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"size",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"totalLength",void 0);return b=a.__decorate([g.subclass("esri.views.interactive.sketch.SketchTooltipVisibleElements")],b)})},"esri/views/interactive/snapping/SnappingManager":function(){define("exports ../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/Evented ../../../core/has ../../../core/promiseUtils ../../../core/reactiveUtils ../../../core/accessorSupport/decorators/property ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../geometry/projection ../../../support/elevationInfoUtils ../sketch/normalizedPoint ./Settings ./SnappingDomain ./snappingFactory ./SnappingOptions ./snappingUtils ./candidates/DrapedEdgeSnappingCandidate ./candidates/EdgeSnappingCandidate ./candidates/IntersectionSnappingCandidate ./candidates/LineSnappingCandidate ./candidates/ParallelLineSnappingCandidate ./candidates/RightAngleSnappingCandidate ./candidates/RightAngleTriangleSnappingCandidate ../support/viewUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O,t){function H(A,M){return!M||null==M.direction&&null==M.distance?!0:A instanceof x.DrapedEdgeSnappingCandidate||A instanceof N.EdgeSnappingCandidate||A instanceof I.LineSnappingCandidate||A instanceof d.ParallelLineSnappingCandidate||A instanceof O.RightAngleTriangleSnappingCandidate||A instanceof v.RightAngleSnappingCandidate&&(null!=M.direction||A.selfSnappingType!==v.SelfSnappingRightAngleType.LastVertex)?!1:!0}function P(A,M){let C= -1;for(let e=0;e {const {effectiveFeatureEnabled:A,effectiveSelfEnabled:M,touchSensitivityMultiplier:C,distance:e}=this.options;return{effectiveFeatureEnabled:A,effectiveSelfEnabled:M,touchSensitivityMultiplier:C,distance:e}},()=>{this.doneSnapping();this.emit("changed")},g.sync),g.watch(()=>this.options,A=>{for(const M of this._engines)M.options=A},g.sync),g.watch(()=>({viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,snappingEnginesFactory:this.snappingEnginesFactory}),({viewReady:A,snappingEnginesFactory:M})=> this._recreateEngines(A,M),g.syncAndInitial)])}destroy(){this._destroyEngines()}get updating(){return this._engines.some(A=>A.updating)}_recreateEngines(A,M){this._destroyEngines();if(A){var {view:C,options:e}=this;this._engines=M(C,e)}}_destroyEngines(){for(const A of this._engines)A.destroy();this._engines=[]}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const {distance:A,touchSensitivityMultiplier:M}=this.options, C=A*M;return C*C}snap(A){return null!=A.scenePoint?this._snapMultiPoint(A):this._snapSinglePoint(A)}update(A){const {point:M,context:C}=A;this._removeVisualization();const e=this._currentMainCandidate;if(null==e)return M;var n=this._selectUpdateInput(A);if(null==n)return M;({spatialReference:A}=C);var G=l.project(n,A);if(null==G)return M;({view:n}=this);const {elevationInfo:L,visualizer:S}=C,T=[];G=q.fromPoint(G,n,L);const ea=e.constraint.closestTo(G);if(!this._arePointsWithinScreenThreshold(G,ea, C)||!H(e,C.drawConstraints))return this._resetSnappingState(),M;e.targetPoint=q.markAsTarget(ea);T.push(...e.hints);for(const V of this._currentOtherActiveCandidates)H(V,C.drawConstraints)&&(V.targetPoint=q.markAsTarget(ea),T.push(...V.hints));null!=S&&this.addHandles(S.draw(T,{spatialReference:A,elevationInfo:K(C),view:n,selfSnappingZ:C.selfSnappingZ}),"visualization-handle");return q.toElevationAlignedDehydratedPoint(ea,n,M,C)}doneSnapping(){this._removeVisualization();this._resetSnappingState()}_selectUpdateInput({point:A, scenePoint:M}){switch(this._currentSnappedType){case D.MAIN:return A;case D.SCENE:return M}}_resetSnappingState(){this._currentMainCandidate=null;this._currentOtherActiveCandidates=[];this._currentSnappedType=D.MAIN}_removeVisualization(){this.removeHandles("visualization-handle")}async _snapSinglePoint({point:A,context:M,signal:C}){const {view:e}=this;var {elevationInfo:n}=M;n=q.fromPoint(A,e,n);const G=await this._fetchCandidates(n,u.SnappingDomain.ALL,M,C);return this._createSnapResult(n,D.MAIN, G,e,A,M,C)}async _snapMultiPoint({point:A,scenePoint:M,context:C,signal:e}){const {view:n}=this,{coordinateHelper:G,elevationInfo:L,spatialReference:S}=C;await l.initializeProjection(M.spatialReference,S);M=l.project(M,S);var T=q.fromPoint(M,n,L);const ea=await this._fetchCandidates(T,u.SnappingDomain.FEATURE,C,e);if(0n.fetchCandidates(A,M,C,e)))).flat()}_createSnapResult(A,M,C,e,n,G,L){return{get valid(){return!w.isAborted(L)},apply:()=>{const {spatialReference:S}=G,{snappedPoint:T,hints:ea}=this._processCandidates(A,M,C,G);this._removeVisualization();null!=G.visualizer&&this.addHandles(G.visualizer.draw(ea, {spatialReference:S,elevationInfo:r.absoluteHeightElevationInfo,view:e,selfSnappingZ:G.selfSnappingZ}),"visualization-handle");return q.toElevationAlignedDehydratedPoint(T,e,n,G)}}}_processCandidates(A,M,C,e){if(1>C.length)return this.doneSnapping(),{snappedPoint:A,hints:[]};this._currentSnappedType!==M&&this._resetSnappingState();B.sortCandidatesInPlace(A,C);const n=this._currentMainCandidate;if(null!=n){var G=n instanceof J.IntersectionSnappingCandidate?0<=P(C,n.first)&&0<=P(C,n.second)?0:-1:P(C, n);if(0<=G)if(C[G]instanceof J.IntersectionSnappingCandidate){if(this._arePointsWithinScreenThreshold(A,n.targetPoint,e))return this._updateSnappingCandidate(n,M,C,e)}else return this._intersectWithOtherCandidates(G,C,A,M,e)}return this._intersectWithOtherCandidates(0,C,A,M,e)}_intersectWithOtherCandidates(A,M,C,e,n){const {coordinateHelper:G}=n,L=M[A],S=[];for(let T=0;TT[1]-ea[1]),S[0][1]C/n}function D(C,e,n,G,L,S,{spatialReference:T}){e=h.copy(M,e);e[0]+=n;e[1]+=G;e[2]+=L;return(n=P.vectorToScreenPoint(e,T,B.absoluteHeightElevationInfo,S))?d.screenDistance(n,C):Infinity}b.FeatureSnappingEngine=class extends m{get updating(){return this._snappingSources.some(C=>null==C?.valid|| !0===C.valid&&!0===C.snappingSource?.updating)||this._updatingHandles.updating}constructor(C){super(C);this.options=null;this._domain=I.SnappingDomain.FEATURE;this._updatingHandles=new z.UpdatingHandles;this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const C=F.mapCollectionAsync(()=>this.options?._effectiveFeatureSources,(e,n)=> this._createSourceInfo(e,n));this._snappingSources=C;this.addHandles([w.destroyHandle(C),F.watch(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(k.isSome)}),({rulesEnabled:e,sources:n})=>{for(const G of n)G.attributeRulesEnabled=e},F.sync)])}destroy(){this._set("options",null);this._updatingHandles.destroy()}async fetchCandidates(C,e,n,G){if(!(e&this._domain&&null!=this.options&&this.options.effectiveFeatureEnabled))return[];const L=[];e=this._computeScreenSizeDistanceParameters(C, n);for(const T of this._snappingSources){if(!T?.valid||!T.snappingSource?.layerSource?.enabled||T.layerView?.suspended)continue;const ea=T.getFetchCandidatesParameters(C,n,e);for(var S of ea)L.push(T.snappingSource.fetchCandidates(S,G).then(V=>V.filter(ca=>!this._candidateIsExcluded(T.snappingSource,ca,n.excludeFeature))))}S=(await E.allSettledValues(L)).flat();this._addRightAngleCandidates(S,C,e,n);E.throwIfAborted(G);d.sortCandidatesInPlace(C,S);return S}_addRightAngleCandidates(C,e,n,G){var L= null!=G.vertexHandle?G.vertexHandle.rightEdge?.rightVertex?.pos:null!=G.editGeometryOperations&&"polygon"===G.editGeometryOperations.data.type?G.editGeometryOperations.data.components[0]?.getFirstVertex()?.pos:null,S=null!=G.vertexHandle?G.vertexHandle.leftEdge?.leftVertex?.pos:null!=G.editGeometryOperations?G.editGeometryOperations.data.components[0]?.getLastVertex()?.pos:null,{view:T}=this;L=N.fromAnyMapPoint(L,T,G);G=N.fromAnyMapPoint(S,T,G);S=C.length;for(T=0;T=T*T+n*n&&(n=q.squaredDistance(N.asVec2(S),N.asVec2(ea))>q.squaredDistance(N.asVec2(S),N.asVec2(V))?ea:V,C=new H.RightAngleSnappingCandidate({targetPoint:N.markAsTarget(S),otherVertex:e,otherVertexType:H.OtherVertexType.NEXT, previousVertex:n,constraint:new x.VerticalHalfPlaneConstraint(e,S),objectId:C.objectId,isDraped:C.isDraped,domain:I.SnappingDomain.FEATURE}),L.push(C))}}_computeScreenSizeDistanceParameters(C,e){let n=null!=this.options?this.options.distance*("touch"===e.pointer?this.options.touchSensitivityMultiplier:1):0;return null==this.view?{x:n,y:n,z:n,distance:n}:"2d"===this.view.type?(n*=this.view.resolution,{x:n,y:n,z:n,distance:n}):this._computeScreenSizeDistanceParameters3D(C,n,this.view,e)}_computeScreenSizeDistanceParameters3D(C, e,n,G){var {spatialReference:L}=G;n.renderCoordsHelper.toRenderCoords(C,L,A);const S=n.state.camera.computeScreenPixelSizeAt(A);var T=S*n.renderCoordsHelper.unitInMeters,ea=T/p.getMetersPerUnitForSR(L);const V=T/p.getMetersPerVerticalUnitForSR(L);T=e*ea;const ca=e*V,ja=P.vectorToScreenPoint(C,L,B.absoluteHeightElevationInfo,n);L=ja?D(ja,C,ea,0,0,n,G):0;ea=ja?D(ja,C,0,ea,0,n,G):0;C=ja?D(ja,C,0,0,V,n,G):0;return{x:0===L?0:T/L,y:0===ea?0:T/ea,z:0===C?0:ca/C,distance:S*e}}_candidateIsExcluded(C,e,n){if(null== n)return!1;e=this._getCandidateObjectId(e);if(null==e)return!1;C=C.layerSource.layer;return"graphics"===C.type?n.uid===e:n.sourceLayer===C&&n.attributes&&"objectIdField"in C?n.attributes[C.objectIdField]===e:!1}_getCandidateObjectId(C){return C instanceof t.FeatureSnappingCandidate?C.objectId:null}async _createSourceInfo(C,e){const n=C.layer;n.loaded||(await n.load(),E.throwIfAborted(e));const {view:G}=this;C=await this._createFeatureSnappingSourceType(C);E.throwIfAborted(e);return null==C?new J.FeatureSnappingSourceInfo({}): new J.FeatureSnappingSourceInfo({snappingSource:C,view:G,layer:n})}async _createFeatureSnappingSourceType(C){switch(C.layer.type){case "feature":case "geojson":case "csv":case "oriented-imagery":case "subtype-group":case "wfs":return this._createFeatureSnappingSourceFeatureLayer(C);case "graphics":return this._createFeatureSnappingSourceGraphicsLayer(C);case "map-notes":return this._createFeatureSnappingSourceMapNotesLayer(C);case "scene":case "building-scene":return this._createFeatureSnappingSourceSceneLayer(C)}return null}async _createFeatureSnappingSourceSceneLayer(C){const {view:e}= this;return null==e||"3d"!==e.type?null:new ((await this._getSourceModule("scene")).SceneLayerSnappingSource)({layerSource:C,view:e})}async _createFeatureSnappingSourceFeatureLayer(C){switch(C.layer.source?.type){case "feature-layer":case "oriented-imagery":return new ((await this._getSourceModule("featureService")).FeatureServiceSnappingSource)({spatialReference:this.spatialReference,view:this.view,layerSource:C});case "memory":case "csv":case "geojson":case "wfs":if("mesh"!==C.layer.geometryType)return new ((await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource)({layerSource:C, view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(C){return new ((await this._getSourceModule("graphics")).GraphicsSnappingSource)({getGraphicsLayers:()=>[C.layer],spatialReference:this.spatialReference,view:this.view,layerSource:C})}async _createFeatureSnappingSourceMapNotesLayer(C){return new ((await this._getSourceModule("notes")).GraphicsSnappingSource)({getGraphicsLayers:()=>C.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:C})}async _getSourceModule(C){var e= this._sourceModules[C];if(null==e.loader){e=this._loadSourceModule(C);this._sourceModules[C]={module:null,loader:e};const n=await e;this._sourceModules[C]={module:n,loader:e};return n}return null==e.module?e.loader:e.module}_loadSourceModule(C){const e=this._updatingHandles;switch(C){case "featureService":return e.addPromise(new Promise((n,G)=>a(["./featureSources/FeatureServiceSnappingSource"],n,G)));case "featureCollection":return e.addPromise(new Promise((n,G)=>a(["./featureSources/FeatureCollectionSnappingSource"], n,G)));case "graphics":return e.addPromise(new Promise((n,G)=>a(["./featureSources/GraphicsSnappingSource"],n,G)));case "notes":return e.addPromise(new Promise((n,G)=>a(["./featureSources/GraphicsSnappingSource"],n,G)));case "scene":return e.addPromise(new Promise((n,G)=>a(["./featureSources/SceneLayerSnappingSource"],n,G)))}}get test(){}};c.__decorate([y.property({constructOnly:!0})],b.FeatureSnappingEngine.prototype,"spatialReference",void 0);c.__decorate([y.property({constructOnly:!0})],b.FeatureSnappingEngine.prototype, "view",void 0);c.__decorate([y.property()],b.FeatureSnappingEngine.prototype,"options",void 0);c.__decorate([y.property({readOnly:!0})],b.FeatureSnappingEngine.prototype,"updating",null);c.__decorate([y.property()],b.FeatureSnappingEngine.prototype,"_snappingSources",void 0);b.FeatureSnappingEngine=c.__decorate([r.subclass("esri.views.interactive.snapping.FeatureSnappingEngine")],b.FeatureSnappingEngine);const A=u.create(),M=u.create();Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})}, "esri/views/interactive/sketch/constraints":function(){define("exports ../../../core/arrayUtils ../../../core/mathUtils ../../../core/libs/gl-matrix-2/math/vec2 ../../../core/libs/gl-matrix-2/factories/vec2f64 ../../../chunks/vec32 ../../../core/libs/gl-matrix-2/factories/vec3f64 ../../../chunks/vec42 ../../../core/libs/gl-matrix-2/factories/vec4f64 ../../../geometry/support/geodesicConstants ../../../geometry/support/geodesicUtils ../../../geometry/support/plane ../../../chunks/sphere ../../3d/support/mathUtils ./normalizedPoint ../../support/geometry3dUtils ../../support/geometry2dUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f){function z(Y,aa){if(Y instanceof ea){var oa=[];for(const qa of Y.constraints)(Y=qa.intersect(aa))&&oa.push(Y);return t(oa)}if(aa instanceof ea)return z(aa,Y);if(Y instanceof ma)return I(Y,aa);if(aa instanceof ma)return I(aa,Y);if(H(Y)){({point:oa}=Y);if(H(aa))return w.exactEquals(oa,aa.point)?Y:void 0;aa=aa.closestTo(oa);return w.equals(aa,oa)?Y:void 0}if(P(Y)){if(H(aa))return z(aa,Y);if(P(aa))return v(u.intersectLineLikes(Y.lineLike,aa.lineLike));if(K(aa))return ta(Y, aa);if(D(aa))return v(u.intersectVerticalPlaneAndLineLike(aa.planeLike,Y.lineLike));if(A(aa))return v(u.intersectLineLikeAndVerticalCylinder(Y.lineLike,aa.center,aa.radius));if(C(aa))return v(u.intersectLineLikeAndCircle(Y.lineLike,aa));if(M(aa))return B(Y,aa);if(e(aa))return x(Y,aa)}else if(K(Y)){if(H(aa)||P(aa))return z(aa,Y);if(K(aa))return u.isClose(Y.z,aa.z)?Y:void 0;if(D(aa))return N(Y,aa);if(A(aa)){const [qa,ua]=aa.center;return new ca(h.fromValues(qa,ua,Y.z),aa.radius)}if(C(aa))return wa(Y, aa);if(M(aa))return u.isClose(aa.center[2],Y.z)?aa:void 0;if(e(aa))return J(Y,aa)}else if(D(Y)){if(H(aa)||P(aa)||K(aa))return z(aa,Y);if(D(aa))return d(u.intersectVerticalPlanes(Y.planeLike,aa.planeLike));if(A(aa))return d(u.intersectVerticalPlaneAndVerticalCylinder(Y.planeLike,aa.center,aa.radius));if(C(aa))return Aa(Y,aa);if(M(aa))return sa(Y,aa);if(e(aa))return ya(Y,aa)}else if(A(Y)){if(H(aa)||P(aa)||K(aa)||D(aa))return z(aa,Y);if(A(aa))return d(u.intersectVerticalCylinders(h.asVec2(Y.center), Y.radius,h.asVec2(aa.center),aa.radius));if(!C(aa)){if(M(aa))return oa=m.squaredDistance(h.asVec2(Y.center),h.asVec2(aa.center)),u.isClose(oa,0)&&u.isClose(Y.radius,aa.radius)||(Y=u.intersectVerticalCylinders(h.asVec2(Y.center),Y.radius,h.asVec2(aa.center),aa.radius),aa=O(Y,aa.center[2])),aa;e(aa)}}else if(C(Y)){if(H(aa)||P(aa)||K(aa)||D(aa)||A(aa))return z(aa,Y);C(aa)||(M(aa)?aa.asCircle():e(aa))}else if(M(Y)){if(H(aa)||P(aa)||K(aa)||D(aa)||A(aa)||C(aa))return z(aa,Y);if(M(aa))return u.vectorsHaveCloseZ(aa.center, Y.center)?(oa=m.squaredDistance(h.asVec2(aa.center),h.asVec2(Y.center)),u.isClose(oa,0)&&u.isClose(aa.radius,Y.radius)||(Y=u.intersectVerticalCylinders(h.asVec2(aa.center),aa.radius,h.asVec2(Y.center),Y.radius),aa=O(Y,aa.center[2]))):aa=void 0,aa;e(aa)}else if(e(Y)){if(H(aa)||P(aa)||K(aa)||D(aa)||A(aa)||M(aa))return z(aa,Y);e(aa)}}function B({lineLike:Y},{center:aa,radius:oa}){const qa=aa[2];Y=u.intersectLineLikeAndVerticalCylinder(Y,aa,oa).filter(ua=>u.isClose(ua[2],qa));return v(Y)}function x({lineLike:Y}, {sphere:aa}){return v(r.intersectLine(aa,Y.start,Y.end))}function N({z:Y},{planeLike:aa}){const [oa,qa]=aa.start,[ua,za]=aa.end,Ba=h.fromValues(oa,qa,Y);Y=h.fromValues(ua,za,Y);return aa.type===u.VerticalPlaneType.PLANE?new S(Ba,Y):new T(Ba,Y)}function J(Y,{center:aa,radius:oa}){const qa=Math.abs(aa[2]-Y.z);if(!(qa>oa)||u.isClose(qa,oa))if(Y=h.fromValues(aa[0],aa[1],Y.z),oa=Math.sqrt(oa**2-qa**2),!u.isClose(oa,0))return new ca(Y,oa)}function I(Y,aa){const {planeLike:oa,getZ:qa}=Y,ua=[];if(H(aa))Y.addIfOnTheGround(ua, u.intersectVerticalPlaneAndPoint(oa,aa.point));else if(P(aa))Y.addIfOnTheGround(ua,u.intersectVerticalPlaneAndLineLike(oa,aa.lineLike));else if(A(aa))for(const [za,Ba]of u.intersectVerticalPlaneAndVerticalCylinder(oa,aa.center,aa.radius))Y=qa(za,Ba),null!=Y&&ua.push(g.fromValues(za,Ba,Y));else if(D(aa)||aa instanceof ma)for(const [za,Ba]of u.intersectVerticalPlanes(oa,aa.planeLike))Y=qa(za,Ba)??0,ua.push(g.fromValues(za,Ba,Y));return v(ua)}function d(Y){return t(Y.map(([aa,oa])=>{const qa=h.fromValues(aa, oa,0);aa=h.fromValues(aa,oa,1);return new S(qa,aa)}))}function v(Y){return t(Y.map(aa=>aa?new G(h.fromVec3(aa)):void 0))}function O(Y,aa){return v(Y.map(([oa,qa])=>[oa,qa,aa]))}function t(Y){if(0!==Y.length)return 1===Y.length?Y[0]??void 0:new ea(Y.filter(b.isSome))}function H(Y){return Y instanceof G}function P(Y){return Y instanceof L}function K(Y){return Y instanceof ha}function D(Y){return Y instanceof U}function A(Y){return Y instanceof V}function M(Y){return Y instanceof ca}function C(Y){return Y instanceof ja}function e(Y){return Y instanceof fa}class n{intersect(Y){return z(this,Y)}closestPoints(Y){return[this.closestTo(Y)]}}class G extends n{constructor(Y){super();this.point=Y}equals(Y){return this===Y||H(Y)&&w.exactEquals(this.point,Y.point)}closestTo(){return h.clone(this.point)}}class L extends n{constructor(Y,aa,oa){super();this.start=Y;this.end=aa;this.lineLike={start:Y,end:aa,type:oa}}equals(Y){return this===Y||P(Y)&&this.lineLike.type===Y.lineLike.type&&w.exactEquals(this.start,Y.start)&&w.exactEquals(this.end, Y.end)}closestTo(Y){const aa=h.createWritable();u.projectPointToLineLike(Y,this.lineLike,aa);return aa}}class S extends L{constructor(Y,aa){super(Y,aa,f.LineType.LINE)}}class T extends L{constructor(Y,aa){super(Y,aa,f.LineType.RAY)}}class ea extends n{constructor(Y){super();this.constraints=Y}equals(Y){return this===Y||Y instanceof ea&&b.equals(this.constraints,Y.constraints,(aa,oa)=>aa.equals(oa))}closestTo(Y){let aa=Infinity,oa;for(const qa of this.constraints){const ua=qa.closestTo(Y),za=w.squaredDistance(Y, ua);zaaa===this?[]:aa.closestPoints(Y))}}class V extends n{constructor(Y,aa){super();this.center=Y;this.radius=aa}equals(Y){return this===Y||A(Y)&&this.center[0]===Y.center[0]&&this.center[1]===Y.center[1]&&this.radius===Y.radius}closestTo(Y){const aa=h.createWritable();u.projectPointToVerticalCylinder(Y,this.center,this.radius,aa);return aa}}class ca extends n{constructor(Y,aa){super();this.center=Y;this.radius= aa}equals(Y){return this===Y||M(Y)&&w.exactEquals(this.center,Y.center)&&this.radius===Y.radius}closestTo(Y){const aa=h.createWritable();u.projectPointToVerticalCylinder(Y,this.center,this.radius,aa);aa[2]=this.center[2];return aa}asCircle(){return new ja(h.clone(this.center),this.radius,h.fromValues(0,0,1))}}class ja extends n{constructor(Y,aa,oa,qa){super();this.center=Y;this.radius=aa;this.normal=oa;this.slicePlane=qa}equals(Y){return this===Y||C(Y)&&w.exactEquals(this.center,Y.center)&&w.exactEquals(this.normal, Y.normal)&&this.radius===Y.radius}closestTo(Y){const {center:aa,radius:oa}=this;l.projectPoint(this.getPlane(Z),Y,W);var qa=w.sub(W,W,aa),ua=w.squaredLength(qa);if(u.isClose(ua,0))return h.clone(Y);const za=oa/Math.sqrt(ua);ua=h.createWritable();w.scaleAndAdd(ua,aa,qa,za);({slicePlane:qa}=this);return qa&&!u.isPointInsidePlane(qa,ua)?xa(qa,this)?.closestTo(Y)??h.clone(Y):ua}getPlane(Y=l.create()){return l.fromPositionAndNormal(this.center,this.normal,Y)}}const W=g.create(),Z=l.create();class ha extends n{constructor(Y){super(); this.z=Y}equals(Y){return this===Y||K(Y)&&this.z===Y.z}closestTo(Y){return h.fromValues(Y[0],Y[1],this.z)}getPlane(Y=l.create()){w.set(Q,0,0,this.z);return l.fromPositionAndNormal(Q,g.UNIT_Z,Y)}}const Q=g.create();class U extends n{constructor(Y,aa,oa){super();this.start=Y;this.end=aa;this.planeLike={start:h.asVec2(Y),end:h.asVec2(aa),type:oa}}equals(Y){return this===Y||D(Y)&&this.planeLike.type===Y.planeLike.type&&w.exactEquals(this.start,Y.start)&&w.exactEquals(this.end,Y.end)}closestTo(Y){const aa= h.createWritable();u.projectPointToVerticalPlane(Y,this.planeLike,aa);return aa}closestEndTo(Y){const {start:aa,end:oa}=this.planeLike;return 0{const Y=l.create();return(aa,oa)=>{const {start:qa,end:ua}=aa;if(u.vectorsHaveCloseZ(qa,ua)&&u.isClose(qa[2],oa.z))return aa;aa=h.createWritable();if(l.intersectLine(oa.getPlane(Y),qa,ua,aa))return new G(aa)}})(),xa=(()=>{const Y=F.create(),aa=g.create(),oa=g.create();return(qa,ua,za)=>{const {normal:Ba,center:Ea, radius:Fa}=ua;q.tangentFrame(Ba,aa,oa);const Ga=l.getNormal(qa);var Da=Fa*w.dot(Ga,aa),Ca=Fa*w.dot(Ga,oa);E.set(Y,Ea[0],Ea[1],Ea[2],1);const Ja=E.dot(qa,Y),Ha=Math.hypot(Da,Ca),Ia=u.isClose(Ha,0);if(u.isClose(l.distance(qa,Ea),0)){if(Ia)return ua;if(u.isClose(Fa,0))return!za||u.isPointInsidePlane(za,Ea)?new G(h.clone(Ea)):void 0;w.cross(aa,Ga,Ba);w.normalize(aa,aa);Da=[];Ca=g.clone(Ea);w.scaleAndAdd(Ca,Ca,aa,Fa);za&&!u.isPointInsidePlane(za,Ca)||Da.push(Ca);Ca=g.clone(Ea);w.scaleAndAdd(Ca,Ca,aa,-Fa); za&&!u.isPointInsidePlane(za,Ca)||Da.push(Ca);return v(Da)}if(!(Ia||(qa=-Ja/Ha,1{const Y=l.create();return(aa,oa)=>xa(aa.getPlane(Y),oa, oa.slicePlane)})(),sa=(()=>{const Y=l.create();return(aa,{center:oa,radius:qa})=>{qa=u.intersectVerticalPlaneAndVerticalCylinder(aa.planeLike,oa,qa);oa=oa[2];aa.getSlicePlane(Y);aa=[];for(const [ua,za]of qa)qa=[ua,za,oa],u.isPointInsidePlane(Y,qa)&&aa.push(qa);return v(aa)}})(),Aa=(()=>{const Y=l.create(),aa=l.create();return(oa,qa)=>xa(oa.getPlane(Y),qa,oa.getSlicePlane(aa))})(),ya=(()=>{const Y=l.create();return(aa,{center:oa,radius:qa})=>{var ua=aa.getPlane(Y);const za=l.signedDistance(ua,oa); var Ba=Math.abs(za);if(!(Ba>qa)||u.isClose(Ba,qa)){qa=Math.sqrt(qa**2-za**2);if(u.isClose(qa,0))return aa=h.createWritable(),l.projectPoint(ua,oa,aa),new G(aa);Ba=h.createWritable();ua=g.clone(l.getNormal(ua));w.scaleAndAdd(Ba,oa,ua,za);return new ja(Ba,qa,ua,aa.getSlicePlane())}}})();a.CircleConstraint=ja;a.Constraint=n;a.CoordinateConstraint=ra;a.DrapedLineConstraint=ma;a.GeodesicConstraint=pa;a.HorizontalCircleConstraint=ca;a.HorizontalPlaneConstraint=ha;a.LineConstraint=S;a.LineLikeConstraint= L;a.PointConstraint=G;a.RayConstraint=T;a.SetConstraint=ea;a.SphereConstraint=fa;a.VerticalCylinderConstraint=V;a.VerticalHalfPlaneConstraint=X;a.VerticalPlaneConstraint=da;a.VerticalPlaneLikeConstraint=U;a.constraintOrSet=t;a.isPoint=H;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/geometry/support/plane":function(){define("exports ../../core/mathUtils ../../chunks/vec32 ../../core/libs/gl-matrix-2/factories/vec3f64 ../../chunks/vec42 ./vector ./vectorStacks ../../views/3d/support/mathUtils".split(" "), function(a,b,c,m,k,w,g,E){function F(H=d){return[H[0],H[1],H[2],H[3]]}function p(H,P){return y(P[0],P[1],P[2],P[3],H)}function y(H,P,K,D,A=F()){A[0]=H;A[1]=P;A[2]=K;A[3]=D;return A}function l(H,P,K){var D=P[0]*P[0]+P[1]*P[1]+P[2]*P[2];D=1E-5K)return!1;P(B,D);let C=A,e=!1;for(;CMath.abs(c.dot(J,I));if(!e)return 0=== D&&1===A&&2===M?!1:q(H,P,K,0,1,2);r(B,x,N,H);return!0}function h(H,P,K){H=c.scale(g.sv3d.get(),H,c.dot(H,P));c.subtract(K,P,H);return K}function u(H,P){return c.dot(H,P)+H[3]}function f(H,P,K,D,A){const M=c.dot(H,K);if(0===M)return!1;H=-(c.dot(H,P)+H[3])/M;D&v.CLAMP&&(H=b.clamp(H,0,1));if(!(D&v.INFINITE_MIN)&&0>H||!(D&v.INFINITE_MAX)&&1H&&0<=K)return!1;if(-1E-6K)return 0H||0>K)&&!(0>H&&0>K))return!0;H/=K;0P.c0&&(P.c0=H);return P.c0<=P.c1};a.clipInfinite=function(H,P){const K=c.dot(H,P.ray.direction);H=-u(H,P.ray.origin); if(-1E-6K)return 0P.c0&&(P.c0=H);return P.c0<=P.c1};a.copy=p;a.create=F;a.distance=function(H,P){return Math.abs(u(H,P))};a.equals=k;a.exactEquals=z;a.fromArray=function(H,P,K=!0){const D=P.length/3;return q(H,(A,M)=>c.set(A,P[3*M],P[3*M+1],P[3*M+2]),K?D-1:D)};a.fromManyPoints=q;a.fromNormalAndOffset=function(H,P,K){c.copy(K,H);K[3]=P;return K};a.fromPoints=r;a.fromPositionAndNormal=l;a.fromValues=y;a.fromVectorsAndPoint=function(H,P,K,D){c.cross(N,P,H);return l(K, N,D)};a.getNormal=function(H){return H};a.intersectLine=function(H,P,K,D){K=c.subtract(g.sv3d.get(),K,P);return f(H,P,K,O,D)};a.intersectLineSegment=function(H,P,K){return f(H,P.origin,P.vector,v.NONE,K)};a.intersectLineSegmentClamp=function(H,P,K){return f(H,P.origin,P.vector,v.CLAMP,K)};a.intersectRay=function(H,P,K){return null!=P?f(H,P.origin,P.direction,t,K):!1};a.isPointInside=function(H,P){return 0<=u(H,P)};a.negate=function(H,P){P[0]=-H[0];P[1]=-H[1];P[2]=-H[2];P[3]=-H[3];return P};a.projectPoint= function(H,P,K){const D=c.scale(g.sv3d.get(),H,-H[3]);P=c.subtract(g.sv3d.get(),P,D);H=h(H,P,g.sv3d.get());c.add(K,H,D);return K};a.projectPointLocal=function(H,P,K,D){var A=g.sv3d.get(),M=g.sv3d.get();E.tangentFrame(H,A,M);P=c.subtract(g.sv3d.get(),K,P);A=w.projectPointSignedLength(A,P);M=w.projectPointSignedLength(M,P);H=w.projectPointSignedLength(H,P);return c.set(D,A,M,H)};a.projectVector=h;a.setOffsetFromPoint=function(H,P,K){P!==H&&p(H,P);H[3]=-c.dot(H,K);return H};a.signedDistance=u;a.up=d; a.wrap=function(H=d[0],P=d[1],K=d[2],D=d[3]){return y(H,P,K,D,g.sv4d.get())};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/geometry/support/vector":function(){define(["exports","../../core/mathUtils","../../chunks/vec32","../../core/libs/gl-matrix-2/factories/vec3f64"],function(a,b,c,m){const k=m.create(),w=m.create();a.angle=function(g,E){g=c.dot(g,E)/(c.length(g)*c.length(E));return-b.acosClamped(g)};a.angleAroundAxis=function(g,E,F){c.normalize(k,g);c.normalize(w,E);g=c.dot(k, w);g=b.acosClamped(g);E=c.cross(k,k,w);return 0>c.dot(E,F)?2*Math.PI-g:g};a.projectPoint=function(g,E,F){E=c.dot(g,E)/c.dot(g,g);return c.scale(F,g,E)};a.projectPointSignedLength=function(g,E){return c.dot(g,E)/c.length(g)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/geometry/support/vectorStacks":function(){define(["exports","../../core/VectorStack"],function(a,b){const c=b.VectorStack.createVec2f64(),m=b.VectorStack.createVec3f64(),k=b.VectorStack.createVec4f64(),w=b.VectorStack.createMat3f64(), g=b.VectorStack.createMat4f64();b=b.VectorStack.createQuatf64();a.sm3d=w;a.sm4d=g;a.sq4d=b;a.sv2d=c;a.sv3d=m;a.sv4d=k;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/core/VectorStack":function(){define("exports ./has ./nextTick ./libs/gl-matrix-2/factories/mat3f64 ./libs/gl-matrix-2/factories/mat4f64 ./libs/gl-matrix-2/factories/quatf64 ./libs/gl-matrix-2/factories/vec2f64 ./libs/gl-matrix-2/factories/vec3f64 ./libs/gl-matrix-2/factories/vec4f64".split(" "),function(a,b,c,m, k,w,g,E,F){class p{constructor(y){this._create=y;this._items=[];this._itemsPtr=0}get(){0===this._itemsPtr&&c.nextTick(()=>this._reset());this._itemsPtr>=this._items.length&&this._items.push(this._create());return this._items[this._itemsPtr++]}_reset(){const y=2*this._itemsPtr;this._items.length>y&&(this._items.length=y);this._itemsPtr=0}static createVec2f64(){return new p(g.create)}static createVec3f64(){return new p(E.create)}static createVec4f64(){return new p(F.create)}static createMat3f64(){return new p(m.create)}static createMat4f64(){return new p(k.create)}static createQuatf64(){return new p(w.create)}get test(){}} a.VectorStack=p;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/3d/support/mathUtils":function(){define(["exports","../../../core/mathUtils","../../../chunks/vec32","../../../core/libs/gl-matrix-2/factories/vec3f64"],function(a,b,c,m){const k=m.create(),w=m.create(),g=m.create(),E=m.create(),F=m.create();a.angle=function(p,y,l){p=c.normalize(E,p);y=c.normalize(F,y);const r=b.acosClamped(c.dot(p,y));return l&&(p=c.cross(g,p,y),0>c.dot(p,l))?-r:r};a.bilerp=function(p,y,l, r,q,h){p+=(y-p)*q;return p+(l+(r-l)*q-p)*h};a.cosCapped=function(p,y){return p>y?Math.cos(y):Math.cos(p)};a.fovx2fovy=function(p,y,l){return 2*Math.atan(l*Math.tan(.5*p)/y)};a.fovy2fovx=function(p,y,l){return 2*Math.atan(y*Math.tan(.5*p)/l)};a.makeOrthonormal=function(p,y,l){l=l||p;const r=c.dot(p,y);c.set(l,p[0]-r*y[0],p[1]-r*y[1],p[2]-r*y[2]);c.normalize(l,l)};a.makePiecewiseLinearFunction=function(p){const y=p.length;return l=>{if(l<=p[0][0])return p[0][1];if(l>=p[y-1][0])return p[y-1][1];let r= 1;for(;l>p[r][0];)r++;const q=p[r][0];l=(q-l)/(q-p[r-1][0]);return l*p[r-1][1]+(1-l)*p[r][1]}};a.maxScale=function(p){return Math.sqrt(Math.max(p[0]*p[0]+p[4]*p[4]+p[8]*p[8],p[1]*p[1]+p[5]*p[5]+p[9]*p[9],p[2]*p[2]+p[6]*p[6]+p[10]*p[10]))};a.midpoint3d=function(p,y){c.set(y,0,0,0);if(0u){u=Math.acos(u);const f=((1-l)*q+l*h)/Math.sin(u);h=f/h*Math.sin(l*u);c.scale(E,p,f/q*Math.sin((1-l)*u));c.scale(F,y,h);return c.add(r,E,F)}return c.lerp(r,p,y,l)};a.slerpTangent=function(p,y,l,r=m.create(),q=m.create()){const h= c.length(p),u=c.length(y);var f=c.dot(p,y)/(h*u);if(.9999999999999999>f){f=Math.acos(f);const z=Math.sin(f),B=Math.sin(l*f),x=Math.sin((1-l)*f),N=(1-l)*h+l*u,J=N/z,I=J/u*B;c.scale(E,p,J/h*x);c.scale(F,y,I);c.add(r,E,F);c.scale(E,p,1/h*(-Math.cos((1-l)*f)*f*N+x*(-h+u)));c.scale(F,y,1/u*(Math.cos(l*f)*f*N+B*(-h+u)));c.add(q,E,F);c.scale(q,q,1/z);return q}c.lerp(r,p,y,l);c.subtract(q,y,p);c.normalize(q,q);return q};a.tangentFrame=function(p,y,l){Math.abs(p[0])>Math.abs(p[1])?c.set(y,0,1,0):c.set(y,1, 0,0);c.cross(l,p,y);c.cross(y,l,p);c.normalize(l,l);c.normalize(y,y)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/chunks/sphere":function(){define("exports ../core/has ../core/Logger ../core/mathUtils ../core/libs/gl-matrix-2/math/mat4 ./vec32 ../core/libs/gl-matrix-2/factories/vec3f64 ./vec42 ../core/libs/gl-matrix-2/factories/vec4f64 ../core/libs/gl-matrix-2/math/common ../geometry/support/Axis ../geometry/support/ray ../geometry/support/vector ../geometry/support/vectorStacks".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q){function h(){return F.create()}function u(Q,U){return E.copy(U,Q)}function f(Q,U){return F.fromValues(Q[0],Q[1],Q[2],U)}function z(Q){return Q}function B(Q){Q[0]=Q[1]=Q[2]=Q[3]=0}function x(Q,U){Q[0]=Q[1]=Q[2]=0;Q[3]=U;return Q}function N(Q){return Q[3]}function J(Q){return Q}function I(Q,U,ba,ia){return F.fromValues(Q,U,ba,ia)}function d(Q,U,ba){Q!==ba&&(ba[0]=Q[0],ba[1]=Q[1],ba[2]=Q[2]);ba[3]=Q[3]+U;return ba}function v(Q,U,ba){Q!==ba&&u(Q,ba);return ba}function O(Q, U,ba){if(null==U||!H(Q,U,V))return!1;let {t0:ia,t1:ka}=V;if(0>ia||kaia)return!1;if(ba){const {origin:R,direction:X}=U;ba[0]=R[0]+X[0]*ia;ba[1]=R[1]+X[1]*ia;ba[2]=R[2]+X[2]*ia}return!0}function t(Q,U,ba){U=l.fromPoints(U,ba);if(!H(Q,U,V))return[];const {origin:ia,direction:ka}=U,{t0:R,t1:X}=V;U=da=>{const fa=g.create();w.scaleAndAdd(fa,ia,ka,da);return M(Q,fa,fa)};return Math.abs(R-X)Q)return!1;Q=Math.sqrt(Q);ba.t0=(-X-Q)/(2*U);ba.t1=(-X+Q)/(2*U);return!0}function P(Q,U){return O(Q,U,null)}function K(Q,U,ba){if(O(Q,U,ba))return ba;Q=D(Q,U,q.sv3d.get());w.add(ba,U.origin,w.scale(q.sv3d.get(),U.direction,w.distance(U.origin,Q)/w.length(U.direction)));return ba}function D(Q,U,ba){const ia= q.sv3d.get(),ka=q.sm4d.get();w.cross(ia,U.origin,U.direction);const R=Q[3];w.cross(ba,ia,U.origin);w.scale(ba,ba,1/w.length(ba)*R);Q=e(Q,U.origin);U=r.angle(U.origin,ba);k.fromRotation(ka,U+Q,ia);w.transformMat4(ba,ba,ka);return ba}function A(Q,U,ba){if(O(Q,U,ba))return ba;l.closestPoint(U,Q,ba);return M(Q,ba,ba)}function M(Q,U,ba){U=w.subtract(q.sv3d.get(),U,Q);U=w.scale(q.sv3d.get(),U,Q[3]/w.length(U));return w.add(ba,U,Q)}function C(Q,U){U=w.subtract(q.sv3d.get(),U,Q);U=w.squaredLength(U);return Math.sqrt(Math.abs(U- Q[3]*Q[3]))}function e(Q,U){U=w.subtract(q.sv3d.get(),U,Q);U=w.length(U);Q=Q[3];return m.acosClamped(Q/(Q+Math.abs(Q-U)))}function n(Q,U,ba,ia){Q=w.subtract(ja,U,Q);switch(ba){case y.Axis.X:return ba=m.cartesianToSpherical(Q,ja)[2],w.set(ia,-Math.sin(ba),Math.cos(ba),0);case y.Axis.Y:return Q=m.cartesianToSpherical(Q,ja),ba=Q[1],Q=Q[2],U=Math.sin(ba),w.set(ia,-U*Math.cos(Q),-U*Math.sin(Q),Math.cos(ba));case y.Axis.Z:return w.normalize(ia,Q)}}function G(Q,U){U=w.subtract(W,U,Q);return w.length(U)- Q[3]}function L(Q,U,ba,ia){const ka=G(Q,U);Q=n(Q,U,y.Axis.Z,W);ba=w.scale(W,Q,ba-ka);return w.add(ia,U,ba)}function S(Q,U){U=w.squaredDistance(Q,U);Q=Q[3];return U<=Q*Q}function T(Q,U,ba=F.create()){const ia=w.distance(Q,U),ka=Q[3],R=U[3];if(ia+Rg()),y=k.create();a.closestPoint=function(l,r,q){r=m.dot(l.direction,m.subtract(q,r,l.origin));m.add(q,l.origin,m.scale(q,l.direction,r));return q};a.closestPoints=function(l,r,q,h){const u=l.direction,f=r.direction;var z=m.sub(y,r.origin,l.origin); const B=m.dot(u,f),x=m.dot(f,z);z=m.dot(u,z);const N=m.dot(u,u),J=m.dot(f,f),I=(B*z-x*N)/(N*J-B*B);m.add(q,l.origin,m.scale(y,u,(B*x+z*J)/(N*J-B*B)));m.add(h,r.origin,m.scale(y,f,I));return[q,h]};a.copy=function(l,r=g()){return F(l.origin,l.direction,r)};a.create=g;a.distance2=function(l,r){l=m.cross(w.sv3d.get(),m.normalize(w.sv3d.get(),l.direction),m.subtract(w.sv3d.get(),r,l.origin));return m.dot(l,l)};a.equals=function(l,r){return b.equals(l.origin,r.origin)&&b.equals(l.direction,r.direction)}; a.fromPoints=function(l,r,q=g()){m.copy(q.origin,l);m.subtract(q.direction,r,l);return q};a.fromValues=F;a.wrap=function(l,r){const q=p.get();q.origin=l;q.direction=r;return q};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/core/ObjectStack":function(){define(["exports","./nextTick"],function(a,b){class c{constructor(m){this._allocator=m;this._items=[];this._itemsPtr=0;this._grow()}get(){0===this._itemsPtr&&b.nextTick(()=>this._reset());this._itemsPtr===this._items.length&& this._grow();return this._items[this._itemsPtr++]}_reset(){this._items.length=Math.min(Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3072),this._items.length);this._itemsPtr=0}_grow(){for(let m=0;m{const A=w.create(),M=w.create(),C=w.create();return({start:e,end:n},{center:G,radius:L,normal:S,slicePlane:T})=>{var ea=E.fromPositionAndNormal(G,S,P);if(u(E.distance(ea,e),0)&&u(E.distance(ea,n),0)){F.tangentFrame(S,A,M);ea= (V,ca)=>{k.subtract(C,ca,G);c.set(V,k.dot(C,A),k.dot(C,M));return V};n=p.intersectLineLikeAndCircle({start:ea(x,e),end:ea(N,n),type:p.LineType.LINE},m.ZEROS,L);e=[];for(const [V,ca]of n)n=k.copy(w.create(),G),k.scaleAndAdd(n,n,A,V),k.scaleAndAdd(n,n,M,ca),T&&!f(T,n)||e.push(n);return e}S=w.create();return E.intersectLine(ea,e,n,S)?!u(k.distance(S,G),L)||T&&!f(T,S)?[]:[S]:[]}})();a.VerticalPlaneType=void 0;(function(A){A[A.PLANE=0]="PLANE";A[A.HALF_PLANE=1]="HALF_PLANE"})(a.VerticalPlaneType||(a.VerticalPlaneType= {}));const B={[a.VerticalPlaneType.PLANE]:p.LineType.LINE,[a.VerticalPlaneType.HALF_PLANE]:p.LineType.RAY},x=m.create(),N=m.create(),J=w.create(),I=w.create(),d=w.create(),v=w.create(),O=w.create(),t=w.create(),H=w.create(),P=E.create(),K={start:w.create(),end:w.create(),type:p.LineType.LINE},D={start:w.create(),end:w.create(),type:p.LineType.LINE};Object.defineProperty(a,"LineType",{enumerable:!0,get:()=>p.LineType});a.intersectLineAndPoint=q;a.intersectLineLikeAndCircle=z;a.intersectLineLikeAndVerticalCylinder= function({start:A,end:M,type:C},e,n){const G=[];M=k.subtract(J,M,A);var L=c.subtract(N,A,e);e=c.squaredLength(M);const S=2*c.dot(M,L);n=c.squaredLength(L)-n*n;n=S*S-4*e*n;0===n?(e=-S/(2*e),(C===p.LineType.LINE||0<=e)&&G.push(k.scaleAndAdd(w.create(),A,M,e))):0M+e||cam.fromValues(C,e))};a.isClose=u;a.isPointInsidePlane=f;a.pointToLineLikeDistance=l;a.pointToVerticalCylinderDistance=function(A,M,C){return c.distance(A,M)-C};a.pointToVerticalPlaneDistance=function(A,M){return l(h(K,A[2],M),A)};a.pointsInsidePlane=function(A,M){return M.filter(C=>f(A,C))};a.projectPointToLineLike=y;a.projectPointToVerticalCylinder=function(A,M,C,e=w.create()){const n=c.subtract(x,A,M),G=c.length(n);c.scaleAndAdd(e,M,n,0===G?1:C/ G);e[2]=A[2];return e};a.projectPointToVerticalPlane=function(A,M,C){return y(A,h(K,A[2],M),C)};a.vectorsHaveCloseZ=function(A,M){return u(A[2],M[2])};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/support/geometry2dUtils":function(){define(["exports","../../core/mathUtils","../../core/libs/gl-matrix-2/math/vec2","../../core/libs/gl-matrix-2/factories/vec2f64"],function(a,b,c,m){function k(r,q){return r[0]*q[1]-r[1]*q[0]}function w(r,q,h){q=c.dot(h,q)/c.squaredLength(h); return c.scale(r,h,q)}function g(r,q,h,u,f=h){c.subtract(F,u,h);c.subtract(y,q,f);w(l,y,F);return c.add(r,f,l)}function E(r,q,h,u){c.subtract(F,q,h);q=u/c.length(F);return c.scaleAndAdd(r,h,F,q)}a.LineType=void 0;(function(r){r[r.RAY=0]="RAY";r[r.LINE=1]="LINE"})(a.LineType||(a.LineType={}));const F=m.create(),p=m.create(),y=m.create(),l=m.create();a.cross=k;a.intersectCircleAndPoint=function(r,q,h){E(y,h,r,q);return b.floatEqualAbsolute(y[0],h[0])&&b.floatEqualAbsolute(y[1],h[1])?[m.clone(h)]:[]}; a.intersectLineAndPoint=function(r,q){g(y,q,r.start,r.end);return b.floatEqualAbsolute(y[0],q[0])&&b.floatEqualAbsolute(y[1],q[1])?[m.clone(q)]:[]};a.intersectLineAndRay=function(r,q){const h=r.start;var u=q.start,f=q.end;const z=c.subtract(F,r.end,h);var B=c.subtract(p,f,u);f=k(z,B);if(1E-6>=Math.abs(f))return[];u=c.subtract(y,h,u);B=k(B,u)/f;f=k(z,u)/f;if(0<=B){if(0<=f||q.type===a.LineType.LINE)return[c.scaleAndAdd(l,h,z,B)]}else if(r.type===a.LineType.LINE&&(0<=f||q.type===a.LineType.LINE))return[c.scaleAndAdd(l, h,z,B)];return[]};a.intersectLineLikeAndCircle=function(r,q,h){const u=[],f=c.subtract(F,r.end,r.start);var z=c.subtract(p,r.start,q);q=c.squaredLength(f);const B=2*c.dot(f,z);h=c.squaredLength(z)-h*h;h=B*B-4*q*h;0===h?(q=-B/(2*q),(r.type===a.LineType.LINE||0<=q)&&u.push(c.scaleAndAdd(l,r.start,f,q))):0f.layer===this.layer)}get valid(){const {_valid:f,snappingSource:z,layer:B}=this;return z&&B?f:!1}get subtypeFilter(){const {layer:f,snappingSource:z}=this;if(!r.isSubtypeGroupLayer(f)|| !f.subtypes?.length||!z)return{mode:"not-in-use",filter:null};const B=z.layerSource.sublayerSources.filter(N=>N.enabled&&N.layer.visible&&h.scaleBoundsPredicate(this.view?.scale,N.layer.effectiveScaleRange.minScale,N.layer.effectiveScaleRange.maxScale)).map(N=>N.layer.subtypeCode);if(!B.length)return{mode:"none-visible",filter:null};if(B.length===f.subtypes.length)return{mode:"all-visible",filter:null};const x=f.fieldsIndex.get(f.subtypeField)?.name??f.subtypeField;return 1===B.length?{mode:"in-use", filter:`${x} = ${B.getItemAt(0)}`}:{mode:"in-use",filter:`${x} IN (${B.join(", ")})`}}get floorFilter(){const {view:f,layer:z}=this;return f&&z?l.getFloorFilterClause({view:f,layer:z}):null}constructor(f){super(f);this._valid=this.rulesTable=this.snappingSource=this.layer=null}initialize(){if(this.snappingSource&&this.layer){var {layer:f,snappingSource:z}=this;"refresh"in f&&this.addHandles(f.on("refresh",()=>z.refresh()));this.loadRules();this.addHandles([k.watch(()=>z.updating,B=>z.layerSource.updating= B,k.syncAndInitial),k.watch(()=>z.availability,B=>z.layerSource.availability=B,k.syncAndInitial)])}else this._valid=!1}getFetchCandidatesParameters(f,z,B){if(!this.valid)return[];const {layer:x,layerView:N,floorFilter:J,rulesTable:I,subtypeFilter:d}=this;f={distance:B,mode:this.view?.type??"2d",point:f,coordinateHelper:z.coordinateHelper,returnEdge:!0,vertexMode:"all",filter:N&&"filter"in N?N.filter:null};J&&(f.filter=u(f.filter,J));if("not-in-use"!==d.mode&&"all-visible"!==d.mode){if("none-visible"=== d.mode)return[];f.filter?f.filter.where=w.sqlAnd(f.filter.where,d.mode):f.filter=new y({where:d.filter})}if(!this.attributeRulesEnabled)return[f];B=z.feature;const v="subtype-sublayer"===B?.sourceLayer?.type?B.sourceLayer.parent:B?.sourceLayer;if(I&&B&&q.isUtilityNetworkWebMap(this.view?.map)&&(r.isFeatureLayer(x)||r.isSubtypeGroupLayer(x))&&x.layerId&&(r.isFeatureLayer(v)||r.isSubtypeGroupLayer(v))&&this.view.map.utilityNetworks?.find(t=>t.isUtilityLayer(v))){if("loaded"!==I.loadStatus)return[]; z=[];var O=x.layerId;O=I.getFeatureSQL(v,B)?.[O];if(!O)return[];B=O.anyVertex;(O=O.endVertex)&&B&&O===B&&(O="");O&&z.push({...f,returnEdge:!1,vertexMode:"ends",filter:u(f.filter,O)});B&&z.push({...f,returnEdge:!1,vertexMode:"all",filter:u(f.filter,B)});return z}return[f]}async loadRules(){this._valid=null;const {layer:f,view:z,attributeRulesEnabled:B}=this;if(B&&f&&z&&q.isUtilityNetworkWebMap(z?.map)&&(r.isFeatureLayer(f)||r.isSubtypeGroupLayer(f)))try{await Promise.allSettled(z.map.utilityNetworks?.map(N=> N.load())??[]);const x=z.map.utilityNetworks?.find(N=>N.isUtilityLayer(f));x&&(this.rulesTable=await x.getRulesTable(),await this.rulesTable?.load())}catch(x){this._valid=!1;m.getLogger("esri.views.interactive.snapping.FeatureSnappingSourceInfo").error("Failed to load rules table for snapping source",f.title);return}this._valid=!0}remove(){this.destroy()}destroy(){this.snappingSource?.destroy()}};b.__decorate([g.property({constructOnly:!0})],a.FeatureSnappingSourceInfo.prototype,"layer",void 0);b.__decorate([g.property({constructOnly:!0})], a.FeatureSnappingSourceInfo.prototype,"snappingSource",void 0);b.__decorate([g.property({constructOnly:!0})],a.FeatureSnappingSourceInfo.prototype,"view",void 0);b.__decorate([g.property({value:!1})],a.FeatureSnappingSourceInfo.prototype,"attributeRulesEnabled",null);b.__decorate([g.property()],a.FeatureSnappingSourceInfo.prototype,"layerView",null);b.__decorate([g.property()],a.FeatureSnappingSourceInfo.prototype,"rulesTable",void 0);b.__decorate([g.property()],a.FeatureSnappingSourceInfo.prototype, "valid",null);b.__decorate([g.property()],a.FeatureSnappingSourceInfo.prototype,"subtypeFilter",null);b.__decorate([g.property()],a.FeatureSnappingSourceInfo.prototype,"floorFilter",null);b.__decorate([g.property()],a.FeatureSnappingSourceInfo.prototype,"_valid",void 0);a.FeatureSnappingSourceInfo=b.__decorate([p.subclass("esri.views.interactive.snapping.FeatureSnappingSourceInfo")],a.FeatureSnappingSourceInfo);Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/layers/support/floorFilterUtils":function(){define(["exports"], function(a){function b(c,m){if(!c?.length)return null;c=c.filter(k=>""!==k).map(k=>`'${k}'`);c.push("''");return`${m} IN (${c.join(",")}) OR ${m} IS NULL`}a.getFloorFilterClause=function(c){const m=c.layer;return"floorInfo"in m&&m.floorInfo?.floorField&&"floors"in c.view?b(c.view.floors,m.floorInfo.floorField):null};a.getLayerFloorFilterClause=function(c,m){return"floorInfo"in m&&m.floorInfo?.floorField?b(c,m.floorInfo.floorField):null};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})}, "esri/views/interactive/snapping/snappingUtils":function(){define("exports ../../../core/reactiveUtils ../../../core/SetUtils ../../../core/sql ../../../core/timeUtils ../../../chunks/vec32 ../../../layers/graphics/dehydratedPoint ../../../rest/support/Query ../../input/InputManager ../keybindings ../sketch/normalizedPoint ../../../webmap/utils".split(" "),function(a,b,c,m,k,w,g,E,F,p,y,l){function r(h,u){const f=h.x-u.x;h=h.y-u.y;return f*f+h*h}a.LineSegmentHintType=void 0;(function(h){h[h.TARGET= 0]="TARGET";h[h.REFERENCE=1]="REFERENCE";h[h.REFERENCE_EXTENSION=2]="REFERENCE_EXTENSION"})(a.LineSegmentHintType||(a.LineSegmentHintType={}));const q=Symbol("snapping-toggle");a.editEdgeToSnappingEdge=function(h,u,f){return{left:y.fromAnyMapPoint(h.leftVertex.pos,u,f),right:y.fromAnyMapPoint(h.rightVertex.pos,u,f)}};a.isUtilityNetworkWebMap=function(h){return l.isWebMap(h)&&"utilityNetworks"in h&&!!h.utilityNetworks?.length};a.makeFilter=function(h){return h.createQuery()};a.makeSnappingQuery=function({point:h, distance:u,returnEdge:f,vertexMode:z,coordinateHelper:{spatialReference:B},filter:x},N,J){J=null!=J?J.clone():new E({where:"1\x3d1"});if(x){J.geometry=x.geometry;J.distance=x.distance;J.spatialRelationship=x.spatialRelationship;J.where=m.sqlAnd(J.where,x.where);J.timeExtent=k.mergeTimeExtents(J.timeExtent,x.timeExtent);var I=J;var d=J.objectIds;x=x.objectIds;d=d||x?x?d?Array.from(c.intersection(new Set(d),new Set(x))):x:d:null;I.objectIds=d}return{point:g.makeDehydratedPoint(h[0],h[1],h[2],B.toJSON()), mode:N,distance:u,returnEdge:f,vertexMode:z,query:J.toJSON()}};a.objectEqual=function(h,u){const f=h.length===u.length&&h[0]===u[0]&&h[1]===u[1];switch(h.length){case 2:return f;case 3:return f&&h[2]===u[2];case 4:return f&&h[2]===u[2]&&h[3]===u[3]}return!1};a.screenDistance=function(h,u){return Math.sqrt(r(h,u))};a.setupSnappingToggleHandles=function(h,u=()=>{}){const f=b.watch(()=>({view:h.view,snappingOptions:h.snappingOptions}),({view:z,snappingOptions:B})=>{h.removeHandles(q);if(z&&B){var x= F.ViewEventPriorities.TOOL;z=[z.on("key-down",N=>{N.key!==p.snappingKeys.toggle||N.repeat||(B.enabledToggled=!0,u())},x),z.on("key-up",N=>{N.key===p.snappingKeys.toggle&&(B.enabledToggled=!1,u())},x),z.on("pointer-move",N=>{N=N.native.ctrlKey;B.enabledToggled!==N&&(B.enabledToggled=N,u())},x)];h.addHandles(z,q)}},b.syncAndInitial);h.addHandles(f)};a.sortCandidatesInPlace=function(h,u){u.sort((f,z)=>{f=w.squaredDistance(f.targetPoint,h);z=w.squaredDistance(z.targetPoint,h);return f-z})};a.squaredScreenDistance= r;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/keybindings":function(){define("exports ../../core/arrayUtils ../../core/handleUtils ../../core/MapUtils ../input/InputManager ../input/keys".split(" "),function(a,b,c,m,k,w){w={moveUp:{key:"ArrowUp",modifier:"Shift",repeats:!0},moveDown:{key:"ArrowDown",modifier:"Shift",repeats:!0},moveLeft:{key:"ArrowLeft",modifier:"Shift",repeats:!0},moveRight:{key:"ArrowRight",modifier:"Shift",repeats:!0},scaleUp:{key:"+", modifier:"Shift"},scaleDown:{key:"-",modifier:"Shift"},factorModifier:{key:w.primaryKey,continuePropagation:!0},toggleOpacity:"t",preserveAspectRatio:{key:"Shift",continuePropagation:!0},rotateIncrements:{key:"Shift",continuePropagation:!0},undo:"z",redo:"r"};class g{constructor(){this._bindings=new Map}add(F,p){return this.addToggle(F,y=>{"key-down"===y.type&&p(y)})}addToggle(F,p){const y=E.fromDefinition(F,p),l=m.getOrCreateMapValue(this._bindings,y.key,()=>[]);l.push(y);return c.makeHandle(()=> b.remove(l,y))}register(F,p=k.ViewEventPriorities.WIDGET){return c.handlesGroup([F.on("key-down",y=>this.dispatch(F.inputManager,y),p),F.on("key-up",y=>this.dispatch(F.inputManager,y),p)])}dispatch(F,p){const y=this._bindings.get(p.key);if(y)for(const l of y)l.process(F,p)}}class E{constructor(F,p,y,l,r){this.key=F;this.modifiers=p;this.repeats=y;this.continuePropagation=l;this.callback=r}process(F,p){if(!(p.key!==this.key||"repeat"in p&&p.repeat&&!this.repeats)){for(const y of this.modifiers)if(!F.isModifierKeyDown(y))return; this.continuePropagation||p.stopPropagation();this.callback(p)}}static fromDefinition(F,p){if("string"===typeof F)return new E(F,[],!1,!1,p);const {key:y,modifier:l,repeats:r,continuePropagation:q}=F;return new E(y,l?Array.isArray(l)?l:[l]:[],!!r,!!q,p)}}a.KeyBindings=g;a.mediaKeys=w;a.sketchKeys={redo:"r",undo:"z",center:"Alt",constraint:"Shift",cancel:"Escape",delete:["Backspace","Delete"],complete:"Enter",vertexAdd:"f",pan:" "};a.snappingKeys={toggle:"Control"};a.tooltipKeys={enterInputMode:"Tab", commit:"Enter",discard:"Escape",next:"Tab"};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/webmap/utils":function(){define(["exports"],function(a){a.isWebMap=function(b){return null!=b&&"object"===typeof b&&"declaredClass"in b&&"esri.WebMap"===b.declaredClass};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/candidates/DrapedEdgeSnappingCandidate":function(){define(["exports","../../sketch/constraints","../snappingUtils","./FeatureSnappingCandidate", "../hints/LineSnappingHint"],function(a,b,c,m,k){class w extends m.FeatureSnappingCandidate{constructor(g){super({...g,isDraped:!0,constraint:new b.DrapedLineConstraint(g.edgeStart,g.edgeEnd,g.getGroundElevation)})}get hints(){return[new k.LineSnappingHint(c.LineSegmentHintType.REFERENCE,this.constraint.start,this.constraint.end,this.isDraped,this.domain)]}}a.DrapedEdgeSnappingCandidate=w;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/candidates/FeatureSnappingCandidate":function(){define(["exports", "../SnappingDomain","./SnappingCandidate"],function(a,b,c){class m extends c.SnappingCandidate{constructor({targetPoint:k,objectId:w,constraint:g,isDraped:E}){super(k,g,E,b.SnappingDomain.FEATURE);this.objectId=w}}a.FeatureSnappingCandidate=m;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/candidates/SnappingCandidate":function(){define(["exports"],function(a){class b{constructor(c,m,k,w){this.targetPoint=c;this.constraint=m;this.isDraped=k;this.domain= w}}a.SnappingCandidate=b;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/hints/LineSnappingHint":function(){define("exports ../../../../core/has ../../../../core/Logger ../../../../chunks/vec32 ../SnappingDomain ./SnappingHint".split(" "),function(a,b,c,m,k,w){class g extends w.SnappingHint{constructor(E,F,p,y,l=k.SnappingDomain.ALL,r=!0,q=!0){super(y,l);this.type=E;this.lineStart=F;this.lineEnd=p;this.fadeLeft=r;this.fadeRight=q}equals(E){return E instanceof g?this.type===E.type&&m.exactEquals(this.lineStart,E.lineStart)&&m.exactEquals(this.lineEnd,E.lineEnd)&&this.fadeLeft===E.fadeLeft&&this.fadeRight===E.fadeRight:!1}get length(){return m.distance(this.lineStart,this.lineEnd)}}a.LineSnappingHint=g;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/hints/SnappingHint":function(){define(["exports"],function(a){class b{constructor(c,m){this.isDraped=c;this.domain=m}}a.SnappingHint=b;Object.defineProperty(a, Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/candidates/EdgeSnappingCandidate":function(){define(["exports","../../sketch/constraints","../snappingUtils","./FeatureSnappingCandidate","../hints/LineSnappingHint"],function(a,b,c,m,k){class w extends m.FeatureSnappingCandidate{constructor(g){super({...g,constraint:new b.LineConstraint(g.edgeStart,g.edgeEnd)})}get hints(){return[new k.LineSnappingHint(c.LineSegmentHintType.REFERENCE,this.constraint.start,this.constraint.end, this.isDraped,this.domain)]}}a.EdgeSnappingCandidate=w;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/candidates/RightAngleSnappingCandidate":function(){define("exports ../SnappingDomain ../snappingUtils ./SnappingCandidate ../hints/LineSnappingHint ../hints/RightAngleSnappingHint".split(" "),function(a,b,c,m,k,w){class g extends m.SnappingCandidate{constructor({targetPoint:E,constraint:F,previousVertex:p,otherVertex:y,otherVertexType:l,isDraped:r, selfSnappingType:q,objectId:h,domain:u}){super(E,F,r,u??b.SnappingDomain.SELF);this.previousVertex=p;this.otherVertex=y;this.otherVertexType=l;this.selfSnappingType=q??a.SelfSnappingRightAngleType.None;this.objectId=h??null}get hints(){const E=this.previousVertex,F=this.otherVertexType===a.OtherVertexType.CENTER?this.otherVertex:this.targetPoint,p=this.otherVertexType===a.OtherVertexType.CENTER?this.targetPoint:this.otherVertex;return[new k.LineSnappingHint(c.LineSegmentHintType.TARGET,F,p,this.isDraped, this.domain),new k.LineSnappingHint(c.LineSegmentHintType.REFERENCE,E,F,this.isDraped,this.domain),new w.RightAngleSnappingHint(this.previousVertex,F,p,this.isDraped,this.domain)]}}a.OtherVertexType=void 0;(function(E){E[E.NEXT=0]="NEXT";E[E.CENTER=1]="CENTER"})(a.OtherVertexType||(a.OtherVertexType={}));a.SelfSnappingRightAngleType=void 0;(function(E){E[E.None=0]="None";E[E.LastVertex=1]="LastVertex";E[E.FirstVertex=2]="FirstVertex";E[E.ExistingEdge=3]="ExistingEdge"})(a.SelfSnappingRightAngleType|| (a.SelfSnappingRightAngleType={}));a.RightAngleSnappingCandidate=g;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/hints/RightAngleSnappingHint":function(){define("exports ../../../../core/has ../../../../core/Logger ../../../../chunks/vec32 ../SnappingDomain ./SnappingHint".split(" "),function(a,b,c,m,k,w){class g extends w.SnappingHint{constructor(E,F,p,y,l=k.SnappingDomain.ALL){super(y,l);this.previousVertex=E;this.centerVertex=F;this.nextVertex= p}equals(E){return E instanceof g?m.exactEquals(this.previousVertex,E.previousVertex)&&m.exactEquals(this.centerVertex,E.centerVertex)&&m.exactEquals(this.nextVertex,E.nextVertex):!1}}a.RightAngleSnappingHint=g;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/support/viewUtils":function(){define("exports ../../../core/screenUtils ../../../core/libs/gl-matrix-2/math/vec2 ../../../chunks/vec32 ../../../core/libs/gl-matrix-2/factories/vec3f64 ../../../layers/graphics/dehydratedPoint ../../../support/elevationInfoUtils".split(" "), function(a,b,c,m,k,w,g){function E(h,u,f,z,B=k.create()){h=m.copy(y,h);h[2]=g.getConvertedElevationFromVector(z,h,u,f)||0;z.renderCoordsHelper.toRenderCoords(h,u,B);return B}function F(h,u,f,z){if("2d"===z.type)return p.x=h[0],p.y=h[1],p.spatialReference=u,z.toScreen(p);E(h,u,f,z,y);z.state.camera.projectToScreen(y,q);return b.createScreenPoint(q[0],q[1])}const p=w.makeDehydratedPoint(0,0,0,null),y=k.create(),l=b.createRenderScreenPointArray(),r=b.createRenderScreenPointArray(),q=b.createScreenPointArray(); a.anyMapPointToRender=function(h,u,f,z,B=k.create()){h=u.toXYZ(h);h[2]=g.getConvertedElevationFromVector(z,h,u.spatialReference,f)||0;z.renderCoordsHelper.toRenderCoords(h,u.spatialReference,B);return B};a.anyMapPointToScreenPoint=function(h,u,f,z){return F(u.toXYZ(h),u.spatialReference,f,z)};a.renderScreenSpaceTangent=function(h,u,f,z){f.projectToRenderScreen(h,l);f.projectToRenderScreen(u,r);c.subtract(z,r,l);c.normalize(z,z)};a.vectorToRender=E;a.vectorToScreenPoint=F;Object.defineProperty(a,Symbol.toStringTag, {value:"Module"})})},"esri/views/interactive/snapping/SelfSnappingEngine":function(){define("exports ../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/Collection ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ./LineSnapper ./ParallelLineSnapper ./RightAngleSnapper ./RightAngleTriangleSnapper ./SnappingDomain ./snappingUtils".split(" "),function(a,b,c,m,k,w,g,E,F,p,y,l,r, q,h){a.SelfSnappingEngine=class extends c{constructor(u){super(u);this.updating=!1;this._snappers=new m;this._domain=q.SnappingDomain.SELF}initialize(){this._snappers.push(new y.ParallelLineSnapper(this.view,this.options),new p.LineSnapper(this.view,this.options),new l.RightAngleSnapper(this.view,this.options),new r.RightAngleTriangleSnapper(this.view,this.options))}set options(u){this._set("options",u);for(const f of this._snappers)f.options=u}async fetchCandidates(u,f,z){if(!(f&this._domain&&this.options.effectiveSelfEnabled))return[]; f=[];for(const B of this._snappers.items)for(const x of B.snap(u,z))f.push(x);h.sortCandidatesInPlace(u,f);return f}};b.__decorate([k.property({readOnly:!0})],a.SelfSnappingEngine.prototype,"updating",void 0);b.__decorate([k.property({constructOnly:!0})],a.SelfSnappingEngine.prototype,"view",void 0);b.__decorate([k.property()],a.SelfSnappingEngine.prototype,"options",null);a.SelfSnappingEngine=b.__decorate([F.subclass("esri.views.interactive.snapping.SelfSnappingEngine")],a.SelfSnappingEngine);Object.defineProperty(a, Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/LineSnapper":function(){define("exports ../../../core/Cyclical ../../../core/quantityUtils ../../../core/libs/gl-matrix-2/factories/vec3f64 ../../../support/elevationInfoUtils ../sketch/normalizedPoint ./SnappingAlgorithm ./snappingUtils ./candidates/LineSnappingCandidate ../support/viewUtils ../../support/angularMeasurementUtils ../../support/geodesicLengthMeasurementUtils ../../support/geometry3dUtils ../../support/geometry2dUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q){function h(f,z,B,x,{spatialReference:N}){var J=y.radiansGeographicBetweenVec(z,B,N,N);if(null==J)return!1;const I=y.radiansGeographicBetweenVec(B,x,N,N);if(null==I)return!1;z=l.geodesicDistance(B,x,N);if(null==z)return!1;J=Math.abs(b.cyclicalPI.shortestSignedDiff(J,I))>Math.PI/2?b.cyclical2PI.normalize(J+Math.PI):J;y.pointFromDistanceAlongAzimuth(f,B,N,c.valueInUnit(z,"meters"),c.createAngle(J,"radians","geographic"),"geodesic");f[2]=x[2];return!0}class u extends g.SnappingAlgorithm{snapNewVertex(f, z){var B=z.editGeometryOperations.data.components[0],x=B.edges.length;const N=[];if(1>x)return N;var {spatialReference:J}=z;J=p.vectorToScreenPoint(f,J,k.absoluteHeightElevationInfo,this.view);const {view:I}=this;x=B=B.edges[x-1];do{if(this.edgeExceedsShortLineThreshold(x,z)){const d=E.editEdgeToSnappingEdge(x,I,z);this._processCandidateProposal(d.left,d.right,f,J,z,N)}x=x.leftVertex.leftEdge}while(x&&x!==B);return N}snapExistingVertex(f,z){const B=[],x=z.vertexHandle;var N=x.component;if(2>N.edges.length)return B; const {view:J}=this;var {spatialReference:I}=z;I=p.vectorToScreenPoint(f,I,k.absoluteHeightElevationInfo,J);var d=x.leftEdge,v=x.rightEdge;d&&v&&this.edgeExceedsShortLineThreshold(d,z)&&this.edgeExceedsShortLineThreshold(v,z)&&this._processCandidateProposal(w.fromAnyMapPoint(d.leftVertex.pos,J,z),w.fromAnyMapPoint(v.rightVertex.pos,J,z),f,I,z,B);d=N=N.edges[0];do d!==x.leftEdge&&d!==x.rightEdge&&this.edgeExceedsShortLineThreshold(d,z)&&(v=E.editEdgeToSnappingEdge(d,J,z),this._processCandidateProposal(v.left, v.right,f,I,z,B)),d=d.rightVertex.rightEdge;while(d&&d!==N);return B}_processCandidateProposal(f,z,B,x,N,J){const {spatialReference:I,pointer:d}=N,v=m.create();h(v,f,z,B,N)||(r.projectPointToLineLike(B,{start:f,end:z,type:q.LineType.LINE},v),v[2]=B[2]);B=w.markAsTarget(w.fromVec3(v));E.squaredScreenDistance(x,p.vectorToScreenPoint(B,I,k.absoluteHeightElevationInfo,this.view))this.squaredShortLineThreshold}isVertical(p,y,{spatialReference:l}){l=b.getMetersPerUnitForSR(l);return c.distance(k.asVec2(p),k.asVec2(y))*lf)return B;const {view:x}=this,N=p.vectorToScreenPoint(q,h.spatialReference,m.absoluteHeightElevationInfo,x);z=k.fromAnyMapPoint(u.vertices[z-1].pos,x,h);const J=k.fromAnyMapPoint(u.vertices[0].pos,x,h);f=u=u.edges[f-1];do{if(this.edgeExceedsShortLineThreshold(f,h)){const I=E.editEdgeToSnappingEdge(f,x,h);this._checkEdgeForParallelLines(I, z,q,N,h,B);this._checkEdgeForParallelLines(I,J,q,N,h,B)}f=f.leftVertex.leftEdge}while(f&&f!==u);return B}snapExistingVertex(q,h){const u=[],f=h.vertexHandle;var z=f.component;if(3>z.edges.length)return u;const {view:B}=this,x=p.vectorToScreenPoint(q,h.spatialReference,m.absoluteHeightElevationInfo,B),N=f.leftEdge,J=f.rightEdge,I=z.vertices[0],d=k.fromAnyMapPoint(I.pos,B,h),v=z.vertices[z.vertices.length-1],O=k.fromAnyMapPoint(v.pos,B,h);let t=z=z.edges[0];do{if(t!==N&&t!==J&&this.edgeExceedsShortLineThreshold(t, h)){const H=E.editEdgeToSnappingEdge(t,B,h);N&&this._checkEdgeForParallelLines(H,k.fromAnyMapPoint(N.leftVertex.pos,B,h),q,x,h,u);J&&this._checkEdgeForParallelLines(H,k.fromAnyMapPoint(J.rightVertex.pos,B,h),q,x,h,u);f===I?this._checkEdgeForParallelLines(H,O,q,x,h,u):f===v&&this._checkEdgeForParallelLines(H,d,q,x,h,u)}t=t.rightVertex.rightEdge}while(t&&t!==z);return u}_checkEdgeForParallelLines(q,h,u,f,z,B){var x=q.left;const N=q.right;y.projectPointToLine(r,k.asVec2(h),k.asVec2(x),k.asVec2(N));if(!(b.squaredDistance(r, k.asVec2(h))new F.LineSnappingHint(g.LineSegmentHintType.REFERENCE,l.edge.left,l.edge.right,this.isDraped,this.domain,l.fadeLeft,l.fadeRight))]}addReferenceLine(l){const r={edge:l,fadeLeft:!0,fadeRight:!0};this._referenceLines.forEach(q=>{b.exactEquals(l.right,q.edge.left)&&(q.fadeLeft=!1,r.fadeRight=!1);b.exactEquals(l.right,q.edge.right)&&(q.fadeRight=!1,r.fadeRight=!1);b.exactEquals(l.left,q.edge.right)&&(q.fadeRight=!1,r.fadeLeft= !1);b.exactEquals(l.left,q.edge.left)&&(q.fadeLeft=!1,r.fadeLeft=!1)});this._referenceLines.push(r)}}a.ParallelLineSnappingCandidate=y;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/hints/ParallelSnappingHint":function(){define("exports ../../../../core/has ../../../../core/Logger ../../../../chunks/vec32 ../SnappingDomain ./SnappingHint".split(" "),function(a,b,c,m,k,w){class g extends w.SnappingHint{constructor(E,F,p,y=k.SnappingDomain.ALL){super(p, y);this.lineStart=E;this.lineEnd=F}equals(E){return E instanceof g?m.exactEquals(this.lineStart,E.lineStart)&&m.exactEquals(this.lineEnd,E.lineEnd):!1}}a.ParallelSnappingHint=g;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/RightAngleSnapper":function(){define("exports ../../../core/Cyclical ../../../core/quantityUtils ../../../core/libs/gl-matrix-2/math/vec2 ../../../core/libs/gl-matrix-2/factories/vec2f64 ../../../chunks/vec32 ../../../core/libs/gl-matrix-2/factories/vec3f64 ../../../support/elevationInfoUtils ../sketch/constraints ../sketch/normalizedPoint ./SnappingAlgorithm ./snappingUtils ./candidates/RightAngleSnappingCandidate ../support/viewUtils ../../support/angularMeasurementUtils ../../support/geodesicLengthMeasurementUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u){function f(N,J,I,d,{spatialReference:v}){J=h.radiansGeographicBetweenVec(J,I,v,v);if(null==J)return!1;var O=h.radiansGeographicBetweenVec(I,d,v,v);if(null==O)return!1;O=Math.sign(b.cyclical2PI.shortestSignedDiff(J,O))*Math.PI*.5;J=c.createAngle(J+O,"radians","geographic");O=g.create();d=u.geodesicDistance(I,d,v);if(null==d)return!1;h.pointFromDistanceAlongAzimuth(O,I,v,c.valueInUnit(d,"meters"),J,"geodesic");w.subtract(N,O,I);return!0}class z extends y.SnappingAlgorithm{snapNewVertex(N, J){var I=J.editGeometryOperations.data.components[0];const d=[];if(2>I.vertices.length)return d;var {view:v}=this;v=q.vectorToScreenPoint(N,J.spatialReference,E.absoluteHeightElevationInfo,v);const O=I.vertices.at(-1);this._checkForSnappingCandidate(r.SelfSnappingRightAngleType.LastVertex,d,O.leftEdge,O,O.leftEdge.leftVertex,N,v,J);I=I.vertices[0];this._checkForSnappingCandidate(r.SelfSnappingRightAngleType.FirstVertex,d,I.rightEdge,I,I.rightEdge.rightVertex,N,v,J);return d}snapExistingVertex(N,J){const I= [];var d=J.vertexHandle;if(3>d.component.vertices.length)return I;var {view:v}=this;v=q.vectorToScreenPoint(N,J.spatialReference,E.absoluteHeightElevationInfo,v);var O=d.leftEdge;d=d.rightEdge;O?.leftVertex.leftEdge&&(O=O.leftVertex.leftEdge,this._checkForSnappingCandidate(r.SelfSnappingRightAngleType.ExistingEdge,I,O,O.rightVertex,O.leftVertex,N,v,J));d?.rightVertex.rightEdge&&(d=d.rightVertex.rightEdge,this._checkForSnappingCandidate(r.SelfSnappingRightAngleType.ExistingEdge,I,d,d.leftVertex,d.rightVertex, N,v,J));return I}_checkForSnappingCandidate(N,J,I,d,v,O,t,H){if(this.edgeExceedsShortLineThreshold(I,H)){I=this.view;d=p.fromAnyMapPoint(d.pos,I,H);v=p.fromAnyMapPoint(v.pos,I,H);I=x;if(!f(I,v,d,O,H)){const P=m.subtract(B,p.asVec2(d),p.asVec2(v));w.set(I,P[1],-P[0],0)}this._checkForSnappingCandidateAlongProjectedRay(N,J,v,d,x,O,t,H)}}_checkForSnappingCandidateAlongProjectedRay(N,J,I,d,v,O,t,H){const {spatialReference:P,pointer:K}=H;var D=m.subtract(B,p.asVec2(O),p.asVec2(d));D=m.dot(v,D)/m.squaredLength(v); const A=m.scaleAndAdd(B,p.asVec2(d),v,D);O=p.markAsTarget(p.fromValues(A[0],A[1],O[2]));l.squaredScreenDistance(t,q.vectorToScreenPoint(O,P,E.absoluteHeightElevationInfo,this.view))>this.squaredProximityThreshold(K)||this.isVertical(O,d,H)||this.isVertical(d,I,H)||(v=w.scaleAndAdd(g.create(),d,v,Math.sign(D)),J.push(new r.RightAngleSnappingCandidate({targetPoint:O,constraint:new F.VerticalHalfPlaneConstraint(d,p.fromVec3(v)),previousVertex:I,otherVertex:d,otherVertexType:r.OtherVertexType.CENTER, selfSnappingType:N,isDraped:"on-the-ground"===H.elevationInfo?.mode})))}}const B=k.create(),x=g.create();a.RightAngleSnapper=z;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/RightAngleTriangleSnapper":function(){define("exports ../../../core/libs/gl-matrix-2/math/vec2 ../../../core/libs/gl-matrix-2/factories/vec2f64 ../../../support/elevationInfoUtils ../sketch/normalizedPoint ./SnappingAlgorithm ./snappingUtils ./candidates/RightAngleTriangleSnappingCandidate ../support/viewUtils ../../support/geometry2dUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p){class y extends w.SnappingAlgorithm{snapNewVertex(r,q){var h=q.editGeometryOperations.data.components[0];const u=[];var f=h.vertices.length;if("polygon"!==q.editGeometryOperations.data.type||2>f)return u;var {view:z}=this;f=h.vertices[f-1];h=k.fromAnyMapPoint(h.vertices[0].pos,z,q);z=k.fromAnyMapPoint(f.pos,z,q);this._processCandidateProposal(h,z,r,q,u);return u}snapExistingVertex(r,q){const h=[];var u=q.vertexHandle,f=u.component;if(2>f.edges.length||"polyline"===q.editGeometryOperations.data.type&& (0===u.index||u.index===f.vertices.length-1))return h;const {view:z}=this;f=k.fromAnyMapPoint(u.leftEdge.leftVertex.pos,z,q);u=k.fromAnyMapPoint(u.rightEdge.rightVertex.pos,z,q);this._processCandidateProposal(f,u,r,q,h);return h}_processCandidateProposal(r,q,h,u,f){if(this.exceedsShortLineThreshold(r,q,u)){var z=b.lerp(l,k.asVec2(r),k.asVec2(q),.5),B=.5*b.distance(k.asVec2(r),k.asVec2(q));z=p.projectPointToCircle(l,k.asVec2(h),z,B);z=k.markAsTarget(k.fromValues(z[0],z[1],h[2]));var {spatialReference:x, pointer:N}=u;h=F.vectorToScreenPoint(h,x,m.absoluteHeightElevationInfo,this.view);g.squaredScreenDistance(h,F.vectorToScreenPoint(z,x,m.absoluteHeightElevationInfo,this.view))J.layer===N.layer.parent);f?f.sublayerSources.includes(N)||f.sublayerSources.add(N):N.layer.parent&&(f=new F({layer:N.layer.parent}),f.sublayerSources.add(N),u.add(f))}for(var z of u)f=z.sublayerSources.filter(N=>!h.includes(N)),z.sublayerSources.removeMany(f);u.removeMany(u.filter(N=>0===N.sublayerSources.length));q=q.filter(l);z=this._get("_effectiveFeatureSources")??new m;const {added:B,removed:x}=c.difference(z.toArray(),[...q,...u]);z.removeMany(x);z.addMany(B); return z}};a.__decorate([w.property()],b.prototype,"enabled",void 0);a.__decorate([w.property()],b.prototype,"enabledToggled",void 0);a.__decorate([w.property()],b.prototype,"forceDisabled",void 0);a.__decorate([w.property()],b.prototype,"selfEnabled",void 0);a.__decorate([w.property()],b.prototype,"featureEnabled",void 0);a.__decorate([w.property()],b.prototype,"attributeRulesEnabled",void 0);a.__decorate([w.property({type:m.ofType(F)})],b.prototype,"featureSources",void 0);a.__decorate([w.property()], b.prototype,"distance",void 0);a.__decorate([w.property()],b.prototype,"touchSensitivityMultiplier",void 0);a.__decorate([w.property({readOnly:!0})],b.prototype,"effectiveEnabled",null);a.__decorate([w.property({readOnly:!0})],b.prototype,"effectiveSelfEnabled",null);a.__decorate([w.property({readOnly:!0})],b.prototype,"effectiveFeatureEnabled",null);a.__decorate([w.property({readOnly:!0})],b.prototype,"_effectiveFeatureSources",null);return b=a.__decorate([E.subclass("esri.views.interactive.snapping.SnappingOptions")], b)})},"esri/views/interactive/snapping/FeatureSnappingLayerSource":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/Collection ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "),function(a,b,c,m,k,w,g,E){b=class extends b{constructor(F){super(F);this.layer=null;this.enabled=!0;this.updating=!1;this.availability=1;this.sublayerSources=new c}}; a.__decorate([m.property({constructOnly:!0})],b.prototype,"layer",void 0);a.__decorate([m.property()],b.prototype,"enabled",void 0);a.__decorate([m.property()],b.prototype,"updating",void 0);a.__decorate([m.property()],b.prototype,"availability",void 0);a.__decorate([m.property()],b.prototype,"sublayerSources",void 0);return b=a.__decorate([E.subclass("esri.views.interactive.snapping.FeatureSnappingLayerSource")],b)})},"esri/views/interactive/snapping/candidates/IntersectionSnappingCandidate":function(){define(["exports", "../../sketch/constraints","../SnappingDomain","./SnappingCandidate","../hints/IntersectionSnappingHint"],function(a,b,c,m,k){class w extends m.SnappingCandidate{constructor(g,E,F,p){super(g,new b.PointConstraint(g),p,c.SnappingDomain.ALL);this.first=E;this.second=F}get hints(){this.first.targetPoint=this.targetPoint;this.second.targetPoint=this.targetPoint;return[...this.first.hints,...this.second.hints,new k.IntersectionSnappingHint(this.targetPoint,this.isDraped,this.domain)]}}a.IntersectionSnappingCandidate= w;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/interactive/snapping/hints/IntersectionSnappingHint":function(){define(["exports","../../../../chunks/vec32","../SnappingDomain","./SnappingHint"],function(a,b,c,m){class k extends m.SnappingHint{constructor(w,g,E=c.SnappingDomain.ALL){super(g,E);this.intersectionPoint=w}equals(w){return w instanceof k?b.exactEquals(this.intersectionPoint,w.intersectionPoint):!1}}a.IntersectionSnappingHint=k;Object.defineProperty(a,Symbol.toStringTag, {value:"Module"})})},"esri/widgets/Editor/CreateFeaturesWorkflow":function(){define("require ../../chunks/tslib.es6 ../../Graphic ../../core/arrayUtils ../../core/Error ../../core/handleUtils ../../core/has ../../core/maybe ../../core/promiseUtils ../../core/reactiveUtils ../../core/uuid ../../core/accessorSupport/decorators/property ../../core/Logger ../../core/accessorSupport/decorators/subclass ../../layers/GraphicsLayer ../../layers/support/layerUtils ../../views/draw/support/helpMessageUtils ../../views/input/InputManager ../../views/interactive/sketch/SketchOptions ../../views/interactive/snapping/FeatureSnappingLayerSource ./CreateFeaturesWorkflowData ./modelUploadUtils ./Workflow ./workflowUtils ../FeatureForm/FeatureFormViewModel ../Sketch/SketchViewModel".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O){function t(C,e){let n=null;const G=()=>{null!=n&&(C.snappingOptions.featureSources.remove(n),n=E.destroyMaybe(n))};return w.handlesGroup([p.watch(()=>{const L=e.creationInfo?.layer,S=C.snappingOptions.featureSources.find(T=>T.layer===L);return{hasFeatureLayerSource:!!S,enabled:S?.enabled??!1}},({hasFeatureLayerSource:L,enabled:S})=>{if(L)null==n&&(n=new x({layer:C.layer}),C.snappingOptions.featureSources.add(n)),n.enabled=S;else return G()}, p.syncAndInitial),w.makeHandle(G)])}function H(C,e,n,G){const L=[];e.forEach((S,T)=>{if(!S.error){const ea=C[T];T=G.get(ea)||[];ea.attributes[n.objectIdField]=S.objectId;T.forEach(({form:V})=>L.push({feature:ea,attachment:V}))}});return L}function P(C,e,n){const G=[],L=e.globalIdField;C.forEach((S,T)=>{let ea;(ea=C[T].attributes)[L]??(ea[L]=y.generateBracedUUID());(n?.get(S)||[]).forEach(({file:V})=>G.push({feature:S,attachment:{globalId:y.generateBracedUUID(),data:V}}))});return G.length?{addFeatures:C, addAttachments:G}:{addFeatures:C}}var K;const D=Symbol(),A=Symbol(),M=Symbol();g=K=class extends I{constructor(C){super(C);this.type="create-features";this.createFeatureState="create-new";this.data=void 0;this.isNested=!1;this._getDrawMeshHelpMessage=void 0;this._featureFormHandle=null;this._visualVariableAttributes={rotation:null,size:null};this._featureFormViewModel=new v;this._sketchViewModel=null;this._attachmentFileInfos=new Map;this._highlightHandles=new Map;this._preventDefaultActionOnCancel= !1;this._lastActiveGraphics=[];this._isActive=!0;this._updateGraphicDebounced=F.debounce((e,n,G)=>d.updateGraphicSymbolWhenRequired(e,n,G))}initialize(){this.isNested&&(this._isActive=!1);this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(0a(["../../views/draw/support/helpMessageUtils3d"], L,S))).then(L=>{this._getDrawMeshHelpMessage=L.getDrawMeshHelpMessage}),{view:n}=e,"3d"===n?.type?this._getDrawMeshHelpMessage?.(G,n):void 0):f.getDrawHelpMessage(n,G?.geometry)}}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges?? !1}get shouldShowAttachments(){return this.data.editorItem?.capabilities.create.attachments.enabled??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}async enter(){this._isActive=!0;"awaiting-feature-creation-info"!==this.stepId&&this._setUpCreatingFeaturesStep()}exit(){this._isActive=!1;this.removeHandles([M])}async updatePendingFeature(C,e){this._preventDefaultActionOnCancel=!0;this._sketchViewModel.cancel();m.remove(this._lastActiveGraphics, C);return this._startUpdating(C,e)}async start(){await super.start();return u.isTable(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}static create(C){const {addAttachmentsCallback:e,applyEditsCallback:n,isNested:G,creationInfo:L,parent:S,snappingManager:T,startAt:ea,viewModel:V}=C;C=C.sketchOptions??new B;var ca=L?.layer;ca=ca?V.findEditorItemForLayer(ca):void 0;const ja=new K({data:new N.CreateFeaturesWorkflowData({creationInfo:L,editorItem:ca, parent:S,sketchOptions:C,snappingManager:T,viewModel:V}),isNested:G,onCommit:async W=>{var {creationInfo:Z}=W;if(Z){W=W.pendingFeatures.toArray();({layer:Z}=Z);var ha=ja._attachmentFileInfos;if(Z.capabilities?.editing.supportsGlobalId&&"globalIdField"in Z)W=P(W,Z,ha),await n(Z,W,{globalIdUsed:!0});else{var Q=await n(Z,{addFeatures:W});0C.effect=n)}const e=C.opacity;C.opacity=.7;return w.makeHandle(()=>C.opacity=e)}_highlight(C){const e=this.data.viewModel.view;"3d"===e?.type&&this._highlightHandles.set(C,e.highlight(C))}_removeHighlight(C){E.removeMaybe(this._highlightHandles.get(C));this._highlightHandles.delete(C)}async _startCreating(C){this.removeHandles(A);const {creationInfo:e}=this.data;e&&(this.createFeatureState="create-new",C=await d.startCreatingNewFeature(this._sketchViewModel, e,C),this.addHandles(C,A))}async _startUpdating(C,e){var {pendingFeatures:n}=this;n.includes(C)||n.add(C);const {_featureFormViewModel:G,_sketchViewModel:L}=this,{creationInfo:S,viewModel:T}=this.data,{attachmentsViewModel:ea,layerInfos:V,view:ca}=T;if(ca&&S){n=S.layer;var ja=d.findLayerInfo(V,n);G.set({arcadeEditType:"INSERT",feature:C,formTemplate:ja?.formTemplate,spatialReference:ca.spatialReference,map:ca.map});"add"!==ea.mode&&"edit"!==ea.mode||T.activeWorkflow?.previous();ea.graphic=C;ea.fileInfos.removeAll(); ea.mode="view";(this._attachmentFileInfos.get(C)||[]).forEach(({file:W,form:Z})=>ea.addFile(W,Z));this._removeHighlight(C);await d.updateGraphicSymbolWhenRequired(C,e,"2d"===ca.type?ca.scale:null);this.removeHandles(A);E.removeMaybe(this._featureFormHandle);"2d"===ca.type&&(ja=p.watch(()=>ca.scale,W=>this._updateGraphicDebounced(C,e,W)),this.addHandles(ja,A));this._featureFormHandle=w.handlesGroup([G.on("value-change",async()=>{C.attributes=G.getValues();await d.updateGraphicSymbolWhenRequired(C, e,"2d"===ca.type?ca.scale:null)}),L.on(["update","undo","redo"],W=>{("undo"===W.type||"redo"===W.type||"update"===W.type&&null!=W.toolEventInfo&&d.isTerminalUpdateEventType(W.toolEventInfo.type))&&G.notifyFeatureGeometryChanged()})]);this.createFeatureState="update-pending";this._visualVariableAttributes=d.getVisualVariableAttributes(C);if(!u.isTable(n))return d.startUpdatingFeature({graphic:C,sketchViewModel:L,sourceLayer:n,visualVariables:this._visualVariableAttributes,webStyleCache:e})}}static _createWorkflowSteps(C, e="awaiting-feature-creation-info"){const {data:n}=C;e=d.createWorkflowSteps(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],e,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const {creationInfo:G,viewModel:L}=n,{view:S}=L;S&&(J.isModelUpload(G)?C.addHandles(await J.handleModelUpload({view:S,data:n,next:()=>C.next(),cancel:()=>L.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(n.parent&&G&&(C.addHandles(L.lockFeatureTemplatesViewModel(), this.id),L.featureTemplatesViewModel.layers=[G.layer]),C.addHandles(L.featureTemplatesViewModel.on("select",({item:T})=>{T&&(n.creationInfo={...n.creationInfo,layer:T.layer,template:T.template},C.next())}),this.id)))},async tearDown(){C.removeHandles([this.id,A])}}),"creating-features":()=>({id:"creating-features",async setUp(){C._isActive&&await C._setUpCreatingFeaturesStep()},async tearDown(G){const {viewModel:L}=n;G.canceled&&(C.removeHandles([M,D,A]),L.attachmentsViewModel.fileInfos.removeAll(), C._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const {attachmentsViewModel:G}=n.viewModel,{graphic:L,fileInfos:S}=G;C._attachmentFileInfos.set(L,S.toArray());G.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const {attachmentsViewModel:G}=n.viewModel,{graphic:L,fileInfos:S}=G;C._attachmentFileInfos.set(L,S.toArray());G.mode= "view"}})});return d.avoidFeatureTemplateSelectionWithOnlyOneItem(n,e)}static _configureSketchViewModel(C,e){var {data:n}=C;const {creationInfo:G,viewModel:L}=n,{view:S}=L,T=C._sketchViewModel;let ea=null;const V=[];if(!S)return w.makeHandle();"2d"===S.type&&G&&V.push(C._fadeExistingFeatures(G.layer));const ca=async Z=>{if("cancel"===Z.state){if(C._preventDefaultActionOnCancel){C._preventDefaultActionOnCancel=!1;return}if(1>C._lastActiveGraphics.length)return C._startCreating(e);Z=C._lastActiveGraphics.pop(); return C._startUpdating(Z,e)}if("complete"===Z.state&&Z.graphic)return C._startUpdating(Z.graphic,e)},ja=async Z=>{var {attachmentsViewModel:ha}=L;const {_featureFormViewModel:Q}=C;var U=Z.graphics[0];if("complete"===Z.state){U!==ea&&(C._lastActiveGraphics.push(U),C._highlight(U));ea=null;const {hasPendingSubtypeChoice:ka,submittable:R}=Q;if(C.numPendingFeatures===G?.maxFeatures||ka||!R)return!R&&Q.submit(),Z=C._lastActiveGraphics.pop(),C._startUpdating(Z,e);"add"!==ha.mode&&"edit"!==ha.mode||L.activeWorkflow?.previous(); if(Z.aborted&&C._preventDefaultActionOnCancel){C._preventDefaultActionOnCancel=!1;return}C.addHandles([d.showProgressCursor(S),S.on("click",X=>X.preventDefault())],D);await p.whenOnce(()=>!Q.updating);C.removeHandles(D);C._startCreating(e)}"start"===Z.state&&C._removeHighlight(U);ha=C._visualVariableAttributes;await d.visualVariableInteractiveUpdate(S,U,Z,ha,e);Z=U.attributes;const {rotation:ba,size:ia}=ha;null!=ba&&({field:U}=ba,Q.setValue(U,Z[U]));null!=ia&&({field:U}=ia,Q.setValue(U,Z[U]))},W= async Z=>{if(!J.isModelUpload(G)&&({results:Z}=await S.hitTest(Z,{include:T.layer}),Z=Z.find(U=>"graphic"===U.type&&U.graphic.sourceLayer===G?.layer))&&(Z=Z.graphic,("transform"===T.activeTool||"reshape"===T.activeTool)&&T.updateGraphics.at(0)!==Z)){var {submittable:ha,hasPendingSubtypeChoice:Q}=C._featureFormViewModel;ha&&!Q&&await C.updatePendingFeature(Z,e)}};V.push(T.on("create",Z=>C._updatingHandles.addPromise(ca(Z))),T.on("update",Z=>C._updatingHandles.addPromise(ja(Z))),T.on("delete",Z=>{Z= Z.graphics[0];C.pendingFeatures.remove(Z);m.remove(C._lastActiveGraphics,Z);ea=Z}),S.on("immediate-click",Z=>C._updatingHandles.addPromise(W(Z)),z.ViewEventPriorities.TOOL),w.makeHandle(()=>{C._preventDefaultActionOnCancel=!0;T.cancel()}),t(T,n));n=w.handlesGroup(V);T.addHandles(n);return n}_initializeSketchViewModel(){const {data:C}=this,{view:e}=C.viewModel,n=new h({elevationInfo:C.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide"});this._sketchViewModel=new O({layer:n,sketchOptions:C.sketchOptions, snappingManager:C.snappingManager,updateOnGraphicClick:!1,view:e});e?.map.add(n);this.addHandles(w.makeHandle(()=>{e?.destroyed||e?.map.remove(n);n.destroy()}))}async _setUpCreatingFeaturesStep(){if(!this.hasHandles(M)){var {creationInfo:C,viewModel:e}=this.data,{attachmentsViewModel:n,view:G}=e;if(!G||!C?.layer)throw new k("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");var {initialFeature:L,layer:S}=C,T=this._sketchViewModel,ea=new Map,V=[];this._lastActiveGraphics= [];this._featureFormHandle=E.removeMaybe(this._featureFormHandle);this._visualVariableAttributes={rotation:null,size:null};this.data.editorItem=e.findEditorItemForLayer(C.layer);d.prepareAttachmentsForCreateFeaturesWorkflow(n);V.push(p.watch(()=>n.mode,W=>{switch(W){case "add":this.go("adding-attachment");break;case "edit":this.go("editing-attachment")}}));var ca=d.showProgressCursor(G);V.push(ca);var ja=u.isTable(C.layer);try{if(ja){const W=L??new c({attributes:{...C.template?.prototype.attributes, ...C.attributeOverrides},sourceLayer:S});await this._startUpdating(W,ea)}else V.push(K._configureSketchViewModel(this,ea)),L?(T.layer.add(L),await this._startUpdating(L,ea)):await this._startCreating(ea)}finally{ca.remove()}ea=w.makeHandle(()=>this.pendingFeatures.drain(W=>T.layer.remove(W)));ca=p.watch(()=>G?.timeZone,W=>this._featureFormViewModel.timeZone=W,p.initial);ja=w.makeHandle(()=>{J.isModelUpload(C)&&e.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&V.push(this._featureFormHandle); this.addHandles(V,this._handleKeys.beforeCommit);this.addHandles([w.makeHandle(()=>n.fileInfos.removeAll()),w.handlesGroup(V),ja,ea,ca],M)}}};b.__decorate([l.property()],g.prototype,"createFeatureState",void 0);b.__decorate([l.property()],g.prototype,"data",void 0);b.__decorate([l.property({constructOnly:!0})],g.prototype,"isNested",void 0);b.__decorate([l.property()],g.prototype,"featureFormViewModel",null);b.__decorate([l.property()],g.prototype,"hasPendingEdits",null);b.__decorate([l.property()], g.prototype,"_getDrawMeshHelpMessage",void 0);b.__decorate([l.property()],g.prototype,"helpMessage",null);b.__decorate([l.property()],g.prototype,"layer",null);b.__decorate([l.property()],g.prototype,"parent",null);b.__decorate([l.property()],g.prototype,"parentLayer",null);b.__decorate([l.property()],g.prototype,"keyboardCancellationEnabled",null);b.__decorate([l.property()],g.prototype,"reliesOnOwnerAdminPrivileges",null);b.__decorate([l.property()],g.prototype,"shouldShowAttachments",null);b.__decorate([l.property()], g.prototype,"shouldAllowAttachmentEditing",null);b.__decorate([l.property()],g.prototype,"sketchViewModel",null);return g=K=b.__decorate([q.subclass("esri.widgets.Editor.CreateFeaturesWorkflow")],g)})},"esri/views/draw/support/helpMessageUtils":function(){define(["exports"],function(a){a.getDrawHelpMessage=function(b,c){switch(b){case "point":case "multipoint":return"point";case "polyline":return 2>(null!=c&&"polyline"===c.type&&c.paths.length?c.paths[0].length:0)?"polylineZeroVertices":"polylineOneVertex"; case "polygon":return b=null!=c&&"polygon"===c.type&&c.rings.length?c.rings[0].length:0,b=3>b?"polylineZeroVertices":4>b?"polygonOneVertex":"polygonTwoVertices",b}};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/CreateFeaturesWorkflowData":function(){define("exports ../../chunks/tslib.es6 ../../core/Accessor ../../core/Collection ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g,E,F){a.CreateFeaturesWorkflowData=class extends c{constructor(p){super(p);this.parent=this.editorItem=this.creationInfo=null;this.pendingFeatures=new m;this.upload=this.viewModel=this.snappingManager=this.sketchOptions=null}};b.__decorate([k.property()],a.CreateFeaturesWorkflowData.prototype,"creationInfo",void 0);b.__decorate([k.property()],a.CreateFeaturesWorkflowData.prototype,"editorItem",void 0);b.__decorate([k.property()],a.CreateFeaturesWorkflowData.prototype,"parent", void 0);b.__decorate([k.property({constructOnly:!0})],a.CreateFeaturesWorkflowData.prototype,"sketchOptions",void 0);b.__decorate([k.property()],a.CreateFeaturesWorkflowData.prototype,"snappingManager",void 0);b.__decorate([k.property()],a.CreateFeaturesWorkflowData.prototype,"viewModel",void 0);b.__decorate([k.property()],a.CreateFeaturesWorkflowData.prototype,"upload",void 0);a.CreateFeaturesWorkflowData=b.__decorate([F.subclass("esri.widgets.Editor.CreateFeaturesWorkflowData")],a.CreateFeaturesWorkflowData); Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/modelUploadUtils":function(){define("require exports ../../core/handleUtils ../../core/promiseUtils ../../core/reactiveUtils ./workflowUtils".split(" "),function(a,b,c,m,k,w){function g(E){return"scene"===E?.layer?.type}b.handleModelUpload=async function({view:E,data:F,signal:p,next:y,cancel:l}){const {creationInfo:r}=F;if(!r||!g(r))return c.makeHandle();const {layer:q}=r,h=null!=r.geometryToPlace;r.geometryToPlace= null;if(h)return l(),c.makeHandle();({Upload:l}=await new Promise((z,B)=>a(["./Upload"],z,B)));m.throwIfAborted(p);const u=new l;F.upload=u;let f=null;F=c.handlesGroup([k.watch(()=>u.state,z=>{switch(z){case "default":f?.remove();break;case "pending":f?.remove();f=w.showProgressCursor(E);break;case "success":r.maxFeatures=1;r.geometryToPlace=u.result;f?.remove();y();break;case "error":f?.remove()}}),c.makeHandle(()=>{u.cancel();f?.remove()})]);u.uploadTo(q);return F};b.isModelUpload=g;Object.defineProperty(b, Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/workflowUtils":function(){define("require exports ../../Graphic ../../core/arrayUtils ../../core/asyncUtils ../../core/has ../../core/handleUtils ../../core/lang ../../core/promiseUtils ../../core/reactiveUtils ../../core/screenUtils ../../core/accessorSupport/diffUtils ../../layers/support/fieldUtils ../../renderers/support/clickToleranceUtils ../../renderers/support/lengthUtils ../../renderers/visualVariables/support/sizeVariableUtils ../../renderers/visualVariables/support/visualVariableUtils ../../symbols/support/symbolConversion ../../symbols/support/symbolUtils ../../views/3d/layers/graphics/GraphicState ../../views/support/drapedUtils ../../views/support/hitTestSelectUtils ../support/templateUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I){function d(W){const Z=W.sourceLayer;var ha;if(!(ha=!Z||"feature"!==Z.type)){a:switch(Z.renderer?.type){case "class-breaks":case "simple":case "unique-value":case "dot-density":case "dictionary":case "pie-chart":ha=!0;break a;default:ha=!1}ha=!ha}if(ha)return{rotation:null,size:null};let Q=ha=null;var U=Z.renderer.getVisualVariablesForType("rotation").filter(ba=>(!ba.axis||"heading"===ba.axis)&&ba.field&&!ba.valueExpression&&null!=f.getRotationAngle(ba, W));1===U.length&&(ha=v(U[0],Z));U=Z.renderer.getVisualVariablesForType("size").filter(ba=>ba.field&&!ba.useSymbolValue&&!ba.valueExpression&&u.getTransformationType(ba)===u.TransformationType.RealWorldSize&&null!=f.getSize(ba,W));1===U.length&&(Q=H(U[0],Z));return{rotation:ha,size:Q}}function v(W,Z){const ha="heading"===(W.axis||"heading")&&"arithmetic"===W.rotationType?-1:1,Q=W.field,U=(Z=Z.fields&&Z.fields.filter(ka=>ka.name===Q))&&1===Z.length?Z[0].type:"double";var ba=0,ia=0;return{field:Q,fieldType:U, getDefault:()=>Promise.resolve(0),getValue:ka=>{ia=ba-ha*ka;return P((ia+360)%360,U)},setInitialValue:ka=>{ba=ka;ia=0},isUpdatingInteractively:!1,rotationType:W.rotationType??"geographic"}}function O(W,Z){switch(Z){case "width":return W[0];case "depth":return W[1];case "height":return W[2];default:return W[2]||W[1]||W[0]}}async function t(W,Z,ha){if(null==Z)return 0;({symbol:Z}=z.to3D(Z));if(null==Z||"web-style"===Z.type||"cim"===Z.type)return 0;Z=Z.symbolLayers.at(0);if(!Z)return 0;switch(Z.type){case "icon":return{computeIconLayerResourceSize:ha}= await new Promise((U,ba)=>a(["../../symbols/support/symbolLayerUtils"],U,ba)),Z.size||Math.min(ca.icon,(await ha(Z,ca.icon))[0])||ca.icon;case "text":return Z.size||ca.text;case "line":return Z.size||ca.line;case "object":const {computeObjectLayerResourceSize:Q}=await new Promise((U,ba)=>a(["../../symbols/support/symbolLayerUtils"],U,ba));W=await Q(Z,W.scale/ca.viewScaleSizeFactor);return O(W,ha);case "path":return(null!=Z.width?Z.width:Z.height)||W.scale/ca.viewScaleSizeFactor;case "extrude":return Z.size|| W.scale/ca.viewScaleSizeFactor;case "fill":case "water":return 0;default:return 0}}function H(W,Z){const ha=W.field,Q=W.axis,U=(Z=Z.fields&&Z.fields.filter(X=>X.name===ha))&&1===Z.length?Z[0].type:"double";var ba=0,ia=0;const ka=h.meterIn[W.valueUnit]??1;let R;R="area"===W.valueRepresentation?X=>(X*ka/2)**2*Math.PI:"radius"===W.valueRepresentation||"distance"===W.valueRepresentation?X=>X*ka/2:X=>X*ka;return{field:ha,fieldType:U,getDefault:async(X,da)=>P(R(await t(da,X,Q)),U),getValue:(X,da)=>{ba||= da.pixelSizeAt(da.center);ia=ba*X;return P(ia,U)},setInitialValue:X=>{ba=X;ia=0},isUpdatingInteractively:!1,displayUnit:ea(W.valueUnit),axis:W.axis}}function P(W,Z){switch(Z){case "small-integer":case "integer":case "long":return Math.round(W);case "double":case "single":return W;default:return 0}}async function K(W,Z,ha){Z=await B.getDisplayedSymbol(W,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:Z,scale:ha});null!=l.diff(W.symbol,Z)&&(W.symbol=Z)}function D(W){if(!W)throw Error("no geometry type"); return"multipatch"===W?"mesh":W}async function A(W,Z,ha,Q,U){Z=new c({sourceLayer:Z,attributes:ha});const {rotation:ba,size:ia}=d(Z);let ka=await B.getDisplayedSymbol(Z,{useSourceLayer:!0,webStyleCache:Q,scale:U}),R=!1;for(const X of[ia,ba])null!=X&&null==ha[X.field]&&(ha[X.field]=await X.getDefault(ka,W.view),R=!0);R&&(ka=await B.getDisplayedSymbol(Z,{useSourceLayer:!0,webStyleCache:Q,scale:U}));switch(ka?.type){case "simple-fill":case "polygon-3d":W.polygonSymbol=ka;break;case "simple-line":case "line-3d":W.polylineSymbol= ka;break;case "simple-marker":case "picture-marker":case "point-3d":case "cim":W.pointSymbol=ka;break;case "mesh-3d":W.meshSymbol=ka}M(W.tooltipOptions,ia,ba)}function M(W,Z,ha){W.visualVariables=null!=Z||null!=ha?{size:null!=Z?{unit:Z.displayUnit,axis:Z.axis,valueType:Z.fieldType}:null,rotation:null!=ha?{valueType:ha.fieldType,rotationType:ha.rotationType??"geographic"}:null}:null}async function C(W,Z,ha,Q){if(0===W.length)return[];const {updatable:U,graphicsByLayer:ba}=await ha.async(async()=>{var {results:ia}= await F.whenOrAbort(J.hitTestSelectSimilarDistance(Z,ha),Q);const ka=new Map;J.filterGraphicHits(ia).forEach(({graphic:R})=>{var X=R.layer;var da=ka.get(X);da?X=da:(da=[],ka.set(X,da),X=da);return X.push(R)});ia=W.filter(({capabilities:R,layer:X})=>R.update.enabled&&ka.has(X));0!==ia.length&&ha.stopPropagation();return{updatable:ia,graphicsByLayer:ka}});return F.whenOrAbort(Promise.allSettled(U.map(async({layer:ia})=>{var ka=ba.get(ia);const R=n(ia);if(ka.every(fa=>r.featureHasFields(R,fa)))return ka; const X=[];for(var da of ka)X.push(da.getObjectId()),ka=Object.keys(da.attributes),m.addMany(R,ka);da=ia.createQuery();da.returnGeometry=!1;da.objectIds=X;da.outFields=r.fixFields(ia.fieldsIndex,R);return ia.queryFeatures(da,{signal:Q}).then(({features:fa})=>fa)})),Q)}async function e(W,Z,ha,Q){if(0===W.length)return[];const {mapPoint:U}=ha;if(null==U)return[];let ba=null;const ia=await ha.async(async()=>{var {results:ka}=await F.whenOrAbort(Z.hitTest(ha),Q);if(0===ka.length)return[];const R=new Set; ba=J.filterGraphicHits(ka);ba.forEach(({graphic:X})=>X&&R.add(X.layer));ka=W.filter(X=>R.has(X.layer)&&X.supportsUpdateWorkflow);0{const R=ka.createQuery();R.returnGeometry=!1;R.outFields=n(ka);const X="renderer"in ka?q.calculateTolerance({renderer:ka.renderer,pointerType:ha.pointerType}):0;R.geometry=N.createQueryGeometry(U,X,Z);R.outSpatialReference=Z.spatialReference;const {features:da}= await ka.queryFeatures(R,{signal:Q});ba?.forEach(({graphic:fa})=>{fa.layer!==ka||da.some(ma=>ma.getObjectId()===fa.getObjectId())||da.push(fa)});return da})),Q)}function n(W){return r.fixFields(W.fieldsIndex,[W.objectIdField,r.getDisplayFieldName({displayField:"displayField"in W?W.displayField:null,fields:W.fields})])}async function G(W){const {graphic:Z,sketchViewModel:ha,sourceLayer:Q,visualVariables:U,webStyleCache:ba}=W;let ia=!1;const {rotation:ka,size:R}=U;[ka,R].forEach(async X=>{if(null!= X){var da=Z.getAttribute(X.field);null!=da?X.setInitialValue(da):(da=await X.getDefault(Z.symbol,ha.view),X.setInitialValue(da),Z.setAttribute(X.field,da),ia=!0)}});ia&&await K(Z,ba,"2d"===ha.view?.type?ha.view.scale:null);W={multipleSelectionEnabled:!1};"point"===Q.geometryType&&(W.enableRotation=null!=ka,W.enableScaling=null!=R);M(ha.tooltipOptions,R,ka);ha.layer.elevationInfo=Q.elevationInfo;return ha.update(Z,W)}async function L(W,Z,ha,Q,U){if(null!=Z.geometry&&"point"===Z.geometry?.type){var ba= Q.rotation;var ia=ha.toolEventInfo;ia=null==ia||"rotate-start"!==ia.type&&"rotate"!==ia.type&&"rotate-stop"!==ia.type?null:ia;if(null!=ba&&null!=ia){const {field:ka,getValue:R}=ba;"rotate-stop"===ia.type?(ba.isUpdatingInteractively=!1,ba.setInitialValue(Z.getAttribute(ka))):(ba.isUpdatingInteractively=!0,Z.setAttribute(ka,R(ia.angle,W)))}Q=Q.size;ha=ha.toolEventInfo;ha=null==ha||"scale-start"!==ha.type&&"scale"!==ha.type&&"scale-stop"!==ha.type?null:ha;if(null!=Q&&null!=ha){const {field:ka,getValue:R}= Q;"scale-stop"===ha.type?(Q.isUpdatingInteractively=!1,Q.setInitialValue(Z.getAttribute(ka))):(Q.isUpdatingInteractively=!0,Z.setAttribute(ka,R(ha.xScale,W)))}await K(Z,U,"2d"===W.type?W.scale:null)}}function S(W,Z,ha){if("3d"===W.type){const Q=new x.GraphicState({graphic:Z});return g.handlesGroup([W.trackGraphicState(Q),p.watch(()=>Q.displaying,ha)])}return p.watch(()=>Z.visible,ha)}async function T(W,Z){if("3d"===W.type){const ha=new x.GraphicState({graphic:Z});W=W.trackGraphicState(ha);await p.whenOnce(()=> ha.displaying);W.remove()}else await p.whenOnce(()=>Z.visible)}function ea(W){switch(W){case "unknown":case "decimal-degrees":return null;default:return W}}function V(W){const Z=W.geometry;if("mesh"===Z?.type){const ha=W.cloneShallow();ha.attributes=E.clone(W.attributes);ha.geometry=Z.cloneShallow();ha.geometry.transform=Z.transform?.clone()??null;return ha}return W.clone()}const ca={icon:y.px2pt(24),text:y.px2pt(12),line:y.px2pt(1),viewScaleSizeFactor:100},ja=(W,Z)=>W.whenLayerView("subtype-sublayer"=== Z.type?Z.parent:Z);b.avoidFeatureTemplateSelectionWithOnlyOneItem=function(W,Z){W.viewModel.syncFeatureTemplates();W=W.creationInfo;if("awaiting-feature-creation-info"===Z[0].id&&W){const ha=W.layer,Q=I.getAllTemplatesForLayer(ha);1===Q.length&&"scene"!==ha.type&&(W.template=Q[0],Z.shift())}return Z};b.canCreateInteractiveEditSession=function(W){return"createInteractiveEditSession"in W};b.cloneGraphicExceptMesh=V;b.createWorkflowSteps=function(W,Z,ha){let Q=!1;return W.filter(U=>Q?!0:Q=U===Z).map(U=> ha[U]())};b.fetchCandidates=async function(W,Z,ha,Q){switch(Z.type){case "3d":return C(W,Z,ha,Q);case "2d":return e(W,Z,ha,Q)}};b.fetchFullFeature=async function(W,Z,ha){const {sourceLayer:Q}=W,U=Q.createQuery();U.objectIds=[W.getAttribute(Q.objectIdField)];U.outFields=["*"];U.returnM=Q.capabilities.data.supportsM;U.returnZ=Q.capabilities.data.supportsZ;if("scene"!==Q.type||null==Q.infoFor3D)U.outSpatialReference=Z;W=await Q.queryFeatures(U,{signal:ha});F.throwIfAborted(ha);return W.features[0]}; b.findLayerInfo=function(W,Z){return W?.find(ha=>ha.layer===Z)};b.getVisualVariableAttributes=d;b.isTerminalUpdateEventType=W=>/-stop/.test(W)||/vertex-/.test(W);b.prepareAttachmentsForCreateFeaturesWorkflow=function(W){W.filesEnabled=!0;W.mode="view";W.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}};b.setUpGeometryUpdate=async function({feature:W,featureClone:Z,visualVariableAttributes:ha,sketchViewModel:Q,view:U,onUpdate:ba,webStyleCache:ia}){await K(Z,ia,"2d"===U.type?U.scale: null);let ka=null;if("2d"===Q?.view?.type){const la=F.debounce(na=>K(Z,ia,na));ka=p.watch(()=>Q?.view?.scale,na=>la(na))}const R=Z.sourceLayer;var X=ja(U,R);await G({graphic:Z,sketchViewModel:Q,sourceLayer:R,visualVariables:ha,webStyleCache:ia});let da=null;X.then(la=>da=la).catch(()=>{});const fa=ha.size,ma=ha.rotation;X=p.watch(()=>W.attributes,async la=>{let na=!1;for(const va in la){const ta=la[va];ta!==Z.getAttribute(va)&&(Z.setAttribute(va,ta),null==fa||fa.isUpdatingInteractively||fa.field!== va||fa.setInitialValue(ta),null==ma||ma.isUpdatingInteractively||ma.field!==va||ma.setInitialValue(ta),null==da||da.requiredFields.includes(va))&&(na=!0)}na&&await K(Z,ia,"2d"===U.type?U.scale:null)});const ra=Q.on("update",async la=>{const na=la.graphics[0];if("complete"===la.state)return G({graphic:na,sketchViewModel:Q,sourceLayer:R,visualVariables:ha,webStyleCache:ia});await L(U,na,la,ha,ia);ba(V(na),la)}),pa=Q.on(["undo","redo"],async la=>{ba(V(la.graphics[0]),la)});return g.handlesGroup([pa, ra,g.makeHandle(()=>Q.cancel()),X,ka])};b.showProgressCursor=function(W){const Z=W.cursor;W.cursor="progress";return g.makeHandle(()=>W.cursor=Z)};b.sizeDefaults=ca;b.sizeVariableUnitToLengthUnit=ea;b.startCreatingNewFeature=async function(W,Z,ha){const Q=Z.layer,U={...Z.template?.prototype.attributes,...Z.attributeOverrides};let ba=null;const {view:ia}=W,ka="2d"===ia?.type;await A(W,Q,U,ha,ka?ia.scale:null);if(ka){const da=F.debounce(fa=>A(W,Q,U,ha,fa));ba=p.watch(()=>ia.scale,fa=>da(fa))}const {data:R, editing:X}=Q.capabilities;W.layer.elevationInfo=Q.elevationInfo;null==Z.geometryToPlace?await W.create(D(Q.geometryType),{graphicProperties:{attributes:U,sourceLayer:Q},hasZ:R.supportsZ,defaultZ:(ka?X.zDefault:null)??W.defaultCreateOptions.defaultZ}):await W.place(Z.geometryToPlace,{graphicProperties:{attributes:U,sourceLayer:Q}});return ba??g.makeHandle()};b.startUpdatingFeature=G;b.swapForEditingSession=async function(W,Z,ha){function Q(R){ka?.abort();ka=k.createTask(async X=>{const da=await ja(U, ba);F.throwIfAborted(X);da.setVisibility?.(ia,R)})}const U=W.view;W.layer.add(ha);const ba=Z.sourceLayer,ia=Z.getAttribute(Z.layer.objectIdField);let ka=null;await T(U,ha);Q(!1);return g.handlesGroup([S(U,ha,R=>Q(!R)),g.makeHandle(async()=>{Q(!0);try{const R=await ja(U,ba);await p.whenOnce(()=>!R.updating)}finally{W.layer.remove(ha)}})])};b.updateGraphicSymbolWhenRequired=K;b.visualVariableInteractiveUpdate=L;b.whenEditorLayerView=ja;b.whenGraphicDisplayed=T;Object.defineProperty(b,Symbol.toStringTag, {value:"Module"})})},"esri/renderers/support/clickToleranceUtils":function(){define(["exports"],function(a){function b(k,w){return w?"xoffset"in w&&w.xoffset?Math.max(k,Math.abs(w.xoffset)):"yoffset"in w&&w.yoffset?Math.max(k,Math.abs(w.yoffset||0)):k:k}function c(k,w){if("number"===typeof k)return k;if(k?.stops?.length){k=k.stops;let g=w=0;for(let E=0;E"size"===F.type).map(F=> {const {maxSize:p,minSize:y}=F;return(c(p,k)+c(y,k))/2});let g=0;const E=w.length;if(0===E)return k;for(let F=0;F{g=b(g,E.symbol)});return g}if("class-breaks"===w.type){let g=k;w.classBreakInfos.forEach(E=> {g=b(g,E.symbol)});return g}return k};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/3d/layers/graphics/GraphicState":function(){define("exports ../../../../chunks/tslib.es6 ../../../../core/Evented ../../../../core/accessorSupport/decorators/property ../../../../core/has ../../../../core/Logger ../../../../core/RandomLCG ../../../../core/accessorSupport/decorators/subclass".split(" "),function(a,b,c,m,k,w,g,E){a.GraphicState=class extends c.EventedAccessor{constructor(F){super(F); this.isDraped=this.displaying=this.tracking=!1}};b.__decorate([m.property({constructOnly:!0})],a.GraphicState.prototype,"graphic",void 0);b.__decorate([m.property()],a.GraphicState.prototype,"tracking",void 0);b.__decorate([m.property()],a.GraphicState.prototype,"displaying",void 0);b.__decorate([m.property()],a.GraphicState.prototype,"isDraped",void 0);a.GraphicState=b.__decorate([E.subclass("esri.views.3d.layers.graphics.GraphicState")],a.GraphicState);Object.defineProperty(a,Symbol.toStringTag, {value:"Module"})})},"esri/views/support/drapedUtils":function(){define(["exports","../../geometry","../../core/unitUtils","../../renderers/support/clickToleranceUtils","../../geometry/Extent"],function(a,b,c,m,k){function w(E,F,p,y=new k){let l=0;if("2d"===p.type)l=F*(p.resolution??0);else if("3d"===p.type){var r=p.overlayPixelSizeInMapUnits(E),q=p.basemapSpatialReference;l=null==q||q.equals(p.spatialReference)?F*r:c.getMetersPerUnitForSR(q)/c.getMetersPerUnitForSR(p.spatialReference)}F=E.x-l;r= E.y-l;q=E.x+l;E=E.y+l;({spatialReference:p}=p);y.xmin=Math.min(F,q);y.ymin=Math.min(r,E);y.xmax=Math.max(F,q);y.ymax=Math.max(r,E);y.spatialReference=p;return y}const g=new k;a.createQueryGeometry=w;a.intersectsDrapedGeometry=function(E,F,p){E=p.toMap(E);if(null==E)return!1;const y=m.calculateTolerance();return w(E,y,p,g).intersects(F)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/support/hitTestSelectUtils":function(){define(["exports"],function(a){function b(c){return"graphic"=== c?.type}a.filterGraphicHits=function(c){return c.filter(b)};a.findFirstGraphicHit=function(c){return c.find(b)??null};a.hitTestSelectSimilarDistance=async function(c,m){if("2d"===c.type)return c.hitTest(m);c=await c.hitTest(m);if(0===c.results.length)return c;m=c.results[0];const k=1.05*(m.distance??0),w=c.results.findIndex(g=>(g.distance??0)>k);-1!==w&&(c.results=c.results.slice(0,w));m&&c.ground.distance>k&&(c.ground.mapPoint=null);return c};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})}, "esri/widgets/Editor/Workflow":function(){define("../../chunks/tslib.es6 ../../core/Error ../../core/Evented ../../core/promiseUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../core/support/UpdatingHandles".split(" "),function(a,b,c,m,k,w,g,E,F,p){c=class extends c.EventedAccessor{constructor(y){super(y);this._indexHistory=[];this._stepIndex=this._lastStepIndex=-1;this._updatingHandles=new p.UpdatingHandles; this._handleKeys={afterCommit:"after-commit",beforeCommit:"before-commit"};this.data=void 0;this.started=!1;this.steps=[];this._pendingOperation=this.type=null}destroy(){this._updatingHandles.destroy()}get hasNextStep(){const {steps:y}=this;return!!(y&&this._stepIndex!l.parent).length-1)}get hasPreviousStep(){return 0Promise.resolve(!0)){if(!this.hasPendingEdits||await y())this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0})}async cancel(y={force:!0}){return!1!==y.force?this._cancel(y):new Promise((l,r)=>{this.emit("cancel-request",{controller:{allow:()=>{this._cancel({...y, force:!0}).then(l)},deny:()=>r(new b("workflow:cancel-denied","Request to cancel workflow was denied."))}})})}async commit(){this.removeHandles(this._handleKeys.beforeCommit);this.onCommit&&await this.onCommit(this.data);this.removeHandles(this._handleKeys.afterCommit);this.emit("commit")}async go(y){var {steps:l}=this;l=l.findIndex(r=>r.id===y);this._indexHistory.push(this._stepIndex);await this._go(l)}async next(){this._indexHistory.push(this._stepIndex);await this._go(this._stepIndex+1)}async previous(y= {cancelCurrentStep:!1}){await this._go(this._indexHistory.pop(),y.cancelCurrentStep)}async reset(){await this._cancel({emitCancelEvent:!1});await this.start()}async save(){await this.commit();await this.reset()}async start(){this._set("started",!0);await this._go(-1===this._stepIndex?0:this._stepIndex)}async _cancel({emitCancelEvent:y=!0,error:l}={}){this.started&&(this._set("started",!1),await this._transaction(()=>this.steps[this._stepIndex]?.tearDown({canceled:!0})));this.removeHandles([this._handleKeys.afterCommit, this._handleKeys.beforeCommit]);this._resetIndexing(y);y&&this.emit("cancel",{error:l})}_go(y=-1,l=!1){return this._transaction(async()=>{const {steps:r}=this;if(!(-1>=y||y>=r.length)){if(this.started){-1 r.promise);this._pendingOperation=q;this._updatingHandles.addPromise(q);try{l&&await l,await y()}finally{r.resolve(),q===this._pendingOperation&&(this._pendingOperation=null)}}_resetIndexing(y=!0){this._lastStepIndex=this._stepIndex=-1;this._indexHistory.length=0;y&&this._notifyStepProps()}_notifyStepProps(){this.notifyChange("stepId");this.notifyChange("hasPreviousStep");this.notifyChange("hasNextStep")}};a.__decorate([k.property()],c.prototype,"data",void 0);a.__decorate([k.property()],c.prototype, "hasNextStep",null);a.__decorate([k.property()],c.prototype,"hasPreviousStep",null);a.__decorate([k.property()],c.prototype,"onCommit",void 0);a.__decorate([k.property()],c.prototype,"reliesOnOwnerAdminPrivileges",null);a.__decorate([k.property()],c.prototype,"hasInvalidFormTemplate",null);a.__decorate([k.property()],c.prototype,"shouldShowAttachments",null);a.__decorate([k.property()],c.prototype,"shouldAllowAttachmentEditing",null);a.__decorate([k.property()],c.prototype,"started",void 0);a.__decorate([k.property({readOnly:!0})], c.prototype,"stepId",null);a.__decorate([k.property()],c.prototype,"steps",void 0);a.__decorate([k.property({readOnly:!0})],c.prototype,"type",void 0);a.__decorate([k.property()],c.prototype,"helpMessage",null);a.__decorate([k.property()],c.prototype,"hasPendingEdits",null);a.__decorate([k.property()],c.prototype,"keyboardCancellationEnabled",null);a.__decorate([k.property()],c.prototype,"updating",null);return c=a.__decorate([F.subclass("esri.widgets.Editor.Workflow")],c)})},"esri/widgets/Sketch/SketchViewModel":function(){define("require ../../chunks/tslib.es6 ../../symbols ../../core/Collection ../../core/Error ../../core/Evented ../../core/has ../../core/Logger ../../core/maybe ../../core/promiseUtils ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../geometry/ellipsoidUtils ../../geometry/projection ../../geometry/support/coordsUtils ../../geometry/support/spatialReferenceUtils ../../layers/GraphicsLayer ../../layers/support/layerUtils ../../views/3d/interactive/editingTools/isSupportedObjectUtils ../../views/3d/interactive/editingTools/move/isSupportedObject ../../views/3d/interactive/editingTools/reshape/isSupportedObject ../../views/3d/interactive/editingTools/transform/isSupportedGraphic ../../views/draw/support/layerUtils ../../views/input/InputManager ../../views/interactive/keybindings ../../views/interactive/sketch/SketchLabelOptions ../../views/interactive/sketch/SketchOptions ../../views/interactive/sketch/SketchTooltipOptions ../../views/interactive/sketch/SketchValueOptions ../../views/interactive/snapping/SnappingManager ../../views/interactive/snapping/SnappingOptions ../../views/interactive/snapping/snappingUtils ../../views/support/hitTestSelectUtils ../../views/support/screenUtils ./support/OperationHandle ../../symbols/SimpleMarkerSymbol ../../symbols/SimpleFillSymbol ../../symbols/SimpleLineSymbol ../../symbols/MeshSymbol3D ../../symbols/FillSymbol3DLayer".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O,t,H,P,K,D,A,M,C,e,n,G,L,S,T,ea,V){function ca(R){return"polygon"===R||"rectangle"===R||"circle"===R}function ja(R,X){Z("undo",R.history.undo,R.history.redo,X)}function W(R,X){Z("redo",R.history.redo,R.history.undo,X)}function Z(R,X,da,fa){if(X=X.pop()){var ma=X.updates,ra=[];fa.forEach((pa,la)=>{la=ma[la];null!=la&&("geometry"in la&&null!=la.geometry&&(ra.push({geometry:pa.geometry}),pa.geometry=la.geometry),"symbol"in la&&null!=la.symbol&& (ra.push({symbol:pa.symbol}),pa.symbol=la.symbol),"undo"in la&&(ra.push(la),la[R](pa)))});da.push({updates:ra})}}function ha(R){return{updates:R.map(({geometry:X})=>"mesh"===X?.type?{geometry:X.cloneShallow()}:{geometry:X})}}function Q(R){return"requireError"in R&&"aborted"===R.requireError}const U=R=>Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"})),ba={defaultZ:0},ia={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"};w=class extends w.EventedAccessor{constructor(R){super(R);this._numUpdating=0;this._defaultSnappingManager=null;this._internalGraphicsLayer=new B({listMode:"hide",internal:!0,title:"SVM Internal"});this._operationHandle=null;this._viewHandlesKey="viewHandles";this.activeVertexSymbol=this.activeLineSymbol=this.activeFillSymbol= null;this.allowDeleteKey=!0;this.layer=null;this.pointSymbol=new L({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}});this.polygonSymbol=new S({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}});this.polylineSymbol=new T({color:[130,130,130,1],width:2});this.meshSymbol=new ea({symbolLayers:new m([new V])});this.updateGraphics=new m;this.updateOnGraphicClick=!0;this.vertexSymbol=new L({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}); this.sketchOptions=new P;this._originalPopupEnabled=this._viewReadyAbortController=this._moduleLoaderAbortController=null;this.defaultCreateOptions=ba;this.defaultUpdateOptions=ia;this.snappingOptions=R?.snappingManager?.options??R?.snappingOptions??new M}initialize(){this.addHandles([y.on(()=>this.view?.map?.layers,"change",R=>{R.removed.includes(this.layer)&&this.cancel()}),y.on(()=>this.layer?.graphics,"change",R=>{if(null!=this._operationHandle)for(const X of R.removed)this.updateGraphics.includes(X)&& (1this.layer?.elevationInfo??null,R=>{R!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=R)},y.syncAndInitial),y.watch(()=>this.view,R=>{this._defaultSnappingManager=F.destroyMaybe(this._defaultSnappingManager);R&&(this.snappingManager||(this._defaultSnappingManager=new A.SnappingManager({view:R,options:this.snappingOptions})), "2d"===R.type?new Promise((X,da)=>a(["../../views/2d/interactive/editingTools"],X,da)):"3d"===R.type&&(new Promise((X,da)=>a(["../../views/3d/interactive/editingTools"],X,da)),new Promise((X,da)=>a(["../../views/3d/layers/GraphicsLayerView3D"],fa=>X(U(fa)),da))))},y.syncAndInitial),y.watch(()=>this.view?.spatialReference,(R,X)=>{R&&X&&!R.equals(X)&&this.cancel()})]);C.setupSnappingToggleHandles(this)}destroy(){this.cancel();this._removeDefaultLayer();this._defaultSnappingManager=F.destroyMaybe(this._defaultSnappingManager); this._set("snappingManager",null);this._set("view",null);this.emit("destroy")}get updating(){return 0R.ready,da=>{this.removeHandles(this._viewHandlesKey);da&&this.addHandles(this._generateViewHandles(R),this._viewHandlesKey)},y.syncAndInitial),"view-ready");this._set("view",R)}cancel(){this._moduleLoaderAbortController=F.abortMaybe(this._moduleLoaderAbortController);this._viewReadyAbortController=F.abortMaybe(this._viewReadyAbortController); this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const {state:R,updateGraphics:X}=this;if("active"===R&&X.length){const {activeTool:da,layer:fa}=this,ma=X.toArray();fa.removeMany(ma);this.cancel();this._emitDeleteEvent({graphics:ma,tool:da})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const R=this.updateGraphics.map(X=>X.clone()).toArray();this.layer.addMany(R);this.emit("duplicate",{graphics:R, type:"duplicate"});return R}return[]}async create(R,X){this.cancel();await this._waitViewReady();const {view:da,layer:fa}=this;if(!da||"disabled"===this.state)throw fa||this._logMissingLayer(),p.createAbortError();null!=da.activeTool&&(da.activeTool=null);if(R){v.addUniqueLayer(da,this._internalGraphicsLayer);var ma=await this._setupCreateOperation(R,X);null==ma||this.destroyed?da.map.remove(this._internalGraphicsLayer):(ma.on("complete",()=>{if(ma===this._operationHandle){const ra=this.createGraphic, pa=this._operationHandle.cancelled;this._operationHandle.destroy();this._operationHandle=null;this._set("createGraphic",null);this.view?.map&&this.view.map.remove(this._internalGraphicsLayer);ma.cancelled||null==ra||fa.add(ra);this.emit("create",{graphic:ra,state:pa?"cancel":"complete",tool:R,toolEventInfo:null,type:"create"})}}),this._operationHandle=ma,da.ready&&da.focus())}else this._logError("sketch:missing-parameter","Missing parameter 'tool'.")}async place(R,X){return this.create("mesh",{mode:"click", hasZ:R.hasZ,geometryToPlace:R,...X})}async update(R,X){this.cancel();await this._waitViewReady();const {layer:da,view:fa,state:ma}=this;if(!fa||"disabled"===ma)throw da||this._logMissingLayer(),p.createAbortError();null!=fa.activeTool&&(fa.activeTool=null);const ra=Array.isArray(R)?R:[R];null!=R&&ra?.length?ra.some(pa=>pa.layer!==da?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==pa.geometry?(this._logError("sketch:invalid-parameter", "Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):!1)||(R=await this._setupUpdateOperation(ra,X),this.destroyed||null==R||Q(R)||(v.addUniqueLayer(fa,this._internalGraphicsLayer),this._setUpdateOperationHandle(R,X),this.emit("update",{graphics:ra,state:"start",aborted:!1,tool:R.tool,toolEventInfo:null,type:"update"}))):this._logError("sketch:missing-parameter","Missing parameter 'graphics'.")}async _updateSpatialReference(R){const X=this.view;if(X){this._beginAsyncOperation(); R=Array.isArray(R)?R:[R];for(const da of R)null==da.geometry||"mesh"===da.geometry.type||z.equals(da.geometry.spatialReference,X.spatialReference)||(u.canProjectWithoutEngine(da.geometry.spatialReference,X.spatialReference)||u.isLoaded()||await u.load(),da.geometry=u.project(da.geometry,X.spatialReference));this._endAsyncOperation()}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(R){var X= this.view;if(!X)return this._logMissingView(),null;if("2d"===X.type){const fa=[];X.map.allLayers.forEach(ma=>{"vector-tile"!==ma.type&&"imagery"!==ma.type||fa.push(ma)});X=await X.hitTest(R,{exclude:fa});return e.findFirstGraphicHit(X.results)}const da=[X.map.ground];X.map.allLayers.forEach(fa=>{x.isIntegratedMeshLayer(fa.type)&&da.push(fa)});R=await X.hitTest(R,{exclude:da});if(0X.map.ground.opacity|| R.ground.distance-(fa.distance??0)>-Math.min(3*R.ground.distance,"global"===X.viewingMode?h.getReferenceEllipsoid(X.renderCoordsHelper.spatialReference).radius/X.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return fa}return null}_generateViewHandles(R){return[R.on("immediate-click",async X=>{var da="active"===this.state&&"create"===this._operationHandle?.type;if("disabled"!==this.state&&!da&&this.updateOnGraphicClick){this._beginAsyncOperation();var fa=await X.async(()=>this._getFirstHit(n.createScreenPointFromEvent(X))); da=null;null!=fa?(fa=fa.graphic,this.updateGraphics.includes(fa)||fa.layer===this.layer?(X.stopPropagation(),da=fa):"2d"!==R.type||this._isComponentGraphic(fa)||"active"!==this.state||this.cancel()):"active"===this.state&&this.cancel();null==da||this.updateGraphics.includes(da)||await this.update([da],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}});this._endAsyncOperation()}},O.ViewEventPriorities.WIDGET)]}async _setupCreateOperation(R,X){const da=this.view; if(!da)return this._logMissingView(),null;R=await this._setupDrawGraphicTool(R,da,{hasZ:"3d"===da.type,...this.defaultCreateOptions,...X});if(null==R)return null;da.tools.add(R);da.activeTool=R;return this._setupCreateOperationHandle(R)}async _setupDrawGraphicTool(R,X,da){if("multipoint"===R&&"3d"===X.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!X)return this._logMissingView(),null;const {cursor:fa,defaultZ:ma,hasZ:ra,geometryToPlace:pa, graphicProperties:la,mode:na,preserveAspectRatio:va}=da;da="rectangle"===R||"circle"===R?"hybrid":"click";const ta=va??"rectangle"!==R;R={centered:"rectangle"!==R&&!("circle"===R&&!ta),cursor:fa,defaultZ:ma,forceUniformSize:ta,graphicProperties:la,geometryToPlace:pa,geometryType:R,graphicSymbol:this._getGraphicSymbolFromTool(R),hasZ:ra,mode:na??da,snappingManager:this.snappingManager,snapToScene:!1,view:X};return"2d"===X.type?this._makeDrawGraphicTool2D(R):this._makeDrawGraphicTool3D(R)}async _makeDrawGraphicTool2D(R){const X= await this._requireModule(new Promise((da,fa)=>a(["../../views/2d/interactive/editingTools"],da,fa)));return Q(X)||this.destroyed?null:new X.module.DrawGraphicTool2D({...R,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ca(R.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(R){const X=await this._requireModule(new Promise((fa,ma)=>a(["../../views/3d/interactive/editingTools"], fa,ma)));if(Q(X)||this.destroyed)return null;const {elevationInfo:da}=this.layer;return new X.module.DrawGraphicTool3D({...R,elevationInfo:da,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(R){const X=this.view;if(!X)return this._logMissingView(),null;let da=null;const fa=R.forceUniformSize,ma=R.centered,ra=[X.on("key-down",la=>{if(la.key===t.sketchKeys.pan)la.stopPropagation(),la.repeat||(R.enabled=!1);else if(la.key===t.sketchKeys.complete)la.stopPropagation(),R.completeCreateOperation(); else if(la.key!==t.sketchKeys.vertexAdd||la.repeat)la.key===t.sketchKeys.undo?(la.stopPropagation(),pa.undo()):la.key===t.sketchKeys.redo?(la.stopPropagation(),pa.redo()):la.key!==t.sketchKeys.constraint||"rectangle"!==R.geometryType&&"circle"!==R.geometryType||la.repeat?la.key!==t.sketchKeys.center||la.repeat||(R.centered=!ma,la.stopPropagation()):(R.forceUniformSize=!fa,la.stopPropagation());else{const na=R.drawOperation.geometryType;if("polyline"===na||"polygon"===na||"multipoint"===na)la.stopPropagation(), R.drawOperation.commitStagedVertex()}},O.ViewEventPriorities.WIDGET),X.on("key-up",la=>{la.key===t.sketchKeys.pan?R.enabled=!0:la.key!==t.sketchKeys.constraint||"rectangle"!==R.geometryType&&"circle"!==R.geometryType?la.key===t.sketchKeys.center&&(R.centered=ma,la.stopPropagation()):(R.forceUniformSize=fa,la.stopPropagation())},O.ViewEventPriorities.WIDGET),R.on("vertex-add",la=>{da=null==da?"start":"active";switch(la.operation){case "apply":this.emit("create",{graphic:R.graphic,state:da,tool:this.activeTool, toolEventInfo:la,type:"create"});break;case "undo":this._emitUndoEvent({graphics:[R.graphic],tool:R.geometryType});break;case "redo":this._emitRedoEvent({graphics:[R.graphic],tool:R.geometryType})}}),R.on("cursor-update",la=>{0{switch(la.operation){case "apply":this.emit("create", {graphic:R.graphic,state:"active",tool:this.activeTool,toolEventInfo:la,type:"create"});break;case "undo":this._emitUndoEvent({graphics:[R.graphic],tool:R.geometryType});break;case "redo":this._emitRedoEvent({graphics:[R.graphic],tool:R.geometryType})}}),R.on("complete",la=>{this._set("createGraphic",la.graphic);da="complete";la.aborted?pa&&pa.cancel():pa&&pa.complete()}),y.watch(()=>this._getGraphicSymbolFromTool(R.geometryType),la=>{R.graphicSymbol=la})],pa=new G.CreateOperationHandle({activeComponent:R, tool:R.geometryType,type:"create",onEnd:()=>{ra.forEach(la=>la.remove());ra.length=0;X.tools?.remove(R)},undo:()=>{R.canUndo&&R.undo()},redo:()=>{R.canRedo&&R.redo()},canUndo:()=>R.canUndo,canRedo:()=>R.canRedo});return pa}_getGraphicSymbolFromTool(R){switch(R){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(R,X){const {layer:da, view:fa}=this;if(!fa)return this._logMissingView(),null;X={...this.defaultUpdateOptions,...X,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...X?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...X?.highlightOptions}};let ma=X.tool??ia.tool;for(var ra of R)da.remove(ra),da.add(ra);if("3d"===fa.type){if(0===R.length)return null;switch(ma){case "move":return this._setupMove3DOperation(R,X,fa,ma);case "reshape":return 1a(["../../views/3d/interactive/editingTools"],sa,Aa)));if(Q(ra))return ra;const {ManipulatedObject3DGraphic:pa,MoveTool3D:la}=ra.module,na=new Map,va=()=>{na.forEach(sa=>sa.destroy());na.clear()};for(const sa of R){ra=new pa({view:da,graphic:sa});const Aa=J.isSupportedObject(ra);if(Aa!==N.SupportedObjectResult.SUPPORTED)return va(), this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${N.isSupportedObjectResultMessage(Aa)}).`),null;na.set(sa,ra)}const ta=new la({view:da,enableZ:X.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});da.tools.add(ta);ta.objects.addMany(Array.from(na.values()));ma||this.updateGraphics.addMany(R);const xa=[],wa=new G.UpdateOperationHandle({activeComponent:ta,tool:fa,type:"update",onEnd:()=>{xa.forEach(sa=>sa.remove());xa.length=0;da.tools?.remove(ta); ta.destroyed||ta.destroy();va()},undo:()=>{var sa=this.view;null!=sa&&ta.hasGrabbedManipulators&&(sa.activeTool=null);ja(wa,this.updateGraphics.toArray());this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:fa})},redo:()=>{W(wa,this.updateGraphics.toArray());this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:fa})},addToSelection:sa=>{this.updateGraphics.push(sa);const Aa=new pa({view:da,graphic:sa});na.set(sa,Aa);ta.objects.push(Aa);this.emit("update",{graphics:this.updateGraphics.toArray(), state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[sa],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:sa=>{const Aa=this.updateGraphics.indexOf(sa);wa.history.undo.forEach(Y=>Y.updates.splice(Aa,1));wa.history.redo.forEach(Y=>Y.updates.splice(Aa,1));this.updateGraphics.remove(sa);this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[sa],type:"selection-change"},type:"update"}); if(0===this.updateGraphics.length)wa.complete();else{var ya=na.get(sa);ya&&(ta.objects.remove(ya),ya.destroy(),na.delete(sa))}},toggleTool:async()=>{if(1===this.updateGraphics.length&&!1!==X.toggleToolOnClick&&"transform"===fa){var sa=this.updateGraphics.at(0);(sa=await this._setupReshape3DOperation(sa,X,da,!0))&&!Q(sa)&&(wa.onEnd(),wa.destroy(),this._setUpdateOperationHandle(sa,X))}}});xa.push(...this._getHandlesForComponent(wa,X),da.on("immediate-click",sa=>this._getCommonUpdateOperationClickHandlers(wa, sa,X),O.ViewEventPriorities.WIDGET),da.on("key-down",sa=>{this._getCommonUpdateOperationKeyDownHandlers(wa,sa)},O.ViewEventPriorities.WIDGET));return wa}_setupGraphicTransform3DOperation(R,X,da,fa=!1){if(1===R.length&&d.isSupportedGraphic(R[0])===N.SupportedObjectResult.SUPPORTED){const ma=R[0],ra=ma.geometry;if(null!=ra&&("point"===ra.type||"mesh"===ra.type))return this._setupPointTransform3DOperation(ma,X,da);if(null!=ra&&("polygon"===ra.type||"polyline"===ra.type))return this._setupPolyTransform3DOperation(ma, X,da,fa)}return this._setupMove3DOperation(R,X,da,"transform",fa)}async _setupPointTransform3DOperation(R,X,da){const {enableRotation:fa,enableScaling:ma,enableZ:ra}=X,pa=await this._requireModule(new Promise((sa,Aa)=>a(["../../views/3d/interactive/editingTools"],sa,Aa)));if(Q(pa))return pa;const {TransformTool3D:la,ManipulatedObject3DGraphic:na}=pa.module,va=new na({graphic:R,view:da}),ta=new la({object:va,view:da,enableRotation:fa,enableScaling:ma,enableZ:ra,snappingManager:this.snappingManager, sketchOptions:this.sketchOptions});da.tools.add(ta);this.updateGraphics.add(R);const xa=[],wa=new G.UpdateOperationHandle({activeComponent:ta,tool:"transform",type:"update",onEnd:()=>{xa.forEach(sa=>sa.remove());xa.length=0;da.tools?.remove(ta);ta.destroyed||ta.destroy();va.destroy()},undo:()=>{var sa=this.view;null!=sa&&ta.hasGrabbedManipulators&&(sa.activeTool=null);ja(wa,this.updateGraphics.toArray());this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:"transform"})},redo:()=>{W(wa, this.updateGraphics.toArray());this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:"transform"})},addToSelection:async sa=>{this.updateGraphics.add(sa);this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[sa],removed:[],type:"selection-change"},type:"update"});wa.onEnd();wa.destroy();sa=await this._setupMove3DOperation(this.updateGraphics.toArray(),X,da,"transform",!0);Q(sa)||this._setUpdateOperationHandle(sa, X)},removeFromSelection:sa=>{this.updateGraphics.remove(sa);this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[sa],type:"selection-change"},type:"update"});wa.complete()},toggleTool:()=>{}});xa.push(...this._getHandlesForComponent(wa,X),da.on("immediate-click",sa=>this._getCommonUpdateOperationClickHandlers(wa,sa,X),O.ViewEventPriorities.WIDGET),da.on("key-down",sa=>{this._getCommonUpdateOperationKeyDownHandlers(wa, sa)},O.ViewEventPriorities.WIDGET));return wa}async _setupPolyTransform3DOperation(R,X,da,fa=!1){const {enableRotation:ma,enableScaling:ra,enableZ:pa,preserveAspectRatio:la}=X;var na=await this._requireModule(new Promise((ya,Y)=>a(["../../views/3d/interactive/editingTools"],ya,Y)));if(Q(na))return na;const {ManipulatedObject3DGraphic:va,ExtentTransformTool:ta}=na.module;na=this.view?.inputManager?.isModifierKeyDown(t.sketchKeys.constraint);const xa=new va({view:da,graphic:R}),wa=new ta({object:xa, view:da,enableRotation:ma,enableScaling:ra,enableZ:pa,preserveAspectRatio:!!la!==!!na,sketchOptions:this.sketchOptions});da.tools.add(wa);fa||this.updateGraphics.add(R);const sa=[],Aa=new G.UpdateOperationHandle({activeComponent:wa,tool:"transform",type:"update",onEnd:()=>{sa.forEach(ya=>ya.remove());sa.length=0;da.tools?.remove(wa);wa.destroyed||wa.destroy();xa.destroy()},canUndo:()=>wa.canUndo,undo:()=>{wa.undo();this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:"transform"})},canRedo:()=> wa.canRedo,redo:()=>{wa.redo();this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:"transform"})},addToSelection:async ya=>{this.updateGraphics.add(ya);this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[ya],removed:[],type:"selection-change"},type:"update"});Aa.onEnd();Aa.destroy();ya=await this._setupMove3DOperation(this.updateGraphics.toArray(),X,da,"transform",!0);Q(ya)||this._setUpdateOperationHandle(ya, X)},removeFromSelection:ya=>{this.updateGraphics.remove(ya);this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[ya],type:"selection-change"},type:"update"});Aa.complete()},toggleTool:async()=>{if(1===this.updateGraphics.length&&!1!==X.toggleToolOnClick){var ya=await this._setupReshape3DOperation(R,X,da,!0);ya&&!Q(ya)&&(Aa.onEnd(),Aa.destroy(),this._setUpdateOperationHandle(ya,X))}}});sa.push(...this._getHandlesForComponent(Aa, X),da.on("immediate-click",ya=>this._getCommonUpdateOperationClickHandlers(Aa,ya,X),O.ViewEventPriorities.WIDGET),da.on("key-down",ya=>this._getCommonUpdateOperationKeyDownHandlers(Aa,ya),O.ViewEventPriorities.WIDGET),da.on("key-down",ya=>{ya.key!==t.sketchKeys.constraint||ya.repeat||(wa.preserveAspectRatio=!wa.preserveAspectRatio,ya.stopPropagation())},O.ViewEventPriorities.WIDGET),da.on("key-up",ya=>{ya.key===t.sketchKeys.constraint&&(wa.preserveAspectRatio=!wa.preserveAspectRatio,ya.stopPropagation())}, O.ViewEventPriorities.WIDGET));return Aa}async _setupMove2DOperation(R,X,da){this.updateGraphics.addMany(R);await this._updateSpatialReference(R);const fa=await this._getGraphicMover(R,X,da);if(Q(fa))return fa;const ma=new G.UpdateOperationHandle({activeComponent:fa,tool:"move",type:"update",onEnd:()=>{this._displayDefaultCursor();la.forEach(na=>na.remove());pa.forEach(na=>na.remove());la=[];pa=[];fa.destroy();this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const na= this.updateGraphics.toArray();ja(ma,na);ma.refreshComponent();this._emitUndoEvent({graphics:na,tool:"move"})},redo:()=>{const na=this.updateGraphics.toArray();W(ma,na);ma.refreshComponent();this._emitRedoEvent({graphics:na,tool:"move"})},addToSelection:async na=>{await this._updateSpatialReference(na);this.updateGraphics.push(na);fa.graphics=this.updateGraphics.toArray();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[na], removed:[],type:"selection-change"},type:"update"})},removeFromSelection:na=>{const va=this.updateGraphics.indexOf(na);ma.history.undo.forEach(xa=>xa.updates.splice(va,1));ma.history.redo.forEach(xa=>xa.updates.splice(va,1));this.updateGraphics.remove(na);const ta=this.updateGraphics.toArray();this.emit("update",{graphics:ta,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[na],type:"selection-change"},type:"update"});0===this.updateGraphics.length?ma.complete():fa.graphics= ta}});let ra=!1,pa=[da.on("immediate-click",na=>this._getCommonUpdateOperationClickHandlers(ma,na,X),O.ViewEventPriorities.WIDGET),da.on("key-down",na=>{this._getCommonUpdateOperationKeyDownHandlers(ma,na);na.key!==t.sketchKeys.constraint||na.repeat||(ra=!0,fa.enableMoveAllGraphics=!fa.enableMoveAllGraphics)},O.ViewEventPriorities.WIDGET),da.on("key-up",na=>{na.key===t.sketchKeys.constraint&&ra&&(ra=!1,fa.enableMoveAllGraphics=!fa.enableMoveAllGraphics)},O.ViewEventPriorities.WIDGET)],la=this._getHandlesForComponent(ma, X);return ma}async _setupReshape3DOperation(R,X,da,fa=!1){const ma=await this._requireModule(new Promise((xa,wa)=>a(["../../views/3d/interactive/editingTools"],xa,wa)));if(Q(ma))return ma;const {ManipulatedObject3DGraphic:ra,ReshapeTool3D:pa}=ma.module,la=new ra({view:da,graphic:R});R=I.isSupportedObject(la);if(R!==N.SupportedObjectResult.SUPPORTED)return la.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${N.isSupportedObjectResultMessage(R)}).`), null;R=X.reshapeOptions;const na=new pa({view:da,object:la,enableZVertex:X.enableZ&&"move"===R?.vertexOperation,enableZShape:X.enableZ&&"move"===R?.shapeOperation,enableMoveObject:"move"===R?.shapeOperation||"move-xy"===R?.shapeOperation,enableMidpoints:"split"===R?.edgeOperation,enableEdgeOffset:"offset"===R?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});da.tools.add(na);fa||this.updateGraphics.add(la.graphic);const va=[],ta=new G.UpdateOperationHandle({activeComponent:na, tool:"reshape",type:"update",onEnd:()=>{va.forEach(xa=>xa.remove());va.length=0;da.tools?.remove(na);na.destroyed||na.destroy();la.destroy()},canUndo:()=>na.canUndo,undo:()=>{na.undo();this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:"reshape"})},canRedo:()=>na.canRedo,redo:()=>{na.redo();this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:"reshape"})},addToSelection:async xa=>{this.updateGraphics.add(xa);this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active", aborted:!1,tool:this.activeTool,toolEventInfo:{added:[xa],removed:[],type:"selection-change"},type:"update"});ta.onEnd();ta.destroy();xa=await this._setupMove3DOperation(this.updateGraphics.toArray(),X,da,"transform",!0);Q(xa)||this._setUpdateOperationHandle(xa,X)},removeFromSelection:xa=>{this.updateGraphics.remove(xa);this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[xa],type:"selection-change"},type:"update"}); ta.complete()},toggleTool:async()=>{if(!1!==X.toggleToolOnClick){ta.onEnd();ta.destroy();var xa=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),X,da,!0);Q(xa)||this._setUpdateOperationHandle(xa,X)}}});va.push(...this._getHandlesForComponent(ta,X),da.on("immediate-click",xa=>this._getCommonUpdateOperationClickHandlers(ta,xa,X),O.ViewEventPriorities.WIDGET),da.on("key-down",xa=>{this._getCommonUpdateOperationKeyDownHandlers(ta,xa)},O.ViewEventPriorities.WIDGET));return ta}async _setupTransformOrReshape2DOperation(R, X,da,fa){this.updateGraphics.addMany(R);await this._updateSpatialReference(R);R="transform"===X?await this._getBox(R,da,fa):await this._getReshape(R,da,fa);if(Q(R))return R;const ma=new G.UpdateOperationHandle({activeComponent:R,type:"update",onEnd:()=>{pa.forEach(la=>la.remove());ra.forEach(la=>la.remove());pa=[];ra=[];ma.activeComponent&&!ma.activeComponent.destroyed&&ma.activeComponent.destroy();this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{ja(ma,this.updateGraphics.toArray()); ma.refreshComponent();this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:ma.tool})},redo:()=>{W(ma,this.updateGraphics.toArray());ma.refreshComponent();this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:ma.tool})},addToSelection:async la=>{var na=ma.activeComponent;if("reshape"===na?.type){na=[...this.updateGraphics,la];this.updateGraphics.removeAll();ma.onEnd();ma.destroy();na=await this._setupTransformOrReshape2DOperation(na,"transform",da,fa);if(Q(na))return;this._setUpdateOperationHandle(na, da)}else this.updateGraphics.add(la),na.graphics=this.updateGraphics.toArray(),na.refresh(),ma.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[la],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async la=>{const na=this.updateGraphics.indexOf(la);ma.history.undo.forEach(ta=>ta.updates.splice(na,1));ma.history.redo.forEach(ta=>ta.updates.splice(na,1));this.updateGraphics.remove(la); const va=this.updateGraphics.toArray();if(0===va.length)ma.complete();else{const ta=va[0].geometry;1!==va.length||null==ta||"point"!==ta.type&&"multipoint"!==ta.type?ma.activeComponent.graphics=va:ma.toggleTool()}this.emit("update",{graphics:va,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[la],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(!(1va.remove()),pa=this._getHandlesForComponent(ma,da)))}}});let ra=[fa.on("immediate-click",la=>this._getCommonUpdateOperationClickHandlers(ma,la,da),O.ViewEventPriorities.WIDGET),fa.on("key-down", la=>{this._getCommonUpdateOperationKeyDownHandlers(ma,la);la.key===t.sketchKeys.constraint&&!la.repeat&&ma&&(la=ma.activeComponent)&&"box"===la.type&&(la.preserveAspectRatio=!la.preserveAspectRatio)},O.ViewEventPriorities.WIDGET),fa.on("key-up",la=>{la.key===t.sketchKeys.constraint&&ma&&(la=ma.activeComponent)&&"box"===la.type&&(la.preserveAspectRatio=!la.preserveAspectRatio)},O.ViewEventPriorities.WIDGET)],pa=this._getHandlesForComponent(ma,da);return ma}async _getGraphicMover(R,X,da){const {enableMoveAllGraphics:fa, highlightOptions:ma}=X;X=await this._requireModule(new Promise((ra,pa)=>a(["../../views/draw/support/GraphicMover"],la=>ra(U(la)),pa)));return Q(X)?X:new X.module.default({enableMoveAllGraphics:fa,highlightsEnabled:!!ma?.enabled,indicatorsEnabled:!1,graphics:R,view:da,callbacks:{onGraphicMoveStart:({dx:ra,dy:pa,graphic:la})=>{this._displayGrabbingCursor();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:ra,dy:pa,mover:la,type:"move-start"}, type:"update"})},onGraphicMove:({dx:ra,dy:pa,graphic:la})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:ra,dy:pa,mover:la,type:"move"},type:"update"}),onGraphicMoveStop:({dx:ra,dy:pa,graphic:la})=>{this._displayPointerCursor();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:ra,dy:pa,mover:la,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=> this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(R,X,da){const {enableRotation:fa,enableScaling:ma,highlightOptions:ra,preserveAspectRatio:pa}=X;X=await this._requireModule(new Promise((na,va)=>a(["../../views/draw/support/Box"],ta=>na(U(ta)),va)));if(Q(X))return X;const la=this.view?.inputManager?.isModifierKeyDown(t.sketchKeys.constraint);return new X.module.default({graphics:R,enableRotation:fa,enableScaling:ma,highlightsEnabled:!!ra?.enabled,preserveAspectRatio:!!pa!== !!la,layer:this._internalGraphicsLayer,view:da,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na},type:"update"}),onMove:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na},type:"update"}),onMoveStop:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1, tool:this.activeTool,toolEventInfo:{...na},type:"update"}),onScaleStart:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na},type:"update"}),onScale:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na},type:"update"}),onScaleStop:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na}, type:"update"}),onRotateStart:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na},type:"update"}),onRotate:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na},type:"update"}),onRotateStop:na=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...na},type:"update"})}})}async _getReshape(R, X,da){const fa="split"===X.reshapeOptions?.edgeOperation,ma="move"===X.reshapeOptions?.shapeOperation;X=!!X.highlightOptions?.enabled;const ra=await this._requireModule(new Promise((pa,la)=>a(["../../views/draw/support/Reshape"],na=>pa(U(na)),la)));return Q(ra)?ra:new ra.module.default({enableMidpoints:fa,enableMovement:ma,graphic:R[0],highlightsEnabled:X,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:da,callbacks:{onReshapeStart:pa=>this.emit("update", {graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...pa},type:"update"}),onReshape:pa=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...pa},type:"update"}),onReshapeStop:({mover:pa,type:la})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:pa,type:la},type:"update"}),onMoveStart:({dx:pa,dy:la,mover:na, type:va})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:pa,dy:la,mover:na,type:va},type:"update"}),onMove:({dx:pa,dy:la,mover:na,type:va})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:pa,dy:la,mover:na,type:va},type:"update"}),onMoveStop:({dx:pa,dy:la,mover:na,type:va})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active", aborted:!1,tool:this.activeTool,toolEventInfo:{dx:pa,dy:la,mover:na,type:va},type:"update"}),onVertexAdd:({added:pa,type:la,vertices:na})=>{pa=pa.map(va=>f.geometryToCoordinates(va.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:pa,vertices:na,type:la},type:"update"})},onVertexRemove:({removed:pa,type:la,vertices:na})=>{pa=pa.map(va=>f.geometryToCoordinates(va.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(), state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:pa,vertices:na,type:la},type:"update"})}}})}_getHandlesForComponent(R,X){const da=R.activeComponent;if(!da)return[];switch(da.type){case "graphic-mover":return[da.on("graphic-click",({graphic:fa,viewEvent:ma})=>{ma.native?.shiftKey&&(ma.stopPropagation(),R.removeFromSelection(fa))}),da.on("graphic-move-start",fa=>R.addToHistory(ha(fa.allGraphics)))];case "box":return[da.on("graphic-click",fa=>this._onTransformOrReshape2DGraphicClick(R, X,fa)),da.on("move-start",fa=>R.addToHistory(ha(fa.graphics))),da.on("rotate-start",fa=>R.addToHistory(ha(fa.graphics))),da.on("scale-start",fa=>R.addToHistory(ha(fa.graphics)))];case "reshape":return[da.on("graphic-click",fa=>this._onTransformOrReshape2DGraphicClick(R,X,fa)),da.on("move-start",fa=>R.addToHistory(ha([fa.mover]))),da.on("reshape-start",fa=>R.addToHistory(ha([fa.graphic]))),da.on("vertex-add",fa=>R.addToHistory(ha([fa.oldGraphic]))),da.on("vertex-remove",fa=>R.addToHistory(ha([fa.oldGraphic])))]; case "move-3d":return[da.events.on("record-undo",({updates:fa})=>{R.addToHistory({updates:fa})}),da.events.on("move-start",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:0{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:fa.dx, dy:fa.dy,mover:0{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:0{fa.shiftKey?this._toggleSelection([fa.object.graphic],R,X):R.toggleTool()})];case "transform-3d":return[da.events.on("record-undo", ({updates:fa})=>{R.addToHistory({updates:fa})}),da.events.on("translate-start",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,dx:fa.dxScreen,dy:fa.dyScreen,type:"move-start"},type:"update"})}),da.events.on("translate-stop",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,dx:fa.dxScreen,dy:fa.dyScreen, type:"move-stop"},type:"update"})}),da.events.on("rotate-start",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,angle:fa.angle,type:"rotate-start"},type:"update"})}),da.events.on("rotate-stop",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,angle:fa.angle,type:"rotate-stop"},type:"update"})}),da.events.on("scale-start", fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,xScale:fa.xScale,yScale:fa.yScale,type:"scale-start"},type:"update"})}),da.events.on("scale-stop",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,xScale:fa.xScale,yScale:fa.yScale,type:"scale-stop"},type:"update"})}),da.events.on("translate",fa=>{this.emit("update", {graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,dx:fa.dxScreen,dy:fa.dyScreen,type:"move"},type:"update"})}),da.events.on("rotate",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,angle:fa.angle,type:"rotate"},type:"update"})}),da.events.on("scale",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active", aborted:!1,tool:this.activeTool,toolEventInfo:{mover:fa.object.graphic,xScale:fa.xScale,yScale:fa.yScale,type:"scale"},type:"update"})}),da.events.on("immediate-click",fa=>{fa.shiftKey?this._toggleSelection([fa.object.graphic],R,X):R.toggleTool()})];case "reshape-3d":return[da.events.on("reshape",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...fa,mover:fa.object.graphic},type:"update"})}),da.events.on("move",fa=>{this.emit("update", {graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...fa,mover:fa.object.graphic},type:"update"})}),da.events.on("vertex-add",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:fa,type:"update"})}),da.events.on("vertex-remove",fa=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:fa,type:"update"})}),da.events.on("immediate-click", fa=>{fa.shiftKey?this._toggleSelection([fa.object.graphic],R,X):R.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(R,X,da){const {graphic:fa,viewEvent:ma}=da;if(ma.native?.shiftKey&&fa.layer===this.layer)return ma.stopPropagation(),R.removeFromSelection(fa);if(X.toggleToolOnClick)return ma.stopPropagation(),R.toggleTool()}_setUpdateOperationHandle(R,X){this._operationHandle=R;const da=this.view?.map;this._disablePopup(X);R.on("complete",()=>{if(R===this._operationHandle){const fa=this.updateGraphics.toArray(), ma=this._operationHandle.tool;this._operationHandle.destroy();this._operationHandle=null;this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray());this.updateGraphics.removeAll();da&&da.remove(this._internalGraphicsLayer);this._restorePopup(X);this.emit("update",{graphics:fa,state:"complete",aborted:R.cancelled,tool:ma,toolEventInfo:null,type:"update"})}})}async _getCommonUpdateOperationClickHandlers(R,X,da){const fa=n.createScreenPointFromEvent(X),ma=await X.async(()=>this._getFirstHit(fa)); null==ma?R.complete():X.native.shiftKey&&this._toggleSelection([ma.graphic],R,da)?X.stopPropagation():this.updateGraphics.includes(ma.graphic)?X.stopPropagation():R.complete()}_toggleSelection(R,X,da){const fa=!!da.multipleSelectionEnabled;return R.some(ma=>null==ma?!1:fa&&ma.layer===this.layer?(this.updateGraphics.includes(ma)?X.removeFromSelection(ma):X.addToSelection(ma),!0):!1)}_getCommonUpdateOperationKeyDownHandlers(R,X){if(R){var da=X.key;da===t.sketchKeys.undo&&R.canUndo()?(X.stopPropagation(), R.undo()):da===t.sketchKeys.redo&&R.canRedo()?(X.stopPropagation(),R.redo()):da===t.sketchKeys.cancel?(X.stopPropagation(),R.cancel()):this.allowDeleteKey&&t.sketchKeys.delete.includes(da)&&this._onDeleteKey(X)}}_onDeleteKey(R){if(this._operationHandle&&"update"===this._operationHandle.type){var X=this.activeComponent,da=this.updateGraphics.toArray();null!=X&&("reshape"!==X.type||1===da.length&&"point"===da[0].geometry?.type)&&(R.stopPropagation(),this.delete())}}_removeDefaultLayer(){this._internalGraphicsLayer&& (this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=F.destroyMaybe(this._internalGraphicsLayer))}_isComponentGraphic(R){const {activeComponent:X}=this;return R&&null!=X?R.attributes?.esriSketchTool||"draw-2d"===X.type&&X.graphic===R||("box"===X.type||"reshape"===X.type)&&X.isUIGraphic(R):!1}_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(R,X,da){E.getLogger(this).error(new k(R,X,da))}async _requireModule(R){const X=new AbortController;this._moduleLoaderAbortController=X;R=await R;return this._moduleLoaderAbortController!==X||X.signal.aborted?{requireError:"aborted"}:{module:R}}_emitUndoEvent(R){this.emit("undo",{...R,type:"undo"})}_emitRedoEvent(R){this.emit("redo",{...R,type:"redo"})}_emitDeleteEvent(R){this.emit("delete", {...R,type:"delete"})}get test(){}wait(){return y.whenOnce(()=>!this.updating)}_beginAsyncOperation(){this._numUpdating+=1;this.notifyChange("updating")}_endAsyncOperation(){--this._numUpdating;this.notifyChange("updating")}_disablePopupEnabled(R){return"3d"!==this.view?.type||this.updateOnGraphicClick||(R?.toggleToolOnClick??!1)}_disablePopup(R){this._disablePopupEnabled(R)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(R){this._disablePopupEnabled(R)&& this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const R=this.view;R?(F.abortMaybe(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await p.whenOrAbort(y.whenOnce(()=>R?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",ka("view"))}_logMissingLayer(){this._logError("sketch:missing-property", ka("layer"))}};b.__decorate([l.property()],w.prototype,"_defaultSnappingManager",void 0);b.__decorate([l.property()],w.prototype,"updating",null);b.__decorate([l.property()],w.prototype,"_operationHandle",void 0);b.__decorate([l.property({readOnly:!0})],w.prototype,"activeTool",null);b.__decorate([l.property()],w.prototype,"activeFillSymbol",void 0);b.__decorate([l.property()],w.prototype,"activeLineSymbol",void 0);b.__decorate([l.property()],w.prototype,"activeVertexSymbol",void 0);b.__decorate([l.property()], w.prototype,"allowDeleteKey",void 0);b.__decorate([l.property({readOnly:!0})],w.prototype,"createGraphic",null);b.__decorate([l.property()],w.prototype,"defaultCreateOptions",null);b.__decorate([l.property()],w.prototype,"defaultUpdateOptions",null);b.__decorate([l.property({type:H,nonNullable:!0})],w.prototype,"labelOptions",null);b.__decorate([l.property()],w.prototype,"layer",void 0);b.__decorate([l.property({types:c.symbolTypes})],w.prototype,"pointSymbol",void 0);b.__decorate([l.property({types:c.symbolTypes})], w.prototype,"polygonSymbol",void 0);b.__decorate([l.property({types:c.symbolTypes})],w.prototype,"polylineSymbol",void 0);b.__decorate([l.property()],w.prototype,"meshSymbol",void 0);b.__decorate([l.property({type:M,nonNullable:!0})],w.prototype,"snappingOptions",null);b.__decorate([l.property()],w.prototype,"snappingManager",null);b.__decorate([l.property({readOnly:!0})],w.prototype,"state",null);b.__decorate([l.property({type:K,nonNullable:!0})],w.prototype,"tooltipOptions",null);b.__decorate([l.property({readOnly:!0})], w.prototype,"updateGraphics",void 0);b.__decorate([l.property()],w.prototype,"updateOnGraphicClick",void 0);b.__decorate([l.property({type:D,nonNullable:!0})],w.prototype,"valueOptions",null);b.__decorate([l.property({types:c.symbolTypes})],w.prototype,"vertexSymbol",void 0);b.__decorate([l.property({value:null})],w.prototype,"view",null);b.__decorate([l.property({constructOnly:!0,type:P})],w.prototype,"sketchOptions",void 0);w=b.__decorate([q.subclass("esri.widgets.Sketch.SketchViewModel")],w);const ka= R=>`Property '${R}' is missing on SketchViewModel.`;return w})},"esri/views/3d/interactive/editingTools/isSupportedObjectUtils":function(){define(["exports","../../../../core/has"],function(a,b){a.SupportedObjectResult=void 0;(function(c){c[c.SUPPORTED=0]="SUPPORTED";c[c.GRAPHICS_LAYER_MISSING=1]="GRAPHICS_LAYER_MISSING";c[c.GEOMETRY_MISSING=2]="GEOMETRY_MISSING";c[c.GEOMETRY_TYPE_UNSUPPORTED=3]="GEOMETRY_TYPE_UNSUPPORTED";c[c.ELEVATION_MODE_UNSUPPORTED=4]="ELEVATION_MODE_UNSUPPORTED";c[c.SYMBOL_TYPE_UNSUPPORTED= 5]="SYMBOL_TYPE_UNSUPPORTED"})(a.SupportedObjectResult||(a.SupportedObjectResult={}));a.isSupportedObjectResultMessage=function(c){switch(c){case a.SupportedObjectResult.GRAPHICS_LAYER_MISSING:return"not owned by a graphics layer";case a.SupportedObjectResult.GEOMETRY_MISSING:return"no geometry";case a.SupportedObjectResult.GEOMETRY_TYPE_UNSUPPORTED:return"the geometry type is not supported";case a.SupportedObjectResult.ELEVATION_MODE_UNSUPPORTED:return"the elevation mode is not supported";case a.SupportedObjectResult.SYMBOL_TYPE_UNSUPPORTED:return"the symbol type is not supported"}return""}; Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/3d/interactive/editingTools/move/isSupportedObject":function(){define(["exports","../../../../../core/has","../../../../../support/elevationInfoUtils","../isSupportedObjectUtils"],function(a,b,c,m){a.isSupportedObject=function(k){if(k.graphic&&"graphics"!==k.graphic.layer?.type)return m.SupportedObjectResult.GRAPHICS_LAYER_MISSING;const w=k.operations?.data.type;if(!w)return m.SupportedObjectResult.GEOMETRY_TYPE_UNSUPPORTED; switch(w){case "polygon":case "point":case "polyline":case "mesh":break;default:return m.SupportedObjectResult.GEOMETRY_TYPE_UNSUPPORTED}return c.hasEffectiveFeatureExpressionInfo(k.elevationInfo)?m.SupportedObjectResult.ELEVATION_MODE_UNSUPPORTED:m.SupportedObjectResult.SUPPORTED};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/3d/interactive/editingTools/reshape/isSupportedObject":function(){define(["exports","../../../../../support/elevationInfoUtils","../isSupportedObjectUtils"], function(a,b,c){function m(k){if(k.graphic&&"graphics"!==k.graphic.layer?.type)return{result:c.SupportedObjectResult.GRAPHICS_LAYER_MISSING};if(!k.operations)return{result:c.SupportedObjectResult.GEOMETRY_MISSING};if(b.hasEffectiveFeatureExpressionInfo(k.elevationInfo))return{result:c.SupportedObjectResult.ELEVATION_MODE_UNSUPPORTED};const w=k.operations.data.type;k=k.operations.data.geometry;return"point"===w||"mesh"===w||"polyline"===w||"polygon"===w?{result:c.SupportedObjectResult.SUPPORTED,geometry:k}: {result:c.SupportedObjectResult.GEOMETRY_TYPE_UNSUPPORTED}}a.geometryOfSupportedObject=function(k){return m(k).geometry};a.isSupportedObject=function(k){return m(k).result};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/3d/interactive/editingTools/transform/isSupportedGraphic":function(){define(["exports","../../../../../core/has","../../../../../support/elevationInfoUtils","../isSupportedObjectUtils"],function(a,b,c,m){a.isSupportedGraphic=function(k){if("graphics"!== k.layer?.type)return m.SupportedObjectResult.GRAPHICS_LAYER_MISSING;if(null==k.geometry)return m.SupportedObjectResult.GEOMETRY_MISSING;switch(k.geometry.type){case "point":break;case "polygon":case "polyline":case "multipoint":case "extent":case "mesh":return m.SupportedObjectResult.SUPPORTED;default:return m.SupportedObjectResult.GEOMETRY_TYPE_UNSUPPORTED}const w=null!=k.symbol&&"point-3d"===k.symbol.type&&k.symbol.symbolLayers;return w&&w.some(g=>"object"===g.type)?"on-the-ground"!==c.getGraphicEffectiveElevationMode(k)&& c.hasGraphicFeatureExpressionInfo(k)?m.SupportedObjectResult.ELEVATION_MODE_UNSUPPORTED:m.SupportedObjectResult.SUPPORTED:m.SupportedObjectResult.SYMBOL_TYPE_UNSUPPORTED};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/views/draw/support/layerUtils":function(){define(["exports"],function(a){a.addUniqueLayer=function(b,c,m){if(c&&b?.map){({map:b}=b);var k=b.layers.find(w=>w===c);k||b.add(c,m);k&&null!=m&&b.layers.reorder(k,m)}};a.findLayerView=function(b,c){const m="subtype-sublayer"=== c?.type?c.parent:c;return b.allLayerViews.find(k=>{k=k.layer;return k===m||"sublayers"in k&&null!=k.sublayers&&k.sublayers.includes(m)})};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Sketch/support/OperationHandle":function(){define("exports ../../../chunks/tslib.es6 ../../../core/compilerUtils ../../../core/Evented ../../../core/accessorSupport/decorators/property ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g,E){a.OperationHandle=class extends m.EventedAccessor{constructor(F){super(F);this.cancelled=!1;this.history={undo:[],redo:[]};this.type=null}get tool(){if(!this.activeComponent)return null;switch(this.activeComponent.type){case "graphic-mover":case "move-3d":return"move";case "box":case "transform-3d":return"transform";case "reshape":case "reshape-3d":return"reshape";case "draw-2d":case "draw-3d":return this.activeComponent.geometryType;default:c.neverReached(this.activeComponent)}return null}addToHistory(F){this.history.redo= [];this.history.undo.push(F)}resetHistory(){this.history.redo=[];this.history.undo=[]}canUndo(){return 0{this.canUndo()&&F()})}set redo(F){this._set("redo", ()=>{this.canRedo()&&F()})}};b.__decorate([k.property()],a.OperationHandle.prototype,"activeComponent",void 0);b.__decorate([k.property()],a.OperationHandle.prototype,"cancelled",void 0);b.__decorate([k.property()],a.OperationHandle.prototype,"history",void 0);b.__decorate([k.property()],a.OperationHandle.prototype,"tool",null);b.__decorate([k.property()],a.OperationHandle.prototype,"type",void 0);b.__decorate([k.property()],a.OperationHandle.prototype,"canUndo",null);b.__decorate([k.property()], a.OperationHandle.prototype,"canRedo",null);b.__decorate([k.property()],a.OperationHandle.prototype,"onEnd",void 0);b.__decorate([k.property()],a.OperationHandle.prototype,"undo",null);b.__decorate([k.property()],a.OperationHandle.prototype,"redo",null);b.__decorate([k.property()],a.OperationHandle.prototype,"toggleTool",void 0);b.__decorate([k.property()],a.OperationHandle.prototype,"addToSelection",void 0);b.__decorate([k.property()],a.OperationHandle.prototype,"removeFromSelection",void 0);a.OperationHandle= b.__decorate([E.subclass("esri.widgets.Sketch.support.OperationHandle")],a.OperationHandle);a.CreateOperationHandle=class extends a.OperationHandle{};b.__decorate([k.property()],a.CreateOperationHandle.prototype,"activeComponent",void 0);a.CreateOperationHandle=b.__decorate([E.subclass("esri.widgets.Sketch.support.OperationHandle.CreateOperationHandle")],a.CreateOperationHandle);a.UpdateOperationHandle=class extends a.OperationHandle{};b.__decorate([k.property()],a.UpdateOperationHandle.prototype, "activeComponent",void 0);a.UpdateOperationHandle=b.__decorate([E.subclass("esri.widgets.Sketch.support.OperationHandle.UpdateOperationHandle")],a.UpdateOperationHandle);Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/UpdateWorkflow":function(){define("../../chunks/tslib.es6 ../../Graphic ../../core/Error ../../core/handleUtils ../../core/Logger ../../core/maybe ../../core/promiseUtils ../../core/Queue ../../core/reactiveUtils ../../core/SetUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../layers/support/editableLayers ../../layers/support/layerUtils ../../views/draw/support/HighlightHelper ../../views/input/InputManager ../../views/interactive/sketch/SketchOptions ./CreateFeaturesWorkflow ./UpdateFeatureWorkflow ./UpdateRecordWorkflow ./UpdateWorkflowData ./Workflow ./workflowUtils ../Feature/support/featureUtils ../support/templateUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O,t){var H;l=H=class extends d{constructor(K){super(K);this._workflowStack=new E(p.last);this._sketchStack=new E(p.last);this.data=void 0;this.type="update"}get activeEditorItem(){return this.activeWorkflow?.data.editorItem??void 0}get activeFeatureFormViewModel(){return this.activeWorkflow?.featureFormViewModel}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get activeWorkflow(){return this._workflowStack.last()}get hasUpdatableCandidates(){const {candidates:K, viewModel:D}=this.data;return K.some(({layer:A})=>D.findEditorItemForLayer(A)?.supportsUpdateWorkflow)}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return!!this.activeEditorItem?.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return!!this.activeEditorItem?.capabilities.update.attachments.enabled}get hasPendingEdits(){return Array.from(this._workflowStack).some(K=>K.hasPendingEdits)}get helpMessage(){return this.activeWorkflow?.helpMessage? this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return!!this.activeEditorItem?.hasInvalidFormTemplate}async back(K=()=>Promise.resolve(!0)){const {activeWorkflow:D}=this;if(null!=D?.featureFormViewModel.relationshipId)D.featureFormViewModel.relationshipId=null;else if(D){if(!D.hasPendingEdits||await K())D.hasPreviousStep?await D.previous({cancelCurrentStep:!0}): await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0})}async cancelActiveWorkflow(K){await this.activeWorkflow?.cancel(K);await this._popWorkflow()}async commit(){await this._drainWorkflowStack(K=>K.commit());await super.commit()}static create(K){const {viewModel:D,snappingManager:A,startAt:M,addAttachmentsCallback:C,applyEditsCallback:e}=K;K=K.sketchOptions??new B;K=new H({data:new I({addAttachmentsCallback:C, applyEditsCallback:e,sketchOptions:K,snappingManager:A,viewModel:D}),onCommit:async()=>{}});K._set("steps",this._createWorkflowSteps(K,M));return K}async save(){1K.cancel({force:!0}))}async _createNestedCreateFeaturesWorkflow(K){const {relatedLayer:D}=K,{addAttachmentsCallback:A,applyEditsCallback:M,sketchOptions:C,snappingManager:e,viewModel:n}=this.data;if(!h.isEditableLayer(D))throw new c("editor:unsupported-layer","Editing is not supported on the provided layer");K=this._getCreationInfoForNestedCreateFeaturesWorkflow(K);return x.create({addAttachmentsCallback:A,applyEditsCallback:M, creationInfo:K,isNested:!0,parent:"create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,sketchOptions:C,snappingManager:e,startAt:K.template||K.initialFeature?"creating-features":"awaiting-feature-creation-info",viewModel:n})}_getCreationInfoForNestedCreateFeaturesWorkflow(K){const {relatedLayer:D}=K;if(!h.isEditableLayer(D)||u.isSubtypeGroupLayer(D))throw new c("editor:unsupported-layer","Editing is not supported on the provided layer");const A={layer:D,maxFeatures:1};K=this._makeRelatedRecordAttributes(K); const M=t.getAllTemplatesForLayer(D);0await this.startCreatingRelatedRecord(G),editRelatedRecord:async({relatedFeature:G})=>await this.startUpdating(G)}});await F.whenOnce(()=>!n.updating);return n}async _drainWorkflowStack(K){const D=this._workflowStack,A=[];for(;0M.destroy());this._updatingHandles.addPromise(C);A.push(C)}await Promise.all(A)}_makeRelatedRecordAttributes(K){const {parentFeature:D, relatedLayer:A,relationshipId:M}=K;if(O.isGraphicForRelatableFeatureSupportedLayer(D))if(K=A.relationships?.find(e=>e.id===M))if("origin"===K.role)P("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");else{var C=D.sourceLayer;K.relatedTableId!==C.layerId&&P("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");if(C=C.relationships?.find(e=>e.id===M))return(C= D.getAttribute(C.keyField))||P("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field."),{[K.keyField]:C};P("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.")}else P("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.")}async _popWorkflow(){this._workflowStack.pop()?.destroy(); this._sketchStack.pop();const K=await this._reconcileWorkflowStack();if(0{}),exit:K?.exit??(async()=>{}),viewModel:K?.viewModel}}_workflowRequiresSketchViewModel(K){const {type:D}=K;return"update-feature"===D||"create-features"===D&&!u.isTable(K.data.creationInfo?.layer)}static _createWorkflowSteps(K,D="awaiting-feature-to-update"){const {data:A}=K;return v.createWorkflowSteps(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],D,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update", async setUp(){const {spinnerViewModel:M}=A.viewModel,C=A.viewModel.view;let e=null;K.addHandles(m.makeHandle(()=>{e=w.abortMaybe(e)}),this.id);A.rootFeature=null;A.candidates=[];const n=C.on("immediate-click",async G=>{M.location=G.mapPoint;M.visible=!0;e?.abort();const {editorItems:L}=A.viewModel;e=new AbortController;const S=await G.async(()=>new Promise((T,ea)=>{g.onAbort(e?.signal,()=>ea(g.createAbortError()));T(v.fetchCandidates(L,C,G,e?.signal))}));g.throwIfAborted(e);A.candidates=S.filter(T=> "fulfilled"===T.status).flatMap(T=>T.value).filter(T=>!T.isAggregate);M.visible=1===A.candidates.length;0!==A.candidates.length&&(G.stopPropagation(),1===A.candidates.length?(A.rootFeature=A.candidates[0],K.go("editing-existing-feature").catch(()=>{}).then(()=>M.visible=!1)):K.next())},z.ViewEventPriorities.TOOL);C.focus();K.addHandles(n,this.id)},async tearDown(){0===A.candidates.length&&(A.viewModel.spinnerViewModel.visible=!1);K.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=> ({id:"awaiting-update-feature-candidate",async setUp(){A.rootFeature=null;const {view:M}=A.viewModel;if(M){var C=new f({view:M});K.addHandles([F.watch(()=>A.rootFeature,(e,n)=>{C.remove(n);C.add(e)},F.sync),m.makeHandle(()=>C.removeAll())],this.id)}},async tearDown(){K.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const {rootFeature:M,viewModel:C}=K.data;if(!M)throw new c("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until the root feature is defined"); await K.startUpdating(M);C.spinnerViewModel.visible=!1;const e=g.debounce(async()=>{await F.whenOnce(()=>!K.updating);K.previous()});K.addHandles([F.watch(()=>K.nestedWorkflowCount,(n,G)=>{0===n&&0!==G&&e()},F.sync)],this.id)},async tearDown(){await K.cancelAll();K.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){A.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment", parent:"editing-existing-feature",async setUp(){},async tearDown(){A.viewModel.attachmentsViewModel.mode="view"}})})}};a.__decorate([y.property()],l.prototype,"activeEditorItem",null);a.__decorate([y.property()],l.prototype,"activeFeatureFormViewModel",null);a.__decorate([y.property()],l.prototype,"activeSketchViewModel",null);a.__decorate([y.property()],l.prototype,"activeWorkflow",null);a.__decorate([y.property()],l.prototype,"data",void 0);a.__decorate([y.property()],l.prototype,"hasUpdatableCandidates", null);a.__decorate([y.property()],l.prototype,"nestedWorkflowCount",null);a.__decorate([y.property()],l.prototype,"shouldShowAttachments",null);a.__decorate([y.property()],l.prototype,"shouldAllowAttachmentEditing",null);a.__decorate([y.property()],l.prototype,"hasPendingEdits",null);a.__decorate([y.property()],l.prototype,"helpMessage",null);a.__decorate([y.property()],l.prototype,"reliesOnOwnerAdminPrivileges",null);a.__decorate([y.property()],l.prototype,"hasInvalidFormTemplate",null);l=H=a.__decorate([q.subclass("esri.widgets.Editor.UpdateWorkflow")], l);const P=(K,D)=>k.getLogger("esri.widgets.Editor.UpdateWorkflow").warn(`editor:${K}`,D,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature.");return l})},"esri/views/draw/support/HighlightHelper":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ./layerUtils ../../support/layerViewUtils ../../../widgets/Feature/support/featureUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p){b=class extends b{constructor(y){super(y);this.view=null}add(y){y=!y||Array.isArray(y)?y:[y];y?.length&&y.forEach(l=>this._highlight(l))}remove(y){y=!y||Array.isArray(y)?y:[y];y?.length&&y.forEach(l=>this._removeHighlight(l))}removeAll(){this.removeAllHandles()}_highlight(y){const l=E.findLayerView(this.view,y.layer);F.highlightsSupported(l)&&this.addHandles(l.highlight(y),p.getHighlightKeyForFeature(y))}_removeHighlight(y){y&&this.removeHandles(p.getHighlightKeyForFeature(y))}}; a.__decorate([c.property()],b.prototype,"view",void 0);return b=a.__decorate([g.subclass("esri.views.draw.support.HighlightHelper")],b)})},"esri/widgets/Editor/UpdateFeatureWorkflow":function(){define("exports ../../chunks/tslib.es6 ../../core/Error ../../core/handleUtils ../../core/has ../../core/maybe ../../core/accessorSupport/decorators/property ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../layers/GraphicsLayer ../../support/elevationInfoUtils ../../views/support/layerViewUtils ./UpdateFeatureWorkflowData ./UpdateRecordWorkflow ./workflowUtils ../Sketch/SketchViewModel".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f){var z;const B={...h.handleKeys,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol()};a.UpdateFeatureWorkflow=z=class extends h.UpdateRecordWorkflow{constructor(x){super(x);this.type="update-feature";this._sketchViewModel=this._sketchGraphicClone=this._layerViewEditSession=null;this._webStyleCache=new Map}destroy(){this._layerViewEditSession?.rollback()}async commit(){this.removeHandles(B.sketchGraphics);try{const x=this.data.edits.stagedForDelete; await super.commit();const N=this._layerViewEditSession;x?N?.rollback():N?.commit()}catch(x){throw await this._configureSketchViewModel(),new c("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:x});}}async start(){await super.start();return await this._initializeSketchViewModel()}_initializeFeatureFormViewModel(){super._initializeFeatureFormViewModel();this.addHandles(this._featureFormViewModel.on("value-change",x=>{this._layerViewEditSession?.setAttribute(x.fieldName, x.value)}))}_configureHighlight(){const {edits:x,layerView:N}=this.data;r.highlightsSupported(N)&&this.addHandles(N.highlight(x.feature),B.highlights)}async _configureSketchViewModel(){const x=this._sketchViewModel;if(x){var {data:N,_featureFormViewModel:J,_sketchGraphicClone:I}=this,{edits:d,viewModel:v}=N,O=d.feature,{view:t}=v,H=u.getVisualVariableAttributes(O);O=await u.setUpGeometryUpdate({feature:O,featureClone:I,visualVariableAttributes:H,sketchViewModel:x,view:t,onUpdate:({geometry:P,attributes:K}, D)=>{d.updateAttributes(K);d.updateGeometry(P);J.feature.geometry=P;null!=H.rotation&&({field:P}=H.rotation,J.setValue(P,K[P]));null!=H.size&&({field:P}=H.size,J.setValue(P,K[P]));("undo"===D.type||"redo"===D.type||"update"===D.type&&null!=D.toolEventInfo&&u.isTerminalUpdateEventType(D.toolEventInfo.type))&&J.notifyFeatureGeometryChanged()},webStyleCache:this._webStyleCache});this.addHandles(O,B.sketchGraphics);x.addHandles(O)}}async _initializeSketchViewModel(){const {data:x,_sketchGraphicClone:N}= this,J=x.edits.feature,{capabilities:I,layer:d}=x.editorItem,{view:v}=x.viewModel;this.removeHandles([B.highlights,B.sketchGraphics,B.sketchViewModel]);if(!I.update.geometry||"3d"===v?.type&&l.hasEffectiveFeatureExpressionInfo(d.elevationInfo))return{enter:async()=>{this.hasHandles(B.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([B.highlights])};const O=new y({elevationInfo:d.elevationInfo,internal:!0,listMode:"hide"}),t=new f({allowDeleteKey:!1,layer:O,sketchOptions:x.sketchOptions, snappingManager:x.snappingManager,updateOnGraphicClick:!1,view:v});this._sketchViewModel=t;v?.map.add(O);this.addHandles(m.makeHandle(()=>{v?.destroyed||v?.map.remove(O);O.destroy();this._sketchViewModel=w.destroyMaybe(t)}),B.sketchViewModel);await u.updateGraphicSymbolWhenRequired(N,this._webStyleCache,"2d"===v?.type?v.scale:null);this.addHandles([await u.swapForEditingSession(t,J,N)]);return{enter:async()=>{this.hasHandles(B.sketchGraphics)||await this._configureSketchViewModel()},exit:()=>this.removeHandles([B.sketchGraphics]), viewModel:t}}_onFullFeatureLoaded(x){super._onFullFeatureLoaded(x);const N=this._sketchGraphicClone=u.cloneGraphicExceptMesh(x),{edits:J,layerView:I}=this.data;J.updateGeometry(x.geometry);J.trackChanges();u.canCreateInteractiveEditSession(I)&&(this._layerViewEditSession=I.createInteractiveEditSession(N))}static async create(x){x=new z({data:await q.create(x),onCommit:this._onCommitFactory(x.applyEdits)});x._set("steps",this._createWorkflowSteps(x));return x}get test(){}};b.__decorate([g.property()], a.UpdateFeatureWorkflow.prototype,"_layerViewEditSession",void 0);b.__decorate([g.property()],a.UpdateFeatureWorkflow.prototype,"_sketchGraphicClone",void 0);b.__decorate([g.property()],a.UpdateFeatureWorkflow.prototype,"_sketchViewModel",void 0);a.UpdateFeatureWorkflow=z=b.__decorate([p.subclass("esri.widgets.Editor.UpdateFeatureWorkflow")],a.UpdateFeatureWorkflow);a.handleKeys=B;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/UpdateFeatureWorkflowData":function(){define("../../chunks/tslib.es6 ../../core/Error ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../views/interactive/sketch/SketchOptions ./UpdateRecordWorkflowData ./workflowUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p){var y;m=y=class extends F{constructor(l){super(l);this.snappingManager=this.sketchOptions=null}static async create(l){const {feature:r,snappingManager:q,viewModel:h}=l,u=l.sketchOptions??new E;var {view:f}=h;if(!f)throw new b("editor:cannot-create-workflow-data","The provided EditorViewModel does not have an associated view");f=await p.whenEditorLayerView(f,r.layer);return new y({...y._makeConstructorProps(l),layerView:f,sketchOptions:u,snappingManager:q})}};a.__decorate([c.property()], m.prototype,"layerView",void 0);a.__decorate([c.property({constructOnly:!0})],m.prototype,"sketchOptions",void 0);a.__decorate([c.property()],m.prototype,"snappingManager",void 0);return m=y=a.__decorate([g.subclass("esri.widgets.Editor.UpdateFeatureWorkflowData")],m)})},"esri/widgets/Editor/UpdateRecordWorkflowData":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/Error ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./Edits".split(" "), function(a,b,c,m,k,w,g,E,F){var p;b=p=class extends b{constructor(y){super(y);this.viewModel=this.relatedRecordCallbacks=this.parent=this.edits=this.editorItem=null}get attachmentsCapabilities(){const y=this.editorItem.capabilities.update.attachments.enabled;return{editing:!0,operations:{add:y,update:y,delete:y}}}get formTemplate(){return this.editorItem.formTemplate}static async create(y){y=p._makeConstructorProps(y);return new p(y)}static _makeConstructorProps(y){const {feature:l,parent:r,relatedRecordCallbacks:q, viewModel:h}=y;y=h.editorItems.find(u=>u.layer===l.layer);if(!y)throw new c("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified Graphic's layer");return{editorItem:y,edits:new F.Edits({feature:l}),parent:r,relatedRecordCallbacks:q,viewModel:h}}};a.__decorate([m.property()],b.prototype,"attachmentsCapabilities",null);a.__decorate([m.property({constructOnly:!0})],b.prototype,"editorItem",void 0);a.__decorate([m.property()],b.prototype,"edits", void 0);a.__decorate([m.property()],b.prototype,"formTemplate",null);a.__decorate([m.property()],b.prototype,"parent",void 0);a.__decorate([m.property()],b.prototype,"relatedRecordCallbacks",void 0);a.__decorate([m.property()],b.prototype,"viewModel",void 0);return b=p=a.__decorate([E.subclass("esri.widgets.Editor.UpdateRecordWorkflowData")],b)})},"esri/widgets/Editor/Edits":function(){define("exports ../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g,E){function F(p){return null==p?null:JSON.stringify(p)}a.Edits=class extends c{constructor(p){super(p);this._stagedForDelete=!1;this.initialFeature=this.feature=null}get attributesModified(){return this._stringifyAttributes(this.feature)!==this._stringifyAttributes(this.initialFeature)}get geometryModified(){return this._stringifyGeometry(this.feature)!==this._stringifyGeometry(this.initialFeature)}get stagedForDelete(){return this._stagedForDelete}get modified(){return this.attributesModified|| this.geometryModified||this._stagedForDelete}stageDelete(){this._stagedForDelete=!0}unstageDelete(){this._stagedForDelete=!1}trackChanges(){this.initialFeature=this.feature?.clone()}updateAttributes(p){const {feature:y}=this;y&&(y.attributes=p,this.notifyChange("attributesModified"))}updateGeometry(p){const {feature:y}=this;y&&(y.geometry=p,this.notifyChange("geometryModified"))}_stringifyAttributes(p){return F(p?.attributes)}_stringifyGeometry(p){p=p?.geometry;return"mesh"===p?.type?F({transform:p.transform, vertexSpace:p.vertexSpace}):F(p)}};b.__decorate([m.property()],a.Edits.prototype,"_stagedForDelete",void 0);b.__decorate([m.property()],a.Edits.prototype,"attributesModified",null);b.__decorate([m.property()],a.Edits.prototype,"feature",void 0);b.__decorate([m.property()],a.Edits.prototype,"geometryModified",null);b.__decorate([m.property()],a.Edits.prototype,"initialFeature",void 0);b.__decorate([m.property()],a.Edits.prototype,"modified",null);a.Edits=b.__decorate([E.subclass("esri.widgets.Editor.Edits")], a.Edits);Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/UpdateRecordWorkflow":function(){define("exports ../../chunks/tslib.es6 ../../core/Error ../../core/handleUtils ../../core/promiseUtils ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../support/featureFlags ../../views/draw/support/HighlightHelper ./UpdateRecordWorkflowData ./Workflow ./workflowUtils ../FeatureForm/FeatureFormViewModel".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f){var z;const B={exit:Symbol()};a.UpdateRecordWorkflow=z=class extends h{constructor(x){super(x);this.fullFeature=this._highlightHelper=null;this.type="update-table-record"}initialize(){const {data:x}=this;var {edits:N}=x;const {view:J}=x.viewModel;N=N.feature;const I=new AbortController;this.addHandles(m.abortHandle(I));this._updatingHandles.addPromise(u.fetchFullFeature(N,x.viewModel.view.spatialReference,I.signal).then(d=>{k.isAborted(I)||(this._onFullFeatureLoaded(d), this._initializeFeatureFormViewModel())},d=>this.cancel({force:!0,error:new c("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:d}})})));J&&(this._highlightHelper=new r({view:J}),this.addHandles(m.makeHandle(()=>this._highlightHelper?.removeAll())))}get editorItem(){return this.data.editorItem}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){return this.data.edits.modified}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){const x= this.editorItem.capabilities;return x.update.reliesOnOwnerAdminPrivileges||x.delete.reliesOnOwnerAdminPrivileges}async deleteAndCommit(){this.data.edits.stageDelete();return this.commit()}async enter(){this._configureAttachmentsViewModel()}exit(x){this.removeHandles(B.exit)}async start(){await super.start();return null}_configureAttachmentsViewModel(){const {data:x,fullFeature:N}=this,{attachmentsCapabilities:J,viewModel:I}=x,{attachmentsViewModel:d}=I;d.set({capabilities:J,graphic:N,filesEnabled:!1, mode:"view"});this.addHandles([m.makeHandle(()=>d.fileInfos.removeAll()),w.watch(()=>d.mode,v=>{switch(v){case "add":this.go("adding-attachment");break;case "edit":this.go("editing-attachment")}})],B.exit)}_initializeFeatureFormViewModel(){const {edits:x,formTemplate:N,viewModel:{view:J}}=this.data,I=this._featureFormViewModel=new f({arcadeEditType:"UPDATE",feature:this.fullFeature,formTemplate:N,highlightHelper:this._highlightHelper,map:J?.map,spatialReference:J.spatialReference,timeZone:J?.timeZone}); I.relatedRecordCallbacks={...this.data.relatedRecordCallbacks,showAllRelatedRecords:v=>I.relationshipId=v.relationshipId};const {initialFeature:d}=x;d&&I.overrideInitialFeature(d);this.addHandles([I.on("value-change",()=>{x.updateAttributes(I.getValues());this.fullFeature.attributes=x.feature.attributes}),w.watch(()=>J?.timeZone,v=>I.timeZone=v)])}_onFullFeatureLoaded(x){this.fullFeature=x;const {edits:N}=this.data;N.updateAttributes(x.attributes);N.trackChanges()}static async create(x){x=new z({data:await q.create(x), onCommit:this._onCommitFactory(x.applyEdits)});x._set("steps",this._createWorkflowSteps(x));return x}static _createWorkflowSteps(x){const {attachmentsViewModel:N}=x.data.viewModel;return[{id:"editing-attributes",async setUp(){},async tearDown(){}},{id:"adding-attachment",async setUp(){},async tearDown(){N.mode="view"}},{id:"editing-attachment",async setUp(){},async tearDown(){N.mode="view"}}]}};a.UpdateRecordWorkflow._onCommitFactory=x=>async N=>{({edits:N}=N);const {feature:J}=N;if(J){var I=J.sourceLayer, d=J.clone();if(!N.attributesModified||N.stagedForDelete){var v=I.objectIdField;d.attributes={[v]:J.getAttribute(v)};l.sceneLayerEditingEnabled()&&l.i3sPatchingEnabled()&&"scene"===I.type&&null!=I.infoFor3D&&(v=I.associatedLayer?.globalIdField,null!=v&&d.setAttribute(v,J.getAttribute(v)))}if(!N.geometryModified||N.stagedForDelete)d.geometry=null;await x(I,{[N.stagedForDelete?"deleteFeatures":"updateFeatures"]:[d]})}};b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"editorItem",null);b.__decorate([g.property()], a.UpdateRecordWorkflow.prototype,"featureFormViewModel",null);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"fullFeature",void 0);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"hasPendingEdits",null);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"layer",null);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"parent",null);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"parentLayer",null);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype, "shouldShowAttachments",null);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"shouldAllowAttachmentEditing",null);b.__decorate([g.property()],a.UpdateRecordWorkflow.prototype,"reliesOnOwnerAdminPrivileges",null);a.UpdateRecordWorkflow=z=b.__decorate([y.subclass("esri.widgets.Editor.UpdateRecordWorkflow")],a.UpdateRecordWorkflow);a.handleKeys=B;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/UpdateWorkflowData":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.viewModel=this.snappingManager=this.sketchOptions=this.rootFeature=this.candidates=this.applyEditsCallback=this.addAttachmentsCallback=null}};a.__decorate([c.property()],b.prototype,"addAttachmentsCallback",void 0);a.__decorate([c.property()],b.prototype,"applyEditsCallback",void 0);a.__decorate([c.property()],b.prototype,"candidates",void 0);a.__decorate([c.property()],b.prototype,"rootFeature",void 0);a.__decorate([c.property({constructOnly:!0})], b.prototype,"sketchOptions",void 0);a.__decorate([c.property()],b.prototype,"snappingManager",void 0);a.__decorate([c.property()],b.prototype,"viewModel",void 0);return b=a.__decorate([g.subclass("esri.widgets.Editor.UpdateWorkflowData")],b)})},"esri/widgets/Editor/support/EditorItem":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../layers/support/layerUtils ./EditorEditingCapabilities ../../FeatureForm/featureFormUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p){b=class extends b{constructor(y){super(y);this.disabled=!1;this.layerView=this.layerInfo=this.layer=null}get _suspended(){return!!this.layerView?.suspended}get capabilities(){return new F({layer:this.layer,layerInfo:this.layerInfo,layerView:this.layerView})}get editable(){const {create:y,relationship:l,update:r,delete:{enabled:q}}=this.capabilities,h=y.attachments.enabled||r.attachments.enabled;return!this.disabled&&(y.enabled||r.enabled||h||q||l.enabled)}get formTemplate(){return this.capabilities.formTemplate}get hasInvalidFormTemplate(){return p.formTemplateHasInvalidFields(this.layer, this.formTemplate)}get isTable(){return E.isTable(this.layer)}get supportsCreateFeaturesWorkflow(){if(this.disabled)return!1;const {enabled:y,geometry:l}=this.capabilities.create;return this.isTable?y:y&&l}get supportsUpdateWorkflow(){const {capabilities:y}=this;return!this.disabled&&(y.update.enabled||y.update.attachments.enabled||y.delete.enabled)}get visible(){const {layer:y}=this,l=y.parent;return!this._suspended&&y.visible&&(!l||!("visible"in l)||l.visible)}};a.__decorate([c.property()],b.prototype, "_suspended",null);a.__decorate([c.property()],b.prototype,"capabilities",null);a.__decorate([c.property()],b.prototype,"disabled",void 0);a.__decorate([c.property()],b.prototype,"editable",null);a.__decorate([c.property()],b.prototype,"formTemplate",null);a.__decorate([c.property()],b.prototype,"hasInvalidFormTemplate",null);a.__decorate([c.property()],b.prototype,"isTable",null);a.__decorate([c.property()],b.prototype,"layer",void 0);a.__decorate([c.property()],b.prototype,"layerInfo",void 0);a.__decorate([c.property()], b.prototype,"layerView",void 0);a.__decorate([c.property()],b.prototype,"supportsCreateFeaturesWorkflow",null);a.__decorate([c.property()],b.prototype,"supportsUpdateWorkflow",null);a.__decorate([c.property()],b.prototype,"visible",null);return b=a.__decorate([g.subclass("esri.widgets.Editor.support.EditorItem")],b)})},"esri/widgets/Editor/support/EditorEditingCapabilities":function(){define("../../../chunks/tslib.es6 ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../layers/support/EditingCapabilities ../../../views/layers/support/editableLayerViews ../../Feature/support/featureUtils".split(" "), function(a,b,c,m,k,w,g,E,F){function p(y,l){return"scene"!==y.type?!0:null!=l&&"type"in l&&"scene-layer-3d"===l.type?E.isGeometryEditableSceneLayer(y,l):!1}c=class extends g{constructor(y){super(y);this.layerView=this.layerInfo=null}get attachments(){const y=this.layerInfo;return{enabled:this.defaults.attachments.enabled&&!1!==y?.enabled}}get create(){const {attachments:y,defaults:l,layerInfo:r,layer:q,layerView:h}=this,u=l.create,f=u.enabled&&!1!==r?.enabled&&!1!==r?.addEnabled,z=f&&u.attributes, B=f&&u.geometry&&p(q,h);return{attributes:z,enabled:f,geometry:B,attachments:{enabled:y.enabled&&f&&!1!==r?.attachmentsOnCreateEnabled},reliesOnOwnerAdminPrivileges:u.reliesOnOwnerAdminPrivileges}}get defaults(){return new g({layer:this.layer})}get delete(){const {defaults:y,layerInfo:l}=this,r=y.delete;return{enabled:r.enabled&&!1!==l?.enabled&&!1!==l?.deleteEnabled,reliesOnOwnerAdminPrivileges:r.reliesOnOwnerAdminPrivileges}}get formTemplate(){const {layer:y,layerInfo:l}=this;return l?.formTemplate? l.formTemplate:y&&"formTemplate"in y?y.formTemplate:null}get relationship(){var {layer:y}=this;y=!(!F.isRelatableFeatureSupportedLayer(y)||!y.relationships?.length);const l=!!this.formTemplate?.elements?.some(r=>"relationship"===r.type);return{enabled:y&&l}}get update(){const {attachments:y,defaults:l,layerInfo:r,layer:q,layerView:h}=this,u=l.update,f=u.enabled&&!1!==r?.enabled&&!1!==r?.updateEnabled,z=f&&u.attributes&&!1!==r?.attributeUpdatesEnabled,B=f&&u.geometry&&!1!==r?.geometryUpdatesEnabled&& p(q,h),x=y.enabled&&!1!==r?.attachmentsOnUpdateEnabled;return{attributes:z,enabled:f,geometry:B,attachments:{enabled:x,create:x&&u.attachments.create,update:x&&u.attachments.update},reliesOnOwnerAdminPrivileges:u.reliesOnOwnerAdminPrivileges}}};a.__decorate([b.property()],c.prototype,"attachments",null);a.__decorate([b.property()],c.prototype,"create",null);a.__decorate([b.property()],c.prototype,"defaults",null);a.__decorate([b.property()],c.prototype,"delete",null);a.__decorate([b.property()],c.prototype, "formTemplate",null);a.__decorate([b.property()],c.prototype,"layerInfo",void 0);a.__decorate([b.property()],c.prototype,"layerView",void 0);a.__decorate([b.property()],c.prototype,"relationship",null);a.__decorate([b.property()],c.prototype,"update",null);return c=a.__decorate([w.subclass("esri.widgets.Editor.support.EditorEditingCapabilities")],c)})},"esri/layers/support/EditingCapabilities":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./layerUtils".split(" "), function(a,b,c,m,k,w,g,E){b=class extends b{constructor(F){super(F);this.layer=null}get attachments(){return{enabled:this._effectiveEnabled&&!!this._effectiveCapabilities?.data.supportsAttachment}}get create(){const {_effectiveCapabilities:F,layer:p}=this,y=this._createEnabled;return{attachments:{enabled:y&&this.attachments.enabled},attributes:y,enabled:y,geometry:y,reliesOnOwnerAdminPrivileges:!p.capabilities?.operations.supportsAdd&&!!F?.operations.supportsAdd}}get delete(){const {_effectiveCapabilities:F, layer:p}=this;return{enabled:this._effectiveEnabled&&!!F?.operations.supportsDelete,reliesOnOwnerAdminPrivileges:!p.capabilities?.operations.supportsDelete&&!!F?.operations.supportsDelete}}get reliesOnOwnerAdminPrivileges(){return this._effectiveEnabled&&!this.layer.editingEnabled||this.create.reliesOnOwnerAdminPrivileges||this.update.reliesOnOwnerAdminPrivileges||this.delete.reliesOnOwnerAdminPrivileges}get update(){const {_effectiveCapabilities:F,layer:p}=this,y=this._updateEnabled,l=this.attachments.enabled, r=l&&this._canCreateOrUpdate;return{attachments:{enabled:l,create:r,update:r},attributes:y,enabled:y,geometry:!(!y||!F?.editing.supportsGeometryUpdate),reliesOnOwnerAdminPrivileges:!p.capabilities?.operations.supportsUpdate&&!!F?.operations.supportsUpdate}}get _createEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsAdd}get _updateEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsUpdate}get _canCreateOrUpdate(){return!(!this._createEnabled&& !this._updateEnabled)}get _effectiveEnabled(){return E.getEffectiveEditingEnabled(this.layer)}get _effectiveCapabilities(){return E.getEffectiveLayerCapabilities(this.layer)}};a.__decorate([c.property()],b.prototype,"attachments",null);a.__decorate([c.property()],b.prototype,"create",null);a.__decorate([c.property()],b.prototype,"delete",null);a.__decorate([c.property()],b.prototype,"layer",void 0);a.__decorate([c.property()],b.prototype,"reliesOnOwnerAdminPrivileges",null);a.__decorate([c.property()], b.prototype,"update",null);a.__decorate([c.property()],b.prototype,"_createEnabled",null);a.__decorate([c.property()],b.prototype,"_updateEnabled",null);a.__decorate([c.property()],b.prototype,"_canCreateOrUpdate",null);a.__decorate([c.property()],b.prototype,"_effectiveEnabled",null);a.__decorate([c.property()],b.prototype,"_effectiveCapabilities",null);return b=a.__decorate([g.subclass("esri.layers.support.EditingCapabilities")],b)})},"esri/views/layers/support/editableLayerViews":function(){define(["exports", "../../../core/Logger","../../../geometry/support/spatialReferenceUtils","../../../layers/support/infoFor3D","../../ViewingMode"],function(a,b,c,m,k){a.isGeometryEditableSceneLayer=function(w,g){var {associatedLayer:E}=w,F=E?.infoFor3D;if(!F)return!1;const {supportedFormats:p,queryFormats:y}=F;F=m.getMimeTypeFormatId("model/gltf-binary",p)??m.getFilenameFormatId("glb",p);if(null==F||!y.includes(F))return b.getLogger("esri.views.layers.support.editableLayerViews").warnOnce(`SceneLayer (${w.title?? "Untitled layer"}, ${w.id}) does not support geometry edits because it does not support GLB queries.`),!1;F=w.spatialReference;var l=E.spatialReference;if(!c.equals(F,l))return b.getLogger("esri.views.layers.support.editableLayerViews").warnOnce(`SceneLayer (${w.title??"Untitled layer"}, ${w.id}) does not support geometry edits because its spatial reference (wkid:${F.wkid}) is different from its associated FeatureLayer's spatial reference (wkid:${l.wkid}).`),!1;E=E.sourceJSON.sourceSpatialReference; if(null!=E&&!c.equals(E,l))return b.getLogger("esri.views.layers.support.editableLayerViews").warnOnce(`SceneLayer (${w.title??"Untitled layer"}, ${w.id}) does not support geometry edits because the spatial reference of its associated FeatureLayer's service (wkid:${l.wkid}) is different from its source spatial reference (wkid:${E.wkid}).`),!1;({view:E}=g);if(g.destroyed||null==E)return!1;g=E.spatialReference;({viewingMode:l}=E.state);E=c.isGeographic(F);l=l===k.ViewingMode.Global;return E&&!l?(b.getLogger("esri.views.layers.support.editableLayerViews").warnOnce(`SceneLayer (${w.title?? "Untitled layer"}, ${w.id}) does not support geometry edits in local viewing mode because its spatial reference (wkid:${F.wkid}) is geographic. Please consider changing the viewing mode to global.`),!1):!E&&l?(b.getLogger("esri.views.layers.support.editableLayerViews").warnOnce(`SceneLayer (${w.title??"Untitled layer"}, ${w.id}) does not support geometry edits in global viewing mode because its spatial reference (wkid:${F.wkid}) is projected. Please consider changing the viewing mode to local.`), !1):c.equals(F,g)||l&&c.isWebMercator(g)&&c.isWGS84(F)?!0:(b.getLogger("esri.views.layers.support.editableLayerViews").warnOnce(`SceneLayer (${w.title??"Untitled layer"}, ${w.id}) does not support geometry edits because its spatial reference (wkid:${F.wkid}) does not match the view spatial reference (wkid:${g.wkid}).`),!1)};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/VisibleElements":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../support/SnappingControls/VisibleElements".split(" "), function(a,b,c,m,k,w,g,E){b=class extends b{constructor(F){super(F);this.createFeaturesSection=!0;this.directionModePicker=!1;this.snappingControls=this.settingsMenu=this.labelsToggle=this.editFeaturesSection=!0;this.snappingControlsElements=new E;this.tooltipsToggle=!0;this.undoRedoButtons=!1}};a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"createFeaturesSection",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"directionModePicker",void 0);a.__decorate([c.property({type:Boolean, nonNullable:!0})],b.prototype,"editFeaturesSection",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"labelsToggle",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"settingsMenu",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"snappingControls",void 0);a.__decorate([c.property({type:E,nonNullable:!0})],b.prototype,"snappingControlsElements",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype, "tooltipsToggle",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"undoRedoButtons",void 0);return b=a.__decorate([g.subclass("esri.widgets.Editor.VisibleElements")],b)})},"esri/widgets/support/SnappingControls/VisibleElements":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "),function(a, b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.featureEnabledToggle=this.enabledToggle=!0;this.header=!1;this.selfEnabledToggle=this.layerListToggleLayersButton=this.layerList=!0}};a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"enabledToggle",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"featureEnabledToggle",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"header",void 0);a.__decorate([c.property({type:Boolean, nonNullable:!0})],b.prototype,"layerList",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"layerListToggleLayersButton",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"selfEnabledToggle",void 0);return b=a.__decorate([g.subclass("esri.widgets.support.SnappingControls.VisibleElements")],b)})},"esri/widgets/Editor/components/CreateFeaturesPanelContent":function(){define(["exports","./PanelContent","../../support/widgetUtils","../../support/jsxFactory"], function(a,b,c,m){a.CreateFeaturesPanelContent=function({helpMessage:k}){return m.tsx(b.PanelContent,{key:"creating-features-panel-content"},m.tsx(b.PanelContentMessage,{key:"content-message"},k))};a.loadCreateFeaturesPanelContentComponents=()=>b.loadPanelContentComponents();Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/PanelContent":function(){define(["require","exports","../../../chunks/componentsUtils","../../support/widgetUtils","../../support/jsxFactory"], function(a,b,c,m,k){const w={base:"esri-editor__panel-content",message:"esri-editor__panel-content__message",section:"esri-editor__panel-content__section",sectionGroup:"esri-editor__panel-content__section__group",scrimContainer:"esri-editor__panel-content__scrim-container"};b.PanelContent=function(g,...E){return k.tsx("div",{class:m.classes(w.base,g?.showScrimOverlay?w.scrimContainer:void 0),key:g?.key??"panel-content"},...E,g?.showScrimOverlay?k.tsx("calcite-scrim",null):void 0)};b.PanelContentMessage= function(g,...E){return k.tsx("div",{class:w.message,"data-testid":"panel-content-message",key:g?.key??"panel-content-message"},...E)};b.PanelContentSection=function(g,...E){return k.tsx("div",{class:w.section,key:g?.key??"panel-content-section"},...E)};b.PanelContentSectionGroup=function(g,...E){return k.tsx("div",{class:w.sectionGroup,key:g?.key??"panel-content-section-group"},...E)};b.css=w;b.loadPanelContentComponents=()=>c.loadCalciteComponents({scrim:()=>new Promise((g,E)=>a(["../../../chunks/calcite-scrim"], g,E))});Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/FeatureList":function(){define("exports ../../../core/arrayUtils ../../../layers/support/fieldUtils ./PanelContent ../../FeatureTemplates/ItemList ../../support/widgetUtils ../../support/jsxFactory".split(" "),function(a,b,c,m,k,w,g){a.FeatureList=function({editorItems:E,filterText:F,id:p,messagesTemplates:y,onFilterTextChange:l,onSelectFeature:r,workflow:q}){const h=new Map;let u=0;q.data.candidates.map(f=> {var z=f.layer;if(z){var B=z.fieldsIndex.get(z.objectIdField);var x=B.alias||B.name,{attributes:N}=f;B=(z=c.getDisplayFieldName(z))&&N[z]&&`${N[z]}`||`${x}: ${N[B.name]}`}else B=null;return{label:B,id:f.attributes[f.layer.objectIdField],data:f}}).filter(({label:f,data:z})=>{const B=F.toLowerCase(),{title:x}=z.layer,N=E.find(J=>J.layer===z.sourceLayer);return N?N.supportsUpdateWorkflow&&(!B||f?.toLowerCase().includes(B)||x?.toLowerCase().includes(B)):null}).filter(b.isSome).forEach(f=>{u++;const z= f.data.layer;h.has(z)?h.get(z)?.items.push(f):h.set(z,{id:`${z.id}`,label:z.title??"",items:[f]})});q=E.toArray().map(({layer:f})=>h.get(f)).filter(b.isSome);return g.tsx(m.PanelContent,{key:"feature-list"},g.tsx(m.PanelContentSection,null,k.ItemList({enableListScroll:!1,filterEnabled:10l(f),onItemMouseEnter:f=>r(f.data),onItemMouseLeave:()=>r(null),onItemSelect:f=> r(f.data,!0)})))};a.loadFeatureListComponents=()=>m.loadPanelContentComponents();Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/FooterActions":function(){define("require exports ../../../core/arrayUtils ../../../chunks/componentsUtils ../../support/widgetUtils ../../support/jsxFactory".split(" "),function(a,b,c,m,k,w){const g={base:"esri-editor__actions"};b.FooterActions=function({buttons:E,key:F}){return w.tsx("div",{class:g.base,key:F??"footer-actions", slot:"footer"},E.filter(c.isSome).map(({disabled:p,onClick:y,label:l,...r},q)=>w.tsx("calcite-button",{disabled:p??!1,key:`action-${q}`,onclick:()=>{(p??!1)||y()},slot:"footer-actions",width:"full",...r},l)))};b.css=g;b.loadFooterActionsComponents=()=>m.loadCalciteComponents({button:()=>new Promise((E,F)=>a(["../../../chunks/calcite-button"],E,F))});Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/Notices":function(){define("require exports ../icons ../../../chunks/componentsUtils ../../support/widgetUtils ../../support/jsxFactory".split(" "), function(a,b,c,m,k,w){function g({message:F,...p}){return w.tsx("calcite-notice",{class:E.notice,open:!0,scale:"s",...p},w.tsx("div",{slot:"message"},F))}const E={notice:"esri-editor__notice"};b.Notice=g;b.Notices=function({workflow:F,messages:p}){return w.tsx(w.tsxFragment,null,F?.reliesOnOwnerAdminPrivileges?w.tsx(g,{message:p.ownerAdminNotice}):void 0,F?.hasInvalidFormTemplate?w.tsx(g,{icon:c.warningIcon,message:p.formFieldUpdateError}):void 0)};b.css=E;b.loadNoticesComponents=()=>m.loadCalciteComponents({notice:()=> new Promise((F,p)=>a(["../../../chunks/calcite-notice"],F,p))});Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/PanelToolbar":function(){define(["require","exports","./Settings","../../../chunks/componentsUtils","../../support/jsxFactory"],function(a,b,c,m,k){const w={base:"esri-editor__panel-toolbar"};b.PanelToolbar=function({editorViewModel:g,messagesCommon:E,visibleElements:F}){const {sketchViewModel:p}=g;return k.tsx("div",{class:w.base,key:"panel-toolbar"}, k.tsx(c.Settings,{editorViewModel:g,messagesCommon:E,visibleElements:F}),F.undoRedoButtons?[k.tsx("calcite-button",{alignment:"center",appearance:"transparent",disabled:!p?.canUndo(),iconStart:"undo",key:"undo-button",kind:"neutral",label:E.undo,onclick:()=>p?.undo(),scale:"l"},E.undo),k.tsx("calcite-button",{alignment:"center",appearance:"transparent",disabled:!p?.canRedo(),iconStart:"redo",key:"redo-button",kind:"neutral",label:E.redo,onclick:()=>p?.redo(),scale:"l"},E.redo)]:null)};b.css=w;b.loadPanelToolbarComponents= ()=>Promise.all([m.loadCalciteComponents({button:()=>new Promise((g,E)=>a(["../../../chunks/calcite-button"],g,E))}),c.loadSettingsComponents()]);Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/Settings":function(){define("require exports ../../../chunks/componentsUtils ../../support/SketchTooltipControls ../../support/SnappingControls ../../support/widgetUtils ../../support/jsxFactory ../../support/SnappingControls/VisibleElements".split(" "),function(a, b,c,m,k,w,g,E){const F={settingsContainer:"esri-editor__settings"};b.Settings=function({editorViewModel:p,messagesCommon:y,visibleElements:l}){const {snappingOptions:r,sketchOptions:q,view:h}=p;p=[];const u={directionModePicker:l.directionModePicker,labelsToggle:l.labelsToggle,tooltipsToggle:l.tooltipsToggle};w.someElementsAreVisible(u)&&p.push(g.tsx(m,{sketchOptions:q,viewType:h?.type,visibleElements:u}));l.snappingControls&&p.push(g.tsx(k,{afterCreate:f=>f.layerListOpen=!1,snappingOptions:r,view:h, visibleElements:l.snappingControlsElements??new E}));return 0===p.length?null:g.tsx("calcite-accordion",{appearance:"transparent",class:F.settingsContainer,key:"settings"},g.tsx("calcite-accordion-item",{"data-testid":"settings",heading:y.settings,iconStart:"gear"},p))};b.css=F;b.loadSettingsComponents=()=>c.loadCalciteComponents({accordion:()=>new Promise((p,y)=>a(["../../../chunks/calcite-accordion"],p,y)),"accordion-item":()=>new Promise((p,y)=>a(["../../../chunks/calcite-accordion-item"],p,y))}); Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/SketchTooltipControls":function(){define("require ../../chunks/tslib.es6 ../../core/arrayUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/accessorSupport/decorators/subclass ../../views/interactive/sketch/SketchOptions ../../views/interactive/tooltip/components/directionModeIcons ../Widget ../../chunks/componentsUtils ./globalCss ./LabeledSwitch ./widgetUtils ./decorators/messageBundle ./jsxFactory ./SketchTooltipControls/VisibleElements".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f){k=class extends p{constructor(z,B){super(z,B);this.viewModel=null;this.visibleElements=new f;this.sketchOptions=new E;this.viewType=void 0;this._onTooltipsEnabledChange=x=>{this.sketchOptions.tooltips.enabled=x};this._onLabelsEnabledChange=x=>{this.sketchOptions.labels.enabled=x};this._onDirectionModeChange=x=>{this.sketchOptions.values.directionMode=x.target.selectedItem.value}}loadDependencies(){return Promise.all([y.loadCalciteComponents({block:()=>new Promise((z, B)=>a(["../../chunks/calcite-block"],z,B)),label:()=>new Promise((z,B)=>a(["../../chunks/calcite-label"],z,B)),icon:()=>new Promise((z,B)=>a(["../../chunks/calcite-icon"],z,B)),"radio-button":()=>new Promise((z,B)=>a(["../../chunks/calcite-radio-button"],z,B)),"radio-button-group":()=>new Promise((z,B)=>a(["../../chunks/calcite-radio-button-group"],z,B))}),r.loadLabeledSwitchComponents()])}render(){const {label:z,visibleElements:B}=this,x=this._renderContent();return u.tsx("div",{"aria-label":z,class:this.classes("esri-sketch-tooltip-controls", l.globalCss.widget)},x?u.tsx("calcite-block",{class:"esri-sketch-tooltip-controls__block",heading:B.header?this.label:"",key:"content-block",open:!0},u.tsx("div",{class:"esri-sketch-tooltip-controls__block-content",key:"content"},x)):void 0)}get label(){return this.messages?.widgetLabel??""}set label(z){this._overrideIfSome("label",z)}_renderContent(){const {visibleElements:z,viewType:B}=this,x=[z.tooltipsToggle?this._renderTooltipsToggle():null,z.labelsToggle&&"2d"!==B?this._renderLabelsToggle(): null,z.directionModePicker?this._renderDirectionModePicker():null].filter(c.isSome);return 0===x.length?null:x}_renderTooltipsToggle(){const {messages:z,sketchOptions:B}=this;return u.tsx(r.LabeledSwitch,{checked:B.tooltips.effectiveEnabled,hint:z.tooltipsToggleHint,key:`${this.id}__tooltips`,label:z.tooltipsToggle,onChange:this._onTooltipsEnabledChange})}_renderLabelsToggle(){const {messages:z,sketchOptions:B}=this;return u.tsx(r.LabeledSwitch,{checked:B.labels.enabled,hint:z.labelsToggleHint,key:`${this.id}__labels`, label:z.labelsToggle,onChange:this._onLabelsEnabledChange})}_renderDirectionModePicker(){const {messages:z,sketchOptions:B}=this,{directionMode:x}=B.values;return u.tsx("calcite-label",{key:"direction-mode",layout:"default",scale:"s"},z.directionModePicker,u.tsx("calcite-radio-button-group",{key:"radio-button-group",layout:"horizontal",name:this.id,scale:"s",value:x,onCalciteRadioButtonGroupChange:this._onDirectionModeChange},this._renderDirectionModeOption("relative",x,z.directionModeRelative),this._renderDirectionModeOption("absolute", x,z.directionModeAbsolute)))}_renderDirectionModeOption(z,B,x){return u.tsx("calcite-label",{key:z,layout:"inline",scale:"s"},u.tsx("calcite-radio-button",{checked:z===B,scale:"s",value:z}),u.tsx("div",{class:"esri-sketch-tooltip-controls__radio-button-label-wrapper",key:"label-wrapper"},u.tsx("calcite-icon",{icon:F.directionModeIcons[z],scale:"s"}),x))}};b.__decorate([m.property()],k.prototype,"label",null);b.__decorate([m.property({type:f,nonNullable:!0})],k.prototype,"visibleElements",void 0); b.__decorate([m.property(),h.messageBundle("esri/widgets/support/SketchTooltipControls/t9n/SketchTooltipControls")],k.prototype,"messages",void 0);b.__decorate([m.property({nonNullable:!0,type:E})],k.prototype,"sketchOptions",void 0);b.__decorate([m.property({type:String})],k.prototype,"viewType",void 0);return k=b.__decorate([g.subclass("esri.widgets.support.SketchTooltipControls")],k)})},"esri/views/interactive/tooltip/components/directionModeIcons":function(){define(["exports"],function(a){a.directionModeIcons= {absolute:"absolute-direction",relative:"relative-direction"};Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/LabeledSwitch":function(){define(["require","exports","../../chunks/componentsUtils","./widgetUtils","./jsxFactory"],function(a,b,c,m,k){b.LabeledSwitch=function({checked:w,disabled:g,hint:E,key:F,label:p,onChange:y}){return k.tsx("calcite-label",{class:"esri-labeled-switch__label",disabled:g,key:F,layout:"inline-space-between",scale:"s"},k.tsx("div", {class:"esri-labeled-switch__label-content",key:"label-content"},E?k.tsx(k.tsxFragment,null,k.tsx("div",null,p),k.tsx("calcite-icon",{class:"esri-labeled-switch__icon",icon:"information",id:F,scale:"s"}),k.tsx("calcite-tooltip",{class:"esri-labeled-switch__tooltip",referenceElement:F},E)):p),k.tsx("calcite-switch",{checked:w,disabled:g,scale:"s",onCalciteSwitchChange:l=>y(l.target.checked)}))};b.loadLabeledSwitchComponents=()=>Promise.all([c.loadCalciteComponents({icon:()=>new Promise((w,g)=>a(["../../chunks/calcite-icon"], w,g)),label:()=>new Promise((w,g)=>a(["../../chunks/calcite-label"],w,g)),switch:()=>new Promise((w,g)=>a(["../../chunks/calcite-switch"],w,g)),tooltip:()=>new Promise((w,g)=>a(["../../chunks/calcite-tooltip"],w,g))})]);Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/SketchTooltipControls/VisibleElements":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "), function(a,b,c,m,k,w,g){b=class extends b{constructor(E){super(E);this.header=this.directionModePicker=!1;this.tooltipsToggle=this.labelsToggle=!0}};a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"directionModePicker",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"header",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"labelsToggle",void 0);a.__decorate([c.property({type:Boolean,nonNullable:!0})],b.prototype,"tooltipsToggle", void 0);return b=a.__decorate([g.subclass("esri.widgets.support.SketchTooltipControls.VisibleElements")],b)})},"esri/widgets/support/SnappingControls":function(){define("require ../../chunks/tslib.es6 ../../core/arrayUtils ../../core/maybe ../../core/uid ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/accessorSupport/decorators/subclass ../Widget ../../chunks/componentsUtils ./globalCss ./LabeledSwitch ./widgetUtils ./decorators/messageBundle ./jsxFactory ./SnappingControls/SnappingControlsViewModel ./SnappingControls/snappingLayerListUtils ./SnappingControls/VisibleElements".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B){g=class extends p{constructor(x,N){super(x,N);this._layerListFilter=this._defaultViewModel=null;this.layerListOpen=!0;this.messages=null;this.visibleElements=new B;this._enableSnappingSwitchChange=v=>{this.snappingOptions.enabled=v};this._featureEnabledSwitchChange=v=>{this.snappingOptions.featureEnabled=v};this._selfEnabledSwitchChange=v=>{this.snappingOptions.selfEnabled=v};this._onToggleLayersButtonClick=v=>{this.viewModel.toggleSnappingForAllLayers(!this.viewModel.allLayersEnabled); requestAnimationFrame(()=>v.target.setFocus())};const {snappingOptions:J,view:I,viewModel:d}=x;this.viewModel=d??(this._defaultViewModel=new f({snappingOptions:J,view:I}))}normalizeCtorArgs(x){const {snappingOptions:N,view:J,viewModel:I,...d}=x;return d}destroy(){this.viewModel!==this._defaultViewModel&&(this._defaultViewModel=m.destroyMaybe(this._defaultViewModel))}loadDependencies(){return Promise.all([y.loadCalciteComponents({block:()=>new Promise((x,N)=>a(["../../chunks/calcite-block"],x,N)), button:()=>new Promise((x,N)=>a(["../../chunks/calcite-button"],x,N)),input:()=>new Promise((x,N)=>a(["../../chunks/calcite-input"],x,N)),list:()=>new Promise((x,N)=>a(["../../chunks/calcite-list"],x,N)),"list-item":()=>new Promise((x,N)=>a(["../../chunks/calcite-list-item"],x,N)),checkbox:()=>new Promise((x,N)=>a(["../../chunks/calcite-checkbox"],x,N))}),r.loadLabeledSwitchComponents()])}get icon(){return"snap-to-point"}set icon(x){this._overrideIfSome("icon",x)}get label(){return this.messages?.widgetLabel?? ""}set label(x){this._overrideIfSome("label",x)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(x){this.viewModel.snappingOptions=x}get view(){return this.viewModel.view}set view(x){this.viewModel.view=x}set viewModel(x){if(x!==this._get("viewModel")){if(null==this._defaultViewModel||this._defaultViewModel!==x)this._defaultViewModel=m.destroyMaybe(this._defaultViewModel);this._set("viewModel",x)}}render(){const {label:x}=this;return u.tsx("div",{"aria-label":x,class:this.classes("esri-snapping-controls", l.globalCss.widget)},u.tsx("div",{class:"esri-snapping-controls__container"},this._renderContent()))}_renderContent(){return[this._renderToggles(),this._renderLayerList()]}_renderToggles(){const {visibleElements:x}=this;var N=[x.selfEnabledToggle?this._renderSelfEnabledToggle():null,x.featureEnabledToggle?this._renderFeatureEnabledToggle():null].filter(c.isSome);N=[x.enabledToggle?this._renderEnabledToggle():null,0{this._layerListFilter=""===d?null:new RegExp(d,"i")};J=9this.layerListOpen=d.target.open},J,this._renderToggleLayersButton(),u.tsx("calcite-list",{class:"esri-snapping-controls__layer-list",selectionMode:"none"},this._renderLayerListItemCollection(N.layerListViewModel.operationalItems)))}_renderLayerListItemCollection(x){const N=this._layerListFilter;return x.map(J=>{switch(N?z.itemTitleMatchesFilter(J,N):null){case "children":const I=J.children.filter(d=>!1!==z.itemTitleMatchesFilter(d, N));return this._renderLayerListItemGroup(J,I);case "self":case null:return this._renderLayerListItemOrGroup(J);case !1:return"self"===z.itemTitleMatchesFilter(J.parent,N)?this._renderLayerListItemOrGroup(J):null}}).toArray().filter(c.isSome)}_renderToggleLayersButton(){if(!this.visibleElements.layerListToggleLayersButton)return null;const {viewModel:{allLayersEnabled:x},messages:N}=this,J=x?N.disableAllLayers:N.enableAllLayers;return u.tsx("calcite-button",{appearance:"transparent",class:"esri-snapping-controls__layer-list__button", label:J,name:"layer-toggle",onclick:this._onToggleLayersButtonClick},J)}_renderLayerListItemOrGroup(x){if(x.children.length)return this._renderLayerListItemGroup(x);const {messages:{untitledLayer:N}}=this,J=()=>{this.viewModel.toggleSnappingForLayers([x.layer.id],"enabled"!==x.enabled)};return u.tsx("calcite-list-item",{class:"esri-snapping-controls__layer-list__item",key:`${this.id}-list-item-${x.uid}`,label:x.title||N,onCalciteListItemSelect:I=>{I.stopPropagation();J()}},u.tsx("calcite-checkbox", {checked:"enabled"===x.enabled,slot:"actions-start",onCalciteCheckboxChange:J}))}_renderLayerListItemGroup(x,N){const {children:J,title:I}=x,d=I||this.messages.untitledLayer,v=I&&""!==I?I:k.generateUID(),O=N??J,t=()=>{this.viewModel.toggleSnappingForLayers(x.childLayerIds,"enabled"!==x.enabled)};return u.tsx("calcite-list-item",{class:"esri-snapping-controls__layer-list__group",key:v,label:d,open:!!N?.length,onCalciteListItemSelect:H=>{H.stopPropagation();t()}},u.tsx("calcite-checkbox",{checked:"enabled"=== x.enabled,indeterminate:"indeterminate"===x.enabled,slot:"actions-start",onCalciteCheckboxChange:t}),u.tsx("calcite-list",null,this._renderLayerListItemCollection(O)))}get _enabledToggleDisabled(){const x=this.snappingOptions;return x.enabledToggled||x.forceDisabled}get _secondaryElementsDisabled(){return this._enabledToggleDisabled||!this.snappingOptions.enabled}};b.__decorate([w.property()],g.prototype,"_defaultViewModel",void 0);b.__decorate([w.property()],g.prototype,"_layerListFilter",void 0); b.__decorate([w.property()],g.prototype,"label",null);b.__decorate([w.property({type:Boolean,nonNullable:!0})],g.prototype,"layerListOpen",void 0);b.__decorate([w.property(),h.messageBundle("esri/widgets/support/SnappingControls/t9n/SnappingControls")],g.prototype,"messages",void 0);b.__decorate([w.property()],g.prototype,"snappingOptions",null);b.__decorate([w.property()],g.prototype,"view",null);b.__decorate([w.property()],g.prototype,"viewModel",null);b.__decorate([w.property({type:B,nonNullable:!0})], g.prototype,"visibleElements",void 0);b.__decorate([w.property()],g.prototype,"_enabledToggleDisabled",null);b.__decorate([w.property()],g.prototype,"_secondaryElementsDisabled",null);return g=b.__decorate([F.subclass("esri.widgets.support.SnappingControls")],g)})},"esri/widgets/support/SnappingControls/SnappingControlsViewModel":function(){define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/Error ../../../core/reactiveUtils ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../views/interactive/snapping/FeatureSnappingLayerSource ../../../views/interactive/snapping/SnappingOptions ../../LayerList/support/layerListUtils ./SnappingLayerListViewModel".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r){b=class extends b{constructor(q){super(q);this.layerListViewModel=new r.SnappingLayerListViewModel;this.snappingOptions=new y;this.view=null}initialize(){this.addHandles([m.watch(()=>({viewModel:this.layerListViewModel,view:this.view}),({viewModel:q,view:h})=>{q.view=h},m.initial),m.watch(()=>({viewModel:this.layerListViewModel,sources:this.snappingOptions?.featureSources}),({viewModel:q,sources:h})=>{q.featureSnappingSources=h},m.initial)])}get allLayersEnabled(){return(this.layerListViewModel?.selectableItems?? []).every(q=>"enabled"===q.enabled)}get allLayersDisabled(){return(this.layerListViewModel?.selectableItems??[]).every(q=>!q.enabled)}get layersEnabledCount(){return this.layerListViewModel?.selectableItems?.filter(q=>"enabled"===q.enabled).length??0}get state(){return this.snappingOptions?"ready":"disabled"}toggleSnappingForLayers(q,h){q?.forEach(u=>h?this.enableSnappingForLayer(u):this.disableSnappingForLayer(u))}toggleSnappingForAllLayers(q){this.layerListViewModel.selectableItems.forEach(({layer:{id:h}})=> {q?this.enableSnappingForLayer(h):this.disableSnappingForLayer(h)})}enableSnappingForLayer(q){if(q=this._findSnappingSourceForLayer(q)??this._makeSnappingSourceForLayer(q))q.enabled=!0}disableSnappingForLayer(q){if(q=this._findSnappingSourceForLayer(q))q.enabled=!1}updateEnabledFeatureSources(q){for(const h of this.snappingOptions.featureSources)l.canDisplayLayer(h.layer)&&(h.enabled=q.includes(h.layer.id))}_findSnappingSourceForLayer(q){return this.snappingOptions.featureSources.find(h=>h.layer.id=== q)}_makeSnappingSourceForLayer(q){var h=this.layerListViewModel.operationalItemsFlat.find(u=>u.layer.id===q)?.layer;if(!h)throw new c("snapping-controls:layer-not-found",`cannot enable snapping for layer with id ${q} because no such layer was found in the view`);if("group"!==h.type)return h=new p({layer:h}),this.snappingOptions.featureSources.add(h),h}};a.__decorate([k.property()],b.prototype,"allLayersEnabled",null);a.__decorate([k.property()],b.prototype,"allLayersDisabled",null);a.__decorate([k.property({constructOnly:!0})], b.prototype,"layerListViewModel",void 0);a.__decorate([k.property()],b.prototype,"layersEnabledCount",null);a.__decorate([k.property({type:y,nonNullable:!0})],b.prototype,"snappingOptions",void 0);a.__decorate([k.property()],b.prototype,"state",null);a.__decorate([k.property()],b.prototype,"view",void 0);return b=a.__decorate([F.subclass("esri.widgets.support.SnappingControls.SnappingControlsViewModel")],b)})},"esri/widgets/LayerList/support/layerListUtils":function(){define(["exports"],function(a){function b(g){return g?.listMode?? void 0}function c(g){if(g&&!("type"in g&&"wmts"===g.type))return"sublayers"in g?"sublayers":"layers"in g?"layers":void 0}function m(g,E){g?.sort((F,p)=>{F="uid"in F?E.indexOf(F.uid):-1;p="uid"in p?E.indexOf(p.uid):-1;return F>p?-1:F!p.hidden).length&&!E&&!F};a.minDragEnabledItems=2;a.minFilterItems=10;a.sortChildLayersToIds=function(g,E){if(g=g?.layer){var F=c(g);if(F){if("layers"===F&&"layers"in g)var p=g.layers;else"sublayers"===F&&"sublayers"in g&&(p=g.sublayers);m(p,E)}}};a.sortLayersToIds=m;Object.defineProperty(a,Symbol.toStringTag, {value:"Module"})})},"esri/widgets/support/SnappingControls/SnappingLayerListViewModel":function(){define("exports ../../../chunks/tslib.es6 ../../../core/Collection ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../LayerList/LayerListViewModel ./snappingLayerListUtils ./SnappingListItem".split(" "),function(a,b,c,m,k,w,g,E,F,p,y){a.SnappingLayerListViewModel=class extends F{constructor(){super(...arguments); this.featureSnappingSources=new c}get operationalItemsFlat(){return this.operationalItems.flatten(l=>l.children)}get selectableItems(){return this.operationalItemsFlat.filter(l=>!l.children?.length)}_compileList(){var l=this.view?.map?.layers;l&&(l=l.filter(p.isValidSnappingLayer),this._watchLayersListMode(l),l=this._getViewableLayers(l),l?.length?(this._createNewItems(l),this._removeItems(l),this._sortItems(l)):this._removeAllItems())}_createListItem(l){return new y.SnappingListItem({layer:l,view:this.view, getFeatureSnappingSources:()=>this.featureSnappingSources})}};b.__decorate([m.property()],a.SnappingLayerListViewModel.prototype,"featureSnappingSources",void 0);b.__decorate([m.property()],a.SnappingLayerListViewModel.prototype,"operationalItems",void 0);b.__decorate([m.property()],a.SnappingLayerListViewModel.prototype,"operationalItemsFlat",null);b.__decorate([m.property()],a.SnappingLayerListViewModel.prototype,"selectableItems",null);a.SnappingLayerListViewModel=b.__decorate([E.subclass("esri.widgets.support.SnappingControls.SnappingLayerListViewModel")], a.SnappingLayerListViewModel);Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/LayerList/LayerListViewModel":function(){define("../../chunks/tslib.es6 ../../core/Collection ../../core/Evented ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./ListItem ./support/layerListUtils".split(" "),function(a,b,c,m,k,w,g,E,F,p,y){const l=b.ofType(p);b=class extends c.EventedAccessor{constructor(r){super(r); this.checkPublishStatusEnabled=!1;this.listItemCreatedFunction=null;this.listModeDisabled=!1;this.operationalItems=new l;this.view=null}initialize(){this.addHandles([m.watch(()=>!0===this.view?.ready,()=>this._viewHandles(),m.initial),m.watch(()=>[this.listItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._recompileList())],"view")}destroy(){this._removeAllItems();this.view=null}get state(){const {view:r}=this;return r?.ready?"ready":r?"loading":"disabled"}get totalItems(){return this.operationalItems.flatten(r=> r.children).length}triggerAction(r,q){r&&!r.disabled&&this.emit("trigger-action",{action:r,item:q})}moveListItem(r,q,h,u){const f=r?.layer;if(f&&"subtype-sublayer"!==f.type&&"sublayer"!==f.type){var z=this.view?.map?.layers,B=q?y.getItemLayers(q):z;z=h?y.getItemLayers(h):z;if(B&&z){var {operationalItems:x}=this,N=h?.children||x;u=z.length-u;r.parent=h||null;(q?.children||x).remove(r);B.remove(f);N.includes(r)||N.add(r,u);z.includes(f)||z.add(f,u);this._compileList()}}}_createLayerViewHandles(r){this.removeHandles("layer-views"); this._compileList();r&&this.addHandles(r.on("change",()=>this._compileList()),"layer-views")}_createMapLayerHandles(r){this.removeHandles("map-layers");this._compileList();r&&this.addHandles(r.on("change",()=>this._compileList()),"map-layers")}_createListItem(r){const {view:q,listItemCreatedFunction:h,checkPublishStatusEnabled:u,listModeDisabled:f}=this;return new p({checkPublishStatusEnabled:u,listModeDisabled:f,layer:r,listItemCreatedFunction:h,view:q})}_removeAllItems(){this.operationalItems.destroyAll()}_getViewableLayers(r){return r? this.listModeDisabled?r:r.filter(q=>"hide"!==y.findLayerListMode(q)):void 0}_watchLayersListMode(r){this.removeHandles("layer-list-mode");r&&!this.listModeDisabled&&this.addHandles(m.watch(()=>r.filter(q=>"listMode"in q).map(q=>q.listMode).toArray(),()=>this._compileList()),"layer-list-mode")}_compileList(){var r=this.view?.map?.layers;this._watchLayersListMode(r);r=this._getViewableLayers(r);r?.length?(this._createNewItems(r),this._removeItems(r),this._sortItems(r)):this._removeAllItems()}_createNewItems(r){const {operationalItems:q}= this;r.forEach(h=>{q.some(u=>u.layer===h)||q.add(this._createListItem(h))})}_removeItems(r){const {operationalItems:q}=this,h=[];q.forEach(u=>{u&&r&&r.includes(u.layer)||h.push(u)});q.destroyMany(h)}_sortItems(r){const {operationalItems:q}=this;q.sort((h,u)=>{h=r.indexOf(h.layer);u=r.indexOf(u.layer);return h>u?-1:h this.view?.map?.allLayers,q=>this._createMapLayerHandles(q),m.initial),m.watch(()=>this.view?.allLayerViews,q=>this._createLayerViewHandles(q),m.initial)],"view-layers"):this._removeAllItems()}};a.__decorate([k.property()],b.prototype,"checkPublishStatusEnabled",void 0);a.__decorate([k.property()],b.prototype,"listItemCreatedFunction",void 0);a.__decorate([k.property({nonNullable:!0})],b.prototype,"listModeDisabled",void 0);a.__decorate([k.property({type:l})],b.prototype,"operationalItems",void 0); a.__decorate([k.property({readOnly:!0})],b.prototype,"state",null);a.__decorate([k.property()],b.prototype,"totalItems",null);a.__decorate([k.property()],b.prototype,"view",void 0);return b=a.__decorate([F.subclass("esri.widgets.LayerList.LayerListViewModel")],b)})},"esri/widgets/LayerList/ListItem":function(){define("../../chunks/tslib.es6 ../../core/Accessor ../../core/arrayUtils ../../core/Collection ../../core/Identifiable ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/accessorSupport/decorators/cast ../../core/has ../../core/accessorSupport/decorators/subclass ../../core/accessorSupport/get ../../support/actions/ActionBase ../../support/actions/ActionButton ../../support/actions/ActionSlider ../../support/actions/ActionToggle ./ListItemPanel ./support/layerListUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f){var z;F=m.ofType({key:"type",defaultKeyValue:"button",base:l,typeMap:{button:r,toggle:h,slider:q}});const B=m.ofType(F);b=z=class extends k.IdentifiableMixin(b){constructor(x){super(x);this.actionsSections=new B;this.checkPublishStatusEnabled=this.actionsOpen=!1;this.children=new (m.ofType(z));this.childrenSortable=!0;this.hidden=!1;this.listItemCreatedFunction=this.layer=null;this.open=this.listModeDisabled=!1;this.view=this.parent=this.panel=null}initialize(){this.addHandles([w.watch(()=> [this.layer,this.layer?.listMode,this.listModeDisabled],()=>this._watchLayerProperties(this.layer),w.initial),w.watch(()=>this.checkPublishStatusEnabled,x=>this._updateChildrenPublishing(x),w.initial),w.watch(()=>this.view,x=>this._updateChildrenView(x),w.initial),w.watch(()=>this.panel,x=>this._setListItemOnPanel(x),w.initial)]);"function"===typeof this.listItemCreatedFunction&&this.listItemCreatedFunction.call(null,{item:this})}destroy(){this.panel?.destroy();this.children.destroyAll();this.view= null}get connectionStatus(){const {layerView:x,publishing:N}=this;if(!N&&x&&"connectionStatus"in x)return x.connectionStatus}get error(){return this.layer?.loadError}get incompatible(){const {layerView:x}=this;return x&&"spatialReferenceSupported"in x?!x.spatialReferenceSupported:!1}get layerView(){const {layer:x,view:N}=this;if(!x||!N||"sublayer"===x.type)return null;const J="subtype-sublayer"===x.type?x.parent:x;return N.allLayerViews.find(I=>I.layer===J)??null}castPanel(x){this.panel?.open&&!x.hasOwnProperty("open")&& (x.open=!0);return x?new u(x):null}get sortable(){return"knowledge-graph-sublayer"===this.layer?.type?!1:this._get("sortable")}set sortable(x){this._set("sortable",x)}get title(){const x=y.get(this,"layer.layer");return(!x||x&&y.get(this,"layer.layer.loaded"))&&y.get(this,"layer.title")||y.get(this,"layer.attributes.title")||""}set title(x){this._override("title",x)}get publishing(){const {layer:x,checkPublishStatusEnabled:N}=this;return N&&x&&"publishingInfo"in x&&"publishing"===x.publishingInfo?.status}get updating(){const {layerView:x, connectionStatus:N,layer:J,publishing:I}=this;return I||N?!1:x?x.updating:"loading"===J?.loadStatus||!1}get visible(){return this.layer?.visible}set visible(x){const N=this.layer;N&&(N.visible=x)}get visibleAtCurrentScale(){return this.layerView?.visibleAtCurrentScale??!0}get visibleAtCurrentTimeExtent(){return this.layerView?.visibleAtCurrentTimeExtent??!0}get visibilityMode(){return f.findLayerVisibilityMode(this.layer)}clone(){return new z({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen, checkPublishStatusEnabled:this.checkPublishStatusEnabled,children:this.children.clone(),childrenSortable:this.childrenSortable,hidden:this.hidden,layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,open:this.open,panel:this.panel,parent:this.parent,sortable:this.sortable,title:this.title,view:this.view,visible:this.visible})}_setListItemOnPanel(x){x&&(x.listItem=this)}_updateChildrenPublishing(x){const N=this.children;N&&N.forEach(J=>J.checkPublishStatusEnabled= x)}_updateChildrenView(x){const N=this.children;N&&N.forEach(J=>J.view=x)}_createChildren(x){const {listModeDisabled:N,children:J}=this;x=x.filter(I=>!J.some(d=>d.layer===I));J.addMany(this._createChildItems(x,N))}_destroyChildren(x){const {children:N}=this,J=N.filter(I=>!x.includes(I.layer));N.destroyMany(J)}_sortChildren(x){this.children.sort((N,J)=>x.indexOf(J.layer)-x.indexOf(N.layer))}_destroyAllChildren(){this.removeHandles("child-list-mode");this.children.destroyAll()}_watchChildLayerListMode(x){this.removeHandles("child-list-mode"); this.listModeDisabled||this.addHandles(x.toArray().map(N=>w.watch(()=>N.listMode,()=>this._compileChildren(x))),"child-list-mode")}_compileChildren(x){const N=this.listModeDisabled?x:x?.filter(J=>"hide"!==f.findLayerListMode(J));N?.length?(this._createChildren(N),this._destroyChildren(N),this._sortChildren(N),this._watchChildLayerListMode(x)):this._destroyAllChildren()}_watchSublayerChanges(x){x&&this.addHandles(x.on("change",()=>this._compileChildren(x)),"layer")}_initializeChildLayers(x){this._compileChildren(x); this._watchSublayerChanges(x)}_createChildItems(x,N){return x.map(J=>N||f.canDisplayLayer(J)?new z({layer:J,checkPublishStatusEnabled:this.checkPublishStatusEnabled,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,parent:this,view:this.view}):null).filter(c.isSome).reverse()}_watchLayerProperties(x){this.removeHandles("layer");this.removeHandles("child-list-mode");if(x)if("hide-children"===(!this.listModeDisabled&&f.findLayerListMode(x)))this.children.destroyAll(); else{var N=f.getNormalizedChildLayerProperty(x);N&&this.addHandles(w.watch(()=>x[N],J=>{x.hasOwnProperty(N)&&this._initializeChildLayers(J)},w.initial),"layer")}}};a.__decorate([g.property({type:B})],b.prototype,"actionsSections",void 0);a.__decorate([g.property()],b.prototype,"actionsOpen",void 0);a.__decorate([g.property()],b.prototype,"checkPublishStatusEnabled",void 0);a.__decorate([g.property({type:m})],b.prototype,"children",void 0);a.__decorate([g.property()],b.prototype,"childrenSortable", void 0);a.__decorate([g.property({readOnly:!0})],b.prototype,"connectionStatus",null);a.__decorate([g.property({readOnly:!0})],b.prototype,"error",null);a.__decorate([g.property()],b.prototype,"hidden",void 0);a.__decorate([g.property({readOnly:!0})],b.prototype,"incompatible",null);a.__decorate([g.property()],b.prototype,"layer",void 0);a.__decorate([g.property({readOnly:!0})],b.prototype,"layerView",null);a.__decorate([g.property()],b.prototype,"listItemCreatedFunction",void 0);a.__decorate([g.property({nonNullable:!0})], b.prototype,"listModeDisabled",void 0);a.__decorate([g.property()],b.prototype,"open",void 0);a.__decorate([g.property({type:u})],b.prototype,"panel",void 0);a.__decorate([E.cast("panel")],b.prototype,"castPanel",null);a.__decorate([g.property()],b.prototype,"parent",void 0);a.__decorate([g.property({value:!0})],b.prototype,"sortable",null);a.__decorate([g.property()],b.prototype,"title",null);a.__decorate([g.property({readOnly:!0})],b.prototype,"publishing",null);a.__decorate([g.property({readOnly:!0})], b.prototype,"updating",null);a.__decorate([g.property()],b.prototype,"view",void 0);a.__decorate([g.property()],b.prototype,"visible",null);a.__decorate([g.property({readOnly:!0})],b.prototype,"visibleAtCurrentScale",null);a.__decorate([g.property({readOnly:!0})],b.prototype,"visibleAtCurrentTimeExtent",null);a.__decorate([g.property({readOnly:!0})],b.prototype,"visibilityMode",null);return b=z=a.__decorate([p.subclass("esri.widgets.LayerList.ListItem")],b)})},"esri/support/actions/ActionSlider":function(){define("../../chunks/tslib.es6 ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./ActionBase".split(" "), function(a,b,c,m,k,w,g){var E;c=E=class extends g{constructor(F){super(F);this.displayValueEnabled=!1;this.max=1;this.min=0;this.step=.1;this.type="slider";this.value=null}clone(){return new E({active:this.active,className:this.className,disabled:this.disabled,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,displayValueEnabled:this.displayValueEnabled,max:this.max,min:this.min,step:this.step,value:this.value})}};a.__decorate([b.property()],c.prototype,"displayValueEnabled", void 0);a.__decorate([b.property()],c.prototype,"max",void 0);a.__decorate([b.property()],c.prototype,"min",void 0);a.__decorate([b.property()],c.prototype,"step",void 0);a.__decorate([b.property()],c.prototype,"value",void 0);return c=E=a.__decorate([w.subclass("esri.support.actions.ActionSlider")],c)})},"esri/widgets/LayerList/ListItemPanel":function(){define("require ../../chunks/tslib.es6 ../../core/Identifiable ../../core/maybe ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../Widget ./support/layerListUtils ../support/widget ../support/jsxFactory".split(" "), function(a,b,c,m,k,w,g,E,F,p,y,l,r,q){c=class extends c.IdentifiableMixin(y){constructor(h,u){super(h,u);this.content=this.className=this._legend=null;this.flowEnabled=!1;this.listItem=this.image=null;this.open=!1;this.visible=!0}initialize(){this.addHandles([k.watch(()=>this._canCreateLegend,()=>this._createLegend(),k.initial),k.watch(()=>[this._legend,this._legendOptions],()=>this._updateLegend(),k.initial)])}destroy(){this._legend=m.destroyMaybe(this._legend)}get _canCreateLegend(){const {content:h, listItem:u}=this;return u?"legend"===h?!0:null!=h&&(Array.isArray(h)?h.includes("legend"):!1):!1}get _legendOptions(){const {listItem:h,_legendLayerInfo:u}=this,f=h?.view;return u&&f?{view:f,layerInfos:[u]}:{}}get _legendLayerInfo(){const h=this.listItem?.layer;if(!h||"subtype-sublayer"===h.type)return null;var u=l.isSublayer(h)?h:null;const f=h?.parent;return(u=null!=f&&"type"in f&&"map-image"===f.type?u?.source:null)&&f?{layer:f,title:"",sublayerIds:[u.mapLayerId]}:{layer:h,title:""}}get disabled(){const {listItem:h, _legend:u,content:f}=this;return h?Array.isArray(f)&&1this._renderContent(f)):this._renderContent(h): null}async _createLegend(){m.destroyMaybe(this._legend);this._legend=null;if(this._canCreateLegend){var {default:h}=await new Promise((u,f)=>a(["../Legend"],z=>u(Object.freeze(Object.defineProperty({__proto__:null,default:z},Symbol.toStringTag,{value:"Module"}))),f));this._legend=new h(this._legendOptions)}}_attachToNode(h){h.appendChild(this)}_updateLegend(){const h=this._legend;h&&h.set(this._legendOptions)}_getWidget(h){return"legend"===h?this._legend:r.isWidget(h)?h:null}_getFirstWidget(){const {content:h}= this;return Array.isArray(h)?h.map(u=>this._getWidget(u)).find(u=>u):this._getWidget(h)}};b.__decorate([w.property()],c.prototype,"_legend",void 0);b.__decorate([w.property()],c.prototype,"_canCreateLegend",null);b.__decorate([w.property()],c.prototype,"_legendOptions",null);b.__decorate([w.property()],c.prototype,"_legendLayerInfo",null);b.__decorate([w.property()],c.prototype,"className",void 0);b.__decorate([w.property()],c.prototype,"content",void 0);b.__decorate([w.property()],c.prototype,"disabled", null);b.__decorate([w.property()],c.prototype,"flowEnabled",void 0);b.__decorate([w.property()],c.prototype,"icon",null);b.__decorate([w.property()],c.prototype,"image",void 0);b.__decorate([w.property()],c.prototype,"listItem",void 0);b.__decorate([w.property()],c.prototype,"open",void 0);b.__decorate([w.property()],c.prototype,"title",null);b.__decorate([w.property()],c.prototype,"visible",void 0);return c=b.__decorate([p.subclass("esri.widgets.LayerList.ListItemPanel")],c)})},"esri/widgets/support/SnappingControls/snappingLayerListUtils":function(){define(["exports", "../../LayerList/support/layerListUtils"],function(a,b){const c=g=>m(g)||k(g),m=g=>{if(!("type"in g))return!1;switch(g.type){case "feature":case "geojson":case "csv":case "graphics":case "wfs":case "map-notes":case "oriented-imagery":case "scene":case "building-scene":case "subtype-sublayer":return!0;default:return!1}},k=g=>{const E=b.getNormalizedChildLayerProperty(g);if(null!=E&&g.hasOwnProperty(E)&&null!=g[E])for(const F of g[E])if(c(F))return!0;return!1},w=(g,E)=>{if(null!=E&&null!=g){if(E.test(g.title))return"self"; if(g.children.some(F=>!1!==w(F,E)))return"children"}return!1};a.isValidSnappingLayer=c;a.isValidSnappingLayerGroup=k;a.isValidSnappingLayerSource=m;a.itemTitleMatchesFilter=w;Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/SnappingControls/SnappingListItem":function(){define("exports ../../../chunks/tslib.es6 ../../../core/arrayUtils ../../../core/Collection ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/accessorSupport/decorators/subclass ../../LayerList/ListItem ../../LayerList/support/layerListUtils ./snappingLayerListUtils".split(" "), function(a,b,c,m,k,w,g,E,F,p,y){var l;a.SnappingListItem=l=class extends F{constructor(r){super(r);this.children=new m;this.parent=null}get enabled(){const {children:r}=this;if(0===r.length)return null!=this.featureSource?this.featureSource.enabled?"enabled":"disabled":"disabled";let q=!1,h=!1;for(const u of r){if("indeterminate"===u.enabled)return u.enabled;"enabled"===u.enabled?q=!0:"disabled"===u.enabled&&(h=!0);if(h&&q)return"indeterminate"}return h?"disabled":"enabled"}get childLayerIds(){return this.children.toArray().flatMap(r=> [r.layer.id,...r.childLayerIds])}get featureSource(){const {layer:r,getFeatureSnappingSources:q}=this;return q().find(h=>h.layer===r)}_initializeChildLayers(r){r&&(r=r.filter(y.isValidSnappingLayer),super._initializeChildLayers(r))}_createChildItems(r){return r.map(q=>p.canDisplayLayer(q)?new l({layer:q,parent:this,view:this.view,getFeatureSnappingSources:this.getFeatureSnappingSources}):null).filter(c.isSome).reverse()}};b.__decorate([k.property()],a.SnappingListItem.prototype,"enabled",null);b.__decorate([k.property()], a.SnappingListItem.prototype,"children",void 0);b.__decorate([k.property()],a.SnappingListItem.prototype,"childLayerIds",null);b.__decorate([k.property()],a.SnappingListItem.prototype,"featureSource",null);b.__decorate([k.property({constructOnly:!0})],a.SnappingListItem.prototype,"getFeatureSnappingSources",void 0);b.__decorate([k.property()],a.SnappingListItem.prototype,"parent",void 0);a.SnappingListItem=l=b.__decorate([E.subclass("esri.widgets.support.SnappingControls.SnappingListItem")],a.SnappingListItem); Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/UpdateFeaturePanelContent":function(){define("exports ../../../intl/substitute ./FooterActions ./Notices ./PanelContent ../../support/Heading ../../support/widgetUtils ../../support/jsxFactory".split(" "),function(a,b,c,m,k,w,g,E){a.UpdateFeaturePanelContent=function({editorViewModel:F,headingLevel:p,messages:y,messagesCommon:l,onDelete:r,onSave:q,renderAttachments:h,renderFeatureForm:u}){const {activeWorkflow:f, featureFormViewModel:z,syncing:B}=F;if(!f||!z)return null;var x=f.type,N="activeWorkflow"in f?f.activeWorkflow:void 0;const J=N&&!N.hasPendingEdits||"update"===x&&!f.hasPendingEdits||B||z.updating,I="update"===x&&"create-features"!==N?.type?l.update:l.create;N="create-features"===x&&"create-new"===f.createFeatureState;x="create-features"===x?f.numPendingFeatures:0;x=1 !v.visible)&&!d?E.tsx(k.PanelContentMessage,{key:"panel-content-message"},b.substitute(y.clickToFinishTemplate,{button:I})):E.tsx(k.PanelContentSection,{key:"panel-content-section"},E.tsx(m.Notices,{messages:y,workflow:f}),E.tsx(k.PanelContentSectionGroup,null,u(),d?E.tsx("div",{key:"attachments"},E.tsx(w.Heading,{level:w.incrementHeadingLevel(p)},y.attachments),h()):null));return E.tsx(E.tsxFragment,null,E.tsx(k.PanelContent,{key:"attribute-panel-content",showScrimOverlay:N},p),E.tsx(c.FooterActions, {buttons:[{onClick:q,disabled:J,label:x},F.shouldShowDeleteButton?{appearance:"outline",onClick:r,disabled:B,kind:"danger",label:l.delete}:void 0]}))};a.loadUpdateFeaturePanelContentComponents=()=>Promise.all([c.loadFooterActionsComponents(),m.loadNoticesComponents(),k.loadPanelContentComponents()]);Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Editor/components/UploadDetails":function(){define("require exports ../../../layers/graphics/sources/support/uploadAssetErrors ./FooterActions ./PanelContent ../../../chunks/componentsUtils ../../support/widgetUtils ../../support/jsxFactory".split(" "), function(a,b,c,m,k,w,g,E){function F(h){const u=p(h);return u?E.tsx("div",{class:r.base,"data-testid":"upload-details",key:"upload-details-content"},E.tsx("div",{class:r.status,key:"status"},u.iconContent,E.tsx("div",{class:r.titleWrapper,key:"text"},E.tsx("div",{class:r.title,key:"title"},u.title),E.tsx("div",{class:r.description,key:"description"},u.description))),l(h.upload)):null}function p({helpMessage:h,messages:u,upload:f}){switch(f.state){case "pending":const {title:z,description:B}=u.modelUploads.pending; return{title:z,description:B,iconContent:E.tsx("calcite-loader",{"aria-hidden":"true",class:r.loader,label:"",scale:"s",type:"determinate",value:Math.min(Math.round(100*f.progress),1===f.progress?100:99)})};case "success":return{title:f}=u.modelUploads.success,{title:f,description:h||u.helpMessages3d.mesh,iconContent:E.tsx("calcite-icon",{class:g.classes(r.iconSuccess),icon:"check",scale:"l"})};case "error":return{title:h}=u.modelUploads.error,{title:h,description:y(f.error,u),iconContent:E.tsx("calcite-icon", {class:g.classes(r.iconError),icon:"exclamation-mark-circle",scale:"l"})};default:return null}}function y(h,u){if(!h)return null;u=u.modelUploads.error.messages;switch(h.constructor){case c.NoModelError:return u.noModel;case c.MultipleModelsError:return u.multipleModels;case c.Convert3DFailedError:return u.conversionFailed;default:return u.default}}function l(h){return E.tsx("div",{class:r.fileList,key:"file-list"},h.files.map(u=>{var f=E.tsx,z={class:r.file,key:`file-${u.name}`},B=E.tsx,x=r.fileIcon; const N=u.name.split(".").pop()?.toLowerCase();return f.call(E,"div",z,B.call(E,"calcite-icon",{class:x,icon:(N?q[N]:null)??"file",scale:"s"}),E.tsx("span",{class:r.fileName},u.name.split("/").pop()?.split("\\").pop()??""))}))}const r={base:"esri-editor__upload-details",status:"esri-editor__upload-details__status",titleWrapper:"esri-editor__upload-details__title-wrapper",title:"esri-editor__upload-details__title",description:"esri-editor__upload-details__description",loader:"esri-editor__upload-details__loader", iconSuccess:"esri-editor__upload-details__icon esri-editor__upload-details__icon--success",iconError:"esri-editor__upload-details__icon esri-editor__upload-details__icon--error",fileList:"esri-editor__upload-details__file-list",file:"esri-editor__upload-details__file",fileIcon:"esri-editor__upload-details__file-icon",fileName:"esri-editor__upload-details__file-name"},q={glb:"file-shape",gltf:"file-shape",jpeg:"file-image",jpg:"file-image",png:"file-image",svg:"file-image",zip:"file-zip"};b.UploadDetails= function(h){const {messages:u,key:f,upload:z}=h;return E.tsx(E.tsxFragment,null,E.tsx(k.PanelContent,{key:f??"upload-details"},E.tsx(k.PanelContentSection,null,F(h))),"error"===z.state?E.tsx(m.FooterActions,{buttons:[{onClick:()=>z.retry(),label:u.modelUploads.error.uploadNew,iconStart:"upload-to"}],key:"upload-details-footer-actions"}):null)};b.css=r;b.loadUploadDetailsComponents=()=>Promise.all([w.loadCalciteComponents({icon:()=>new Promise((h,u)=>a(["../../../chunks/calcite-icon"],h,u)),loader:()=> new Promise((h,u)=>a(["../../../chunks/calcite-loader"],h,u))}),m.loadFooterActionsComponents(),k.loadPanelContentComponents()]);Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/layers/graphics/sources/support/uploadAssetErrors":function(){define(["exports","../../../../core/Error"],function(a,b){class c extends b{constructor(){super("upload-assets:unsupported","Layer does not support asset uploads.",Error())}}class m extends b{constructor(){super("upload-assets:no-glb-support", "Layer does not support glb.",Error())}}class k extends b{constructor(){super("upload-assets:no-supported-source","No supported external source found",Error())}}class w extends b{constructor(){super("upload-assets:not-base-64","Expected gltf data in base64 format after conversion.",Error())}}class g extends b{constructor(){super("upload-assets:unable-to-prepare-options","Unable to prepare uploadAsset request options.",Error())}}class E extends b{constructor(q,h){super("upload-assets:bad-response", `Bad response. Uploaded ${q} items and received ${h} results.`,Error())}}class F extends b{constructor(q,h){super("upload-assets-layer:upload-failed",`Failed to upload mesh file ${q}. Error code: ${h?.code??"-1"}. Error message: ${h?.messages??"unknown"}`,Error())}}class p extends b{constructor(q){super("upload-assets-layer:unsupported-format",`The service allowed us to upload an asset of FormatID ${q}, but it does not list it in its supported formats.`,Error())}}class y extends b{constructor(){super("upload-assets:convert3D-failed", "convert3D failed.")}}class l extends b{constructor(){super("invalid-input:no-model","No supported model found")}}class r extends b{constructor(){super("invalid-input:multiple-models","Multiple supported models found")}}a.BadResponseError=E;a.Convert3DFailedError=y;a.MultipleModelsError=r;a.NoGlbSupportError=m;a.NoModelError=l;a.NoSupportedSourceError=k;a.NotBase64Error=w;a.UnableToPrepareOptionsError=g;a.UnsupportedError=c;a.UnsupportedFormatUploadedError=p;a.UploadFailedError=F;Object.defineProperty(a, Symbol.toStringTag,{value:"Module"})})},"*noref":1}}); define("require ../chunks/tslib.es6 ../intl ../core/deprecate ../core/Logger ../core/maybe ../core/promiseUtils ../core/reactiveUtils ../core/accessorSupport/decorators/property ../core/has ../core/RandomLCG ../core/accessorSupport/decorators/subclass ../views/interactive/sketch/SketchValueOptions ./Attachments ./FeatureForm ./FeatureTemplates ./Spinner ./Widget ./Editor/css ./Editor/EditorViewModel ./Editor/icons ./Editor/modelUploadUtils ./Editor/VisibleElements ./Editor/components/CreateFeaturesPanelContent ./Editor/components/FeatureList ./Editor/components/FooterActions ./Editor/components/Notices ./Editor/components/PanelContent ./Editor/components/PanelToolbar ./Editor/components/Prompt ./Editor/components/UpdateFeaturePanelContent ./Editor/components/UploadDetails ./FeatureTemplates/ItemList ../chunks/componentsUtils ./support/globalCss ./support/Heading ./support/widgetUtils ./support/decorators/messageBundle ./support/decorators/vmEvent ./support/jsxFactory ../intl/substitute".split(" "),function(a, b,c,m,k,w,g,E,F,p,y,l,r,q,h,u,f,z,B,x,N,J,I,d,v,O,t,H,P,K,D,A,M,C,e,n,G,L,S,T,ea){c=class extends z{constructor(V,ca){super(V,ca);this._featureForm=new h;this._attachments=new q({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}});this._featureTemplates=new u({enableListScroll:!1,renderItemContentEnd:ja=>ja.supportsUpload?T.tsx("calcite-icon",{class:B.css.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}): null,renderItemLabel:ja=>ja.label,renderCustomGroupContent:ja=>this._renderCustomTemplateGroupContent(ja)});this._filterText="";this._prompt=null;this._spinner=new f;this.headingLevel=4;this.supportingWidgetDefaults=this.messagesTemplates=this.messagesCommon=this.messages=null;this.viewModel=new x;this.visibleElements=new I;this._renderSelectIcon=()=>T.tsx("calcite-icon",{icon:"cursor",slot:"content-start"});this.EditorPanel=({heading:ja,key:W},...Z)=>{const {visibleElements:ha}=this;return T.tsx("calcite-flow-item", {closable:!1,heading:ja,headingLevel:this.headingLevel,key:W,loading:this._loading,onCalciteFlowItemBack:this._onBack},ha.settingsMenu?T.tsx(P.PanelToolbar,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:ha}):null,...Z)};this._showDiscardEditsPrompt=()=>{const {messages:ja,activeWorkflow:W}=this;return"create-features"===W?.type&&J.isModelUpload(W.data.creationInfo)?this._showPromptAndWait("success"===W.data.upload?.state?ja.modelUploads.cancelPlacementPrompt:ja.modelUploads.cancelUploadPrompt): this._showPromptAndWait({title:ja.cancelEditTitle,message:ja.cancelEditWarningMessage,yesLabel:ja.discardEdits,noLabel:ja.continueEditing})};this._showGenericCancelPrompt=()=>{const {messages:ja,messagesCommon:W}=this;return this._showPromptAndWait({title:ja.cancelRequestTitle,message:ja.cancelRequestWarningMessage,yesLabel:W.form.yes,noLabel:W.form.no})};this._showPrompt=ja=>{this._prompt?.cancel?.();this._prompt=ja};this._clearPrompt=()=>{this._prompt=null};this._onSave=()=>{this.viewModel.saveWorkflow()}; this._onDelete=()=>{const {messages:ja,messagesCommon:W}=this;this._showPrompt({title:ja.deleteWarningTitle,message:ja.deleteWarningMessage,context:"danger",actions:{primary:{label:W.delete,action:()=>{this.deleteFeatureFromWorkflow();this._clearPrompt()}},secondary:{label:ja.keepFeature,action:this._clearPrompt}}})};this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow();this._onBack=ja=>{ja?.stopPropagation();return this.viewModel.back()};this._onAttachmentAdd=()=>{const {activeWorkflow:ja}= this.viewModel;ja&&("create-features"===ja.type||"update"===ja.type&&"create-features"===ja.activeWorkflow?.type?(this._attachments.addFile(),ja.back()):this._attachments.addAttachment().then(()=>ja.back()))};this._onAttachmentUpdate=()=>{const {activeWorkflow:ja}=this.viewModel;ja&&("create-features"===ja.type?(this._attachments.updateFile(),ja.back()):this._attachments.updateAttachment().then(()=>ja.back()))};this._onAttachmentDelete=()=>{const {messages:ja,messagesCommon:W}=this;this._showPrompt({title:ja.deleteAttachmentWarningTitle, message:ja.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:W.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:ja.keepAttachment,action:this._clearPrompt}}})};this._onAttachmentDeleteConfirm=async()=>{const ja=this._attachments,{activeWorkflow:W}=this.viewModel;W&&("create-features"===W.type?ja.deleteFile():(await ja.deleteAttachment(ja.viewModel.activeAttachmentInfo),this._clearPrompt()),await W.back(),this._clearPrompt())};this._onAttachmentsError=ja=>{this._showPrompt({title:this.messages.errorWarningTitle, message:ja.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt;this._featureForm.clearPrompt=this._clearPrompt;this.addHandles([E.watch(()=>n.incrementHeadingLevel(this.headingLevel),V=>{this._featureForm.headingLevel=V;this._featureTemplates.headingLevel=V},E.initial),E.on(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:V})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt(): this._showGenericCancelPrompt()).then(ca=>ca?V.allow():V.deny())}),E.when(()=>this.viewModel.featureFormViewModel,V=>{this._featureForm.viewModel=V},E.initial),E.watch(()=>this.viewModel,V=>{this._attachments.viewModel=V?.attachmentsViewModel??null;this._featureTemplates.viewModel=V?.featureTemplatesViewModel??null;this._spinner.viewModel=V?.spinnerViewModel??null;V.showDiscardEditsPrompt=this._showDiscardEditsPrompt},E.initial),E.watch(()=>this.view,(V,ca)=>{const ja=`editor-${this.id}-spinner`; ca?.ui.remove(this._spinner,ja);V?.ui.add(this._spinner,{key:ja,position:"manual"})},E.initial),E.watch(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([V])=>{V&&(this._featureForm.set(V.featureForm),this._attachments.set(V.attachments),this._featureTemplates.set(V.featureTemplates),this.viewModel.sketchViewModel?.set(V.sketch))},E.initial),E.when(()=>this._attachments?.error,V=>this._onAttachmentsError(V)),E.when(()=>this.viewModel?.failures,V=>{const {messages:ca}=this,[{error:ja, retry:W,cancel:Z}]=V;this._showPrompt({title:ca.errorWarningTitle,message:ea.substitute(ca.errorWarningMessageTemplate,{errorMessage:ja.message}),context:"warning",actions:{primary:{label:ca.retry,action:()=>{W();this._clearPrompt()}},secondary:{label:ca.ignore,action:()=>{Z();this._clearPrompt()}}}})}),E.watch(()=>this.viewModel?.state,V=>{switch(V){case "awaiting-feature-to-update":case "ready":case "disabled":this._filterText="",this._featureTemplates.filterText=""}}),E.watch(()=>this.viewModel.featureFormDisabled, V=>this._featureForm.disabled=V)])}destroy(){this._attachments.destroy();this._featureForm.destroy();this._featureTemplates.destroy()}loadDependencies(){return Promise.all([C.loadCalciteComponents({"flow-item":()=>new Promise((V,ca)=>a(["../chunks/calcite-flow-item"],V,ca)),flow:()=>new Promise((V,ca)=>a(["../chunks/calcite-flow"],V,ca)),icon:()=>new Promise((V,ca)=>a(["../chunks/calcite-icon"],V,ca)),list:()=>new Promise((V,ca)=>a(["../chunks/calcite-list"],V,ca))}),d.loadCreateFeaturesPanelContentComponents(), v.loadFeatureListComponents(),O.loadFooterActionsComponents(),t.loadNoticesComponents(),H.loadPanelContentComponents(),P.loadPanelToolbarComponents(),K.loadPromptComponents(),D.loadUpdateFeaturePanelContentComponents(),A.loadUploadDetailsComponents()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _loading(){const {viewModel:V}=this;return V.syncing||V.updating||this._attachments.submitting}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(V){m.deprecatedProperty(k.getLogger(this), "allowedWorkflows",{replacement:"visibleElements",version:"4.29",warnOnce:!0});this.viewModel.allowedWorkflows=V}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(V){this.viewModel.hideTemplatesForInactiveLayers=V}get icon(){return"pencil"}set icon(V){this._overrideIfSome("icon",V)}get label(){return this.messages?.widgetLabel??""}set label(V){this._overrideIfSome("label",V)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(V){this.viewModel.labelOptions= V}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(V){this.viewModel.layerInfos=V}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(V){this.viewModel.snappingOptions=V}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(V){this.viewModel.tooltipOptions=V}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(V){this.viewModel.valueOptions=V}get view(){return this.viewModel.view}set view(V){this.viewModel.view=V}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(V){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(V)}startCreateFeaturesWorkflowAtFeatureEdit(V){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(V)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(V){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(V)}startUpdateWorkflowAtFeatureEdit(V){return this.viewModel.startUpdateWorkflowAtFeatureEdit(V)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(V){return this.viewModel.cancelWorkflow(V)}render(){const {viewModel:V}= this,ca=this.classes(B.css.base,e.globalCss.widget,e.globalCss.panel);return V?T.tsx("div",{class:ca,key:"base"},T.tsx("calcite-flow",{key:"flow"},V.pageStack.map(ja=>this._renderPage(ja))),this._prompt?T.tsx(K.Prompt,{...this._prompt,headingLevel:this.headingLevel}):void 0):T.tsx("div",{class:ca,key:"empty"})}_renderPage(V){switch(V){case "ready":return this._renderReady();case "awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo();case "creating-features-upload-details":return this._renderUploadDetails(); case "creating-features":return this._renderCreatingFeatures();case "editing-existing-feature":case "editing-attributes":return this._renderUpdateFeature();case "awaiting-update-feature-candidate":return this._renderFeatureList();case "adding-attachment":return this._renderAttachmentAdding();case "editing-attachment":return this._renderAttachmentEditing()}return T.tsx("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(){const {EditorPanel:V,messages:ca}=this;return T.tsx(V,{heading:ca.selectTemplate, key:"templates-panel"},T.tsx(H.PanelContent,{key:"feature-templates"},T.tsx(H.PanelContentSection,null,this._featureTemplates.render())))}_renderUploadDetails(){const {EditorPanel:V,activeWorkflow:ca,messages:ja}=this;if("create-features"!==ca?.type)return null;const W=ca.data.upload;return W?T.tsx(V,{heading:ja.createFeatures,key:"upload-details-panel"},T.tsx(A.UploadDetails,{helpMessage:this._helpMessage,messages:ja,upload:W})):null}_renderCreatingFeatures(){const {EditorPanel:V,activeWorkflow:ca, messages:ja,messagesCommon:W,headingLevel:Z,viewModel:ha}=this;return ca?T.tsx(V,{heading:ja.createFeatures,key:"create-features-panel"},"create-features"===ca.type&&0this._attachments.render(),renderFeatureForm:()=>this._featureForm.render(),onDelete:this._onDelete, onSave:this._onSave}):T.tsx(d.CreateFeaturesPanelContent,{helpMessage:this._helpMessage})):null}_renderUpdateFeature(){const {EditorPanel:V,messages:ca,messagesCommon:ja,headingLevel:W,viewModel:Z}=this;return T.tsx(V,{heading:ca.editFeature,key:"update-feature-panel"},T.tsx(D.UpdateFeaturePanelContent,{editorViewModel:Z,headingLevel:W,messages:ca,messagesCommon:ja,renderAttachments:()=>this._attachments.render(),renderFeatureForm:()=>this._featureForm.render(),onDelete:this._onDelete,onSave:this._onSave}))}_renderCustomTemplateGroupContent(V){const {messages:ca, viewModel:ja}=this;return(V=w.mappedFind(V.group.items,W=>ja.itemHasInvalidFormTemplate(W)?ca.formFieldCreateError:void 0))?T.tsx(t.Notice,{icon:N.warningIcon,message:V}):null}_renderAttachmentAdding(){const {EditorPanel:V,_attachments:ca,messages:ja,messagesCommon:W}=this;return T.tsx(V,{heading:ja.addAttachment,key:"attachment-adding-panel"},T.tsx(H.PanelContent,{key:"attachments"},ca.render()),T.tsx(O.FooterActions,{buttons:[{label:ca.submitting?W.cancel:W.add,disabled:ca.submitting||!ca.selectedFile, onClick:this._onAttachmentAdd}]}))}_renderAttachmentEditing(){const {EditorPanel:V,_attachments:ca,activeWorkflow:ja,messages:W,messagesCommon:Z}=this;return ja?T.tsx(V,{heading:W.editAttachment,key:"attachment-editing-panel"},T.tsx(H.PanelContent,{key:"attachments"},ca.render()),ja.shouldAllowAttachmentEditing?T.tsx(O.FooterActions,{buttons:[{label:Z.update,disabled:ca.submitting||!ca.selectedFile,onClick:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete, disabled:ca.submitting,label:Z.delete}]}):void 0):null}_renderReady(){const {EditorPanel:V,messages:ca,viewModel:ja,visibleElements:W}=this,Z=this._helpMessage;return T.tsx(V,{heading:ca.widgetLabel,key:"landing-panel"},T.tsx(H.PanelContent,{key:"landing-content"},ja.editorItems.length?[W.editFeaturesSection?T.tsx(H.PanelContentSection,{key:"edit-actions"},this._renderUpdateActions()):null,W.createFeaturesSection&&ja.canCreateVisible?T.tsx(H.PanelContentSection,{key:"create-actions"},this._renderCreateActions()): null]:T.tsx(H.PanelContentMessage,{key:"no-content"},ca.noEditableLayers)),Z?T.tsx("div",{class:B.css.helpMessage,key:"footer-actions",slot:"footer"},Z):void 0)}get _helpMessage(){const {activeWorkflow:V,messages:ca,view:ja}=this,W=V?.helpMessage;return W?ca["3d"===ja?.type?"helpMessages3d":"helpMessages2d"]?.[W]:void 0}_renderUpdateActions(){const {messages:V,messagesCommon:ca,viewModel:ja}=this,W={id:"select",label:ca.select};return T.tsx("div",{class:B.css.updateActions,key:"update-actions"},T.tsx(n.Heading, {level:n.incrementHeadingLevel(this.headingLevel)},V.editFeatures),T.tsx("calcite-list",{class:B.css.updateActionsList,selectionAppearance:"border",selectionMode:"single"},M.renderItem({disabled:!ja.canUpdateVisible,grouped:!1,item:W,selectedItem:"awaiting-feature-to-update"===ja.activeWorkflow?.stepId?W:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return T.tsx("div",{key:"create-actions"},T.tsx(n.Heading,{level:n.incrementHeadingLevel(this.headingLevel)}, this.messages.createFeatures),T.tsx("div",{class:B.css.featureTemplatesContainer,key:"templates"},this._featureTemplates.render()))}_renderFeatureList(){const {EditorPanel:V,viewModel:ca}=this,{activeWorkflow:ja}=ca;if("update"!==ja?.type)return null;const W=ea.substitute(this.messages.multipleFeaturesTemplate,{total:ja.data.candidates.length});return T.tsx(V,{heading:W,key:"feature-list"},T.tsx(v.FeatureList,{editorItems:ca.editorItems,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates, workflow:ja,onFilterTextChange:Z=>this._filterText=Z,onSelectFeature:(Z,ha)=>ca.selectFeature(Z,ha)}))}_showPromptAndWait({title:V,message:ca,yesLabel:ja,noLabel:W}){const Z=g.createResolver(),{view:ha}=this,Q=ha?.focused;this._showPrompt({title:V,message:ca,context:"danger",actions:{primary:{label:ja,action:()=>Z.resolve(!0)},secondary:{label:W,action:()=>Z.resolve(!1)}}});return Z.promise.finally(()=>{this._clearPrompt();Q&&ha?.focus()})}};b.__decorate([F.property()],c.prototype,"_featureForm", void 0);b.__decorate([F.property()],c.prototype,"_attachments",void 0);b.__decorate([F.property()],c.prototype,"_featureTemplates",void 0);b.__decorate([F.property()],c.prototype,"_filterText",void 0);b.__decorate([F.property()],c.prototype,"_prompt",void 0);b.__decorate([F.property()],c.prototype,"_spinner",void 0);b.__decorate([F.property()],c.prototype,"_deleteButtonCommonInfo",null);b.__decorate([F.property()],c.prototype,"_loading",null);b.__decorate([F.property({readOnly:!0})],c.prototype,"activeWorkflow", null);b.__decorate([F.property()],c.prototype,"allowedWorkflows",null);b.__decorate([F.property()],c.prototype,"headingLevel",void 0);b.__decorate([F.property()],c.prototype,"hideTemplatesForInactiveLayers",null);b.__decorate([F.property()],c.prototype,"icon",null);b.__decorate([F.property()],c.prototype,"label",null);b.__decorate([F.property()],c.prototype,"labelOptions",null);b.__decorate([F.property()],c.prototype,"layerInfos",null);b.__decorate([F.property(),L.messageBundle("esri/widgets/Editor/t9n/Editor")], c.prototype,"messages",void 0);b.__decorate([F.property(),L.messageBundle("esri/t9n/common")],c.prototype,"messagesCommon",void 0);b.__decorate([F.property(),L.messageBundle("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],c.prototype,"messagesTemplates",void 0);b.__decorate([F.property()],c.prototype,"snappingOptions",null);b.__decorate([F.property()],c.prototype,"tooltipOptions",null);b.__decorate([F.property()],c.prototype,"supportingWidgetDefaults",void 0);b.__decorate([F.property({type:r, nonNullable:!0})],c.prototype,"valueOptions",null);b.__decorate([F.property()],c.prototype,"view",null);b.__decorate([F.property(),S.vmEvent(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],c.prototype,"viewModel",void 0);b.__decorate([F.property({type:I,nonNullable:!0})],c.prototype,"visibleElements",void 0);b.__decorate([F.property()],c.prototype,"_helpMessage",null);return c=b.__decorate([l.subclass("esri.widgets.Editor")],c)});