// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../chunks/tslib.es6 ../../Graphic ../../PopupTemplate ../../renderers/ClassBreaksRenderer ../../renderers/DictionaryRenderer ../../renderers/DotDensityRenderer ../../renderers/HeatmapRenderer ../../renderers/PieChartRenderer ../../renderers/Renderer ../../renderers/SimpleRenderer ../../renderers/UniqueValueRenderer ../../renderers/support/jsonUtils ../../renderers/support/types ../../request ../../core/Error ../../core/jsonMap ../../core/Loadable ../../core/Logger ../../core/Promise ../../core/accessorSupport/decorators/property ../../core/has ../../core/RandomLCG ../../core/accessorSupport/decorators/enumeration ../../core/accessorSupport/decorators/reader ../../core/accessorSupport/decorators/subclass ../../geometry/Extent ../../geometry/SpatialReference ../FeatureLayer ./BuildingSublayer ../support/capabilities ../support/commonProperties ../support/fieldProperties ../support/FieldsIndex ../support/fieldUtils ../support/I3SIndexInfo ../support/I3SLayerDefinitions ../../rest/support/Query ../../support/popupUtils ../../symbols/support/ElevationInfo ../../views/3d/layers/i3s/I3SUtil ../../views/layers/support/popupUtils".split(" "), function(c,p,q,k,N,O,P,Q,R,S,T,U,r,t,l,u,b,v,w,d,V,W,x,y,z,A,B,m,C,D,E,F,G,H,I,g,J,K,L,M,n){k=F.defineFieldProperties();b=class extends b.LoadableMixin(w.EsriPromiseMixin(C)){constructor(a){super(a);this.type="building-component";this.nodePages=null;this.materialDefinitions=[];this.textureSetDefinitions=[];this.geometryDefinitions=[];this.store=this.serviceUpdateTimeStamp=this.indexInfo=null;this.attributeStorageInfo=[];this.fields=[];this.outFields=this.associatedLayer=null;this.listMode="show"; this.definitionExpression=this.renderer=null;this.popupEnabled=!0;this.popupTemplate=null;this.layerType="3d-object"}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new G(this.fields)}readAssociatedLayer(a,e){a=this.layer.associatedFeatureServiceItem;e=e.associatedLayerID;return null!=a&&"number"===typeof e?new m({portalItem:a,customParameters:this.customParameters,layerId:e}):null}get objectIdField(){if(null!= this.fields)for(const a of this.fields)if("oid"===a.type)return a.name;return null}get displayField(){return null!=this.associatedLayer?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get customParameters(){return this.layer.customParameters}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(a){const e= null!=a?a.signal:null;a=this._fetchService(e).then(()=>{this.indexInfo=I.fetchIndexInfo(this.parsedUrl.path,this.rootNode,this.nodePages,this.customParameters,this.apiKey,v.getLogger(this),e)});this.addResolvingPromise(a);return Promise.resolve(this)}createPopupTemplate(a){return K.createPopupTemplate(this,a)}async _fetchService(a){a=(await t(this.parsedUrl.path,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:a})).data;this.read(a,{origin:"service",url:this.parsedUrl})}getField(a){return this.fieldsIndex.get(a)}getFieldDomain(a, e){return(e=this.getFeatureType(e?.feature)?.domains?.[a])&&"inherited"!==e.type?e:this.getField(a)?.domain??null}getFeatureType(a){return a&&null!=this.associatedLayer?this.associatedLayer.getFeatureType(a):null}get types(){return null!=this.associatedLayer?this.associatedLayer.types??[]:[]}get typeIdField(){return null!=this.associatedLayer?this.associatedLayer.typeIdField:null}get geometryType(){return"3d-object"===this.layerType?"mesh":"point"}get profile(){return"3d-object"===this.layerType? "mesh-pyramids":"points"}get capabilities(){const {query:a,data:{supportsZ:e,supportsM:f,isVersioned:h}}=null!=this.associatedLayer&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:D.zeroCapabilities;return{query:a,data:{supportsZ:e,supportsM:f,isVersioned:h}}}createQuery(){const a=new J;"mesh"!==this.geometryType&&(a.returnGeometry=!0,a.returnZ=!0);a.where=this.definitionExpression||"1\x3d1";a.sqlFormat="standard";return a}queryExtent(a,e){return this._getAssociatedLayerForQuery().then(f=> f.queryExtent(a||this.createQuery(),e))}queryFeatureCount(a,e){return this._getAssociatedLayerForQuery().then(f=>f.queryFeatureCount(a||this.createQuery(),e))}queryFeatures(a,e){return this._getAssociatedLayerForQuery().then(f=>f.queryFeatures(a||this.createQuery(),e)).then(f=>{if(f?.features)for(const h of f.features)h.layer=this.layer,h.sourceLayer=this;return f})}queryObjectIds(a,e){return this._getAssociatedLayerForQuery().then(f=>f.queryObjectIds(a||this.createQuery(),e))}async queryCachedAttributes(a, e){const f=H.unpackFieldNames(this.fieldsIndex,await n.getRequiredFields(this,n.getFetchPopupTemplate(this)));return M.queryAttributesFromCachedAttributesId(this.parsedUrl.path,this.attributeStorageInfo,a,e,f,this.apiKey,this.customParameters)}async queryCachedFeature(a,e){a=await this.queryCachedAttributes(a,[e]);if(!a||0===a.length)throw new l("scenelayer:feature-not-in-cached-data","Feature not found in cached data");return new p({attributes:a[0],layer:this,sourceLayer:this})}getFieldUsageInfo(a){return this.fieldsIndex.has(a)? {supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:null!=this.associatedLayer}}_getAssociatedLayerForQuery(){const a=this.associatedLayer;return null!=a&&a.loaded?Promise.resolve(a):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){await this.load();if(null==this.associatedLayer)throw new l("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer", {layer:this});try{await this.associatedLayer.load()}catch(a){throw new l("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:a});}return this.associatedLayer}};c.__decorate([d.property({readOnly:!0})],b.prototype,"parsedUrl",null);c.__decorate([d.property({type:g.I3SNodePageDefinition,readOnly:!0})],b.prototype,"nodePages",void 0);c.__decorate([d.property({type:[g.I3SMaterialDefinition],readOnly:!0})],b.prototype,"materialDefinitions", void 0);c.__decorate([d.property({type:[g.I3STextureSetDefinition],readOnly:!0})],b.prototype,"textureSetDefinitions",void 0);c.__decorate([d.property({type:[g.I3SGeometryDefinition],readOnly:!0})],b.prototype,"geometryDefinitions",void 0);c.__decorate([d.property({readOnly:!0})],b.prototype,"serviceUpdateTimeStamp",void 0);c.__decorate([d.property({readOnly:!0})],b.prototype,"store",void 0);c.__decorate([d.property({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],b.prototype,"rootNode", void 0);c.__decorate([d.property({readOnly:!0})],b.prototype,"attributeStorageInfo",void 0);c.__decorate([d.property(k.fields)],b.prototype,"fields",void 0);c.__decorate([d.property({readOnly:!0})],b.prototype,"fieldsIndex",null);c.__decorate([d.property({readOnly:!0,type:m})],b.prototype,"associatedLayer",void 0);c.__decorate([y.reader("service","associatedLayer",["associatedLayerID"])],b.prototype,"readAssociatedLayer",null);c.__decorate([d.property(k.outFields)],b.prototype,"outFields",void 0); c.__decorate([d.property({type:String,readOnly:!0})],b.prototype,"objectIdField",null);c.__decorate([d.property({readOnly:!0,type:String,json:{read:!1}})],b.prototype,"displayField",null);c.__decorate([d.property({readOnly:!0,type:String})],b.prototype,"apiKey",null);c.__decorate([d.property({readOnly:!0,type:String})],b.prototype,"customParameters",null);c.__decorate([d.property({readOnly:!0,type:A})],b.prototype,"fullExtent",null);c.__decorate([d.property({readOnly:!0,type:B})],b.prototype,"spatialReference", null);c.__decorate([d.property({readOnly:!0})],b.prototype,"version",null);c.__decorate([d.property({readOnly:!0,type:L})],b.prototype,"elevationInfo",null);c.__decorate([d.property({readOnly:!0,type:Number})],b.prototype,"minScale",null);c.__decorate([d.property({readOnly:!0,type:Number})],b.prototype,"maxScale",null);c.__decorate([d.property({readOnly:!0,type:Number})],b.prototype,"effectiveScaleRange",null);c.__decorate([d.property({type:["hide","show"],json:{write:!0}})],b.prototype,"listMode", void 0);c.__decorate([d.property({types:r.webSceneRendererTypes,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],b.prototype,"renderer",void 0);c.__decorate([d.property({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],b.prototype,"definitionExpression",void 0);c.__decorate([d.property(E.popupEnabled)],b.prototype,"popupEnabled",void 0); c.__decorate([d.property({type:q,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],b.prototype,"popupTemplate",void 0);c.__decorate([d.property({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],b.prototype,"normalReferenceFrame",void 0);c.__decorate([d.property({readOnly:!0,json:{read:!1}})],b.prototype,"defaultPopupTemplate",null);c.__decorate([d.property()],b.prototype,"types",null);c.__decorate([d.property()],b.prototype,"typeIdField", null);c.__decorate([d.property({json:{write:!1}}),x.enumeration(new u.JSONMap({"3DObject":"3d-object",Point:"point"}))],b.prototype,"layerType",void 0);c.__decorate([d.property()],b.prototype,"geometryType",null);c.__decorate([d.property()],b.prototype,"profile",null);c.__decorate([d.property({readOnly:!0,json:{read:!1}})],b.prototype,"capabilities",null);c.__decorate([d.property({readOnly:!0})],b.prototype,"statisticsInfo",void 0);return b=c.__decorate([z.subclass("esri.layers.buildingSublayers.BuildingComponentSublayer")], b)});