var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};function validate_regex(a,b){var c=new RegExp(b.slice(1,-1));return c.test(a)}function ucfirst(a){return a.charAt(0).toUpperCase()+a.slice(1)}function compare_strings(a,b){return a=(a+"").trim(),b=(b+"").trim(),a===b}function number_format(a){return a=parseFloat(a),currency.symbol+a.toLocaleString(currency.code,{minimumFractionDigits:currency.decimals,maximumFractionDigits:currency.decimals})}function number_round(a){return parseFloat(parseFloat(a).toFixed(2))}function compare_dates(a,b){return"now"===a?(a=new Date,a.setHours(a.getHours()+3)):a=new Date(a.replace(/\s/,"T")),"now"===b?(b=new Date,b.setHours(b.getHours()+3)):b=new Date(b.replace(/\s/,"T")),a<=b}function compare_dates_between(a,b,c){return"now"===a?(a=new Date,a.setHours(a.getHours()+3)):a=new Date(a.replace(/\s/,"T")),"now"===b?(b=new Date,b.setHours(b.getHours()+3)):b=new Date(b.replace(/\s/,"T")),"now"===c?(c=new Date,c.setHours(c.getHours()+3)):c=new Date(c.replace(/\s/,"T")),b<=a&&a<=c}function utc2local_format(a){var b=new Date(a.replace(/\s/,"T"));return b.toLocaleDateString()}function in_array(a,b){var c,d=b.length;for(c=0;c").attr("ratio",b).appendTo(a)}function unset_loading_button(a){var b=!!(1","button__icon--left":"Filtrar ","fa-search":"",script:""},d=a.attr("data-label"),e=!1;Object.keys(c).forEach(function(a){d.includes(a)&&(d=c[a],e=!0)}),b?setTimeout(function(){a.removeClass("button--inactive"),a.removeAttr("disabled","disabled"),e?a.html(d):a.text(d)},1e3):(a.removeClass("button--inactive"),a.removeAttr("disabled","disabled"),e?a.html(d):a.text(d))}function set_loading_spinner(a,b){a.html("
")}function alert_message(a,b){var c="
";return c+="",c+="

"+b+"

",c+="
",c}function success(a,b){var c=!!(2$1").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/<(\/?strong)>/g,"<$1>")},formatGroup:function(c,a){return"
"+a+"
"},delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:e,onSearchComplete:e,onSearchError:e,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:b,paramName:"query",transformResult:function(a){return"string"==typeof a?p.parseJSON(a):a},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1},a.prototype={initialize:function(){var b,h=this,d="."+h.classes.suggestion,e=h.classes.selected,f=h.options;h.element.setAttribute("autocomplete","off"),h.noSuggestionsContainer=p("
").html(this.options.noSuggestionNotice).get(0),h.suggestionsContainer=a.utils.createNode(f.containerClass),b=p(h.suggestionsContainer),b.appendTo(f.appendTo||"body"),"auto"!==f.width&&b.css("width",f.width),b.on("mouseover.autocomplete",d,function(){h.activate(p(this).data("index"))}),b.on("mouseout.autocomplete",function(){h.selectedIndex=-1,b.children("."+e).removeClass(e)}),b.on("click.autocomplete",d,function(){h.select(p(this).data("index"))}),b.on("click.autocomplete",function(){clearTimeout(h.blurTimeoutId)}),h.fixPositionCapture=function(){h.visible&&h.fixPosition()},p(window).on("resize.autocomplete",h.fixPositionCapture),h.el.on("keydown.autocomplete",function(b){h.onKeyPress(b)}),h.el.on("keyup.autocomplete",function(b){h.onKeyUp(b)}),h.el.on("blur.autocomplete",function(){h.onBlur()}),h.el.on("focus.autocomplete",function(){h.onFocus()}),h.el.on("change.autocomplete",function(b){h.onKeyUp(b)}),h.el.on("input.autocomplete",function(b){h.onKeyUp(b)})},onFocus:function(){var b=this;b.fixPosition(),b.el.val().length>=b.options.minChars&&b.onValueChange()},onBlur:function(){var b=this;b.blurTimeoutId=setTimeout(function(){b.hide()},200)},abortAjax:function(){var b=this;b.currentRequest&&(b.currentRequest.abort(),b.currentRequest=null)},setOptions:function(a){var b=this,c=p.extend({},b.options,a);b.isLocal=Array.isArray(c.lookup),b.isLocal&&(c.lookup=b.verifySuggestionsFormat(c.lookup)),c.orientation=b.validateOrientation(c.orientation,"bottom"),p(b.suggestionsContainer).css({"max-height":c.maxHeight+"px",width:c.width+"px","z-index":c.zIndex}),this.options=c},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var b=this;b.disabled=!0,clearTimeout(b.onChangeTimeout),b.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var a=this,b=p(a.suggestionsContainer),c=b.parent().get(0);if(c===document.body||a.options.forceFixPosition){var d=a.options.orientation,q=b.outerHeight(),f=a.el.outerHeight(),g=a.el.offset(),h={top:g.top,left:g.left};if("auto"===d){var i=p(window).height(),j=p(window).scrollTop(),k=-j+g.top-q,l=j+i-(g.top+f+q);d=Math.max(k,l)===k?"top":"bottom"}if(h.top+="top"===d?-q:f,c!==document.body){var m,r=b.css("opacity");a.visible||b.css("opacity",0).show(),m=b.offsetParent().offset(),h.top-=m.top,h.top+=c.scrollTop,h.left-=m.left,a.visible||b.css("opacity",r).hide()}"auto"===a.options.width&&(h.width=a.el.outerWidth()+"px"),b.css(h)}},isCursorAtEnd:function(){var e,f=this,b=f.el.val().length,c=f.element.selectionStart;return"number"==typeof c?c===b:!document.selection||(e=document.selection.createRange(),e.moveStart("character",-b),b===e.text.length)},onKeyPress:function(d){var a=this;if(!a.disabled&&!a.visible&&d.which===c.DOWN&&a.currentValue)return void a.suggest();if(!a.disabled&&a.visible){switch(d.which){case c.ESC:a.el.val(a.currentValue),a.hide();break;case c.RIGHT:if(a.hint&&a.options.onHint&&a.isCursorAtEnd()){a.selectHint();break}return;case c.TAB:if(a.hint&&a.options.onHint)return void a.selectHint();if(-1===a.selectedIndex)return void a.hide();if(a.select(a.selectedIndex),!1===a.options.tabDisabled)return;break;case c.RETURN:if(-1===a.selectedIndex)return void a.hide();a.select(a.selectedIndex);break;case c.UP:a.moveUp();break;case c.DOWN:a.moveDown();break;default:return;}d.stopImmediatePropagation(),d.preventDefault()}},onKeyUp:function(d){var a=this;if(!a.disabled){switch(d.which){case c.UP:case c.DOWN:return;}clearTimeout(a.onChangeTimeout),a.currentValue!==a.el.val()&&(a.findBestHint(),0g&&(a.suggestions=a.suggestions.slice(0,g)),a},getSuggestions:function(j){var a,b,k,l,m=this,g=m.options,h=g.serviceUrl;if(g.params[g.paramName]=j,!1!==g.onSearchStart.call(m.element,g.params)){if(b=g.ignoreParams?null:g.params,p.isFunction(g.lookup))return void g.lookup(j,function(b){m.suggestions=b.suggestions,m.suggest(),g.onSearchComplete.call(m.element,j,b.suggestions)});m.isLocal?a=m.getSuggestionsLocal(j):(p.isFunction(h)&&(h=h.call(m.element,j)),k=h+"?"+p.param(b||{}),a=m.cachedResponse[k]),a&&Array.isArray(a.suggestions)?(m.suggestions=a.suggestions,m.suggest(),g.onSearchComplete.call(m.element,j,a.suggestions)):m.isBadQuery(j)?g.onSearchComplete.call(m.element,j,[]):(m.abortAjax(),l={url:h,data:b,type:g.type,dataType:g.dataType},p.extend(l,g.ajaxSettings),m.currentRequest=p.ajax(l).done(function(b){var a;m.currentRequest=null,a=g.transformResult(b,j),m.processResponse(a,j,k),g.onSearchComplete.call(m.element,j,a.suggestions)}).fail(function(b,a,c){g.onSearchError.call(m.element,j,b,a,c)}))}},isBadQuery:function(d){if(!this.options.preventBadQueries)return!1;for(var a=this.badQueries,b=a.length;b--;)if(0===d.indexOf(a[b]))return!0;return!1},hide:function(){var a=this,b=p(a.suggestionsContainer);p.isFunction(a.options.onHide)&&a.visible&&a.options.onHide.call(a.element,b),a.visible=!1,a.selectedIndex=-1,clearTimeout(a.onChangeTimeout),p(a.suggestionsContainer).hide(),a.signalHint(null)},suggest:function(){if(!this.suggestions.length)return void(this.options.showNoSuggestionNotice?this.noSuggestions():this.hide());var o,a=this,c=a.options,d=c.groupBy,e=c.formatResult,f=a.getQuery(a.currentValue),g=a.classes.suggestion,h=a.classes.selected,i=p(a.suggestionsContainer),j=p(a.noSuggestionsContainer),k=c.beforeRender,l="",q=function(b){var a=b.data[d];return o===a?"":(o=a,c.formatGroup(b,o))};return c.triggerSelectOnValidInput&&a.isExactMatch(f)?void a.select(0):(p.each(a.suggestions,function(c,a){d&&(l+=q(a,f,c)),l+="
"+e(a,f,c)+"
"}),this.adjustContainerWidth(),j.detach(),i.html(l),p.isFunction(k)&&k.call(a.element,i,a.suggestions),a.fixPosition(),i.show(),c.autoSelectFirst&&(a.selectedIndex=0,i.scrollTop(0),i.children("."+g).first().addClass(h)),a.visible=!0,void a.findBestHint())},noSuggestions:function(){var a=this,b=a.options.beforeRender,c=p(a.suggestionsContainer),d=p(a.noSuggestionsContainer);this.adjustContainerWidth(),d.detach(),c.empty(),c.append(d),p.isFunction(b)&&b.call(a.element,c,a.suggestions),a.fixPosition(),c.show(),a.visible=!0},adjustContainerWidth:function(){var a,f=this,c=f.options,d=p(f.suggestionsContainer);"auto"===c.width?(a=f.el.outerWidth(),d.css("width",0h.selectedIndex?(b=f.get(h.selectedIndex),p(b).addClass(d),b):null},selectHint:function(){var a=this,b=p.inArray(a.hint,a.suggestions);a.select(b)},select:function(c){var a=this;a.hide(),a.onSelect(c)},moveUp:function(){var a=this;if(-1!==a.selectedIndex)return 0===a.selectedIndex?(p(a.suggestionsContainer).children("."+a.classes.suggestion).first().removeClass(a.classes.selected),a.selectedIndex=-1,a.ignoreValueChange=!1,a.el.val(a.currentValue),void a.findBestHint()):void a.adjustScroll(a.selectedIndex-1)},moveDown:function(){var b=this;b.selectedIndex!==b.suggestions.length-1&&b.adjustScroll(b.selectedIndex+1)},adjustScroll:function(a){var b=this,c=b.activate(a);if(c){var d,i,j,k=p(c).outerHeight();d=c.offsetTop,i=p(b.suggestionsContainer).scrollTop(),j=i+b.options.maxHeight-k,dj&&p(b.suggestionsContainer).scrollTop(d-b.options.maxHeight+k),b.options.preserveInput||(b.ignoreValueChange=!0,b.el.val(b.getValue(b.suggestions[a].value))),b.signalHint(null)}},onSelect:function(a){var b=this,c=b.options.onSelect,d=b.suggestions[a];b.currentValue=b.getValue(d.value),b.currentValue===b.el.val()||b.options.preserveInput||b.el.val(b.currentValue),b.signalHint(null),b.suggestions=[],b.selection=d,p.isFunction(c)&&c.call(b.element,d)},getValue:function(f){var a,g,h=this,d=h.options.delimiter;return d?(a=h.currentValue,g=a.split(d),1===g.length?f:a.substr(0,a.length-g[g.length-1].length)+f):f},dispose:function(){var a=this;a.el.off(".autocomplete").removeData("autocomplete"),p(window).off("resize.autocomplete",a.fixPositionCapture),p(a.suggestionsContainer).remove()}},p.fn.devbridgeAutocomplete=function(b,c){return arguments.length?this.each(function(){var d=p(this),e=d.data("autocomplete");"string"==typeof b?e&&"function"==typeof e[b]&&e[b](c):(e&&e.dispose&&e.dispose(),e=new a(this,b),d.data("autocomplete",e))}):this.first().data("autocomplete")},p.fn.autocomplete||(p.fn.autocomplete=p.fn.devbridgeAutocomplete)});