import{__decorate as e}from"tslib";import{applyJsonToLayer as t,layerToJson as r}from"../json/LayerJson.js";import{serializable as i}from"../support/Serializable.js";import{notifyChange as a}from"../support/observableUtils.js";import{ReadOnlyCollection as o}from"../utilities/ReadOnlyCollection.js";import{isStreamLayer as s}from"../utilities/_layers.js";import{LayerExtension as n,LayerExtensionSchema as l}from"./_LayerExtension.js";import{ArrayWrappedCollection as p}from"./support/ArrayWrappedCollection.js";import{PopupTemplateFeatureSettings as y}from"./support/PopupTemplateFeatureSettings.js";let c=class extends n{get layer(){return super.layer}get _layerView(){return this.layer&&this.mapExtension?._allLayerViews.find((e=>e.layer===this.layer))}get hasFeatures(){return!0}get renderer(){return this.layer.renderer}get canChangeLabels(){return!0}get canChangeRenderer(){return!0}get canChangeDefinitionExpression(){return!0}_getProjectWebmapJSON(){const e=super._getProjectWebmapJSON();if(!e||this.dynamicallyAddedLayer)return e;const{layerDefinition:t}=r(this.layer),{definitionExpression:i,drawingInfo:a}=t??{};return i&&(e.layerDefinition={...e.layerDefinition,definitionExpression:i}),a&&(e.layerDefinition={...e.layerDefinition,drawingInfo:a}),e}_capabilities(){return{...super._capabilities(),supportsStandardizedQueries:!0}}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,layer:{...this._toPropertyDef(e.layer),default:{layerType:"ArcGISStreamLayer"}}}}_createSchema(){return new d(this)}_isSupportedLayer(e){return s(e)}_createFeatureSettings(){return new u(this)}async _applyPortalItemProperties(e){if("Stream Service"!==e.type)throw new Error(`Cannot create Stream Layer from Portal item that has type: ${e.type}`);this.layer.url=e.url||this.layer.url;const r=await e.fetchData();r&&Object.keys(r).length>0&&await t(r,this.layer)}};c=e([i],c);export{c as StreamLayerExtension};let d=class extends l{_fieldCollection;constructor(e){super(e),this._fieldCollection=this._createFieldCollection(),a(this,"_fields")}destroy(){this._fieldCollection.destroy(),super.destroy()}get _fields(){return this._fieldCollection}_createFieldCollection(){return new o(new p({parent:this._layerExtension,targetProperty:"layer",arrayProperty:"fields"}),{destroyBackingCollection:!0})}_getPropertyBindings(){return{primaryKeyField:"objectIdField",geometryType:"geometryType",spatialReference:"spatialReference",displayField:"displayField"}}};d=e([i],d);export{d as StreamLayerSchema};let u=class extends y{get zoomScale(){const e="point"===this._layerExtension.schema.geometryType?this._layerExtension.layer.maxScale:void 0;return this._getSetting("zoomScale",e)}set zoomScale(e){this._setSetting("zoomScale",e)}};u=e([i],u);