// 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
require({cache:{"url:widgets/LayerList/LayerFilter.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"search-input-node invalid" data-dojo-attach-point\x3d"searchInputNode"\x3e\r\n    \x3cdiv class\x3d"clear-input-button disable" tabindex\x3d"0" role\x3d"button" aria-label\x3d\'${nls.tipClearText}\' data-dojo-attach-point\x3d"clearInputButton" data-dojo-attach-event\x3d"click:_onClearInputButton"\x3e\x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"search-button" data-dojo-attach-point\x3d"searchButton" role\x3d"button" tabindex\x3d"0" data-dojo-attach-event\x3d"click:_onSearchBtnClick"\x3e\x3c/div\x3e\r\n  \x3cdiv class\x3d"cancel-button invalid" data-dojo-attach-point\x3d"cancelButton" role\x3d"button" tabindex\x3d"0" data-dojo-attach-event\x3d"click:_onCancelBtnClick"\x3e${nls.cancel}\x3c/div\x3e\r\n\x3c/div\x3e\r\n'}});
define("dijit/_WidgetBase dojo/_base/declare dojo/_base/lang dijit/_TemplatedMixin dojo/text!./LayerFilter.html dojo/dom dojo/on dojo/keys dojo/dom-class dijit/focus jimu/utils jimu/dijit/Search".split(" "),function(k,l,e,m,n,p,h,c,b,f,q,r){return l([k,m],{templateString:n,baseClass:"layer-filter",layerFilterInput:null,isValid:!1,layerListWidget:null,layerInfoIsValidStatus:null,layerInfoIsExpandStatus:null,postMixInProperties:function(){this.inherited(arguments);this.nls=e.mixin(e.clone(this.layerListWidget.nls),
window.jimuNls.common)},constructor:function(){this.layerInfoIsValidStatus={};this.layerInfoIsExpandStatus={}},startup:function(){this.layerFilterInput=(new r({placeholder:this.nls.typeAKeywork,onSearch:e.hitch(this,this._onFilter),searchWhenInput:!0})).placeAt(this.searchInputNode);p.setSelectable(this.cancelButton,!1);this.own(h(this.searchButton,"keydown",e.hitch(this,"_onSearchButtonKey")));this.own(h(this.layerFilterInput.inputSearch,"keydown",e.hitch(this,"_onLayerFilterInputKey")));this.own(h(this.clearInputButton,
"keydown",e.hitch(this,"_onClearInputButtonKey")));this.own(h(this.cancelButton,"keydown",e.hitch(this,"_onCancelButtonKey")))},_updateLayerInfoStatus:function(a){this.layerInfoIsValidStatus={};this.layerInfoIsExpandStatus={};this.layerListWidget.operLayerInfos.traversalAll(e.hitch(this,function(g){if(a){var d;if(0<=g.title.toLowerCase().indexOf(a.toLowerCase()))for(d=g;d;)this.layerInfoIsValidStatus[d.id]=!0,(d=d.parentLayerInfo)&&(this.layerInfoIsExpandStatus[d.id]=!0);else for(d=g.parentLayerInfo;d;){if(0<=
d.title.toLowerCase().indexOf(a.toLowerCase())){this.layerInfoIsValidStatus[g.id]=!0;break}d=d.parentLayerInfo}}else this.layerInfoIsValidStatus[g.id]=!0}))},isValidLayerInfo:function(a){return!this.isValid||this.layerInfoIsValidStatus[a.id]},isExpanded:function(a){return this.isValid&&this.layerInfoIsExpandStatus[a.id]},cancelFilter:function(a){this.isValid=!1;this.layerFilterInput.inputSearch.value&&(this.layerFilterInput.inputSearch.value="",this.layerListWidget._refresh());b.remove(this.searchButton,
"invalid");b.add(this.searchInputNode,"invalid");b.add(this.cancelButton,"invalid");a&&f.focus(this.searchButton)},hideFilter:function(){b.remove(this.searchButton,"invalid");b.add(this.searchInputNode,"invalid");b.add(this.cancelButton,"invalid");f.focus(this.searchButton)},_onFilter:function(a){a?b.remove(this.clearInputButton,"disable"):b.add(this.clearInputButton,"disable");this._updateLayerInfoStatus(a);this.layerListWidget._refresh()},_onSearchBtnClick:function(){this.isValid=!0;b.add(this.searchButton,
"invalid");b.remove(this.searchInputNode,"invalid");b.remove(this.cancelButton,"invalid");this.layerFilterInput.inputSearch.focus()},_onCancelBtnClick:function(){this.cancelFilter(!0)},_onClearInputButton:function(){this.layerFilterInput.inputSearch.value&&(b.add(this.clearInputButton,"disable"),this.layerFilterInput.inputSearch.focus(),this.layerFilterInput.inputSearch.value="",this._updateLayerInfoStatus(""),this.layerListWidget._refresh())},_onSearchButtonKey:function(a){a.keyCode===c.ENTER&&this._onSearchBtnClick()},
_onLayerFilterInputKey:function(a){a.keyCode===c.TAB&&a.shiftKey?(a.stopPropagation(),a.preventDefault(),this._enableNavMode(a)):a.keyCode!==c.TAB||a.shiftKey?a.keyCode===c.ESCAPE&&(a.stopPropagation(),a.preventDefault(),this.hideFilter()):(a.stopPropagation(),a.preventDefault(),this._enableNavMode(a),b.contains(this.clearInputButton,"disable")?f.focus(this.cancelButton):f.focus(this.clearInputButton))},_onClearInputButtonKey:function(a){a.keyCode===c.TAB&&a.shiftKey?(a.stopPropagation(),a.preventDefault(),
this._enableNavMode(a),f.focus(this.layerFilterInput.inputSearch)):a.keyCode!==c.TAB||a.shiftKey?a.keyCode===c.ENTER?(a.stopPropagation(),a.preventDefault(),this._onClearInputButton()):a.keyCode===c.ESCAPE&&(a.stopPropagation(),a.preventDefault(),this.hideFilter()):(a.stopPropagation(),a.preventDefault(),f.focus(this.cancelButton))},_onCancelButtonKey:function(a){a.keyCode===c.TAB&&a.shiftKey?(a.stopPropagation(),a.preventDefault(),this._enableNavMode(a),f.focus(this.layerFilterInput.inputSearch)):
a.keyCode!==c.TAB||a.shiftKey?a.keyCode===c.ENTER?(a.stopPropagation(),a.preventDefault(),this._onCancelBtnClick()):a.keyCode===c.ESCAPE&&(a.stopPropagation(),a.preventDefault(),this.hideFilter()):(a.stopPropagation(),a.preventDefault(),this._enableNavMode(a))},_enableNavMode:function(a){a.keyCode!==c.TAB||q.isInNavMode()||b.add(document.body,"jimu-nav-mode")}})});