/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../chunks/_rollupPluginBabelHelpers","../chunks/tslib.es6","../config","../request","../symbols","../core/maybe","../core/MultiOriginJSONSupport","../core/promiseUtils","../core/urlUtils","../core/accessorSupport/decorators/property","../core/arrayUtils","../core/has","../core/accessorSupport/ensureType","../core/accessorSupport/decorators/reader","../core/accessorSupport/decorators/subclass","../geometry/Extent","../geometry/support/spatialReferenceUtils","./Layer","./mixins/BlendLayer","./mixins/OperationalLayer","./mixins/PortalLayer","./mixins/RefreshableLayer","./mixins/ScaleRangeLayer","./support/commonProperties","../symbols/Symbol","../symbols/SimpleLineSymbol","../symbols/PictureMarkerSymbol","../symbols/SimpleMarkerSymbol","../symbols/SimpleFillSymbol"],(function(e,r,t,o,i,l,n,s,a,p,y,c,u,d,m,S,h,f,_,v,g,b,L,k,C,x,G,P,R){"use strict";const M=["atom","xml"],E={base:C,key:"type",typeMap:{"simple-line":x},errorContext:"symbol"},F={base:C,key:"type",typeMap:{"picture-marker":G,"simple-marker":P},errorContext:"symbol"},O={base:C,key:"type",typeMap:{"simple-fill":R},errorContext:"symbol"};let w=function(r){function i(...e){var t;return(t=r.call(this,...e)||this).description=null,t.fullExtent=null,t.legendEnabled=!0,t.lineSymbol=null,t.pointSymbol=null,t.polygonSymbol=null,t.operationalLayerType="GeoRSS",t.url=null,t.type="geo-rss",t}e._inheritsLoose(i,r);var n=i.prototype;return n.normalizeCtorArgs=function(e,r){return"string"==typeof e?{url:e,...r}:e},n.readFeatureCollections=function(e,r){return r.featureCollection.layers.forEach((e=>{var r;const t=e.layerDefinition.drawingInfo.renderer.symbol;t&&"esriSFS"===t.type&&null!=(r=t.outline)&&r.style.includes("esriSFS")&&(t.outline.style="esriSLSSolid")})),r.featureCollection.layers},n.load=function(e){const r=l.isSome(e)?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service","Feature Service","Feature Collection","Scene Service"]},e).catch(s.throwIfAbortError).then((()=>this._fetchService(r))).then((e=>{this.read(e,{origin:"service"})}))),Promise.resolve(this)},n.hasDataChanged=function(){var r=e._asyncToGenerator((function*(){const e=yield this._fetchService();return this.read(e,{origin:"service",ignoreDefaults:!0}),!0}));function t(){return r.apply(this,arguments)}return t}(),n._fetchService=function(){var r=e._asyncToGenerator((function*(e){var r;const i=this.spatialReference,{data:l}=yield o(t.geoRSSServiceUrl,{query:{url:this.url,refresh:!!this.loaded||void 0,outSR:h.isWGS84(i)?void 0:null!=(r=i.wkid)?r:JSON.stringify(i)},signal:e});return l}));function i(e){return r.apply(this,arguments)}return i}(),n._hasGeometry=function(e){var r,t;return null!=(r=null==(t=this.featureCollections)?void 0:t.some((r=>{var t,o;return(null==(t=r.featureSet)?void 0:t.geometryType)===e&&(null==(o=r.featureSet.features)?void 0:o.length)>0})))&&r},e._createClass(i,[{key:"hasPoints",get:function(){return this._hasGeometry("esriGeometryPoint")}},{key:"hasPolylines",get:function(){return this._hasGeometry("esriGeometryPolyline")}},{key:"hasPolygons",get:function(){return this._hasGeometry("esriGeometryPolygon")}},{key:"title",get:function(){const e=this._get("title");return e&&"defaults"!==this.originOf("title")?e:this.url?a.getFilename(this.url,M)||"GeoRSS":e||""},set:function(e){this._set("title",e)}}]),i}(_.BlendLayer(b.RefreshableLayer(v.OperationalLayer(g.PortalLayer(L.ScaleRangeLayer(n.MultiOriginJSONMixin(f)))))));r.__decorate([p.property()],w.prototype,"description",void 0),r.__decorate([p.property()],w.prototype,"featureCollections",void 0),r.__decorate([d.reader("service","featureCollections",["featureCollection.layers"])],w.prototype,"readFeatureCollections",null),r.__decorate([p.property({type:S,json:{name:"lookAtExtent"}})],w.prototype,"fullExtent",void 0),r.__decorate([p.property(k.id)],w.prototype,"id",void 0),r.__decorate([p.property(k.legendEnabled)],w.prototype,"legendEnabled",void 0),r.__decorate([p.property({types:E,json:{write:!0}})],w.prototype,"lineSymbol",void 0),r.__decorate([p.property({type:["show","hide"]})],w.prototype,"listMode",void 0),r.__decorate([p.property({types:F,json:{write:!0}})],w.prototype,"pointSymbol",void 0),r.__decorate([p.property({types:O,json:{write:!0}})],w.prototype,"polygonSymbol",void 0),r.__decorate([p.property({type:["GeoRSS"]})],w.prototype,"operationalLayerType",void 0),r.__decorate([p.property(k.url)],w.prototype,"url",void 0),r.__decorate([p.property({json:{origins:{service:{read:{source:"name",reader:e=>e||void 0}}}}})],w.prototype,"title",null),r.__decorate([p.property({readOnly:!0,json:{read:!1},value:"geo-rss"})],w.prototype,"type",void 0),w=r.__decorate([m.subclass("esri.layers.GeoRSSLayer")],w);return w}));
