(function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else if(typeof module==="object"&&module.exports){e(require("jquery"))}else{e(jQuery)}})(function(f,i){"use strict";var r={background:"rgba(255, 255, 255, 0.8)",backgroundClass:"",image:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 1000'><circle r='80' cx='500' cy='90'/><circle r='80' cx='500' cy='910'/><circle r='80' cx='90' cy='500'/><circle r='80' cx='910' cy='500'/><circle r='80' cx='212' cy='212'/><circle r='80' cx='788' cy='212'/><circle r='80' cx='212' cy='788'/><circle r='80' cx='788' cy='788'/></svg>",imageAnimation:"2000ms rotate_right",imageAutoResize:true,imageResizeFactor:1,imageColor:"#202020",imageClass:"",imageOrder:1,fontawesome:"",fontawesomeAnimation:"",fontawesomeAutoResize:true,fontawesomeResizeFactor:1,fontawesomeColor:"#202020",fontawesomeOrder:2,custom:"",customAnimation:"",customAutoResize:true,customResizeFactor:1,customOrder:3,text:"",textAnimation:"",textAutoResize:true,textResizeFactor:.5,textColor:"#202020",textClass:"",textOrder:4,progress:false,progressAutoResize:true,progressResizeFactor:.25,progressColor:"#a0a0a0",progressClass:"",progressOrder:5,progressFixedPosition:"",progressFixedMargin:"",progressSpeed:200,progressMin:0,progressMax:100,size:50,maxSize:120,minSize:20,direction:"column",fade:true,resizeInterval:50,zIndex:2147483647};var g={overlay:{"box-sizing":"border-box",position:"relative",display:"flex","flex-wrap":"nowrap","align-items":"center","justify-content":"space-around"},element:{"box-sizing":"border-box",overflow:"visible",flex:"0 0 auto",display:"flex","justify-content":"center","align-items":"center"},element_svg:{width:"100%",height:"100%"},progress_fixed:{position:"absolute",left:"0",width:"100%"},progress_wrapper:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},progress_bar:{position:"absolute",left:"0"}};var d={count:0,container:i,settings:i,wholePage:i,resizeIntervalId:i,text:i,progress:i};var s={animations:["rotate_right","rotate_left","fadein","pulse"],progressPosition:["top","bottom"]};var c={animations:{name:"rotate_right",time:"2000ms"},fade:[400,200]};f.LoadingOverlaySetup=function(e){f.extend(true,r,e)};f.LoadingOverlay=function(e,s){switch(e.toLowerCase()){case"show":a("body",f.extend(true,{},r,s));break;case"hide":t("body",s);break;case"resize":o("body",s);break;case"text":n("body",s);break;case"progress":l("body",s);break}};f.fn.LoadingOverlay=function(e,s){switch(e.toLowerCase()){case"show":return this.each(function(){a(this,f.extend(true,{},r,s))});case"hide":return this.each(function(){t(this,s)});case"resize":return this.each(function(){o(this,s)});case"text":return this.each(function(){n(this,s)});case"progress":return this.each(function(){l(this,s)})}};function a(e,s){e=f(e);s.size=w(s.size);s.maxSize=parseInt(s.maxSize,10)||0;s.minSize=parseInt(s.minSize,10)||0;s.resizeInterval=parseInt(s.resizeInterval,10)||0;var r=p(e);var i=u(e);if(i===false){i=f.extend({},d);i.container=e;i.wholePage=e.is("body");var a,t=0;if(s.image)t++;if(s.text)t++;if(s.progress)t++;if(t>1){a=f.extend(true,{},g.overlay,{"justify-content":"center"})}else{a=g.overlay}r=f("<div>",{class:"loadingoverlay"}).css(a).css("flex-direction",s.direction.toLowerCase()==="row"?"row":"column");if(s.backgroundClass){r.addClass(s.backgroundClass)}else{r.css("background",s.background)}if(i.wholePage){r.css({position:"fixed",top:0,left:0,width:"100%",height:"100%"})}if(typeof s.zIndex!=="undefined")r.css("z-index",s.zIndex);if(s.image){if(f.isArray(s.imageColor)){if(s.imageColor.length===0){s.imageColor=false}else if(s.imageColor.length===1){s.imageColor={fill:s.imageColor[0]}}else{s.imageColor={fill:s.imageColor[0],stroke:s.imageColor[1]}}}else if(s.imageColor){s.imageColor={fill:s.imageColor}}var o=v(r,s.imageOrder,s.imageAutoResize,s.imageResizeFactor,s.imageAnimation);if(s.image.slice(0,4).toLowerCase()==="<svg"&&s.image.slice(-6).toLowerCase()==="</svg>"){o.append(s.image);o.children().css(g.element_svg);if(!s.imageClass&&s.imageColor)o.find("*").css(s.imageColor)}else if(s.image.slice(-4).toLowerCase()===".svg"||s.image.slice(0,14).toLowerCase()==="data:image/svg"){f.ajax({url:s.image,type:"GET",dataType:"html",global:false}).done(function(e){o.html(e);o.children().css(g.element_svg);if(!s.imageClass&&s.imageColor)o.find("*").css(s.imageColor)})}else{o.css({"background-image":"url("+s.image+")","background-position":"center","background-repeat":"no-repeat","background-size":"cover"})}if(s.imageClass)o.addClass(s.imageClass)}if(s.fontawesome){var o=v(r,s.fontawesomeOrder,s.fontawesomeAutoResize,s.fontawesomeResizeFactor,s.fontawesomeAnimation).addClass("loadingoverlay_fa");f("<div>",{class:s.fontawesome}).appendTo(o);if(s.fontawesomeColor)o.css("color",s.fontawesomeColor)}if(s.custom){var o=v(r,s.customOrder,s.customAutoResize,s.customResizeFactor,s.customAnimation).append(s.custom)}if(s.text){i.text=v(r,s.textOrder,s.textAutoResize,s.textResizeFactor,s.textAnimation).addClass("loadingoverlay_text").text(s.text);if(s.textClass){i.text.addClass(s.textClass)}else if(s.textColor){i.text.css("color",s.textColor)}}if(s.progress){var o=v(r,s.progressOrder,s.progressAutoResize,s.progressResizeFactor,false).addClass("loadingoverlay_progress");var n=f("<div>").css(g.progress_wrapper).appendTo(o);i.progress={bar:f("<div>").css(g.progress_bar).appendTo(n),fixed:false,margin:0,min:parseFloat(s.progressMin),max:parseFloat(s.progressMax),speed:parseInt(s.progressSpeed,10)};var l=(s.progressFixedPosition+"").replace(/\s\s+/g," ").toLowerCase().split(" ");if(l.length===2&&h(l[0])){i.progress.fixed=l[0];i.progress.margin=w(l[1])}else if(l.length===2&&h(l[1])){i.progress.fixed=l[1];i.progress.margin=w(l[0])}else if(l.length===1&&h(l[0])){i.progress.fixed=l[0];i.progress.margin=0}if(i.progress.fixed==="top"){o.css(g.progress_fixed).css("top",i.progress.margin?i.progress.margin.value+(i.progress.margin.fixed?i.progress.margin.units:"%"):0)}else if(i.progress.fixed==="bottom"){o.css(g.progress_fixed).css("top","auto")}if(s.progressFixedMargin){i.progress.bar.css("margin",s.progressFixedMargin)}if(s.progressClass){i.progress.bar.addClass(s.progressClass)}else if(s.progressColor){i.progress.bar.css("background",s.progressColor)}}if(!s.fade){s.fade=[0,0]}else if(s.fade===true){s.fade=c.fade}else if(typeof s.fade==="string"||typeof s.fade==="number"){s.fade=[s.fade,s.fade]}else if(f.isArray(s.fade)&&s.fade.length<2){s.fade=[s.fade[0],s.fade[0]]}s.fade=[parseInt(s.fade[0],10),parseInt(s.fade[1],10)];i.settings=s;r.data("loadingoverlay_data",i);e.data("loadingoverlay",r);r.fadeTo(0,.01).appendTo("body");m(e,true);if(s.resizeInterval>0){i.resizeIntervalId=setInterval(function(){m(e,false)},s.resizeInterval)}r.fadeTo(s.fade[0],1)}i.count++}function t(e,s){e=f(e);var r=p(e);var i=u(e);if(i===false)return;i.count--;if(s||i.count<=0){r.animate({opacity:0},i.settings.fade[1],function(){if(i.resizeIntervalId)clearInterval(i.resizeIntervalId);f(this).remove();e.removeData("loadingoverlay")})}}function o(e){m(f(e),true)}function n(e,s){e=f(e);var r=u(e);if(r===false||!r.text)return;if(s===false){r.text.hide()}else{r.text.show().text(s)}}function l(e,s){e=f(e);var r=u(e);if(r===false||!r.progress)return;if(s===false){r.progress.bar.hide()}else{var i=((parseFloat(s)||0)-r.progress.min)*100/(r.progress.max-r.progress.min);if(i<0)i=0;if(i>100)i=100;r.progress.bar.show().animate({width:i+"%"},r.progress.speed)}}function m(e,r){var s=p(e);var i=u(e);if(i===false)return;if(!i.wholePage){var a=e.css("position")==="fixed";var t=a?e[0].getBoundingClientRect():e.offset();s.css({position:a?"fixed":"absolute",top:t.top+parseInt(e.css("border-top-width"),10),left:t.left+parseInt(e.css("border-left-width"),10),width:e.innerWidth(),height:e.innerHeight()})}if(i.settings.size){var o=i.wholePage?f(window):e;var n=i.settings.size.value;if(!i.settings.size.fixed){n=Math.min(o.innerWidth(),o.innerHeight())*n/100;if(i.settings.maxSize&&n>i.settings.maxSize)n=i.settings.maxSize;if(i.settings.minSize&&n<i.settings.minSize)n=i.settings.minSize}s.children(".loadingoverlay_element").each(function(){var e=f(this);if(r||e.data("loadingoverlay_autoresize")){var s=e.data("loadingoverlay_resizefactor");if(e.hasClass("loadingoverlay_fa")||e.hasClass("loadingoverlay_text")){e.css("font-size",n*s+i.settings.size.units)}else if(e.hasClass("loadingoverlay_progress")){i.progress.bar.css("height",n*s+i.settings.size.units);if(!i.progress.fixed){i.progress.bar.css("top",e.position().top).css("top","-="+n*s*.5+i.settings.size.units)}else if(i.progress.fixed==="bottom"){e.css("bottom",i.progress.margin?i.progress.margin.value+(i.progress.margin.fixed?i.progress.margin.units:"%"):0).css("bottom","+="+n*s+i.settings.size.units)}}else{e.css({width:n*s+i.settings.size.units,height:n*s+i.settings.size.units})}}})}}function p(e){return e.data("loadingoverlay")}function u(e){var s=p(e);var r=typeof s==="undefined"?i:s.data("loadingoverlay_data");if(typeof r==="undefined"){f(".loadingoverlay").each(function(){var e=f(this);var s=e.data("loadingoverlay_data");if(!document.body.contains(s.container[0])){if(s.resizeIntervalId)clearInterval(s.resizeIntervalId);e.remove()}});return false}else{s.toggle(e.is(":visible"));return r}}function v(e,s,r,i,a){var t=f("<div>",{class:"loadingoverlay_element",css:{order:s}}).css(g.element).data({loadingoverlay_autoresize:r,loadingoverlay_resizefactor:i}).appendTo(e);if(a===true)a=c.animations.time+" "+c.animations.name;if(typeof a==="string"){var o;var n;var l=a.replace(/\s\s+/g," ").toLowerCase().split(" ");if(l.length===2&&x(l[0])&&y(l[1])){o=l[1];n=l[0]}else if(l.length===2&&x(l[1])&&y(l[0])){o=l[0];n=l[1]}else if(l.length===1&&x(l[0])){o=c.animations.name;n=l[0]}else if(l.length===1&&y(l[0])){o=l[0];n=c.animations.time}t.css({"animation-name":"loadingoverlay_animation__"+o,"animation-duration":n,"animation-timing-function":"linear","animation-iteration-count":"infinite"})}return t}function x(e){return!isNaN(parseFloat(e))&&(e.slice(-1)==="s"||e.slice(-2)==="ms")}function y(e){return s.animations.indexOf(e)>-1}function h(e){return s.progressPosition.indexOf(e)>-1}function w(e){if(!e||e<0){return false}else if(typeof e==="string"&&["vmin","vmax"].indexOf(e.slice(-4))>-1){return{fixed:true,units:e.slice(-4),value:e.slice(0,-4)}}else if(typeof e==="string"&&["rem"].indexOf(e.slice(-3))>-1){return{fixed:true,units:e.slice(-3),value:e.slice(0,-3)}}else if(typeof e==="string"&&["px","em","cm","mm","in","pt","pc","vh","vw"].indexOf(e.slice(-2))>-1){return{fixed:true,units:e.slice(-2),value:e.slice(0,-2)}}else{return{fixed:false,units:"px",value:parseFloat(e)}}}f(function(){f("head").append(["<style>","@-webkit-keyframes loadingoverlay_animation__rotate_right {","to {","-webkit-transform : rotate(360deg);","transform : rotate(360deg);","}","}","@keyframes loadingoverlay_animation__rotate_right {","to {","-webkit-transform : rotate(360deg);","transform : rotate(360deg);","}","}","@-webkit-keyframes loadingoverlay_animation__rotate_left {","to {","-webkit-transform : rotate(-360deg);","transform : rotate(-360deg);","}","}","@keyframes loadingoverlay_animation__rotate_left {","to {","-webkit-transform : rotate(-360deg);","transform : rotate(-360deg);","}","}","@-webkit-keyframes loadingoverlay_animation__fadein {","0% {","opacity   : 0;","-webkit-transform : scale(0.1, 0.1);","transform : scale(0.1, 0.1);","}","50% {","opacity   : 1;","}","100% {","opacity   : 0;","-webkit-transform : scale(1, 1);","transform : scale(1, 1);","}","}","@keyframes loadingoverlay_animation__fadein {","0% {","opacity   : 0;","-webkit-transform : scale(0.1, 0.1);","transform : scale(0.1, 0.1);","}","50% {","opacity   : 1;","}","100% {","opacity   : 0;","-webkit-transform : scale(1, 1);","transform : scale(1, 1);","}","}","@-webkit-keyframes loadingoverlay_animation__pulse {","0% {","-webkit-transform : scale(0, 0);","transform : scale(0, 0);","}","50% {","-webkit-transform : scale(1, 1);","transform : scale(1, 1);","}","100% {","-webkit-transform : scale(0, 0);","transform : scale(0, 0);","}","}","@keyframes loadingoverlay_animation__pulse {","0% {","-webkit-transform : scale(0, 0);","transform : scale(0, 0);","}","50% {","-webkit-transform : scale(1, 1);","transform : scale(1, 1);","}","100% {","-webkit-transform : scale(0, 0);","transform : scale(0, 0);","}","}","</style>"].join(" "))})});