/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as r}from"tslib";import{ClonableMixin as e}from"../../core/Clonable.js";import t from"../../core/Collection.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as i,subclass as s}from"../../core/accessorSupport/decorators.js";import{compareMinScale as l}from"../../geometry/support/scaleUtils.js";import p from"./DisplayFilter.js";import{createDisplayFilterJSONContext as a}from"./displayFilterUtils.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";let c=class extends(e(o)){constructor(r){super(r),this.activeFilterId=null,this.filters=new(t.ofType(p)),this.mode="manual"}writeFilters(r,e,t,o){const i=r.toArray();"scale"===this.mode&&i.sort((r,e)=>{const t=l(e.minScale,r.minScale),o=r.maxScale-e.maxScale;return 0===t?o:t}),e[t]=i.map(r=>r.toJSON(o))}write(r,e){return super.write(r,a(this,e))}};r([i({type:String,json:{write:{overridePolicy:(r,e,t)=>({enabled:"manual"===t.filterMode,isRequired:!0})}}})],c.prototype,"activeFilterId",void 0),r([i({type:t.ofType(p),nonNullable:!0,json:{write:!0}})],c.prototype,"filters",void 0),r([m("filters")],c.prototype,"writeFilters",null),r([i({type:["manual","scale"],nonNullable:!0,json:{name:"filterMode",write:!0}})],c.prototype,"mode",void 0),c=r([s("esri.layers.support.DisplayFilterInfo")],c);export{c as default};
