/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../layers/support/RangeDomain","../FieldConfig","../FieldGroupConfig"],(function(e,i,n,t){"use strict";function l(e){var i;const n={},t=[];return null==(i=e.expressionInfos)||i.map((e=>n[e.name]=e.expression)),{config:a(e.elements,n,t),encounteredUnsupportedTypes:t}}function o(e,t,l){const{description:o,domain:a,editable:s,fieldName:u,hint:r,input:p,label:d,requiredExpression:m,visibilityExpression:f}=e,c=t[m]||null,y=t[f]||null,g=new n({description:o,domain:a,editable:s,hint:r,label:d,name:u,requiredExpression:c,visibilityExpression:y});if(p)if("barcode-scanner"===p.type||"text-area"===p.type||"text-box"===p.type)g.minLength=p.minLength,g.maxLength=p.maxLength;else if("combo-box"===p.type||"radio-buttons"===p.type)g.noValueOptionLabel=p.noValueOptionLabel,g.showNoValueOption=p.showNoValueOption;else if("switch"===p.type)g.offValue=p.offValue,g.onValue=p.onValue;else if("datetime-picker"===p.type){g.includeTime=p.includeTime;const{max:e,min:n}=p;if(e||n){const t="range"===(null==a?void 0:a.type)?Math.min(null==e?void 0:e.getTime(),a.maxValue):null==e?void 0:e.getTime(),l="range"===(null==a?void 0:a.type)?Math.max(null==n?void 0:n.getTime(),a.minValue):null==n?void 0:n.getTime();g.domain=new i({maxValue:t,minValue:l,name:"__internal-range-domain-based-on-datetime-picker-input__"})}}else l.push({type:"unsupported-input-type",details:p});return g}function a(e,i,n,l=!0){return e.map((e=>{if("field"===e.type)return o(e,i,n);if("group"===e.type){if(!l)return n.push({type:"nested-group",details:e}),null;const o=i[e.visibilityExpression]||null;return new t({description:e.description,state:e.initialState,fieldConfig:a(e.elements,i,n,!1),label:e.label,visibilityExpression:o})}return n.push({type:"unsupported-element-type",details:e}),null})).filter((e=>!!e))}e.fieldConfigsFromFormTemplate=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
