// 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/AddData/search/templates/SortOptions.html":'\x3cdiv class\x3d"search-sort-options"\x3e\r\n  \x3clabel for\x3d"${id}_select" class\x3d"sort-prompt"\x3e${i18n.search.sortOptions.prompt}\x3c/label\x3e \r\n  \x3cselect id\x3d"${id}_select"\r\n    data-dojo-type\x3d"dijit/form/Select" data-dojo-attach-point\x3d"sortSelect"\x3e\r\n    \x3coption value\x3d"" selected\x3d"selected"\x3e${i18n.search.sortOptions.relevance}\x3c/option\x3e\r\n    \x3coption value\x3d"title"\x3e${i18n.search.sortOptions.title}\x3c/option\x3e\r\n    \x3coption value\x3d"owner"\x3e${i18n.search.sortOptions.owner}\x3c/option\x3e\r\n    \x3coption value\x3d"avgrating"\x3e${i18n.search.sortOptions.rating}\x3c/option\x3e\r\n    \x3coption value\x3d"numviews"\x3e${i18n.search.sortOptions.views}\x3c/option\x3e\r\n    \x3coption value\x3d"modified"\x3e${i18n.search.sortOptions.date}\x3c/option\x3e\r\n  \x3c/select\x3e\r\n  \x3ca href\x3d"#" class\x3d"sort-order-icon"\r\n    title\x3d"${i18n.search.sortOptions.switchOrder}"\r\n    data-dojo-attach-point\x3d"sortOrderBtn"\r\n    data-dojo-attach-event\x3d"onclick: sortOrderClicked"\x3e\r\n  \x3c/a\x3e\r\n\x3c/div\x3e\r\n'}});
define("dojo/_base/declare dojo/on dojo/dom-class ./SearchComponent dojo/text!./templates/SortOptions.html dojo/i18n!../nls/strings dijit/form/Select".split(" "),function(e,f,c,g,h,k){return e([g],{i18n:k,templateString:h,sortField:null,sortOrder:null,postCreate:function(){this.inherited(arguments);this.updateSortOrderButton();var a=this;this.own(this.sortSelect.on("change",function(){var b=a.sortField=a.sortSelect.get("value");if(""===b)a.sortOrder=null;else if("title"===b||"owner"===b)a.sortOrder=
"asc";else if("avgrating"===b||"numviews"===b||"modified"===b)a.sortOrder="desc";a.updateSortOrderButton();a.search()}));this.own(f(this.sortSelect.dropDown,"open",function(){var b=this.domNode.parentElement;b&&c.add(b,"add-data-widget-popup")}))},sortOrderClicked:function(){"asc"===this.sortOrder?(this.sortOrder="desc",this.updateSortOrderButton(),this.search()):"desc"===this.sortOrder&&(this.sortOrder="asc",this.updateSortOrderButton(),this.search())},updateSortOrderButton:function(){var a=this.sortOrderBtn;
a.style.visibility=null!==this.sortField&&0<this.sortField.length?"visible":"hidden";"desc"===this.sortOrder?c.add(a,"descending"):c.remove(a,"descending")},appendQueryParams:function(a){a.sortField=null;a.sortOrder=null;var b=this.sortField,d=this.sortOrder;null!==b&&0<b.length?(a.sortField=b,null!==d&&0<d.length&&(a.sortOrder=d)):a.canSortByRelevance||(a.sortField="numviews",a.sortOrder="desc")}})});