@arcgis/core 4.30.1 → 4.30.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6107,9377,3069,9062],{70668:(e,t,r)=>{r.d(t,{A:()=>y});var i=r(90237),n=r(69540),o=r(25482),s=r(88930),l=r(10107),a=(r(44208),r(53966),r(87811),r(93223)),d=r(40608),u=r(73133);let p=class extends((0,n.O)(o.oY)){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return(0,s.t)(this.value,this.unit,"milliseconds")}};(0,i._)([(0,a.e)(u.j,{nonNullable:!0})],p.prototype,"unit",void 0),(0,i._)([(0,l.MZ)({type:Number,json:{write:!0},nonNullable:!0})],p.prototype,"value",void 0),p=(0,i._)([(0,d.$)("esri.TimeInterval")],p);const y=p},32587:(e,t,r)=>{r.d(t,{A:()=>o});var i=r(62788),n=r(95488);class o{constructor(e){this._observable=new n.I,this._map=new Map(e)}get size(){return(0,i.gc)(this._observable),this._map.size}clear(){this._map.size>0&&(this._map.clear(),this._observable.notify())}delete(e){const t=this._map.delete(e);return t&&this._observable.notify(),t}entries(){return(0,i.gc)(this._observable),this._map.entries()}forEach(e,t){(0,i.gc)(this._observable),this._map.forEach(((r,i)=>e.call(t,r,i,this)),t)}get(e){return(0,i.gc)(this._observable),this._map.get(e)}has(e){return(0,i.gc)(this._observable),this._map.has(e)}keys(){return(0,i.gc)(this._observable),this._map.keys()}set(e,t){return this._map.set(e,t),this._observable.notify(),this}values(){return(0,i.gc)(this._observable),this._map.values()}[Symbol.iterator](){return(0,i.gc)(this._observable),this._map[Symbol.iterator]()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}}},44794:(e,t,r)=>{r.d(t,{v:()=>l});var i=r(4718),n=r(62788),o=r(95488);class s{constructor(e,t){this._observable=new o.I,this._value=e,this._equalityFunction=t}get value(){return(0,n.gc)(this._observable),this._value}set value(e){this._equalityFunction(e,this._value)||(this._value=e,this._observable.notify())}mutate(e){e(this._value),this._observable.notify()}}function l(e,t=i.gh){return new s(e,t)}},39516:(e,t,r)=>{async function i(e,t){const{WhereClause:i}=await Promise.all([r.e(835),r.e(4800)]).then(r.bind(r,50835));return i.create(e,t)}function n(e,t){return"1=1"===e?t??e:"1=1"===t?e??t:null!=e&&""!==e?null!=t&&""!==t?`(${e}) AND (${t})`:e:t}r.d(t,{G:()=>i,m:()=>n})},3330:(e,t,r)=>{r.d(t,{GB:()=>n,Qo:()=>s,Y4:()=>o});var i=r(96285);class n{}function o(e){return e instanceof i.bo?e===n.instance:"unknown"===e?.toString().toLowerCase()}function s(e){return o(e)?n.instance:e}n.instance=new i.oh("Etc/UTC")},13069:(e,t,r)=>{r.d(t,{lk:()=>n,vD:()=>s,yS:()=>o});const i="randomUUID"in crypto;function n(){if(i)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint16Array(8));e[3]=4095&e[3]|16384,e[4]=16383&e[4]|32768;const t=t=>e[t].toString(16).padStart(4,"0");return t(0)+t(1)+"-"+t(2)+"-"+t(3)+"-"+t(4)+"-"+t(5)+t(6)+t(7)}function o(){return`{${n().toUpperCase()}}`}function s(){return`{${n()}}`}},70328:(e,t,r)=>{r.d(t,{BI:()=>f,Ej:()=>u,Hq:()=>d,Ie:()=>h,Jt:()=>m,Ne:()=>p,RF:()=>l,aI:()=>_,fA:()=>o,hZ:()=>c,iT:()=>a,is:()=>g,qv:()=>v,vI:()=>y,v_:()=>w,vt:()=>n,w1:()=>s});var i=r(5443);function n(e=w){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function o(e,t,r,i,o,s,l=n()){return l[0]=e,l[1]=t,l[2]=r,l[3]=i,l[4]=o,l[5]=s,l}function s(e,t){const r=isFinite(e[2])||isFinite(e[5]);return new i.A(r?{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],zmin:e[2],zmax:e[5],spatialReference:t}:{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],spatialReference:t})}function l(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[3]),e[4]=Math.max(e[4],t[4]),e[5]=Math.max(e[5],t[5])}function a(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[0]),e[4]=Math.max(e[4],t[1]),e[5]=Math.max(e[5],t[2])}function d(e,t,r=0,i=t.length/3){let n=e[0],o=e[1],s=e[2],l=e[3],a=e[4],d=e[5];for(let e=0;e<i;e++)n=Math.min(n,t[r+3*e]),o=Math.min(o,t[r+3*e+1]),s=Math.min(s,t[r+3*e+2]),l=Math.max(l,t[r+3*e]),a=Math.max(a,t[r+3*e+1]),d=Math.max(d,t[r+3*e+2]);e[0]=n,e[1]=o,e[2]=s,e[3]=l,e[4]=a,e[5]=d}function u(e,t=[0,0,0]){return t[0]=function(e){return e[0]>=e[3]?0:e[3]-e[0]}(e),t[1]=function(e){return e[1]>=e[4]?0:e[4]-e[1]}(e),t[2]=function(e){return e[2]>=e[5]?0:e[5]-e[2]}(e),t}function p(e,t,r=e){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r!==e&&(r[3]=e[3],r[4]=e[4],r[5]=e[5]),r}function y(e,t,r=e){return r[3]=t[0],r[4]=t[1],r[5]=t[2],r!==e&&(r[0]=e[0],r[1]=e[1],r[2]=e[2]),e}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function h(e){return e?c(e,v):n(v)}function m(e,t){return e[0]=t[0],e[1]=t[1],e[2]=Number.NEGATIVE_INFINITY,e[3]=t[2],e[4]=t[3],e[5]=Number.POSITIVE_INFINITY,e}function f(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=Number.NEGATIVE_INFINITY,e[3]=i,e[4]=n,e[5]=Number.POSITIVE_INFINITY,e}function g(e){return 6===e.length}function _(e,t,r){if(null==e||null==t)return e===t;if(!g(e)||!g(t))return!1;if(r){for(let i=0;i<e.length;i++)if(!r(e[i],t[i]))return!1}else for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}r(19419);const v=[1/0,1/0,1/0,-1/0,-1/0,-1/0],w=[0,0,0,0,0,0];n()},79003:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ye});var i=r(90237),n=r(78888),o=r(5503),s=r(49186),l=r(91869),a=r(92071),d=r(74887),u=r(84952),p=r(10107),y=(r(44208),r(53966),r(87811),r(40608)),c=r(4146),h=r(36563),m=r(55359),f=r(32587),g=r(36708),_=r(44794),v=r(56507),w=r(63074),b=r(25036),M=r(10873),F=r(91880),x=r(1873);let Z=class extends((0,b.j)((0,w.dM)((0,a.P)(c.A)))){constructor(e){super(e),this._layerCache=new m.q(20,(e=>e.destroy())),this._oidToReference=new f.A,this._layerToReference=new Map,this.layers=new o.A,this.maximumVisibleSublayers=10,this.opacity=1,this.parent=null,this.persistenceEnabled=!0,this.title="Layers in view",this.type="catalog-dynamic-group",this.visible=!0}initialize(){this.addHandles([this.layers.on("after-add",(({item:e})=>{e.parent=this})),this.layers.on("after-remove",(({item:e})=>{e.parent=null})),(0,g.wB)((()=>this._orderBy),(()=>{this._updateLayerSortValues(),this._sortAllLayers()}))])}load(e){return this.addResolvingPromise(this.parent.load()),Promise.resolve(this)}destroy(){this._layerCache.destroy(),this._oidToReference.clear(),this._layerToReference.clear()}get _orderBy(){return this.parent?this.parent.orderBy?.find((e=>!e.valueExpression&&e.field))??new F.A({field:this.parent.objectIdField}):null}get _referenceComparator(){const e=this._orderBy;if(!this.parent||!e)return()=>0;const t=this.parent.fieldsIndex.get(e.field),r=(0,x.FM)(t?.toJSON().type,"descending"===e.order),i=(0,x.FM)("esriFieldTypeOID","descending"===e.order);return(e,t)=>r(t.sortValue,e.sortValue)||i(t.objectId,e.objectId)}get fullExtent(){return this.parent?.fullExtent??null}get updating(){return(0,l.Bs)(this._oidToReference,(e=>null!=e.pending))}acquireLayer(e){if(this.destroyed)return(0,h.hA)();const t=this._getLayerReference(e);return t.count++,(0,h.hA)((()=>{t.count--,t.count||this._destroyLayerReference(t)}))}_getLayerReference(e){const t=e.getObjectId();return(0,l.tE)(this._oidToReference,t,(()=>{const t=e.getObjectId(),r=`${t}`,i=e.getAttribute(this.parent.itemSourceField),n=new T(e,t,i),o=this._layerCache.pop(r);return o?(this._addLayer(n,o),n):(n.pending=this.parent.createLayerFromFootprint(e).then((e=>{n.count?this._addLayer(n,e):(this.destroyed||this._layerCache.get(r)||this._layerCache.put(r,e),n.layer=null)})).catch((()=>{})).finally((()=>{n.pending=null})),n)}))}_destroyLayerReference(e){e.layer&&(this._layerToReference.delete(e.layer),this.layers.remove(e.layer),this.destroyed?e.layer.destroy():this._layerCache.put(`${e.objectId}`,e.layer),e.layer=null),this._oidToReference.delete(e.objectId)}_addLayer(e,t){e.layer=t,t.persistenceEnabled=!1,this._layerToReference.set(t,e),this._updateLayerSortValue(e),this.layers.add(t),this._sortAllLayers()}_updateLayerSortValues(){for(const e of this._layerToReference.values())this._updateLayerSortValue(e)}_updateLayerSortValue(e){this._orderBy&&(e.sortValue=e.footprint.getAttribute(this._orderBy.field))}_sortAllLayers(){this.layers.sort(((e,t)=>this._referenceComparator(this._layerToReference.get(e),this._layerToReference.get(t))))}};(0,i._)([(0,p.MZ)()],Z.prototype,"_orderBy",null),(0,i._)([(0,p.MZ)({readOnly:!0})],Z.prototype,"_referenceComparator",null),(0,i._)([(0,p.MZ)({type:["show","hide","hide-children"],json:{write:!0}})],Z.prototype,"listMode",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],Z.prototype,"fullExtent",null),(0,i._)([(0,p.MZ)({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Z.prototype,"id",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],Z.prototype,"layers",void 0),(0,i._)([(0,p.MZ)({type:v.jz,range:{min:0,max:50},json:{write:!0,default:10}})],Z.prototype,"maximumVisibleSublayers",void 0),(0,i._)([(0,p.MZ)(M.ke)],Z.prototype,"opacity",void 0),(0,i._)([(0,p.MZ)({clonable:!1})],Z.prototype,"parent",void 0),(0,i._)([(0,p.MZ)({type:String,nonNullable:!0,json:{write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"title",void 0),(0,i._)([(0,p.MZ)({json:{read:!1}})],Z.prototype,"type",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],Z.prototype,"updating",null),(0,i._)([(0,p.MZ)({type:Boolean,json:{name:"visibility",write:!0}})],Z.prototype,"visible",void 0),Z=(0,i._)([(0,y.$)("esri.layers.catalog.CatalogDynamicGroupLayer")],Z);const I=Z;class T{constructor(e,t,r){this.footprint=e,this.objectId=t,this.itemSource=r,this.count=0,this.layer=null,this.sortValue=void 0,this._pending=(0,_.v)(null)}get pending(){return this._pending.value}set pending(e){this._pending.value=e}}var S=r(13874),O=(r(86162),r(94409),r(65345),r(42980),r(39290),r(92438),r(96576)),j=(r(93618),r(65494),r(15036)),E=r(4718),A=r(35666),R=r(4206),N=r(87718),L=r(30524),V=r(81457),D=r(39383),P=r(30291),B=r(94985);let q=class extends((0,b.j)((0,N.F)((0,w.dM)((0,a.P)(c.A))))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.elevationInfo=null,this.formTemplate=null,this.labelingInfo=null,this.labelsVisible=!0,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.opacity=1,this.parent=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.title="Footprints",this.type="catalog-footprint",this.visible=!0}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){await this.parent.load(e),(0,L.yp)(this.renderer,this.fieldsIndex),this.addHandles([this.parent.on("apply-edits",(e=>this.emit("apply-edits",e))),this.parent.on("edits",(e=>this.emit("edits",e))),this.parent.on("refresh",(e=>this.emit("refresh",e)))])}get apiKey(){return this.parent?.apiKey}get capabilities(){return this.parent?.capabilities}get customParameters(){return this.parent?.customParameters}get dateFieldsTimeZone(){return this.parent?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this.parent?.datesInUnknownTimezone??!1}get definitionExpression(){return this.parent?.definitionExpression}get editingInfo(){return this.parent?.editingInfo}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get createQueryVersion(){return this.parent?.createQueryVersion}get defaultPopupTemplate(){return this.createPopupTemplate()}get displayField(){return this.parent?.displayField}get effectiveEditingEnabled(){return!1}get fields(){return this.parent?.fields}get fieldsIndex(){return this.parent?.fieldsIndex}get fullExtent(){return this.parent?.fullExtent}get geometryFieldsInfo(){return this.parent?.geometryFieldsInfo}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?.globalIdField}get hasM(){return this.parent?.hasM??!1}get hasZ(){return this.parent?.hasZ??!1}get objectIdField(){return this.parent?.objectIdField}get orderBy(){return this.parent?.orderBy??null}get outFields(){return this.parent?.outFields}get parsedUrl(){return this.parent?.parsedUrl??null}get preferredTimeZone(){return this.parent?.preferredTimeZone??null}set renderer(e){(0,L.yp)(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){return this._isOverridden("renderer")?this._get("renderer"):function(){const e=new B.A({style:"solid",color:[0,0,0,0],outline:{style:"solid",color:[96,96,96,.75],width:.75}});return new O.A({symbol:e})}()}get returnM(){return this.parent?.returnM}get returnZ(){return this.parent?.returnZ}get source(){return this.parent?.source}get timeExtent(){return this.parent?.timeExtent}get timeInfo(){return this.parent?.timeInfo}get timeOffset(){return this.parent?.timeOffset}get typeIdField(){return this.parent?.typeIdField}get types(){return this.parent?.types}get useViewTime(){return this.parent?.useViewTime??!0}get version(){return this.parent?.version}async applyEdits(e,t){return await this.load(),this.parent.applyEdits(e,t)}createPopupTemplate(e){const t={fields:this.fields,objectIdField:this.objectIdField,title:this.title};return(0,P.tn)(t,e)}createQuery(){return this.parent?.createQuery()}getField(e){return this.parent?.getField(e)}getFieldDomain(e,t){return this.parent?.getFieldDomain(e,t)}async queryExtent(e,t){return await this.load(),this.parent.queryExtent(e,t)}async queryFeatures(e,t){return await this.load(),this.parent.queryFeatures(e,t)}async queryFeatureCount(e,t){return await this.load(),this.parent.queryFeatureCount(e,t)}async queryObjectIds(e,t){return await this.load(),this.parent.queryObjectIds(e,t)}};(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"apiKey",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"capabilities",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"customParameters",null),(0,i._)([(0,p.MZ)()],q.prototype,"dateFieldsTimeZone",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"datesInUnknownTimezone",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"definitionExpression",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"editingInfo",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"effectiveCapabilities",null),(0,i._)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],q.prototype,"charts",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"createQueryVersion",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"defaultPopupTemplate",null),(0,i._)([(0,p.MZ)()],q.prototype,"displayField",null),(0,i._)([(0,p.MZ)({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],q.prototype,"editingEnabled",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"effectiveEditingEnabled",null),(0,i._)([(0,p.MZ)((()=>{const e=(0,E.o8)(M.Yj);return e.json.origins["web-map"]={read:!1,write:!1},e})())],q.prototype,"elevationInfo",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"fields",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"fieldsIndex",null),(0,i._)([(0,p.MZ)({type:R.A,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],q.prototype,"formTemplate",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"fullExtent",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"geometryFieldsInfo",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"geometryType",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"globalIdField",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"hasM",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"hasZ",null),(0,i._)([(0,p.MZ)({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],q.prototype,"id",void 0),(0,i._)([(0,p.MZ)({type:[V.A],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:D.w,write:!0}})],q.prototype,"labelingInfo",void 0),(0,i._)([(0,p.MZ)(M.kF)],q.prototype,"labelsVisible",void 0),(0,i._)([(0,p.MZ)(M.fV)],q.prototype,"legendEnabled",void 0),(0,i._)([(0,p.MZ)({type:["show","hide"],json:{write:!0}})],q.prototype,"listMode",void 0),(0,i._)([(0,p.MZ)((()=>{const e=(0,E.o8)(M.hG);return e.json.origins.service.read=!1,e})())],q.prototype,"maxScale",void 0),(0,i._)([(0,p.MZ)((()=>{const e=(0,E.o8)(M.hn);return e.json.origins.service.read=!1,e})())],q.prototype,"minScale",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"objectIdField",null),(0,i._)([(0,p.MZ)(M.ke)],q.prototype,"opacity",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"orderBy",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"outFields",null),(0,i._)([(0,p.MZ)({clonable:!1})],q.prototype,"parent",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"parsedUrl",null),(0,i._)([(0,p.MZ)(M.M6)],q.prototype,"popupEnabled",void 0),(0,i._)([(0,p.MZ)({type:S.A,json:{name:"popupInfo",write:!0}})],q.prototype,"popupTemplate",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"preferredTimeZone",null),(0,i._)([(0,p.MZ)({types:j.H,json:{origins:{"web-scene":{types:j.X}},name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(e,t){return{ignoreOrigin:this.originIdOf(t)<A.Gr.PORTAL_ITEM}}}}})],q.prototype,"renderer",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"returnM",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"returnZ",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"source",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"timeExtent",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"timeInfo",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"timeOffset",null),(0,i._)([(0,p.MZ)({type:String,nonNullable:!0,json:{write:{ignoreOrigin:!0,isRequired:!0}}})],q.prototype,"title",void 0),(0,i._)([(0,p.MZ)({json:{read:!1}})],q.prototype,"type",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"typeIdField",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"types",null),(0,i._)([(0,p.MZ)({readOnly:!0})],q.prototype,"useViewTime",null),(0,i._)([(0,p.MZ)({type:Boolean,json:{name:"visibility",write:!0}})],q.prototype,"visible",void 0),q=(0,i._)([(0,y.$)("esri.layers.catalog.CatalogFootprintLayer")],q);const $=q;var U=r(72593),C=r(52136),G=r(18768),J=r(69208),z=r(47685),k=r(87796),Q=r(16131),Y=r(32756),K=r(8303),H=r(54310),X=r(82935),W=r(15426),ee=r(33143),te=r(17036),re=r(4513),ie=r(91908),ne=r(20655),oe=r(80812),se=r(39131),le=r(61956);const ae=(0,te.p)();function de(e,t,r,i){const n=e.write({},i);(function(e){if(null==e)return!0;const t=Object.keys(e);return!t.length||1===t.length&&"id"===t[0]})(n)||(t[r]=n)}let ue=class extends((0,k.j)((0,z.w6)((0,w.dM)((0,Y.f)((0,X.e)((0,b.j)((0,H.J)((0,G.b)((0,Q.q)((0,K.A)((0,a.P)((0,J.d)((0,C.p)(c.A)))))))))))))){constructor(e){super(e),this._portals=new Map,this._layerToFootprint=new WeakMap,this.drawOrderField="cd_draworder",this.dynamicGroupLayer=new I({parent:this}),this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.footprintLayer=new $({parent:this}),this.itemNameField="cd_itemname",this.itemSourceField="cd_itemsource",this.itemTypeField="cd_itemtype",this.layers=new o.A([this.dynamicGroupLayer,this.footprintLayer]),this.maxScaleField="cd_maxscale",this.minScaleField="cd_minscale",this.orderBy=null,this.outFields=null,this.supportedSourceTypes=new Set(["Catalog Layer"]),this.source=new U.default({layer:this,supportedSourceTypes:this.supportedSourceTypes}),this.type="catalog",this.typeIdField=null,this.types=null}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(d.QP).then((async()=>{const{url:e,source:r,portalItem:i}=this;if(!e)throw new s.A("catalog-layer:missing-url","Catalog layer must be created with a url");if(null==this.layerId){const r=await this._fetchFirstValidLayerId(t);if(null==r)throw new s.A("catalog-layer:missing-layerId","There is no Catalog Layer in the service",{service:e});this.layerId=r}await r.load({signal:t});const{sourceJSON:n}=r;n&&(this.sourceJSON=n,this.read(n,{origin:"service",portalItem:i,portal:i?.portal,url:this.parsedUrl}))})).then((()=>{const e=[this.itemNameField,this.itemSourceField,this.itemTypeField,this.minScaleField,this.maxScaleField],t=e.filter((e=>!this.fieldsIndex.has(e)));if(t.length)throw new s.A("catalog-layer:missing-fields","There are missing fields to operate properly",{requiredFields:e,missingFields:t})})).then((()=>(0,W.VA)(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}destroy(){this.footprintLayer.destroy(),this.dynamicGroupLayer.destroy();for(const e of this._portals.values())e.destroy();this._portals.clear()}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return!1}get parsedUrl(){const e=(0,u.An)(this.url);return null!=e&&null!=this.layerId&&(e.path=(0,u.fj)(e.path,this.layerId.toString())),e}async applyEdits(e,t){return(0,W.ct)(this,e,t)}on(e,t){return super.on(e,t)}async createLayerFromFootprint(e){const t=await this._createLayer(e);return this._configureLayer(t,e),this._layerToFootprint.set(t,e),t}createFootprintFromLayer(e){return this._layerToFootprint.get(e)?.clone()}createQuery(){const e=new le.A,t=this.capabilities?.query;e.returnGeometry=!0,t&&(e.compactGeometryEnabled=t.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=t.supportsDefaultSpatialReference),e.outFields=["*"];const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e.where=this.definitionExpression||"1=1",e}getFeatureType(e){return(0,W.xd)(this.types,this.typeIdField,e)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=t?.feature,i=this.getFeatureType(r);if(i){const t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this.getField(e)?.domain}async hasDataChanged(){return(0,W.jp)(this)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(le.A.from(e)??r.createQuery(),t);if(i?.features)for(const e of i.features)e.layer=e.sourceLayer=r.footprintLayer;return i}async queryObjectIds(e,t){return(await this.load()).source.queryObjectIds(le.A.from(e)??this.createQuery(),t)}async queryFeatureCount(e,t){return(await this.load()).source.queryFeatureCount(le.A.from(e)??this.createQuery(),t)}async queryExtent(e,t){return(await this.load()).source.queryExtent(le.A.from(e)??this.createQuery(),t)}serviceSupportsSpatialReference(e){return this.loaded&&(0,ie.D)(this,e)}read(e,t){if(super.read(e,t),e){const{footprintLayer:r,dynamicGroupLayer:i}=e;r&&this.footprintLayer.read(r,t),i&&this.dynamicGroupLayer.read(i,t)}}async _fetchFirstValidLayerId(e){const{data:t}=await(0,n.A)(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(Array.isArray(t?.layers))return t.layers.find((({type:e})=>this.supportedSourceTypes.has(e)))?.id}async _createLayer(e){const t=e.getAttribute(this.itemSourceField);if(!t)throw new s.A("catalog-layer:item-source-missing",`The footprint is missing the "${this.itemSourceField}" attribute`);const r=JSON.parse(t);if(function(e){return"object"==typeof e&&null!=e&&"itemId"in e&&"portalUrl"in e}(r)){const{itemId:e,portalUrl:t}=r,i=(0,se.qG)(t),n=this.portalItem?.portal,o=ne.A.getDefault();let s,a=!0;n&&(0,u.ut)(t,n.url)?s=n:(0,u.ut)(t,o.url)?s=o:(s=(0,l.tE)(this._portals,i,(()=>new ne.A({url:i}))),a=!1);const d=await c.A.fromPortalItem(new oe.default({id:e,portal:s}));return a||await pe(d),d}return function(e){return"object"==typeof e&&null!=e&&"url"in e}(r)?c.A.fromArcGISServerUrl({url:r.url}):new(await re.S.UnsupportedLayer())}_configureLayer(e,t){const r=t.getAttribute(this.itemNameField);r&&(e.title=r);const i=t.getAttribute(this.maxScaleField);null!=i&&"maxScale"in e&&(e.maxScale=i);const n=t.getAttribute(this.minScaleField);null!=n&&"minScale"in e&&(e.minScale=n)}};async function pe(e){if("portalItem"in e&&e.portalItem){try{await e.load()}catch{}e.portalItem=null,"group"===e.type&&await Promise.allSettled([...e.layers.map((e=>pe(e))),...e.tables.map((e=>pe(e)))])}}(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"createQueryVersion",null),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"drawOrderField",void 0),(0,i._)([(0,p.MZ)({type:I,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:de}}})],ue.prototype,"dynamicGroupLayer",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"editingEnabled",null),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"effectiveEditingEnabled",null),(0,i._)([(0,p.MZ)({json:{origins:{"web-scene":{name:"layerDefinition.elevationInfo",read:!1,write:!1}}}})],ue.prototype,"elevationInfo",void 0),(0,i._)([(0,p.MZ)({...ae.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ue.prototype,"fields",void 0),(0,i._)([(0,p.MZ)(ae.fieldsIndex)],ue.prototype,"fieldsIndex",void 0),(0,i._)([(0,p.MZ)({json:{origins:{"web-scene":{name:"layerDefinition.floorInfo",read:!1,write:!1}}}})],ue.prototype,"floorInfo",void 0),(0,i._)([(0,p.MZ)({type:$,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:de}}})],ue.prototype,"footprintLayer",void 0),(0,i._)([(0,p.MZ)(M.id)],ue.prototype,"id",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"itemNameField",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"itemSourceField",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"itemTypeField",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"layers",void 0),(0,i._)([(0,p.MZ)({type:["show","hide","hide-children"]})],ue.prototype,"listMode",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"maxScaleField",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"minScaleField",void 0),(0,i._)([(0,p.MZ)({value:"CatalogLayer",type:["CatalogLayer"]})],ue.prototype,"operationalLayerType",void 0),(0,i._)([(0,p.MZ)({json:{origins:{"web-scene":{name:"layerDefinition.orderBy",write:!0,read:!0}}}})],ue.prototype,"orderBy",void 0),(0,i._)([(0,p.MZ)(ae.outFields)],ue.prototype,"outFields",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"parsedUrl",null),(0,i._)([(0,p.MZ)({readOnly:!0})],ue.prototype,"source",void 0),(0,i._)([(0,p.MZ)({json:{read:!1}})],ue.prototype,"type",void 0),(0,i._)([(0,p.MZ)({type:String})],ue.prototype,"typeIdField",void 0),(0,i._)([(0,p.MZ)({type:[ee.A]})],ue.prototype,"types",void 0),ue=(0,i._)([(0,y.$)("esri.layers.CatalogLayer")],ue);const ye=ue},87718:(e,t,r)=>{r.d(t,{F:()=>T,Y:()=>I});var i,n=r(90237),o=r(10107),s=(r(44208),r(53966),r(87811),r(40608)),l=r(49186),a=r(25482),d=r(93637),u=r(76369),p=r(59456),y=r(60945),c=r(66552),h=r(4718),m=r(61956);const f=new c.J({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),g=new c.J({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let _=i=class extends a.oY{constructor(e){super(e),this.where=null,this.geometry=null,this.spatialRelationship="intersects",this.distance=void 0,this.objectIds=null,this.units=null,this.timeExtent=null}createQuery(e={}){const{where:t,geometry:r,spatialRelationship:i,timeExtent:n,objectIds:o,units:s,distance:l}=this;return new m.A({geometry:(0,h.o8)(r),objectIds:(0,h.o8)(o),spatialRelationship:i,timeExtent:(0,h.o8)(n),where:t,units:s,distance:l,...e})}clone(){const{where:e,geometry:t,spatialRelationship:r,timeExtent:n,objectIds:o,units:s,distance:l}=this;return new i({geometry:(0,h.o8)(t),objectIds:(0,h.o8)(o),spatialRelationship:r,timeExtent:(0,h.o8)(n),where:e,units:s,distance:l})}};(0,n._)([(0,o.MZ)({type:String,json:{write:!0}})],_.prototype,"where",void 0),(0,n._)([(0,o.MZ)({types:p.yR,json:{write:!0}})],_.prototype,"geometry",void 0),(0,n._)([(0,o.MZ)({type:f.apiValues,json:{name:"spatialRel",read:{reader:f.read},write:{allowNull:!1,writer:f.write,overridePolicy(){return{enabled:null!=this.geometry}}}}})],_.prototype,"spatialRelationship",void 0),(0,n._)([(0,o.MZ)({type:Number,json:{write:{overridePolicy(e){return{enabled:null!=e&&null!=this.geometry}}}}})],_.prototype,"distance",void 0),(0,n._)([(0,o.MZ)({type:[Number],json:{write:!0}})],_.prototype,"objectIds",void 0),(0,n._)([(0,o.MZ)({type:g.apiValues,json:{read:g.read,write:{writer:g.write,overridePolicy(e){return{enabled:null!=e&&null!=this.geometry}}}}})],_.prototype,"units",void 0),(0,n._)([(0,o.MZ)({type:y.A,json:{write:!0}})],_.prototype,"timeExtent",void 0),_=i=(0,n._)([(0,s.$)("esri.layers.support.FeatureFilter")],_);const v=_;var w;const b={read:{reader:u.LF},write:{writer:u.M9,overridePolicy(){return{allowNull:null!=this.excludedEffect,isRequired:null==this.excludedEffect}}}},M={read:{reader:u.LF},write:{writer:u.M9,overridePolicy(){return{allowNull:null!=this.includedEffect,isRequired:null==this.includedEffect}}}},F={name:"showExcludedLabels",default:!0};let x=w=class extends a.oY{constructor(e){super(e),this.filter=null,this.includedEffect=null,this.excludedEffect=null,this.excludedLabelsVisible=!1}write(e,t){const r=super.write(e,t);if(t?.origin){if(r.filter){const e=Object.keys(r.filter);if(e.length>1||"where"!==e[0])return t.messages?.push(new l.A("web-document-write:unsupported-feature-effect","Invalid feature effect 'filter'. A filter can only contain a 'where' property",{layer:t.layer,effect:this})),null}if("showExcludedLabels"in r)return t.messages?.push(new l.A("web-document-write:unsupported-feature-effect","Invalid value for property 'excludedLabelsVisible' which should always be 'true'",{layer:t.layer,effect:this})),null}return r}clone(){return new w({filter:null!=this.filter?this.filter.clone():null,includedEffect:this.includedEffect,excludedEffect:this.excludedEffect,excludedLabelsVisible:this.excludedLabelsVisible})}};(0,n._)([(0,o.MZ)({type:v,json:{write:{allowNull:!0,writer(e,t,r,i){const n=e?.write({},i);n&&0!==Object.keys(n).length?(0,d.sM)(r,n,t):(0,d.sM)(r,null,t)}}}})],x.prototype,"filter",void 0),(0,n._)([(0,o.MZ)({json:{read:u.LF,write:{writer:u.M9,allowNull:!0},origins:{"web-map":b,"portal-item":b}}})],x.prototype,"includedEffect",void 0),(0,n._)([(0,o.MZ)({json:{read:u.LF,write:{writer:u.M9,allowNull:!0},origins:{"web-map":M,"portal-item":M}}})],x.prototype,"excludedEffect",void 0),(0,n._)([(0,o.MZ)({type:Boolean,json:{write:!0,name:"showExcludedLabels",origins:{"web-map":F,"portal-item":F}}})],x.prototype,"excludedLabelsVisible",void 0),x=w=(0,n._)([(0,s.$)("esri.layers.support.FeatureEffect")],x);const Z={write:{allowNull:!0}},I={type:x,json:{origins:{"web-map":Z,"portal-item":Z}}},T=e=>{let t=class extends e{constructor(){super(...arguments),this.featureEffect=null}};return(0,n._)([(0,o.MZ)(I)],t.prototype,"featureEffect",void 0),t=(0,n._)([(0,s.$)("esri.layers.mixins.FeatureEffectLayer")],t),t}},32756:(e,t,r)=>{r.d(t,{f:()=>d,n:()=>a});var i=r(90237),n=r(93637),o=r(10107),s=(r(44208),r(53966),r(87811),r(40608)),l=r(91880);const a={type:[l.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:function(e,t,r){if(!e)return null;const i=e.find((e=>!!e.field));if(!i)return null;const n=new l.A;return n.read(i,r),[n]}},write:{writer:function(e,t,r,i){const o=e.find((e=>!!e.field));o&&(0,n.sM)(r,[o.toJSON()],t)}}}},d=e=>{let t=class extends e{constructor(){super(...arguments),this.orderBy=null}};return(0,i._)([(0,o.MZ)(a)],t.prototype,"orderBy",void 0),t=(0,i._)([(0,s.$)("esri.layers.mixins.OrderedLayer")],t),t}},82935:(e,t,r)=>{r.d(t,{B:()=>c,e:()=>h});var i=r(90237),n=r(60945),o=r(70668),s=r(10107),l=(r(44208),r(53966),r(87811),r(36005)),a=r(40608),d=r(89317),u=r(30524),p=r(96184),y=r(73133);const c={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation",layerContainerTypes:d.K}}},h=e=>{let t=class extends e{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(e,t){const r=t.timeInfo.exportOptions;if(!r)return null;const i=r.timeOffset,n=y.j.fromJSON(r.timeOffsetUnits);return i&&n?new o.A({value:i,unit:n}):null}set timeInfo(e){(0,u.sv)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i._)([(0,s.MZ)({type:n.A,json:{write:!1}})],t.prototype,"timeExtent",void 0),(0,i._)([(0,s.MZ)({type:o.A})],t.prototype,"timeOffset",void 0),(0,i._)([(0,l.w)("service","timeOffset",["timeInfo.exportOptions"])],t.prototype,"readOffset",null),(0,i._)([(0,s.MZ)({value:null,type:p.A,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],t.prototype,"timeInfo",null),(0,i._)([(0,s.MZ)(c)],t.prototype,"useViewTime",void 0),t=(0,i._)([(0,a.$)("esri.layers.mixins.TemporalLayer")],t),t}},33143:(e,t,r)=>{r.d(t,{A:()=>c});var i=r(90237),n=r(69540),o=r(25482),s=r(10107),l=(r(44208),r(53966),r(87811),r(36005)),a=r(40608),d=r(43937),u=r(72088),p=r(29005);let y=class extends((0,n.O)(o.oY)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const r of Object.keys(e))t[r]=(0,u.rS)(e[r]);return t}writeDomains(e,t){const r={};for(const t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,i._)([(0,s.MZ)({json:{write:!0}})],y.prototype,"id",void 0),(0,i._)([(0,s.MZ)({json:{write:!0}})],y.prototype,"name",void 0),(0,i._)([(0,s.MZ)({json:{write:!0}})],y.prototype,"domains",void 0),(0,i._)([(0,l.w)("domains")],y.prototype,"readDomains",null),(0,i._)([(0,d.K)("domains")],y.prototype,"writeDomains",null),(0,i._)([(0,s.MZ)({type:[p.A],json:{write:!0}})],y.prototype,"templates",void 0),y=(0,i._)([(0,a.$)("esri.layers.support.FeatureType")],y);const c=y},20437:(e,t,r)=>{r.d(t,{A:()=>f});var i,n=r(90237),o=r(66552),s=r(25482),l=r(10107),a=r(56507),d=(r(87811),r(44208),r(93223)),u=r(36005),p=r(40608),y=r(72088),c=r(98453);const h=new o.J({binary:"binary",coordinate:"coordinate",countOrAmount:"count-or-amount",dateAndTime:"date-and-time",description:"description",locationOrPlaceName:"location-or-place-name",measurement:"measurement",nameOrTitle:"name-or-title",none:"none",orderedOrRanked:"ordered-or-ranked",percentageOrRatio:"percentage-or-ratio",typeOrCategory:"type-or-category",uniqueIdentifier:"unique-identifier"});let m=i=class extends s.oY{constructor(e){super(e),this.alias=null,this.defaultValue=void 0,this.description=null,this.domain=null,this.editable=!0,this.length=void 0,this.name=null,this.nullable=!0,this.type=null,this.valueType=null,this.visible=!0}readDescription(e,{description:t}){let r=null;try{r=t?JSON.parse(t):null}catch(e){}return r?.value??null}readValueType(e,{description:t}){let r=null;try{r=t?JSON.parse(t):null}catch(e){}return r?h.fromJSON(r.fieldValueType):null}clone(){return new i({alias:this.alias,defaultValue:this.defaultValue,description:this.description,domain:this.domain?.clone()??null,editable:this.editable,length:this.length,name:this.name,nullable:this.nullable,type:this.type,valueType:this.valueType,visible:this.visible})}};(0,n._)([(0,l.MZ)({type:String,json:{write:!0}})],m.prototype,"alias",void 0),(0,n._)([(0,l.MZ)({type:[String,Number],json:{write:{allowNull:!0}}})],m.prototype,"defaultValue",void 0),(0,n._)([(0,l.MZ)()],m.prototype,"description",void 0),(0,n._)([(0,u.w)("description")],m.prototype,"readDescription",null),(0,n._)([(0,l.MZ)({types:y.gK,json:{read:{reader:y.rS},write:!0}})],m.prototype,"domain",void 0),(0,n._)([(0,l.MZ)({type:Boolean,json:{write:!0}})],m.prototype,"editable",void 0),(0,n._)([(0,l.MZ)({type:a.jz,json:{write:{overridePolicy:e=>({enabled:Number.isFinite(e)})}}})],m.prototype,"length",void 0),(0,n._)([(0,l.MZ)({type:String,json:{write:!0}})],m.prototype,"name",void 0),(0,n._)([(0,l.MZ)({type:Boolean,json:{write:!0}})],m.prototype,"nullable",void 0),(0,n._)([(0,d.e)(c.m)],m.prototype,"type",void 0),(0,n._)([(0,l.MZ)()],m.prototype,"valueType",void 0),(0,n._)([(0,u.w)("valueType",["description"])],m.prototype,"readValueType",null),(0,n._)([(0,l.MZ)({type:Boolean,json:{read:!1}})],m.prototype,"visible",void 0),m=i=(0,n._)([(0,p.$)("esri.layers.support.Field")],m);const f=m},95466:(e,t,r)=>{r.d(t,{A:()=>y});var i=r(49186),n=r(25482),o=r(53966),s=r(91869),l=r(3330),a=r(30524),d=r(56400),u=r(96285);const p=new Map;class y{static fromJSON(e){return new y(e.fields,e.timeZoneByFieldName)}static fromLayer(e){return new y(e.fields??[],f(e))}static fromLayerJSON(e){return new y(e.fields??[],f(e))}constructor(e=[],t){this._fieldsMap=new Map,this._normalizedFieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this._requiredFields=null,this.dateFields=[],this.numericFields=[],this.fields=e||[],this._timeZoneByFieldName=t?new Map(t):null;const r=[];for(const e of this.fields){const t=e?.name,i=h(t);if(t&&i){const n=c(t);this._fieldsMap.set(t,e),this._fieldsMap.set(n,e),this._normalizedFieldsMap.set(i,e),r.push(`${n}:${e.type}:${this._timeZoneByFieldName?.get(t)}`),(0,a.vE)(e)?(this.dateFields.push(e),this._dateFieldsSet.add(e)):(0,a.WA)(e)&&(this._numericFieldsSet.add(e),this.numericFields.push(e)),(0,a.te)(e)||(0,a.Xz)(e)||(e.editable=null==e.editable||!!e.editable,e.nullable=null==e.nullable||!!e.nullable)}}r.sort(),this.uid=r.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)(0,a.te)(e)||(0,a.Xz)(e)||e.nullable||void 0!==(0,a.lD)(e)||this._requiredFields.push(e)}return this._requiredFields}equals(e){return this.uid===e?.uid}has(e){return null!=this.get(e)}get(e){if(!e)return;let t=this._fieldsMap.get(e);return t||(t=this._fieldsMap.get(c(e))??this._normalizedFieldsMap.get(h(e)),t&&this._fieldsMap.set(e,t),t)}getTimeZone(e){const t=this.get(e&&"string"!=typeof e?e.name:e);return t?this._timeZoneByFieldName?this._timeZoneByFieldName.get(t.name):"date"===t.type||"esriFieldTypeDate"===t.type?(o.A.getLogger("esri.layers.support.FieldsIndex").error(new i.A("getTimeZone:no-timezone-information",`no time zone information for field '${t.name}'`)),d.n$):m.has(t.type)?d.L5:null:null}getLuxonTimeZone(e){const t=this.getTimeZone(e);return t?t===d.L5?l.GB.instance:t===d.n$?u.mQ.utcInstance:(0,s.tE)(p,t,(()=>u.oh.create(t))):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return(0,a.OH)(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){return this.get(e)?.name??void 0}toJSON(){return{fields:this.fields.map((e=>(0,n.Wj)(e)?e.toJSON():e)),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}function c(e){return e.trim().toLowerCase()}function h(e){return(0,a.rS)(e)?.toLowerCase()??""}const m=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function f(e){const t=new Map;if(!e.fields)return t;const r=!0===e.datesInUnknownTimezone,{timeInfo:i,editFieldsInfo:n}=e,o=(i?"startField"in i?i.startField:i.startTimeField:"")??"",s=(i?"endField"in i?i.endField:i.endTimeField:"")??"",l=function(e){return"dateFieldsTimeZone"in e}(e)?e.dateFieldsTimeZone??null:e.dateFieldsTimeReference?(0,d.ZS)(e.dateFieldsTimeReference):null,a=n?function(e){return"timeZone"in e}(n)?n.timeZone??l:n.dateFieldsTimeReference?(0,d.ZS)(n.dateFieldsTimeReference):l??d.n$:null,u=i?function(e){return"timeZone"in e}(i)?i.timeZone??l:i.timeReference?(0,d.ZS)(i.timeReference):l:null,p=new Map([[c(n?.creationDateField??""),a],[c(n?.editDateField??""),a],[c(o),u],[c(s),u]]);for(const{name:i,type:n}of e.fields)if(m.has(n))t.set(i,d.L5);else if("date"!==n&&"esriFieldTypeDate"!==n)t.set(i,null);else if(r)t.set(i,d.L5);else{const e=p.get(c(i??""))??l;t.set(i,e)}return t}},91880:(e,t,r)=>{r.d(t,{A:()=>p});var i,n=r(90237),o=r(66552),s=r(25482),l=r(10107),a=(r(44208),r(53966),r(87811),r(40608));const d=new o.J({asc:"ascending",desc:"descending"});let u=i=class extends s.oY{constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new i({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,n._)([(0,l.MZ)({type:String,json:{write:!0}})],u.prototype,"field",void 0),(0,n._)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],u.prototype,"valueExpression",void 0),(0,n._)([(0,l.MZ)({type:d.apiValues,json:{type:d.jsonValues,read:d.read,write:d.write}})],u.prototype,"order",void 0),u=i=(0,n._)([(0,a.$)("esri.layers.support.OrderByInfo")],u);const p=u},96184:(e,t,r)=>{r.d(t,{A:()=>m});var i=r(90237),n=r(60945),o=r(70668),s=r(69540),l=r(25482),a=r(10107),d=(r(44208),r(53966),r(87811),r(36005)),u=r(40608),p=r(43937),y=r(56400);function c(e,t){return o.A.fromJSON({value:e,unit:t})}let h=class extends((0,s.O)(l.oY)){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeZone=null,this.trackIdField=null,this.useTime=!0,this.stops=null}readFullTimeExtent(e,t){return t.timeExtent&&Array.isArray(t.timeExtent)&&2===t.timeExtent.length?n.A.fromArray(t.timeExtent):null}writeFullTimeExtent(e,t){null!=e?.start&&null!=e.end?t.timeExtent=e.toArray():t.timeExtent=null}readInterval(e,t){return t.timeInterval&&t.timeIntervalUnits?c(t.timeInterval,t.timeIntervalUnits):t.defaultTimeInterval&&t.defaultTimeIntervalUnits?c(t.defaultTimeInterval,t.defaultTimeIntervalUnits):null}writeInterval(e,t){t.timeInterval=e?.toJSON().value??null,t.timeIntervalUnits=e?.toJSON().unit??null}};(0,i._)([(0,a.MZ)({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],h.prototype,"cumulative",void 0),(0,i._)([(0,a.MZ)({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"endField",void 0),(0,i._)([(0,a.MZ)({type:n.A,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"fullTimeExtent",void 0),(0,i._)([(0,d.w)("fullTimeExtent",["timeExtent"])],h.prototype,"readFullTimeExtent",null),(0,i._)([(0,p.K)("fullTimeExtent")],h.prototype,"writeFullTimeExtent",null),(0,i._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],h.prototype,"hasLiveData",void 0),(0,i._)([(0,a.MZ)({type:o.A,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"interval",void 0),(0,i._)([(0,d.w)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],h.prototype,"readInterval",null),(0,i._)([(0,p.K)("interval")],h.prototype,"writeInterval",null),(0,i._)([(0,a.MZ)({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"startField",void 0),(0,i._)([(0,a.MZ)((0,y.P6)("timeReference",!0))],h.prototype,"timeZone",void 0),(0,i._)([(0,a.MZ)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"trackIdField",void 0),(0,i._)([(0,a.MZ)({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],h.prototype,"useTime",void 0),(0,i._)([(0,a.MZ)({type:[Date],json:{read:!1}})],h.prototype,"stops",void 0),h=(0,i._)([(0,u.$)("esri.layers.support.TimeInfo")],h);const m=h},72088:(e,t,r)=>{r.d(t,{rS:()=>x,gK:()=>F}),r(44208);var i,n=r(90237),o=r(4718),s=r(10107),l=(r(53966),r(93223)),a=r(40608),d=r(25482);r(87811);let u=i=class extends d.oY{constructor(e){super(e),this.name=null,this.code=null}clone(){return new i({name:this.name,code:this.code})}};(0,n._)([(0,s.MZ)({type:String,json:{write:!0}})],u.prototype,"name",void 0),(0,n._)([(0,s.MZ)({type:[String,Number],json:{write:!0}})],u.prototype,"code",void 0),u=i=(0,n._)([(0,a.$)("esri.layers.support.CodedValue")],u);const p=new(r(66552).J)({inherited:"inherited",codedValue:"coded-value",range:"range"});let y=class extends d.oY{constructor(e){super(e),this.name=null,this.type=null}};(0,n._)([(0,s.MZ)({type:String,json:{write:!0}})],y.prototype,"name",void 0),(0,n._)([(0,l.e)(p)],y.prototype,"type",void 0),y=(0,n._)([(0,a.$)("esri.layers.support.Domain")],y);const c=y;var h;let m=h=class extends c{constructor(e){super(e),this.codedValues=null,this.type="coded-value"}getName(e){let t=null;if(this.codedValues){const r=String(e);this.codedValues.some((e=>(String(e.code)===r&&(t=e.name),!!t)))}return t}clone(){return new h({codedValues:(0,o.o8)(this.codedValues),name:this.name})}};(0,n._)([(0,s.MZ)({type:[u],json:{write:!0}})],m.prototype,"codedValues",void 0),(0,n._)([(0,l.e)({codedValue:"coded-value"})],m.prototype,"type",void 0),m=h=(0,n._)([(0,a.$)("esri.layers.support.CodedValueDomain")],m);const f=m;var g;r(49186);let _=g=class extends c{constructor(e){super(e),this.type="inherited"}clone(){return new g}};(0,n._)([(0,l.e)({inherited:"inherited"})],_.prototype,"type",void 0),_=g=(0,n._)([(0,a.$)("esri.layers.support.InheritedDomain")],_);const v=_;var w;let b=w=class extends c{constructor(e){super(e),this.maxValue=null,this.minValue=null,this.type="range"}clone(){return new w({maxValue:this.maxValue,minValue:this.minValue,name:this.name})}};(0,n._)([(0,s.MZ)({json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range?.[1]},write:{enabled:!1,overridePolicy(){return{enabled:null!=this.maxValue&&null==this.minValue}},target:"range",writer(e,t,r){t[r]=[this.minValue||0,e]}}}})],b.prototype,"maxValue",void 0),(0,n._)([(0,s.MZ)({json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range?.[0]},write:{target:"range",writer(e,t,r){t[r]=[e,this.maxValue||0]}}}})],b.prototype,"minValue",void 0),(0,n._)([(0,l.e)({range:"range"})],b.prototype,"type",void 0),b=w=(0,n._)([(0,a.$)("esri.layers.support.RangeDomain")],b);const M=b,F={key:"type",base:c,typeMap:{range:b,"coded-value":f,inherited:v}};function x(e){if(!e?.type)return null;switch(e.type){case"range":return M.fromJSON(e);case"codedValue":return f.fromJSON(e);case"inherited":return v.fromJSON(e)}return null}},17036:(e,t,r)=>{r.d(t,{p:()=>a});var i=r(44208),n=r(53966),o=r(20437),s=r(95466),l=r(30524);function a(){return{fields:{type:[o.A],value:null,set:function(e){if(e&&(0,i.A)("big-integer-warning-enabled")){const t=e.filter((e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8));if(t.length){const e=t.map((e=>`'${e.name}'`)).join(", ");n.A.getLogger(this).warn("#fields",`Layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}') references big-integer field(s): ${e}, support for which is experimental. Only integers less than ${Number.MAX_SAFE_INTEGER} (Number.MAX_SAFE_INTEGER) are supported.`)}}this._set("fields",e)}},fieldsIndex:{readOnly:!0,get(){return s.A.fromLayer(this)}},outFields:{type:[String],json:{read:!1},set:function(e){this._userOutFields=e,this.notifyChange("outFields")},get:function(){const e=this._userOutFields;if(!e?.length)return null;if(e.includes("*"))return["*"];if(!this.fields)return e;for(const t of e){const r=this.fieldsIndex?.has(t);r||n.A.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${t} found in outFields`,{layer:this,outFields:e})}return(0,l.DB)(this.fieldsIndex,e)}}}}},98453:(e,t,r)=>{r.d(t,{m:()=>i});const i=new(r(66552).J)({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml",esriFieldTypeBigInteger:"big-integer",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimeOnly:"time-only",esriFieldTypeTimestampOffset:"timestamp-offset"})},32730:(e,t,r)=>{r.d(t,{BI:()=>f,D3:()=>h,XJ:()=>m,lc:()=>c,mX:()=>_,rU:()=>g,tH:()=>F});var i=r(799);const n="__begin__",o="__end__",s=new RegExp(n,"ig"),l=new RegExp(o,"ig"),a=new RegExp("^"+n,"i"),d=new RegExp(o+"$","i"),u='"',p=u+" + ",y=" + "+u;function c(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function h(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function m(e){const t={expression:"",type:"none"};return e.labelExpressionInfo?e.labelExpressionInfo.value?(t.expression=e.labelExpressionInfo.value,t.type="conventional"):e.labelExpressionInfo.expression&&(t.expression=e.labelExpressionInfo.expression,t.type="arcade"):null!=e.labelExpression&&(t.expression=c(e.labelExpression),t.type="conventional"),t}function f(e){const t=m(e);if(!t)return null;switch(t.type){case"conventional":return _(t.expression);case"arcade":return t.expression}return null}function g(e){const t=m(e);if(!t)return null;switch(t.type){case"conventional":return function(e){const t=e?.match(v);return t?.[1].trim()||null}(t.expression);case"arcade":return F(t.expression)}return null}function _(e){let t;return e?(t=(0,i.HC)(e,(e=>n+'$feature["'+e+'"]'+o)),t=a.test(t)?t.replace(a,""):u+t,t=d.test(t)?t.replace(d,""):t+u,t=t.replaceAll(s,p).replaceAll(l,y)):t='""',t}const v=/^\s*\{([^}]+)\}\s*$/i,w=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,b=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,M=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function F(e){if(!e)return null;let t=w.exec(e)||b.exec(e);return t?t[1]||t[3]:(t=M.exec(e),t?t[2]:null)}},73133:(e,t,r)=>{r.d(t,{j:()=>i});const i=(0,r(66552).O)()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0})},96520:(e,t,r)=>{r.d(t,{u:()=>s});var i=r(83047),n=r(21325);function o(e,t,r){if(null==e.hasM||e.hasZ)for(const e of t)for(const t of e)t.length>2&&(t[2]*=r)}function s(e,t,r){if(!e&&!t||!r)return;const n=(0,i.G9)(r);l(e,r,n),l(t,r,n)}function l(e,t,r){if(e)for(const i of e)a(i.geometry,t,r)}function a(e,t,r){if(!e?.spatialReference||(0,n.aI)(e.spatialReference,t))return;const s=(0,i.G9)(e.spatialReference)/r;if(1!==s)if("x"in e)null!=e.z&&(e.z*=s);else if("rings"in e)o(e,e.rings,s);else if("paths"in e)o(e,e.paths,s);else if("points"in e&&(null==e.hasM||e.hasZ))for(const t of e.points)t.length>2&&(t[2]*=s)}},58501:(e,t,r)=>{r.d(t,{q:()=>n});var i=r(62815);function n(e,t,r){if(!r?.features||!r.hasZ)return;const n=(0,i.N)(r.geometryType,t,e.outSpatialReference);if(null!=n)for(const e of r.features)n(e.geometry)}},22671:(e,t,r)=>{r.d(t,{A:()=>v});var i,n=r(90237),o=r(59456),s=r(52106),l=r(66552),a=r(25482),d=r(4718),u=r(10107),p=(r(44208),r(53966),r(36005)),y=r(40608),c=r(43937),h=r(16930),m=r(65864),f=r(20437);const g=new l.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let _=i=class extends a.oY{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const r=h.A.fromJSON(t.spatialReference),i=[];for(let t=0;t<e.length;t++){const n=e[t],o=s.A.fromJSON(n),l=n.geometry?.spatialReference;null==o.geometry||l||(o.geometry.spatialReference=r);const a=n.aggregateGeometries,d=o.aggregateGeometries;if(a&&null!=d)for(const e in d){const t=d[e],i=a[e],n=i?.spatialReference;null==t||n||(t.spatialReference=r)}i.push(o)}return i}writeGeometryType(e,t,r,i){if(e)return void g.write(e,t,r,i);const{features:n}=this;if(n)for(const e of n)if(null!=e?.geometry)return void g.write(e.geometry.type,t,r,i)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,i=(0,m.rS)(e);return i&&!r&&t.spatialReference&&(i.spatialReference=h.A.fromJSON(t.spatialReference)),i}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new i(this.cloneProperties())}cloneProperties(){return(0,d.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const i=t.features[r];if(i.geometry){const t=e?.[r];i.geometry=t?.toJSON()||i.geometry}}return t}quantize(e){const{scale:[t,r],translate:[i,n]}=e,o=this.features,s=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-i)/t)),(e=>Math.round((n-e)/r)));for(let e=0,t=o.length;e<t;e++)s?.(o[e].geometry)||(o.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[i,n],scale:[o,s]}=r;let l=null,a=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;l=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;a=r=>null==r?r:r*t+e}const d=this._getHydrationFunction(e,(e=>e*o+i),(e=>n-e*s),l,a);for(const{geometry:e}of t)null!=e&&d&&d(e);return this.transform=null,this}_quantizePoints(e,t,r){let i,n;const o=[];for(let s=0,l=e.length;s<l;s++){const l=e[s];if(s>0){const e=t(l[0]),s=r(l[1]);e===i&&s===n||(o.push([e-i,s-n]),i=e,n=s)}else i=t(l[0]),n=r(l[1]),o.push([i,n])}return o.length>0?o:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const i=(0,m.Bi)(e)?e.rings:e.paths,n=[];for(let e=0,o=i.length;e<o;e++){const o=i[e],s=this._quantizePoints(o,t,r);s&&n.push(s)}return n.length>0?((0,m.Bi)(e)?e.rings=n:e.paths=n,e):null}:"multipoint"===e?e=>{const i=this._quantizePoints(e.points,t,r);return i&&i.length>0?(e.points=i,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,i,n){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),i&&(e.z=i(e.z))}:"polyline"===e||"polygon"===e?e=>{const o=(0,m.Bi)(e)?e.rings:e.paths;let s,l;for(let e=0,i=o.length;e<i;e++){const i=o[e];for(let e=0,n=i.length;e<n;e++){const n=i[e];e>0?(s+=n[0],l+=n[1]):(s=n[0],l=n[1]),n[0]=t(s),n[1]=r(l)}}if(i&&n)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2]),r[3]=n(r[3])}}else if(i)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2])}}else if(n)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=n(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),i&&null!=e.zmax&&null!=e.zmin&&(e.zmax=i(e.zmax),e.zmin=i(e.zmin)),n&&null!=e.mmax&&null!=e.mmin&&(e.mmax=n(e.mmax),e.mmin=n(e.mmin))}:"multipoint"===e?e=>{const o=e.points;let s,l;for(let e=0,i=o.length;e<i;e++){const i=o[e];e>0?(s+=i[0],l+=i[1]):(s=i[0],l=i[1]),i[0]=t(s),i[1]=r(l)}if(i&&n)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=i(t[2]),t[3]=n(t[3])}else if(i)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=i(t[2])}else if(n)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=n(t[2])}}:null}};(0,n._)([(0,u.MZ)({type:String,json:{write:!0}})],_.prototype,"displayFieldName",void 0),(0,n._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"exceededTransferLimit",void 0),(0,n._)([(0,u.MZ)({type:[s.A],json:{write:!0}})],_.prototype,"features",void 0),(0,n._)([(0,p.w)("features")],_.prototype,"readFeatures",null),(0,n._)([(0,u.MZ)({type:[f.A],json:{write:!0}})],_.prototype,"fields",void 0),(0,n._)([(0,u.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],_.prototype,"geometryType",void 0),(0,n._)([(0,c.K)("geometryType")],_.prototype,"writeGeometryType",null),(0,n._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"hasM",void 0),(0,n._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"hasZ",void 0),(0,n._)([(0,u.MZ)({types:o.yR,json:{write:!0}})],_.prototype,"queryGeometry",void 0),(0,n._)([(0,p.w)("queryGeometry")],_.prototype,"readQueryGeometry",null),(0,n._)([(0,u.MZ)({type:h.A,json:{write:!0}})],_.prototype,"spatialReference",void 0),(0,n._)([(0,c.K)("spatialReference")],_.prototype,"writeSpatialReference",null),(0,n._)([(0,u.MZ)({json:{write:!0}})],_.prototype,"transform",void 0),_=i=(0,n._)([(0,y.$)("esri.rest.support.FeatureSet")],_),_.prototype.toJSON.isDefaultToJSON=!0;const v=_}}]);
package/interfaces.d.ts CHANGED
@@ -1413,6 +1413,12 @@ declare namespace __esri {
1413
1413
  * Checks for relative urls and returns whether or not this webscene allows the `saveAs()` operation.
1414
1414
  */
1415
1415
  canSaveAs(webscene: WebScene): boolean;
1416
+ /**
1417
+ * Note: reserved for internal use only, this is not part of the stable public API.
1418
+ *
1419
+ * Helper function to close a catalog layer in the layer list.
1420
+ */
1421
+ closeCatalogLayer(layerList: LayerList): void;
1416
1422
  /**
1417
1423
  * Note: reserved for internal use only, this is not part of the stable public API.
1418
1424
  *
@@ -114041,7 +114047,8 @@ declare namespace __esri {
114041
114047
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-PrintViewModel.html#includeDefaultTemplates)
114042
114048
  */
114043
114049
  includeDefaultTemplates: boolean;
114044
- layoutTemplateNorthArrowInfo: any;
114050
+ readonly layoutTemplateInfo: any;
114051
+ readonly layoutTemplateNorthArrowInfo: any;
114045
114052
  /**
114046
114053
  * It is possible to search a specified portal instance's [locator services](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-portal-to-geocode-addresses.htm).
114047
114054
  *
@@ -114155,7 +114162,6 @@ declare namespace __esri {
114155
114162
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-PrintViewModel.html#includeDefaultTemplates)
114156
114163
  */
114157
114164
  includeDefaultTemplates?: boolean;
114158
- layoutTemplateNorthArrowInfo?: any;
114159
114165
  /**
114160
114166
  * It is possible to search a specified portal instance's [locator services](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-portal-to-geocode-addresses.htm).
114161
114167
  *
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.1";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.3";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Collection.js";import i from"../core/Error.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{urlToObject as n,join as l,hasSamePortal as p}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import u from"./Layer.js";import m from"./catalog/CatalogDynamicGroupLayer.js";import c from"./catalog/CatalogFootprintLayer.js";import h from"./graphics/sources/FeatureLayerSource.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{BlendLayer as F}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as w}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as L}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{OrderedLayer as S}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as b}from"./mixins/TemporalLayer.js";import{id as T}from"./support/commonProperties.js";import{ensureLayerCredential as _,applyEdits as E,getFeatureType as P,hasDataChanged as C}from"./support/featureLayerUtils.js";import G from"./support/FeatureType.js";import{defineFieldProperties as U}from"./support/fieldProperties.js";import{layerLookupMap as q}from"./support/lazyLayerLoader.js";import{serviceSupportsSpatialReference as A}from"./support/versionUtils.js";import Q from"../portal/Portal.js";import D from"../portal/PortalItem.js";import{normalizeArcGISOnlineOrgDomain as N}from"../portal/support/urlUtils.js";import M from"../rest/support/Query.js";const R=U();function B(e){return"object"==typeof e&&null!=e&&"itemId"in e&&"portalUrl"in e}function V(e){return"object"==typeof e&&null!=e&&"url"in e}function k(e){if(null==e)return!0;const t=Object.keys(e);return!t.length||1===t.length&&"id"===t[0]}function J(e,t,r,i){const o=e.write({},i);k(o)||(t[r]=o)}let K=class extends(L(w(F(S(b(O(I(g(v(x(s(j(f(u)))))))))))))){constructor(e){super(e),this._portals=new Map,this._layerToFootprint=new WeakMap,this.drawOrderField="cd_draworder",this.dynamicGroupLayer=new m({parent:this}),this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.footprintLayer=new c({parent:this}),this.itemNameField="cd_itemname",this.itemSourceField="cd_itemsource",this.itemTypeField="cd_itemtype",this.layers=new r([this.dynamicGroupLayer,this.footprintLayer]),this.maxScaleField="cd_maxscale",this.minScaleField="cd_minscale",this.orderBy=null,this.outFields=null,this.supportedSourceTypes=new Set(["Catalog Layer"]),this.source=new h({layer:this,supportedSourceTypes:this.supportedSourceTypes}),this.type="catalog",this.typeIdField=null,this.types=null}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(a).then((async()=>{const{url:e,source:r,portalItem:o}=this;if(!e)throw new i("catalog-layer:missing-url","Catalog layer must be created with a url");if(null==this.layerId){const r=await this._fetchFirstValidLayerId(t);if(null==r)throw new i("catalog-layer:missing-layerId","There is no Catalog Layer in the service",{service:e});this.layerId=r}await r.load({signal:t});const{sourceJSON:s}=r;s&&(this.sourceJSON=s,this.read(s,{origin:"service",portalItem:o,portal:o?.portal,url:this.parsedUrl}))})).then((()=>{const e=[this.itemNameField,this.itemSourceField,this.itemTypeField,this.minScaleField,this.maxScaleField],t=e.filter((e=>!this.fieldsIndex.has(e)));if(t.length)throw new i("catalog-layer:missing-fields","There are missing fields to operate properly",{requiredFields:e,missingFields:t})})).then((()=>_(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}destroy(){this.footprintLayer.destroy(),this.dynamicGroupLayer.destroy();for(const e of this._portals.values())e.destroy();this._portals.clear()}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return!1}get parsedUrl(){const e=n(this.url);return null!=e&&null!=this.layerId&&(e.path=l(e.path,this.layerId.toString())),e}async applyEdits(e,t){return E(this,e,t)}on(e,t){return super.on(e,t)}async createLayerFromFootprint(e){const t=await this._createLayer(e);return this._configureLayer(t,e),this._layerToFootprint.set(t,e),t}createFootprintFromLayer(e){return this._layerToFootprint.get(e)?.clone()}createQuery(){const e=new M,t=this.capabilities?.query;e.returnGeometry=!0,t&&(e.compactGeometryEnabled=t.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=t.supportsDefaultSpatialReference),e.outFields=["*"];const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e.where=this.definitionExpression||"1=1",e}getFeatureType(e){return P(this.types,this.typeIdField,e)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=t?.feature,i=this.getFeatureType(r);if(i){const t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this.getField(e)?.domain}async hasDataChanged(){return C(this)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(M.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r.footprintLayer;return i}async queryObjectIds(e,t){return(await this.load()).source.queryObjectIds(M.from(e)??this.createQuery(),t)}async queryFeatureCount(e,t){return(await this.load()).source.queryFeatureCount(M.from(e)??this.createQuery(),t)}async queryExtent(e,t){return(await this.load()).source.queryExtent(M.from(e)??this.createQuery(),t)}serviceSupportsSpatialReference(e){return this.loaded&&A(this,e)}read(e,t){if(super.read(e,t),e){const{footprintLayer:r,dynamicGroupLayer:i}=e;r&&this.footprintLayer.read(r,t),i&&this.dynamicGroupLayer.read(i,t)}}async _fetchFirstValidLayerId(e){const{data:r}=await t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(Array.isArray(r?.layers))return r.layers.find((({type:e})=>this.supportedSourceTypes.has(e)))?.id}async _createLayer(e){const t=e.getAttribute(this.itemSourceField);if(!t)throw new i("catalog-layer:item-source-missing",`The footprint is missing the "${this.itemSourceField}" attribute`);const r=JSON.parse(t);if(B(r)){const{itemId:e,portalUrl:t}=r,i=N(t),s=this.portalItem?.portal,a=Q.getDefault();let n,l=!0;s&&p(t,s.url)?n=s:p(t,a.url)?n=a:(n=o(this._portals,i,(()=>new Q({url:i}))),l=!1);const d=await u.fromPortalItem(new D({id:e,portal:n}));if(!l){try{await d.load()}catch{}d.portalItem=null}return d}if(V(r))return u.fromArcGISServerUrl({url:r.url});return new(await q.UnsupportedLayer())}_configureLayer(e,t){const r=t.getAttribute(this.itemNameField);r&&(e.title=r);const i=t.getAttribute(this.maxScaleField);null!=i&&"maxScale"in e&&(e.maxScale=i);const o=t.getAttribute(this.minScaleField);null!=o&&"minScale"in e&&(e.minScale=o)}};e([d({readOnly:!0})],K.prototype,"createQueryVersion",null),e([d({readOnly:!0})],K.prototype,"drawOrderField",void 0),e([d({type:m,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:J}}})],K.prototype,"dynamicGroupLayer",void 0),e([d({readOnly:!0})],K.prototype,"editingEnabled",null),e([d({readOnly:!0})],K.prototype,"effectiveEditingEnabled",null),e([d({json:{origins:{"web-scene":{name:"layerDefinition.elevationInfo",read:!1,write:!1}}}})],K.prototype,"elevationInfo",void 0),e([d({...R.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],K.prototype,"fields",void 0),e([d(R.fieldsIndex)],K.prototype,"fieldsIndex",void 0),e([d({json:{origins:{"web-scene":{name:"layerDefinition.floorInfo",read:!1,write:!1}}}})],K.prototype,"floorInfo",void 0),e([d({type:c,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:J}}})],K.prototype,"footprintLayer",void 0),e([d(T)],K.prototype,"id",void 0),e([d({readOnly:!0})],K.prototype,"itemNameField",void 0),e([d({readOnly:!0})],K.prototype,"itemSourceField",void 0),e([d({readOnly:!0})],K.prototype,"itemTypeField",void 0),e([d({readOnly:!0})],K.prototype,"layers",void 0),e([d({type:["show","hide","hide-children"]})],K.prototype,"listMode",void 0),e([d({readOnly:!0})],K.prototype,"maxScaleField",void 0),e([d({readOnly:!0})],K.prototype,"minScaleField",void 0),e([d({value:"CatalogLayer",type:["CatalogLayer"]})],K.prototype,"operationalLayerType",void 0),e([d({json:{origins:{"web-scene":{name:"layerDefinition.orderBy",write:!0,read:!0}}}})],K.prototype,"orderBy",void 0),e([d(R.outFields)],K.prototype,"outFields",void 0),e([d({readOnly:!0})],K.prototype,"parsedUrl",null),e([d({readOnly:!0})],K.prototype,"source",void 0),e([d({json:{read:!1}})],K.prototype,"type",void 0),e([d({type:String})],K.prototype,"typeIdField",void 0),e([d({type:[G]})],K.prototype,"types",void 0),K=e([y("esri.layers.CatalogLayer")],K);const z=K;export{z as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Collection.js";import i from"../core/Error.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{urlToObject as n,join as l,hasSamePortal as p}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import m from"./Layer.js";import u from"./catalog/CatalogDynamicGroupLayer.js";import c from"./catalog/CatalogFootprintLayer.js";import h from"./graphics/sources/FeatureLayerSource.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{BlendLayer as F}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as w}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as L}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{OrderedLayer as v}from"./mixins/OrderedLayer.js";import{PortalLayer as I}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as b}from"./mixins/TemporalLayer.js";import{id as T}from"./support/commonProperties.js";import{ensureLayerCredential as _,applyEdits as E,getFeatureType as P,hasDataChanged as C}from"./support/featureLayerUtils.js";import G from"./support/FeatureType.js";import{defineFieldProperties as U}from"./support/fieldProperties.js";import{layerLookupMap as q}from"./support/lazyLayerLoader.js";import{serviceSupportsSpatialReference as A}from"./support/versionUtils.js";import Q from"../portal/Portal.js";import D from"../portal/PortalItem.js";import{normalizeArcGISOnlineOrgDomain as N}from"../portal/support/urlUtils.js";import M from"../rest/support/Query.js";const R=U();function B(e){return"object"==typeof e&&null!=e&&"itemId"in e&&"portalUrl"in e}function V(e){return"object"==typeof e&&null!=e&&"url"in e}function k(e){if(null==e)return!0;const t=Object.keys(e);return!t.length||1===t.length&&"id"===t[0]}function J(e,t,r,i){const o=e.write({},i);k(o)||(t[r]=o)}let K=class extends(L(w(F(v(b(O(x(g(S(I(s(j(f(m)))))))))))))){constructor(e){super(e),this._portals=new Map,this._layerToFootprint=new WeakMap,this.drawOrderField="cd_draworder",this.dynamicGroupLayer=new u({parent:this}),this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.footprintLayer=new c({parent:this}),this.itemNameField="cd_itemname",this.itemSourceField="cd_itemsource",this.itemTypeField="cd_itemtype",this.layers=new r([this.dynamicGroupLayer,this.footprintLayer]),this.maxScaleField="cd_maxscale",this.minScaleField="cd_minscale",this.orderBy=null,this.outFields=null,this.supportedSourceTypes=new Set(["Catalog Layer"]),this.source=new h({layer:this,supportedSourceTypes:this.supportedSourceTypes}),this.type="catalog",this.typeIdField=null,this.types=null}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(a).then((async()=>{const{url:e,source:r,portalItem:o}=this;if(!e)throw new i("catalog-layer:missing-url","Catalog layer must be created with a url");if(null==this.layerId){const r=await this._fetchFirstValidLayerId(t);if(null==r)throw new i("catalog-layer:missing-layerId","There is no Catalog Layer in the service",{service:e});this.layerId=r}await r.load({signal:t});const{sourceJSON:s}=r;s&&(this.sourceJSON=s,this.read(s,{origin:"service",portalItem:o,portal:o?.portal,url:this.parsedUrl}))})).then((()=>{const e=[this.itemNameField,this.itemSourceField,this.itemTypeField,this.minScaleField,this.maxScaleField],t=e.filter((e=>!this.fieldsIndex.has(e)));if(t.length)throw new i("catalog-layer:missing-fields","There are missing fields to operate properly",{requiredFields:e,missingFields:t})})).then((()=>_(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}destroy(){this.footprintLayer.destroy(),this.dynamicGroupLayer.destroy();for(const e of this._portals.values())e.destroy();this._portals.clear()}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return!1}get parsedUrl(){const e=n(this.url);return null!=e&&null!=this.layerId&&(e.path=l(e.path,this.layerId.toString())),e}async applyEdits(e,t){return E(this,e,t)}on(e,t){return super.on(e,t)}async createLayerFromFootprint(e){const t=await this._createLayer(e);return this._configureLayer(t,e),this._layerToFootprint.set(t,e),t}createFootprintFromLayer(e){return this._layerToFootprint.get(e)?.clone()}createQuery(){const e=new M,t=this.capabilities?.query;e.returnGeometry=!0,t&&(e.compactGeometryEnabled=t.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=t.supportsDefaultSpatialReference),e.outFields=["*"];const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e.where=this.definitionExpression||"1=1",e}getFeatureType(e){return P(this.types,this.typeIdField,e)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=t?.feature,i=this.getFeatureType(r);if(i){const t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this.getField(e)?.domain}async hasDataChanged(){return C(this)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(M.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r.footprintLayer;return i}async queryObjectIds(e,t){return(await this.load()).source.queryObjectIds(M.from(e)??this.createQuery(),t)}async queryFeatureCount(e,t){return(await this.load()).source.queryFeatureCount(M.from(e)??this.createQuery(),t)}async queryExtent(e,t){return(await this.load()).source.queryExtent(M.from(e)??this.createQuery(),t)}serviceSupportsSpatialReference(e){return this.loaded&&A(this,e)}read(e,t){if(super.read(e,t),e){const{footprintLayer:r,dynamicGroupLayer:i}=e;r&&this.footprintLayer.read(r,t),i&&this.dynamicGroupLayer.read(i,t)}}async _fetchFirstValidLayerId(e){const{data:r}=await t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(Array.isArray(r?.layers))return r.layers.find((({type:e})=>this.supportedSourceTypes.has(e)))?.id}async _createLayer(e){const t=e.getAttribute(this.itemSourceField);if(!t)throw new i("catalog-layer:item-source-missing",`The footprint is missing the "${this.itemSourceField}" attribute`);const r=JSON.parse(t);if(B(r)){const{itemId:e,portalUrl:t}=r,i=N(t),s=this.portalItem?.portal,a=Q.getDefault();let n,l=!0;s&&p(t,s.url)?n=s:p(t,a.url)?n=a:(n=o(this._portals,i,(()=>new Q({url:i}))),l=!1);const d=await m.fromPortalItem(new D({id:e,portal:n}));return l||await z(d),d}if(V(r))return m.fromArcGISServerUrl({url:r.url});return new(await q.UnsupportedLayer())}_configureLayer(e,t){const r=t.getAttribute(this.itemNameField);r&&(e.title=r);const i=t.getAttribute(this.maxScaleField);null!=i&&"maxScale"in e&&(e.maxScale=i);const o=t.getAttribute(this.minScaleField);null!=o&&"minScale"in e&&(e.minScale=o)}};async function z(e){if("portalItem"in e&&e.portalItem){try{await e.load()}catch{}e.portalItem=null,"group"===e.type&&await Promise.allSettled([...e.layers.map((e=>z(e))),...e.tables.map((e=>z(e)))])}}e([d({readOnly:!0})],K.prototype,"createQueryVersion",null),e([d({readOnly:!0})],K.prototype,"drawOrderField",void 0),e([d({type:u,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:J}}})],K.prototype,"dynamicGroupLayer",void 0),e([d({readOnly:!0})],K.prototype,"editingEnabled",null),e([d({readOnly:!0})],K.prototype,"effectiveEditingEnabled",null),e([d({json:{origins:{"web-scene":{name:"layerDefinition.elevationInfo",read:!1,write:!1}}}})],K.prototype,"elevationInfo",void 0),e([d({...R.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],K.prototype,"fields",void 0),e([d(R.fieldsIndex)],K.prototype,"fieldsIndex",void 0),e([d({json:{origins:{"web-scene":{name:"layerDefinition.floorInfo",read:!1,write:!1}}}})],K.prototype,"floorInfo",void 0),e([d({type:c,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:J}}})],K.prototype,"footprintLayer",void 0),e([d(T)],K.prototype,"id",void 0),e([d({readOnly:!0})],K.prototype,"itemNameField",void 0),e([d({readOnly:!0})],K.prototype,"itemSourceField",void 0),e([d({readOnly:!0})],K.prototype,"itemTypeField",void 0),e([d({readOnly:!0})],K.prototype,"layers",void 0),e([d({type:["show","hide","hide-children"]})],K.prototype,"listMode",void 0),e([d({readOnly:!0})],K.prototype,"maxScaleField",void 0),e([d({readOnly:!0})],K.prototype,"minScaleField",void 0),e([d({value:"CatalogLayer",type:["CatalogLayer"]})],K.prototype,"operationalLayerType",void 0),e([d({json:{origins:{"web-scene":{name:"layerDefinition.orderBy",write:!0,read:!0}}}})],K.prototype,"orderBy",void 0),e([d(R.outFields)],K.prototype,"outFields",void 0),e([d({readOnly:!0})],K.prototype,"parsedUrl",null),e([d({readOnly:!0})],K.prototype,"source",void 0),e([d({json:{read:!1}})],K.prototype,"type",void 0),e([d({type:String})],K.prototype,"typeIdField",void 0),e([d({type:[G]})],K.prototype,"types",void 0),K=e([y("esri.layers.CatalogLayer")],K);const H=K;export{H as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";var g;let h=g=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){const{layer:e}=this;return"subtype-group"===e.type?e.subtypeField:e.typeIdField}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new g({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await x(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await v(n,t);if(i){const t=i.map((t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map((t=>e.fieldsIndex.normalizeFieldName(t)))})));return new g({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some((e=>t.includes(e))))continue;if(!o.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=V(i);p[e]||a.push(i),p[e]=!0}}c&&(a=b(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await w(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:x(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await v(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await S(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await C(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===o?.name));e&&(t=e.entries[t])}const u=o?.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})}));return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?F(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function V(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function b(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function j(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function T(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?j(e,t):T(e,t)}async function w(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups??[]))}async function v(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[]))}async function x(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}async function C(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async function S(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}function F(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find((([e])=>e.trim().toLowerCase()===t.trim().toLowerCase()))||[];return i||null}return null}e([o({constructOnly:!0})],h.prototype,"layer",void 0),e([o({constructOnly:!0})],h.prototype,"request",void 0),e([o({type:[d]})],h.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],h.prototype,"fieldGroupDefinitions",void 0),e([o()],h.prototype,"subtypeFieldName",null),h=g=e([r("esri.layers.support.LayerContingentValuesCache")],h);const O=h;export{O as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import f from"./FieldGroup.js";import{isStringField as d,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";import{getNormalizedFeatureTypeInfo as g}from"../../widgets/FeatureForm/featureFormUtils.js";var h;let V=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){return g(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await C(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await x(n,t);if(i){const t=i.map((t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map((t=>e.fieldsIndex.normalizeFieldName(t)))})));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some((e=>t.includes(e))))continue;if(!o.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));if(0!==c.length){for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=b(i);p[e]||a.push(i),p[e]=!0}}c&&(a=j(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await v(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:C(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await x(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await S(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await F(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===o?.name));e&&(t=e.entries[t])}const u=o?.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(d(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})}));return new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?O(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function b(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function j(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function T(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function w(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?T(e,t):w(e,t)}async function v(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups??[]))}async function x(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[]))}async function C(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}async function F(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async function S(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}function O(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find((([e])=>e.trim().toLowerCase()===t.trim().toLowerCase()))||[];return i||null}return null}e([o({constructOnly:!0})],V.prototype,"layer",void 0),e([o({constructOnly:!0})],V.prototype,"request",void 0),e([o({type:[f]})],V.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],V.prototype,"fieldGroupDefinitions",void 0),e([o()],V.prototype,"subtypeFieldName",null),V=h=e([r("esri.layers.support.LayerContingentValuesCache")],V);const _=V;export{_ as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.30.1",
3
+ "version": "4.30.3",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- const b="20240627",c="fe105cb6984889590b420bfd80d8f495c7bec1d9";export{b as buildDate,c as commitHash};
5
+ const c="20240701",b="108b4ad1205e66e8bbda4bc3310ec5c14354fcbc";export{c as buildDate,b as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a,whenOnce as l,on as u}from"../../core/reactiveUtils.js";import{templateHasKey as p}from"../../core/string.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import f from"../../form/FormTemplate.js";import{isGroupElement as m,isFieldElement as g,isRelationshipElement as y,isTextElement as _}from"../../form/support/formUtils.js";import v from"../../layers/support/ContingentValue.js";import{isEditableLayer as x}from"../../layers/support/editableLayers.js";import E from"../../layers/support/LayerContingentValuesCache.js";import{utc as I,unknown as C,system as F}from"../../time/timeZoneUtils.js";import{flattenFieldInputs as b,isGroupInput as V,flattenRelationshipInputs as w,parseFormTemplateString as j,isRelationshipInput as T,isFieldInput as A,isTextElementInput as M,getNormalizedFeatureTypeInfo as R,valueIsValidContingentValue as S}from"./featureFormUtils.js";import H from"./FieldInput.js";import{createFormExpressionArcadeExecutor as N}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as Z}from"./FormExpressionsManager.js";import L from"./GroupInput.js";import U from"./RelationshipInput.js";import{TextElementInput as k}from"./TextElementInput.js";const P=new t({attributes:{}}),O={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"]},W="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",G="#JSAPI_CONTINGENT_VALUE_ANY_HASH",$="#JSAPI_CONTINGENT_VALUE_NULL_HASH",z="esri.widgets.FeatureForm.FeatureFormViewModel",D=()=>i.getLogger(z);let J=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=P.clone(),this._initialFeature=P.clone(),this._timeZone=null,this._updatingHandles=new h,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1,this.hasPendingSubtypeChoice=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i,o],[r,a,l,u,p,c])=>e===r&&t===a&&n===l&&s===u&&i===p&&o===c,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(E.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:x(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get allFieldInputs(){return b(this.inputs)}get allGroupInputs(){return this.inputs.filter(V)}get allRelationshipInputs(){return w(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():P.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.hasPendingSubtypeChoice=!1),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?j({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?j({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return I;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===C?t||I:this._timeZone||F}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const{_featureClone:t,layer:n}=this,s=!!n?.getField(e);return t.getAttribute(e)??(s?null:void 0)}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(V(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(B),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await l((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),V(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(T(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(m(a)){const e=a.elements.filter((e=>B(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return D().warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const o of e)if(V(o)){for(const e of o.inputs)e.destroy();o.inputs.length=0,o.destroy()}else T(o)?o.destroy():A(o)&&(null!==o.element?o.destroy():s.set(o.field,o));const i=[];for(const o of t){const e=n.feature?.getAttribute(o.name)??null,t=s.get(o)??new H({field:o,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});i.push(t.set({...n,value:e})),s.delete(o)}for(const[o,r]of s.entries())s.delete(o),r.destroy();return i}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return m(e)?K(e,t):g(e)?this._makeFieldInputFromElement(e,t,s):y(e)?this._makeRelationshipInputFromElement(e,t,s):_(e)?q(e,t):n()}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new H({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new U({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(u((()=>a.relatedLayer),"edits",(()=>this._expressionsManager?.evaluateAsyncExpressions()))),a}_assignExpressionExecutors(e,t,n){const s=O[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return M(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=N(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new Z({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=R(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&p(n,t)&&this.notifyChange("formTitle"),e&&p(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=R(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(G)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(G),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(G)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(G),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:h}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new v({objectType:"null"});continue}if(r&&h||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new v({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===G)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||S(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[W,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[G,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${$}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};function B(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||(D().warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}function K(e,t){const{feature:n,layer:s}=t;return new L({element:e,inputs:[],feature:n,layer:s})}function q(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new k({element:e,feature:s,group:n,layer:i,timeZone:o})}e([c()],J.prototype,"_expressionInfosLookup",null),e([c()],J.prototype,"_featureClone",void 0),e([c()],J.prototype,"_timeZone",void 0),e([c()],J.prototype,"activeRelationshipInput",null),e([c()],J.prototype,"_arcadeContextInfo",null),e([c()],J.prototype,"allFieldInputs",null),e([c()],J.prototype,"allGroupInputs",null),e([c()],J.prototype,"allRelationshipInputs",null),e([c()],J.prototype,"_layerFieldsByName",null),e([c()],J.prototype,"arcadeEditType",void 0),e([c()],J.prototype,"contingencyConstraintViolations",void 0),e([c()],J.prototype,"disabled",void 0),e([c()],J.prototype,"feature",null),e([c()],J.prototype,"fieldsWithContingentValues",null),e([c({type:f})],J.prototype,"formTemplate",null),e([c()],J.prototype,"formDescription",null),e([c()],J.prototype,"formTitle",null),e([c()],J.prototype,"formHeaderVisible",null),e([c()],J.prototype,"highlightHelper",void 0),e([c()],J.prototype,"inputs",void 0),e([c()],J.prototype,"joinedContingentValues",null),e([c()],J.prototype,"layer",null),e([c()],J.prototype,"map",void 0),e([c()],J.prototype,"relatedRecordCallbacks",void 0),e([c()],J.prototype,"relationshipId",null),e([c()],J.prototype,"spatialReference",null),e([c()],J.prototype,"state",null),e([c()],J.prototype,"strict",void 0),e([c()],J.prototype,"submittable",null),e([c()],J.prototype,"timeZone",null),e([c()],J.prototype,"updating",null),e([c()],J.prototype,"valid",null),e([c()],J.prototype,"hasPendingSubtypeChoice",void 0),e([c()],J.prototype,"getValues",null),e([c()],J.prototype,"submit",null),J=e([d(z)],J);const Y=J;export{Y as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a,whenOnce as l,on as u}from"../../core/reactiveUtils.js";import{templateHasKey as p}from"../../core/string.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import f from"../../form/FormTemplate.js";import{isGroupElement as m,isFieldElement as g,isRelationshipElement as y,isTextElement as _}from"../../form/support/formUtils.js";import x from"../../layers/support/ContingentValue.js";import{isEditableLayer as v}from"../../layers/support/editableLayers.js";import E from"../../layers/support/LayerContingentValuesCache.js";import{utc as I,unknown as C,system as F}from"../../time/timeZoneUtils.js";import{flattenFieldInputs as b,isGroupInput as V,flattenRelationshipInputs as w,parseFormTemplateString as j,isRelationshipInput as T,isFieldInput as A,isTextElementInput as M,getNormalizedFeatureTypeInfo as R,valueIsValidContingentValue as S}from"./featureFormUtils.js";import H from"./FieldInput.js";import{createFormExpressionArcadeExecutor as N}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as Z}from"./FormExpressionsManager.js";import L from"./GroupInput.js";import U from"./RelationshipInput.js";import{TextElementInput as k}from"./TextElementInput.js";const P=new t({attributes:{}}),O={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"]},W="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",G="#JSAPI_CONTINGENT_VALUE_ANY_HASH",$="#JSAPI_CONTINGENT_VALUE_NULL_HASH",z="esri.widgets.FeatureForm.FeatureFormViewModel",D=()=>i.getLogger(z);let J=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=P.clone(),this._initialFeature=P.clone(),this._timeZone=null,this._updatingHandles=new h,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1,this.hasPendingSubtypeChoice=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i,o],[r,a,l,u,p,c])=>e===r&&t===a&&n===l&&s===u&&i===p&&o===c,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(E.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:v(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get allFieldInputs(){return b(this.inputs)}get allGroupInputs(){return this.inputs.filter(V)}get allRelationshipInputs(){return w(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():P.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.hasPendingSubtypeChoice=!1),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?j({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?j({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return I;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===C?t||I:this._timeZone||F}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(V(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(B),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await l((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),V(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(T(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(m(a)){const e=a.elements.filter((e=>B(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return D().warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const o of e)if(V(o)){for(const e of o.inputs)e.destroy();o.inputs.length=0,o.destroy()}else T(o)?o.destroy():A(o)&&(null!==o.element?o.destroy():s.set(o.field,o));const i=[];for(const o of t){const e=n.feature?.getAttribute(o.name)??null,t=s.get(o)??new H({field:o,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});i.push(t.set({...n,value:e})),s.delete(o)}for(const[o,r]of s.entries())s.delete(o),r.destroy();return i}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return m(e)?K(e,t):g(e)?this._makeFieldInputFromElement(e,t,s):y(e)?this._makeRelationshipInputFromElement(e,t,s):_(e)?q(e,t):n()}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new H({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new U({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(u((()=>a.relatedLayer),"edits",(()=>this._expressionsManager?.evaluateAsyncExpressions()))),a}_assignExpressionExecutors(e,t,n){const s=O[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return M(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=N(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new Z({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=R(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&p(n,t)&&this.notifyChange("formTitle"),e&&p(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=R(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(G)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(G),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(G)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(G),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:h}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new x({objectType:"null"});continue}if(r&&h||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new x({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===G)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||S(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[W,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[G,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${$}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};function B(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||(D().warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}function K(e,t){const{feature:n,layer:s}=t;return new L({element:e,inputs:[],feature:n,layer:s})}function q(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new k({element:e,feature:s,group:n,layer:i,timeZone:o})}e([c()],J.prototype,"_expressionInfosLookup",null),e([c()],J.prototype,"_featureClone",void 0),e([c()],J.prototype,"_timeZone",void 0),e([c()],J.prototype,"activeRelationshipInput",null),e([c()],J.prototype,"_arcadeContextInfo",null),e([c()],J.prototype,"allFieldInputs",null),e([c()],J.prototype,"allGroupInputs",null),e([c()],J.prototype,"allRelationshipInputs",null),e([c()],J.prototype,"_layerFieldsByName",null),e([c()],J.prototype,"arcadeEditType",void 0),e([c()],J.prototype,"contingencyConstraintViolations",void 0),e([c()],J.prototype,"disabled",void 0),e([c()],J.prototype,"feature",null),e([c()],J.prototype,"fieldsWithContingentValues",null),e([c({type:f})],J.prototype,"formTemplate",null),e([c()],J.prototype,"formDescription",null),e([c()],J.prototype,"formTitle",null),e([c()],J.prototype,"formHeaderVisible",null),e([c()],J.prototype,"highlightHelper",void 0),e([c()],J.prototype,"inputs",void 0),e([c()],J.prototype,"joinedContingentValues",null),e([c()],J.prototype,"layer",null),e([c()],J.prototype,"map",void 0),e([c()],J.prototype,"relatedRecordCallbacks",void 0),e([c()],J.prototype,"relationshipId",null),e([c()],J.prototype,"spatialReference",null),e([c()],J.prototype,"state",null),e([c()],J.prototype,"strict",void 0),e([c()],J.prototype,"submittable",null),e([c()],J.prototype,"timeZone",null),e([c()],J.prototype,"updating",null),e([c()],J.prototype,"valid",null),e([c()],J.prototype,"hasPendingSubtypeChoice",void 0),e([c()],J.prototype,"getValues",null),e([c()],J.prototype,"submit",null),J=e([d(z)],J);const Y=J;export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{equalsShallow as n}from"../../core/lang.js";import r from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as s}from"../../form/support/formUtils.js";import{DomainValidationError as l}from"../../layers/support/domainUtils.js";import{isTimeOnlyField as u,NumericRangeValidationError as a,TypeValidationError as p}from"../../layers/support/fieldUtils.js";import{isAnyDateField as m}from"../../smartMapping/support/utils.js";import{getLabelForDateFieldValue as d,getIntlOptionsForField as c}from"../support/dateUtils.js";import{substitute as f}from"../../intl/substitute.js";const y=e=>"field"===e?.type,b=e=>"group"===e?.type,g=e=>"relationship"===e?.type,x=e=>"text"===e.type,T=e=>!b(e)&&null!=e.group,O=e=>e.reduce(((e,t)=>b(t)?[...e,...t.inputs]:[...e,t]),[]),j=e=>O(e).filter(y),h=e=>O(e).filter(g),v=e=>null!=e&&(E(e,"combo-box")||E(e,"radio-buttons")),E=(e,t)=>null!=e&&e.input?.type===t,V=e=>null!=e&&(E(e,"text-box")||E(e,"text-area")),N=({domain:e,inputType:t="text-box",dataType:n})=>"number"===n&&"text-box"===t&&(!e||"coded-value"!==e.type),F=e=>"items"in e,U={typeFieldName:null,types:[]};function L(t){const{attributes:n,fieldsIndex:r,label:i,timeZone:s}=t;if(!n||"object"!=typeof n)return i;const l=Object.keys(n).filter((e=>o(i,e))),u=l.map((e=>n[e])),a=l.map((e=>r.get(e))).filter(e);return C(i,Z({values:u,fields:a,timeZone:s}))}const _="expression/",A="expr/",I="field/";function R(e){const[t,n]=e.split(_);return""===t&&n?n:(r.getLogger("esri.widgets.FeatureForm/featureFormUtils").error("extractExpressionNameFromString:invalid-input",`The string ${e} is not a valid expression reference of the form '${_}/expressionName'`),"")}function $(e){return`${_}${e}`}function D(e){return`${I}${e}`}function w(e){return e.startsWith(_)}function S(e){return e.startsWith(A)}function Z(e){const{fields:t,values:n}=e,r=e.timeZone??void 0,o=t.map(((e,t)=>{let o=n[t];if(e.domain&&"coded-value"===e.domain.type){const t=e.domain.codedValues.find((e=>e.code===o));t?.name&&(o=t.name)}return(m(e)||u(e))&&(o=d(e,o,{timeZone:r,...c(e)})),[e.name,o]}));return Object.fromEntries(o)}function C(e,t){return i(i(e,(e=>`{${e.toLowerCase()}}`)),Object.fromEntries(Object.entries(t).map((([e,t])=>[e.toLowerCase(),t]))))}const G=e=>e?"subtype-sublayer"===e.type?{typeFieldName:e.parent?.subtypeField,types:e.parent?.subtypes??[]}:"feature"===e.type&&e.subtypes?.length?{typeFieldName:e.subtypeField,types:e.subtypes}:"types"in e&&e.types?{typeFieldName:e.typeIdField,types:e.types.map((({id:e,name:t,domains:n})=>({code:e,name:t,domains:n})))}:U:U,M=(e,t)=>{if(!e)return!0;const{operations:n}=e;switch(t){case"INSERT":return n.supportsAdd;case"UPDATE":case"DELETE":return n.supportsUpdate;default:return!0}};var H;!function(e){e.TOO_SHORT="length-validation-error::too-short",e.TOO_LONG="length-validation-error::too-long"}(H||(H={}));const P={type:"number"},W={type:"number",intlOptions:{notation:"scientific"}};function k(e){return e>=1e7||e<=-1e7}function q(e,{validationErrors:t}){return null!=e.max&&null!=e.min?t.outsideRange:null!=e.max?t.outsideRangeMax:t.outsideRangeMin}const B=(e,t,n)=>{const{dataType:r,error:o,minLength:i,value:s,required:u}=e,m=t?.validationErrors;if(!m||!o)return null;if(u&&null===s)return m.cannotBeNull;if(o===l.VALUE_OUT_OF_RANGE||o===a.OUT_OF_RANGE){const{field:o,range:i}=e,s={type:"date",intlOptions:{timeZone:"date"===o.type&&n?n:void 0,...c(o)}},l=q(i,t);return f(l,i,{format:{max:"date"===r?s:null!=i.max&&k(i.max)?W:P,min:"date"===r?s:null!=i.min&&k(i.min)?W:P}})}return o===l.INVALID_CODED_VALUE?m.invalidCodedValue:o===p.INVALID_TYPE?m.invalidType:o===H.TOO_SHORT?f(m.tooShort,{min:i}):(H.TOO_LONG,null)},Y=e=>{if(!e)return;const t=e.layer,n=t&&"geometryType"in t?t.geometryType:void 0,r=e.geometry?.type;return"polyline"===r||"polyline"===n?"line":"mesh"===r||"mesh"===n||"multipatch"===n?"cube":"multipoint"===r||"multipoint"===n?"point":r||n||"table"},z=e=>{const t=[];if(e.formTemplate){const{description:n,title:r}=e.formTemplate;e.fields?.forEach((e=>{const i=r&&o(r,e.name),s=n&&o(n,e.name);(i||s)&&t.push(e.name)}))}return t};function J(e,t){const n=t??("formTemplate"in e&&e.formTemplate);if(n){return(n.elements?.filter(s)??[]).some((({fieldName:t})=>!e.fieldsIndex.get(t)))}return!1}function K(e,t){return null==e||t.onValue!==e&&t.offValue!==e}function Q(e,n){switch(n.objectType){case"any":return!0;case"null":return null==e;case"code":return e===n.codedValue?.code;case"range":return null!=e&&null!=n.minValue&&null!=n.maxValue&&+e>=n.minValue&&+e<=n.maxValue;default:return t(n.objectType),!1}}function X(e,t,r){if(!e||!("subtypes"in e))return!1;const o=e.subtypes?.find((e=>e.code===r));if(!o)return!1;const i=e.subtypes?.find((e=>e.code===t));return!n(o.defaultValues,i?.defaultValues)&&Object.values(o.defaultValues).some((e=>null!=e))}export{H as LengthValidationError,M as capabilitiesAllowEditType,R as extractExpressionNameFromString,j as flattenFieldInputs,O as flattenInputs,h as flattenRelationshipInputs,J as formTemplateHasInvalidFields,Z as getComputedAttributes,B as getErrorMessageForFieldInput,z as getFieldsInTitleAndDesc,Y as getIconForFeature,G as getNormalizedFeatureTypeInfo,w as isExpressionReference,E as isFieldElementWithInputType,v as isFieldElementWithShowNoValueOptionInput,V as isFieldElementWithTextInput,y as isFieldInput,b as isGroupInput,T as isInputInGroupInput,S as isLegacyFieldMapsExpressionReference,N as isNumberFieldInput,g as isRelationshipInput,F as isTemplateItemGroup,x as isTextElementInput,L as parseFormTemplateString,$ as prependExpressionPrefix,D as prependFieldPrefix,C as substituteFieldTemplatesInString,X as subtypeChangeShouldPrompt,K as valueIsInvalidSwitchValue,Q as valueIsValidContingentValue};
5
+ import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{equalsShallow as n}from"../../core/lang.js";import r from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as s}from"../../form/support/formUtils.js";import{DomainValidationError as l}from"../../layers/support/domainUtils.js";import{isTimeOnlyField as u,NumericRangeValidationError as a,TypeValidationError as p}from"../../layers/support/fieldUtils.js";import{isAnyDateField as m}from"../../smartMapping/support/utils.js";import{getLabelForDateFieldValue as d,getIntlOptionsForField as c}from"../support/dateUtils.js";import{substitute as f}from"../../intl/substitute.js";const y=e=>"field"===e?.type,b=e=>"group"===e?.type,g=e=>"relationship"===e?.type,x=e=>"text"===e.type,T=e=>!b(e)&&null!=e.group,O=e=>e.reduce(((e,t)=>b(t)?[...e,...t.inputs]:[...e,t]),[]),j=e=>O(e).filter(y),N=e=>O(e).filter(g),h=e=>null!=e&&(v(e,"combo-box")||v(e,"radio-buttons")),v=(e,t)=>null!=e&&e.input?.type===t,F=e=>null!=e&&(v(e,"text-box")||v(e,"text-area")),E=({domain:e,inputType:t="text-box",dataType:n})=>"number"===n&&"text-box"===t&&(!e||"coded-value"!==e.type),V=e=>"items"in e;function U(t){const{attributes:n,fieldsIndex:r,label:i,timeZone:s}=t;if(!n||"object"!=typeof n)return i;const l=Object.keys(n).filter((e=>o(i,e))),u=l.map((e=>n[e])),a=l.map((e=>r.get(e))).filter(e);return Z(i,S({values:u,fields:a,timeZone:s}))}const L="expression/",_="expr/",A="field/";function I(e){const[t,n]=e.split(L);return""===t&&n?n:(r.getLogger("esri.widgets.FeatureForm/featureFormUtils").error("extractExpressionNameFromString:invalid-input",`The string ${e} is not a valid expression reference of the form '${L}/expressionName'`),"")}function R(e){return`${L}${e}`}function $(e){return`${A}${e}`}function D(e){return e.startsWith(L)}function w(e){return e.startsWith(_)}function S(e){const{fields:t,values:n}=e,r=e.timeZone??void 0,o=t.map(((e,t)=>{let o=n[t];if(e.domain&&"coded-value"===e.domain.type){const t=e.domain.codedValues.find((e=>e.code===o));t?.name&&(o=t.name)}return(m(e)||u(e))&&(o=d(e,o,{timeZone:r,...c(e)})),[e.name,o]}));return Object.fromEntries(o)}function Z(e,t){return i(i(e,(e=>`{${e.toLowerCase()}}`)),Object.fromEntries(Object.entries(t).map((([e,t])=>[e.toLowerCase(),t]))))}const C=e=>{const t={typeFieldName:null,types:[]};return e?("subtype-sublayer"===e.type?(t.typeFieldName=e.parent?.subtypeField,t.types=e.parent?.subtypes??[]):"subtype-group"===e.type||"feature"===e.type&&e.subtypes?.length?(t.typeFieldName=e.subtypeField,t.types=e.subtypes??[]):"types"in e&&e.types&&(t.typeFieldName=e.typeIdField,t.types=e.types.map((({id:e,name:t,domains:n})=>({code:e,name:t,domains:n})))),null!=t.typeFieldName&&(t.typeFieldName=e.getField(t.typeFieldName)?.name??t.typeFieldName),t):t},G=(e,t)=>{if(!e)return!0;const{operations:n}=e;switch(t){case"INSERT":return n.supportsAdd;case"UPDATE":case"DELETE":return n.supportsUpdate;default:return!0}};var M;!function(e){e.TOO_SHORT="length-validation-error::too-short",e.TOO_LONG="length-validation-error::too-long"}(M||(M={}));const H={type:"number"},P={type:"number",intlOptions:{notation:"scientific"}};function W(e){return e>=1e7||e<=-1e7}function k(e,{validationErrors:t}){return null!=e.max&&null!=e.min?t.outsideRange:null!=e.max?t.outsideRangeMax:t.outsideRangeMin}const q=(e,t,n)=>{const{dataType:r,error:o,minLength:i,value:s,required:u}=e,m=t?.validationErrors;if(!m||!o)return null;if(u&&null===s)return m.cannotBeNull;if(o===l.VALUE_OUT_OF_RANGE||o===a.OUT_OF_RANGE){const{field:o,range:i}=e,s={type:"date",intlOptions:{timeZone:"date"===o.type&&n?n:void 0,...c(o)}},l=k(i,t);return f(l,i,{format:{max:"date"===r?s:null!=i.max&&W(i.max)?P:H,min:"date"===r?s:null!=i.min&&W(i.min)?P:H}})}return o===l.INVALID_CODED_VALUE?m.invalidCodedValue:o===p.INVALID_TYPE?m.invalidType:o===M.TOO_SHORT?f(m.tooShort,{min:i}):(M.TOO_LONG,null)},B=e=>{if(!e)return;const t=e.layer,n=t&&"geometryType"in t?t.geometryType:void 0,r=e.geometry?.type;return"polyline"===r||"polyline"===n?"line":"mesh"===r||"mesh"===n||"multipatch"===n?"cube":"multipoint"===r||"multipoint"===n?"point":r||n||"table"},Y=e=>{const t=[];if(e.formTemplate){const{description:n,title:r}=e.formTemplate;e.fields?.forEach((e=>{const i=r&&o(r,e.name),s=n&&o(n,e.name);(i||s)&&t.push(e.name)}))}return t};function z(e,t){const n=t??("formTemplate"in e&&e.formTemplate);if(n){return(n.elements?.filter(s)??[]).some((({fieldName:t})=>!e.fieldsIndex.get(t)))}return!1}function J(e,t){return null==e||t.onValue!==e&&t.offValue!==e}function K(e,n){switch(n.objectType){case"any":return!0;case"null":return null==e;case"code":return e===n.codedValue?.code;case"range":return null!=e&&null!=n.minValue&&null!=n.maxValue&&+e>=n.minValue&&+e<=n.maxValue;default:return t(n.objectType),!1}}function Q(e,t,r){if(!e||!("subtypes"in e))return!1;const o=e.subtypes?.find((e=>e.code===r));if(!o)return!1;const i=e.subtypes?.find((e=>e.code===t));return!n(o.defaultValues,i?.defaultValues)&&Object.values(o.defaultValues).some((e=>null!=e))}export{M as LengthValidationError,G as capabilitiesAllowEditType,I as extractExpressionNameFromString,j as flattenFieldInputs,O as flattenInputs,N as flattenRelationshipInputs,z as formTemplateHasInvalidFields,S as getComputedAttributes,q as getErrorMessageForFieldInput,Y as getFieldsInTitleAndDesc,B as getIconForFeature,C as getNormalizedFeatureTypeInfo,D as isExpressionReference,v as isFieldElementWithInputType,h as isFieldElementWithShowNoValueOptionInput,F as isFieldElementWithTextInput,y as isFieldInput,b as isGroupInput,T as isInputInGroupInput,w as isLegacyFieldMapsExpressionReference,E as isNumberFieldInput,g as isRelationshipInput,V as isTemplateItemGroup,x as isTextElementInput,U as parseFormTemplateString,R as prependExpressionPrefix,$ as prependFieldPrefix,Z as substituteFieldTemplatesInString,Q as subtypeChangeShouldPrompt,J as valueIsInvalidSwitchValue,K as valueIsValidContingentValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{autoLink as s}from"../../support/uriUtils.js";import{renderingSanitizer as r}from"../../support/widgetUtils.js";const l="esri-column",c={sorter:`${l}__sorter`,headerContent:`${l}__header-content`,headerLabel:`${l}__header-label`,headerMenuIcon:`${l}__header-menu-icon`};let a=class extends t.EventedAccessor{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=e=>{const{rowData:t,value:o}=e,{formatFunction:n}=this,i=r.sanitize(o);if(n&&t){const{index:e,item:{feature:o}}=t;return n({column:this,feature:o,index:e,value:i})}return i},this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,o=this.createHeaderContent();this.removeCellContent(t),t.appendChild(o)},this.hidden=!1,this.icon=null,this.initialSortPriority=null,this.label=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,column:t,rowData:o})=>{const n=this.getCellValue(t,o),i=this.cellValueFormatFunction({column:t,rowData:o,value:n});let r=null;r=i instanceof HTMLElement?i:s(this.messagesURIUtils,i),this.removeCellContent(e),r instanceof HTMLElement?e.appendChild(r):null!=r&&(e.innerHTML=r.toString())},this.resizable=!0,this.sortable=!1,this.store=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.timeZoneName=null,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([o((()=>this.direction),(e=>{const{sortElement:t}=this;this.sortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))})),o((()=>this.hidden),(()=>this.closeMenu())),o((()=>this.fieldName),(e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)})),o((()=>this.effectiveLabel),(e=>{const{sortElement:t}=this;t&&t.textContent!==e&&(t.setAttribute("title",e),t.textContent=e)}))])}get customMenuItems(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:o,iconClass:n,label:i,selected:s,clickFunction:r})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:n,iconStart:o,selected:s,textContent:i,onclick:e=>r(e)})))??[]}get defaultMenuItems(){if(!this.sortable)return[];const e=this.messages,t=[],o=this.visibleElements?.columnMenuItems;if(!1!==o?.sortAscending){const o=this.createCalciteDropdownItem({iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(o)}if(!1!==o?.sortDescending){const o=this.createCalciteDropdownItem({iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(o)}return t}get effectiveLabel(){return r.sanitize(this.label||this.fieldName)}get iconNode(){const{icon:e}=this;return e?this.createCalciteIcon({icon:e}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:o}=this,n=!!o?.open,i=this.createCalciteAction({icon:o?.icon??"ellipsis",text:this.messages?.menu??"",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=o?.maxItems??4,s.placement="top-end",s.overlayPositioning="fixed",s.scale=o?.scale??"m",s.widthScale="s",n&&(s.open=n,this._menuIsOpen=!0),s.appendChild(i),s.addEventListener("calciteDropdownOpen",(()=>this._menuIsOpen=!0)),s.addEventListener("calciteDropdownClose",(()=>this._menuIsOpen=!1)),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",(e=>{e.stopPropagation()})),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=o?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}closeMenu(){this.menu.open=!1}getCellValue(e,t){return e.path&&t?.item?t.item[e.path]:""}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:o,initialSortPriority:n}=this,i=document.createElement("vaadin-grid-sorter");return i.classList.add(c.sorter),i.setAttribute("path",o),i.setAttribute("title",e),i.textContent=e,t&&i.setAttribute("direction",t),null!=n&&(i._initialOrder=n),i.addEventListener("direction-changed",(()=>{this.direction!==i.direction&&this._set("direction",i.direction)})),i}createCalciteAction(e){const t=document.createElement("calcite-action"),{className:o,disabled:n,icon:i,label:s,scale:r,slot:l,text:c,textEnabled:a,onclick:d}=e;return t.className=o??"",t.disabled=!!n,t.icon=i??"",t.label=s??"",t.scale=r??"s",t.slot=l??"",t.text=t.title=c??"",t.textEnabled=!!a,t.onclick=d??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{appearance:o,className:n,disabled:i,iconEnd:s,iconFlipRtl:r,loading:l,onclick:c,scale:a,textContent:d}=e;return t.className=n??"",t.scale=a??"s",t.appearance=o??"transparent",t.disabled=!!i,t.iconEnd=s??"",r&&(t.iconFlipRtl=r),t.loading=!!l,t.textContent=t.title=d??"",t.onclick=c??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:o,hidden:n,iconClass:i,iconStart:s,textContent:r,onclick:l,selected:a}=e,d=r??"";if(i&&!s){const e=document.createElement("span"),o=document.createElement("span");o.classList.add(c.headerMenuIcon,i),e.textContent=e.title=d,e.insertBefore(o,e.firstChild),t.appendChild(e)}else t.iconStart=s??"",t.textContent=t.title=d;return t.disabled=!!o,t.hidden="function"==typeof n?n():!!n,t.selected=!!a,l&&(t.addEventListener("calciteDropdownItemSelect",l),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:o,scale:n,textLabel:i}=e,s=document.createElement("calcite-icon"),r=i??t;return s.icon=o,s.scale=n??"s",s.textLabel=r,s.title=r,s}createHeaderContent(){const{effectiveLabel:e,iconNode:t}=this,o=document.createElement("div");if(o.classList.add(c.headerContent),t&&o.appendChild(t),this.sortable)o.appendChild(this.sortElement);else if(""!==e){const t=document.createElement("div");t.classList.add(c.headerLabel);const n=t.appendChild(document.createElement("span"));n.textContent=e,n.setAttribute("title",e),o.appendChild(t)}return this.menuIsVisible&&o.appendChild(this.menu),o}removeCellContent(e){if(e&&e.firstChild)try{for(;e?.firstChild;)e?.removeChild(e.firstChild)}catch(t){}}openMenu(){this.menuIsVisible&&(this.menu.open=!0,this.menuItems[0]?.setFocus())}sort(){this.sortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}};e([n()],a.prototype,"_menuIsOpen",void 0),e([n()],a.prototype,"autoWidth",void 0),e([n()],a.prototype,"cellValueFormatFunction",void 0),e([n()],a.prototype,"customMenuItems",null),e([n()],a.prototype,"defaultMenuItems",null),e([n()],a.prototype,"direction",void 0),e([n()],a.prototype,"effectiveLabel",null),e([n({constructOnly:!0})],a.prototype,"fieldName",void 0),e([n()],a.prototype,"flexGrow",void 0),e([n()],a.prototype,"footerRenderFunction",void 0),e([n()],a.prototype,"formatFunction",void 0),e([n()],a.prototype,"frozen",void 0),e([n()],a.prototype,"frozenToEnd",void 0),e([n()],a.prototype,"grid",void 0),e([n()],a.prototype,"iconNode",null),e([n()],a.prototype,"invalid",null),e([n()],a.prototype,"headerRenderFunction",void 0),e([n()],a.prototype,"hidden",void 0),e([n()],a.prototype,"icon",void 0),e([n({constructOnly:!0})],a.prototype,"initialSortPriority",void 0),e([n()],a.prototype,"label",void 0),e([n()],a.prototype,"menu",null),e([n()],a.prototype,"menuItems",null),e([n()],a.prototype,"menuConfig",void 0),e([n()],a.prototype,"menuIsOpen",null),e([n()],a.prototype,"menuIsVisible",null),e([n()],a.prototype,"messages",void 0),e([n()],a.prototype,"messagesCommon",void 0),e([n()],a.prototype,"messagesURIUtils",void 0),e([n()],a.prototype,"renderFunction",void 0),e([n()],a.prototype,"resizable",void 0),e([n()],a.prototype,"sortable",void 0),e([n({readOnly:!0})],a.prototype,"sortElement",void 0),e([n()],a.prototype,"store",void 0),e([n()],a.prototype,"textAlign",void 0),e([n()],a.prototype,"textWrap",void 0),e([n()],a.prototype,"timeZone",void 0),e([n()],a.prototype,"timeZoneName",void 0),e([n()],a.prototype,"visibleElements",void 0),e([n()],a.prototype,"width",void 0),a=e([i("esri.widgets.FeatureTable.Grid.Column")],a);const d=a;export{d as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{autoLink as s}from"../../support/uriUtils.js";import{renderingSanitizer as r}from"../../support/widgetUtils.js";const l="esri-column",c={sorter:`${l}__sorter`,headerContent:`${l}__header-content`,headerLabel:`${l}__header-label`,headerMenuIcon:`${l}__header-menu-icon`};let a=class extends t.EventedAccessor{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=e=>{const{rowData:t,value:o}=e,{formatFunction:n}=this,i=r.sanitize(o);if(n&&t){const{index:e,item:{feature:o}}=t;return n({column:this,feature:o,index:e,value:i})}return i},this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,o=this.createHeaderContent();this.removeCellContent(t),t.appendChild(o)},this.hidden=!1,this.icon=null,this.initialSortPriority=null,this.label=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,column:t,rowData:o})=>{const n=this.getCellValue(t,o),i=this.cellValueFormatFunction({column:t,rowData:o,value:n});let r=null;r=i instanceof HTMLElement?i:s(this.messagesURIUtils,i),this.removeCellContent(e),r instanceof HTMLElement?e.appendChild(r):null!=r&&(e.innerHTML=r.toString())},this.resizable=!0,this.sortable=!1,this.store=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.timeZoneName=null,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([o((()=>this.direction),(e=>{const{sortElement:t}=this;this.sortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))})),o((()=>this.hidden),(()=>this.closeMenu())),o((()=>this.fieldName),(e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)})),o((()=>this.effectiveLabel),(e=>{const{sortElement:t}=this;t&&t.textContent!==e&&(t.setAttribute("title",e),t.textContent=e)}))])}get customMenuItems(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:o,iconClass:n,label:i,selected:s,clickFunction:r})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:n,iconStart:o,selected:s,textContent:i,onclick:e=>r(e)})))??[]}get defaultMenuItems(){if(!this.sortable)return[];const e=this.messages,t=[],o=this.visibleElements?.columnMenuItems;if(!1!==o?.sortAscending){const o=this.createCalciteDropdownItem({iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(o)}if(!1!==o?.sortDescending){const o=this.createCalciteDropdownItem({iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(o)}return t}get effectiveLabel(){return r.sanitize(this.label||this.fieldName)}get iconNode(){const{icon:e}=this;return e?this.createCalciteIcon({icon:e}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:o}=this,n=!!o?.open,i=this.createCalciteAction({icon:o?.icon??"ellipsis",text:this.messages?.menu??"",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=o?.maxItems??4,s.placement="top-end",s.overlayPositioning="fixed",s.scale=o?.scale??"m",n&&(s.open=n,this._menuIsOpen=!0),s.appendChild(i),s.addEventListener("calciteDropdownOpen",(()=>this._menuIsOpen=!0)),s.addEventListener("calciteDropdownClose",(()=>this._menuIsOpen=!1)),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",(e=>{e.stopPropagation()})),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=o?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}closeMenu(){this.menu.open=!1}getCellValue(e,t){return e.path&&t?.item?t.item[e.path]:""}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:o,initialSortPriority:n}=this,i=document.createElement("vaadin-grid-sorter");return i.classList.add(c.sorter),i.setAttribute("path",o),i.setAttribute("title",e),i.textContent=e,t&&i.setAttribute("direction",t),null!=n&&(i._initialOrder=n),i.addEventListener("direction-changed",(()=>{this.direction!==i.direction&&this._set("direction",i.direction)})),i}createCalciteAction(e){const t=document.createElement("calcite-action"),{className:o,disabled:n,icon:i,label:s,scale:r,slot:l,text:c,textEnabled:a,onclick:d}=e;return t.className=o??"",t.disabled=!!n,t.icon=i??"",t.label=s??"",t.scale=r??"s",t.slot=l??"",t.text=t.title=c??"",t.textEnabled=!!a,t.onclick=d??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{appearance:o,className:n,disabled:i,iconEnd:s,iconFlipRtl:r,loading:l,onclick:c,scale:a,textContent:d}=e;return t.className=n??"",t.scale=a??"s",t.appearance=o??"transparent",t.disabled=!!i,t.iconEnd=s??"",r&&(t.iconFlipRtl=r),t.loading=!!l,t.textContent=t.title=d??"",t.onclick=c??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:o,hidden:n,iconClass:i,iconStart:s,textContent:r,onclick:l,selected:a}=e,d=r??"";if(i&&!s){const e=document.createElement("span"),o=document.createElement("span");o.classList.add(c.headerMenuIcon,i),e.textContent=e.title=d,e.insertBefore(o,e.firstChild),t.appendChild(e)}else t.iconStart=s??"",t.textContent=t.title=d;return t.disabled=!!o,t.hidden="function"==typeof n?n():!!n,t.selected=!!a,l&&(t.addEventListener("calciteDropdownItemSelect",l),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:o,scale:n,textLabel:i}=e,s=document.createElement("calcite-icon"),r=i??t;return s.icon=o,s.scale=n??"s",s.textLabel=r,s.title=r,s}createHeaderContent(){const{effectiveLabel:e,iconNode:t}=this,o=document.createElement("div");if(o.classList.add(c.headerContent),t&&o.appendChild(t),this.sortable)o.appendChild(this.sortElement);else if(""!==e){const t=document.createElement("div");t.classList.add(c.headerLabel);const n=t.appendChild(document.createElement("span"));n.textContent=e,n.setAttribute("title",e),o.appendChild(t)}return this.menuIsVisible&&o.appendChild(this.menu),o}removeCellContent(e){if(e&&e.firstChild)try{for(;e?.firstChild;)e?.removeChild(e.firstChild)}catch(t){}}openMenu(){this.menuIsVisible&&(this.menu.open=!0,this.menuItems[0]?.setFocus())}sort(){this.sortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}};e([n()],a.prototype,"_menuIsOpen",void 0),e([n()],a.prototype,"autoWidth",void 0),e([n()],a.prototype,"cellValueFormatFunction",void 0),e([n()],a.prototype,"customMenuItems",null),e([n()],a.prototype,"defaultMenuItems",null),e([n()],a.prototype,"direction",void 0),e([n()],a.prototype,"effectiveLabel",null),e([n({constructOnly:!0})],a.prototype,"fieldName",void 0),e([n()],a.prototype,"flexGrow",void 0),e([n()],a.prototype,"footerRenderFunction",void 0),e([n()],a.prototype,"formatFunction",void 0),e([n()],a.prototype,"frozen",void 0),e([n()],a.prototype,"frozenToEnd",void 0),e([n()],a.prototype,"grid",void 0),e([n()],a.prototype,"iconNode",null),e([n()],a.prototype,"invalid",null),e([n()],a.prototype,"headerRenderFunction",void 0),e([n()],a.prototype,"hidden",void 0),e([n()],a.prototype,"icon",void 0),e([n({constructOnly:!0})],a.prototype,"initialSortPriority",void 0),e([n()],a.prototype,"label",void 0),e([n()],a.prototype,"menu",null),e([n()],a.prototype,"menuItems",null),e([n()],a.prototype,"menuConfig",void 0),e([n()],a.prototype,"menuIsOpen",null),e([n()],a.prototype,"menuIsVisible",null),e([n()],a.prototype,"messages",void 0),e([n()],a.prototype,"messagesCommon",void 0),e([n()],a.prototype,"messagesURIUtils",void 0),e([n()],a.prototype,"renderFunction",void 0),e([n()],a.prototype,"resizable",void 0),e([n()],a.prototype,"sortable",void 0),e([n({readOnly:!0})],a.prototype,"sortElement",void 0),e([n()],a.prototype,"store",void 0),e([n()],a.prototype,"textAlign",void 0),e([n()],a.prototype,"textWrap",void 0),e([n()],a.prototype,"timeZone",void 0),e([n()],a.prototype,"timeZoneName",void 0),e([n()],a.prototype,"visibleElements",void 0),e([n()],a.prototype,"width",void 0),a=e([i("esri.widgets.FeatureTable.Grid.Column")],a);const d=a;export{d as default};