/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["require","exports","../../../chunks/_rollupPluginBabelHelpers","../../../chunks/tslib.es6","../../../core/maybe","../../../core/uuid","../../../core/accessorSupport/decorators/property","../../../core/arrayUtils","../../../core/has","../../../core/accessorSupport/ensureType","../../../core/accessorSupport/decorators/subclass","../../../intl/duration","../../Widget","../css","./Label","./LabeledColorPicker","../../support/widgetUtils","../../support/decorators/messageBundle","../../support/jsxFactory"],(function(e,r,o,t,s,i,a,c,n,l,u,p,d,g,h,_,C,b,v){"use strict";r.DiscreteConfigurator=function(r){function t(e){var o;return(o=r.call(this,e)||this).colorPickerVisible=!0,o._selectId=`select-${i.generateUUID()}`,o._colorPickerId=`color-picker-${i.generateUUID()}`,o._onColorChange=e=>{o.options.color=e},o}o._inheritsLoose(t,r);var a=t.prototype;return a.loadDependencies=function(){return Promise.all([new Promise(((r,o)=>e(["../../../chunks/calcite-label"],r,o))),new Promise(((r,o)=>e(["../../../chunks/calcite-select"],r,o)))])},a.render=function(){const e=this._messages.discrete,r=e.intervalLabel,{color:o,interval:t,intervalOptions:i}=this.options;return v.tsx("div",{class:g.DISCRETE_CONFIGURATOR_CSS.base},v.tsx(h.Label,{for:this._selectId,label:r},v.tsx("calcite-select",{id:this._selectId,label:r,bind:this,onCalciteSelectChange:this._onIntervalChange},i.toArray().map((e=>v.tsx("calcite-option",{key:e,selected:e===t,value:String(e)},s.unwrapOr(p.formatDuration(e,{round:!0,largest:2}),"")))))),this.colorPickerVisible&&v.tsx(_.LabeledColorPicker,{id:this._colorPickerId,label:e.colorLabel,value:o,onChange:this._onColorChange}))},a._onIntervalChange=function(e){var r;const o=e.target,t=parseInt(null==(r=o.selectedOption)?void 0:r.value,10);Number.isFinite(t)&&(this.options.interval=t)},t}(d),t.__decorate([a.property()],r.DiscreteConfigurator.prototype,"options",void 0),t.__decorate([a.property()],r.DiscreteConfigurator.prototype,"colorPickerVisible",void 0),t.__decorate([a.property(),b.messageBundle("esri/widgets/ShadowCast/t9n/ShadowCast")],r.DiscreteConfigurator.prototype,"_messages",void 0),r.DiscreteConfigurator=t.__decorate([u.subclass("esri.widgets.ShadowCast.components.DiscreteConfigurator")],r.DiscreteConfigurator),Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
