/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../config.js";import o from"../request.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{getFilename as s}from"../core/urlUtils.js";import{property as l,subclass as n}from"../core/accessorSupport/decorators.js";import p from"../geometry/Extent.js";import{isWGS84 as a}from"../geometry/support/spatialReferenceUtils.js";import m from"./Layer.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{OperationalLayer as u}from"./mixins/OperationalLayer.js";import{PortalLayer as c}from"./mixins/PortalLayer.js";import{RefreshableLayer as d}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as f}from"./mixins/ScaleRangeLayer.js";import{id as h,legendEnabled as S,url as g}from"./support/commonProperties.js";import v from"../symbols/PictureMarkerSymbol.js";import b from"../symbols/SimpleFillSymbol.js";import j from"../symbols/SimpleLineSymbol.js";import x from"../symbols/SimpleMarkerSymbol.js";import C from"../symbols/Symbol.js";import{reader as P}from"../core/accessorSupport/decorators/reader.js";const G=["atom","xml"],L={base:C,key:"type",typeMap:{"simple-line":j},errorContext:"symbol"},R={base:C,key:"type",typeMap:{"picture-marker":v,"simple-marker":x},errorContext:"symbol"},k={base:C,key:"type",typeMap:{"simple-fill":b},errorContext:"symbol"};let _=class extends(y(d(u(c(f(r(m))))))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.legendEnabled=!0,this.lineSymbol=null,this.pointSymbol=null,this.polygonSymbol=null,this.operationalLayerType="GeoRSS",this.url=null,this.type="geo-rss"}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}readFeatureCollections(e,t){return t.featureCollection.layers.forEach(e=>{const t=e.layerDefinition.drawingInfo.renderer.symbol;t&&"esriSFS"===t.type&&t.outline?.style.includes("esriSFS")&&(t.outline.style="esriSLSSolid")}),t.featureCollection.layers}get hasPoints(){return this._hasGeometry("esriGeometryPoint")}get hasPolylines(){return this._hasGeometry("esriGeometryPolyline")}get hasPolygons(){return this._hasGeometry("esriGeometryPolygon")}get title(){const e=this._get("title");return e&&"defaults"!==this.originOf("title")?e:this.url?s(this.url,G)||"GeoRSS":e}set title(e){this._set("title",e)}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service","Feature Service","Feature Collection","Scene Service"]},e).catch(i).then(()=>this._fetchService(t)).then(e=>{this.read(e,{origin:"service"})})),Promise.resolve(this)}async hasDataChanged(){const e=await this._fetchService();return this.read(e,{origin:"service",ignoreDefaults:!0}),!0}async _fetchService(e){const r=this.spatialReference,{data:i}=await o(t.geoRSSServiceUrl,{query:{url:this.url,refresh:!!this.loaded||void 0,outSR:a(r)?void 0:r.wkid??JSON.stringify(r)},signal:e});return i}_hasGeometry(e){return this.featureCollections?.some(t=>t.featureSet?.geometryType===e&&t.featureSet.features?.length>0)??!1}};e([l()],_.prototype,"description",void 0),e([l()],_.prototype,"featureCollections",void 0),e([P("service","featureCollections",["featureCollection.layers"])],_.prototype,"readFeatureCollections",null),e([l({type:p,json:{name:"lookAtExtent"}})],_.prototype,"fullExtent",void 0),e([l(h)],_.prototype,"id",void 0),e([l(S)],_.prototype,"legendEnabled",void 0),e([l({types:L,json:{write:!0}})],_.prototype,"lineSymbol",void 0),e([l({type:["show","hide"]})],_.prototype,"listMode",void 0),e([l({types:R,json:{write:!0}})],_.prototype,"pointSymbol",void 0),e([l({types:k,json:{write:!0}})],_.prototype,"polygonSymbol",void 0),e([l({type:["GeoRSS"]})],_.prototype,"operationalLayerType",void 0),e([l(g)],_.prototype,"url",void 0),e([l({json:{origins:{service:{read:{source:"name",reader:e=>e||void 0}}}}})],_.prototype,"title",null),e([l({readOnly:!0,json:{read:!1},value:"geo-rss"})],_.prototype,"type",void 0),_=e([n("esri.layers.GeoRSSLayer")],_);const w=_;export{w as default};
