// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
define("dojo/_base/array dojo/_base/declare dojo/_base/lang dojo/dom-class ./settingComponents ./SettingCheckbox ./SettingContainer ./SettingObject ./SettingOptionsTable ./SettingStaticText".split(" "),function(d,k,f,g,l,m,n,p,q,r){return k(p,{_inputControl:null,_detailsDiv:null,_detailsTitle:null,_detailsCheckbox:null,_iCurrentDetails:-1,_menuItems:[],constructor:function(a,b,c){this.nls=b;this._inputControl=new q(null,"half-width","",b.propertyLabels.name,null,b.hints.selectionListOfOptionsToDisplay,
f.hitch(this,this._onRowSelected));this._detailsTitle=new r;this._detailsCheckbox=new m(null,b.propertyLabels.useRelatedRecords,"",f.hitch(this,this._checkboxChanged));this._detailsDiv=l.container("half-width optionsTableHeaderHeight","majorTrailingVertGap",[this._detailsTitle.div(),this._detailsCheckbox.div()]);this._mainDiv=(new n(null,"flexbox "+(c||""),"majorTrailingHorizGap",b.groupingLabels.addressSources,"full-width",[this._inputControl,this._detailsDiv])).div()},setConfig:function(){var a=
[this._config[0]];var b=this._config.slice(1);this._menuItems=d.map(b,function(c){return c.name});this._menuItems=0<this._menuItems.length?[].concat(a,this._menuItems):[a];this._inputControl.setValue(this._menuItems);this._setDetails(0)},getConfig:function(a,b){var c=this._config.slice(1);this._menuItems=this._inputControl.getValue();var e=[this._menuItems[0]];d.forEach(this._menuItems.slice(1),function(t){d.some(c,function(h){t===h.name&&e.push(h)})});this._config=e;0>this._config[0].indexOf("1")&&
b.push(this.nls.problems.noAddresseeLayers)},_setDetails:function(a){var b=this._config.length-1;0<=a&&a<b&&"boolean"===typeof this._config[a+1].useRelatedRecords?(g.remove(this._detailsDiv,"hidden"),this._detailsTitle.setValue(this._config[a+1].name),this._iCurrentDetails=a,this._detailsCheckbox.setValue(this._config[a+1].useRelatedRecords)):(g.add(this._detailsDiv,"hidden"),this._iCurrentDetails=-1)},_onRowSelected:function(a){var b=a.innerText.trim();d.some(this._menuItems,f.hitch(this,function(c,
e){return c===b?(this._setDetails(e-1),!0):!1}))},_checkboxChanged:function(a){0<=this._iCurrentDetails&&(this._config[this._iCurrentDetails+1].useRelatedRecords=a)}})});