@arcgis/core 4.31.0-next.20240921 → 4.31.0-next.20240922

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/1810cb638ca1d52de7b2.js +1 -0
  3. package/assets/esri/core/workers/chunks/{69f6f35b04c722aba8cf.js → 238897e72fedd6754af7.js} +1 -1
  4. package/assets/esri/core/workers/chunks/2807eb7bfe4868fe840f.js +1 -0
  5. package/assets/esri/core/workers/chunks/{6c07116c8f7361780803.js → 2b04d2f8466d16a24a80.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{83649583139b818d4dfa.js → 356f6cc122287412b888.js} +1 -1
  7. package/assets/esri/core/workers/chunks/36a1de3752ff13d77b4d.js +1 -0
  8. package/assets/esri/core/workers/chunks/{f14cefc311a21116d21b.js → 4c0d37b799edae391ab2.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{16eda85f728423c4ed02.js → 4ea08495271f6d291b05.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{cf147f34032a8d07f322.js → 53becb5fe10f7f38311f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{24d45530fe47b3114daf.js → 5652ff08dcc5afd3d739.js} +1 -1
  12. package/assets/esri/core/workers/chunks/5fe1f8881959df0e61ce.js +1 -0
  13. package/assets/esri/core/workers/chunks/62f4eda8a9f4de481dcb.js +1 -0
  14. package/assets/esri/core/workers/chunks/{3fa3e1e6595668ca0e18.js → 686613864dd54d1cae3c.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{5d0d36230a5b8309c9e4.js → 75bf6dff29056a5a1242.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{a7bd5bb21a7f3030ee13.js → 783d66397f16899dd0e9.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{2658205b1ab2502c0bc7.js → 856c82a20027435fd306.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{99944b05d3142903511c.js → 93fb720bbfb3628f9c71.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{14f77efbfba0ca9efb6c.js → 9dce33a9bcfb852a74d3.js} +1 -1
  20. package/assets/esri/core/workers/chunks/abdb6f02351250a776ff.js +1 -0
  21. package/assets/esri/core/workers/chunks/{de7e197223471c7b66a7.js → afb35deb035c9c9225c9.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{5f9beed2a9599b9ce649.js → bc37c0dc14ea54f1b9e8.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{35f92652df2561845d47.js → c9aa8df2f62e6d40b771.js} +1 -1
  24. package/assets/esri/core/workers/chunks/d8435cc010bd2260feec.js +1 -0
  25. package/assets/esri/core/workers/chunks/e5a8ab8d02a616469f1d.js +1 -0
  26. package/assets/esri/core/workers/chunks/f1446e56c35e59b904e1.js +1 -0
  27. package/assets/esri/core/workers/chunks/{6508ff21b0a5725629eb.js → fa3f9691a9bd1bbb25d3.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{008f290833724454160d.js → fab59ee41f96b2378768.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{67ea066a903f5ad31155.js → fe709db8238127f91e59.js} +1 -1
  30. package/layers/FeatureLayer.js +1 -1
  31. package/layers/SubtypeGroupLayer.js +1 -1
  32. package/layers/support/SubtypeSublayer.js +1 -1
  33. package/layers/support/featureLayerUtils.js +1 -1
  34. package/package.json +1 -1
  35. package/support/revision.js +1 -1
  36. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  37. package/assets/esri/core/workers/chunks/0eb789af3c26fecdf3be.js +0 -1
  38. package/assets/esri/core/workers/chunks/41a3c7d286a050002d20.js +0 -1
  39. package/assets/esri/core/workers/chunks/59e4731d246203e94a96.js +0 -1
  40. package/assets/esri/core/workers/chunks/69c09478c899cd5e5013.js +0 -1
  41. package/assets/esri/core/workers/chunks/7088f771163fda53d196.js +0 -1
  42. package/assets/esri/core/workers/chunks/79ed119c70ce6ea02f71.js +0 -1
  43. package/assets/esri/core/workers/chunks/eeacd5fa9fb9b1dee5f7.js +0 -1
  44. package/assets/esri/core/workers/chunks/f7c96d34c70ed36da7c2.js +0 -1
  45. package/assets/esri/core/workers/chunks/f9e90a2fda559ca68848.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import s from"../../core/Logger.js";import{ClonableMixin as a}from"../../core/Clonable.js";import"../../core/has.js";import l from"../../core/Error.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as d}from"../../core/lang.js";import u from"../../core/Loadable.js";import{MultiOriginJSONMixin as y}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../../core/object.js";import{sqlAnd as m}from"../../core/sql.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{createTypeReader as j}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import v from"../../form/FormTemplate.js";import w from"../../geometry/SpatialReference.js";import{labelsVisible as F,legendEnabled as O,minScale as I,maxScale as S,popupEnabled as T}from"./commonProperties.js";import{createQuery as C}from"./featureLayerUtils.js";import R from"./FeatureTemplate.js";import{defineFieldProperties as q}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import A from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import P from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as L,defaultPolylineSymbol2D as G,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";const N={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},U=q(),$=j({types:N});let k=0;function M(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function _(e){return new o({symbol:B(e)})}function B(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return G.clone();case"polygon":case"multipatch":return L.clone();default:return null}}function H(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function Q(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=Q(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new R({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let J=class extends(y(a(p(u)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${k++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const a=o?.fields?.find((e=>e.name===t));if(!a)return;const l={name:t};let p=!1;r!==a.alias&&(l.alias=r,p=!0),i!==a.editable&&(l.editable=i,p=!0),n.push(l),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=d(e);n?.length&&c(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),a=s?.defaultValues,l=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=a?.[i]??null;e.defaultValue=i===n?r:s;const u=l?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(X("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?_(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=$(i,t,r);let s;const{subtypeCode:a}=this;if(null!=a&&H(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(a)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:$(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??w.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=Q(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw X("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw X("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw X("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw X("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw X("createQuery");const e=C(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=m(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw X("queryAttachments");const i=e.clone();return i.where=K(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatureCount");return r.parent.queryFeatureCount(W(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatures");return r.parent.queryFeatures(W(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw X("queryObjectIds");return r.parent.queryObjectIds(W(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([f({readOnly:!0,json:{read:!1}})],J.prototype,"capabilities",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"effectiveCapabilities",null),e([f({json:{write:{ignoreOrigin:!0}}})],J.prototype,"charts",void 0),e([f({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],J.prototype,"editingEnabled",void 0),e([f({type:Boolean,readOnly:!0})],J.prototype,"effectiveEditingEnabled",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"elevationInfo",null),e([f({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],J.prototype,"fieldOverrides",void 0),e([g("fieldOverrides")],J.prototype,"writeFieldOverrides",null),e([f({...U.fields,readOnly:!0,json:{read:!1}})],J.prototype,"fields",null),e([f(U.fieldsIndex)],J.prototype,"fieldsIndex",void 0),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"floorInfo",null),e([f({type:v,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],J.prototype,"formTemplate",void 0),e([f({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],J.prototype,"id",void 0),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"geometryType",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"type",void 0),e([f(M(d(F)))],J.prototype,"labelsVisible",void 0),e([f({type:[A],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0}}})],J.prototype,"labelingInfo",void 0),e([f({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],J.prototype,"layerType",void 0),e([f(M(d(O)))],J.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],J.prototype,"listMode",void 0),e([f((()=>{const e=d(I);return e.json.origins.service.read=!1,M(e)})())],J.prototype,"minScale",void 0),e([f((()=>{const e=d(S);return e.json.origins.service.read=!1,M(e)})())],J.prototype,"maxScale",void 0),e([f({readOnly:!0})],J.prototype,"effectiveScaleRange",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"objectIdField",null),e([f({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],J.prototype,"opacity",void 0),e([f({clonable:!1})],J.prototype,"parent",void 0),e([f(M(d(T)))],J.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],J.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],J.prototype,"defaultPopupTemplate",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"relationships",null),e([f({types:N,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],J.prototype,"renderer",null),e([h("service","renderer",["drawingInfo.renderer","subtypeField","type"])],J.prototype,"readRendererFromService",null),e([h("renderer",["layerDefinition.drawingInfo.renderer"])],J.prototype,"readRenderer",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"spatialReference",null),e([f({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],J.prototype,"subtypeCode",void 0),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"subtypeField",null),e([f({type:[R],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],J.prototype,"templates",void 0),e([h("service","templates",["geometryType","subtypeField","subtypes","type"])],J.prototype,"readTemplatesFromService",null),e([f({type:String,json:{write:{ignoreOrigin:!0}}})],J.prototype,"title",void 0),e([h("service","title",["subtypes"])],J.prototype,"readTitleFromService",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"url",null),e([f({readOnly:!0})],J.prototype,"userHasUpdateItemPrivileges",null),e([f({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],J.prototype,"visible",void 0),J=e([b("esri.layers.support.SubtypeSublayer")],J);const W=(e,t,r)=>{if(!r)return t.createQuery();const i=P.from(r);return i.where=K(i.where,e.subtypeField,t.subtypeCode),i},K=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):m(o,n)},X=e=>new l(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Y=J;export{Y as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import n from"../../renderers/SimpleRenderer.js";import o from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import s from"../../core/Logger.js";import{ClonableMixin as a}from"../../core/Clonable.js";import"../../core/has.js";import l from"../../core/Error.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as d}from"../../core/lang.js";import u from"../../core/Loadable.js";import{MultiOriginJSONMixin as y}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../../core/object.js";import{sqlAnd as m}from"../../core/sql.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{createTypeReader as j}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import v from"../../form/FormTemplate.js";import w from"../../geometry/SpatialReference.js";import{labelsVisible as F,legendEnabled as O,minScale as I,maxScale as S,popupEnabled as T}from"./commonProperties.js";import{createQuery as C,getImpliedDomainForTypeOrSubtypeField as R}from"./featureLayerUtils.js";import q from"./FeatureTemplate.js";import{defineFieldProperties as E}from"./fieldProperties.js";import{fixRendererFields as A}from"./fieldUtils.js";import x from"./LabelClass.js";import{reader as P}from"./labelingInfo.js";import D from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as V,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";const U={key:"type",base:i,errorContext:"renderer",typeMap:{simple:n,"unique-value":o,"class-breaks":r}},$=E(),k=j({types:U});let M=0;function _(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function B(e){return new n({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return V.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function Q(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function z(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function J(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},n=z(e,t);if(null!=n){const{defaultValues:e}=n;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new q({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let W=class extends(y(a(p(u)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${M++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return A(this.renderer,this.fieldsIndex),Promise.resolve(this)}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:n}=this;let o;if(i){o=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const a=n?.fields?.find((e=>e.name===t));if(!a)return;const l={name:t};let p=!1;r!==a.alias&&(l.alias=r,p=!0),i!==a.editable&&(l.editable=i,p=!0),o.push(l),p&&e++})),0===e&&o.length===i.length&&(o=null)}else o=d(e);o?.length&&c(r,o,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:n,subtypeField:o}=e,s=n?.find((e=>e.code===r)),a=s?.defaultValues,l=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,n=t?.find((e=>e.name===i));if(e.visible=!t||!!n,n){const{alias:t,editable:r}=n;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=a?.[i]??null;e.defaultValue=i===o?r:s;const u=l?.[i]??null;e.domain=i===o?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){A(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=k(i,t,r);let s;const{subtypeCode:a}=this;if(null!=a&&Q(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(a)));e&&(s=new n({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(s=o);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const n=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return n?void 0:k(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??w.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[J(this.subtypeCode,t)]}readTitleFromService(e,t){const r=z(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw Y("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:n}=this;if(r){const{displayField:e,editFieldsInfo:o,objectIdField:s}=r;t={displayField:e,editFieldsInfo:o,fields:i,objectIdField:s,title:n}}return L(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=C(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=m(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(t?.includeImpliedDomains&&this.parent){const t=R(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatureCount");return r.parent.queryFeatureCount(K(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");return r.parent.queryFeatures(K(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Y("queryObjectIds");return r.parent.queryObjectIds(K(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([f({readOnly:!0,json:{read:!1}})],W.prototype,"capabilities",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"effectiveCapabilities",null),e([f({json:{write:{ignoreOrigin:!0}}})],W.prototype,"charts",void 0),e([f({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],W.prototype,"editingEnabled",void 0),e([f({type:Boolean,readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"elevationInfo",null),e([f({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],W.prototype,"fieldOverrides",void 0),e([g("fieldOverrides")],W.prototype,"writeFieldOverrides",null),e([f({...$.fields,readOnly:!0,json:{read:!1}})],W.prototype,"fields",null),e([f($.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"floorInfo",null),e([f({type:v,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],W.prototype,"formTemplate",void 0),e([f({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"id",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"geometryType",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([f(_(d(F)))],W.prototype,"labelsVisible",void 0),e([f({type:[x],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:P},write:{ignoreOrigin:!0}}})],W.prototype,"labelingInfo",void 0),e([f({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],W.prototype,"layerType",void 0),e([f(_(d(O)))],W.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],W.prototype,"listMode",void 0),e([f((()=>{const e=d(I);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"minScale",void 0),e([f((()=>{const e=d(S);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"maxScale",void 0),e([f({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"objectIdField",null),e([f({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],W.prototype,"opacity",void 0),e([f({clonable:!1})],W.prototype,"parent",void 0),e([f(_(d(T)))],W.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],W.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"relationships",null),e([f({types:U,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],W.prototype,"renderer",null),e([h("service","renderer",["drawingInfo.renderer","subtypeField","type"])],W.prototype,"readRendererFromService",null),e([h("renderer",["layerDefinition.drawingInfo.renderer"])],W.prototype,"readRenderer",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"spatialReference",null),e([f({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"subtypeCode",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"subtypeField",null),e([f({type:[q],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],W.prototype,"templates",void 0),e([h("service","templates",["geometryType","subtypeField","subtypes","type"])],W.prototype,"readTemplatesFromService",null),e([f({type:String,json:{write:{ignoreOrigin:!0}}})],W.prototype,"title",void 0),e([h("service","title",["subtypes"])],W.prototype,"readTitleFromService",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"url",null),e([f({readOnly:!0})],W.prototype,"userHasUpdateItemPrivileges",null),e([f({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],W.prototype,"visible",void 0),W=e([b("esri.layers.support.SubtypeSublayer")],W);const K=(e,t,r)=>{if(!r)return t.createQuery();const i=D.from(r);return i.where=X(i.where,e.subtypeField,t.subtypeCode),i},X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),n=`${t}=${r}`,o=e??"";return i.test(o)?o.replace(i,n):m(n,o)},Y=e=>new l(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Z=W;export{Z 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{id as t}from"../../kernel.js";import{symbolTypesRenderer as e}from"../../symbols.js";import{resultOrAbort as r}from"../../core/asyncUtils.js";import n from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import{parseWhereClause as s}from"../../core/sql.js";import{createTypeReader as i}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{queryAllJSON as a}from"./featureQueryAll.js";import{getOwningPortalUrl as u}from"./layerUtils.js";import c from"../../renderers/SimpleRenderer.js";import l from"../../renderers/UniqueValueRenderer.js";import p from"../../rest/support/AttachmentQuery.js";import d from"../../rest/support/Query.js";import f from"../../rest/support/RelationshipQuery.js";const y=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function m(t,e,r,o){const s=await C(t);if(await h(t,e,o),!s.addAttachment)throw new n(o,"Layer source does not support addAttachment capability");return s.addAttachment(e,r)}function h(t,e,r){const{attributes:o}=e,{objectIdField:s}=t;return t.capabilities?.data?.supportsAttachment?e?o?s&&o[s]?Promise.resolve():Promise.reject(new n(r,`feature is missing the identifying attribute ${s}`)):Promise.reject(new n(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new n(r,"A feature is required to add/delete/update attachments")):Promise.reject(new n(r,"this layer doesn't support attachments"))}async function w(t,e,r,o,s){const i=await C(t);if(await h(t,e,s),!i.updateAttachment)throw new n(s,"Layer source does not support updateAttachment capability");return i.updateAttachment(e,r,o)}async function b(t,e,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await t.load();let s=r;return"feature"===o.type&&o.infoFor3D&&null!=e.deleteFeatures&&null!=o.globalIdField&&(s={...s,globalIdToObjectId:await k(o,e.deleteFeatures,o.globalIdField)}),n(o,o.source,e,r)}async function g(t,e,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await t.load();return n(o,o.source,e,r)}async function I(t,e,r,o){const s=await C(t);if(await h(t,e,o),!s.deleteAttachments)throw new n(o,"Layer source does not support deleteAttachments capability");return s.deleteAttachments(e,r)}async function j(t,e,r){const o=(await t.load({signal:e?.signal})).source;if(!o.fetchRecomputedExtents)throw new n(r,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(e)}async function F(t,e,r,o){e=p.from(e),await t.load();const s=t.source,i=t.capabilities;if(!i?.data?.supportsAttachment)throw new n(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:d,start:f,where:y}=e;if(!i?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||d?.length>0||l||f||y)throw new n(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e)}if(!(u?.length||c?.length||y))throw new n(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);if(!s.queryAttachments)throw new n(o,"Layer source does not support queryAttachments capability",e);return s.queryAttachments(e)}async function q(t,e,r,o){const s=await C(t);if(!s.queryObjectIds)throw new n(o,"Layer source does not support queryObjectIds capability");return s.queryObjectIds(d.from(e)??t.createQuery(),r)}async function x(t,e,r,o){const s=await C(t);if(!s.queryFeatureCount)throw new n(o,"Layer source does not support queryFeatureCount capability");return s.queryFeatureCount(d.from(e)??t.createQuery(),r)}async function A(t,e,r,o){const s=await C(t);if(!s.queryExtent)throw new n(o,"Layer source does not support queryExtent capability");return s.queryExtent(d.from(e)??t.createQuery(),r)}async function v(t,e,r,o){const s=await C(t);if(!s.queryRelatedFeatures)throw new n(o,"Layer source does not support queryRelatedFeatures capability");return s.queryRelatedFeatures(f.from(e),r)}async function S(t,e,r,o){const s=await C(t);if(!s.queryRelatedFeaturesCount)throw new n(o,"Layer source does not support queryRelatedFeaturesCount capability");return s.queryRelatedFeaturesCount(f.from(e),r)}async function O(t){const e=t.source;if(e?.refresh)try{const{dataChanged:r,updates:n}=await e.refresh();if(null!=n&&(t.sourceJSON={...t.sourceJSON,...n},t.read(n,{origin:"service",url:t.parsedUrl})),r)return!0}catch{}if(t.definitionExpression)try{return(await s(t.definitionExpression,t.fieldsIndex)).hasDateFunctions}catch{}return!1}function P(t){const e=new d,r=t.capabilities?.data,n=t.capabilities?.query;e.historicMoment=t.historicMoment,e.gdbVersion=t.gdbVersion,e.returnGeometry=!0,n&&(e.compactGeometryEnabled=n.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=t.returnZ&&(e.returnZ=t.returnZ),r.supportsM&&null!=t.returnM&&(e.returnM=t.returnM)),e.outFields=["*"];const{timeOffset:o,timeExtent:s}=t;return e.timeExtent=null!=o&&null!=s?s.offset(-o.value,o.unit):s||null,e.multipatchOption="multipatch"===t.geometryType?"xyFootprint":null,e}function E(t){const{globalIdField:e,fields:r}=t;if(e)return e;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function L(t){const{objectIdField:e,fields:r}=t;if(e)return e;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function R(t){return t.currentVersion?t.currentVersion:t.hasOwnProperty("capabilities")||t.hasOwnProperty("drawingInfo")||t.hasOwnProperty("hasAttachments")||t.hasOwnProperty("htmlPopupType")||t.hasOwnProperty("relationships")||t.hasOwnProperty("timeInfo")||t.hasOwnProperty("typeIdField")||t.hasOwnProperty("types")?10:9.3}function M(t,e){const{subtypes:r,subtypeField:n}=t;if(!e||!r?.length||!n)return null;const o=e.attributes[n];return null==o?null:r.find((t=>t.code===o))}async function C(t){return(await t.load()).source}async function G(e,r){if(!t)return;if(t.findCredential(e))return;let n;try{const o=await u(e,r);o&&(n=await t.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await t.getCredential(e,{signal:n})}catch(o){}}async function Q(t,e,r){const n=t.parsedUrl?.path;n&&t.authenticationTriggerEvent===e&&await G(n,r)}function D(t){return!N(t)&&(t.userHasUpdateItemPrivileges||t.editingEnabled)}const T=i({types:e});function U(t,e){if(t.defaultSymbol)return t.types?.length?new l({defaultSymbol:T(t.defaultSymbol,t,e),field:t.typeIdField,uniqueValueInfos:t.types.map((t=>({id:t.id,symbol:T(t.symbol,t,e)})))}):new c({symbol:T(t.defaultSymbol,t,e)})}function V(t){let e=t.sourceJSON?.cacheMaxAge;if(!e)return!1;const r=t.editingInfo?.lastEditDate?.getTime();return null==r||(e*=1e3,Date.now()-r<e)}async function k(t,e,n){if(null==e)return null;const o=[],{objectIdField:s}=t;if(e.forEach((t=>{let e=null;if("attributes"in t){const{attributes:r}=t;e={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else e={globalId:t.globalId,objectId:null!=t.objectId&&-1!==t.objectId?t.objectId:null};null!=e.globalId&&(null!=e.objectId&&-1!==e.objectId||o.push(e.globalId))})),0===o.length)return null;const i=t.createQuery();i.where=o.map((t=>`${n}='${t}'`)).join(" OR "),i.returnGeometry=!1,i.outFields=[s,n],i.cacheHint=!1;const u=await r(a(t,i));if(!u.ok)return null;const c=new Map,l=u.value.features;for(const r of l){const t=r.attributes[n],e=r.attributes[s];null!=t&&null!=e&&-1!==e&&c.set(t,e)}return c}function J(t,e,r){if(!e||!r||!t)return null;const n=r.getAttribute(e);return null==n?null:t.find((t=>{const{id:e}=t;return null!=e&&e.toString()===n.toString()}))??null}function N(t){return t.sourceJSON?.isMultiServicesView||$(t)}function $(t){return!!t.sourceJSON?.capabilities?.toLowerCase().split(",").map((t=>t.trim())).includes("map")}function Z(t,e,r){const o=e?.queryBins;if(!o)throw new n(r,"Layer source does not support binning");switch(t.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new n(r,"Layer source does not support auto-interval binning");break;case"date":if(!o.supportsDate)throw new n(r,"Layer source does not support date binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new n(r,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new n(r,"Layer source does not support fixed-interval binning")}const s=o?.supportedStatistics;if(t.outStatistics&&s){const e=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of t.outStatistics){const t=e.get(o);if(t&&!s[t])throw new n(r,`Layer source does not support ${o} statistic type`)}}}export{m as addAttachment,b as applyEdits,D as computeEffectiveEditingEnabled,U as createDefaultRenderer,P as createQuery,I as deleteAttachments,G as ensureCredentialIfSignedIn,Q as ensureLayerCredential,j as fetchRecomputedExtents,y as geometryTypeKebabDict,M as getFeatureSubtype,J as getFeatureType,k as getGlobalIdToObjectIdMap,O as hasDataChanged,V as isLayerCacheStale,F as queryAttachments,A as queryExtent,x as queryFeatureCount,q as queryObjectIds,v as queryRelatedFeatures,S as queryRelatedFeaturesCount,E as readGlobalIdField,L as readObjectIdField,R as readVersion,N as supportsQueryOnly,w as updateAttachment,g as uploadAssets,Z as validateBinsQuery};
5
+ import{id as e}from"../../kernel.js";import{symbolTypesRenderer as t}from"../../symbols.js";import{resultOrAbort as r}from"../../core/asyncUtils.js";import n from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import{parseWhereClause as s}from"../../core/sql.js";import{createTypeReader as i}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as a}from"./CodedValue.js";import u from"./CodedValueDomain.js";import{queryAllJSON as c}from"./featureQueryAll.js";import{getOwningPortalUrl as l}from"./layerUtils.js";import p from"../../renderers/SimpleRenderer.js";import d from"../../renderers/UniqueValueRenderer.js";import f from"../../rest/support/AttachmentQuery.js";import y from"../../rest/support/Query.js";import m from"../../rest/support/RelationshipQuery.js";const h=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function w(e,t,r,o){const s=await G(e);if(await b(e,t,o),!s.addAttachment)throw new n(o,"Layer source does not support addAttachment capability");return s.addAttachment(t,r)}function b(e,t,r){const{attributes:o}=t,{objectIdField:s}=e;return e.capabilities?.data?.supportsAttachment?t?o?s&&o[s]?Promise.resolve():Promise.reject(new n(r,`feature is missing the identifying attribute ${s}`)):Promise.reject(new n(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new n(r,"A feature is required to add/delete/update attachments")):Promise.reject(new n(r,"this layer doesn't support attachments"))}async function g(e,t,r,o,s){const i=await G(e);if(await b(e,t,s),!i.updateAttachment)throw new n(s,"Layer source does not support updateAttachment capability");return i.updateAttachment(t,r,o)}async function I(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let s=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(s={...s,globalIdToObjectId:await $(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function j(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function F(e,t,r,o){const s=await G(e);if(await b(e,t,o),!s.deleteAttachments)throw new n(o,"Layer source does not support deleteAttachments capability");return s.deleteAttachments(t,r)}async function q(e,t,r){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new n(r,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function x(e,t,r,o){t=f.from(t),await e.load();const s=e.source,i=e.capabilities;if(!i?.data?.supportsAttachment)throw new n(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:p,start:d,where:y}=t;if(!i?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||p?.length>0||l||d||y)throw new n(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||c?.length||y))throw new n(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!s.queryAttachments)throw new n(o,"Layer source does not support queryAttachments capability",t);return s.queryAttachments(t)}async function A(e,t,r,o){const s=await G(e);if(!s.queryObjectIds)throw new n(o,"Layer source does not support queryObjectIds capability");return s.queryObjectIds(y.from(t)??e.createQuery(),r)}async function v(e,t,r,o){const s=await G(e);if(!s.queryFeatureCount)throw new n(o,"Layer source does not support queryFeatureCount capability");return s.queryFeatureCount(y.from(t)??e.createQuery(),r)}async function S(e,t,r,o){const s=await G(e);if(!s.queryExtent)throw new n(o,"Layer source does not support queryExtent capability");return s.queryExtent(y.from(t)??e.createQuery(),r)}async function O(e,t,r,o){const s=await G(e);if(!s.queryRelatedFeatures)throw new n(o,"Layer source does not support queryRelatedFeatures capability");return s.queryRelatedFeatures(m.from(t),r)}async function P(e,t,r,o){const s=await G(e);if(!s.queryRelatedFeaturesCount)throw new n(o,"Layer source does not support queryRelatedFeaturesCount capability");return s.queryRelatedFeaturesCount(m.from(t),r)}async function E(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await s(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function L(e){const t=new y,r=e.capabilities?.data,n=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:o,timeExtent:s}=e;return t.timeExtent=null!=o&&null!=s?s.offset(-o.value,o.unit):s||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function C(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function R(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function M(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function V(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function D(e,t){const{fieldsIndex:r,subtypeField:n}=e,o=r.get(t)?.name;if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new a({code:e.code,name:e.name})));if(t?.length)return new u({codedValues:t})}if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===o&&"types"in e&&e.types?.length){const t=e.types.map((e=>new a({code:e.id,name:e.name})));return new u({codedValues:t})}return null}async function G(e){return(await e.load()).source}async function Q(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await l(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function T(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await Q(n,r)}function U(e){return!H(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const k=i({types:t});function J(e,t){if(e.defaultSymbol)return e.types?.length?new d({defaultSymbol:k(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:k(e.symbol,e,t)})))}):new p({symbol:k(e.defaultSymbol,e,t)})}function N(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function $(e,t,n){if(null==t)return null;const o=[],{objectIdField:s}=e;if(t.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const i=e.createQuery();i.where=o.map((e=>`${n}='${e}'`)).join(" OR "),i.returnGeometry=!1,i.outFields=[s,n],i.cacheHint=!1;const a=await r(c(e,i));if(!a.ok)return null;const u=new Map,l=a.value.features;for(const r of l){const e=r.attributes[n],t=r.attributes[s];null!=e&&null!=t&&-1!==t&&u.set(e,t)}return u}function Z(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function H(e){return e.sourceJSON?.isMultiServicesView||z(e)}function z(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function B(e,t,r){const o=t?.queryBins;if(!o)throw new n(r,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new n(r,"Layer source does not support auto-interval binning");break;case"date":if(!o.supportsDate)throw new n(r,"Layer source does not support date binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new n(r,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new n(r,"Layer source does not support fixed-interval binning")}const s=o?.supportedStatistics;if(e.outStatistics&&s){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!s[e])throw new n(r,`Layer source does not support ${o} statistic type`)}}}export{w as addAttachment,I as applyEdits,U as computeEffectiveEditingEnabled,J as createDefaultRenderer,L as createQuery,F as deleteAttachments,Q as ensureCredentialIfSignedIn,T as ensureLayerCredential,q as fetchRecomputedExtents,h as geometryTypeKebabDict,V as getFeatureSubtype,Z as getFeatureType,$ as getGlobalIdToObjectIdMap,D as getImpliedDomainForTypeOrSubtypeField,E as hasDataChanged,N as isLayerCacheStale,x as queryAttachments,S as queryExtent,v as queryFeatureCount,A as queryObjectIds,O as queryRelatedFeatures,P as queryRelatedFeaturesCount,C as readGlobalIdField,R as readObjectIdField,M as readVersion,H as supportsQueryOnly,g as updateAttachment,j as uploadAssets,B as validateBinsQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.31.0-next.20240921",
3
+ "version": "4.31.0-next.20240922",
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.31/esri/copyright.txt for details.
4
4
  */
5
- const a="20240921",c="7a2168859a2cbc136ee3503e46fa34d4f7e1acca";export{a as buildDate,c as commitHash};
5
+ const f="20240922",e="497df6e4b6f0d3d12b3942f6fa19c8b21ae7f3ec";export{f as buildDate,e 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import{isSome as r,equals as i}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedProperty as s}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import{isSerializable as c}from"../../core/JSONSupport.js";import{equalsShallow as u}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{throwIfAborted as y,isAbortError as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as F,watch as b,syncAndInitial as _,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as P}from"../../core/sql.js";import{property as C}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as V}from"../../core/support/UpdatingHandles.js";import{projectWithZConversion as A}from"../../geometry/projection.js";import{isPolygon as j}from"../../geometry/support/jsonUtils.js";import{geographicToWebMercator as M}from"../../geometry/support/webMercatorUtils.js";import O from"../../layers/GraphicsLayer.js";import{searchImages as k}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as B}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as R,computePolygonForInspection as G,resizePolygon as L,checkIfPolygonContainsSelectedPoint as x}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as E}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as H,imageToWorldPanoramic as T}from"../../layers/orientedImagery/transformations/imageToWorld.js";import D from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as U}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as z,convertPixelToHeadingPitch as W,getUpdateElevationProps as N,isElevationSampler as q,getImageToWorldProperties as $,getImageToWorldPanoramicProperties as J,geographicToLTP as K,getWorldToImageProperties as Q,convertHeadingPitchToSphereVertex as X}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as Y,worldToImage as Z}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as ee}from"../../layers/support/floorFilterUtils.js";import te from"../../rest/support/AttachmentQuery.js";import{scale as re}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ie}from"../../views/input/InputManager.js";import ae from"../PanoramicViewer.js";import{invalidCameraHeading as oe,sectorsInOrder as se,sectorsRadii as ne}from"./constants.js";import{crossSymbol as le,crossSymbol3D as ce,sourcePointSymbol as ue,diamondSymbol as he,diamondSymbol3D as pe,activeSourcePointSymbol as me}from"./symbols.js";import{isNoAttachmentError as de,getContentType as ge,isTifOrMrf as ye,filterOILLayerView as fe,isSceneView as ve,isGraphic as we,calculateSegment as Fe,calculateDirection as be}from"./utils.js";import _e from"./components/ImageViewer.js";import Ie from"../../geometry/Point.js";import Pe from"../../geometry/SpatialReference.js";import Ce from"../../symbols/SimpleLineSymbol.js";import Se from"../../geometry/Multipoint.js";import Ve from"../../geometry/Polyline.js";import Ae from"../../geometry/Polygon.js";const je={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles"},Me=new Set(["JPG","JPEG"]),Oe=/\.(\w+)$/,ke=e=>"FA"===e;let Be=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new o,this.additionalCameraLocations=new o,this.additionalFootprints=new o,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.coverageFrustums=new o,this.coveragePolygons=new o,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=()=>{m(this._featureChangedTask),this._featureChangedTask=a((async e=>{const{currentBestFeature:t,selectedPoint:r,view:i}=this;if(i?.closePopup(),t&&r){this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons({signal:e}),await this._loadImage({signal:e})}catch(a){f(a)||(this.loadImageError(a),h.getLogger(this).error("#loadIImage()","error occured while loading image",a))}}}))},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.drawFootprint=()=>{this.bestFeatureFootprint&&this.updateCurrentCoveragePolygon(this.bestFeatureFootprint)},this.features=new o,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.navigatorCurrentBestFeature=null,this.overlayedCameraLocations=new o,this.overlayedMapFeatures=new w,this.pointSources=new o,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new _e,this._initialCurrentCoverageUpdate=!0,this._overlays=new O({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new ae,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._updatingHandles=new V,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find((({attributes:{imageID:t}})=>t===Number(e)));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=a((async e=>{const{currentBestFeature:r,popupEnabled:i,layer:a,view:o}=this;if(o?.closePopup(),!(o&&r&&i&&a))return;const{attributes:s,geometry:n}=r,l=new t({geometry:n,attributes:s.toJSON(),layer:a});y(e),await o.openPopup({features:[l],location:s.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(je.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ie.WIDGET),je.click)},this._createImageClickHandle=()=>{this.removeHandles(je.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:r,currentBestFeature:i,footprintExtent:o}=this,s=r?.imageSize;if(!(e&&"none"!==t&&s&&o&&i))return;r.clickAction="pixel-location";let n=null;const l=F((()=>r),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=a((async r=>{if(!e)return;const a=await this.getMapPoint(e,{feature:i,imageSize:s,mode:t});y(r),this.plotReferencePointOnGround(a)}))}));this.addHandles(l,je.imageClick)},this._getImageSourceFromAttachment=async(e,t,r)=>{const i=new te({objectIds:[t]}),a=await e.queryAttachments(i,r),o=a[`${t}`]?.[0],s=o?.url;if(!s)throw new n("NoAttachmentError","no attachments found",{[e.objectIdField]:t,layer:e});return{datasetFormat:o.contentType.split("/")[1].toUpperCase(),url:s}},this._loadAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/OrientedImageryViewerViewModelAdapter2D.js");y(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/OrientedImageryViewerViewModelAdapter3D.js");y(e),this._adapter=new t(this);break}}else this._adapter=null},this._loadImage=async e=>{const{currentBestFeature:t,layer:r,mode:i}=this;if(this.clearGraphics(),!r||!t||"none"===i)return;const{attributes:a}=t,{imagePath:o,imageRotation:s,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:u,cameraOrientation:p,location:m}=a,d=(l??0)+(s??0),g=m.spatialReference.isWGS84&&4!==p?.type?M(m):new Ie(m);let v=o;if(ke(o))try{v=await this._getImageSourceFromAttachment(r,u,e)}catch(w){if(f(w))return;return de(w)?(h.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${r.objectIdField}: ${u}`)):(h.getLogger(this).error(w,{[r.objectIdField]:u,layer:r}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${r.objectIdField} ${u}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:i,cameraLocation:g}),y(e),await this.transformAndPlotSelectedLocation(e)}catch(w){f(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:r,imageRotation:i,options:a}=t,o="string"==typeof e,s=o?e:e.url,{origin:n,pathname:l,searchParams:c}=new URL(s);let u=o?l.match(Oe)?.[1]??"":e.datasetFormat;if(!u){const e=await ge(s,{...t.options});e&&(u=e.split("/")[1]),u??="UNKNOWN FORMAT"}switch(r){case"default":this._imageViewer.imageSource={datasetFormat:u.toUpperCase(),url:`${n}${l}`},this._imageViewer.customParameters=Object.fromEntries(c),this._imageViewer.imageRotation=i??0,await this._imageViewer.loadImage(a);break;case"panoramic":if(Me.has(u.toUpperCase())){const{selectedPoint:e}=this,{pitch:r,yaw:i,cameraLocation:o,viewAngle:n}=t;this._panoramicViewer.imageSource=s;let l=i??0;"number"==typeof n?l=n-l:o&&e&&(l=await z(o,e)-l),this._panoramicViewer.pitch=r??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(a)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:u});break}},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a((async t=>{const{pointerType:r,button:i,mapPoint:a}=e;if(("mouse"!==r||0===i)&&a)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,r)=>{if(await v(r),!e)return;const i=new Ie({...c(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:le}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:r}=this._panoramicViewer;if(!r)return;const[i,a]=r,{heading:o,pitch:s}=W(e,i,a),n=X(o,s);this._crossSymbol=new t({geometry:new Ie(n,Pe.WebMercator),symbol:ce}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.determineWorkflowForFeature=this.determineWorkflowForFeature.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this),this.drawFootprint=this.drawFootprint.bind(this)}initialize(){this.addHandles([b((()=>this.view),(()=>{this.load()}),_),b((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),I),b((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),I),b((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),b((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),b((()=>this.currentBestFeature),((e,t)=>{this.determineWorkflowForFeature(e,t)}),{sync:!0}),b((()=>this.mode),(e=>{switch(this.removeHandles(je.interactionHandles),e){case"default":this.addHandles(b((()=>this._imageViewer.imagePointsInView),(e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a((async t=>{await this.updateFootprint(e,{signal:t})})))}),{..._,equals:(e,t)=>i(e,t,u)}),je.interactionHandles);break;case"panoramic":this.addHandles(b((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s}=this._panoramicViewer;return e&&r&&"image-loading"!==t?[i,a,s,o]:null}),(e=>{if(!e||"image-loading"===this.state)return;const[t,r,i,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=a((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:r,yaw:i,pitch:o},{signal:e})}))}),{..._,equals:(e,t)=>i(e,t,u)}),je.interactionHandles)}}),_),b((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:r,mode:i,sharpness:a}=this;"default"===i&&(e.brightness=t,e.contrast=r,e.sharpness=a)}),_)])}destroy(){this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy()}get activeLayer(){return s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:r}=this;switch(r){case"default":return e;case"panoramic":return t;default:return null}}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",p(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",p(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){return ye(this.currentBestFeature?.attributes.imagePath.trim())}get imageLoaded(){return s(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===oe}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(fe(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ee(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:r}=e;return 360===t||r?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?se.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",p(e,0,1))}get state(){const{mode:e,disabled:t}=this;if(t)return"disabled";if(!this.isFulfilled())return"loading";if(this.isRejected())return"error";if(this._updatingHandles.updating)return"image-loading";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}return"ready"}get thumbnails(){const{features:e}=this;return e?new o(e.map((({attributes:{imagePath:e,objectId:t,cameraRoll:r,imageRotation:i}})=>{const a=e.trim();return ye(a)?{url:a,objectId:t,rotation:(r??0)+(i??0)}:null})).filter(r)):null}set view(e){this._set("view",e)}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}filterByFootprints(e,t){const r=[],i=[],a=[];return e.forEach((e=>{const{layer:{coveragePercent:o},attributes:s}=e;let n;const{polygon:l,frustum:c}=R(s);if(n=l.clone(),s.isInspection&&(n=G(s)),o&&(n=L(n,o)),x(n,t)){a.push(e);const{geometry:t,objectId:o,cameraHeight:n,cameraHeading:u}=s,h=t.clone();h.z=n,h.imageID=o,this.pointSources.push(h),u!==oe&&(r.push(l),c&&i.push(c))}})),{features:a,polygons:r,frustums:i}}getCurrentCoveragePolygon(){return this.bestFeatureCurrentFootprint}getCurrentBestFeaturePolygon(){return this.bestFeatureFootprint}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[se[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:r}=e;if(isNaN(r))return;const i=this._sectorData?.[t];i?.length&&this._updateCurrentBestFeature(i.at(r))}async load(e){return this.addResolvingPromise(this._loadAdapter(e).catch((e=>{if(!f(e))throw e}))),this}async loadBestImage(e,t){return this.view?.closePopup(),this.displayMessage=null,this.selectedPoint=e.spatialReference.isGeographic?M(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async overlayCameraLocations(e){const{activeViewer:r,currentBestFeature:i,overlayedCameraLocations:a,layer:o,mode:s}=this,n=r?.imageSize;if(!n||!i||!o||"none"===s)return;const{polygon:l}=R(i.attributes);if(r.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await o.queryFeatures({where:`${o.objectIdField} <> ${i.attributes.objectId}`,geometry:l,returnGeometry:!0,outFields:[o.objectIdField]}),c=await Promise.all(e.map((async e=>{const{attributes:r,geometry:a}=e,o=await this.getPixels(a,{feature:i,imageSize:n,mode:s}),l=ue.clone();return l.outline=new Ce({color:[0,0,0],width:1}),new t({attributes:r,symbol:l,geometry:o})})));a.addMany(c),r.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e){const{activeViewer:i,currentBestFeature:a,mode:s}=this,n=i?.imageSize;if(!n||!a||"none"===s)return;const{polygon:l}=R(a.attributes),{features:c}=await e.queryFeatures({geometry:l,returnGeometry:!0,outFields:[e.objectIdField]}),u=new o((await Promise.all(c.map((async r=>{const{attributes:i,geometry:o}=r,l=r.symbol?.clone()??e.renderer?.getSymbol(r).clone();switch(o?.type){case"point":{const r=await this.getPixels(o,{feature:a,imageSize:n,mode:s});return new t({attributes:i,layer:e,symbol:l,geometry:r,visible:e.visible})}case"polygon":{const{rings:r,spatialReference:c}=o,u=r.flatMap((e=>e.map((([e,t,r])=>new Ie({x:e,y:t,z:r,spatialReference:c}))))),h=await this.getPixels(u,{feature:a,imageSize:n,mode:s});return new t({attributes:i,layer:e,symbol:l,geometry:new Ae({rings:[h.map((e=>e.toArray()))],spatialReference:Pe.WebMercator}),visible:e.visible})}case"polyline":{const{paths:r,spatialReference:c}=o,u=r.flatMap((e=>e.map((([e,t,r])=>new Ie({x:e,y:t,z:r,spatialReference:c}))))),h=await this.getPixels(u,{feature:a,imageSize:n,mode:s});return new t({attributes:i,layer:e,symbol:l,geometry:new Ve({paths:[h.map((e=>e.toArray()))],spatialReference:Pe.WebMercator}),visible:e.visible})}case"multipoint":{const{points:r,spatialReference:c}=o,u=r.map((([e,t,r])=>new Ie({x:e,y:t,z:r,spatialReference:c}))),h=await this.getPixels(u,{feature:a,imageSize:n,mode:s});return new t({attributes:i,layer:e,symbol:l,geometry:new Se({points:h.map((e=>e.toArray())),spatialReference:Pe.WebMercator}),visible:e.visible})}}return null})))).filter(r));this.overlayGraphicsOnImage(`${e.id}`,u)}async getPixels(e,t){const{imageSize:r,mode:i}=t,a=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===i)return new Ie({x:e.x-.5,y:.5-e.y,spatialReference:Pe.WebMercator});const[t,a]=r,{heading:o,pitch:s}=W(e,t,a),n=X(o,s);return new Ie(n,Pe.WebMercator)}));return Array.isArray(e)?a:a[0]}async getMapPoint(e,t){const{feature:r,mode:i,imageSize:a}=t,o=await N(r.attributes.cameraHeight,{elevationSample:r.elevationSample,elevationSource:r.attributes.elevationSource,extent:this.footprintExtent});let s;if("elevationSample"in o&&q(o.elevationSample)&&(r.elevationSample=o.elevationSample),"default"===i){const t=$(r.attributes,a);s=await H(Array.isArray(e)?e:[e],t,o)}else{const t=J(r.attributes,a[0],a[1]);s=await T(Array.isArray(e)?e:[e],t,o)}return Array.isArray(e)?s:s[0]}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new Ie({...e.toJSON()}),symbol:he}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage.destroy()),this.mode){case"default":{const r=c(e)?e.toJSON():e;r.x-=.5,r.y=.5-r.y,this._referencePointOnImage=new t({geometry:new Ie({spatialReference:this._imageViewer.imageRenderer.spatialReference.clone(),...r}),symbol:he}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:r}=this._panoramicViewer;if(!r)return;const[i,a]=r,{heading:o,pitch:s}=W(e,i,a),n=X(o,s);this._referencePointOnImage=new t({geometry:new Ie(n,Pe.WebMercator),symbol:pe}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach((e=>{this._imageViewer.removeManyGraphics(e.toArray())})),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this._imageViewer.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}async searchBestImage(e,t){try{const r=await k(e,t);r&&await this._processFeatureResponse(r,e.point,{signal:t?.signal})}catch(r){f(r)||(this.setMessage("imageLoadError","error",r.message),h.getLogger(this).error("error occurred while finding best image",r))}}selectBestFeature(e){this.currentBestFeature=this.features?.find((({attributes:t})=>t.objectId===Number(e)))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const r=this.overlayedMapFeatures.get(e);r&&this._toggleVisiblity(r,t)}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:r}=e,i=this.bestFeatureFootprint?.geometry,a=j(i)&&i.contains(t),o="mesh"===i?.type&&i?.extent.contains(t);if(!a&&!o)return;const s=await this.worldToImage(t,r);return s?(y(r),this.plotReferencePointOnImage(s),{x:s.x,y:s.y}):void 0}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const r=this.layer;if(r){const i={include:r},a=this.view.toScreen(e);if(!a)return;const o=await this.view.hitTest(a,i);return this._processHitTestResults(r,o,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(r){if(f(r))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",r)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:r,features:i,invalidCameraHeading:a}=this;if(!e||!t||!r||!i||a)return void(this._sectorData=null);this._sectorData={};for(const c of se)this._sectorData[c]=new o;const s=e.map(((e,t)=>({...e,featureIndex:t})));s.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const n=s.map((({distance:e})=>e)),l=Math.max(...n);s.forEach((e=>{const{distance:t,angle:r,featureIndex:a}=e,o=t/l*ne[2],s=Fe(t,l),n=be(r);if(!this._sectorData)return;const c=ne[3]+o*Math.sin(r*Math.PI/180),u=ne[3]+o*Math.cos(r*Math.PI/180);let h;const p=i.at(a),m=p===this.currentBestFeature,d=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(m&&d)h=-90;else{const e=c-ne[3],t=u-ne[3],r=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(r)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),h=i}const g=""===s?n:`${s}_${n}`;m&&(h===this.bestFeatureAngle?this.previousFeatureAngle=h:this.bestFeatureAngle=h,this.navigatorCurrentBestFeature=d?null:{x:c,y:u,direction:n});const y=this._sectorData[g];y.add({angle:r,featureIndex:a,x:c,y:u,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}async _processFeatureResponse(e,t,r){const{features:i}=e;if(!i?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:a,polygons:o,frustums:s}=this.filterByFootprints(i,t);if(!a.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(o),this.coverageFrustums.addMany(s),o[0]){const e=new Ae({spatialReference:o[0].spatialReference});for(const{rings:r}of o)e.addRing(r[0]);const t=[];for(const{geometry:r}of a)e.contains(r)||t.push(r);if(e.addRing(t),this.footprintExtent=re(e.extent,2,2),this.view?.supportsGround)try{n=await this.view.map.ground.createElevationSampler(this.footprintExtent,r)}catch(l){f(l)||h.getLogger(this).error(l)}}if((n||a[0].attributes.elevationSource)&&this.footprintExtent){const e=a[0].attributes.elevationSource;E(e)&&!n&&(n=await U({extent:this.footprintExtent,lod:e.lod,url:e.url,rasterFunction:e.rasterFunction}));const r=await N(a[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[i,...o]=await D([t,...a.map((e=>e.attributes.geometry.clone()))],r);a[0].elevationSample=n??r.elevationSample,t.elevation=i.z,a.forEach(((e,t)=>{e.attributes.elevation=o[t].z}))}a[0].elevationSample&&a.forEach((e=>{e.elevationSample=a[0].elevationSample})),this._suitabilities=B({features:a,selectedPoint:t,camera:ve(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,r){const{screenPoint:i,results:[a]}=t,o="graphic"===a?.type&&this.shouldShowSelectedImage,s=a?.mapPoint??this.view?.toMap(i);if(!s)return;const{layerFloorFilterClause:n}=this,l={layerInstanceOrURL:e,point:s,queryParams:{where:P("1=1",P(e.definitionExpression,n)),maximumDistance:e.maximumDistance,objectIds:o?[a.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(l,r)}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}_updateFeatures(e){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this.currentBestFeature=e[0]}async _updatePointsAndPolygons(e){const{pointSources:r,currentBestFeature:i,currentCoverageVisible:a,isAdditionalPointSourcesVisible:o}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),y(e);for(const e of r)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e,symbol:me,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e,symbol:ue,visible:o}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let r;if(t)r=-90;else{const t=e.x-ne[3],i=e.y-ne[3],a=i/Math.sqrt(t**2+i**2);let o=180*Math.acos(a)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(o*=-1),r=o}r===this.bestFeatureAngle?this.previousFeatureAngle=r:this.bestFeatureAngle=r,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics()}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,r,i){this.displayMessage={key:e,type:t,data:r,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:r,selectedPoint:i,state:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=d(this._crossSymbol)),!i||!t||"image-loaded"!==a||r)return;let o;try{o=await this.worldToImage(i,e),y(e),await this.plotSelectedPointOnImage(o,e)}catch(s){f(s)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:s,selectedPoint:i,feature:t})}}async worldToImage(e,t){const{footprintExtent:r}=this,{imageSize:i}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!i||!r)return;const{attributes:{location:a,cameraOrientation:o,elevationSource:s,cameraHeight:n,cameraHeading:l},elevationSample:c}=this.currentBestFeature;let u=a.clone();const h=await N(n,{elevationSample:c,elevationSource:s});this.currentBestFeature.elevationSample=h.elevationSample;let p,m=await D(Array.isArray(e)?e:[e],h);if(a.spatialReference.isGeographic)if(a.spatialReference.isWGS84&&4===o?.type){const{latitude:e,longitude:r,ellipsoidRadius:i,squaredEccentricity:s}=o;u=new Ie(K(a.toArray(),[e,r,i,s]),{wkid:0}),m=await Promise.all(m.map((async a=>new Ie(K((await A(a,Pe.WGS84,t)).toArray(),[e,r,i,s]),{wkid:0}))))}else u=await A(u,Pe.WebMercator,t);if(m=await Promise.all(m.map((async e=>u.spatialReference.equals(e.spatialReference)?e:await A(e,u.spatialReference,t)))),y(t),"panoramic"===this.mode)p=Y(m,{imageHeight:i[1],imageWidth:i[0],cameraHeading:l,cameraLocation:a});else{const e=Q(this.currentBestFeature.attributes,i);p=Z(m,e)}return Array.isArray(e)?p:p[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:r,additionalCameraLocations:i,currentBestFeature:a,currentBestFeatureLocation:o,currentCoverageVisible:s,selectedPoint:n,view:l,_adapter:c}=this,{attributes:{objectId:u},elevationSample:h}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...r,...i,this.bestFeatureCurrentFootprint,o].filter(we);l.supportsGround&&h&&c?.updateGroundElevation&&c.updateGroundElevation(e,h),n&&e.push(new t({geometry:n.clone(),symbol:le.clone(),attributes:{imageID:u}})),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&h&&c?.updateGroundElevation&&c.updateGroundElevation([e],h),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([C()],Be.prototype,"activeLayer",null),e([C({readOnly:!0})],Be.prototype,"activeViewer",null),e([C()],Be.prototype,"additionalFeatures",void 0),e([C({type:o.ofType(t)})],Be.prototype,"additionalCameraLocations",void 0),e([C({type:o.ofType(t)})],Be.prototype,"additionalFootprints",void 0),e([C()],Be.prototype,"bestFeatureAngle",void 0),e([C()],Be.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],Be.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],Be.prototype,"brightness",null),e([C({type:Number})],Be.prototype,"contrast",null),e([C()],Be.prototype,"coverageFrustums",void 0),e([C()],Be.prototype,"coveragePolygons",void 0),e([C()],Be.prototype,"currentBestFeature",void 0),e([C()],Be.prototype,"currentBestFeatureLocation",void 0),e([C()],Be.prototype,"currentCoverageVisible",void 0),e([C({json:{write:!1}})],Be.prototype,"determineWorkflowForFeature",void 0),e([C()],Be.prototype,"disabled",void 0),e([C()],Be.prototype,"displayMessage",void 0),e([C()],Be.prototype,"drawFootprint",void 0),e([C({readOnly:!0})],Be.prototype,"featureCount",null),e([C()],Be.prototype,"features",void 0),e([C({readOnly:!0})],Be.prototype,"imageGalleryEnabled",null),e([C({readOnly:!0})],Be.prototype,"imageLoaded",null),e([C({readOnly:!0})],Be.prototype,"invalidCameraHeading",null),e([C()],Be.prototype,"imagePointsInView",null),e([C()],Be.prototype,"isAdditionalCoverageVisible",void 0),e([C()],Be.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],Be.prototype,"layer",void 0),e([C()],Be.prototype,"layerView",null),e([C({readOnly:!0})],Be.prototype,"layerFloorFilterClause",null),e([C({type:Number})],Be.prototype,"localPort",void 0),e([C()],Be.prototype,"mapImageConversionToolState",void 0),e([C({readOnly:!0,value:"none"})],Be.prototype,"mode",null),e([C()],Be.prototype,"navigatorCurrentBestFeature",void 0),e([C({type:o.ofType(t)})],Be.prototype,"overlayedCameraLocations",void 0),e([C()],Be.prototype,"overlayedMapFeatures",void 0),e([C()],Be.prototype,"pointSources",void 0),e([C({readOnly:!0})],Be.prototype,"popupEnabled",null),e([C()],Be.prototype,"previousFeatureAngle",void 0),e([C()],Be.prototype,"referencePoint",null),e([C({readOnly:!0})],Be.prototype,"sectorData",null),e([C()],Be.prototype,"selectedPoint",void 0),e([C({type:Number})],Be.prototype,"sharpness",null),e([C()],Be.prototype,"shouldShowSelectedImage",void 0),e([C({readOnly:!0})],Be.prototype,"state",null),e([C({readOnly:!0})],Be.prototype,"thumbnails",null),e([C()],Be.prototype,"updateFootprint",void 0),e([C()],Be.prototype,"updateFootprintPanorama",void 0),e([C({value:null})],Be.prototype,"view",null),e([C()],Be.prototype,"_adapter",void 0),e([C()],Be.prototype,"_highlightedFeatureHandle",void 0),e([C()],Be.prototype,"_imageViewer",void 0),e([C()],Be.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],Be.prototype,"_overlays",void 0),e([C({readOnly:!0})],Be.prototype,"_overlaysView",null),e([C()],Be.prototype,"_panoramicViewer",void 0),e([C()],Be.prototype,"_referencePointOnGround",void 0),e([C()],Be.prototype,"_referencePointOnImage",void 0),e([C()],Be.prototype,"_sectorData",void 0),e([C({readOnly:!0})],Be.prototype,"_updatingHandles",void 0),e([C()],Be.prototype,"footprintExtent",void 0),Be=e([S("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Be);const Re=Be;export{Re as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import{isSome as r,equals as i}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedProperty as s}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import{isSerializable as c}from"../../core/JSONSupport.js";import{equalsShallow as u}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{throwIfAborted as y,isAbortError as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as F,watch as b,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{property as C}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as V}from"../../core/support/UpdatingHandles.js";import{projectWithZConversion as A}from"../../geometry/projection.js";import{isPolygon as j}from"../../geometry/support/jsonUtils.js";import{geographicToWebMercator as M}from"../../geometry/support/webMercatorUtils.js";import O from"../../layers/GraphicsLayer.js";import{searchImages as k}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as B}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as R,computePolygonForInspection as G,resizePolygon as L,checkIfPolygonContainsSelectedPoint as x}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as E}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as H,imageToWorldPanoramic as T}from"../../layers/orientedImagery/transformations/imageToWorld.js";import D from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as U}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as z,convertPixelToHeadingPitch as W,getUpdateElevationProps as N,isElevationSampler as q,getImageToWorldProperties as $,getImageToWorldPanoramicProperties as J,geographicToLTP as K,getWorldToImageProperties as Q,convertHeadingPitchToSphereVertex as X}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as Y,worldToImage as Z}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as ee}from"../../layers/support/floorFilterUtils.js";import te from"../../rest/support/AttachmentQuery.js";import{scale as re}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ie}from"../../views/input/InputManager.js";import ae from"../PanoramicViewer.js";import{invalidCameraHeading as oe,sectorsInOrder as se,sectorsRadii as ne}from"./constants.js";import{crossSymbol as le,crossSymbol3D as ce,sourcePointSymbol as ue,diamondSymbol as he,diamondSymbol3D as pe,activeSourcePointSymbol as me}from"./symbols.js";import{isNoAttachmentError as de,getContentType as ge,isTifOrMrf as ye,filterOILLayerView as fe,isSceneView as ve,isGraphic as we,calculateSegment as Fe,calculateDirection as be}from"./utils.js";import _e from"./components/ImageViewer.js";import Pe from"../../geometry/Point.js";import Ie from"../../geometry/SpatialReference.js";import Ce from"../../symbols/SimpleLineSymbol.js";import Se from"../../geometry/Multipoint.js";import Ve from"../../geometry/Polyline.js";import Ae from"../../geometry/Polygon.js";const je={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles"},Me=new Set(["JPG","JPEG"]),Oe=/\.(\w+)$/,ke=e=>"FA"===e;let Be=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new o,this.additionalCameraLocations=new o,this.additionalFootprints=new o,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.coverageFrustums=new o,this.coveragePolygons=new o,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=()=>{m(this._featureChangedTask),this._featureChangedTask=a((async e=>{const{currentBestFeature:t,selectedPoint:r,view:i}=this;if(i?.closePopup(),t&&r){this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons({signal:e}),await this._loadImage({signal:e})}catch(a){f(a)||(this.loadImageError(a),h.getLogger(this).error("#loadIImage()","error occured while loading image",a))}}}))},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.drawFootprint=()=>{this.bestFeatureFootprint&&this.updateCurrentCoveragePolygon(this.bestFeatureFootprint)},this.features=new o,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.navigatorCurrentBestFeature=null,this.overlayedCameraLocations=new o,this.overlayedMapFeatures=new w,this.pointSources=new o,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new _e,this._initialCurrentCoverageUpdate=!0,this._overlays=new O({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new ae,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._updatingHandles=new V,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find((({attributes:{imageID:t}})=>t===Number(e)));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=a((async e=>{const{currentBestFeature:r,popupEnabled:i,layer:a,view:o}=this;if(o?.closePopup(),!(o&&r&&i&&a))return;const{attributes:s,geometry:n}=r,l=new t({geometry:n,attributes:s.toJSON(),layer:a});y(e),await o.openPopup({features:[l],location:s.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(je.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ie.WIDGET),je.click)},this._createImageClickHandle=()=>{this.removeHandles(je.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:r,currentBestFeature:i,footprintExtent:o}=this,s=r?.imageSize;if(!(e&&"none"!==t&&s&&o&&i))return;r.clickAction="pixel-location";let n=null;const l=F((()=>r),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=a((async r=>{if(!e)return;const a=await this.getMapPoint(e,{feature:i,imageSize:s,mode:t});y(r),this.plotReferencePointOnGround(a)}))}));this.addHandles(l,je.imageClick)},this._getImageSourceFromAttachment=async(e,t,r)=>{const i=new te({objectIds:[t]}),a=await e.queryAttachments(i,r),o=a[`${t}`]?.[0],s=o?.url;if(!s)throw new n("NoAttachmentError","no attachments found",{[e.objectIdField]:t,layer:e});return{datasetFormat:o.contentType.split("/")[1].toUpperCase(),url:s}},this._loadAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/OrientedImageryViewerViewModelAdapter2D.js");y(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/OrientedImageryViewerViewModelAdapter3D.js");y(e),this._adapter=new t(this);break}}else this._adapter=null},this._loadImage=async e=>{const{currentBestFeature:t,layer:r,mode:i}=this;if(this.clearGraphics(),!r||!t||"none"===i)return;const{attributes:a}=t,{imagePath:o,imageRotation:s,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:u,cameraOrientation:p,location:m}=a,d=(l??0)+(s??0),g=m.spatialReference.isWGS84&&4!==p?.type?M(m):new Pe(m);let v=o;if(ke(o))try{v=await this._getImageSourceFromAttachment(r,u,e)}catch(w){if(f(w))return;return de(w)?(h.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${r.objectIdField}: ${u}`)):(h.getLogger(this).error(w,{[r.objectIdField]:u,layer:r}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${r.objectIdField} ${u}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:i,cameraLocation:g}),y(e),await this.transformAndPlotSelectedLocation(e)}catch(w){f(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:r,imageRotation:i,options:a}=t,o="string"==typeof e,s=o?e:e.url,{origin:n,pathname:l,searchParams:c}=new URL(s);let u=o?l.match(Oe)?.[1]??"":e.datasetFormat;if(!u){const e=await ge(s,{...t.options});e&&(u=e.split("/")[1]),u??="UNKNOWN FORMAT"}switch(r){case"default":this._imageViewer.imageSource={datasetFormat:u.toUpperCase(),url:`${n}${l}`},this._imageViewer.customParameters=Object.fromEntries(c),this._imageViewer.imageRotation=i??0,await this._imageViewer.loadImage(a);break;case"panoramic":if(Me.has(u.toUpperCase())){const{selectedPoint:e}=this,{pitch:r,yaw:i,cameraLocation:o,viewAngle:n}=t;this._panoramicViewer.imageSource=s;let l=i??0;"number"==typeof n?l=n-l:o&&e&&(l=await z(o,e)-l),this._panoramicViewer.pitch=r??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(a)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:u});break}},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a((async t=>{const{pointerType:r,button:i,mapPoint:a}=e;if(("mouse"!==r||0===i)&&a)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,r)=>{if(await v(r),!e)return;const i=new Pe({...c(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:le}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:r}=this._panoramicViewer;if(!r)return;const[i,a]=r,{heading:o,pitch:s}=W(e,i,a),n=X(o,s);this._crossSymbol=new t({geometry:new Pe(n,Ie.WebMercator),symbol:ce}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.determineWorkflowForFeature=this.determineWorkflowForFeature.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this),this.drawFootprint=this.drawFootprint.bind(this)}initialize(){this.addHandles([b((()=>this.view),(()=>{this.load()}),_),b((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),b((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),b((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),b((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),b((()=>this.currentBestFeature),((e,t)=>{this.determineWorkflowForFeature(e,t)}),{sync:!0}),b((()=>this.mode),(e=>{switch(this.removeHandles(je.interactionHandles),e){case"default":this.addHandles(b((()=>this._imageViewer.imagePointsInView),(e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a((async t=>{await this.updateFootprint(e,{signal:t})})))}),{..._,equals:(e,t)=>i(e,t,u)}),je.interactionHandles);break;case"panoramic":this.addHandles(b((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s}=this._panoramicViewer;return e&&r&&"image-loading"!==t?[i,a,s,o]:null}),(e=>{if(!e||"image-loading"===this.state)return;const[t,r,i,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=a((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:r,yaw:i,pitch:o},{signal:e})}))}),{..._,equals:(e,t)=>i(e,t,u)}),je.interactionHandles)}}),_),b((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:r,mode:i,sharpness:a}=this;"default"===i&&(e.brightness=t,e.contrast=r,e.sharpness=a)}),_)])}destroy(){this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy()}get activeLayer(){return s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:r}=this;switch(r){case"default":return e;case"panoramic":return t;default:return null}}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",p(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",p(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){return ye(this.currentBestFeature?.attributes.imagePath.trim())}get imageLoaded(){return s(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===oe}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(fe(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ee(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:r}=e;return 360===t||r?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?se.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",p(e,0,1))}get state(){const{mode:e,disabled:t}=this;if(t)return"disabled";if(!this.isFulfilled())return"loading";if(this.isRejected())return"error";if(this._updatingHandles.updating)return"image-loading";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}return"ready"}get thumbnails(){const{features:e}=this;return e?new o(e.map((({attributes:{imagePath:e,objectId:t,cameraRoll:r,imageRotation:i}})=>{const a=e.trim();return ye(a)?{url:a,objectId:t,rotation:(r??0)+(i??0)}:null})).filter(r)):null}set view(e){this._set("view",e)}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}filterByFootprints(e,t){const r=[],i=[],a=[];return e.forEach((e=>{const{layer:{coveragePercent:o},attributes:s}=e;let n;const{polygon:l,frustum:c}=R(s);if(n=l.clone(),s.isInspection&&(n=G(s)),o&&(n=L(n,o)),x(n,t)){a.push(e);const{geometry:t,objectId:o,cameraHeight:n,cameraHeading:u}=s,h=t.clone();h.z=n,h.imageID=o,this.pointSources.push(h),u!==oe&&(r.push(l),c&&i.push(c))}})),{features:a,polygons:r,frustums:i}}getCurrentCoveragePolygon(){return this.bestFeatureCurrentFootprint}getCurrentBestFeaturePolygon(){return this.bestFeatureFootprint}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[se[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:r}=e;if(isNaN(r))return;const i=this._sectorData?.[t];i?.length&&this._updateCurrentBestFeature(i.at(r))}async load(e){return this.addResolvingPromise(this._loadAdapter(e).catch((e=>{if(!f(e))throw e}))),this}async loadBestImage(e,t){return this.view?.closePopup(),this.displayMessage=null,this.selectedPoint=e.spatialReference.isGeographic?M(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async overlayCameraLocations(e){const{activeViewer:r,currentBestFeature:i,overlayedCameraLocations:a,layer:o,mode:s}=this,n=r?.imageSize;if(!n||!i||!o||"none"===s)return;const{polygon:l}=R(i.attributes);if(r.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await o.queryFeatures({where:`${o.objectIdField} <> ${i.attributes.objectId}`,geometry:l,returnGeometry:!0,outFields:[o.objectIdField]}),c=await Promise.all(e.map((async e=>{const{attributes:r,geometry:a}=e,o=await this.getPixels(a,{feature:i,imageSize:n,mode:s}),l=ue.clone();return l.outline=new Ce({color:[0,0,0],width:1}),new t({attributes:r,symbol:l,geometry:o})})));a.addMany(c),r.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e){const{activeViewer:i,currentBestFeature:a,mode:s}=this,n=i?.imageSize;if(!n||!a||"none"===s)return;const{polygon:l}=R(a.attributes),{features:c}=await e.queryFeatures({geometry:l,returnGeometry:!0,outFields:[e.objectIdField]}),u=new o((await Promise.all(c.map((async r=>{const{attributes:i,geometry:o}=r,l=r.symbol?.clone()??e.renderer?.getSymbol(r).clone();switch(o?.type){case"point":{const r=await this.getPixels(o,{feature:a,imageSize:n,mode:s});return new t({attributes:i,layer:e,symbol:l,geometry:r,visible:e.visible})}case"polygon":{const{rings:r,spatialReference:c}=o,u=r.map((e=>e.map((([e,t,r])=>new Pe({x:e,y:t,z:r,spatialReference:c}))))),h=await Promise.all(u.map((async e=>this.getPixels(e,{feature:a,imageSize:n,mode:s}).then((e=>e.map((({x:e,y:t})=>[e,t])))))));return new t({attributes:i,layer:e,symbol:l,geometry:new Ae({rings:h,spatialReference:Ie.WebMercator}),visible:e.visible})}case"polyline":{const{paths:r,spatialReference:c}=o,u=r.flatMap((e=>e.map((([e,t,r])=>new Pe({x:e,y:t,z:r,spatialReference:c}))))),h=await this.getPixels(u,{feature:a,imageSize:n,mode:s});return new t({attributes:i,layer:e,symbol:l,geometry:new Ve({paths:[h.map((e=>e.toArray()))],spatialReference:Ie.WebMercator}),visible:e.visible})}case"multipoint":{const{points:r,spatialReference:c}=o,u=r.map((([e,t,r])=>new Pe({x:e,y:t,z:r,spatialReference:c}))),h=await this.getPixels(u,{feature:a,imageSize:n,mode:s});return new t({attributes:i,layer:e,symbol:l,geometry:new Se({points:h.map((e=>e.toArray())),spatialReference:Ie.WebMercator}),visible:e.visible})}}return null})))).filter(r));this.overlayGraphicsOnImage(`${e.id}`,u)}async getPixels(e,t){const{imageSize:r,mode:i}=t,a=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===i)return new Pe({x:e.x-.5,y:.5-e.y,spatialReference:Ie.WebMercator});const[t,a]=r,{heading:o,pitch:s}=W(e,t,a),n=X(o,s);return new Pe(n,Ie.WebMercator)}));return Array.isArray(e)?a:a[0]}async getMapPoint(e,t){const{feature:r,mode:i,imageSize:a}=t,o=await N(r.attributes.cameraHeight,{elevationSample:r.elevationSample,elevationSource:r.attributes.elevationSource,extent:this.footprintExtent});let s;if("elevationSample"in o&&q(o.elevationSample)&&(r.elevationSample=o.elevationSample),"default"===i){const t=$(r.attributes,a);s=await H(Array.isArray(e)?e:[e],t,o)}else{const t=J(r.attributes,a[0],a[1]);s=await T(Array.isArray(e)?e:[e],t,o)}return Array.isArray(e)?s:s[0]}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new Pe({...e.toJSON()}),symbol:he}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage.destroy()),this.mode){case"default":{const r=c(e)?e.toJSON():e;r.x-=.5,r.y=.5-r.y,this._referencePointOnImage=new t({geometry:new Pe({spatialReference:this._imageViewer.imageRenderer.spatialReference.clone(),...r}),symbol:he}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:r}=this._panoramicViewer;if(!r)return;const[i,a]=r,{heading:o,pitch:s}=W(e,i,a),n=X(o,s);this._referencePointOnImage=new t({geometry:new Pe(n,Ie.WebMercator),symbol:pe}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach((e=>{this._imageViewer.removeManyGraphics(e.toArray())})),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this._imageViewer.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}async searchBestImage(e,t){try{const r=await k(e,t);r&&await this._processFeatureResponse(r,e.point,{signal:t?.signal})}catch(r){f(r)||(this.setMessage("imageLoadError","error",r.message),h.getLogger(this).error("error occurred while finding best image",r))}}selectBestFeature(e){this.currentBestFeature=this.features?.find((({attributes:t})=>t.objectId===Number(e)))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const r=this.overlayedMapFeatures.get(e);r&&this._toggleVisiblity(r,t)}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:r}=e,i=this.bestFeatureFootprint?.geometry,a=j(i)&&i.contains(t),o="mesh"===i?.type&&i?.extent.contains(t);if(!a&&!o)return;const s=await this.worldToImage(t,r);return s?(y(r),this.plotReferencePointOnImage(s),{x:s.x,y:s.y}):void 0}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const r=this.layer;if(r){const i={include:r},a=this.view.toScreen(e);if(!a)return;const o=await this.view.hitTest(a,i);return this._processHitTestResults(r,o,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(r){if(f(r))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",r)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:r,features:i,invalidCameraHeading:a}=this;if(!e||!t||!r||!i||a)return void(this._sectorData=null);this._sectorData={};for(const c of se)this._sectorData[c]=new o;const s=e.map(((e,t)=>({...e,featureIndex:t})));s.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const n=s.map((({distance:e})=>e)),l=Math.max(...n);s.forEach((e=>{const{distance:t,angle:r,featureIndex:a}=e,o=t/l*ne[2],s=Fe(t,l),n=be(r);if(!this._sectorData)return;const c=ne[3]+o*Math.sin(r*Math.PI/180),u=ne[3]+o*Math.cos(r*Math.PI/180);let h;const p=i.at(a),m=p===this.currentBestFeature,d=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(m&&d)h=-90;else{const e=c-ne[3],t=u-ne[3],r=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(r)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),h=i}const g=""===s?n:`${s}_${n}`;m&&(h===this.bestFeatureAngle?this.previousFeatureAngle=h:this.bestFeatureAngle=h,this.navigatorCurrentBestFeature=d?null:{x:c,y:u,direction:n});const y=this._sectorData[g];y.add({angle:r,featureIndex:a,x:c,y:u,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}async _processFeatureResponse(e,t,r){const{features:i}=e;if(!i?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:a,polygons:o,frustums:s}=this.filterByFootprints(i,t);if(!a.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(o),this.coverageFrustums.addMany(s),o[0]){const e=new Ae({spatialReference:o[0].spatialReference});for(const{rings:r}of o)e.addRing(r[0]);const t=[];for(const{geometry:r}of a)e.contains(r)||t.push(r);if(e.addRing(t),this.footprintExtent=re(e.extent,2,2),this.view?.supportsGround)try{n=await this.view.map.ground.createElevationSampler(this.footprintExtent,r)}catch(l){f(l)||h.getLogger(this).error(l)}}if((n||a[0].attributes.elevationSource)&&this.footprintExtent){const e=a[0].attributes.elevationSource;E(e)&&!n&&(n=await U({extent:this.footprintExtent,lod:e.lod,url:e.url,rasterFunction:e.rasterFunction}));const r=await N(a[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[i,...o]=await D([t,...a.map((e=>e.attributes.geometry.clone()))],r);a[0].elevationSample=n??r.elevationSample,t.elevation=i.z,a.forEach(((e,t)=>{e.attributes.elevation=o[t].z}))}a[0].elevationSample&&a.forEach((e=>{e.elevationSample=a[0].elevationSample})),this._suitabilities=B({features:a,selectedPoint:t,camera:ve(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,r){const{screenPoint:i,results:[a]}=t,o="graphic"===a?.type&&this.shouldShowSelectedImage,s=a?.mapPoint??this.view?.toMap(i);if(!s)return;const{layerFloorFilterClause:n}=this,l={layerInstanceOrURL:e,point:s,queryParams:{where:I("1=1",I(e.definitionExpression,n)),maximumDistance:e.maximumDistance,objectIds:o?[a.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(l,r)}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}_updateFeatures(e){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this.currentBestFeature=e[0]}async _updatePointsAndPolygons(e){const{pointSources:r,currentBestFeature:i,currentCoverageVisible:a,isAdditionalPointSourcesVisible:o}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),y(e);for(const e of r)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e,symbol:me,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e,symbol:ue,visible:o}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let r;if(t)r=-90;else{const t=e.x-ne[3],i=e.y-ne[3],a=i/Math.sqrt(t**2+i**2);let o=180*Math.acos(a)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(o*=-1),r=o}r===this.bestFeatureAngle?this.previousFeatureAngle=r:this.bestFeatureAngle=r,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics()}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,r,i){this.displayMessage={key:e,type:t,data:r,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:r,selectedPoint:i,state:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=d(this._crossSymbol)),!i||!t||"image-loaded"!==a||r)return;let o;try{o=await this.worldToImage(i,e),y(e),await this.plotSelectedPointOnImage(o,e)}catch(s){f(s)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:s,selectedPoint:i,feature:t})}}async worldToImage(e,t){const{footprintExtent:r}=this,{imageSize:i}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!i||!r)return;const{attributes:{location:a,cameraOrientation:o,elevationSource:s,cameraHeight:n,cameraHeading:l},elevationSample:c}=this.currentBestFeature;let u=a.clone();const h=await N(n,{elevationSample:c,elevationSource:s});this.currentBestFeature.elevationSample=h.elevationSample;let p,m=await D(Array.isArray(e)?e:[e],h);if(a.spatialReference.isGeographic)if(a.spatialReference.isWGS84&&4===o?.type){const{latitude:e,longitude:r,ellipsoidRadius:i,squaredEccentricity:s}=o;u=new Pe(K(a.toArray(),[e,r,i,s]),{wkid:0}),m=await Promise.all(m.map((async a=>new Pe(K((await A(a,Ie.WGS84,t)).toArray(),[e,r,i,s]),{wkid:0}))))}else u=await A(u,Ie.WebMercator,t);if(m=await Promise.all(m.map((async e=>u.spatialReference.equals(e.spatialReference)?e:await A(e,u.spatialReference,t)))),y(t),"panoramic"===this.mode)p=Y(m,{imageHeight:i[1],imageWidth:i[0],cameraHeading:l,cameraLocation:a});else{const e=Q(this.currentBestFeature.attributes,i);p=Z(m,e)}return Array.isArray(e)?p:p[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:r,additionalCameraLocations:i,currentBestFeature:a,currentBestFeatureLocation:o,currentCoverageVisible:s,selectedPoint:n,view:l,_adapter:c}=this,{attributes:{objectId:u},elevationSample:h}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...r,...i,this.bestFeatureCurrentFootprint,o].filter(we);l.supportsGround&&h&&c?.updateGroundElevation&&c.updateGroundElevation(e,h),n&&e.push(new t({geometry:n.clone(),symbol:le.clone(),attributes:{imageID:u}})),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&h&&c?.updateGroundElevation&&c.updateGroundElevation([e],h),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([C()],Be.prototype,"activeLayer",null),e([C({readOnly:!0})],Be.prototype,"activeViewer",null),e([C()],Be.prototype,"additionalFeatures",void 0),e([C({type:o.ofType(t)})],Be.prototype,"additionalCameraLocations",void 0),e([C({type:o.ofType(t)})],Be.prototype,"additionalFootprints",void 0),e([C()],Be.prototype,"bestFeatureAngle",void 0),e([C()],Be.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],Be.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],Be.prototype,"brightness",null),e([C({type:Number})],Be.prototype,"contrast",null),e([C()],Be.prototype,"coverageFrustums",void 0),e([C()],Be.prototype,"coveragePolygons",void 0),e([C()],Be.prototype,"currentBestFeature",void 0),e([C()],Be.prototype,"currentBestFeatureLocation",void 0),e([C()],Be.prototype,"currentCoverageVisible",void 0),e([C({json:{write:!1}})],Be.prototype,"determineWorkflowForFeature",void 0),e([C()],Be.prototype,"disabled",void 0),e([C()],Be.prototype,"displayMessage",void 0),e([C()],Be.prototype,"drawFootprint",void 0),e([C({readOnly:!0})],Be.prototype,"featureCount",null),e([C()],Be.prototype,"features",void 0),e([C({readOnly:!0})],Be.prototype,"imageGalleryEnabled",null),e([C({readOnly:!0})],Be.prototype,"imageLoaded",null),e([C({readOnly:!0})],Be.prototype,"invalidCameraHeading",null),e([C()],Be.prototype,"imagePointsInView",null),e([C()],Be.prototype,"isAdditionalCoverageVisible",void 0),e([C()],Be.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],Be.prototype,"layer",void 0),e([C()],Be.prototype,"layerView",null),e([C({readOnly:!0})],Be.prototype,"layerFloorFilterClause",null),e([C({type:Number})],Be.prototype,"localPort",void 0),e([C()],Be.prototype,"mapImageConversionToolState",void 0),e([C({readOnly:!0,value:"none"})],Be.prototype,"mode",null),e([C()],Be.prototype,"navigatorCurrentBestFeature",void 0),e([C({type:o.ofType(t)})],Be.prototype,"overlayedCameraLocations",void 0),e([C()],Be.prototype,"overlayedMapFeatures",void 0),e([C()],Be.prototype,"pointSources",void 0),e([C({readOnly:!0})],Be.prototype,"popupEnabled",null),e([C()],Be.prototype,"previousFeatureAngle",void 0),e([C()],Be.prototype,"referencePoint",null),e([C({readOnly:!0})],Be.prototype,"sectorData",null),e([C()],Be.prototype,"selectedPoint",void 0),e([C({type:Number})],Be.prototype,"sharpness",null),e([C()],Be.prototype,"shouldShowSelectedImage",void 0),e([C({readOnly:!0})],Be.prototype,"state",null),e([C({readOnly:!0})],Be.prototype,"thumbnails",null),e([C()],Be.prototype,"updateFootprint",void 0),e([C()],Be.prototype,"updateFootprintPanorama",void 0),e([C({value:null})],Be.prototype,"view",null),e([C()],Be.prototype,"_adapter",void 0),e([C()],Be.prototype,"_highlightedFeatureHandle",void 0),e([C()],Be.prototype,"_imageViewer",void 0),e([C()],Be.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],Be.prototype,"_overlays",void 0),e([C({readOnly:!0})],Be.prototype,"_overlaysView",null),e([C()],Be.prototype,"_panoramicViewer",void 0),e([C()],Be.prototype,"_referencePointOnGround",void 0),e([C()],Be.prototype,"_referencePointOnImage",void 0),e([C()],Be.prototype,"_sectorData",void 0),e([C({readOnly:!0})],Be.prototype,"_updatingHandles",void 0),e([C()],Be.prototype,"footprintExtent",void 0),Be=e([S("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Be);const Re=Be;export{Re as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7e3,3069],{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,{fieldsIndex: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:()=>o,Y4:()=>s});var i=r(96285);class n{}function s(e){return e instanceof i.bo?e===n.instance:"unknown"===e?.toString().toLowerCase()}function o(e){return s(e)?n.instance:e}n.instance=new i.oh("Etc/UTC")},13069:(e,t,r)=>{r.d(t,{lk:()=>n,vD:()=>o,yS:()=>s});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 s(){return`{${n().toUpperCase()}}`}function o(){return`{${n()}}`}},70328:(e,t,r)=>{r.d(t,{BI:()=>_,Ej:()=>m,Hq:()=>u,Ie:()=>v,Jt:()=>w,Ne:()=>f,RF:()=>l,_F:()=>c,aI:()=>T,fA:()=>s,gX:()=>h,hZ:()=>b,iT:()=>a,is:()=>F,qv:()=>I,vI:()=>g,v_:()=>M,vt:()=>n,w1:()=>o});var i=r(5443);function n(e=M){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function s(e,t,r,i,s,o,l=n()){return l[0]=e,l[1]=t,l[2]=r,l[3]=i,l[4]=s,l[5]=o,l}function o(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 u(e,t,r=0,i=t.length/3){let n=e[0],s=e[1],o=e[2],l=e[3],a=e[4],u=e[5];for(let e=0;e<i;e++)n=Math.min(n,t[r+3*e]),s=Math.min(s,t[r+3*e+1]),o=Math.min(o,t[r+3*e+2]),l=Math.max(l,t[r+3*e]),a=Math.max(a,t[r+3*e+1]),u=Math.max(u,t[r+3*e+2]);e[0]=n,e[1]=s,e[2]=o,e[3]=l,e[4]=a,e[5]=u}function d(e){return e[0]>=e[3]?0:e[3]-e[0]}function p(e){return e[1]>=e[4]?0:e[4]-e[1]}function y(e){return e[2]>=e[5]?0:e[5]-e[2]}function c(e){const t=d(e),r=y(e),i=p(e);return Math.sqrt(t*t+r*r+i*i)}function h(e,t=[0,0,0]){return t[0]=e[0]+d(e)/2,t[1]=e[1]+p(e)/2,t[2]=e[2]+y(e)/2,t}function m(e,t=[0,0,0]){return t[0]=d(e),t[1]=p(e),t[2]=y(e),t}function f(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 g(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 b(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 v(e){return e?b(e,I):n(I)}function w(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 _(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 F(e){return 6===e.length}function T(e,t,r){if(null==e||null==t)return e===t;if(!F(e)||!F(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 I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],M=[0,0,0,0,0,0];n()},70048:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ve});var i=r(90237),n=r(69540),s=r(5503),o=r(49186),l=r(81583),a=r(92071),u=r(74887),d=r(36708),p=r(39516),y=r(84952),c=r(10107),h=(r(44208),r(53966)),m=(r(87811),r(36005)),f=r(40608),g=r(4146),b=r(52136),v=r(18768),w=r(63074),_=r(69208),F=r(47685),T=r(87796),I=r(16131),M=r(8303),S=r(54310),x=r(25036),A=r(82935),O=r(60694),E=r(10873),j=r(15426),N=r(17036),V=r(30524),C=r(13874),$=r(86162),L=(r(94409),r(65345),r(42980),r(20917),r(92438)),D=r(96576),R=r(93618),q=(r(65494),r(4902)),P=r(4718),U=r(92474),G=r(93637),B=r(43937),k=r(90360),Z=r(9582),J=r(16930),X=r(29005),z=r(81457),H=r(39383),Y=r(61956),Q=r(30291),K=r(59868);const W={key:"type",base:L.A,errorContext:"renderer",typeMap:{simple:D.A,"unique-value":R.A,"class-breaks":$.A}},ee=(0,N.p)(),te=(0,k.C)({types:W});let re=0;function ie(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function ne(e){switch(e){case"point":case"multipoint":return K.UK.clone();case"polyline":return K.A7.clone();case"polygon":case"multipatch":return K.Cx.clone();default:return null}}function se(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function oe(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},n=se(e,t);if(null!=n){const{defaultValues:e}=n;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new X.A({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let le=class extends((0,a.P)((0,n.O)((0,q.sA)(U.A)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${re++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return(0,V.yp)(this.renderer,this.fieldsIndex),Promise.resolve(this)}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:n}=this;let s;if(i){s=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:o})=>{if(!o)return;const l=n?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let u=!1;r!==l.alias&&(a.alias=r,u=!0),i!==l.editable&&(a.editable=i,u=!0),s.push(a),u&&e++})),0===e&&s.length===i.length&&(s=null)}else s=(0,P.o8)(e);s?.length&&(0,G.sM)(r,s,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:n,subtypeField:s}=e,o=n?.find((e=>e.code===r)),l=o?.defaultValues,a=o?.domains,u=[];for(const e of i){const i=e.clone(),{name:n}=i,o=t?.find((e=>e.name===n));if(i.visible=!t||!!o,o){const{alias:e,editable:t}=o;e&&(i.alias=e),!1===t&&(i.editable=!1)}const d=l?.[n]??null;i.defaultValue=n===s?r:d;const p=a?.[n]??null;i.domain=n===s?null:p?"inherited"===p.type?i.domain:p.clone():null,u.push(i)}return u}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||h.A.getLogger(this).error(de("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){(0,V.yp)(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?function(e){return new D.A({symbol:ne(e)})}(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=te(i,t,r);let s;const{subtypeCode:o}=this;if(null!=o&&function(e,t){return!(!t||"unique-value"!==e?.type||null==e.field||e.field.toLowerCase()!==t.toLowerCase()||e.field2||e.field3||e.valueExpression)}(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(o)));e&&(s=new D.A({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const n=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return n?void 0:te(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??J.A.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[oe(this.subtypeCode,t)]}readTitleFromService(e,t){const r=se(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw de("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new o.A("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw de("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new o.A("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw de("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new o.A("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw de("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:n}=this;if(r){const{displayField:e,editFieldsInfo:s,objectIdField:o}=r;t={displayField:e,editFieldsInfo:s,fields:i,objectIdField:o,title:n}}return(0,Q.tn)(t,e)}createQuery(){if(!this.parent)throw de("createQuery");const e=(0,j.VZ)(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=(0,p.m)(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw de("queryAttachments");const i=e.clone();return i.where=ue(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw de("queryFeatureCount");return r.parent.queryFeatureCount(ae(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw de("queryFeatures");return r.parent.queryFeatures(ae(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw de("queryObjectIds");return r.parent.queryObjectIds(ae(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw de("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw de("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"capabilities",null),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"effectiveCapabilities",null),(0,i._)([(0,c.M)({json:{write:{ignoreOrigin:!0}}})],le.prototype,"charts",void 0),(0,i._)([(0,c.M)({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],le.prototype,"editingEnabled",void 0),(0,i._)([(0,c.M)({type:Boolean,readOnly:!0})],le.prototype,"effectiveEditingEnabled",null),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"elevationInfo",null),(0,i._)([(0,c.M)({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],le.prototype,"fieldOverrides",void 0),(0,i._)([(0,B.K)("fieldOverrides")],le.prototype,"writeFieldOverrides",null),(0,i._)([(0,c.M)({...ee.fields,readOnly:!0,json:{read:!1}})],le.prototype,"fields",null),(0,i._)([(0,c.M)(ee.fieldsIndex)],le.prototype,"fieldsIndex",void 0),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"floorInfo",null),(0,i._)([(0,c.M)({type:Z.A,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],le.prototype,"formTemplate",void 0),(0,i._)([(0,c.M)({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],le.prototype,"id",void 0),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"geometryType",null),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"type",void 0),(0,i._)([(0,c.M)(ie((0,P.o8)(E.kF)))],le.prototype,"labelsVisible",void 0),(0,i._)([(0,c.M)({type:[z.A],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:H.w},write:{ignoreOrigin:!0}}})],le.prototype,"labelingInfo",void 0),(0,i._)([(0,c.M)({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],le.prototype,"layerType",void 0),(0,i._)([(0,c.M)(ie((0,P.o8)(E.fV)))],le.prototype,"legendEnabled",void 0),(0,i._)([(0,c.M)({type:["show","hide"]})],le.prototype,"listMode",void 0),(0,i._)([(0,c.M)((()=>{const e=(0,P.o8)(E.hn);return e.json.origins.service.read=!1,ie(e)})())],le.prototype,"minScale",void 0),(0,i._)([(0,c.M)((()=>{const e=(0,P.o8)(E.hG);return e.json.origins.service.read=!1,ie(e)})())],le.prototype,"maxScale",void 0),(0,i._)([(0,c.M)({readOnly:!0})],le.prototype,"effectiveScaleRange",null),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"objectIdField",null),(0,i._)([(0,c.M)({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],le.prototype,"opacity",void 0),(0,i._)([(0,c.M)({clonable:!1})],le.prototype,"parent",void 0),(0,i._)([(0,c.M)(ie((0,P.o8)(E.M6)))],le.prototype,"popupEnabled",void 0),(0,i._)([(0,c.M)({type:C.A,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],le.prototype,"popupTemplate",void 0),(0,i._)([(0,c.M)({readOnly:!0})],le.prototype,"defaultPopupTemplate",null),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"relationships",null),(0,i._)([(0,c.M)({types:W,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],le.prototype,"renderer",null),(0,i._)([(0,m.w)("service","renderer",["drawingInfo.renderer","subtypeField","type"])],le.prototype,"readRendererFromService",null),(0,i._)([(0,m.w)("renderer",["layerDefinition.drawingInfo.renderer"])],le.prototype,"readRenderer",null),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"spatialReference",null),(0,i._)([(0,c.M)({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],le.prototype,"subtypeCode",void 0),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"subtypeField",null),(0,i._)([(0,c.M)({type:[X.A],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],le.prototype,"templates",void 0),(0,i._)([(0,m.w)("service","templates",["geometryType","subtypeField","subtypes","type"])],le.prototype,"readTemplatesFromService",null),(0,i._)([(0,c.M)({type:String,json:{write:{ignoreOrigin:!0}}})],le.prototype,"title",void 0),(0,i._)([(0,m.w)("service","title",["subtypes"])],le.prototype,"readTitleFromService",null),(0,i._)([(0,c.M)({readOnly:!0,json:{read:!1}})],le.prototype,"url",null),(0,i._)([(0,c.M)({readOnly:!0})],le.prototype,"userHasUpdateItemPrivileges",null),(0,i._)([(0,c.M)({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],le.prototype,"visible",void 0),le=(0,i._)([(0,f.$)("esri.layers.support.SubtypeSublayer")],le);const ae=(e,t,r)=>{if(!r)return t.createQuery();const i=Y.A.from(r);return i.where=ue(i.where,e.subtypeField,t.subtypeCode),i},ue=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),n=`${t}=${r}`,s=e??"";return i.test(s)?s.replace(i,n):(0,p.m)(n,s)},de=e=>new o.A(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),pe=le;var ye=r(96184),ce=r(91908),he=r(92935);const me="SubtypeGroupLayer";function fe(e,t){return new o.A("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}const ge=(0,N.p)();let be=class extends((0,T.j)((0,F.w6)((0,w.dM)((0,A.e)((0,x.j)((0,S.J)((0,v.b)((0,I.q)((0,M.A)((0,a.P)((0,_.d)((0,b.p)((0,n.O)(g.A)))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(s.A.ofType(pe)),this.supportedSourceTypes=new Set(["Feature Layer"]),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=(0,u.sg)((async(e,t,i)=>{const{save:n,saveAs:s}=await r.e(5740).then(r.bind(r,33359));switch(e){case he.X.SAVE:return n(this,t);case he.X.SAVE_AS:return s(this,i,t)}})),this.addHandles((0,d.wB)((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),d.OH))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(u.QP).then((async()=>{if(!this.url)throw new o.A("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new o.A("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>(0,j.VA)(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return(0,j.C$)(this)}get parsedUrl(){const e=(0,y.An)(this.url);return null!=e&&null!=this.layerId&&(e.path=(0,y.fj)(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?(0,O.yG)(this.url,t):t}async addAttachment(e,t){return(0,j.Xl)(this,e,t,me)}async updateAttachment(e,t,r){return(0,j.bt)(this,e,t,r,me)}async applyEdits(e,t){return(0,j.ct)(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await(0,u.qr)(Promise.all([r.e(893),r.e(8132),r.e(2593),r.e(9062)]).then(r.bind(r,72593)),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=(0,j.VZ)(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=(0,p.m)(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){return(0,j.mm)(this,e,t,me)}async fetchRecomputedExtents(e){return(0,j.WP)(this,e,me)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return(0,l.g)(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return(0,j.lV)(this,e,t,me)}async queryFeatures(e,t){const r=await this.load(),i=Y.A.from(e)??r.createQuery(),n=i.outFields??[];n.includes(this.subtypeField)||(n.push(this.subtypeField),i.outFields=n);const s=await r.source.queryFeatures(i,t);if(s?.features)for(const e of s.features)e.layer=e.sourceLayer=this.findSublayerForFeature(e);return s}async queryObjectIds(e,t){return(0,j.sg)(this,e,t,me)}async queryFeatureCount(e,t){return(0,j.Ye)(this,e,t,me)}async queryExtent(e,t){return(0,j.B5)(this,e,t,me)}async queryRelatedFeatures(e,t){return(0,j.hM)(this,e,t,me)}async queryRelatedFeaturesCount(e,t){return(0,j.S2)(this,e,t,me)}async save(e){return this._debouncedSaveOperations(he.X.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(he.X.SAVE_AS,t,e)}write(e,t){const{origin:r,layerContainerType:i,messages:n}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return n?.push(fe(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return n?.push(fe(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(n?.push(new o.A("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&(0,ce.D)(this,e)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),!this.subtypes?.length)throw new o.A("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),(0,V.sv)(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return(0,j.jp)(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)}))],"sublayers-owner"))}};(0,i._)([(0,c.M)({readOnly:!0})],be.prototype,"createQueryVersion",null),(0,i._)([(0,c.M)({readOnly:!0})],be.prototype,"editingEnabled",null),(0,i._)([(0,c.M)({readOnly:!0})],be.prototype,"effectiveEditingEnabled",null),(0,i._)([(0,c.M)({...ge.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],be.prototype,"fields",void 0),(0,i._)([(0,c.M)(ge.fieldsIndex)],be.prototype,"fieldsIndex",void 0),(0,i._)([(0,c.M)(E.id)],be.prototype,"id",void 0),(0,i._)([(0,c.M)({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],be.prototype,"listMode",void 0),(0,i._)([(0,c.M)({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],be.prototype,"operationalLayerType",void 0),(0,i._)([(0,c.M)(ge.outFields)],be.prototype,"outFields",void 0),(0,i._)([(0,c.M)({readOnly:!0})],be.prototype,"parsedUrl",null),(0,i._)([(0,c.M)({clonable:!1})],be.prototype,"source",null),(0,i._)([(0,c.M)({type:s.A.ofType(pe),json:{origins:{service:{read:{source:"subtypes",reader:(e,t,r)=>{const i=e.map((({code:e})=>{const i=new pe({subtypeCode:e});return i.read(t,r),i}));return new(s.A.ofType(pe))(i)}}}},name:"layers",write:{ignoreOrigin:!0}}})],be.prototype,"sublayers",void 0),(0,i._)([(0,c.M)({type:ye.A})],be.prototype,"timeInfo",void 0),(0,i._)([(0,c.M)({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],be.prototype,"title",void 0),(0,i._)([(0,m.w)("service","title",["name"])],be.prototype,"readTitleFromService",null),(0,i._)([(0,c.M)({json:{read:!1}})],be.prototype,"type",void 0),be=(0,i._)([(0,f.$)("esri.layers.SubtypeGroupLayer")],be);const ve=be},82935:(e,t,r)=>{r.d(t,{B:()=>c,e:()=>h});var i=r(90237),n=r(10107),s=(r(44208),r(53966),r(87811),r(36005)),o=r(40608),l=r(89317),a=r(30524),u=r(96184),d=r(73133),p=r(79677),y=r(10184);const c={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation",layerContainerTypes:l.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=d.j.fromJSON(r.timeOffsetUnits);return i&&n?new y.A({value:i,unit:n}):null}set timeInfo(e){(0,a.sv)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i._)([(0,n.M)({type:p.A,json:{write:!1}})],t.prototype,"timeExtent",void 0),(0,i._)([(0,n.M)({type:y.A})],t.prototype,"timeOffset",void 0),(0,i._)([(0,s.w)("service","timeOffset",["timeInfo.exportOptions"])],t.prototype,"readOffset",null),(0,i._)([(0,n.M)({value:null,type:u.A,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],t.prototype,"timeInfo",null),(0,i._)([(0,n.M)(c)],t.prototype,"useViewTime",void 0),t=(0,i._)([(0,o.$)("esri.layers.mixins.TemporalLayer")],t),t}},20437:(e,t,r)=>{r.d(t,{A:()=>f});var i,n=r(90237),s=r(66552),o=r(25482),l=r(10107),a=r(56507),u=(r(87811),r(44208),r(93223)),d=r(36005),p=r(40608),y=r(72088),c=r(98453);const h=new s.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 o.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.M)({type:String,json:{write:!0}})],m.prototype,"alias",void 0),(0,n._)([(0,l.M)({type:[String,Number],json:{write:{allowNull:!0}}})],m.prototype,"defaultValue",void 0),(0,n._)([(0,l.M)()],m.prototype,"description",void 0),(0,n._)([(0,d.w)("description")],m.prototype,"readDescription",null),(0,n._)([(0,l.M)({types:y.gK,json:{read:{reader:y.rS},write:!0}})],m.prototype,"domain",void 0),(0,n._)([(0,l.M)({type:Boolean,json:{write:!0}})],m.prototype,"editable",void 0),(0,n._)([(0,l.M)({type:a.jz,json:{write:{overridePolicy:e=>({enabled:Number.isFinite(e)})}}})],m.prototype,"length",void 0),(0,n._)([(0,l.M)({type:String,json:{write:!0}})],m.prototype,"name",void 0),(0,n._)([(0,l.M)({type:Boolean,json:{write:!0}})],m.prototype,"nullable",void 0),(0,n._)([(0,u.e)(c.m)],m.prototype,"type",void 0),(0,n._)([(0,l.M)()],m.prototype,"valueType",void 0),(0,n._)([(0,d.w)("valueType",["description"])],m.prototype,"readValueType",null),(0,n._)([(0,l.M)({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),s=r(53966),o=r(91869),l=r(3330),a=r(30524),u=r(56400),d=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?(s.A.getLogger("esri.layers.support.FieldsIndex").error(new i.A("getTimeZone:no-timezone-information",`no time zone information for field '${t.name}'`)),u.n$):m.has(t.type)?u.L5:null:null}getLuxonTimeZone(e){const t=this.getTimeZone(e);return t?t===u.L5?l.GB.instance:t===u.n$?d.mQ.utcInstance:(0,o.tE)(p,t,(()=>d.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,s=(i?"startField"in i?i.startField:i.startTimeField:"")??"",o=(i?"endField"in i?i.endField:i.endTimeField:"")??"",l=function(e){return"dateFieldsTimeZone"in e}(e)?e.dateFieldsTimeZone??null:e.dateFieldsTimeReference?(0,u.ZS)(e.dateFieldsTimeReference):null,a=n?function(e){return"timeZone"in e}(n)?n.timeZone??l:n.dateFieldsTimeReference?(0,u.ZS)(n.dateFieldsTimeReference):l??u.n$:null,d=i?function(e){return"timeZone"in e}(i)?i.timeZone??l:i.timeReference?(0,u.ZS)(i.timeReference):l:null,p=new Map([[c(n?.creationDateField??""),a],[c(n?.editDateField??""),a],[c(s),d],[c(o),d]]);for(const{name:i,type:n}of e.fields)if(m.has(n))t.set(i,u.L5);else if("date"!==n&&"esriFieldTypeDate"!==n)t.set(i,null);else if(r)t.set(i,u.L5);else{const e=p.get(c(i??""))??l;t.set(i,e)}return t}},96184:(e,t,r)=>{r.d(t,{A:()=>m});var i=r(90237),n=r(69540),s=r(25482),o=r(10107),l=(r(44208),r(53966),r(87811),r(36005)),a=r(40608),u=r(43937),d=r(79677),p=r(10184),y=r(56400);function c(e,t){return p.A.fromJSON({value:e,unit:t})}let h=class extends((0,n.O)(s.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?d.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,o.M)({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],h.prototype,"cumulative",void 0),(0,i._)([(0,o.M)({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"endField",void 0),(0,i._)([(0,o.M)({type:d.A,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"fullTimeExtent",void 0),(0,i._)([(0,l.w)("fullTimeExtent",["timeExtent"])],h.prototype,"readFullTimeExtent",null),(0,i._)([(0,u.K)("fullTimeExtent")],h.prototype,"writeFullTimeExtent",null),(0,i._)([(0,o.M)({type:Boolean,json:{write:!0}})],h.prototype,"hasLiveData",void 0),(0,i._)([(0,o.M)({type:p.A,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"interval",void 0),(0,i._)([(0,l.w)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],h.prototype,"readInterval",null),(0,i._)([(0,u.K)("interval")],h.prototype,"writeInterval",null),(0,i._)([(0,o.M)({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"startField",void 0),(0,i._)([(0,o.M)((0,y.P6)("timeReference",!0))],h.prototype,"timeZone",void 0),(0,i._)([(0,o.M)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"trackIdField",void 0),(0,i._)([(0,o.M)({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],h.prototype,"useTime",void 0),(0,i._)([(0,o.M)({type:[Date],json:{read:!1}})],h.prototype,"stops",void 0),h=(0,i._)([(0,a.$)("esri.layers.support.TimeInfo")],h);const m=h},72088:(e,t,r)=>{r.d(t,{rS:()=>I,gK:()=>T}),r(44208);var i,n=r(90237),s=r(4718),o=r(10107),l=(r(53966),r(93223)),a=r(40608),u=r(25482);r(87811);let d=i=class extends u.oY{constructor(e){super(e),this.name=null,this.code=null}clone(){return new i({name:this.name,code:this.code})}};(0,n._)([(0,o.M)({type:String,json:{write:!0}})],d.prototype,"name",void 0),(0,n._)([(0,o.M)({type:[String,Number],json:{write:!0}})],d.prototype,"code",void 0),d=i=(0,n._)([(0,a.$)("esri.layers.support.CodedValue")],d);const p=new(r(66552).J)({inherited:"inherited",codedValue:"coded-value",range:"range"});let y=class extends u.oY{constructor(e){super(e),this.name=null,this.type=null}};(0,n._)([(0,o.M)({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,s.o8)(this.codedValues),name:this.name})}};(0,n._)([(0,o.M)({type:[d],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 b=g=class extends c{constructor(e){super(e),this.type="inherited"}clone(){return new g}};(0,n._)([(0,l.e)({inherited:"inherited"})],b.prototype,"type",void 0),b=g=(0,n._)([(0,a.$)("esri.layers.support.InheritedDomain")],b);const v=b;var w;let _=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,o.M)({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]}}}})],_.prototype,"maxValue",void 0),(0,n._)([(0,o.M)({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]}}}})],_.prototype,"minValue",void 0),(0,n._)([(0,l.e)({range:"range"})],_.prototype,"type",void 0),_=w=(0,n._)([(0,a.$)("esri.layers.support.RangeDomain")],_);const F=_,T={key:"type",base:c,typeMap:{range:_,"coded-value":f,inherited:v}};function I(e){if(!e?.type)return null;switch(e.type){case"range":return F.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),s=r(20437),o=r(95466),l=r(30524);function a(){return{fields:{type:[s.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 o.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:()=>b,rU:()=>g,tH:()=>T});var i=r(799);const n="__begin__",s="__end__",o=new RegExp(n,"ig"),l=new RegExp(s,"ig"),a=new RegExp("^"+n,"i"),u=new RegExp(s+"$","i"),d='"',p=d+" + ",y=" + "+d;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 b(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 T(t.expression)}return null}function b(e){let t;return e?(t=(0,i.HC)(e,(e=>n+'$feature["'+e+'"]'+s)),t=a.test(t)?t.replace(a,""):d+t,t=u.test(t)?t.replace(u,""):t+d,t=t.replaceAll(o,p).replaceAll(l,y)):t='""',t}const v=/^\s*\{([^}]+)\}\s*$/i,w=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,_=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,F=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function T(e){if(!e)return null;let t=w.exec(e)||_.exec(e);return t?t[1]||t[3]:(t=F.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})},10184:(e,t,r)=>{r.d(t,{A:()=>y});var i=r(90237),n=r(69540),s=r(25482),o=r(88930),l=r(10107),a=(r(44208),r(53966),r(87811),r(93223)),u=r(40608),d=r(73133);let p=class extends((0,n.O)(s.oY)){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return(0,o.t)(this.value,this.unit,"milliseconds")}};(0,i._)([(0,a.e)(d.j,{nonNullable:!0})],p.prototype,"unit",void 0),(0,i._)([(0,l.M)({type:Number,json:{write:!0},nonNullable:!0})],p.prototype,"value",void 0),p=(0,i._)([(0,u.$)("esri.time.TimeInterval")],p);const y=p},92935:(e,t,r)=>{var i;r.d(t,{X:()=>i}),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(i||(i={}))}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9377,3069],{39516:(e,t,n)=>{async function i(e,t){const{WhereClause:i}=await Promise.all([n.e(835),n.e(4800)]).then(n.bind(n,50835));return i.create(e,{fieldsIndex:t})}function r(e,t){return"1=1"===e?t??e:"1=1"===t?e??t:null!=e&&""!==e?null!=t&&""!==t?`(${e}) AND (${t})`:e:t}n.d(t,{G:()=>i,m:()=>r})},3330:(e,t,n)=>{n.d(t,{GB:()=>r,Qo:()=>s,Y4:()=>o});var i=n(96285);class r{}function o(e){return e instanceof i.bo?e===r.instance:"unknown"===e?.toString().toLowerCase()}function s(e){return o(e)?r.instance:e}r.instance=new i.oh("Etc/UTC")},13069:(e,t,n)=>{n.d(t,{lk:()=>r,vD:()=>s,yS:()=>o});const i="randomUUID"in crypto;function r(){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`{${r().toUpperCase()}}`}function s(){return`{${r()}}`}},70328:(e,t,n)=>{n.d(t,{BI:()=>x,Ej:()=>f,Hq:()=>u,Ie:()=>F,Jt:()=>w,Ne:()=>h,RF:()=>l,_F:()=>m,aI:()=>T,fA:()=>o,gX:()=>y,hZ:()=>_,iT:()=>a,is:()=>v,qv:()=>M,vI:()=>g,v_:()=>N,vt:()=>r,w1:()=>s});var i=n(5443);function r(e=N){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function o(e,t,n,i,o,s,l=r()){return l[0]=e,l[1]=t,l[2]=n,l[3]=i,l[4]=o,l[5]=s,l}function s(e,t){const n=isFinite(e[2])||isFinite(e[5]);return new i.A(n?{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 u(e,t,n=0,i=t.length/3){let r=e[0],o=e[1],s=e[2],l=e[3],a=e[4],u=e[5];for(let e=0;e<i;e++)r=Math.min(r,t[n+3*e]),o=Math.min(o,t[n+3*e+1]),s=Math.min(s,t[n+3*e+2]),l=Math.max(l,t[n+3*e]),a=Math.max(a,t[n+3*e+1]),u=Math.max(u,t[n+3*e+2]);e[0]=r,e[1]=o,e[2]=s,e[3]=l,e[4]=a,e[5]=u}function p(e){return e[0]>=e[3]?0:e[3]-e[0]}function d(e){return e[1]>=e[4]?0:e[4]-e[1]}function c(e){return e[2]>=e[5]?0:e[5]-e[2]}function m(e){const t=p(e),n=c(e),i=d(e);return Math.sqrt(t*t+n*n+i*i)}function y(e,t=[0,0,0]){return t[0]=e[0]+p(e)/2,t[1]=e[1]+d(e)/2,t[2]=e[2]+c(e)/2,t}function f(e,t=[0,0,0]){return t[0]=p(e),t[1]=d(e),t[2]=c(e),t}function h(e,t,n=e){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n!==e&&(n[3]=e[3],n[4]=e[4],n[5]=e[5]),n}function g(e,t,n=e){return n[3]=t[0],n[4]=t[1],n[5]=t[2],n!==e&&(n[0]=e[0],n[1]=e[1],n[2]=e[2]),e}function _(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 F(e){return e?_(e,M):r(M)}function w(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 x(e,t,n,i,r){return e[0]=t,e[1]=n,e[2]=Number.NEGATIVE_INFINITY,e[3]=i,e[4]=r,e[5]=Number.POSITIVE_INFINITY,e}function v(e){return 6===e.length}function T(e,t,n){if(null==e||null==t)return e===t;if(!v(e)||!v(t))return!1;if(n){for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1}else for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}n(19419);const M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],N=[0,0,0,0,0,0];r()},33143:(e,t,n)=>{n.d(t,{A:()=>m});var i=n(90237),r=n(69540),o=n(25482),s=n(10107),l=(n(44208),n(53966),n(87811),n(36005)),a=n(40608),u=n(43937),p=n(72088),d=n(29005);let c=class extends((0,r.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 n of Object.keys(e))t[n]=(0,p.rS)(e[n]);return t}writeDomains(e,t){const n={};for(const t of Object.keys(e))e[t]&&(n[t]=e[t]?.toJSON());t.domains=n}};(0,i._)([(0,s.M)({json:{write:!0}})],c.prototype,"id",void 0),(0,i._)([(0,s.M)({json:{write:!0}})],c.prototype,"name",void 0),(0,i._)([(0,s.M)({json:{write:!0}})],c.prototype,"domains",void 0),(0,i._)([(0,l.w)("domains")],c.prototype,"readDomains",null),(0,i._)([(0,u.K)("domains")],c.prototype,"writeDomains",null),(0,i._)([(0,s.M)({type:[d.A],json:{write:!0}})],c.prototype,"templates",void 0),c=(0,i._)([(0,a.$)("esri.layers.support.FeatureType")],c);const m=c},20437:(e,t,n)=>{n.d(t,{A:()=>h});var i,r=n(90237),o=n(66552),s=n(25482),l=n(10107),a=n(56507),u=(n(87811),n(44208),n(93223)),p=n(36005),d=n(40608),c=n(72088),m=n(98453);const y=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 f=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 n=null;try{n=t?JSON.parse(t):null}catch(e){}return n?.value??null}readValueType(e,{description:t}){let n=null;try{n=t?JSON.parse(t):null}catch(e){}return n?y.fromJSON(n.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,r._)([(0,l.M)({type:String,json:{write:!0}})],f.prototype,"alias",void 0),(0,r._)([(0,l.M)({type:[String,Number],json:{write:{allowNull:!0}}})],f.prototype,"defaultValue",void 0),(0,r._)([(0,l.M)()],f.prototype,"description",void 0),(0,r._)([(0,p.w)("description")],f.prototype,"readDescription",null),(0,r._)([(0,l.M)({types:c.gK,json:{read:{reader:c.rS},write:!0}})],f.prototype,"domain",void 0),(0,r._)([(0,l.M)({type:Boolean,json:{write:!0}})],f.prototype,"editable",void 0),(0,r._)([(0,l.M)({type:a.jz,json:{write:{overridePolicy:e=>({enabled:Number.isFinite(e)})}}})],f.prototype,"length",void 0),(0,r._)([(0,l.M)({type:String,json:{write:!0}})],f.prototype,"name",void 0),(0,r._)([(0,l.M)({type:Boolean,json:{write:!0}})],f.prototype,"nullable",void 0),(0,r._)([(0,u.e)(m.m)],f.prototype,"type",void 0),(0,r._)([(0,l.M)()],f.prototype,"valueType",void 0),(0,r._)([(0,p.w)("valueType",["description"])],f.prototype,"readValueType",null),(0,r._)([(0,l.M)({type:Boolean,json:{read:!1}})],f.prototype,"visible",void 0),f=i=(0,r._)([(0,d.$)("esri.layers.support.Field")],f);const h=f},95466:(e,t,n)=>{n.d(t,{A:()=>c});var i=n(49186),r=n(25482),o=n(53966),s=n(91869),l=n(3330),a=n(30524),u=n(56400),p=n(96285);const d=new Map;class c{static fromJSON(e){return new c(e.fields,e.timeZoneByFieldName)}static fromLayer(e){return new c(e.fields??[],h(e))}static fromLayerJSON(e){return new c(e.fields??[],h(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 n=[];for(const e of this.fields){const t=e?.name,i=y(t);if(t&&i){const r=m(t);this._fieldsMap.set(t,e),this._fieldsMap.set(r,e),this._normalizedFieldsMap.set(i,e),n.push(`${r}:${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)}}n.sort(),this.uid=n.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(m(e))??this._normalizedFieldsMap.get(y(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}'`)),u.n$):f.has(t.type)?u.L5:null:null}getLuxonTimeZone(e){const t=this.getTimeZone(e);return t?t===u.L5?l.GB.instance:t===u.n$?p.mQ.utcInstance:(0,s.tE)(d,t,(()=>p.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,r.Wj)(e)?e.toJSON():e)),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}function m(e){return e.trim().toLowerCase()}function y(e){return(0,a.rS)(e)?.toLowerCase()??""}const f=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function h(e){const t=new Map;if(!e.fields)return t;const n=!0===e.datesInUnknownTimezone,{timeInfo:i,editFieldsInfo:r}=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,u.ZS)(e.dateFieldsTimeReference):null,a=r?function(e){return"timeZone"in e}(r)?r.timeZone??l:r.dateFieldsTimeReference?(0,u.ZS)(r.dateFieldsTimeReference):l??u.n$:null,p=i?function(e){return"timeZone"in e}(i)?i.timeZone??l:i.timeReference?(0,u.ZS)(i.timeReference):l:null,d=new Map([[m(r?.creationDateField??""),a],[m(r?.editDateField??""),a],[m(o),p],[m(s),p]]);for(const{name:i,type:r}of e.fields)if(f.has(r))t.set(i,u.L5);else if("date"!==r&&"esriFieldTypeDate"!==r)t.set(i,null);else if(n)t.set(i,u.L5);else{const e=d.get(m(i??""))??l;t.set(i,e)}return t}},72088:(e,t,n)=>{n.d(t,{rS:()=>M,gK:()=>T}),n(44208);var i,r=n(90237),o=n(4718),s=n(10107),l=(n(53966),n(93223)),a=n(40608),u=n(25482);n(87811);let p=i=class extends u.oY{constructor(e){super(e),this.name=null,this.code=null}clone(){return new i({name:this.name,code:this.code})}};(0,r._)([(0,s.M)({type:String,json:{write:!0}})],p.prototype,"name",void 0),(0,r._)([(0,s.M)({type:[String,Number],json:{write:!0}})],p.prototype,"code",void 0),p=i=(0,r._)([(0,a.$)("esri.layers.support.CodedValue")],p);const d=new(n(66552).J)({inherited:"inherited",codedValue:"coded-value",range:"range"});let c=class extends u.oY{constructor(e){super(e),this.name=null,this.type=null}};(0,r._)([(0,s.M)({type:String,json:{write:!0}})],c.prototype,"name",void 0),(0,r._)([(0,l.e)(d)],c.prototype,"type",void 0),c=(0,r._)([(0,a.$)("esri.layers.support.Domain")],c);const m=c;var y;let f=y=class extends m{constructor(e){super(e),this.codedValues=null,this.type="coded-value"}getName(e){let t=null;if(this.codedValues){const n=String(e);this.codedValues.some((e=>(String(e.code)===n&&(t=e.name),!!t)))}return t}clone(){return new y({codedValues:(0,o.o8)(this.codedValues),name:this.name})}};(0,r._)([(0,s.M)({type:[p],json:{write:!0}})],f.prototype,"codedValues",void 0),(0,r._)([(0,l.e)({codedValue:"coded-value"})],f.prototype,"type",void 0),f=y=(0,r._)([(0,a.$)("esri.layers.support.CodedValueDomain")],f);const h=f;var g;n(49186);let _=g=class extends m{constructor(e){super(e),this.type="inherited"}clone(){return new g}};(0,r._)([(0,l.e)({inherited:"inherited"})],_.prototype,"type",void 0),_=g=(0,r._)([(0,a.$)("esri.layers.support.InheritedDomain")],_);const F=_;var w;let x=w=class extends m{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,r._)([(0,s.M)({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,n){t[n]=[this.minValue||0,e]}}}})],x.prototype,"maxValue",void 0),(0,r._)([(0,s.M)({json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range?.[0]},write:{target:"range",writer(e,t,n){t[n]=[e,this.maxValue||0]}}}})],x.prototype,"minValue",void 0),(0,r._)([(0,l.e)({range:"range"})],x.prototype,"type",void 0),x=w=(0,r._)([(0,a.$)("esri.layers.support.RangeDomain")],x);const v=x,T={key:"type",base:m,typeMap:{range:x,"coded-value":h,inherited:F}};function M(e){if(!e?.type)return null;switch(e.type){case"range":return v.fromJSON(e);case"codedValue":return h.fromJSON(e);case"inherited":return F.fromJSON(e)}return null}},98453:(e,t,n)=>{n.d(t,{m:()=>i});const i=new(n(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,n)=>{n.d(t,{BI:()=>h,D3:()=>y,XJ:()=>f,lc:()=>m,mX:()=>_,rU:()=>g,tH:()=>T});var i=n(799);const r="__begin__",o="__end__",s=new RegExp(r,"ig"),l=new RegExp(o,"ig"),a=new RegExp("^"+r,"i"),u=new RegExp(o+"$","i"),p='"',d=p+" + ",c=" + "+p;function m(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function y(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function f(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=m(e.labelExpression),t.type="conventional"),t}function h(e){const t=f(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=f(e);if(!t)return null;switch(t.type){case"conventional":return function(e){const t=e?.match(F);return t?.[1].trim()||null}(t.expression);case"arcade":return T(t.expression)}return null}function _(e){let t;return e?(t=(0,i.HC)(e,(e=>r+'$feature["'+e+'"]'+o)),t=a.test(t)?t.replace(a,""):p+t,t=u.test(t)?t.replace(u,""):t+p,t=t.replaceAll(s,d).replaceAll(l,c)):t='""',t}const F=/^\s*\{([^}]+)\}\s*$/i,w=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,x=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,v=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function T(e){if(!e)return null;let t=w.exec(e)||x.exec(e);return t?t[1]||t[3]:(t=v.exec(e),t?t[2]:null)}},58501:(e,t,n)=>{n.d(t,{q:()=>r});var i=n(62815);function r(e,t,n){if(!n?.features||!n.hasZ)return;const r=(0,i.N)(n.geometryType,t,e.outSpatialReference);if(null!=r)for(const e of n.features)r(e.geometry)}},22671:(e,t,n)=>{n.d(t,{A:()=>F});var i,r=n(90237),o=n(59456),s=n(52106),l=n(66552),a=n(25482),u=n(4718),p=n(10107),d=(n(44208),n(53966),n(36005)),c=n(40608),m=n(43937),y=n(16930),f=n(65864),h=n(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 n=y.A.fromJSON(t.spatialReference),i=[];for(let t=0;t<e.length;t++){const r=e[t],o=s.A.fromJSON(r),l=r.geometry?.spatialReference;null==o.geometry||l||(o.geometry.spatialReference=n);const a=r.aggregateGeometries,u=o.aggregateGeometries;if(a&&null!=u)for(const e in u){const t=u[e],i=a[e],r=i?.spatialReference;null==t||r||(t.spatialReference=n)}i.push(o)}return i}writeGeometryType(e,t,n,i){if(e)return void g.write(e,t,n,i);const{features:r}=this;if(r)for(const e of r)if(null!=e?.geometry)return void g.write(e.geometry.type,t,n,i)}readQueryGeometry(e,t){if(!e)return null;const n=!!e.spatialReference,i=(0,f.rS)(e);return i&&!n&&t.spatialReference&&(i.spatialReference=y.A.fromJSON(t.spatialReference)),i}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:n}=this;if(n)for(const e of n)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,u.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 n=0;n<t.features.length;n++){const i=t.features[n];if(i.geometry){const t=e?.[n];i.geometry=t?.toJSON()||i.geometry}}return t}quantize(e){const{scale:[t,n],translate:[i,r]}=e,o=this.features,s=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-i)/t)),(e=>Math.round((r-e)/n)));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:n}=this;if(!n)return this;const{translate:[i,r],scale:[o,s]}=n;let l=null,a=null;if(this.hasZ&&null!=n?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=n;l=n=>n*t+e}if(this.hasM&&null!=n?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=n;a=n=>null==n?n:n*t+e}const u=this._getHydrationFunction(e,(e=>e*o+i),(e=>r-e*s),l,a);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}_quantizePoints(e,t,n){let i,r;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=n(l[1]);e===i&&s===r||(o.push([e-i,s-r]),i=e,r=s)}else i=t(l[0]),r=n(l[1]),o.push([i,r])}return o.length>0?o:null}_getQuantizationFunction(e,t,n){return"point"===e?e=>(e.x=t(e.x),e.y=n(e.y),e):"polyline"===e||"polygon"===e?e=>{const i=(0,f.Bi)(e)?e.rings:e.paths,r=[];for(let e=0,o=i.length;e<o;e++){const o=i[e],s=this._quantizePoints(o,t,n);s&&r.push(s)}return r.length>0?((0,f.Bi)(e)?e.rings=r:e.paths=r,e):null}:"multipoint"===e?e=>{const i=this._quantizePoints(e.points,t,n);return i&&i.length>0?(e.points=i,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,n,i,r){return"point"===e?e=>{e.x=t(e.x),e.y=n(e.y),i&&(e.z=i(e.z))}:"polyline"===e||"polygon"===e?e=>{const o=(0,f.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,r=i.length;e<r;e++){const r=i[e];e>0?(s+=r[0],l+=r[1]):(s=r[0],l=r[1]),r[0]=t(s),r[1]=n(l)}}if(i&&r)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,n=t.length;e<n;e++){const n=t[e];n[2]=i(n[2]),n[3]=r(n[3])}}else if(i)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,n=t.length;e<n;e++){const n=t[e];n[2]=i(n[2])}}else if(r)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,n=t.length;e<n;e++){const n=t[e];n[2]=r(n[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=n(e.ymin),e.xmax=t(e.xmax),e.ymax=n(e.ymax),i&&null!=e.zmax&&null!=e.zmin&&(e.zmax=i(e.zmax),e.zmin=i(e.zmin)),r&&null!=e.mmax&&null!=e.mmin&&(e.mmax=r(e.mmax),e.mmin=r(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]=n(l)}if(i&&r)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=i(t[2]),t[3]=r(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(r)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=r(t[2])}}:null}};(0,r._)([(0,p.M)({type:String,json:{write:!0}})],_.prototype,"displayFieldName",void 0),(0,r._)([(0,p.M)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"exceededTransferLimit",void 0),(0,r._)([(0,p.M)({type:[s.A],json:{write:!0}})],_.prototype,"features",void 0),(0,r._)([(0,d.w)("features")],_.prototype,"readFeatures",null),(0,r._)([(0,p.M)({type:[h.A],json:{write:!0}})],_.prototype,"fields",void 0),(0,r._)([(0,p.M)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],_.prototype,"geometryType",void 0),(0,r._)([(0,m.K)("geometryType")],_.prototype,"writeGeometryType",null),(0,r._)([(0,p.M)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"hasM",void 0),(0,r._)([(0,p.M)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"hasZ",void 0),(0,r._)([(0,p.M)({types:o.yR,json:{write:!0}})],_.prototype,"queryGeometry",void 0),(0,r._)([(0,d.w)("queryGeometry")],_.prototype,"readQueryGeometry",null),(0,r._)([(0,p.M)({type:y.A,json:{write:!0}})],_.prototype,"spatialReference",void 0),(0,r._)([(0,m.K)("spatialReference")],_.prototype,"writeSpatialReference",null),(0,r._)([(0,p.M)({json:{write:!0}})],_.prototype,"transform",void 0),_=i=(0,r._)([(0,c.$)("esri.rest.support.FeatureSet")],_),_.prototype.toJSON.isDefaultToJSON=!0;const F=_}}]);