function FilterLanguagesLocal(){var n=[],i=[],t=$(".filter-language:checked").length,r=$(".filter-pubgroup:checked").length;r>0?t<1?($.each($(".filter-pubgroup:checked"),function(){n.push('#resultsAccordion *[data-pubgroup*="'+$(this).val()+'"]')}),r>0&&$.each($(".filter-pubgroup:not(:checked)"),function(){i.push('#resultsAccordion *[data-pubgroup*="'+$(this).val()+'"]')}),$("#resultsAccordion *[data-pubgroup]").hide(),$(n.join(",")).show()):($.each($(".filter-language:checked"),function(){var t=$(this).val();$.each($(".filter-pubgroup:checked"),function(){n.push('#resultsAccordion *[data-language*="'+t+'"][data-pubgroup*="'+$(this).val()+'"]')})}),$("#resultsAccordion *[data-language]").hide(),$(n.join(",")).show()):t<1?$("#resultsAccordion *[data-language]").show():($.each($(".filter-language:checked"),function(){n.push('#resultsAccordion *[data-language*="'+$(this).val()+'"]')}),t>0&&$.each($(".filter-language:not(:checked)"),function(){i.push('#resultsAccordion *[data-language*="'+$(this).val()+'"]')}),$("#resultsAccordion *[data-language]").hide(),$(n.join(",")).show())}function FilterPubGroupsLocal(){var n=[],i=[],t=$(".filter-pubgroup:checked").length,r=$(".filter-language:checked").length;r>0?t<1?($.each($(".filter-language:checked"),function(){n.push('#resultsAccordion *[data-language*="'+$(this).val()+'"]')}),r>0&&$.each($(".filter-language:not(:checked)"),function(){i.push('#resultsAccordion *[data-language*="'+$(this).val()+'"]')}),$("#resultsAccordion *[data-language]").hide(),$(n.join(",")).show()):($.each($(".filter-pubgroup:checked"),function(){var t=$(this).val();$.each($(".filter-language:checked"),function(){n.push('#resultsAccordion *[data-language*="'+$(this).val()+'"][data-pubgroup*="'+t+'"]')})}),$("#resultsAccordion *[data-language]").hide(),$(n.join(",")).show()):t<1?$("#resultsAccordion *[data-pubgroup]").show():($.each($(".filter-pubgroup:checked"),function(){n.push('#resultsAccordion *[data-pubgroup*="'+$(this).val()+'"]')}),t>0&&$.each($(".filter-pubgroup:not(:checked)"),function(){i.push('#resultsAccordion *[data-pubgroup*="'+$(this).val()+'"]')}),$("#resultsAccordion *[data-pubgroup]").hide(),$(n.join(",")).show())}function GetFormData(){var t=$("#searchForm"),n=t.serializeArray();return $("input[name='Languages']:checked").each(function(){n.push({name:"Languages",value:$(this).val()})}),$("input[name='PubGroups']:checked").each(function(){n.push({name:"PubGroups",value:$(this).val()})}),$(".filter-classification:checked").each(function(){n.push({name:"Classifications",value:$(this).val()})}),$(".filter-edition:checked").each(function(){n.push({name:"Editions",value:$(this).val()})}),n}function OpenSearch(n){var r,t,i,u,f;if(event.preventDefault(),r=!1,stopEmptySearch===!0&&(t=$("#Keywords").val(),i=$("#Models").val(),(typeof t=="undefined"||t===null||t.length<1)&&(typeof i=="undefined"||i===null||i.length<1)&&(r=!0)),r)return!1;u=0;f=!1;u=n!==undefined?n:$("#PageNumber").val();f=$("#FromNav").val();Search(u,"","",f)}function Search(n,t,i,r){if($("#SearchResults").length>0){n!==undefined&&$("#searchForm input[name='PageNumber']").val(n);$("#progressBackgroundFilter, #processMessage").show();var u=GetFormData(),f=$("html").attr("lang");return $("#SearchFilter input, #SearchFilter button").attr("disabled","disabled"),searchUrl="/"+f+"/Search/"+$("#searchMethod").val(),$.ajax({url:searchUrl,type:"POST",dataType:"html",data:u,success:function(n){var r,f;console.log("SEARCH PAGED!");$("#progressBackgroundFilter, #processMessage").hide();$("#SearchFilter input, #SearchFilter button").attr("disabled",null);r=$("#SearchType");r&&r.val()==="token"&&searchUrl.toLowerCase().indexOf("instruction")<0?$("#SearchResults").replaceWith($(n)):r&&r.val()==="pin"&&searchUrl.toLowerCase().indexOf("instruction")<0?$("#SearchResults").replaceWith($(n)):(f=$(n).find("#SearchResults").addBack("#SearchResults"),$("#SearchResults").replaceWith(f));translateSite();convertPrice();reportToGoogle==="true"&&ReportToGoogleAnalytics(u);addBehaviors();t&&i&&dataLayerSubmit({event:"facetedSearch",attributes:{pagePath:document.location.pathname,searchKey:t,searchValue:i,quantity:$("#totalSearchResults").val()}})},error:function(){$("#progressBackgroundFilter, #processMessage").hide();$("#SearchFilter input").attr("disabled",null);$("#SearchResults").replaceWith('<div id="SearchResults"><\/div>')}}),!1}return r&&$("#searchForm").submit(),!1}function ReportToGoogleAnalytics(n){var t,i,r;for(let r=0,u=n.length;r<u;r++)n[r].name==="SearchTerm"&&(t=n[r].value),n[r].name==="SearchPubType"&&(i=n[r].value);t&&t!==""&&(r=searchUrl+"?terms="+encodeURI(t),i&&i!==""&&(r=r+"&pt="+encodeURI(i)),ga("MidlandAccount.send","pageview",r))}function ClearFilters(n=true,t=null){t?$("."+t+":checked").prop("checked",!1):($(".filter-language:checked").prop("checked",!1),$(".filter-pubgroup:checked").prop("checked",!1),$(".filter-classification:checked").prop("checked",!1),$(".filter-editions:checked").prop("checked",!1));n&&Search(0)}function automatedSearch(n){var t=$(n).data("search-term");t!==""&&($("#SearchTerm").length>0&&$("#searchForm").length>0&&$("#SearchTerm").val(t),Search(0))}function loadEquipmentCard(n){var t=getPubAction();$.ajax({url:t,type:"POST",data:n,success:function(t){if($("#pubajax_"+n.SerialRangeId+"_"+n.FileMetaId).replaceWith(t),$("#headingPub_"+n.SerialRangeId+"_"+n.FileMetaId+",#collapsePub_"+n.SerialRangeId+"_"+n.FileMetaId).localize(),convertPrice(),$("#headingPub_"+n.SerialRangeId+"_"+n.FileMetaId).is(":visible")){var i=$("#headingPub_"+n.SerialRangeId+"_"+n.FileMetaId).parent().data("language"),r=$("#headingPub_"+n.SerialRangeId+"_"+n.FileMetaId).parent().data("pubgroup");FilterLanguagesLocal();FilterPubGroupsLocal()}$("#headingPub_"+n.SerialRangeId+"_"+n.FileMetaId+' .uxf-icon[data-toggle="tooltip"]').tooltip("dispose");$("#headingPub_"+n.SerialRangeId+"_"+n.FileMetaId+' .uxf-icon[data-toggle="tooltip"]').tooltip()},error:function(n,t){console.log(t+" :: "+n.status+" - "+n.statusText)}})}function loadPinProductCard(n,t){var i=getPinPubAction();$.ajax({url:i,type:"POST",data:n,success:function(n){if(n&&n.length>0){$("#heading_"+t).parent().replaceWith(n).localize();var i=$(n).children(".card-header").prop("id");$("#"+i+" button[data-toggle=collapse]").click();convertPrice()}else $("#collapse_"+t+" div.spinner-border").remove(),$("#collapse_"+t+" div.alert-info").show()},error:function(n,t){console.log(t+" :: "+n.status+" - "+n.statusText)}})}function getDownload(n){var i=$(n).data("product-format-id"),u=$(n).data("product-pubtype"),f=$(n).data("product-name"),e=$(n).data("product-marketingcode");if(i!==""){toastr.info(i18next.t("resource:GlobalDownloadRequested"));var o={downloadId:i,publicationType:u,productName:f,marketingCode:e},t=$(n),r=t.siblings(".uxf-spinner-border-sm");t.hide();r.show();$.ajax({url:"/api/download/free",processData:!1,contentType:"application/json",cache:!1,type:"POST",data:JSON.stringify(o),xhrFields:{responseType:"blob",onprogress:function(n){n.lengthComputable}},error:function(n){toastr.error(i18next.t("resource:GlobalDownloadErrorDuringDownload"));console.log("Error downloading content file.",n)},success:function(n,i,u){var o="",h=u.getResponseHeader("Content-Disposition"),a,s,v,c,l,e,f;h&&h.indexOf("attachment")!==-1&&(a=/filename[^;=\n]*=(([""]).*?\2|[^;\n]*)/,s=a.exec(h),s!==null&&s[1]&&(o=s[1].replace(/[""]/g,"")));v=u.getResponseHeader("Content-Type");c=new Blob([n],{type:v});typeof window.navigator.msSaveBlob!="undefined"?window.navigator.msSaveBlob(c,o):(l=window.URL||window.webkitURL,e=l.createObjectURL(c),o?(f=document.createElement("a"),typeof f.download=="undefined"?window.open(e,"_blank"):(f.href=e,f.target="_blank",f.download=o,document.body.appendChild(f),f.click())):window.open(e,"_blank"),setTimeout(function(){l.revokeObjectURL(e)},3e3));toastr.clear();toastr.success(i18next.t("resource:GlobalDownloadSuccess"));r.hide();t.show()}})}}function setupEdAutoComplete(n,t){$(t+"[data-searchType=ed]").bind("keydown",function(n){n.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active&&n.preventDefault()}).autocomplete({source:function(n,t){$.ajax({url:"/api/TokenSearch/Suggest?part="+n.term,type:"POST",data:GetFormData(),success:function(n){if(n!==null){var i=[];$.each(n,function(n,t){t.token==="TOKEN"?i.unshift({label:t.text,value:t.token}):t.token==="result"?$(".result-count").text(t.text):t.token==="query"?$(".query-time").text(t.text+" seconds"):t.token==="total"?$(".total-time").text(t.text+" seconds"):i.push({label:t.text,value:t.token})});t(i)}else t([])},error:function(n,t){alert(t)}})},search:function(){},focus:function(){return!1},select:function(t,i){if(i.item.value!=="TOKEN")return this.value=i.item.label,$("#tokenizedSearch").click(),!1;var r=n.split(this.value);return r.pop(),r.push(i.item.label),this.value=r.join(" "),!1}})}function setupEqAutoComplete(n,t){$(t+"[data-searchType=eq]").bind("keydown",function(n){n.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active&&n.preventDefault()}).autocomplete({source:function(n,t){$.ajax({url:"/api/TokenSearch/Suggest?part="+n.term,type:"POST",data:GetFormData(),success:function(n){if(n!==null){var i=[];$.each(n,function(n,t){t.token==="TOKEN"?i.unshift({label:t.text,value:t.token}):t.token==="result"?$(".result-count").text(t.text):t.token==="query"?$(".query-time").text(t.text+" seconds"):t.token==="total"?$(".total-time").text(t.text+" seconds"):i.push({label:t.text,value:t.token})});t(i)}else t([])},error:function(n,t){alert(t)}})},search:function(){},focus:function(){return!1},select:function(t,i){if(i.item.value!=="TOKEN")return this.value=i.item.label,$("#IsSuggestion")&&$("#IsSuggestion").val(!0),$("#tokenizedSearch").click(),!1;var r=n.split(this.value);return r.pop(),r.push(i.item.label),this.value=r.join(" "),!1}})}function setupInAutoComplete(n,t){$(t+"[data-searchType=in]").bind("keydown",function(n){n.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active&&n.preventDefault()}).autocomplete({source:function(n,t){$.ajax({url:"/api/TokenSearch/Suggest?part="+n.term,type:"POST",data:GetFormData(),success:function(n){if(n!==null){var i=[];$.each(n,function(n,t){t.token==="TOKEN"?i.unshift({label:t.text,value:t.token}):t.token==="result"?$(".result-count").text(t.text):t.token==="query"?$(".query-time").text(t.text+" seconds"):t.token==="total"?$(".total-time").text(t.text+" seconds"):i.push({label:t.text,value:t.token})});t(i)}else t([])},error:function(n,t){alert(t)}})},search:function(){},focus:function(){return!1},select:function(t,i){if(i.item.value!=="TOKEN")return this.value=i.item.label,$("#tokenizedSearch").click(),!1;var r=n.split(this.value);return r.pop(),r.push(i.item.label),this.value=r.join(" "),!1}})}typeof String.prototype.endsWith!="function"&&(String.prototype.endsWith=function(n){return this.indexOf(n,this.length-n.length)!==-1});$(document).on("keypress",function(n){if($(this).parents("#loginForm"))return!0;n.which===13&&(n.preventDefault(),OpenSearch())});$(document).on("click","#copyLink",function(){var n=document.getElementById("searchLink");n.focus();n.select();document.execCommand("copy")});$(document).on("change",".search-sort",function(){var n=$(this).val();return $("#searchForm input[name='SearchSort']").val(n),Search(0,"SearchSort",n),!1});$(document).on("change",".search-result-pagesize",function(){var n=$(this).val();return $("#searchForm input[name='PageSize']").val(n),Search(0,"PageSize",n),!1});$(document).on("change","#SearchType",function(){var n=$("#SearchType").val();return n==="model"?($('[data-pubgroup][data-pinsearch-show="False"]').removeClass("d-none"),$("#SearchFilter").show(),$("#langFilters").show(),$("#deereLangFilters").hide(),$("#pinDisclaimer").hide(),$("#editionFilters").show(),$("#classFilters").show(),$("#SearchSort").val("Model")):n==="pin"?($("#pinDisclaimerModal").modal("show"),$('[data-pubgroup][data-pinsearch-show="False"]').addClass("d-none"),$("#SearchFilter").show(),$("#pinDisclaimer").show(),$("#langFilters").hide(),$("#deereLangFilters").show(),$("#pubGroupFilters").show(),$("#editionFilters").hide(),$("#classFilters").hide(),$("#Models").hide(),$("#SearchSort").val("ProductName")):($('[data-pubgroup][data-pinsearch-show="False"]').removeClass("d-none"),$("#SearchFilter").show(),$("#langFilters").show(),$("#deereLangFilters").hide(),$("#pinDisclaimer").hide(),$("#editionFilters").hide(),$("#classFilters").hide(),$("#Models").show(),$("#SearchSort").val("Relevance")),$("#searchForm div.uxf-search span.dropdown-toggle").removeAttr("data-i18n"),$("#SearchResults").html(""),$("#Keywords").val(null),ClearFilters(!1),!1});$(document).on("click",".filter-language-showhide",function(){return $(this).data("show")==="priority"?($(this).data("show","all"),$(this).text($(this).data("showless")),$('.filter-language-display[data-priority="False"]').show()):($(this).data("show","priority"),$(this).text($(this).data("showmore")),$('.filter-language-display[data-priority="False"]').hide()),!1});$(document).on("click",".filter-pubgroup-showhide",function(){return $(this).data("show")==="priority"?($(this).data("show","all"),$(this).text($(this).data("showless")),$('.filter-pubgroup-display[data-priority="False"]').show()):($(this).data("show","priority"),$(this).text($(this).data("showmore")),$('.filter-pubgroup-display[data-priority="False"]').hide()),!1});$(document).on("click",".filter-edition-showhide",function(){return $(this).data("show")==="priority"?($(this).data("show","all"),$(this).text($(this).data("showless")),$('.filter-edition-display[data-priority="False"]').show()):($(this).data("show","priority"),$(this).text($(this).data("showmore")),$('.filter-edition-display[data-priority="False"]').hide()),!1});$(document).on("click","#SearchPager a",function(){var n=new RegExp("page=([0-9]+)","i").exec($(this).prop("href")),t=0;return n!==null&&(t=n[1]-1),Search(t),$("html, body").animate({scrollTop:0},0),!1});$(document).on("change",".filter-language",function(){var n=$(this).val();$("#searchMethod").val()==="Equipment"&&$("#SearchType").val()==="model"?FilterLanguagesLocal():Search(0,"Language",n)});$(document).on("change",".filter-pubgroup",function(){var n=$(this).val();$("#searchMethod").val()==="Equipment"&&$("#SearchType").val()==="model"?FilterPubGroupsLocal():Search(0,"PubGroup",n)});$(document).on("change",".filter-classification",function(){var n=$(this).val();Search(0,"Classification",n)});$(document).on("change",".filter-edition",function(){var n=$(this).val();Search(0,"Edition",n)});window.TokenSearch=function(){function n(n){return n.split(/\s+/)}return{groupKey:"",_url:"",_resultTemplate:"",_templateSource:null,_template:null,_currentPage:null,_pageCount:null,_totalResults:null,_curPage:1,_totalPages:1,init:function(n,t,i,r,u,f,e,o,s,h){var c=this;this._currentPage=$(f);this._pageCount=$(e);this._totalResults=$(o);this.groupKey=r;this._resultTemplate=u;this._templateSource=$(this._resultTemplate).html();$("body").on("click",".common-query",function(){c.doSearch("/api/TokenSearch/Search?queryId=",$(this).data("token"))});$("body").on("click",i,function(n){n.preventDefault();$.ajax({url:c._url+"/api/TokenSearch/PickItem?queryId="+$("#resultQueryId").val()+"&metadataId="+$(this).data("metadataid"),type:"POST",contentType:"application/json",data:JSON.stringify($("#groupKey").val())})});setupEdAutoComplete(c,n);setupEqAutoComplete(c,n);setupInAutoComplete(c,n);$("--"+n).bind("keydown",function(n){n.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active&&n.preventDefault()}).autocomplete({source:function(n,t){$.ajax({url:"/api/TokenSearch/Suggest?part="+n.term,type:"POST",data:GetFormData(),success:function(n){if(n!==null){var i=[];$.each(n,function(n,t){t.token==="TOKEN"?i.unshift({label:t.text,value:t.token}):t.token==="result"?$(".result-count").text(t.text):t.token==="query"?$(".query-time").text(t.text+" seconds"):t.token==="total"?$(".total-time").text(t.text+" seconds"):i.push({label:t.text,value:t.token})});t(i)}else t([])}})},search:function(){},focus:function(){return!1},select:function(n,t){if(t.item.value!=="TOKEN")return this.value=t.item.label,c.doSearch("/api/TokenSearch/Search?queryId=",t.item.value),!1;var i=c.split(this.value);return i.pop(),i.push(t.item.label),this.value=i.join(" "),!1}});$(t).on("click",function(){c._curPage=1});$(s).on("click",function(){c._curPage+1<=c._pageCount.val()&&(c._curPage++,c.doSearch("/api/TokenSearch/SearchByToken?pageSize=10&pageNumber="+c._curPage+"&tokens=",$(n).val()))});$(h).on("click",function(){c._curPage-1>0&&(c._curPage--,c.doSearch("/api/TokenSearch/SearchByToken?pageSize=10&pageNumber="+c._curPage+"&tokens=",$(n).val()))})},doSearch:function(n,t){var i=this;$.ajax({url:i._url+n+t,type:"POST",contentType:"application/json",data:JSON.stringify(i.groupKey),success:function(n){if(i.getCommonQueries(),i.getHotItems(),$("#searchResults").children().remove(),n!==null){$("#resultQueryId").val(n.QueryId);i._totalResults.text(n.ResultCount);i._currentPage.text(i._curPage);i._pageCount.text(Math.ceil(n.ResultCount/10));var r=$("<ul>"),t=$("<div><\/div>");$.each(n.Results,function(n,r){t.append(i._template(r))});t.localize();$("#searchResults").append(t)}}})},split:function(n){return n.split(/\s+/)},extractLast:function(t){return n(t).pop()},getCommonQueries:function(){var n=this;$("#commonQueries").children().remove();$.ajax({url:n._url+"/api/TokenSearch/TopSearches?count=10",type:"POST",contentType:"application/json",data:JSON.stringify(n.groupKey),success:function(n){$.each(n,function(n,t){$("#commonQueries").append($("<li>").addClass("common-query").text(t.Text).data("token",t.Token))})}})},getHotItems:function(){var n=this;$("#commonItems").children().remove();$.ajax({url:n._url+"/api/TokenSearch/HotItems?itemCount=10",type:"POST",contentType:"application/json",data:JSON.stringify(n.groupKey),success:function(n){$.each(n,function(n,t){$("#commonItems").append($("<li>").addClass("pick-item").text("("+t.PickCount+") "+t.Metadata.ProductName))})}})}}}();!function(n){"use strict";function t(t,i){this.options=n.extend({},n.fn.combobox.defaults,i);this.template=this.options.template||this.template;this.$source=n(t);this.$container=this.setup();this.$element=this.$container.find("input[type=text]");this.$target=this.$container.find("input[type=hidden]");this.$button=this.$container.find(".dropdown-toggle");this.$menu=n(this.options.menu).appendTo("body");this.matcher=this.options.matcher||this.matcher;this.sorter=this.options.sorter||this.sorter;this.highlighter=this.options.highlighter||this.highlighter;this.shown=!1;this.selected=!1;this.renderLimit=this.options.renderLimit||-1;this.clearIfNoMatch=this.options.clearIfNoMatch;this.refresh();this.transferAttributes();this.listen()}var i="undefined"!=typeof Popper;t.prototype={constructor:t,setup:function(){var t=n(this.template());return this.$source.before(t),this.$source.hide(),t},disable:function(){this.$element.prop("disabled",!0);this.$button.attr("disabled",!0);this.disabled=!0;this.$container.addClass("combobox-disabled")},enable:function(){this.$element.prop("disabled",!1);this.$button.attr("disabled",!1);this.disabled=!1;this.$container.removeClass("combobox-disabled")},parse:function(){var f=this,i={},r=[],t=!1,u="";return this.$source.find("option").each(function(){var e=n(this);""!==e.val()?(i[e.text()]=e.val(),r.push(e.text()),e.prop("selected")&&(t=e.text(),u=e.val())):f.options.placeholder=e.text()}),this.map=i,t&&(this.$element.val(t),this.$target.val(u),this.$container.addClass("combobox-selected"),this.selected=!0),r},transferAttributes:function(){this.options.placeholder=this.$source.attr("data-placeholder")||this.options.placeholder;void 0!==this.options.appendId&&this.$element.attr("id",this.$source.attr("id")+this.options.appendId);this.$element.attr("placeholder",this.options.placeholder);this.$target.prop("name",this.$source.prop("name"));this.$target.val(this.$source.val());this.$source.removeAttr("name");this.$element.attr("required",this.$source.attr("required"));this.$element.attr("rel",this.$source.attr("rel"));this.$element.attr("title",this.$source.attr("title"));this.$element.attr("class",this.$source.attr("class"));this.$element.attr("tabindex",this.$source.attr("tabindex"));this.$source.removeAttr("tabindex");void 0!==this.$source.attr("disabled")&&this.disable()},select:function(){var n=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(n)).trigger("change"),this.$target.val(this.map[n]).trigger("change"),this.$source.val(this.map[n]).trigger("change"),this.$container.addClass("combobox-selected"),this.selected=!0,this.hide()},updater:function(n){return n},show:function(){var t=n.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),n(".dropdown-menu").on("mousedown",n.proxy(this.scrollSafety,this)),this.shown=!0,this},hide:function(){return this.$menu.hide(),n(".dropdown-menu").off("mousedown",n.proxy(this.scrollSafety,this)),this.$element.on("blur",n.proxy(this.blur,this)),this.shown=!1,this},lookup:function(){return this.query=this.$element.val(),this.process(this.source)},process:function(t){var i=this;return t=n.grep(t,function(n){return i.matcher(n)}),(t=this.sorter(t)).length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},template:function(){return"2"==this.options.bsVersion?'<div class="combobox-container"><input type="hidden" /> <div class="input-append"> <input type="text" autocomplete="off" /> <span class="add-on dropdown-toggle" data-dropdown="dropdown"> <span class="caret pulldown" style="vertical-align: middle"/> <i class="icon-remove remove"/> <\/span> <\/div> <\/div>':"3"==this.options.bsVersion?'<div class="combobox-container"> <input type="hidden" /> <div class="input-group"> <input type="text" autocomplete="off" /> <span class="input-group-addon dropdown-toggle" data-dropdown="dropdown"> <span class="caret pulldown" /> <span class="glyphicon glyphicon-remove remove" /> <\/span> <\/div> <\/div>':'<div class="combobox-container"> <input type="hidden" /> <div class="input-group"> <input type="text" autocomplete="off" /><span class="input-group-append"'+(i?' data-toggle="dropdown" data-reference="parent"':"")+'><span class="input-group-text dropdown-toggle'+(this.options.iconCaret?" custom-icon":"")+'">'+(this.options.iconCaret?'<span class="'+this.options.iconCaret+' pulldown" />':"")+(this.options.iconRemove?'<span class="'+this.options.iconRemove+' remove" />':'<span class="utf-remove remove" />')+"<\/span><\/span> <\/div> <\/div>"},matcher:function(n){return~n.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(n){for(var t,i=[],r=[],u=[];t=n.shift();)t.toLowerCase().indexOf(this.query.toLowerCase())?~t.indexOf(this.query)?r.push(t):u.push(t):i.push(t);return i.concat(r,u)},highlighter:function(n){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return n.replace(new RegExp("("+t+")","ig"),function(n,t){return"<strong>"+t+"<\/strong>"})},render:function(t){var i=this;return(t=n(t).map(function(t,r){if(!(~i.renderLimit&&t>=i.renderLimit))return(t=n(i.options.item).attr("data-value",r)).find("a").html(i.highlighter(r)),t[0]})).first().addClass("active"),this.$menu.html(t),this},next:function(){var t=this.$menu.find(".active").removeClass("active").next();t.length||(t=n(this.$menu.find("li")[0]));t.addClass("active")},prev:function(){var n=this.$menu.find(".active").removeClass("active").prev();n.length||(n=this.$menu.find("li").last());n.addClass("active")},toggle:function(){this.disabled||(this.$container.hasClass("combobox-selected")?(this.clearTarget(),this.triggerChange(),this.clearElement()):this.shown?this.hide():(this.clearElement(),this.lookup()))},scrollSafety:function(n){"UL"==n.target.tagName&&this.$element.off("blur")},clearElement:function(){this.$element.val("").focus()},clearTarget:function(){this.$source.val("");this.$target.val("");this.$container.removeClass("combobox-selected");this.selected=!1},triggerChange:function(){this.$source.trigger("change")},refresh:function(){this.source=this.parse();this.options.items=this.source.length},listen:function(){this.$element.on("focus",n.proxy(this.focus,this)).on("blur",n.proxy(this.blur,this)).on("keypress",n.proxy(this.keypress,this)).on("keyup",n.proxy(this.keyup,this));this.eventSupported("keydown")&&this.$element.on("keydown",n.proxy(this.keydown,this));this.$menu.on("click",n.proxy(this.click,this)).on("mouseenter","li",n.proxy(this.mouseenter,this)).on("mouseleave","li",n.proxy(this.mouseleave,this));this.$button.on("click",n.proxy(this.toggle,this))},eventSupported:function(n){var t=n in this.$element;return t||(this.$element.setAttribute(n,"return;"),t="function"==typeof this.$element[n]),t},move:function(n){if(this.shown){switch(n.keyCode){case 9:case 13:case 27:n.preventDefault();break;case 38:n.preventDefault();this.prev();this.fixMenuScroll();break;case 40:n.preventDefault();this.next();this.fixMenuScroll()}n.stopPropagation()}},fixMenuScroll:function(){var n=this.$menu.find(".active");if(n.length){var t=n.position().top,i=t+n.height(),r=this.$menu.scrollTop(),u=this.$menu.height();u<i?this.$menu.scrollTop(r+i-u):t<0&&this.$menu.scrollTop(r+t)}},keydown:function(t){this.suppressKeyPressRepeat=~n.inArray(t.keyCode,[40,38,9,13,27]);this.move(t)},keypress:function(n){this.suppressKeyPressRepeat||this.move(n)},keyup:function(n){switch(n.keyCode){case 40:this.shown||this.toggle();break;case 39:case 38:case 37:case 36:case 35:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.clearTarget();this.lookup()}n.stopPropagation();n.preventDefault()},focus:function(){this.focused=!0},blur:function(){var n=this,t;this.focused=!1;t=this.$element.val();this.selected||""===t||(n.clearIfNoMatch&&this.$element.val(""),this.$source.val("").trigger("change"),this.$target.val("").trigger("change"));!this.mousedover&&this.shown&&setTimeout(function(){n.hide()},200)},click:function(n){n.stopPropagation();n.preventDefault();this.select();this.$element.focus()},mouseenter:function(t){this.mousedover=!0;this.$menu.find(".active").removeClass("active");n(t.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1}};n.fn.combobox=function(i){return this.each(function(){var u=n(this),r=u.data("combobox"),f="object"==typeof i&&i;r||u.data("combobox",r=new t(this,f));"string"==typeof i&&r[i]()})};n.fn.combobox.defaults={bsVersion:"4",menu:'<ul class="typeahead typeahead-long dropdown-menu"><\/ul>',item:'<li><a href="#" class="dropdown-item"><\/a><\/li>',iconCaret:void 0,iconRemove:void 0,clearIfNoMatch:!0};n.fn.combobox.Constructor=t}(window.jQuery)