/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../../core/Collection.js";import{JSONSupportMixin as t}from"../../core/JSONSupport.js";import o from"../../core/Warning.js";import{subclass as s}from"../../core/accessorSupport/decorators.js";import n from"../../geometry/Polygon.js";import{canProjectWithoutEngine as i,projectPolygon as a}from"../../geometry/projectionUtils.js";var c;let l=c=class extends(t(r.ofType(n))){constructor(e){super(e)}clone(){return new c(this.items.map(e=>e.clone()))}write(e,r){return this.toJSON(r)}toJSON(e){const r=e?.layer?.spatialReference;return r?this.toArray().map(t=>{if(!r.equals(t.spatialReference)){if(!i(t.spatialReference,r))return e?.messages?.push(new o("scenefilter:unsupported","Scene filters with incompatible spatial references are not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),null;const s=new n;a(t,s,r),t=s}const s=t.toJSON(e);return delete s.spatialReference,s}).filter(e=>null!=e):this.toArray().map(r=>r.toJSON(e))}static fromJSON(e,r){const t=new c;return e.forEach(e=>t.add(n.fromJSON(e,r))),t}};l=c=e([s("esri.layers.support.PolygonCollection")],l);const p=l;export{p as default};
